Beispiel #1
0
 def _get_query_value(self, resource, context, name):
     if name == 'target':
         # Target is a special case
         site_root = resource.get_site_root()
         target = self._get_target(resource, context)
         return site_root.get_pathto(target)
     return Feed_View._get_query_value(self, resource, context, name)
Beispiel #2
0
 def _get_namespace(self, brain, resource, context, column, current_path):
     if column == 'title':
         # Return title or long_title
         title = resource.get_property('title')
         if title:
             return title
         # long title
         long_title = resource.get_property('long_title')
         if long_title:
             return long_title
         # Fallback
         return resource.get_title()
     return Feed_View._get_namespace(self, brain, resource, context, column,
                                     current_path)
Beispiel #3
0
def itws_get_item_value(self, resource, context, item, column):
    brain, item_resource = item
    if column == 'js_link':
        id = str(resource.get_canonical_path().get_pathto(brain.abspath))
        id += self.resource_action
        return id
    elif column == 'is_selectable':
        return isinstance(item_resource, self.get_item_classes())
    elif column == 'link':
        if self.is_folder(item_resource):
            path_to_item = context.site_root.get_pathto(item_resource)
            url_dic = {'target': str(path_to_item),
                       # Avoid search conservation
                       'search_text': None,
                       'search_type': None,
                       # Reset batch
                       'batch_start': None}
            return context.uri.replace(**url_dic)
        return None
    return Feed_View.get_item_value(self, resource, context, item, column)
Beispiel #4
0
def itws_get_table_namespace(self, resource, context, items):
    namespace =  Feed_View.get_table_namespace(self, resource, context, items)
    # Sort by
    widget = SelectWidget('sort_by',
                          datatype=SortBy_Enumerate,
                          value=context.query['sort_by'],
                          has_empty_option=False)
    namespace['sort_by'] = widget.render()
    widget = SelectWidget('reverse',
                          datatype=Reverse_Enumerate,
                          value=str(int(context.query['reverse'])),
                          has_empty_option=False)
    namespace['reverse'] = widget.render()
    for key in ['target', 'target_id', 'mode']:
        namespace[key] = context.get_form_value(key)
    # If target is no defined in the query (when we open the popup)
    # Get the target value from attributes
    if namespace['target'] is None:
        popup_root_abspath = self.popup_root.get_abspath()
        target = popup_root_abspath.get_pathto(self.target.get_abspath())
        namespace['target'] = target
    return namespace
Beispiel #5
0
 def get_items(self, resource, context, *args):
     args = [PhraseQuery('format', 'news')]
     return Feed_View.get_items(self, resource, context, *args)
Beispiel #6
0
 def get_search_types(self, resource, context):
     target = self._get_target(resource, context)
     return Feed_View.get_search_types(self, target, context)
Beispiel #7
0
 def get_items(self, resource, context, *args):
     # Get configuration
     args = list(args)
     args.append(PhraseQuery('is_tagsaware', True))
     return Feed_View.get_items(self, resource, context, *args)