def highlightscript(self):
        need("highlight")
        words = filter(lambda x: x,
            self.request.form.get("%s.full_text" % self.prefix, "").split(" "))

        def highliightword(x):
            return """$("#search-results").highlight("%s", true);""" % x
        words = "\n".join(map(highliightword, words))
        return """
               <script type="text/javascript">
                 var ch = document.getElementById("%s");
                 function highlightwords(){
                   $("#search-results").removeHighlight();
                   if (ch.checked) {
                     %s
                   }
                 }
                 function radioHighlightChangeonclick(){
                   ch.onclick=function(){
                     highlightwords();
                   }
                   highlightwords();
                 }
                 window.onload = radioHighlightChangeonclick;
               </script>
            """ % ("%s.highlight" % self.prefix, words)
Exemple #2
0
    def update(self):
        source = createObject("tackle.markdown", self.context.description)
        renderer = getMultiAdapter((source, self.request))
        self.description = renderer.render()

        need("tacklets.project")
        need("tacklets.todo")
Exemple #3
0
 def __call__(self):
     # require tiny-mce
     need("tiny-mce")
     need("tiny-mce-config")
     # render default input widget for text
     input_widget = super(RichTextEditor, self).__call__()
     return input_widget
Exemple #4
0
    def update(self):
        source = createObject("tackle.markdown", self.context.description)
        renderer = getMultiAdapter((source, self.request))
        self.description = renderer.render()

        need("tacklets.project")
        need("tacklets.todo")
Exemple #5
0
 def __call__(self):
     need("yui-paginator")
     return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
         self.prefix,
         self._getCSSClass("table"),
         self.renderContents(),
         self.script(**self.getDataTableConfig()))
Exemple #6
0
    def highlightscript(self):
        need("highlight")
        words = filter(
            lambda x: x,
            self.request.form.get("%s.full_text" % self.prefix, "").split(" "))

        def highliightword(x):
            return """$("#search-results").highlight("%s", true);""" % x

        words = "\n".join(map(highliightword, words))
        return """
               <script type="text/javascript">
                 var ch = document.getElementById("%s");
                 function highlightwords(){
                   $("#search-results").removeHighlight();
                   if (ch.checked) {
                     %s
                   }
                 }
                 function radioHighlightChangeonclick(){
                   ch.onclick=function(){
                     highlightwords();
                   }
                   highlightwords();
                 }
                 window.onload = radioHighlightChangeonclick;
               </script>
            """ % ("%s.highlight" % self.prefix, words)
Exemple #7
0
 def __call__(self):
     need("yui-paginator")
     script_html, script_js = self.get_search_widgets()
     return '%s<div id="%s">\n%s%s</div>' % (script_html,
         self.prefix,
         self.script % self.getDataTableConfig(),
         script_js)
Exemple #8
0
 def __call__(self):
     need("dynatree")
     contents = []
     contents.append(template % {
         "html": self.html,
         "javascript": self.javascript()
     })
     return "\n".join(contents)
Exemple #9
0
 def render(self, template=None):
     need("bungeni-calendar-bundle")
     if template is None:
         template = self.template
     if not checkPermission(u"bungeni.sitting.Add", self.context):
         self.edit = False
     else:
         self.edit = True
     return template()
 def __init__(self, *args):
     super(SelectDateWidget, self).__init__(*args)
     need("yui-core")
     need("yui-calendar")
     need("yui-container")
     need("yui-element")
     need("yui-button")
     self.minDate = datetime.date.today() - datetime.timedelta(self.minYearDelta * 365)
     self.maxDate = datetime.date.today() + datetime.timedelta(self.maxYearDelta * 365)
Exemple #11
0
 def render(self, template=None):
     need("bungeni-calendar-bundle")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
         (IBusinessSectionLayer.providedBy(self.request)):
         self.edit = False
     else:
         self.edit = True
     return template()
