diff --git a/README.txt b/README.txt index 070991a..3cea3e4 100755 --- a/README.txt +++ b/README.txt @@ -463,6 +463,18 @@ Node Views ... print item.url, view.selected(item) http://127.0.0.1/loops/views/m1/m11 True +There is an openEditWindow() method that returns a JavaScript call for +opening a new browser window for editing; but only if the view is +editable: + + >>> page.openEditWindow() + '' + >>> page.editable = True + >>> page.openEditWindow() + "openEditWindow('http://127.0.0.1/loops/views/m1/m11/@@edit.html')" + >>> page.openEditWindow('configure.html') + "openEditWindow('http://127.0.0.1/loops/views/m1/m11/@@configure.html')" + A Node and its Target --------------------- diff --git a/browser/add.pt b/browser/add.pt new file mode 100644 index 0000000..7649331 --- /dev/null +++ b/browser/add.pt @@ -0,0 +1,73 @@ + + +
+ +
+ +
+ +
+ +

Edit something

+ +

+ +

+ There are 6 input errors. +

+ +
+
+ +
+
Extra top
+
+
+ +
+ +
+ +
+
Extra bottom
+
+
+ +
+ +
+

+
+

+ +   Object Name   + + + +
+
+ +
+
+ +
+ +
+ +
+ + + diff --git a/browser/common.py b/browser/common.py index 52bc59e..a83e70c 100644 --- a/browser/common.py +++ b/browser/common.py @@ -32,6 +32,7 @@ from zope.interface import implements from zope.app.publisher.browser import applySkin from zope.publisher.interfaces.browser import ISkin from zope.schema.vocabulary import SimpleTerm +from zope.security import canAccess, canWrite from zope.security.proxy import removeSecurityProxy from cybertools.typology.interfaces import IType @@ -62,12 +63,6 @@ class BaseView(object): def getController(self): return self._controller controller = property(getController, setController) - #@Lazy - #def resourceBase(self): - # skinSetter = self.skin and ('/++skin++' + self.skin.__name__) or '' - # # TODO: put '/@@' etc after path to site instead of directly after URL0 - # return self.request.URL[0] + skinSetter + '/@@/' - @Lazy def modified(self): """ get date/time of last modification @@ -119,6 +114,19 @@ class BaseView(object): def uniqueId(self): return zapi.getUtility(IIntIds).getId(self.context) + @Lazy + def editable(self): + return canWrite(self.context, 'title') + + def openEditWindow(self, viewName='edit.html'): + if self.editable: + return "openEditWindow('%s/@@%s')" % (self.url, viewName) + return '' + + @Lazy + def xeditable(self): + return getattr(self.context, 'contentType', '').startswith('text/') + class LoopsTerms(object): """ Provide the ITerms interface, e.g. for usage in selection @@ -138,7 +146,10 @@ class LoopsTerms(object): return self.context.getLoopsRoot() def getTerm(self, value): - return BaseView(value, self.request) + #return BaseView(value, self.request) + title = value.title or zapi.getName(value) + token = self.loopsRoot.getLoopsUri(value) + return SimpleTerm(value, token, title) def getValue(self, token): return self.loopsRoot.loopsTraverse(token) diff --git a/browser/concept.py b/browser/concept.py index 442cea3..053219a 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -52,8 +52,6 @@ class ConceptEditForm(EditForm): @Lazy def typeInterface(self): - print IType(self.context) - print IType(self.context).typeInterface return IType(self.context).typeInterface @property diff --git a/browser/concept_macros.pt b/browser/concept_macros.pt index 6202ae1..7d55c33 100644 --- a/browser/concept_macros.pt +++ b/browser/concept_macros.pt @@ -1,9 +1,13 @@
-

Concept: - Title

+

+ Concept: + Title +

-
+

Parents

-
+

Children

-
+

Resources

- @@ -368,7 +367,7 @@ name="AddLoopsNode.html" content_factory="loops.view.Node" schema="loops.interfaces.INode" - fields="title description nodeType body" + fields="title description nodeType viewer body" permission="zope.ManageContent"> @@ -399,10 +398,30 @@ + + + + + + + + - + permission="zope.ManageContent" + />
The body
The body
@@ -37,9 +35,8 @@
+ ondblclick python: item.openEditWindow('configure.html')"> Node Body
@@ -52,9 +49,8 @@
+ ondblclick python: item.openEditWindow('edit_target.html')"> The body @@ -66,17 +62,15 @@
+ ondblclick python: item.openEditWindow('edit_target.html')">
The body
@@ -86,9 +80,8 @@
+ tal:attributes="ondblclick view/openEditWindow"> Listing

@@ -124,9 +117,7 @@ + onclick item/openEditWindow;"> diff --git a/browser/node_target.pt b/browser/node_target.pt index efeb028..f6b0b13 100644 --- a/browser/node_target.pt +++ b/browser/node_target.pt @@ -16,12 +16,10 @@ Document xy - External Editor + + +
diff --git a/browser/resource_configure.pt b/browser/resource_configure.pt index b8bc723..83fded2 100644 --- a/browser/resource_configure.pt +++ b/browser/resource_configure.pt @@ -7,11 +7,9 @@

Concept Title - + + +


+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
Inserted titleAdd Content
+ + + +
+ Folders are generic containers for content, including other + folders. +
+

+ +
+ +
+ +
+ +