Hi
I'm now developing a little tool using plone 3 and kss, something like "drag
and drop" behavour.
I need to obtain a portlet reference by its hash code.
I show you some code:
interfaces.py
class IDynamicMenu(Interface):
""" Generate recent menu """
def getMenu():
""" Get html menu """
------------------------------------*
recentMenu.py
from Products.kssdnd.interfaces import IDynamicMenu
class RecentMenu(object):
implements(IDynamicMenu)
def getMenu(self):
...
# some code to do a nice menu
...
return
------------------------------------*
configure.zcml
<adapter
provides="Products.kssdnd.interfaces.IDynamicMenu"
for="Products.CMFPlone.browser.interfaces.IRecentPortlet"
factory="Products.kssdnd.recentMenu.RecentMenu"
/>
<adapter
provides="Products.kssdnd.interfaces.IDynamicMenu"
for="Products.CMFPlone.browser.interfaces.(portlet interface)"
factory="Products.kssdnd.(class that implement the specific menu)"
/>
...
more adapters
...
------------------------------------*
dragSupport.py
...
def getReply(self,urlObject = None, urlDest = None, portlethash = None):
...
#here code to obtain portlet reference
...
#call of adapter
menu = IDynamicMenu(...portlet reference...)
menu.getMenu()
...
------------------------------------*
kssdnd.kss
...
# get info by kss, like hash, url of object to drag...
.documentContent a:dad-drag {}
.documentContent a:dad-start {
action-client: setStateVar;
setStateVar-varname: urlObject;
setStateVar-value: nodeAttr('href');
}
dl.portlet:dad-hover {
action-client: setStateVar;
setStateVar-varname: portlethash;
setStateVar-value: kssAttr(portlethash, True);
}
.portlet:dad-drop{
action-client: setAttribute;
setAttribute-name: id;
setAttribute-value: 'choiseMenu';
action-server: getReply;
getReply-urlObject: stateVar(urlObject);
getReply-Hash: stateVar(portlethash);
...
}
...
-------------------------------------*
How to obtain this portlet reference? Varius portlet must have different
menu ;)
Thanks Nicola Senno
--
View this message in context:
http://www.nabble.com/portlet-reference-from-hash-code-tf4269138s20094.html#a12150416
Sent from the Product Developers mailing list archive at Nabble.com.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers