From 04852360fab3c2fbc6cdc58e10a91e4d87a08489 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 21 Aug 2013 22:25:27 +0200 Subject: [PATCH] [gen] Goodbye Zope Page Templates. --- fields/__init__.py | 6 +- fields/calendar.py | 37 ++-- fields/list.py | 1 - fields/pod.py | 2 +- fields/ref.py | 6 +- fields/search.py | 6 +- gen/installer.py | 35 +-- gen/layout.py | 31 ++- gen/mixins/ToolMixin.py | 47 ++-- gen/mixins/__init__.py | 197 +---------------- gen/model.py | 2 +- gen/ui/ajax.pt | 34 --- gen/ui/appy.js | 2 +- gen/ui/{widgets => }/calendar.js | 0 gen/ui/callMacro.pt | 16 -- gen/ui/edit.pt | 43 ---- gen/ui/footer.pt | 4 - gen/ui/home.pt | 9 - gen/ui/icons.pt | 2 - gen/ui/import.pt | 109 --------- gen/ui/navigate.pt | 143 ------------ gen/ui/page.pt | 369 ------------------------------- gen/ui/portlet.pt | 184 --------------- gen/ui/query.pt | 10 - gen/ui/result.pt | 178 --------------- gen/ui/search.pt | 54 ----- gen/ui/template.pt | 212 ------------------ gen/ui/view.pt | 20 -- gen/ui/widgets/action.pt | 34 --- gen/ui/widgets/boolean.pt | 42 ---- gen/ui/widgets/calendar.pt | 210 ------------------ gen/ui/widgets/computed.pt | 43 ---- gen/ui/widgets/date.pt | 153 ------------- gen/ui/widgets/file.pt | 70 ------ gen/ui/widgets/float.pt | 38 ---- gen/ui/widgets/info.pt | 11 - gen/ui/widgets/integer.pt | 38 ---- gen/ui/widgets/list.pt | 74 ------- gen/ui/widgets/ogone.pt | 28 --- gen/ui/widgets/pod.pt | 26 --- gen/ui/widgets/ref.pt | 285 ------------------------ gen/ui/widgets/show.pt | 241 -------------------- gen/ui/widgets/string.pt | 132 ----------- gen/wrappers/ToolWrapper.py | 42 ++-- gen/wrappers/__init__.py | 16 +- shared/utils.py | 33 +-- 46 files changed, 102 insertions(+), 3173 deletions(-) delete mode 100644 gen/ui/ajax.pt rename gen/ui/{widgets => }/calendar.js (100%) delete mode 100644 gen/ui/callMacro.pt delete mode 100644 gen/ui/edit.pt delete mode 100644 gen/ui/footer.pt delete mode 100644 gen/ui/home.pt delete mode 100644 gen/ui/icons.pt delete mode 100644 gen/ui/import.pt delete mode 100644 gen/ui/navigate.pt delete mode 100644 gen/ui/page.pt delete mode 100644 gen/ui/portlet.pt delete mode 100644 gen/ui/query.pt delete mode 100644 gen/ui/result.pt delete mode 100644 gen/ui/search.pt delete mode 100644 gen/ui/template.pt delete mode 100644 gen/ui/view.pt delete mode 100644 gen/ui/widgets/action.pt delete mode 100644 gen/ui/widgets/boolean.pt delete mode 100644 gen/ui/widgets/calendar.pt delete mode 100644 gen/ui/widgets/computed.pt delete mode 100644 gen/ui/widgets/date.pt delete mode 100644 gen/ui/widgets/file.pt delete mode 100644 gen/ui/widgets/float.pt delete mode 100644 gen/ui/widgets/info.pt delete mode 100644 gen/ui/widgets/integer.pt delete mode 100644 gen/ui/widgets/list.pt delete mode 100644 gen/ui/widgets/ogone.pt delete mode 100644 gen/ui/widgets/pod.pt delete mode 100644 gen/ui/widgets/ref.pt delete mode 100644 gen/ui/widgets/show.pt delete mode 100644 gen/ui/widgets/string.pt diff --git a/fields/__init__.py b/fields/__init__.py index 1f3f34b..3b250d1 100644 --- a/fields/__init__.py +++ b/fields/__init__.py @@ -421,10 +421,6 @@ class Field: self.hasLabel = self.hasLayoutElement('l', layouts) self.hasDescr = self.hasLayoutElement('d', layouts) self.hasHelp = self.hasLayoutElement('h', layouts) - # Store Table instance's dicts instead of instances: this way, they can - # be manipulated in ZPTs. - for layoutType in layouts.iterkeys(): - layouts[layoutType] = layouts[layoutType].get() return layouts def hasLayoutElement(self, element, layouts): @@ -444,7 +440,7 @@ class Field: value for the Field constructor.''' res = '{' for k, v in self.layouts.iteritems(): - res += '"%s":"%s",' % (k, v['layoutString']) + res += '"%s":"%s",' % (k, v.layoutString) res += '}' return res diff --git a/fields/calendar.py b/fields/calendar.py index 1a863c7..3159a6f 100644 --- a/fields/calendar.py +++ b/fields/calendar.py @@ -11,13 +11,12 @@ from persistent.list import PersistentList class Calendar(Field): '''This field allows to produce an agenda (monthly view) and view/edit events on it.''' - jsFiles = {'view': ('widgets/calendar.js',)} + jsFiles = {'view': ('calendar.js',)} # Month view for a calendar. Called by pxView, and directly from the UI, # via Ajax, when the user selects another month. pxMonthView = Px(''' -
+ (q('new'), q(field.name), q(dayString), q(info.eventTypes),\ + q(info.message))"/> -
+
:field.getEventName(zobj, eventType)
-
:event['name']
+
:event.name
@@ -318,10 +318,8 @@ class Ref(Field): self.isBack = False # Initialise the backward reference self.back = back - self.backd = back.__dict__ back.isBack = True back.back = self - back.backd = self.__dict__ # klass may be None in the case we are defining an auto-Ref to the # same class as the class where this field is defined. In this case, # when defining the field within the class, write @@ -580,7 +578,7 @@ class Ref(Field): def mayAdd(self, obj): '''May the user create a new referred object from p_obj via this Ref?''' # We can't (yet) do that on back references. - if self.isBack: return No('is_back') + if self.isBack: return gutils.No('is_back') # Check if this Ref is addable if callable(self.add): add = self.callMethod(obj, self.add) diff --git a/fields/search.py b/fields/search.py index 47f8361..f61b8a6 100644 --- a/fields/search.py +++ b/fields/search.py @@ -147,9 +147,9 @@ class UiSearch: pxView = Px('''
:search['translated'] + (queryUrl, rootClass, search.name)" + class=":search.name == currentSearch and 'portletCurrent' or ''" + title=":search.translatedDescr">:search.translated
''') def __init__(self, search, className, tool): diff --git a/gen/installer.py b/gen/installer.py index 3690286..d97dcf2 100644 --- a/gen/installer.py +++ b/gen/installer.py @@ -19,7 +19,7 @@ homePage = '', re.S) - def getReferenceLabel(self, name, refObject, className=None): - '''p_name is the name of a Ref field with link=True. I need to display, - on an edit view, the p_refObject in the listbox that will allow - the user to choose which object(s) to link through the Ref. - The information to display may only be the object title or more if - field.shownInfo is used.''' - appyType = self.getAppyType(name, className=className) - res = '' - for fieldName in appyType.shownInfo: - refType = refObject.o.getAppyType(fieldName) - value = getattr(refObject, fieldName) - value = refType.getFormattedValue(refObject.o, value) - if refType.type == 'String': - if refType.format == 2: - value = self.xhtmlToText.sub(' ', value) - elif type(value) in sequenceTypes: - value = ', '.join(value) - prefix = '' - if res: - prefix = ' | ' - res += prefix + value - maxWidth = appyType.width or 30 - if len(res) > maxWidth: - res = res[:maxWidth-2] + '...' - return res - - def getReferenceUid(self, refObject): - '''Returns the UID of referred object p_refObject.''' - return refObject.o.UID() - - def getAppyRefIndex(self, fieldName, obj): - '''Gets the position of p_obj within Ref field named p_fieldName.''' - refs = getattr(self.aq_base, fieldName, None) - if not refs: raise IndexError() - return refs.index(obj.UID()) - def mayAddReference(self, name): '''May the user add references via Ref field named p_name in p_folder?''' @@ -1134,7 +1071,7 @@ class BaseMixin: else: event = history[i] res.append(event) - return {'events': res, 'totalNumber': len(history)} + return Object(events=res, totalNumber=len(history)) def mayNavigate(self): '''May the currently logged user see the navigation panel linked to @@ -1258,64 +1195,6 @@ class BaseMixin: self.reindex() return self.goto(self.getUrl(rq['HTTP_REFERER'])) - def fieldValueSelected(self, fieldName, vocabValue, dbValue): - '''When displaying a selection box (ie a String with a validator being a - list), must the _vocabValue appear as selected?''' - rq = self.REQUEST - # Get the value we must compare (from request or from database) - if rq.has_key(fieldName): - compValue = rq.get(fieldName) - else: - compValue = dbValue - # Compare the value - if type(compValue) in sequenceTypes: - if vocabValue in compValue: return True - else: - if vocabValue == compValue: return True - - def checkboxChecked(self, fieldName, dbValue): - '''When displaying a checkbox, must it be checked or not?''' - rq = self.REQUEST - # Get the value we must compare (from request or from database) - if rq.has_key(fieldName): - compValue = rq.get(fieldName) - compValue = compValue in ('True', 1, '1') - else: - compValue = dbValue - # Compare the value - return compValue - - def dateValueSelected(self, fieldName, fieldPart, dateValue, dbValue): - '''When displaying a date field, must the particular p_dateValue be - selected in the field corresponding to the date part?''' - # Get the value we must compare (from request or from database) - rq = self.REQUEST - partName = '%s_%s' % (fieldName, fieldPart) - if rq.has_key(partName): - compValue = rq.get(partName) - if compValue.isdigit(): - compValue = int(compValue) - else: - compValue = dbValue - if compValue: - compValue = getattr(compValue, fieldPart)() - # Compare the value - return compValue == dateValue - - def getSelectableYears(self, name): - '''Gets the list of selectable years for Date field named p_name.''' - return self.getAppyType(name).getSelectableYears() - - def getPossibleValues(self, name, withTranslations, withBlankValue, - className=None): - '''See docstring of String.getPossibleValues.''' - field = self.getAppyType(name, className=className) - return field.getPossibleValues(self, withTranslations, withBlankValue, - className=className) - - def getCaptchaChallenge(self, name): - return self.getAppyType(name).getCaptchaChallenge(self.REQUEST.SESSION) - def appy(self): '''Returns a wrapper object allowing to manipulate p_self the Appy way.''' @@ -1480,20 +1359,6 @@ class BaseMixin: for permission, creators in allCreators.iteritems(): updateRolesForPermission(permission, tuple(creators), folder) - def _appy_getPortalType(self, request): - '''Guess the portal_type of p_self from info about p_self and - p_request.''' - res = None - # If the object is being created, self.portal_type is not correctly - # initialized yet. - if request.has_key('__factory__info__'): - factoryInfo = request['__factory__info__'] - if factoryInfo.has_key('stack'): - res = factoryInfo['stack'][0] - if not res: - res = self.portal_type - return res - getUrlDefaults = {'page':True, 'nav':True} def getUrl(self, base=None, mode='view', **kwargs): '''Returns an URL for this object. @@ -1568,8 +1433,8 @@ class BaseMixin: klass = self.getClass() if hasattr(klass, 'breadcrumb') and not klass.breadcrumb: return () # Compute the breadcrumb - res = [{'url': self.absolute_url(), - 'title': self.getFieldValue('title', layoutType='view')}] + res = [Object(url=self.absolute_url(), + title=self.getFieldValue('title', layoutType='view'))] parent = self.getParent() if parent: res = parent.getBreadCrumb() + res @@ -1681,14 +1546,7 @@ class BaseMixin: layout = Table(layout) else: layout = defaultPageLayouts[layoutType] - return layout.get() - - def getPageTemplate(self, ui, templateName): - '''Returns, in the ui folder, the page template corresponding to - p_templateName.''' - res = ui - for name in templateName.split('/'): res = getattr(res, name) - return res + return layout def download(self, name=None): '''Downloads the content of the file that is in the File field whose @@ -1753,44 +1611,6 @@ class BaseMixin: raise Unauthorized return res - def getEditorInit(self, name): - '''Gets the Javascript init code for displaying a rich editor for - field named p_name.''' - # Define the attributes that will initialize the ckeditor instance for - # this field. - field = self.getAppyType(name) - ckAttrs = {'toolbar': 'Appy', - 'format_tags': '%s' % ';'.join(field.styles)} - if field.width: ckAttrs['width'] = field.width - if field.allowImageUpload: - ckAttrs['filebrowserUploadUrl'] = '%s/upload' % self.absolute_url() - ck = [] - for k, v in ckAttrs.iteritems(): - if isinstance(v, int): sv = str(v) - else: sv = '"%s"' % v - ck.append('%s: %s' % (k, sv)) - return 'CKEDITOR.replace("%s", {%s})' % (name, ', '.join(ck)) - - def getEditorInlineInit(self, name): - '''Gets the Javascript init code for enabling inline edition of a rich - field named p_name.''' - field = self.getAppyType(name) - uid = self.UID() - return "CKEDITOR.disableAutoInline = true;\n" \ - "CKEDITOR.inline('%s_%s_ck', {on: {blur: " \ - "function( event ) { var data = event.editor.getData(); " \ - "askAjaxChunk('%s_%s','POST','%s','page','saveField', "\ - "{'fieldName':'%s', 'fieldContent': encodeURIComponent(data)}, "\ - "null, evalInnerScripts);}}});"% \ - (uid, name, uid, name, self.absolute_url(), name) - - def getCalendarInit(self, name, years): - '''Gets the Javascript init code for displaying a calendar popup for - field named p_name.''' - return 'Calendar.setup({inputField: "%s", button: "%s_img", ' \ - 'onSelect: onSelectDate, range:[%d,%d]});' % \ - (name, name, years[0], years[-1]) - def isTemporary(self): '''Is this object temporary ?''' parent = self.getParentNode() @@ -1802,11 +1622,4 @@ class BaseMixin: '''This method is a general hook for transfering processing of a request to a given field, whose name must be in the request.''' return self.getAppyType(self.REQUEST['name']).process(self) - - def callField(self, name, method, *args, **kwargs): - '''This method i a general hook for calling a p_method defined on a - field named p_name.''' - field = self.getAppyType(name) - exec 'res = field.%s(*args, **kwargs)' % method - return res # ------------------------------------------------------------------------------ diff --git a/gen/model.py b/gen/model.py index 329fefb..4ef941b 100644 --- a/gen/model.py +++ b/gen/model.py @@ -12,7 +12,7 @@ class Protos: # List of attributes that can't be given to a Type constructor notInit = ('id', 'type', 'pythonType', 'slaves', 'isSelect', 'hasLabel', 'hasDescr', 'hasHelp', 'required', 'filterable', 'validable', - 'backd', 'isBack', 'sync', 'pageName', 'masterName') + 'isBack', 'sync', 'pageName', 'masterName') @classmethod def get(self, appyType): '''Returns a prototype instance for p_appyType.''' diff --git a/gen/ui/ajax.pt b/gen/ui/ajax.pt deleted file mode 100644 index e43071d..0000000 --- a/gen/ui/ajax.pt +++ /dev/null @@ -1,34 +0,0 @@ - - This page is called by a XmlHttpRequest object. It requires parameters "page" and "macro": - they are used to call the macro that will render the HTML chunk to be returned to the browser. - It can also have a parameter "action", that refers to a method that will be triggered on - contextObj before returning the result of the macro to the browser. - - - Keys "Expires" and "CacheControl" are used for preventing IE to cache - this page. Indeed, this page is retrieved through an asynchronous XMLHttpRequest by the browser, and - IE caches this by default. - - - - - diff --git a/gen/ui/appy.js b/gen/ui/appy.js index 4b96dc0..08dadd9 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -369,7 +369,7 @@ function initSlaves() { } } -// Function used to submit the appy form on edit.pt +// Function used to submit the appy form on pxEdit function submitAppyForm(button) { var theForm = document.getElementById('appyForm'); // On which button has the user clicked? diff --git a/gen/ui/widgets/calendar.js b/gen/ui/calendar.js similarity index 100% rename from gen/ui/widgets/calendar.js rename to gen/ui/calendar.js diff --git a/gen/ui/callMacro.pt b/gen/ui/callMacro.pt deleted file mode 100644 index fbe76c6..0000000 --- a/gen/ui/callMacro.pt +++ /dev/null @@ -1,16 +0,0 @@ - - This page allows to call any macro from Python code, for example. - - - - diff --git a/gen/ui/edit.pt b/gen/ui/edit.pt deleted file mode 100644 index 15f245d..0000000 --- a/gen/ui/edit.pt +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - Warn the user that the form should be left via buttons - -
- - - - - - - - - -
- -
diff --git a/gen/ui/footer.pt b/gen/ui/footer.pt deleted file mode 100644 index 2e02f64..0000000 --- a/gen/ui/footer.pt +++ /dev/null @@ -1,4 +0,0 @@ -
- - diff --git a/gen/ui/home.pt b/gen/ui/home.pt deleted file mode 100644 index b8f1efe..0000000 --- a/gen/ui/home.pt +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - -
- -
diff --git a/gen/ui/icons.pt b/gen/ui/icons.pt deleted file mode 100644 index 23416d9..0000000 --- a/gen/ui/icons.pt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/gen/ui/import.pt b/gen/ui/import.pt deleted file mode 100644 index d21ea7d..0000000 --- a/gen/ui/import.pt +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - Form for importing several meetings at once. -
- - - -
- -


