Beispiel #1
0
 def update_params(self, d):
     d['topic'] = str(uuid4()) 
     super(MokshaFeedReaderWidget, self).update_params(d)
     self.add_call(jQuery('#' + d.id).splitter({
         'splitVertical': True,
         'outline': True,
         'sizeLeft': True,
         'anchorToWindow': True,
         'accessKey': "I",
         }))
     self.add_call(jQuery('#RightPane').splitter({
         'splitHorizontal': True,
         'sizeTop': True,
         'accessKey': "H",
         }))
Beispiel #2
0
    def update_params(self, d):
        super(MokshaMenu, self).update_params(d)

        if not d.id:
            raise Exception("MokshaMenu must have an id!")
        if not d.callback:
            raise Exception("Must provide a callback URL!")

        menus = []
        for menu in d.menus:
            menus.append((menu.lower().replace(' ', ''), menu))
        d.menus = menus

        self.add_call(when_ready(jQuery('.%s' % d.id).buildMenu({
                'template': d.callback,
                'additionalData': d.additionalData,
                'menuWidth': d.menuWidth,
                'openOnRight': d.openOnRight,
                'rootMenuSelector': ".%s" % d.rootMenuSelector,
                'menuSelector': ".%s" % d.menuSelector,
                'iconPath': d.iconPath,
                'hasImages': d.hasImages,
                'fadeTime': d.fadeTime,
                'fadeInTime': d.fadeInTime,
                'fadeOutTime': d.fadeOutTime,
                'adjustLeft': d.adjustLeft,
                'adjustTop': d.adjustTop,
                'opacity': d.opacity,
                'shadow': d.shadow,
                'minZindex': d.minZindex,
                })))
Beispiel #3
0
    def update_params(self, d):
        super(MokshaMenu, self).update_params(d)

        if not d.id:
            raise Exception("MokshaMenu must have an id!")
        if not d.callback:
            raise Exception("Must provide a callback URL!")

        menus = []
        for menu in d.menus:
            menus.append((menu.lower().replace(' ', ''), menu))
        d.menus = menus

        self.add_call(
            when_ready(
                jQuery('.%s' % d.id).buildMenu({
                    'template': d.callback,
                    'additionalData': d.additionalData,
                    'menuWidth': d.menuWidth,
                    'openOnRight': d.openOnRight,
                    'rootMenuSelector': ".%s" % d.rootMenuSelector,
                    'menuSelector': ".%s" % d.menuSelector,
                    'iconPath': d.iconPath,
                    'hasImages': d.hasImages,
                    'fadeTime': d.fadeTime,
                    'fadeInTime': d.fadeInTime,
                    'fadeOutTime': d.fadeOutTime,
                    'adjustLeft': d.adjustLeft,
                    'adjustTop': d.adjustTop,
                    'opacity': d.opacity,
                    'shadow': d.shadow,
                    'minZindex': d.minZindex,
                })))
Beispiel #4
0
    def update_params(self, d):
        super(MokshaContextualMenu, self).update_params(d)

        if not d.id:
            raise Exception("MokshaMenu must have an id!")
        if not d.callback:
            raise Exception("Must provide a callback URL!")

        menus = []
        for menu in d.menus:
            menus.append((menu.lower().replace(' ', ''), menu))
        d.menus = menus

        self.add_call(jQuery(js_symbol('document')).buildContextualMenu({
                'template': d.callback,
                'menuWidth': d.menuWidth,
                'rootMenuSelector': ".%s" % d.rootMenuSelector,
                'menuSelector': ".%s" % d.menuSelector,
                'iconPath': d.iconPath,
                'hasImages': d.hasImages,
                'fadeTime': d.fadeTime,
                'fadeInTime': d.fadeInTime,
                'fadeOutTime': d.fadeOutTime,
                'adjustLeft': d.adjustLeft,
                'adjustTop': d.adjustTop,
                'opacity': d.opacity,
                'shadow': d.shadow,
                'effect': d.effect,
                'minZindex': d.minZindex
                }))
Beispiel #5
0
    def update_params(self, d):
        super(Dynatree, self).update_params(d)

        options = {}

        # Hack around ToscaWidgets
        for param in self.params:
            if param in ('css_class', 'css_classes'):
                continue
            if getattr(d, param, None):
                options[param] = d[param]
        if 'tree_children' in options:
            options['children'] = options['tree_children']
            del(options['tree_children'])

        self.add_call(jQuery('#%s' % d.id).dynatree(options))
Beispiel #6
0
    def update_params(self, d):
        super(MokshaContextualMenu, self).update_params(d)

        if not d.id:
            raise Exception("MokshaMenu must have an id!")
        if not d.callback:
            raise Exception("Must provide a callback URL!")

        menus = []
        for menu in d.menus:
            menus.append((menu.lower().replace(' ', ''), menu))
        d.menus = menus

        self.add_call(
            jQuery(js_symbol('document')).buildContextualMenu({
                'template':
                d.callback,
                'menuWidth':
                d.menuWidth,
                'rootMenuSelector':
                ".%s" % d.rootMenuSelector,
                'menuSelector':
                ".%s" % d.menuSelector,
                'iconPath':
                d.iconPath,
                'hasImages':
                d.hasImages,
                'fadeTime':
                d.fadeTime,
                'fadeInTime':
                d.fadeInTime,
                'fadeOutTime':
                d.fadeOutTime,
                'adjustLeft':
                d.adjustLeft,
                'adjustTop':
                d.adjustTop,
                'opacity':
                d.opacity,
                'shadow':
                d.shadow,
                'effect':
                d.effect,
                'minZindex':
                d.minZindex
            }))
