[Zope-CVS] CVS: Products/OSCOM/NOTSite/skins/NOTContent - section_list_stories.py:1.1 story_tease.py:1.1 story_tease_form.pt:1.1 section_view.pt:1.2 story_edit.py:1.2 story_edit_form.pt:1.2

Tres Seaver tseaver@zope.com
Thu, 29 May 2003 14:50:26 -0400


Update of /cvs-repository/Products/OSCOM/NOTSite/skins/NOTContent
In directory cvs.zope.org:/tmp/cvs-serv952/skins/NOTContent

Modified Files:
	section_view.pt story_edit.py story_edit_form.pt 
Added Files:
	section_list_stories.py story_tease.py story_tease_form.pt 
Log Message:


  - Repair skins breakage:

    o 'story_edit' marshalling error.

  - Implement "most recent 15" for section fronts.

  - Make CMS breadcrumbs emit CMS-centric URLs.

  - Expose effective / expires dates for stories.

  - Compute section list slot.

  - Implement "Tease Story" action for stories.

  - Add knobs to change the includable types for a section (currently
    needs help from ZMI to set property).

  - Add handling for "NITF" as text_format value.

  - First pass at NITF-HTML rendering.

  - *Don't* make folders / sections workflowed.


=== Added File Products/OSCOM/NOTSite/skins/NOTContent/section_list_stories.py ===
## Script (Python) "section_list_stories"
##parameters=story_count=15, item_types=None
##title=Return top 'story_count' stories.

if item_types is None:
    item_types = getattr( context, 'section_item_types', ( 'News Story', ) )

decorated = [ ( x.Date(), x ) for x in context.contentValues( item_types ) ]

decorated.sort()
decorated.reverse()

result = []
for item in [ x[1] for x in decorated[ :story_count ] ]:

    folderish = getattr( item, 'isPrincipiaFolderish', 0 )
    contentish = getattr( item, 'isPortalContent', 0 )
    teaseish = getattr( item, 'getRemoteUrl', 0 )

    if teaseish:
        obj = item.getObject()
    else:
        obj = item

    typeinfo = obj.getTypeInfo()

    info = { 'method'       : folderish and 'folder_contents'
                                         or typeinfo.getActionById( 'edit' )
           , 'icon'         : typeinfo.getIcon()
           , 'id'           : obj.getId()
           , 'title'        : obj.Title()
           , 'description'  : obj.Description()
           , 'url'          : obj.absolute_url()
           , 'type'         : typeinfo.Title()  # label, not lookup
           }

    result.append( info )

return result


=== Added File Products/OSCOM/NOTSite/skins/NOTContent/story_tease.py ===
## Script (Python) "story_tease"
##parameters=section_path
##title=Modify the status of a content object
 
from Products.CMFCore.utils import getToolByName

if section_path:

    urltool = getToolByName( context, 'portal_url' )
    root = urltool.getPortalObject()
    story_path = urltool.getRelativeContentPath( context )
    section = root.restrictedTraverse( section_path )

    section.invokeFactory( type_name='Story Tease'
                         , id=context.getId()   # XXX:  conflicts
                         , remote_url='/'.join( story_path )
                         )

    message = 'Tease+created.'

else:

    message = 'Select+a+section.'

context.REQUEST['RESPONSE'].redirect( '%s/story_tease_form?'
                                      'portal_status_message=%s'
                                    % ( context.absolute_url()
                                      , message
                                      ) )


=== Added File Products/OSCOM/NOTSite/skins/NOTContent/story_tease_form.pt ===
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="here/main_template/macros/master">
<body>
<div metal:fill-slot="main">	  
<div class="Desktop">
<h2>Tease <span tal:replace="here/getId">ID</span></h2>

<form action="story_tease" method="GET" enctype="multipart/form-data"
      tal:attributes="action string:${here/absolute_url}/story_tease"
>

<table class="FormLayout">

 <tr>
  <th width="10%"> Tease to: </th>
  <td width="10%">
   <select name="section_path" size="1">
    <option value="">-- select a section --</option>
    <option value="SECTION_PATH"
            tal:repeat="info here/list_section_info"
            tal:attributes="value info/path"
            tal:content="info/title">SECTION_TITLE</option>
   </select>
  </td>
  <td>
    <input type="submit" name="choice" value=" Create Tease ">
  </td>
 </tr>
</table>
</form>
</div>
</div>
</body>
</html>