Exemple #12
0
 def render(self, template=None):
     need("bungeni-calendar-bundle")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
         (IBusinessSectionLayer.providedBy(self.request)):
         self.edit = False
     else:
         self.edit = True
     return template()
Exemple #13
0
 def __init__(self, *args):
     super(SelectDateWidget, self).__init__(*args)
     need("yui-core")
     need("yui-calendar")
     need("yui-container")
     need("yui-element")
     need("yui-button")
     self.minDate = datetime.date.today() - datetime.timedelta(
         self.minYearDelta * 365)
     self.maxDate = datetime.date.today() + datetime.timedelta(
         self.maxYearDelta * 365)
Exemple #14
0
 def render(self, template=None):
     need("dhtmlxscheduler")
     need("dhtmlxscheduler-recurring")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
         (IBusinessSectionLayer.providedBy(self.request)):
         self.edit = False
     else:
         self.edit = True
     return template()
Exemple #15
0
    def update(self):
        need('bbru.answers')

        formatter = self.request.locale.dates.getFormatter('date')
        auth = getUtility(IAuthentication)

        dc = IZopeDublinCore(self.context)
        principal = auth.getPrincipal(dc.creators[0])

        self.user = principal.title
        self.created = formatter.format(dc.created)
        self.title = dc.title
Exemple #16
0
    def update(self):
        need('yui-dragdrop')
        need('yui-container')

        session = Session()
        group_id = self.get_group_id()

        items = tuple(
            session.query(self.model).filter(
                sql.and_(self.model.status.in_(self.states),
                         self.model.group_id == group_id)))
        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model), interface.providedBy(self)),
            ILocation)

        items = [adapter(item, None) for item in items]

        # for each item, format dictionary for use in template
        self.items = [
            {
                'title':
                properties.title,
                'name':
                item.__class__.__name__,
                'description':
                properties.description,
                #'date': _(u"$F", mapping={'F':
                #           datetimedict.fromdatetime(item.changes[-1].date)}),
                'date':
                item.changes[-1].date_active,
                'state':
                _(IWorkflow(item).workflow.states[item.status].title),
                'id':
                item.parliamentary_item_id,
                'class': (item.parliamentary_item_id in scheduled_item_ids)
                and "dd-disable" or "",
                'url':
                url.set_url_context(url.absoluteURL(item, self.request))
            }
            for (item,
                 properties) in [(item,
                                  (IDCDescriptiveProperties.providedBy(item)
                                   and item or IDCDescriptiveProperties(item)))
                                 for item in items]
        ]
Exemple #17
0
    def update(self):
        need("ice.control.tree.css")
        need("ice.control.tree.js")

        if queryUtility(IDispatcher) is not None:
            need("ice.control.repl.css")
            need("ice.control.repl.js")

        self.content = self.context.get_content()
Exemple #18
0
    def update(self):
        need("ice.control.tree.css")
        need("ice.control.tree.js")

        if queryUtility(IDispatcher) is not None:
            need("ice.control.repl.css")
            need("ice.control.repl.js")

        self.content = self.context.get_content()
