view plugins/content_types/mpiwg_geobrowser_storyTelling.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
line wrap: on
line source

<?php

$plugin = array(
    'single' => TRUE,
    'title' => t('storytelling'),
    'description' => t('shows the storytelling widget.'),
    'category' => t('mpiwg geobrowser'),
    'edit form' => 'mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_edit_form',
    'render callback' => 'mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_render',
    'admin info' => 'mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_admin_info',
    'defaults' => array()
);

function mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_render($subtype, $conf, $panel_args, $context = NULL) {
    $block = new stdClass();

    // initial content is blank
    $block->title = '';
    $block->content = '';

    // Add in the content
    $block->content .= '
        <fieldset id="storytellingContainerDiv" style="position:relative;">
            <legend>Data History</legend>
        </fieldset>
        <script type="text/javascript">
  if (typeof StorytellingWidget_l=="undefined")
	    {
         
            var storytellingDiv = document.getElementById("storytellingContainerDiv");
            var storytelling = new WidgetWrapper();
            var storytellingWidget = new StorytellingWidget(storytelling,storytellingDiv);
            var mpiwg_geobrowser_storyTellingInitialized = false;
            mpiwg_geobrowser_widgetsCount++;
            jq1110(document).ready(function() {
                if (mpiwg_geobrowser_storyTellingInitialized == false) {
                    if (storytellingDiv) {
                        storytelling.display();
                    }
                    mpiwg_geobrowser_storyTellingInitialized = true;
                    document.dispatchEvent(widgetLoadedEvent);
                }
            });
	    StorytellingWidget_l=true;
}
        </script>
    ';

    return $block;
}

function mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_admin_info($subtype, $conf, $contexts) {
    if (!empty($conf)) {
        $block = new stdClass;
        $block->title = 'map';
        $block->content = t('showing the basic map.');
        return $block;
    }
}

function mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_edit_form($form, &$form_state) {
    return $form;
}

function mpiwg_geobrowser_mpiwg_geobrowser_storyTelling_edit_form_submit($form, &$form_state) {
    foreach (array_keys($form_state['plugin']['defaults']) as $key) {
        if (isset($form_state['values'][$key])) {
            $form_state['conf'][$key] = $form_state['values'][$key];
        }
    }
}