ZEXP((U App.ProductqUProductqtqNt.}q(USTX_Document_add_permissionq(Uq(UApp.PermissionqU PermissionqttQU__ac_local_roles__q }q Uzopeq ]q UOwnerq asU_objectsq(}q(U meta_typeqUZ ClassqUidqU STX_Documentqu}q(hU DTML MethodqhUSTX_Document_addFormqu}q(hhhUSTX_Document_addqu}q(hUZope Permissionqhhu}q(hU Zope FactoryqhUSTX_Document_factoryqu}q(U meta_typeqU DTML Documentq Uidq!UREADMEq"utUREADMEq#(Uq$(UOFS.DTMLDocumentq%U DTMLDocumentq&ttQU STX_Documentq'(Uq((UZClasses.ZClassq)UZClassq*ttQUversionq+U1.2q,hh'h(Uq-(UOFS.DTMLMethodq.U DTMLMethodq/ttQh(Uq0(h.U DTMLMethodq1ttQh(Uq2(U App.Factoryq3UFactoryq4ttQUtitleq5UStructured Text Documentq6u.((UApp.PermissionqU PermissionqtqNt.}q(UtitleqU#STX_Document constructor permissionqUidqUSTX_Document_add_permissionqUnameq UAdd STX_Documentsq U__ac_local_roles__q }q Uzopeq ]qUOwnerqasu. ((UOFS.DTMLDocumentqU DTMLDocumentqtqNt.}q(U changes_stxqTB**1.2** (18 February 2000) * Added README, explaining workaround for the "can't use ZClass as index_html" problem. * Added file upload to the constructor form. **1.1** (17 February 2000) * Added file upload to edit_form. **1.0** (15 February 2000) * Initial release, at behest of Kevin Dangoor on PTK list.qU__ac_local_roles__q}qUzopeq ]q UOwnerq asU__name__q UREADMEq U_varsq}qU _propertiesq(}q(UmodeqUwUidqUtitleqUtypeqUstringqu}q(hU notes_stxqhUtextqu}q(hU changes_stxqhUtextqu}q(hUtodo_stxqhUtextqutq hU2Design Notes, Known Issues, and General Maunderingq!Uglobalsq"}q#hU* Add "preview" facility (steal from ZGotW). * Strip potentially malicious HTML tags from source on save? * Refactor edit form to allow reuse outside of Zope's management interface. q$Urawq%T6

Design Notes

Change History

To Do's / Known Issues

q&hT* STX_Document is a "pure ZClass" product: it needs no outside assistance from lordly Python products to make it go. I went this route with the product back when I was first beginning to use ZClasses in a big way; it still seems like a pretty reasonable design choice today. * STX_Document can serve as a pretty easy, but useful, introduction into the world of user-defined ZClasses. In particular, it works as a starting point for other, more elaborate "content" objects. * One consequence of this choice is that STX_Documents cannot be used, out of the box, as drop-in replacements for DTML Methods/Documents *in all cases*: in particular, a stock STX_Document won't do the Right Thing (TM) when used as the index_html default view for a Folder or other ObjectManager. * To remedy this lack, I have blazed the following trail: 1. Get Lalo's excellent "RenderableZClass":http://www.zope.org/Members/lalo/RenderableZClass, and install it in your Zope. 2. Inside the STX_Document product, add a new ZClass (call it RSTX_Document), with Renderable and CatalogAware as base classes (in that order). 3. Duplicate the two propertysheets from STX_Document (HelpText, which has help_stx, as "static" content showing how to use StructuredText; and Properties, which has title:string and body_stx:text instance properties). 4. Copy and paste all the methods from STX_Document into RSTX_Document. - Copy and paste the index_html method and name the copy 'render'. 5. Duplicate the views from STX_Document onto the RSTX_Document Views tab: **Edit** -- propertysheets/Properties **View** -- index_html **Security** -- manage_access **Help** -- help_stx * I have decided *not* to fold these changes into STX_Document itself in order to preserve its nice "didactic" qualities: it is still useful for the majority of users in the original form, and by leaving it alone, I avoid adding a dependency on another third-party product. * If DC ever adds the functionality of Lalo's product to the "base" ZClass (I hope they do!), then STX_Document will automatically become a first-class citizen. q'u.((UZClasses.ZClassqUZClassqtqNt.}q(U_permissionMapperqcAccessControl.PermissionMapping PM qNRq}qU"_Create_class_instances_Permissionq U_Add_STX_Documents_Permissionq sbU_zclass_propertysheets_classq Uq QUidq U STX_DocumentqU_zbasesq]q(cZClasses.ZClass ZObject qcProducts.ZCatalog _ZClass_for_CatalogAware qeU__ac_local_roles__q}qUzopeq]qUOwnerqasU_zclass_qUqQUtitleqUStructured Text DocumentqUpropertysheetsqUqQu.H((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqUSTX_Document constructorqUrawqT~ Add STX_Document Use uploaded body, if it exists. Now we need to return something. We do this via a redirect so that the URL is correct. Unfortunately, the way we do this depends on whether we live in a product or in a class. If we live in a product, we need to use DestinationURL to decide where to go. If we live in a class, DestinationURL won't be available, so we use URL2. qU__ac_local_roles__q }q Uzopeq ]q UOwnerq asUglobalsq}qU__name__qUSTX_Document_addqU_varsq}qu.((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqU#STX_Document constructor input formqUrawqT Add STX_Document

Add STX_Document

Id:
Title:
Body:
Upload:
qU__ac_local_roles__q }q Uzopeq ]q UOwnerq asUglobalsq}qU__name__qUSTX_Document_addFormqU_varsq}qu.((U App.FactoryqUFactoryqtqNt.}q(UtitleqUSTX_Document factoryqUidqUSTX_Document_factoryqUinitialq USTX_Document_addFormq U object_typeq U STX_Documentq U__ac_local_roles__q }qUzopeq]qUOwnerqasU permissionqUAdd STX_Documentsqu.(cExtensionClass ExtensionClass q(U STX_Document_PropertySheetsClassq(cZClasses.ZClass PersistentClass qcZClasses.Property ZInstanceSheets qtq}q(UiconqUU _p_changedqKU__doc__q USTX_Document Property Sheetsq U__propset_attrs__q (U Propertiesq UHelpTextq tqU_p_oidqUqh (Uq(UZClasses.PropertyqUZInstanceSheetqttQU Propertiesq(Uq(hUZInstanceSheetqttQU __module__qNU _p_serialqU2c:q!s]qutqt.N.e(cExtensionClass ExtensionClass q(U STX_Documentq(cZClasses.ZClass PersistentClass qcProducts.ZCatalog.CatalogAwareness CatalogAware qcOFS.SimpleItem SimpleItem qtq}q(UiconqU;Control_Panel/Products/STX_Document/STX_Document/ziconImageq U _p_changedq KU__doc__q UStructured Text Documentq U meta_typeq U STX_DocumentqUhelp_stxqT *From the StructuredText docstrings* Structured text is text that uses indentation and simple symbology to indicate the structure of a document. A structured string consists of a sequence of paragraphs separated by one or more blank lines. Each paragraph has a level which is defined as the minimum indentation of the paragraph. A paragraph is a sub-paragraph of another paragraph if the other paragraph is the last preceding paragraph that has a lower level. Special symbology is used to indicate special constructs: - A single-line paragraph whose immediately succeeding paragraphs are lower level is treated as a header. - A paragraph that begins with a '-', '*', or 'o' is treated as an unordered list (bullet) element. - A paragraph that begins with a sequence of digits followed by a white-space character is treated as an ordered list element. - A paragraph that begins with a sequence of sequences, where each sequence is a sequence of digits or a sequence of letters followed by a period, is treated as an ordered list element. - A paragraph with a first line that contains some text, followed by some white-space and '--' is treated as a descriptive list element. The leading text is treated as the element title. - Sub-paragraphs of a paragraph that ends in the word 'example' or the word 'examples', or '::' is treated as example code and is output as is::
Foo
- Text enclosed single quotes (with white-space to the left of the first quote and whitespace or puctuation to the right of the second quote) is treated as example code. For example: ''. - Text surrounded by '*' characters (with white-space to the left of the first '*' and whitespace or puctuation to the right of the second '*') is *emphasized*. - Text surrounded by '**' characters (with white-space to the left of the first '**' and whitespace or puctuation to the right of the second '**') is made **strong**. - Text surrounded by '_' underscore characters (with whitespace to the left and whitespace or punctuation to the right) is _made underlined_. - Text encloded by double quotes followed by a colon, a URL, and concluded by punctuation plus white space, *or* just white space, is treated as a hyper link. For example, '"Zope":http://www.zope.org/' is interpreted as "Zope":http://www.zope.org/ *Note: This works for relative as well as absolute !URLs.* - Text enclosed by double quotes followed by a comma, one or more spaces, an absolute URL and concluded by punctuation plus white space, or just white space, is treated as a hyper link. For example: '"mail me", mailto:amos@digicool.com' is interpreted as "mail me", mailto:amos@digicool.com - Text enclosed in brackets which consists only of letters, digits, underscores and dashes is treated as hyper links within the document. For example: '"As demonstrated by Smith [12] this technique ..."' Is interpreted as: "As demonstrated by Smith [12] this technique" Together with the next rule this allows easy coding of references or end notes. - Text enclosed in brackets which is preceded by the start of a line, two periods and a space is treated as a named link. For example: '.. [12] "Effective Techniques" Smith, Joe ...' Is interpreted as .. [12] "Effective Techniques" Smith, Joe ... *Note the '' in the HTML source.* Together with the previous rule this allows easy coding of references or end notes.qUpropertysheetsqUqQUmanage_optionsq(}q(UlabelqUEditqUactionqU edit_formqu}q(hUViewqhU index_htmlqu}q(UlabelqUSecurityqUactionqU manage_accessq u}q!(hUHelpq"hUhelp_on_structured_textq#utq$Ubody_stxq%UUhelp_on_structured_textq&cZClasses.Method MW q'NRq(}q)U$_ZClassMethodPermissionMapperMethod_q*(Uq+(UOFS.DTMLMethodq,U DTMLMethodq-ttQsbU index_htmlq.h'NRq/}q0U$_ZClassMethodPermissionMapperMethod_q1(Uq2(h,U DTMLMethodq3ttQsbU ziconImageq4(Uq5(U OFS.Imageq6UImageq7ttQUeditq8h'NRq9}q:h*(Uq;(h,U DTMLMethodq)(UManagerq?tttq@U_p_oidqAUqBU _p_serialqCU2n*vuqDU __module__qEU*Qbz37JW7fLHAB81pjBuQpg==qFUtitleqGUU edit_formqHh'NRqI}qJh*(UqK(h,U DTMLMethodqLttQsbutqMt.N.(UqQNt.}q(Ucommonq(Uq(UZClasses.PropertyqUZInstanceSheetsSheetqttQUmethodsq(Uq(UZClasses.Methodq UZClassMethodsSheetq ttQu.}((UZClasses.PropertyqUZInstanceSheetqtqNt.}q(U_mdq}qU_baseq(Uq(hU ZCommonSheetq ttQUidq UHelpTextq u.((UZClasses.PropertyqUZInstanceSheetqtqNt.}q(U_mdq}qU_baseq(Uq(hU ZCommonSheetq ttQUidq U Propertiesq u.(UqQNt.}q.q((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqUHelp on Structured TextqUrawqU

qU__ac_local_roles__q }q Uzopeq ]q UOwnerq asUglobalsq}qU__name__qUhelp_on_structured_textqU_varsq}qu.0((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqUUrawqU

qU__ac_local_roles__q}q Uzopeq ]q UOwnerq asUglobalsq }qU__name__qU index_htmlqU_varsq}qu.7((U OFS.ImageqUImageqtqNt.}q(UsizeqMUdataqTGIF89aPPP@@@@@!,@c@AxC.t0E\h!D;>( D?D0@0cT’&m6Y3ǎ1]ͅ>n<(P'Yŀ;qU__name__qU ziconImageq Utitleq UU content_typeq U image/gifq U preconditionq UUwidthqU16qUheightqU16qu.((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqUUrawqTw Use uploaded body, if it exists. qU__ac_local_roles__q}q Uzopeq ]q UOwnerq asUglobalsq }qU__name__qUeditqU_varsq}qu.((UOFS.DTMLMethodqU DTMLMethodqtqNt.}q(UtitleqUEdit a STX_DocumentqUrawqT

:

Id:
Title:
Body:
Upload:

qU__ac_local_roles__q }q Uzopeq ]q UOwnerq asUglobalsq}qU__name__qU edit_formqU_varsq}qu.Q(cExtensionClass ExtensionClass q(U!STX_Document_ZPropertySheetsClassq(cZClasses.ZClass PersistentClass qcOFS.PropertySheets PropertySheets qcZClasses.ZClass ZClassSheets qcApp.PersistentExtra Persistent qtq}q(Uiconq UU _p_changedq KU__doc__q U!STX_Document_ZPropertySheetsClassq U_p_oidq UqU __module__qNutqt.N.((UZClasses.PropertyqUZInstanceSheetsSheetqtqNt.}q(U Propertiesq(Uq(hU ZCommonSheetqttQU_objectsq(}q (U meta_typeq UCommon Instance Property Sheetq Uidq U Propertiesq u}q(h h h UHelpTextquth(Uq(hU ZCommonSheetqttQu."((UZClasses.MethodqUZClassMethodsSheetqtqNt.}q(U_mdq}qUidqUmethodsqU_objectsq (}q (U meta_typeq U DTML Methodq Uidq Uhelp_on_structured_text qu}q(h h h U edit_form qu}q(U meta_typeqU DTML MethodqUidqUedit qu}q(U meta_typeqU DTML MethodqUidqU index_html qutu.((UZClasses.PropertyqU ZCommonSheetqtqNt.}q(UtitleqUU_mdq}qUidqUHelpTextq U _propertiesq (}q (Umetaq }q hUhelp_stxqUtypeqUtextqutu.((UZClasses.PropertyqU ZCommonSheetqtqNt.}q(UtitleqUInstance PropertiesqU_mdq}qUidq U Propertiesq U _propertiesq (}q (Umetaq }qh UtitleqUtypeqUstringqu}q(h }qh Ubody_stxqhUtextqutu.