Exemple #19
0
    def render(self, date, template=None):
        #need('yui-editor')
        need('yui-connection')
        need('yui-rte')
        need('yui-resize')
        need('yui-button')

        if template is None:
            template = self.template

        container = self.context.__parent__
        #schedule_url = self.request.getURL()
        container_url = url.absoluteURL(container, self.request)

        # determine position in container
        key = stringKey(self.context)
        keys = list(container.keys())
        pos = keys.index(key)

        links = {}
        if pos > 0:
            links['previous'] = "%s/%s/%s" % (container_url, keys[pos - 1],
                                              self.__name__)
        if pos < len(keys) - 1:
            links['next'] = "%s/%s/%s" % (container_url, keys[pos + 1],
                                          self.__name__)

        #start_date = utils.datetimedict.fromdatetime(self.context.start_date)
        #end_date = utils.datetimedict.fromdatetime(self.context.end_date)

        site_url = url.absoluteURL(getSite(), self.request)
        reorder = "reorder" if self.context.status in \
                                ["draft_agenda", "draft_minutes"] \
                            else "dont-reorder"
        return template(
            display="sitting",
            #title=_(u"$A $e, $B $Y", mapping=start_date),
            title="%s: %s - %s" %
            (self.context.group.short_name,
             self.context.start_date.strftime('%Y-%m-%d %H:%M'),
             self.context.end_date.strftime('%H:%M')),
            description=_(u"Sitting Info"),
            #            title = u"",
            #            description = u"",
            #
            links=links,
            actions=get_sitting_actions(self.context, self.request),
            items=get_sitting_items(self.context,
                                    self.request,
                                    include_actions=True),
            #categories=vocabulary.ItemScheduleCategories(self.context),
            new_category_url="%s/admin/content/categories/add?next_url=..." %
            site_url,
            status=self.context.status,
            reorder=reorder,
        )
Exemple #20
0
    def update(self):
        need("yui-dragdrop")
        need("yui-container")

        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]

        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model), interface.providedBy(self)),
            ILocation)

        date_formatter = self.get_date_formatter("date", "medium")
        items = [adapter(item, None) for item in self._query_items()]
        # for each item, format dictionary for use in template
        self.items = [
            {
                "title":
                properties.title,
                "name":
                item.__class__.__name__,
                "description":
                properties.description,
                #"date": _(u"$F", mapping={"F":
                #       datetimedict.fromdatetime(item.changes[-1].date)}),
                #"date":item.changes[-1].date,
                # not every item has a auditlog (headings)
                # use last status change instead.
                "date":
                self._item_date(item)
                and date_formatter.format(self._item_date(item)),
                "state":
                IWorkflow(item).get_state(item.status).title,
                "id":
                self._get_item_key(item),
                "class": ((self._get_item_key(item) in scheduled_item_ids
                           and "dd-disable") or ""),
                "url":
                self._item_url(item),
                "type":
                item.type
            } for item, properties in [(
                item, (IDCDescriptiveProperties.providedBy(item) and item
                       or IDCDescriptiveProperties(item))) for item in items]
        ]
    def render(self, date, template=None):
        #need('yui-editor')
        need('yui-connection')
        need('yui-rte')
        need('yui-resize')
        need('yui-button')
        
        if template is None:
            template = self.template

        container = self.context.__parent__
        #schedule_url = self.request.getURL()
        container_url = url.absoluteURL(container, self.request)
        
        # determine position in container
        key = stringKey(self.context)
        keys = list(container.keys())
        pos = keys.index(key)

        links = {}
        if pos > 0:
            links['previous'] = "%s/%s/%s" % (
                container_url, keys[pos-1], self.__name__)
        if pos < len(keys) - 1:
            links['next'] = "%s/%s/%s" % (
                container_url, keys[pos+1], self.__name__)

        #start_date = utils.datetimedict.fromdatetime(self.context.start_date)
        #end_date = utils.datetimedict.fromdatetime(self.context.end_date)
        

        site_url = url.absoluteURL(getSite(), self.request)
        reorder = "reorder" if self.context.status in \
                                ["draft_agenda", "draft_minutes"] \
                            else "dont-reorder"
        return template(
            display="sitting",
            #title=_(u"$A $e, $B $Y", mapping=start_date),
            title = "%s: %s - %s" % (self.context.group.short_name, 
                self.context.start_date.strftime('%Y-%m-%d %H:%M'), 
                self.context.end_date.strftime('%H:%M')),
            description=_(u"Sitting Info"),
#            title = u"",
#            description = u"",
#
            links=links,
            actions=get_sitting_actions(self.context, self.request),
            items=get_sitting_items(
                self.context, self.request, include_actions=True),
            #categories=vocabulary.ItemScheduleCategories(self.context),
            new_category_url="%s/admin/content/categories/add?next_url=..." % site_url,
            status=self.context.status,
            reorder=reorder,
            )