Beispiel #7
0
    def update_params(self, d):
        super(MokshaContainer, self).update_params(d)

        if isinstance(d.content, Widget):
            d.widget_name = d.content.__class__.__name__
            content_args = getattr(d, 'content_args', {})

            if isinstance(d.content, LiveWidget):
                topics = d.content.get_topics()
                # FIXME: also unregister the moksha callback functions.  Handle
                # cases where multiple widgets are listening to the same topics
                d.onClose = js_callback("function(o){%s $(o).remove();}" %
                                        unsubscribe_topics(topics))
                d.onIconize = d.onCollapse = js_callback(
                    "function(o){%s}" % unsubscribe_topics(topics))
                d.onRestore = js_callback("function(o){%s}" %
                                          subscribe_topics(topics))

            d.content = d.content.display(**content_args)

        for option in self.options:
            d[option] = d.get(option, True) and option or ''

        d.buttons = ''
        for button in self.button_options:
            if d.get(button, True):
                d.buttons += '%s,' % button[:1]
        d.buttons = d.buttons[:-1]

        d.id = str(uuid.uuid4())

        self.add_call(
            jQuery('#%s' % d.id).buildContainers({
                'elementsPath':
                '/toscawidgets/resources/moksha.widgets.container.container/static/css/elements/',
                'onClose': d.onClose,
                'onResize': d.onResize,
                'onCollapse': d.onCollapse,
                'onIconize': d.onIconize,
                'onDrag': d.onDrag,
                'onRestore': d.onRestore,
            }))
Beispiel #8
0
    def update_params(self, d):
        super(Grid, self).update_params(d)
        if not getattr(d, "id", None):
            raise ValueError, "Moksha Grid is supposed to have id"

        if not d.filters:
            d.filters = {}

        grid_d = {}
        for p in self.params:
            v = d.get(p)
            if v:
                if isinstance(v, dict):
                    v = json.dumps(v)

                grid_d[p] = v

        d['id'] += "-uuid" + str(uuid.uuid4())

        self.add_call(when_ready(jQuery("#%s" % d['id']).mokshagrid(grid_d)))
Beispiel #9
0
    def update_params(self, d):
        super(Grid, self).update_params(d)
        if not getattr(d, "id", None):
            raise ValueError, "Moksha Grid is supposed to have id"

        if not d.filters:
            d.filters = {}

        grid_d = {}
        for p in self.params:
            v = d.get(p)
            if v:
                if isinstance(v, dict):
                    v = json.dumps(v)

                grid_d[p] = v

        d["id"] += "-uuid" + str(uuid.uuid4())

        self.add_call(when_ready(jQuery("#%s" % d["id"]).mokshagrid(grid_d)))
Beispiel #10
0
    def update_params(self, d):
        super(MokshaContainer, self).update_params(d)

        if isinstance(d.content, Widget):
            d.widget_name = d.content.__class__.__name__
            content_args = getattr(d, 'content_args', {})

            if isinstance(d.content, LiveWidget):
                topics = d.content.get_topics()
                # FIXME: also unregister the moksha callback functions.  Handle
                # cases where multiple widgets are listening to the same topics
                d.onClose = js_callback("function(o){%s $(o).remove();}" %
                        unsubscribe_topics(topics))
                d.onIconize = d.onCollapse = js_callback("function(o){%s}" %
                        unsubscribe_topics(topics))
                d.onRestore = js_callback("function(o){%s}" %
                        subscribe_topics(topics))

            d.content = d.content.display(**content_args)

        for option in self.options:
            d[option] = d.get(option, True) and option or ''

        d.buttons = ''
        for button in self.button_options:
            if d.get(button, True):
                d.buttons += '%s,' % button[:1]
        d.buttons = d.buttons[:-1]

        d.id = str(uuid.uuid4())

        self.add_call(jQuery('#%s' % d.id).buildContainers({
            'elementsPath': '/toscawidgets/resources/moksha.widgets.container.container/static/css/elements/',
            'onClose': d.onClose,
            'onResize': d.onResize,
            'onCollapse': d.onCollapse,
            'onIconize': d.onIconize,
            'onDrag': d.onDrag,
            'onRestore': d.onRestore,
            }))
Beispiel #11
0
    def update_params(self, d):
        super(Selectable, self).update_params(d)
        content_id = d.id + '-uuid' + str(uuid4())
        d['content_id'] = content_id

        self.add_call(jQuery("#%s" % d.content_id).moksha_selectable())
Beispiel #12
0
    def update_params(self, d):
        super(Selectable, self).update_params(d)
        content_id = d.id + '-uuid' + str(uuid4())
        d['content_id'] = content_id

        self.add_call(jQuery("#%s" % d.content_id).moksha_selectable())