- - - - - - - - - - - - - - -
- - -
- - - - - -
- Button for importing several elements at once. -


- -

- - - diff --git a/gen/ui/navigate.pt b/gen/ui/navigate.pt deleted file mode 100644 index 41f0e24..0000000 --- a/gen/ui/navigate.pt +++ /dev/null @@ -1,143 +0,0 @@ -
- - Buttons for navigating among a list of elements (next, back, first, last, etc). - - - - Go to the first page - - Go to the previous page - - Explain which elements are currently shown - - Go to the next page - - Go to the last page - - -
  - - -  // -    -
-
- - - Buttons for going to next/previous elements if this one is among bunch of referenced or searched objects. - currentNumber starts with 1. - - -
- Go to the source URL (search or referred object) - - Go to the first page - - Go to the previous page - - Explain which element is currently shown -   -  // -    - - Go to the next page - - Go to the last page - -
-
- - - - - - - - - - This macro displays up/down arrows in a table header column for sorting a given column. - It requires variables "sortable", 'filterable' and 'fieldName'. - - - - - - - - - - - - -Icon for hiding/showing details below the title - - - diff --git a/gen/ui/page.pt b/gen/ui/page.pt deleted file mode 100644 index ff547d1..0000000 --- a/gen/ui/page.pt +++ /dev/null @@ -1,369 +0,0 @@ - - This macro contains global page-related Javascripts. - -
- Include type-specific CSS and JS. - - - - - - Javascript messages - - - Global form for deleting an object -
- - -
- Global form for deleting an event from an object's history -
- - - -
- Global form for unlinking an object -
- - - - -
- Global form for unlocking a page -
- - - -
- Global form for generating a document from a pod template -
- - - - - - -
-
- - - This macro shows the content of page. Because a page is a layouted object, - we simply call the macro that displays a layouted object. - contextObj The Zope object for which this page must be shown - layoutType The kind of layout: "view"? "edit"? "cell"? - layout The layout object that will dictate how object content - will be rendered. - - - - - - - This macro displays all widgets of a given page. It requires: - contextObj The Zope object for which widgets must be shown - page We show widgets of a given page - layoutType We must know if we must render the widgets in a "view", - "edit" or "cell" layout - - - - - - -
- - - -
- - - This macro displays an object's history. It is used by macro "header" below. - - - - Table containing the history - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - Display the previous values of the fields whose value were modified in this change. - - - - - - - - - - - -
-
-
-
- - - This macro displays an object's transitions(s). It is used by macro "header" below. - - -
- - - - - Input field for storing comment - - Buttons for triggering transitions - - -
- Real button - - - Fake button, explaining why the transition can't be triggered - -
-
-
- - - This macros displays the page header, containing object title, - workflow-related info, object history, etc. - -
- - Information that is common to all tabs (object title, state, etc) - - - - - Object history - - - -
- Creator and last modification date - Plus/minus icon for accessing history - -   - ||  - - - Document creator - - - - - Creation and last modification dates - - - - — - - - - - State - - — - : - - -
- -
- -
-
-
-
- -The page footer. - - - - - - This macro shows the range of buttons (next, previous, save,...) and the workflow transitions. - - - - Previous - - - Save - - - Cancel - - - - - - - Next - - Workflow transitions - - - Refresh - - -
- - - - - - - - - - - - - - Edit - - - Locked - - - - - - - - - - - - - - - - - -
- - - This macro displays the global message on the page. - - -
- - -
-
- - - Save the content of a rich field and return its consult view. - Requires request/fieldContent. - - - - diff --git a/gen/ui/portlet.pt b/gen/ui/portlet.pt deleted file mode 100644 index 68106b5..0000000 --- a/gen/ui/portlet.pt +++ /dev/null @@ -1,184 +0,0 @@ -Macro for displaying a search -
- - -
- -Macro for displaying a group of searches - - Group name -
- - - -
- Group content -
- - - An inner group within this group - - - - - - - - - - - - -
-
- -Macro displaying the whole portlet - - - - - - - One section for every searchable root class. - - - A separator if required -
- -
- Section title (link triggers the default search) -
- - -
- - Create a new object from a web form - - Create object(s) by importing data - - - - - Live search -
- - - - - - - -
-
- Advanced search - -
- Predefined searches - - - - - - - - - - -
-
-
- - - This macro displays, within the portlet, the navigation tree for the - currently shown object, made of phases and contained pages. - - - - The box containing phase-related information - - - - -
- The title of the phase -
-
- The page(s) within the phase - - First line: page name and icons -
- - - - - - - - - - - -
- Next lines: links - -
- -
-
-
-
diff --git a/gen/ui/query.pt b/gen/ui/query.pt deleted file mode 100644 index 032e3ac..0000000 --- a/gen/ui/query.pt +++ /dev/null @@ -1,10 +0,0 @@ - - - -
- - - - diff --git a/gen/ui/result.pt b/gen/ui/result.pt deleted file mode 100644 index a0442c8..0000000 --- a/gen/ui/result.pt +++ /dev/null @@ -1,178 +0,0 @@ -Show field content of a given object. - - Title - - - - - Actions: edit, delete -
- - -
-
-
- Any other field - - - - - -
- -Show query results as a list. - - Headers, with filters and sort arrows - - - - - - - Results - - - - - - - - -
- - - -
- -
- -Show query results as a grid. - - - - -
- - - - - - - -
- -Show paginated query results as a list or grid. -
- - - Display here POD templates if required. - - - - -
-     -
- - The title of the search. -