Exemple #22
0
 def render(self):
     if haveResourceLibrary:
         resourcelibrary.need('tiny_mce')
     mceOptions = []
     for k in dir(self):
         if k.startswith(OPT_PREFIX):
             v = getattr(self,k,None)
             v = v==True and 'true' or v==False and 'false' or v
             if v in ['true','false']:
                 mceOptions.append('%s : %s' % (k[OPT_PREFIX_LEN:],v))
             elif v is not None:
                 mceOptions.append('%s : "%s"' % (k[OPT_PREFIX_LEN:],v))
     mceOptions = ', '.join(mceOptions)
     if mceOptions:
         mceOptions += ', '
     if self.request.locale.id.language in MCE_LANGS:
         mceOptions += ('language : "ru",')
     widget_html =  super(TinyWidget,self).render()
     return template % {"widget_html": widget_html,
                        "name": self.name,
                        "options": mceOptions}
    def update(self):
        need('yui-dragdrop')
        need('yui-container')

        session = Session()
        group_id = self.get_group_id()
        
        items = tuple(session.query(self.model).filter(
            sql.and_(
            self.model.status.in_(self.states),
            self.model.group_id == group_id)
            ))
        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model),
             interface.providedBy(self)), ILocation)
        
        items = [adapter(item, None) for item in items]
        
        # for each item, format dictionary for use in template
        self.items = [{
            'title': properties.title,
            'name': item.__class__.__name__,
            'description': properties.description,
            #'date': _(u"$F", mapping={'F':
            #           datetimedict.fromdatetime(item.changes[-1].date)}),
            'date': item.changes[-1].date_active,
            'state': _(IWorkflow(item).workflow.states[item.status].title),
            'id': item.parliamentary_item_id,
            'class': (item.parliamentary_item_id in 
                            scheduled_item_ids) and "dd-disable" or "",
            'url': url.set_url_context(url.absoluteURL(item, self.request))
        } for (item, properties) in [
             (item, (IDCDescriptiveProperties.providedBy(item) and item or
                      IDCDescriptiveProperties(item))) 
              for item in items ]
        ]
    def update(self):
        need("yui-dragdrop")
        need("yui-container")

        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
        
        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model), interface.providedBy(self)), 
            ILocation
        )
        
        date_formatter = self.get_date_formatter("date", "medium")
        items = [ adapter(item, None) for item in self._query_items() ]
        # for each item, format dictionary for use in template
        self.items = [{
                "title": properties.title,
                "name": item.__class__.__name__,
                "description": properties.description,
                #"date": _(u"$F", mapping={"F":
                #       datetimedict.fromdatetime(item.changes[-1].date)}),
                #"date":item.changes[-1].date,
                # not every item has a auditlog (headings) 
                # use last status change instead.
                "date": date_formatter.format(self._item_date(item)),
                "state": IWorkflow(item).get_state(item.status).title,
                "id": item.parliamentary_item_id,
                "class": (
                    (item.parliamentary_item_id in scheduled_item_ids and
                        "dd-disable") or 
                    ""),
                "url": self._item_url(item),
                "type": item.type
            } for item, properties in [
                (item, (IDCDescriptiveProperties.providedBy(item) and item or
                        IDCDescriptiveProperties(item))) 
                for item in items ]
        ]
