[CMF-checkins] CVS: Products/CMFCalendar/skins/zpt_calendar - event_edit_control.py:1.1.2.1 event_edit_form.py:1.1.2.1 event_edit_template.pt:1.1.2.1 event_icon.gif:1.1.2.1 event_edit_form.pt:NONE

Yvo Schubbe y.2005- at wcm-solutions.de
Tue Apr 5 08:21:51 EDT 2005


Update of /cvs-repository/Products/CMFCalendar/skins/zpt_calendar
In directory cvs.zope.org:/tmp/cvs-serv25992/CMFCalendar/skins/zpt_calendar

Added Files:
      Tag: CMF-1_5-branch
	event_edit_control.py event_edit_form.py 
	event_edit_template.pt event_icon.gif 
Removed Files:
      Tag: CMF-1_5-branch
	event_edit_form.pt 
Log Message:
- refactored event_edit_form, making it similar to CMFDefault forms and independent of the dtml layer
- improved Install.py, backporting stuff from setuphandlers.py


=== Added File Products/CMFCalendar/skins/zpt_calendar/event_edit_control.py ===
##parameters=title=None, description=None, event_type=None, effectiveDay=None, effectiveMo=None, effectiveYear=None, expirationDay=None, expirationMo=None, expirationYear=None, start_time=None, startAMPM=None, stop_time=None, stopAMPM=None, location=None, contact_name=None, contact_email=None, contact_phone=None, event_url=None, **kw
##
from Products.CMFCalendar.exceptions import ResourceLockedError

try:
    context.edit(title, description, event_type, effectiveDay, effectiveMo,
                 effectiveYear, expirationDay, expirationMo, expirationYear,
                 start_time, startAMPM, stop_time, stopAMPM, location,
                 contact_name, contact_email, contact_phone, event_url)
    return context.setStatus(True, 'Event changed.')
except ResourceLockedError, errmsg:
    return context.setStatus(False, errmsg)


=== Added File Products/CMFCalendar/skins/zpt_calendar/event_edit_form.py ===
##parameters=change='', change_and_view=''
##
form = context.REQUEST.form
if change and \
        context.event_edit_control(**form) and \
        context.setRedirect(context, 'object/edit'):
    return
elif change_and_view and \
        context.event_edit_control(**form) and \
        context.setRedirect(context, 'object/view'):
    return


options = {}

buttons = []
target = context.getActionInfo('object/edit')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
                    'listButtonInfos': tuple(buttons) }

return context.event_edit_template(**options)


=== Added File Products/CMFCalendar/skins/zpt_calendar/event_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>

<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Edit: <tal:span
    tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>

<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
   tal:define="form options/form">
<div class="Desktop">

<form action="event_edit_form" method="post"
   tal:attributes="action form/action">