- - () - -  —  - -

- - - Search description - - - -
-
-
- Appy (top) navigation - -
- - Results, as a list or grid - - - - - - - - - - Appy (bottom) navigation - -
- - - - -
-
-
-
diff --git a/gen/ui/search.pt b/gen/ui/search.pt deleted file mode 100644 index f22dfd8..0000000 --- a/gen/ui/search.pt +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Include type-specific CSS and JS. - - - - Search title -

— -


- - Form for searching objects of request/className. -
- - - - - - - - - - -
- - - - -
-
- - Submit button -


- -

-
-
- -
diff --git a/gen/ui/template.pt b/gen/ui/template.pt deleted file mode 100644 index 23793a2..0000000 --- a/gen/ui/template.pt +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - - - - - - - Google Analytics stuff, if enabled - - Grey background shown when popups are shown -
- Popup for confirming an action - - Popup for reinitializing the password - - - - Top banner - - - - The message strip - - - - The user strip - - - - The navigation strip - - - - - - - Footer - - -
- Top links -
- Icon "home" - - - - Additional links (or icons) from icons.pt - - Top-level pages - - Connect link if discreet login - - - Language selector - - - -
-
-
- -
-
- - - The user login form for anonymous users - - User info and controls for authenticated users - - -
- - - - - - -
- Config - - - - Additional icons from icons.pt - - Log out - - - - - - - - -
-
-
- - - Portlet - - Page content - - -
- -
-
- - -
diff --git a/gen/ui/view.pt b/gen/ui/view.pt deleted file mode 100644 index d0e5695..0000000 --- a/gen/ui/view.pt +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - diff --git a/gen/ui/widgets/action.pt b/gen/ui/widgets/action.pt deleted file mode 100644 index b8c8da1..0000000 --- a/gen/ui/widgets/action.pt +++ /dev/null @@ -1,34 +0,0 @@ -View macro for an Action. - -
- - - - - - - -
-
- -Edit macro for an Action. - - -Cell macro for an Action. - - - - -Search macro for an Action. - diff --git a/gen/ui/widgets/boolean.pt b/gen/ui/widgets/boolean.pt deleted file mode 100644 index 7d86aa4..0000000 --- a/gen/ui/widgets/boolean.pt +++ /dev/null @@ -1,42 +0,0 @@ -View macro for a Boolean. - - - - - -Edit macro for an Boolean. - - - - - -Cell macro for an Boolean. - - - - -Search macro for an Boolean. - -
   - - - - - - - - - - - -
