Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
plone.app.portlets.browser.editmanager.EditPortletManagerRenderer Class Reference
Inheritance diagram for plone.app.portlets.browser.editmanager.EditPortletManagerRenderer:
Inheritance graph
[legend]
Collaboration diagram for plone.app.portlets.browser.editmanager.EditPortletManagerRenderer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def visible
def filter
def update
def render
def normalized_manager_name
def baseUrl
def portlets
def addable_portlets
def referer
def url_quote_referer
def context_url

Public Attributes

 manager
 context
 request

Static Public Attributes

tuple template = ViewPageTemplateFile('templates/edit-manager.pt')

Private Member Functions

def _lazyLoadAssignments

Private Attributes

 __parent__
 __updated

Detailed Description

Render a portlet manager in edit mode.

This is the generic renderer, which delegates to the view to determine
which assignments to display.

Definition at line 28 of file editmanager.py.


Constructor & Destructor Documentation

def plone.app.portlets.browser.editmanager.EditPortletManagerRenderer.__init__ (   self,
  context,
  request,
  view,
  manager 
)

Reimplemented in plone.app.portlets.browser.editmanager.ContextualEditPortletManagerRenderer.

Definition at line 39 of file editmanager.py.

00039 
00040     def __init__(self, context, request, view, manager):
00041         self.__parent__ = view
00042         self.manager = manager # part of interface
00043         self.context = context
00044         self.request = request
00045         self.__updated = False
        

Here is the caller graph for this function:


Member Function Documentation

Definition at line 135 of file editmanager.py.

00135 
00136     def _lazyLoadAssignments(self, manager):
00137         return self.__parent__.getAssignmentsForManager(manager)
    

Here is the caller graph for this function:

Definition at line 101 of file editmanager.py.

00101 
00102     def addable_portlets(self):
00103         baseUrl = self.baseUrl()
00104         addviewbase = baseUrl.replace(self.context_url(), '')
00105         def sort_key(v):
00106             return v.get('title')
00107         portlets =  [{
00108             'title' : p.title,
00109             'description' : p.description,
00110             'addview' : '%s/+/%s' % (addviewbase, p.addview)
00111             } for p in self.manager.getAddablePortletTypes()]
00112         portlets.sort(key=sort_key)
00113         return portlets

Here is the call graph for this function:

Definition at line 66 of file editmanager.py.

00066 
00067     def baseUrl(self):
00068         return self.__parent__.getAssignmentMappingUrl(self.manager)

Here is the caller graph for this function:

Definition at line 139 of file editmanager.py.

00139 
00140     def context_url(self):
00141         return str(getMultiAdapter((self.context, self.request), name='absolute_url'))
          

Here is the caller graph for this function:

Definition at line 50 of file editmanager.py.

00050 
00051     def filter(self, portlets):
00052         return portlets

Here is the caller graph for this function:

Definition at line 63 of file editmanager.py.

00063 
00064     def normalized_manager_name(self):
00065         return self.manager.__name__.replace('.', '-')

Definition at line 69 of file editmanager.py.

00069 
00070     def portlets(self):
00071         baseUrl = self.baseUrl()
00072         assignments = self._lazyLoadAssignments(self.manager)
00073         data = []
00074         
00075         manager_name = self.manager.__name__
00076         category = self.__parent__.category
00077         key = self.__parent__.key
00078         
00079         for idx in range(len(assignments)):
00080             name = assignments[idx].__name__
00081             
00082             editview = queryMultiAdapter((assignments[idx], self.request), name='edit', default=None)
00083             if editview is None:
00084                 editviewName = ''
00085             else:
00086                 editviewName = '%s/%s/edit' % (baseUrl, name)
00087             
00088             portlet_hash = hashPortletInfo(dict(manager=manager_name, category=category, 
00089                                                 key=key, name=name,))
00090             
00091             data.append( {'title'      : assignments[idx].title,
00092                           'editview'   : editviewName,
00093                           'hash'       : portlet_hash,
00094                           'up_url'     : '%s/@@move-portlet-up?name=%s' % (baseUrl, name),
00095                           'down_url'   : '%s/@@move-portlet-down?name=%s' % (baseUrl, name),
00096                           'delete_url' : '%s/@@delete-portlet?name=%s' % (baseUrl, name),
00097                           })
00098         if len(data) > 0:
00099             data[0]['up_url'] = data[-1]['down_url'] = None
00100         return data
        

Here is the call graph for this function:

Definition at line 115 of file editmanager.py.

00115 
00116     def referer(self):
00117         view_name = self.request.get('viewname', None)
00118         key = self.request.get('key', None)
00119         base_url = self.request['ACTUAL_URL']
00120         
00121         if view_name:
00122             base_url = self.context_url() + '/' + view_name
00123         
00124         if key:
00125             base_url += '?key=%s' % key
00126         
00127         return base_url

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file editmanager.py.

00056 
00057     def render(self):
00058         if not self.__updated:
00059             raise UpdateNotCalled
00060         return self.template()
    

Definition at line 53 of file editmanager.py.

00053 
00054     def update(self):
00055         self.__updated = True

Here is the caller graph for this function:

Definition at line 129 of file editmanager.py.

00129 
00130     def url_quote_referer(self):
00131         return url_quote(self.referer())
    

Here is the call graph for this function:

Definition at line 47 of file editmanager.py.

00047 
00048     def visible(self):
00049         return True


Member Data Documentation

Definition at line 40 of file editmanager.py.

Definition at line 44 of file editmanager.py.

Definition at line 42 of file editmanager.py.

Definition at line 41 of file editmanager.py.

Definition at line 43 of file editmanager.py.

tuple plone.app.portlets.browser.editmanager.EditPortletManagerRenderer.template = ViewPageTemplateFile('templates/edit-manager.pt') [static]

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