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

<?php

$plugin = array(
    'single' => TRUE,
    'title' => t('plot'),
    'description' => t('shows the plot widget.'),
    'category' => t('mpiwg geobrowser'),
    'edit form' => 'mpiwg_geobrowser_mpiwg_geobrowser_plot_edit_form',
    'render callback' => 'mpiwg_geobrowser_mpiwg_geobrowser_plot_render',
    'admin info' => 'mpiwg_geobrowser_mpiwg_geobrowser_plot_admin_info',
    'defaults' => array()
);

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

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

    // Add in the content
    $block->content .= '
        <div id="plotContainerDiv" style="position:relative;"></div>
        <script type="text/javascript">
	 	
	    if (typeof FuzzyTimelineWidget_l=="undefined")
	    {
         

            var timeDiv = document.getElementById("plotContainerDiv");
            var time = new WidgetWrapper();
            var timeWidget = new FuzzyTimelineWidget(time,timeDiv,{timeTitle: "Publication Date"});
            var mpiwg_geobrowser_plotInitialized = false;
	    mpiwg_geobrowser_widgetsCount++;

	  
	   

            jq1110(document).ready(function() {
                if (mpiwg_geobrowser_plotInitialized == false) {
                    if (timeDiv) {
                        time.display();
                    }
                    mpiwg_geobrowser_plotInitialized = true;
                    document.dispatchEvent(widgetLoadedEvent);
                }
            });
	    FuzzyTimelineWidget_l = true;
	    }


        </script>
    ';

    return $block;
}

function mpiwg_geobrowser_mpiwg_geobrowser_plot_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_plot_edit_form($form, &$form_state) {
    return $form;
}

function mpiwg_geobrowser_mpiwg_geobrowser_plot_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];
        }
    }
}