Esempio n. 1
0
 def __call__(self, request, dt_formater = None, attrs = (), dt_attrs = ['created', 'modified', 'date']):
     normal_attrs = ['description', 'type_name',
                     'type_title', 'uid',
                     '__name__', 'size', 'mimetype']
     normal_attrs.extend(attrs)
     #wf_state and name?
     results = {}
     if IContextACL.providedBy(self.context) and self.context.workflow != None:
         results['wf_state'] = self.context.wf_state
         results['workflow'] = self.context.workflow.name
     else:
         results['wf_state'] = ""
         results['workflow'] = ""
     results['css_icon'] = getattr(self.context, 'css_icon', '')
     results['tags'] = tuple(getattr(self.context, 'tags', ()))
     results['is_folder'] = IFolder.providedBy(self.context)
     title = getattr(self.context, 'title', None)
     if not title:
         title = self.context.__name__
     results['title'] = title
     for attr in normal_attrs:
         results[attr] = getattr(self.context, attr, '')
         if isinstance(results[attr], TranslationString):
             results[attr] = request.localizer.translate(results[attr])
     for attr in dt_attrs:
         val = getattr(self.context, attr, '')
         if val and dt_formater:
             results[attr] = request.localizer.translate(dt_formater(val))
         else:
             results[attr] = val
     return results
Esempio n. 2
0
 def get_local_nav_objects(self, context):
     #FIXME: Conditions for navigation!
     if IFolder.providedBy(context):
         for obj in context.values():
             if getattr(obj, 'nav_visible', False):
                 if self.request.has_permission(security.PERM_VIEW, obj):
                     yield obj
Esempio n. 3
0
 def __call__(self, request, dt_formater = None, attrs = (), dt_atts = ()):
     normal_attrs = ['description', 'type_name',
                     'type_title', 'uid',
                     '__name__', 'size', 'mimetype']
     normal_attrs.extend(attrs)
     dt_attrs = ['created', 'modified']
     dt_attrs.extend(dt_attrs)
     #wf_state and name?
     results = {}
     results['icon'] = getattr(self.context, 'icon', 'file')
     results['tags'] = tuple(getattr(self.context, 'tags', ()))
     results['is_folder'] = IFolder.providedBy(self.context)
     title = getattr(self.context, 'title', None)
     if not title:
         title = self.context.__name__
     results['title'] = title
     for attr in normal_attrs:
         results[attr] = getattr(self.context, attr, '')
     for attr in dt_attrs:
         val = getattr(self.context, attr, '')
         if val and dt_formater:
             results[attr] = request.localizer.translate(dt_formater(val))
         else:
             results[attr] = val
     return results
Esempio n. 4
0
 def __call__(self, request, dt_formater=None, attrs=(), dt_atts=()):
     normal_attrs = [
         'description', 'type_name', 'type_title', 'uid', '__name__',
         'size', 'mimetype'
     ]
     normal_attrs.extend(attrs)
     dt_attrs = ['created', 'modified']
     dt_attrs.extend(dt_attrs)
     #wf_state and name?
     results = {}
     results['icon'] = getattr(self.context, 'icon', 'file')
     results['tags'] = tuple(getattr(self.context, 'tags', ()))
     results['is_folder'] = IFolder.providedBy(self.context)
     title = getattr(self.context, 'title', None)
     if not title:
         title = self.context.__name__
     results['title'] = title
     for attr in normal_attrs:
         results[attr] = getattr(self.context, attr, '')
     for attr in dt_attrs:
         val = getattr(self.context, attr, '')
         if val and dt_formater:
             results[attr] = request.localizer.translate(dt_formater(val))
         else:
             results[attr] = val
     return results
Esempio n. 5
0
 def __call__(self):
     jqueryui.need()
     touchpunch_js.need()
     pure_js.need()
     return {'is_folderish': IFolder.providedBy(self.context)}
Esempio n. 6
0
 def __call__(self):
     jqueryui.need()
     touchpunch_js.need()
     pure_js.need()
     return {'is_folderish': IFolder.providedBy(self.context)}
Esempio n. 7
0
 def __call__(self):
     folderish_contents_js.need()
     touchpunch_js.need()
     addable_types = set([x.type_name for x in self.addable_content(self.context)])
     show_upload = bool(set(['File', 'Image']) & addable_types)
     return {'is_folderish': IFolder.providedBy(self.context), 'show_upload': show_upload}