Exemple #25
0
 def render(self, template=None):
     need("dhtmlxscheduler")
     need("dhtmlxscheduler-recurring")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
         (IBusinessSectionLayer.providedBy(self.request)):
         self.edit = False
     else:
         self.edit = True
     session = Session()
     venues = session.query(domain.Venue).all()
     languages = get_all_languages()
     # !+SESSION_CLOSE(taras.sterch, july-2011) there is no need to close the
     # session. Transaction manager will take care of this. Hope it does not
     # brake anything.
     #session.close()
     self.display_language = get_default_language()
     if self.request.get("I18N_LANGUAGE"):
         self.display_language = self.request.get("I18N_LANGUAGE")
     #html is hardcoded in here because doing it in the template
     #would have been a colossal pain
     #TODO: FIX THIS
     s = '<div class="dhx_cal_ltext" style="height:90px;">'
     s += '<table>'
     s += '<tr><td>Venue</td><td><select id="select_sitting_venue">'
     for venue in venues:
         s += '<option value="' + str(
             venue.venue_id) + '">' + venue.short_name + '</option>'
     s += '</select></td></tr>'
     s += '<tr><td>Language</td><td><select id="select_sitting_lang">'
     for lang in languages:
         if lang == 'en':
             s += '<option value="' + lang + '" selected>' + lang + '</option>'
         else:
             s += '<option value="' + lang + '">' + lang + '</option>'
     s += '</select></td></tr></table></div>'
     self.sitting_details_form = s
     return template()
Exemple #26
0
    def __call__(self):
        # require yahoo rich text editor and dependencies
        need("yui-rte")
        need("yui-resize")
        need("yui-button")
        # render default input widget for text
        input_widget = super(RichTextEditor, self).__call__()

        # use "_" instead of "." for js identifiers
        jsid = self.name.replace(".", "_")

        # attach behavior to default input widget, disable titlebar
        input_widget_js = u"""
        <script type="text/javascript">
            options={ height:'300px',
                      width:'100%%',
                      dompath:true,
                      animate:true,
                      focusAtStart:false,
                      markup:'xhtml'};
            var %(jsid)s_editor = new YAHOO.widget.Editor('%(js_name)s', options);
            YAHOO.util.Event.on(
                %(jsid)s_editor.get('element').form,
                'submit',
                function(ev) {
                    %(jsid)s_editor.saveHTML();
                }
            );
            %(jsid)s_editor._defaultToolbar.titlebar = false;
            %(jsid)s_editor.on('editorContentLoaded', function() {
              resize = new YAHOO.util.Resize(%(jsid)s_editor.get('element_cont').get('element'), {
                  handles: ['br'],
                  autoRatio: true,
                  status: true,
                  proxy: true,
                  setSize: false //This is where the magic happens
              });
              resize.on('startResize', function() {
                  this.hide();
                  this.set('disabled', true);
              },  %(jsid)s_editor, true);
              resize.on('resize', function(args) {
                  var h = args.height;
                  var th = (this.toolbar.get('element').clientHeight + 2); //It has a 1px border..
                  var dh = (this.dompath.clientHeight + 1); //It has a 1px top border..
                  var newH = (h - th - dh);
                  this.set('width', args.width + 'px');
                  this.set('height', newH + 'px');
                  this.set('disabled', false);
                  this.show();
              },  %(jsid)s_editor, true);
          });


            %(jsid)s_editor.render();
        </script>
        """
        return input_widget + \
            input_widget_js % {"jsid": jsid, "js_name": self.name}
Exemple #27
0
    def __call__(self):
        need('yui-datatable')
        need('yui-paginator')
        need('yui-dragdrop')

        return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
            self.prefix, self._getCSSClass('table'), self.renderContents(),
            self.script(**self.getDataTableConfig()))