-
diff --git a/gen/ui/widgets/calendar.pt b/gen/ui/widgets/calendar.pt deleted file mode 100644 index 49f2500..0000000 --- a/gen/ui/widgets/calendar.pt +++ /dev/null @@ -1,210 +0,0 @@ -Month view macro -
- - -Month chooser -
- Go to the previous month - - Go back to the default date - - - - Go to the next month - - - -
- -Calendar month view - - 1st row: names of days - - - - The calendar in itself - - - - Dump an empty cell if we are out of the supported date range - - Dump a normal cell if we are in range - - - - - - -
-
- - - - - Icon for adding an event - - - - Icon for deleting an event - - - A single event is allowed for the moment -
- -
-
- Events from other calendars - - -
-
-
- Additional info - -
-
- -Popup for creating a calendar event - - -Popup for deleting a calendar event - -
- -View macro - - - - -Edit macro - - -Cell macro - - - - -Search macro - diff --git a/gen/ui/widgets/computed.pt b/gen/ui/widgets/computed.pt deleted file mode 100644 index 8ff7364..0000000 --- a/gen/ui/widgets/computed.pt +++ /dev/null @@ -1,43 +0,0 @@ -View macro for a Computed. - - - - - - -
- -
-
-
- -Ajax-called view content of a non sync Computed field. - - - - -Edit macro for a Computed. - - - - -Cell macro for a Computed. - - - - -Search macro for a Computed. - -
   - -