=== Products/OSCOM/NOTSite/skins/NOTContent/section_view.pt 1.1 => 1.2 ===
--- Products/OSCOM/NOTSite/skins/NOTContent/section_view.pt:1.1	Mon May 26 01:51:36 2003
+++ Products/OSCOM/NOTSite/skins/NOTContent/section_view.pt	Thu May 29 14:49:55 2003
@@ -5,7 +5,18 @@
 
 <div metal:fill-slot="main">
 
-WAAA!
+<div tal:repeat="item here/section_list_stories">
+
+ <a href="URL"
+    tal:attributes="href item/url"
+    tal:content="item/title">TITLE</a><br />
+
+ <blockquote tal:condition="item/Description | nothing">
+  <em tal:content="item/description">Description .... </em>
+ </blockquote>
+
+</div>
+
 </div>
 
 </body>


=== Products/OSCOM/NOTSite/skins/NOTContent/story_edit.py 1.1 => 1.2 ===
--- Products/OSCOM/NOTSite/skins/NOTContent/story_edit.py:1.1	Mon May 26 01:51:36 2003
+++ Products/OSCOM/NOTSite/skins/NOTContent/story_edit.py	Thu May 29 14:49:55 2003
@@ -1,17 +1,16 @@
 ## Script (Python) "story_edit"
-##parameters=content, metadata, SafetyBelt='', choice=' Change '
+##parameters=content, file, metadata, SafetyBelt='', choice=' Change '
 ##title=Edit a News Story
 try:
     context.setTitle( metadata.title )
     context.setDescription( metadata.description )
+    context.setEffectiveDate( metadata.effective )
+    context.setExpirationDate( metadata.expires )
 
-    from Products.CMFDefault.utils import scrubHTML
-    # Strip Javascript, etc.
-    file = scrubHTML( content.file and content.file.read() or '' )
-    text = scrubHTML( content.text )
+    text = content.text
     context.edit( content.text_format
-                , text
-                , file
+                , text=text
+                , file=file
                 , safety_belt=SafetyBelt
                 )
 


=== Products/OSCOM/NOTSite/skins/NOTContent/story_edit_form.pt 1.1 => 1.2 ===
--- Products/OSCOM/NOTSite/skins/NOTContent/story_edit_form.pt:1.1	Mon May 26 01:51:36 2003
+++ Products/OSCOM/NOTSite/skins/NOTContent/story_edit_form.pt	Thu May 29 14:49:55 2003
@@ -39,6 +39,32 @@
   </td>
  </tr>
 
+ <tr>
+  <th>
+    Effective
+  </th>
+  <td tal:define="effective here/effective;
+                  effectiveString python: here.effective_date
+                                and here.effective_date.ISO() or 'None'">
+   <input type="text" size="40" name="metadata.effective:record"
+          value="EXPIRATION"
+          tal:attributes="value effectiveString" />
+  </td>
+ </tr>
+
+ <tr>
+  <th>
+    Expires
+  </th>
+  <td tal:define="expires here/expires;
+                  expiresString python: here.expiration_date
+                                and here.expiration_date.ISO() or 'None'">
+   <input type="text" size="40" name="metadata.expires:record"
+          value="EXPIRATION"
+          tal:attributes="value expiresString" />
+  </td>
+ </tr>
+
  <tr style="background-color: #CCCCCC">
   <td colspan="2" align="center"><strong>Content</strong></td>
  </tr>
@@ -49,6 +75,11 @@
   </th>
   <td tal:define="text_format here/text_format">
 
+   <input type="radio" id="cb_nitf"
+          name="content.text_format:record" value="NITF"
+          tal:attributes="checked python: text_format == 'NITF'" />
+   <label for="cb_NITF">NITF</label>
+
    <input type="radio" id="cb_structuredtext"
           name="content.text_format:record"
           value="structured-text"
@@ -63,7 +94,7 @@
    <input type="radio" id="cb_html"
           name="content.text_format:record" value="html"
           tal:attributes="checked python: text_format == 'html'" />
-   <label for="cb_html">html</label>
+   <label for="cb_html">HTML</label>
 
   </td>
  </tr>
@@ -71,7 +102,7 @@
  <tr>
   <th> Upload </th>
   <td>
-   <input type="file" name="content.file:record" size="25">
+   <input type="file" name="file" size="25">
   </td>
  </tr>