Exemple #28
0
    def update(self):
        need('yui-dragdrop')
        need('yui-container')
        session = Session()
        items = tuple(
            session.query(self.model).filter(self.model.status.in_(
                self.states)))

        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]

        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model), interface.providedBy(self)),
            ILocation)

        items = [adapter(item, None) for item in items]
        site_url = url.absoluteURL(getSite(), self.request)
        # for each item, format dictionary for use in template
        self.items = [{
            'title': properties.title,
            'name': item.__class__.__name__,
            'description': properties.description,
            #            'date': _(u"$F", mapping={"F":
            #                      datetimedict.fromdatetime(item.changes[-1].date)}),
            #'date':item.changes[-1].date,
            # not every item has a auditlog (headings) use last status change instead.
            'date':item.status_date,
            #
            'state': IWorkflow(item).workflow.states[item.status].title,
            'id': item.parliamentary_item_id,
            'class': (item.parliamentary_item_id in scheduled_item_ids) and "dd-disable" or "",
            'url': url.set_url_context(site_url+('/business/%ss/obj-%s' % (item.type, item.parliamentary_item_id)))
            } for item, properties in \
            [(item, (IDCDescriptiveProperties.providedBy(item) and item or \
            IDCDescriptiveProperties(item))) for
             item in items]]
 def render(self, template=None):
     need("dhtmlxscheduler")
     need("dhtmlxscheduler-recurring")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or \
         (IBusinessSectionLayer.providedBy(self.request)):
         self.edit = False
     else:
         self.edit = True
     session = Session()
     venues = session.query(domain.Venue).all()
     languages = get_all_languages()
     # !+SESSION_CLOSE(taras.sterch, july-2011) there is no need to close the 
     # session. Transaction manager will take care of this. Hope it does not 
     # brake anything.
     #session.close()
     self.display_language = get_default_language()
     if self.request.get("I18N_LANGUAGE"):
         self.display_language = self.request.get("I18N_LANGUAGE")
     #html is hardcoded in here because doing it in the template
     #would have been a colossal pain
     #TODO: FIX THIS
     s = '<div class="dhx_cal_ltext" style="height:90px;">' 
     s += '<table>'
     s += '<tr><td>Venue</td><td><select id="select_sitting_venue">'
     for venue in venues:
         s += '<option value="'+str(venue.venue_id)+'">'+venue.short_name+'</option>'
     s += '</select></td></tr>'
     s += '<tr><td>Language</td><td><select id="select_sitting_lang">'
     for lang in languages:
         if lang == 'en':
             s += '<option value="'+lang+'" selected>'+lang+'</option>'
         else:
             s += '<option value="'+lang+'">'+lang+'</option>'
     s += '</select></td></tr></table></div>'
     self.sitting_details_form = s
     return template()
 def __call__(self):
     need("yui-json")
     need("yui-datasource")
     need("yui-autocomplete")
     input_widget = super(TimeWidget, self).__call__()
     auto_container = u'<div id="%s" class="yui-skin-sam"></div>' % (
         self.options_container)
     return "<div class='ac_time_container'>%s%s%s</div>" %(
         input_widget, auto_container, self.js)
    def update(self):
        need('yui-dragdrop')
        need('yui-container')
        session = Session()
        items = tuple(session.query(self.model).filter(
            self.model.status.in_(self.states)))

        sitting = self._parent._parent.context
        scheduled_item_ids = [item.item_id for item in sitting.item_schedule]
        
        # add location to items
        gsm = component.getSiteManager()
        adapter = gsm.adapters.lookup(
            (interface.implementedBy(self.model),
             interface.providedBy(self)), ILocation)

        items = [adapter(item, None) for item in items]
        site_url = url.absoluteURL(getSite(), self.request)
        # for each item, format dictionary for use in template
        self.items = [{
            'title': properties.title,
            'name': item.__class__.__name__,
            'description': properties.description,
#            'date': _(u"$F", mapping={"F":
#                      datetimedict.fromdatetime(item.changes[-1].date)}),
            #'date':item.changes[-1].date,
            # not every item has a auditlog (headings) use last status change instead.
            'date':item.status_date,
#
            'state': IWorkflow(item).workflow.states[item.status].title,
            'id': item.parliamentary_item_id,
            'class': (item.parliamentary_item_id in scheduled_item_ids) and "dd-disable" or "",
            'url': url.set_url_context(site_url+('/business/%ss/obj-%s' % (item.type, item.parliamentary_item_id)))
            } for item, properties in \
            [(item, (IDCDescriptiveProperties.providedBy(item) and item or \
            IDCDescriptiveProperties(item))) for
             item in items]]
