Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.content.browser.foldercontents.FolderContentsTable Class Reference

List of all members.

Public Member Functions

def __init__
def render
def items
def orderable
def show_sort_column
def editable
def buttons
def setbuttonclass

Public Attributes

 context
 request
 contentFilter
 table

Detailed Description

The foldercontents table renders the table and its actions.

Definition at line 79 of file foldercontents.py.


Constructor & Destructor Documentation

def plone.app.content.browser.foldercontents.FolderContentsTable.__init__ (   self,
  context,
  request,
  contentFilter = {} 
)

Definition at line 84 of file foldercontents.py.

00084 
00085     def __init__(self, context, request, contentFilter={}):
00086         self.context = context
00087         self.request = request
00088         self.contentFilter = contentFilter
00089 
00090         url = self.context.absolute_url()
00091         view_url = url + '/@@folder_contents'
00092         self.table = Table(request, url, view_url, self.items,
00093                            show_sort_column=self.show_sort_column,
00094                            buttons=self.buttons)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 193 of file foldercontents.py.

00193 
00194     def buttons(self):
00195         buttons = []
00196         portal_actions = getToolByName(self.context, 'portal_actions')
00197         button_actions = portal_actions.listActionInfos(object=aq_inner(self.context), categories=('folder_buttons', ))
00198 
00199         # Do not show buttons if there is no data, unless there is data to be
00200         # pasted
00201         if not len(self.items):
00202             if self.context.cb_dataValid():
00203                 for button in button_actions:
00204                     if button['id'] == 'paste':
00205                         return [self.setbuttonclass(button)]
00206             else:
00207                 return []
00208 
00209         for button in button_actions:
00210             # Make proper classes for our buttons
00211             if button['id'] != 'paste' or self.context.cb_dataValid():
00212                 buttons.append(self.setbuttonclass(button))
00213         return buttons

Here is the call graph for this function:

Definition at line 185 of file foldercontents.py.

00185 
00186     def editable(self):
00187         """
00188         """
00189         context_state = getMultiAdapter((self.context, self.request),
00190                                         name=u'plone_context_state')
00191         return context_state.is_editable()

Here is the caller graph for this function:

Definition at line 100 of file foldercontents.py.

00100 
00101     def items(self):
00102         """
00103         """
00104         plone_utils = getToolByName(self.context, 'plone_utils')
00105         plone_view = getMultiAdapter((self.context, self.request), name=u'plone')
00106         portal_workflow = getToolByName(self.context, 'portal_workflow')
00107         portal_properties = getToolByName(self.context, 'portal_properties')
00108         site_properties = portal_properties.site_properties
00109         
00110         use_view_action = site_properties.getProperty('typesUseViewActionInListings', ())
00111         browser_default = self.context.browserDefault()
00112                 
00113         if IATTopic.providedBy(self.context):
00114             contentsMethod = self.context.queryCatalog
00115         else:
00116             contentsMethod = self.context.getFolderContents
00117         
00118         results = []
00119         for i, obj in enumerate(contentsMethod(self.contentFilter)):
00120             if (i + 1) % 2 == 0:
00121                 table_row_class = "draggable even"
00122             else:
00123                 table_row_class = "draggable odd"
00124 
00125             url = obj.getURL()
00126             path = obj.getPath or "/".join(obj.getPhysicalPath())
00127             icon = plone_view.getIcon(obj);
00128             
00129             type_class = 'contenttype-' + plone_utils.normalizeString(
00130                 obj.portal_type)
00131 
00132             review_state = obj.review_state
00133             state_class = 'state-' + plone_utils.normalizeString(review_state)
00134             relative_url = obj.getURL(relative=True)
00135             obj_type = obj.portal_type
00136 
00137             modified = plone_view.toLocalizedTime(
00138                 obj.ModificationDate, long_format=1)
00139             
00140             if obj_type in use_view_action:
00141                 view_url = url + '/view'
00142             elif obj.is_folderish:
00143                 view_url = url + "/folder_contents"              
00144             else:
00145                 view_url = url
00146 
00147             is_browser_default = len(browser_default[1]) == 1 and (
00148                 obj.id == browser_default[1][0])
00149                                  
00150             results.append(dict(
00151                 url = url,
00152                 id  = obj.getId,
00153                 quoted_id = urllib.quote_plus(obj.getId),
00154                 path = path,
00155                 title_or_id = obj.pretty_title_or_id(),
00156                 description = obj.Description,
00157                 obj_type = obj_type,
00158                 size = obj.getObjSize,
00159                 modified = modified,
00160                 icon = icon.html_tag(),
00161                 type_class = type_class,
00162                 wf_state = review_state,
00163                 state_title = portal_workflow.getTitleForStateOnType(review_state,
00164                                                            obj_type),
00165                 state_class = state_class,
00166                 is_browser_default = is_browser_default,
00167                 folderish = obj.is_folderish,
00168                 relative_url = relative_url,
00169                 view_url = view_url,
00170                 table_row_class = table_row_class,
00171                 is_expired = self.context.isExpired(obj),
00172             ))
00173         return results

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 175 of file foldercontents.py.

00175 
00176     def orderable(self):
00177         """
00178         """        
00179         return IOrderedContainer.providedBy(self.context)

Here is the caller graph for this function:

Definition at line 95 of file foldercontents.py.

00095 
00096     def render(self):
00097         return self.table.render()

Definition at line 214 of file foldercontents.py.

00214 
00215     def setbuttonclass(self, button):
00216         if button['id'] == 'paste':
00217             button['cssclass'] = 'standalone'
00218         else:
00219             button['cssclass'] = 'context'
00220         return button

Here is the caller graph for this function:

Definition at line 181 of file foldercontents.py.

00181 
00182     def show_sort_column(self):
00183         return self.orderable and self.editable
        

Here is the call graph for this function:


Member Data Documentation

Definition at line 87 of file foldercontents.py.

Definition at line 85 of file foldercontents.py.

Definition at line 86 of file foldercontents.py.

Definition at line 91 of file foldercontents.py.


The documentation for this class was generated from the following file: