summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timelinejs.module36
1 files changed, 36 insertions, 0 deletions
diff --git a/timelinejs.module b/timelinejs.module
index 2923e5d..0b2397a 100644
--- a/timelinejs.module
+++ b/timelinejs.module
@@ -31,6 +31,12 @@ function timelinejs_menu() {
'type' => MENU_CALLBACK,
);
+ $items['widgets/timeline'] = array(
+ 'page callback' => 'timelinejs_widget',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ );
+
return $items;
}
@@ -148,6 +154,36 @@ function timelinejs_json($nid) {
/**
* Menu callback.
*/
+function timelinejs_widget($nid = NULL, $width = '960px', $height = '500px') {
+ // Check parameters.
+ if ($nid == NULL) {
+ drupal_not_found();
+ }
+ else {
+ $node = node_load($nid);
+
+ if ($node == FALSE) {
+ drupal_not_found();
+ }
+ }
+
+ // Format output and include timeline.
+ $output = '<!DOCTYPE html>';
+ $output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
+ $output .= '<html><head>';
+ $output .= '<title>'. t('Timeline: @title', array('@title' => $node->title)) .'</title>';
+ $output .= '</head></body>';
+ $output .= timelinejs($nid, $width, $height);
+ $output .= '</body></html>';
+
+ // Avoid themeable output.
+ print $output;
+ exit;
+}
+
+/**
+ * Menu callback.
+ */
function timelinejs($nid, $width = '960px', $height = '500px') {
global $language;
global $theme;