Exemple #32
0
 def __call__(self):
     need("yui-json")
     need("yui-datasource")
     need("yui-autocomplete")
     input_widget = super(TimeWidget, self).__call__()
     auto_container = u'<div id="%s" class="yui-skin-sam"></div>' % (
         self.options_container)
     return "<div class='ac_time_container'>%s%s%s</div>" % (
         input_widget, auto_container, self.js)
Exemple #33
0
    def __call__(self):
        need('yui-datatable')
        need('yui-paginator')
        need('yui-dragdrop')

        return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
            self.prefix,
            self._getCSSClass('table'),
            self.renderContents(),
            self.script(**self.getDataTableConfig()))
Exemple #34
0
 def render(self):
     need("yui-datatable")
     return self.template()
 def __call__(self):
     need("yui-datatable")
     self.update()
     return self.template()
 def __call__(self):
     need("yui-datatable")
     self.context = removeSecurityProxy(self.context)
     return self.template()
Exemple #37
0
 def __init__(self, context, request):
     self.diff_widgets = []
     self.diff = False
     self.last_timestamp = None
     super(DiffEditForm, self).__init__(context, request)
     need("diff-form")
Exemple #38
0
 def update(self):
     need("yui-tree")
Exemple #39
0
 def update(self):
     need("bungeni-form-block-ui")
Exemple #40
0
    def render(self, date, template=None):
        #need('yui-editor')
        need('yui-rte')
        need('yui-resize')
        need('yui-button')

        if template is None:
            template = self.template

        container = self.context.__parent__
        #schedule_url = self.request.getURL()
        container_url = ui_url.absoluteURL(container, self.request)

        # determine position in container
        key = stringKey(self.context)
        keys = list(container.keys())
        pos = keys.index(key)

        links = {}
        if pos > 0:
            links['previous'] = "%s/%s/%s" % (container_url, keys[pos - 1],
                                              self.__name__)
        if pos < len(keys) - 1:
            links['next'] = "%s/%s/%s" % (container_url, keys[pos + 1],
                                          self.__name__)

        #start_date = utils.datetimedict.fromdatetime(self.context.start_date)
        #end_date = utils.datetimedict.fromdatetime(self.context.end_date)

        #session = Session()
        sitting_type_dc = IDCDescriptiveProperties(self.context.sitting_type)

        site_url = ui_url.absoluteURL(getSite(), self.request)

        return template(
            display="sitting",
            #title=_(u"$A $e, $B $Y", mapping=start_date),
            title="%s: %s - %s" %
            (self.context.group.short_name,
             self.context.start_date.strftime('%Y-%m-%d %H:%M'),
             self.context.end_date.strftime('%H:%M')),
            description=_(
                u"$type &mdash; ${start}-${end}",
                mapping={
                    'type': translate(sitting_type_dc.title),
                    'start':
                    self.context.start_date.strftime('%Y-%m-%d %H:%M'),
                    'end': self.context.end_date.strftime('%H:%M')
                }),
            #            title = u"",
            #            description = u"",
            #
            links=links,
            actions=get_sitting_actions(self.context, self.request),
            items=get_sitting_items(self.context,
                                    self.request,
                                    include_actions=True),
            #categories=vocabulary.ItemScheduleCategories(self.context),
            new_category_url="%s/admin/content/categories/add?next_url=..." %
            site_url,
            status=self.context.status,
        )
Exemple #41
0
 def __call__(self):
     need("yui-paginator")
     script_html, script_js = self.get_search_widgets()
     return '%s<div id="%s">\n%s%s</div>' % (
         script_html, self.prefix, self.script % self.getDataTableConfig(),
         script_js)