diff --git a/gen/ui/widgets/date.pt b/gen/ui/widgets/date.pt deleted file mode 100644 index 23515be..0000000 --- a/gen/ui/widgets/date.pt +++ /dev/null @@ -1,153 +0,0 @@ -View macro for a Date. - - -Edit macro for an Date. - - Day - - - Month - - - Year - - The icon for displaying the calendar popup - - - - - - - - : - - - - -Cell macro for an Date. - - - - -Search macro for an Date. - - - - From - - - - - - To - - - - - -
  - - - - / - / - - The icon for displaying the calendar popup - - - - - -
-      - - / - / - - The icon for displaying the calendar popup - - - - - -
-
diff --git a/gen/ui/widgets/file.pt b/gen/ui/widgets/file.pt deleted file mode 100644 index de70889..0000000 --- a/gen/ui/widgets/file.pt +++ /dev/null @@ -1,70 +0,0 @@ -View macro for a File. - - - -   - - - - - - - - - - -Edit macro for an File. - - - -
-
- - Keep the file unchanged. - - -
- Delete the file. - - - -
-
- Replace with a new file. - - -
-
- The upload field. - - -
- -Cell macro for an File. - - - - -Search macro for an File. - diff --git a/gen/ui/widgets/float.pt b/gen/ui/widgets/float.pt deleted file mode 100644 index f6d510b..0000000 --- a/gen/ui/widgets/float.pt +++ /dev/null @@ -1,38 +0,0 @@ -View macro for a Float. - - - - - -Edit macro for an Float. - - - - -Cell macro for an Float. - - - - -Search macro for an Float. - -
   - - - - - - - -
