Class ::xowiki::includelet::timeline (public)

 ::xowiki::IncludeletClass ::xowiki::includelet::timeline[i]

Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl

Include a timeline of changes (based on yahoo timeline API)

Testcases:
No testcase defined.
Source code:
namespace eval ::xowiki::includelet {}
::nsf::object::alloc ::xowiki::IncludeletClass ::xowiki::includelet::timeline {set :__default_metaclass ::xotcl::Class
   set :__default_superclass ::xotcl::Object
   set :aggregating false
   set :cacheable false
   set :localized true
   set :personalized true}
::xowiki::includelet::timeline instproc render {} {
    :get_parameters

    ::xo::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js"
    ::xo::Page requireJS "/resources/ajaxhelper/yui/event/event.js"
    ::xo::Page requireJS "/resources/xowiki/timeline/api/timeline-api.js"

    set stamp [clock format [clock seconds] -format "%b %d %Y %X %Z" -gmt true]
    if {[info exists user_id]} {append data "?user_id=$user_id"}

    set nonce [security::csp::nonce]

    return [subst -nocommands -nobackslashes {
      <div id="my-timeline" style="font-size:70%; height: 350px; border: 1px solid #aaa"></div>
      <script type="text/javascript" nonce='$nonce'>
      var tl;
      function onLoad() {
        var eventSource = new Timeline.DefaultEventSource();
        var bandInfos = [
                         Timeline.createBandInfo({
                           eventSource:    eventSource,
                           date:           "$stamp",
                           width:          "70%",
                           intervalUnit:   Timeline.DateTime.$interval1,
                           intervalPixels: 100
                         }),
                         Timeline.createBandInfo({
                           eventSource:    eventSource,
                           date:           "$stamp",
                           width:          "30%",
                           intervalUnit:   Timeline.DateTime.$interval2,
                           intervalPixels: 200
                         })
                        ];
        //console.info(bandInfos);
        bandInfos[1].syncWith = 0;
        bandInfos[1].highlight = true;

        tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
        //console.log('create done');
        Timeline.loadXML("$data", function(xml, url) {eventSource.loadXML(xml,url); });
      }

      var resizeTimerID = null;
      function onResize() {
        //   console.log('resize');

        if (resizeTimerID == null) {
          resizeTimerID = window.setTimeout(function() {
            resizeTimerID = null;
            //   console.log('call layout');
            tl.layout();
          }, 500);
        }
      }

      YAHOO.util.Event.addListener(window, 'load',   onLoad());
      // YAHOO.util.Event.addListener(window, 'resize', onResize());

      </script>

    }]
  }
::xowiki::includelet::timeline instparametercmd parameter_declaration
::nsf::relation::set ::xowiki::includelet::timeline superclass ::xowiki::Includelet

::nx::slotObj -container slot ::xowiki::includelet::timeline
::xowiki::includelet::timeline::slot eval {set :__parameter {
        {parameter_declaration {
          -user_id
          {-data timeline-data}
          {-interval1 DAY}
          {-interval2 MONTH}
        }}
      }}

::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::timeline::slot::parameter_declaration {set :accessor public
   set :configurable true
   set :convert false
   set :default {
          -user_id
          {-data timeline-data}
          {-interval1 DAY}
          {-interval2 MONTH}
        }
   set :defaultmethods {}
   set :disposition alias
   set :domain ::xowiki::includelet::timeline
   set :incremental 0
   set :manager ::xowiki::includelet::timeline::slot::parameter_declaration
   set :methodname parameter_declaration
   set :multiplicity 1..1
   set :name parameter_declaration
   set :per-object false
   set :position 0
   set :required false
   set :substdefault 0b111
   set :trace none
   : init}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: