Mercurial > hg > mpiwg_geobrowser
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:b57c7821382f | 1:ea066ce001bd |
---|---|
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 |
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); |
57 $uri = entity_uri('mpiwg_geobrowser', $mpiwg_geobrowser); | 60 $uri = entity_uri('mpiwg_geobrowser', $mpiwg_geobrowser); |
58 drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); | 61 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); | 62 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)); | 63 $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)); | 64 $output = ctools_context_handler_render($task, '', $contexts, array($mpiwg_geobrowser->mpiwg_geobrowser_instance_id)); |
65 | |
63 $geoTemCoIntegration = ' | 66 $geoTemCoIntegration = ' |
64 <script type="text/javascript"> | 67 <script type="text/javascript"> |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
65 var mpiwg_geobrowser_widgetsCount = 0; | 74 var mpiwg_geobrowser_widgetsCount = 0; |
66 var mpiwg_geobrowser_widgetsLoaded = 0; | 75 var mpiwg_geobrowser_widgetsLoaded = 0; |
67 var mpiwg_geobrowser_noWidgetLoaded = true; | 76 var mpiwg_geobrowser_noWidgetLoaded = true; |
68 var widgetLoadedEvent = new Event("mpiwg_geobrowser_widget_loaded"); | 77 var widgetLoadedEvent = new Event("mpiwg_geobrowser_widget_loaded"); |
69 var allWidgetsLoadedEvent = new Event("mpiwg_geobrowser_all_widgets_loaded"); | 78 var allWidgetsLoadedEvent = new Event("mpiwg_geobrowser_all_widgets_loaded"); |
70 | 79 |
71 Drupal.behaviors.mpiwg_geobrowser_entity = { | 80 Drupal.behaviors.mpiwg_geobrowser_entity = { |
72 attach: function (context, settings) { | 81 attach: function (context, settings) { |
73 // jq1110(document).ready(function(){ | 82 |
83 // jQuery(document).ready(function(){ | |
74 if (context[0] !== undefined && context[0].attributes !== undefined) { | 84 if (context[0] !== undefined && context[0].attributes !== undefined) { |
75 var contextAttributes = context[0].attributes; | 85 var contextAttributes = context[0].attributes; |
76 for (i=0; i<contextAttributes.length; i++) { | 86 for (i=0; i<contextAttributes.length; i++) { |
77 if (contextAttributes[i].name == "id" && contextAttributes[i].value == "panels-ipe-edit-control-form") { | 87 if (contextAttributes[i].name == "id" && contextAttributes[i].value == "panels-ipe-edit-control-form") { |
78 window.location.reload(); | 88 window.location.reload(); |
80 } | 90 } |
81 } | 91 } |
82 | 92 |
83 document.addEventListener("mpiwg_geobrowser_widget_loaded", function (e) { | 93 document.addEventListener("mpiwg_geobrowser_widget_loaded", function (e) { |
84 if (mpiwg_geobrowser_noWidgetLoaded) { | 94 if (mpiwg_geobrowser_noWidgetLoaded) { |
85 mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount/2; | 95 |
96 mpiwg_geobrowser_widgetsCount = mpiwg_geobrowser_widgetsCount; | |
97 | |
98 | |
86 mpiwg_geobrowser_noWidgetLoaded = false; | 99 mpiwg_geobrowser_noWidgetLoaded = false; |
87 } | 100 } |
88 mpiwg_geobrowser_widgetsLoaded++; | 101 mpiwg_geobrowser_widgetsLoaded++; |
89 if (mpiwg_geobrowser_widgetsLoaded == mpiwg_geobrowser_widgetsCount) { | 102 if (mpiwg_geobrowser_widgetsLoaded == mpiwg_geobrowser_widgetsCount) { |
90 document.dispatchEvent(allWidgetsLoadedEvent); | 103 document.dispatchEvent(allWidgetsLoadedEvent); |
91 } | 104 } |
92 }, false); | 105 }, false); |
93 // }); | 106 // }); |
107 | |
94 } | 108 } |
95 } | 109 } |
96 </script> | 110 </script> |
97 '; | 111 '; |
98 $output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"]; | 112 |
113 | |
114 | |
115 if (isset($output["content"])){ //unterschiedliches Verhalten, je nach dem ob der Inhalt noch in einen admin rahmen eingebettet ist | |
116 //$output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"]; | |
117 $output["content"]["#markup"] = $geoTemCoIntegration . $output["content"]["#markup"]; | |
118 | |
99 if ($output != FALSE) { | 119 if ($output != FALSE) { |
100 return $output; | 120 return $output; |
101 } | 121 } |
122 } else { | |
123 | |
124 return $geoTemCoIntegration . $output; | |
125 } | |
102 | 126 |
103 $function = 'mpiwg_geobrowser_page_view'; | 127 $function = 'mpiwg_geobrowser_page_view'; |
104 foreach (module_implements('mpiwg_geobrowser_override') as $module) { | 128 foreach (module_implements('mpiwg_geobrowser_override') as $module) { |
105 $call = $module . '_mpiwg_geobrowser_override'; | 129 $call = $module . '_mpiwg_geobrowser_override'; |
106 if (($rc = $call('mpiwg_geobrowser_view')) && function_exists($rc)) { | 130 if (($rc = $call('mpiwg_geobrowser_view')) && function_exists($rc)) { |