diff plugins/tasks/mpiwg_geobrowser_view.inc @ 1:ea066ce001bd

bug fixes, works now without admin rights
author Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de>
date Fri, 29 May 2015 13:59:32 +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	Fri May 29 13:59:32 2015 +0200
@@ -45,9 +45,12 @@
 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_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');
 
     ctools_include('context');
@@ -58,10 +61,16 @@
     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));
+  
     $geoTemCoIntegration = '
         <script type="text/javascript">
+	
+	 
+   
+
+	    
+	
             var mpiwg_geobrowser_widgetsCount = 0;
             var mpiwg_geobrowser_widgetsLoaded = 0;
             var mpiwg_geobrowser_noWidgetLoaded = true;
@@ -70,7 +79,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 +92,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 +103,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) {