comparison 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
comparison
equal deleted inserted replaced
0:b57c7821382f 3:19f75fe342eb
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 function mpiwg_geobrowser_mpiwg_geobrowser_view_page($mpiwg_geobrowser) { 45 function mpiwg_geobrowser_mpiwg_geobrowser_view_page($mpiwg_geobrowser) {
46 drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/css/mpiwg_geobrowser_style.css', array('group' => CSS_DEFAULT, 'type' => 'file')); 46 drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/css/mpiwg_geobrowser_style.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
47 drupal_add_js(drupal_get_path('module', "mpiwg_geobrowser") . '/lib/moment.min.js'); 47 drupal_add_js(drupal_get_path('module', "mpiwg_geobrowser") . '/lib/moment.min.js');
48 drupal_add_js(libraries_get_path("platin") . '/platin.js'); 48 drupal_add_js(drupal_get_path('module', "mpiwg_geobrowser") . '/lib/filesaver/FileSaver.min.js');
49 #drupal_add_js(libraries_get_path("platin") . '/platin.js');
50 drupal_add_js(libraries_get_path("platin") . '/devel/platin.js');
49 drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/lib/GeoTemCo/css/platin.css', array('group' => CSS_DEFAULT, 'type' => 'file')); 51 drupal_add_css(drupal_get_path('module', 'mpiwg_geobrowser') . '/lib/GeoTemCo/css/platin.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
50 52 drupal_add_css(libraries_get_path("platin") . '/devel/css/platin.css');
53 drupal_add_css(libraries_get_path("platin") . '/devel/css/style.css');
51 $task = page_manager_get_task('mpiwg_geobrowser_view'); 54 $task = page_manager_get_task('mpiwg_geobrowser_view');
52 55 dpm($task);
53 ctools_include('context'); 56 ctools_include('context');
54 ctools_include('context-task-handler'); 57 ctools_include('context-task-handler');
55 58
56 drupal_set_title($mpiwg_geobrowser->item_description); 59 drupal_set_title($mpiwg_geobrowser->item_description);
60 dpm($mpiwg_geobrowser);
57 $uri = entity_uri('mpiwg_geobrowser', $mpiwg_geobrowser); 61 $uri = entity_uri('mpiwg_geobrowser', $mpiwg_geobrowser);
58 drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); 62 drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
59 drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); 63 drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);
60 $contexts = ctools_context_handler_get_task_contexts($task, '', array($mpiwg_geobrowser)); 64 $contexts = ctools_context_handler_get_task_contexts($task, '', array($mpiwg_geobrowser));
61
62 $output = ctools_context_handler_render($task, '', $contexts, array($mpiwg_geobrowser->mpiwg_geobrowser_instance_id)); 65 $output = ctools_context_handler_render($task, '', $contexts, array($mpiwg_geobrowser->mpiwg_geobrowser_instance_id));
66 dpm($contexts);
67 dpm($output);
68
63 $geoTemCoIntegration = ' 69 $geoTemCoIntegration = '
64 <script type="text/javascript"> 70 <script type="text/javascript">
71
65 var mpiwg_geobrowser_widgetsCount = 0; 72 var mpiwg_geobrowser_widgetsCount = 0;
66 var mpiwg_geobrowser_widgetsLoaded = 0; 73 var mpiwg_geobrowser_widgetsLoaded = 0;
67 var mpiwg_geobrowser_noWidgetLoaded = true; 74 var mpiwg_geobrowser_noWidgetLoaded = true;
68 var widgetLoadedEvent = new Event("mpiwg_geobrowser_widget_loaded"); 75 var widgetLoadedEvent = new Event("mpiwg_geobrowser_widget_loaded");
69 var allWidgetsLoadedEvent = new Event("mpiwg_geobrowser_all_widgets_loaded"); 76 var allWidgetsLoadedEvent = new Event("mpiwg_geobrowser_all_widgets_loaded");
70 77
71 Drupal.behaviors.mpiwg_geobrowser_entity = { 78 Drupal.behaviors.mpiwg_geobrowser_entity = {
72 attach: function (context, settings) { 79 attach: function (context, settings) {
73 // jq1110(document).ready(function(){ 80
81 // jQuery(document).ready(function(){
74 if (context[0] !== undefined && context[0].attributes !== undefined) { 82 if (context[0] !== undefined && context[0].attributes !== undefined) {
75 var contextAttributes = context[0].attributes; 83 var contextAttributes = context[0].attributes;
76 for (i=0; i<contextAttributes.length; i++) { 84 for (i=0; i<contextAttributes.length; i++) {
77 if (contextAttributes[i].name == "id" && contextAttributes[i].value == "panels-ipe-edit-control-form") { 85 if (contextAttributes[i].name == "id" && contextAttributes[i].value == "panels-ipe-edit-control-form") {
78 window.location.reload(); 86 window.location.reload();
80 } 88 }
81 } 89 }
82 90
83 document.addEventListener("mpiwg_geobrowser_widget_loaded", function (e) { 91 document.addEventListener("mpiwg_geobrowser_widget_loaded", function (e) {
84 if (mpiwg_geobrowser_noWidgetLoaded) { 92 if (mpiwg_geobrowser_noWidgetLoaded) {
85 mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount/2; 93
94 mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount;
95
96
86 mpiwg_geobrowser_noWidgetLoaded = false; 97 mpiwg_geobrowser_noWidgetLoaded = false;
87 } 98 }
88 mpiwg_geobrowser_widgetsLoaded++; 99 mpiwg_geobrowser_widgetsLoaded++;
89 if (mpiwg_geobrowser_widgetsLoaded == mpiwg_geobrowser_widgetsCount) { 100 if (mpiwg_geobrowser_widgetsLoaded == mpiwg_geobrowser_widgetsCount) {
90 document.dispatchEvent(allWidgetsLoadedEvent); 101 document.dispatchEvent(allWidgetsLoadedEvent);
91 } 102 }
92 }, false); 103 }, false);
93 // }); 104 // });
105
94 } 106 }
95 } 107 }
96 </script> 108 </script>
97 '; 109 ';
98 $output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"]; 110
111
112
113 if (isset($output["content"])){ //unterschiedliches Verhalten, je nach dem ob der Inhalt noch in einen admin rahmen eingebettet ist
114 //$output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"];
115 $output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"];
116
99 if ($output != FALSE) { 117 if ($output != FALSE) {
100 return $output; 118 return $output;
101 } 119 }
120 } else {
121
122 return $geoTemCoIntegration . $output;
123 }
102 124
103 $function = 'mpiwg_geobrowser_page_view'; 125 $function = 'mpiwg_geobrowser_page_view';
104 foreach (module_implements('mpiwg_geobrowser_override') as $module) { 126 foreach (module_implements('mpiwg_geobrowser_override') as $module) {
105 $call = $module . '_mpiwg_geobrowser_override'; 127 $call = $module . '_mpiwg_geobrowser_override';
106 if (($rc = $call('mpiwg_geobrowser_view')) && function_exists($rc)) { 128 if (($rc = $call('mpiwg_geobrowser_view')) && function_exists($rc)) {