diff plugins/tasks/mpiwg_geobrowser_view.inc @ 3:19f75fe342eb

minor changes
author Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de>
date Mon, 12 Oct 2015 08:33:28 +0200
parents b57c7821382f
children 1b6cde0e4b83
line wrap: on
line diff
--- a/plugins/tasks/mpiwg_geobrowser_view.inc	Thu May 28 10:28:12 2015 +0200
+++ b/plugins/tasks/mpiwg_geobrowser_view.inc	Mon Oct 12 08:33:28 2015 +0200
@@ -43,25 +43,32 @@
 }
 
 function mpiwg_geobrowser_mpiwg_geobrowser_view_page($mpiwg_geobrowser) {
-    drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/css/mpiwg_geobrowser_style.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
+	drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/css/mpiwg_geobrowser_style.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
     drupal_add_js(drupal_get_path('module', "mpiwg_geobrowser") . '/lib/moment.min.js');
-    drupal_add_js(libraries_get_path("platin") . '/platin.js');
+    drupal_add_js(drupal_get_path('module', "mpiwg_geobrowser") . '/lib/filesaver/FileSaver.min.js');
+    #drupal_add_js(libraries_get_path("platin") . '/platin.js');
+    drupal_add_js(libraries_get_path("platin") . '/devel/platin.js');
     drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/lib/GeoTemCo/css/platin.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
-	
+    drupal_add_css(libraries_get_path("platin") . '/devel/css/platin.css');
+    drupal_add_css(libraries_get_path("platin") . '/devel/css/style.css');
     $task = page_manager_get_task('mpiwg_geobrowser_view');
-
+	dpm($task);
     ctools_include('context');
     ctools_include('context-task-handler');
 
     drupal_set_title($mpiwg_geobrowser->item_description);
+    dpm($mpiwg_geobrowser);
     $uri = entity_uri('mpiwg_geobrowser', $mpiwg_geobrowser);
     drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
     drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);
     $contexts = ctools_context_handler_get_task_contexts($task, '', array($mpiwg_geobrowser));
-
     $output = ctools_context_handler_render($task, '', $contexts, array($mpiwg_geobrowser->mpiwg_geobrowser_instance_id));
+  	dpm($contexts);
+  	dpm($output);
+  	
     $geoTemCoIntegration = '
         <script type="text/javascript">
+	
             var mpiwg_geobrowser_widgetsCount = 0;
             var mpiwg_geobrowser_widgetsLoaded = 0;
             var mpiwg_geobrowser_noWidgetLoaded = true;
@@ -70,7 +77,8 @@
             
             Drupal.behaviors.mpiwg_geobrowser_entity = {
                 attach: function (context, settings) {
-//                    jq1110(document).ready(function(){
+	
+                   // jQuery(document).ready(function(){
                         if (context[0] !== undefined && context[0].attributes !== undefined) {
                             var contextAttributes = context[0].attributes;
                             for (i=0; i<contextAttributes.length; i++) {
@@ -82,7 +90,10 @@
                         
                         document.addEventListener("mpiwg_geobrowser_widget_loaded", function (e) {
                             if (mpiwg_geobrowser_noWidgetLoaded) {
-                                mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount/2;
+
+                                mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount;
+
+
                                 mpiwg_geobrowser_noWidgetLoaded = false;
                             }
                             mpiwg_geobrowser_widgetsLoaded++;
@@ -90,15 +101,26 @@
                                 document.dispatchEvent(allWidgetsLoadedEvent);
                             }
                         }, false);
-//                    });
+		//	});
+                 
                 }
             }
         </script>
     ';
-    $output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"];
+    
+    
+
+    if (isset($output["content"])){ //unterschiedliches Verhalten, je nach dem ob der Inhalt noch in einen admin rahmen eingebettet ist
+    //$output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"];
+    $output["content"]["#markup"]  = $geoTemCoIntegration . $output["content"]["#markup"];
+   
     if ($output != FALSE) {
         return $output;
     }
+    } else {
+ 
+   return $geoTemCoIntegration . $output;
+   }
 
     $function = 'mpiwg_geobrowser_page_view';
     foreach (module_implements('mpiwg_geobrowser_override') as $module) {