Exemple #42
0
 def __call__(self, *args, **kw):
     if haveResourceLibrary:
         resourcelibrary.need('sequencetable')
     return super(SequenceTableJSWidget, self).__call__(*args, **kw)
Exemple #43
0
 def __call__(self):
     need("yui-paginator")
     return '<div id="%s">\n<table %s>\n%s</table>\n%s</div>' % (
         self.prefix, self._getCSSClass("table"), self.renderContents(),
         self.script(**self.getDataTableConfig()))
Exemple #44
0
 def update(self):
     need("advanced-search")
     super(AdvancedPagedSearch, self).update()
Exemple #45
0
 def __call__(self):
     need("yui-datatable")
     self.context = removeSecurityProxy(self.context)
     return self.render()
 def render(self):
     need("hansard-css")
     return self.template()
Exemple #47
0
    def __call__(self):
        need("yui-datasource")
        need("yui-get")
        need("yui-connection")
        need("yui-animation")
        need("yui-json")
        need("yui-autocomplete")

        contents = []
        contents.append(self.style)
        contents.append(template % {"html": self.html,
            "javascript": self.javascript})

        return "\n".join(contents)
Exemple #48
0
 def __getitem__(self, key):
     resourcelibrary.need('mochikit.Base')
     resourcelibrary.need('mochikit.Iter')
     resourcelibrary.need('mochikit.DOM')
     resourcelibrary.need('mochikit.Style')
     resourcelibrary.need('mochikit.Color')
     resourcelibrary.need('mochikit.Position')
     resourcelibrary.need('mochikit.Visual')
     resourcelibrary.need('skin')
     return self.template.macros[key]
 def __call__(self):
     need("dynatree")
     contents = []
     contents.append(template % {"html": self.html,
         "javascript": self.javascript()})
     return "\n".join(contents)
Exemple #50
0
 def __call__(self):
     need("yui-paginator")
     return '<div id="%s">\n%s</div>' % (
         self.prefix, self.script(**self.getDataTableConfig()))
 def update(self):
     need("bungeni-form-block-ui")
 def render(self, template=None):
     need("dhtmlxscheduler")
     need("dhtmlxscheduler-recurring")
     need("dhtmlxscheduler-year-view")
     need("dhtmlxscheduler-week-agenda-view")
     need("dhtmlxscheduler-expand")
     need("bungeni-calendar-globals")
     need("bungeni-calendar-extensions")
     need("dhtmlxscheduler-timeline")
     need("dhtmlxscheduler-tooltip")
     need("dhtmlxscheduler-minical")
     need("dhtmlxscheduler-multisource")
     need("dhtmlxscheduler-collision")
     need("multi-calendar-actions")
     if template is None:
         template = self.template
     if (not checkPermission(u"bungeni.sitting.Add", self.context)) or (
         IBusinessSectionLayer.providedBy(self.request)
     ):
         self.edit = False
     else:
         self.edit = True
     return template()
Exemple #53
0
 def update(self):
     """ """     
     resourcelibrary.need('mochikit.Base')
     resourcelibrary.need('mochikit.DOM')
     resourcelibrary.need('mochikit.Async')
     resourcelibrary.need('mochikit.JsonRpc')
     resourcelibrary.need('mochikit.Style')
     resourcelibrary.need('mochikit.Color')
     resourcelibrary.need('mochikit.Position')
     resourcelibrary.need('mochikit.Visual')
     resourcelibrary.need('quiz_constructor')
     resourcelibrary.need('answer')
     cvm = getMultiAdapter((self.context, self.request, self),IContentProvider, name=u'qreature.QreatureGeneralVM')
     cvm.update()
     self.viewlets = cvm
 def render(self):
     need("yui-datatable")
     return self.template()
Exemple #55
0
 def __call__(self):
     need("yui-datatable")
     self.update()
     return self.template()