From ebefd631a265bcca97adc8e52cf4d88b21581bab Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 16 Mar 2008 21:11:08 +0000 Subject: [PATCH] added view and actions for a pseudo-folder concept type git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2457 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/configure.zcml | 9 ++++ browser/folder.py | 57 +++++++++++++++++++++++++ helpers.txt | 71 ++++++++++++++++++++++++++++++-- interfaces.py | 1 - locales/de/LC_MESSAGES/loops.mo | Bin 6341 -> 6632 bytes locales/de/LC_MESSAGES/loops.po | 15 +++++++ 6 files changed, 148 insertions(+), 5 deletions(-) create mode 100755 browser/folder.py diff --git a/browser/configure.zcml b/browser/configure.zcml index 4108841..7019d2f 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -221,6 +221,15 @@ permission="zope.View" /> + + >> ITopic.providedBy(cc1Adapter) True +There is a shortcut to getting the typeInterface adapter for an object. + + >>> from loops.common import adapted + >>> cc1Adapter = adapted(cc1) + >>> ITopic.providedBy(cc1Adapter) + True + Simple access to type information with BaseView ----------------------------------------------- @@ -299,8 +306,8 @@ context object's type: -Concepts as queries -------------------- +Concepts as Queries +=================== We first have to set up the query type, i.e. a type concept associated with the IQueryConcept interface. The query type concept itself has already @@ -348,8 +355,8 @@ view/multi-adapter with this name: -Controlling presentation using view properties ----------------------------------------------- +Controlling Presentation Using View Properties +============================================== >>> from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations >>> from zope.annotation.attribute import AttributeAnnotations @@ -405,3 +412,59 @@ browser). >>> controller = Controller(view, request) >>> controller.skinName.value 'SuperSkin' + + +Folders +======= + + We may provide a concept type called a folder - there is no special + functionality about it but it may be used for building a pseudo hierarchy + using nested folders. This may make it easier for users to map the + structures of their documents in the filesystem to the loops concept + map. + + >>> from loops.setup import addAndConfigureObject + >>> tFolder = addAndConfigureObject(concepts, Concept, 'folder', + ... title=u'Folder', conceptType=typeObject) + +Usually we want to create folders only in objects of a certain type, +e.g. in a domain. So we activate the folder creation action by providing +the domain type with a corresponding option. + + >>> tDomain = concepts['domain'] + >>> taDomain = adapted(tDomain) + >>> taDomain.options = ['action.portlet:createFolder'] + +Importing the FolderView will register this action. + + >>> from loops.browser.folder import FolderView + +If we now create a domain and set up a view on it it will provide the +folder creation action. + + >>> general = addAndConfigureObject(concepts, Concept, 'general', + ... title=u'General', conceptType=tDomain) + + >>> from loops.browser.concept import ConceptView + >>> view = ConceptView(general, TestRequest()) + >>> sorted(a.name for a in view.getActions('portlet')) + ['createFolder'] + +Let's now create a folder. + + >>> f01 = addAndConfigureObject(concepts, Concept, 'f01', + ... title=u'Test Folder', conceptType=tFolder) + +A folder should be associated with a FolderView that provides two actions +for editing the folder and for creating a new subfolder. + + >>> view = FolderView(f01, TestRequest()) + >>> sorted(a.name for a in view.getActions('portlet')) + ['createFolder', 'editFolder'] + + +Fin de partie +============= + + >>> placefulTearDown() + diff --git a/interfaces.py b/interfaces.py index 14ba8fd..266f454 100644 --- a/interfaces.py +++ b/interfaces.py @@ -28,7 +28,6 @@ from zope import schema from zope.app.container.constraints import contains, containers from zope.app.container.interfaces import IContainer, IOrderedContainer from zope.app.file.interfaces import IImage as IBaseAsset -from zope.app.folder.interfaces import IFolder from zope.component.interfaces import IObjectEvent from zope.size.interfaces import ISized diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index 529e1f04865d7a01d8c135ca7b91c881eef1a256..f9293a5d3240bf6925e3826346b33161f2a9a961 100644 GIT binary patch delta 2516 zcmYk+TWnNC9LMqLZK3qC(r#~vuoVg|Eo-s06uDHYl$-6gRuHPSblX#?t=nX+7;iaI z(fC3z)YTBRsX{P{*2GGApeCk7Q_vUVgGLBEKw^!3Km!kz7r(#V*|?Mb_cJp+XXZb1 z=A7@>&DOYA^U|Y+GC(XPhSQ8u$4?%9DE>@iTCo%>F@g(l6qn;^ybFK8Z2T1&!rZ_t zoVES8uz+^TB4Y}%2i<#f_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ERJj(#`xB7flt4mNxY?Z^pqhEAe+-iy~iLh>ZT*Hj$YZ)n0fv~Hq>Xv0lt!Y&SW zZ~z_2L3BwD<2oF{^irZTI)#3Senw~Pmw5j#WOYI&NlShIi>TPc8nnSiw1ExiT5Uo* zwjX_N7)>;aH{l6%#D5@@70#g}ozIUvFGB}Zjdr9Zn!qgbhi)n+>_r>ii?k8;p}TYl z9q}`0gD>M+JcTy=JDM<`>9HfF=y@gj{1U9gM!W*=MhAKnlPjr=#tWaJ9r+TSx*yQj z>?d@}viNSgrX}b|7Nd!lV?EZRU(kVg{c$u=Dta_tA4T?QIPUyAvQu2(tw|SqXxUDz zC-xAx5|8)0#ZEsaD*x;ArgW|kAq=)dKTSV_44Hxq8GRq^7D z=yWqF{}tZ^%QeJmVv8pf*Sj)Z3*l1SO}I1`H}CC)OVUobS$m1=2+Im0*}=h0Vp&6M zO4slkmI2TWE1&W{Mvj z_d+w_u4hw+7UB}ZO<7B<9k0lqmyueRb6@JioP(*J+|8+p+{eZ{^LA&YJ}5kt>MwdV V)mB`VYAxG)<62nws-&l diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index 932cf8b..2e1a03e 100644 --- a/locales/de/LC_MESSAGES/loops.po +++ b/locales/de/LC_MESSAGES/loops.po @@ -17,6 +17,9 @@ msgstr "Begriff" msgid "Resource" msgstr "Ressource" +msgid "Folder" +msgstr "Ordner" + msgid "Log out" msgstr "Abmelden" @@ -32,6 +35,18 @@ msgstr "Ressource anlegen..." msgid "Create a new resource object." msgstr "Eine neue Ressource erzeugen" +msgid "Create Folder..." +msgstr "Ordner anlegen..." + +msgid "Create a new folder." +msgstr "Einen neuen Ordner anlegen" + +msgid "Edit Folder..." +msgstr "Ordner bearbeiten..." + +msgid "Modify folder." +msgstr "Ordner ändern" + msgid "Edit Blog Post..." msgstr "Eintrag bearbeiten..."