-
diff --git a/gen/ui/widgets/info.pt b/gen/ui/widgets/info.pt deleted file mode 100644 index 5eeee67..0000000 --- a/gen/ui/widgets/info.pt +++ /dev/null @@ -1,11 +0,0 @@ -View macro for an Info. -Shows nothing more. - -Edit macro for an Info. - - -Cell macro for an Info. - - -Search macro for an Info. - diff --git a/gen/ui/widgets/integer.pt b/gen/ui/widgets/integer.pt deleted file mode 100644 index 79d0f5b..0000000 --- a/gen/ui/widgets/integer.pt +++ /dev/null @@ -1,38 +0,0 @@ -View macro for an Integer. - - - - - -Edit macro for an Integer. - - - - -Cell macro for an Integer. - - - - -Search macro for an Integer. - -
   - - - - - - - -
-
diff --git a/gen/ui/widgets/list.pt b/gen/ui/widgets/list.pt deleted file mode 100644 index 9aec355..0000000 --- a/gen/ui/widgets/list.pt +++ /dev/null @@ -1,74 +0,0 @@ -Single row. - - - - - - - Icon for removing the row - - - - - -The whole table, edit or view. - - Header - - - Icon for adding a new row. - - - Template row (edit only) - - - - - Rows of data - - - - - -
- - -
- -View - - - - -Edit - - - The following input makes Appy aware that this field is in the request. - - - - - -Cell - - - - -Search - diff --git a/gen/ui/widgets/ogone.pt b/gen/ui/widgets/ogone.pt deleted file mode 100644 index 2ab59df..0000000 --- a/gen/ui/widgets/ogone.pt +++ /dev/null @@ -1,28 +0,0 @@ -View macro - - var "value" is misused and contains the contact params for Ogone. - The form for sending the payment request to Ogone. -

