Back to index

plone3  3.1.7
Public Member Functions
plone.app.kss.content_replacer.ContentMenuView Class Reference
Inheritance diagram for plone.app.kss.content_replacer.ContentMenuView:
Inheritance graph
[legend]
Collaboration diagram for plone.app.kss.content_replacer.ContentMenuView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def cutObject
def copyObject
def changeViewTemplate
def changeWorkflowState

Detailed Description

Definition at line 174 of file content_replacer.py.


Member Function Documentation

Replace content region after selecting template from drop-down.

Usage::
    dl#templateMenu dd a:click {
    evt-click-preventdefault: True;
    action-server: changeViewTemplate;
    changeViewTemplate-url: nodeAttr(href);
    }

REMARK:

Cheat at the moment: we render down the whole page
but take out the required part only
This will be optimized more to replace the main template
for the context of the call

Warning when we leave the page is not implemented.

Definition at line 195 of file content_replacer.py.

00195 
00196     def changeViewTemplate(self, url):
00197         '''Replace content region after selecting template from drop-down.
00198         
00199         Usage::
00200             dl#templateMenu dd a:click {
00201             evt-click-preventdefault: True;
00202             action-server: changeViewTemplate;
00203             changeViewTemplate-url: nodeAttr(href);
00204             }
00205 
00206         REMARK:
00207 
00208         Cheat at the moment: we render down the whole page
00209         but take out the required part only
00210         This will be optimized more to replace the main template
00211         for the context of the call
00212 
00213         Warning when we leave the page is not implemented.
00214         '''
00215         templateid = url.split('templateId=')[-1].split('&')[0]
00216         context = getCurrentContext(self.context)
00217         wrapping = acquirerFactory(context)
00218         # XXX I believe selectViewTemplate script will be replaced by an
00219         # adapter or a view in the new implementation of CMFDynamicFTI
00220         context.selectViewTemplate(templateid)
00221         # Figure out the template to render.
00222         template = wrapping.restrictedTraverse(templateid)
00223         # We render it
00224         content = template()
00225         # Now. We take out the required node from it!
00226         # We need this in any way, as we don't know if the template
00227         # actually used main_template! In that case we would have
00228         # the *whole* html which is wrong.
00229 
00230         soup = BeautifulSoup(content)
00231         replace_id = 'region-content'
00232         tag = soup.find('div', id=replace_id)
00233         if tag is None:
00234             raise RuntimeError, 'Result content did not contain <div id="%s">' % replace_id
00235         # now we send it back to the client
00236         result = unicode(tag)
00237         ksscore = self.getCommandSet('core')
00238         ksscore.replaceHTML(ksscore.getHtmlIdSelector(replace_id), result)
00239 
00240         self.getCommandSet('plone').refreshContentMenu()
00241         self.issueAllPortalMessages()
00242         self.cancelRedirect()
00243         # XXX We need to take care of the URL history here,
00244         # For instance if we come from the edit page and change the view we
00245         # stay on the edit URL but with a view page

Here is the call graph for this function:

Definition at line 247 of file content_replacer.py.

00247 
00248     def changeWorkflowState(self, url):
00249         context = aq_inner(self.context)
00250         ksscore = self.getCommandSet('core')
00251         zopecommands = self.getCommandSet('zope')
00252         plonecommands = self.getCommandSet('plone')
00253         
00254         locking = ILockable(context, None)
00255         if locking is not None and not locking.can_safely_unlock():
00256             selector = ksscore.getHtmlIdSelector('plone-lock-status')
00257             zopecommands.refreshViewlet(selector, 'plone.abovecontent', 'plone.lockinfo')
00258             plonecommands.refreshContentMenu()
00259             return self.render()
00260 
00261         (proto, host, path, query, anchor) = urlsplit(url)
00262         if not path.endswith('content_status_modify'):
00263             raise KSSExplicitError, 'content_status_modify is not handled'
00264         action = query.split("workflow_action=")[-1].split('&')[0]
00265         context.content_status_modify(action)
00266         selector = ksscore.getCssSelector('.contentViews')
00267         zopecommands.refreshViewlet(selector, 'plone.contentviews', 'plone.contentviews')
00268         plonecommands.refreshContentMenu()
00269         self.issueAllPortalMessages()
00270         self.cancelRedirect()

Definition at line 187 of file content_replacer.py.

00187 
00188     def copyObject(self):
00189         context = getCurrentContext(self.context)
00190         context.object_copy()
00191         self.getCommandSet('plone').refreshContentMenu()
00192         self.issueAllPortalMessages()
00193         self.cancelRedirect()

Here is the call graph for this function:

Definition at line 179 of file content_replacer.py.

00179 
00180     def cutObject(self):
00181         context = getCurrentContext(self.context)
00182         context.object_cut()
00183         self.getCommandSet('plone').refreshContentMenu()
00184         self.issueAllPortalMessages()
00185         self.cancelRedirect()

Here is the call graph for this function:


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