<table class="FormLayout">
 <tr>
  <th i18n:translate="">Event Name</th>
  <td>
   <input type="text"
      name="title" maxlength="100" size="35" value="Title"
      tal:attributes="value context/Title">
  </td>
  <th i18n:translate="">Contact Name</th>
  <td>
   <input type="text"
      name="contact_name" maxlength="100" size="35" value="contact_name"
      tal:attributes="value context/contact_name">
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Location</th>
  <td>
   <input type="text"
      name="location" maxlength="100" size="35" value="location"
      tal:attributes="value context/location">
  </td>
  <th i18n:translate="">Contact Email</th>
  <td>
   <input type="text"
      name="contact_email" maxlength="100" size="35" value="contact_email"
      tal:attributes="value context/contact_email">
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Event type</th>
  <td>
   <select name="event_type:list" multiple
      tal:define="contentSubject context/Subject;
                  allowedSubjects python:context.portal_metadata.listAllowedSubjects(context)">
    <option tal:replace="nothing">Event Type 1</option>
    <option tal:replace="nothing">Event Type 2</option>
    <option tal:replace="nothing">...</option>
    <option value="subj"
       tal:repeat="subj allowedSubjects"
       tal:attributes="value subj; selected python:subj in contentSubject"
       tal:content="subj">Event Type N</option>
   </select>
  </td>
  <th i18n:translate="">Contact Phone</th>
  <td>
   <input type="text" name="contact_phone" maxlength="100" size="35"
      value="contact_phone" id="cb_contact_phone"
      tal:attributes="value context/contact_phone" />
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Event URL</th>
  <td colspan="3">
   <input type="text" name="event_url" size="55" maxlength="100"
      value="event_url"
      tal:attributes="value context/event_url" />
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Start Date</th>
  <td tal:define="startstrings context/getStartStrings">
   <select name="effectiveYear">
    <option value=""
       tal:define="years context/buildYears"
       tal:repeat="year years"
       tal:attributes="value year; selected python:year == startstrings['year']"
       tal:content="year">Year</option>
   </select>
   &nbsp;
   <select name="effectiveMo">
    <option value=""
       tal:define="months context/buildMonths"
       tal:repeat="month months"
       tal:attributes="value month; selected python:month == startstrings['month']"
       tal:content="month">Month</option>
   </select>
   &nbsp;
   <select name="effectiveDay">
    <option value=""
       tal:define="days context/buildDays"
       tal:repeat="day days"
       tal:attributes="value day; selected python:day == startstrings['day']"
       tal:content="day">Day</option>
   </select>
  </td>
  <th i18n:translate="">Stop Date</th>
  <td tal:define="endstrings context/getEndStrings">
   <select name="expirationYear">
    <option value=""
       tal:define="years context/buildYears"
       tal:repeat="year years"
       tal:attributes="value year; selected python:year == endstrings['year']"
       tal:content="year">Day</option>
   </select>
   &nbsp;
   <select name="expirationMo">
    <option value=""
       tal:define="months context/buildMonths"
       tal:repeat="month months"
       tal:attributes="value month; selected python:month == endstrings['month']"
       tal:content="month">Month</option>
   </select>
   &nbsp;
   <select name="expirationDay">
    <option value=""
       tal:define="days context/buildDays"
       tal:repeat="day days"
       tal:attributes="value day; selected python:day == endstrings['day']"
       tal:content="day">Day</option>
   </select>
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Start Time</th>
  <td tal:define="stTimeString python:context.getStartTimeString().split();
                  amSel python:(len(stTimeString) == 2 and stTimeString[1] == 'am');
                  pmSel python:(len(stTimeString) == 2 and stTimeString[1] == 'pm')">
   <select name="start_time">
    <option value=""
       tal:repeat="bt context/buildTimes"
       tal:attributes="value bt; selected python:bt == stTimeString[0]"
       tal:content="bt">start time</option>
   </select>
   &nbsp;
   <input type="radio" name="startAMPM" value="am" id="cb_start_am"
      tal:attributes="checked amSel" />
   <label for="cb_start_am" i18n:translate="">am</label>
   <input type="radio" name="startAMPM" value="pm" id="cb_start_pm"
      tal:attributes="checked pmSel" />
   <label for="cb_start_pm" i18n:translate="">pm</label>
   <input type="hidden" name="startAMPM:default" value="pm" />
  </td>
  <th i18n:translate="">Stop Time</th>
  <td tal:define="stTimeString python:context.getStopTimeString().split();
                  amSel python:(len(stTimeString) == 2 and stTimeString[1] == 'am');
                  pmSel python:(len(stTimeString) == 2 and stTimeString[1] == 'pm')">
   <select name="stop_time">
   <option value=""
      tal:repeat="bt context/buildTimes"
      tal:attributes="value bt; selected python:bt == stTimeString[0]"
      tal:content="bt">end time</option>
   </select>
   &nbsp;
   <input type="radio" name="stopAMPM" value="am" id="cb_stop_am"
      tal:attributes="checked amSel" />
   <label for="cb_stop_am" i18n:translate="">am</label>
   <input type="radio" name="stopAMPM" value="pm" id="cb_stop_pm"
      tal:attributes="checked pmSel" />
   <label for="cb_stop_pm" i18n:translate="">pm</label>
   <input type="hidden" name="stopAMPM:default" value="pm" />
  </td>
 </tr>
 <tr>
  <th i18n:translate="">Description</th>
  <td class="TextField" colspan="3">
   <textarea name="description:text" rows="5" cols="70" wrap="soft"
      tal:content="context/Description"></textarea>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td colspan="3">
   <metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
  </td>
 </tr>
</table>
</form>

</div>
</metal:slot>

</body>
</html>


=== Added File Products/CMFCalendar/skins/zpt_calendar/event_icon.gif ===
  <Binary-ish file>
=== Removed File Products/CMFCalendar/skins/zpt_calendar/event_edit_form.pt ===



More information about the CMF-checkins mailing list