-
- - - - Submit image - -
-
- -Edit macro (none) - - -Cell macro (=view) - - - - -Search macro (none) - diff --git a/gen/ui/widgets/pod.pt b/gen/ui/widgets/pod.pt deleted file mode 100644 index 60326ad..0000000 --- a/gen/ui/widgets/pod.pt +++ /dev/null @@ -1,26 +0,0 @@ -View macro for a Pod. - - - - - - - - -Edit macro for a Pod. - - -Cell macro for a Pod. - - - - -Search macro for a Pod. - diff --git a/gen/ui/widgets/ref.pt b/gen/ui/widgets/ref.pt deleted file mode 100644 index bbe35d5..0000000 --- a/gen/ui/widgets/ref.pt +++ /dev/null @@ -1,285 +0,0 @@ - - We begin with some sub-macros used within macro "show" defined below. - - - - Displays the title of a referenced object, with a link on - it to reach the consult view for this object. If we are on a back reference, the link - allows to reach the correct page where the forward reference is defined. If we are - on a forward reference, the "nav" parameter is added to the URL for allowing to navigate - from one object to the next/previous on ui/view. - - - - - - Displays icons for triggering actions on a given - referenced object (edit, delete, etc). - - - Arrows for moving objects up or down - - Workflow transitions - - Edit - - Delete - - Unlink - - -
- - - - - - - - - - - - - - - -
-
- -Displays the "plus" icon that allows to add new object - through a reference widget. Indeed, If field was declared as "addable", we must provide - an icon for creating a new linked object (at least if multiplicities allow it). - - - - - - This macro displays, in a cell header from a ref table, icons for sorting the - ref field according to the field that corresponds to this column. - - - - - - -View macro for a Ref. - - - - - - This macro is called by a XmlHttpRequest (or directly by the macro above) - for displaying the referred objects of a reference field. - -
- - This macro displays the Reference widget on a "view" page. - - The definition of "atMostOneRef" above may sound strange: we shouldn't check the actual number - of referenced objects. But for back references people often forget to specify multiplicities. - So concretely, multiplicities (0,None) are coded as (0,1). - - Display a simplified widget if maximum number of - referenced objects is 1. - - If there is no object... - - - - - - If there is an object... - - - - - -
-
- - Display a table in all other cases. - -
- () - - The search button if field is queryable - -
- - Appy (top) navigation - - - No object is present -

- - - -
- - Show forward or backward reference(s) - - - - - - - - - - - -
- - - - - - - -
- - - -
- -
-
- - - - - -
-
-
- - Appy (bottom) navigation - -
-
- -Edit macro for an Ref. - - - - - -Cell macro for a Ref. - - - - -Search macro for a Ref. - -
   - The "and" / "or" radio buttons - - - - -
-
- The list of values - -
diff --git a/gen/ui/widgets/show.pt b/gen/ui/widgets/show.pt deleted file mode 100644 index 9d136db..0000000 --- a/gen/ui/widgets/show.pt +++ /dev/null @@ -1,241 +0,0 @@ - - This macro shows the content of a layouted object, like a page or widget. - It requires: - contextObj The Zope object on which we are working - layoutType The kind of layout: "view"? "edit"? "cell"? - layout The layout object that will dictate how object content - will be rendered. - tagId The ID of the main tag for this layout. - - Options: - contextMacro The base folder containing the macros to call for - rendering the elements within the layout. - Defaults to app.ui - tagName The name of the main tag for this layout (used - a.o. for master/slave relationships). - tagCss Some additional CSS class for the main tag - (ie, the CSS class for a slave). - Note: if layoutType is "cell", alignment and width are not taken into account: - we use the alignment of the column specification instead. - - - - The table header row - - - - The table content - - - -
-
-
-
- - - This macro displays the widget corresponding to a given field. It requires: - contextObj The Zope object for which this widget must be rendered - page The page where the widget lies - layoutType "edit"? "view"? "cell?" - widget The widget to render - - Optionally: - widgetName If the field to show is within a List, we cheat and - include, within the widgetName, the row index. - showChanges Do we need to show a variant of the field showing - successive changes made to it? - - - - - - -Call the previous macro, but from Ajax. - - - - - - This macro displays the widget corresponding to a group of widgets. - It requires: - contextObj The Zope object for which this widget must be rendered - page The page where the widget lies - layoutType "edit"? "view"? "cell?" - widget The widget to render - - -
- - - - - - -
- -
- - - - - - First row: the tabs. - - Other rows: the widgets. - - - -
- - - - - - -
- - - - - -
-
- - - - - - -
- -
-
- - - This macro displays the content of a group of widgets. - It is exclusively called by macro "group" above. - - - Display the title of the group if it is not rendered a fieldset. - - - - - - - The column headers - - - The rows of widgets - - - -
- - - - -
-
-
- - - - - - - - -
- -Displays a field label. - - -Displays a field description. - - - -Displays a field help. - - -Displays validation-error-related info about a field. - - -Displays the fact that a field is required. - - -Button for showing changes to the field. - diff --git a/gen/ui/widgets/string.pt b/gen/ui/widgets/string.pt deleted file mode 100644 index 3d2dcab..0000000 --- a/gen/ui/widgets/string.pt +++ /dev/null @@ -1,132 +0,0 @@ -View macro for a String. - - -
    -
  • -
- - A password - ******** - A URL - - Any other value - - -
- Text - - XHTML text - -
-
-
- -
- -
- -Edit macro for a String. - - - - - - - - Display a captcha if required - - - - - - - - - - - -Cell macro for a String. - - - - - - - - -Search macro for a String. - -
   - Show a simple search field for most String fields. - - - - Show a multi-selection box for fields whose - validator defines a list of values, with a "AND/OR" checkbox. - - The "and" / "or" radio buttons - - - - -
-
- The list of values - -

-
diff --git a/gen/wrappers/ToolWrapper.py b/gen/wrappers/ToolWrapper.py index 61f78bf..14635e3 100644 --- a/gen/wrappers/ToolWrapper.py +++ b/gen/wrappers/ToolWrapper.py @@ -185,8 +185,8 @@ class ToolWrapper(AbstractWrapper):
@@ -285,29 +285,29 @@ class ToolWrapper(AbstractWrapper): # will be the object whose page is shown; if the layouted object is a field, # the layout target will be this field. pxLayoutedObject = Px(''' - + style=":layout.style" id=":tagId" name=":tagName"> - - + - - @@ -292,9 +292,9 @@ class AbstractWrapper(object): startNumber=int(startNumber); batchSize=int(req.get('maxPerPage', 5)); historyInfo=zobj.getHistory(startNumber,batchSize=batchSize)" - if="historyInfo['events']" - var2="objs=historyInfo['events']; - totalNumber=historyInfo['totalNumber']; + if="historyInfo.events" + var2="objs=historyInfo.events; + totalNumber=historyInfo.totalNumber; ajaxHookId='appyHistory'; navBaseCall='askObjectHistory(%s,%s,%d,**v**)' % \ (q(ajaxHookId), q(zobj.absolute_url()), batchSize)"> @@ -516,7 +516,7 @@ class AbstractWrapper(object): @@ -525,7 +525,7 @@ class AbstractWrapper(object): # Displays the fields of a given page for a given object. pxFields = Px(''' -
+
+ - + :getattr(layoutTarget, px) @@ -423,9 +423,9 @@ class ToolWrapper(AbstractWrapper): remember=True, sortBy=sortKey, sortOrder=sortOrder, \ filterKey=filterKey, filterValue=filterValue, \ refObject=refObject, refField=refField); - zobjects=queryResult['objects']; - totalNumber=queryResult['totalNumber']; - batchSize=queryResult['batchSize']; + zobjects=queryResult.objects; + totalNumber=queryResult.totalNumber; + batchSize=queryResult.batchSize; batchNumber=len(zobjects); ajaxHookId='queryResult'; navBaseCall='askQueryResult(%s,%s,%s,%s,**v**)' % \ diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index fff3fe9..60819c8 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -69,9 +69,9 @@ class AbstractWrapper(object): - :bc['title'] + :bc.title - :bc['title'] + :bc.title - +
+
@@ -911,7 +911,7 @@ class AbstractWrapper(object): # returned by method executeResult. res = tool.executeQuery(contentType, search=search, maxResults=maxResults, noSecurity=noSecurity) - return [o.appy() for o in res['objects']] + return [o.appy() for o in res.objects] def search1(self, *args, **kwargs): '''Identical to m_search above, but returns a single result (if any).''' diff --git a/shared/utils.py b/shared/utils.py index f71e5d5..4c742c1 100644 --- a/shared/utils.py +++ b/shared/utils.py @@ -300,8 +300,8 @@ def upper(s): # ------------------------------------------------------------------------------ typeLetters = {'b': bool, 'i': int, 'j': long, 'f':float, 's':str, 'u':unicode, 'l': list, 'd': dict} -exts = {'py': ('.py', '.vpy', '.cpy'), 'pt': ('.pt', '.cpt')} +# ------------------------------------------------------------------------------ class CodeAnalysis: '''This class holds information about some code analysis (line counts) that spans some folder hierarchy.''' @@ -318,25 +318,6 @@ class CodeAnalysis: '''Computes the total number of lines within analysed files.''' return self.emptyLines + self.commentLines + self.codeLines - def analyseZptFile(self, theFile): - '''Analyses the ZPT file named p_fileName.''' - inDoc = False - for line in theFile: - stripped = line.strip() - # Manage a comment - if not inDoc and (line.find('') != -1: - inDoc = False - continue - # Manage an empty line - if not stripped: - self.emptyLines += 1 - else: - self.codeLines += 1 - docSeps = ('"""', "'''") def isPythonDoc(self, line, start, isStart=False): '''Returns True if we find, in p_line, the start of a docstring (if @@ -389,8 +370,7 @@ class CodeAnalysis: self.numberOfFiles += 1 theFile = file(fileName) ext = os.path.splitext(fileName)[1] - if ext in exts['py']: self.analysePythonFile(theFile) - elif ext in exts['pt']: self.analyseZptFile(theFile) + if ext == '.py': self.analysePythonFile(theFile) theFile.close() def printReport(self): @@ -416,11 +396,9 @@ class LinesCounter: else: # It is a Python module self.folder = os.path.dirname(folderOrModule.__file__) - # These dicts will hold information about analysed files + # These dict will hold information about analysed files. self.python = {False: CodeAnalysis('Python'), True: CodeAnalysis('Python (test)')} - self.zpt = {False: CodeAnalysis('ZPT'), - True: CodeAnalysis('ZPT (test)')} # Are we currently analysing real or test code? self.inTest = False # Which paths to exclude from the analysis? @@ -430,7 +408,6 @@ class LinesCounter: def printReport(self): '''Displays on stdout a small analysis report about self.folder.''' for zone in (False, True): self.python[zone].printReport() - for zone in (False, True): self.zpt[zone].printReport() def isExcluded(self, path): '''Must p_path be excluded from the analysis?''' @@ -456,10 +433,8 @@ class LinesCounter: # Scan the files in this folder for fileName in files: ext = os.path.splitext(fileName)[1] - if ext in exts['py']: + if ext == '.py': self.python[self.inTest].analyseFile(j(root, fileName)) - elif ext in exts['pt']: - self.zpt[self.inTest].analyseFile(j(root, fileName)) self.printReport() # ------------------------------------------------------------------------------
:field.pxView :field.pxRender