Changeset 5942 for main/waeup.sirp/trunk


Ignore:
Timestamp:
14 Apr 2011, 08:31:02 (14 years ago)
Author:
Henrik Bettermann
Message:

Revert to removesubobjectspage instead of using remove buttons in index views.

Use zebra css class to distinguish odd and even table lines.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5930 r5942  
    161161
    162162    def update(self):
     163        warning.need()
    163164        form = self.request.form
    164165        if 'CANCEL' in form.keys():
     
    846847    pnav = 1
    847848
    848     def update(self, code=None, edit=None, delete=None):
    849         warning.need()
    850         if delete is not None and code is not None:
    851             try:
    852                 del self.context[code]
    853                 self.flash('Faculty %s successfully removed.' % code)               
    854             except:
    855                 self.flash('Could not delete %s.' % code)
     849    #def update(self, code=None, edit=None, delete=None):
     850    #    warning.need()
     851    #    if delete is not None and code is not None:
     852    #        try:
     853    #            del self.context[code]
     854    #            self.flash('Faculty %s successfully removed.' % code)               
     855    #        except:
     856    #            self.flash('Could not delete %s.' % code)
    856857
    857858class AddFacultyFormPage(WAeUPAddFormPage):
     
    907908        return "%s (%s)" % (getName(self.context), self.context.code)
    908909
    909     def update(self, code=None, edit=None, delete=None):
    910         warning.need()
    911         if delete is not None and code is not None:
    912             try:
    913                 del self.context[code]
    914                 self.flash('Department %s successfully removed.' % code)               
    915             except:
    916                 self.flash('Could not delete %s.' % code)
     910    #def update(self, code=None, edit=None, delete=None):
     911    #    warning.need()
     912    #    if delete is not None and code is not None:
     913    #        try:
     914    #            del self.context[code]
     915    #            self.flash('Department %s successfully removed.' % code)               
     916    #        except:
     917    #            self.flash('Could not delete %s.' % code)
    917918
    918919class AddDepartmentFormPage(WAeUPAddFormPage):
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultycontainerpage.pt

    r5936 r5942  
    1010      <th>Code</th>
    1111      <th>Title</th>
    12       <th>&nbsp;</th>
    1312    </tr>
    1413  </thead>
    1514  <tbody>
    16     <tr tal:repeat="value context/values"
    17         tal:attributes="class python: repeat['value'].odd() and 'odd' or 'even'">
     15    <tr tal:repeat="value context/values">
    1816      <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td>
    1917      <td tal:content="value/title">Title</td>
    20       <td class="text-right">
    21       <form method="post">
    22          <input type="hidden" name="code"
    23                  tal:attributes="value value/__name__"/>
    24          <input type="submit" name="delete" value="remove"
    25                 onclick="return confirmPost('All departments and courses of this faculty will be removed too. Are you sure?')">
    26       </form>
    27        
    28       </td>
    2918    </tr>
    3019  </tbody>
    3120</table>
    32 
    33 <div tal:content="structure provider:subobjectlist">
    34   List of subobjects
    35 </div>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultypage.pt

    r5930 r5942  
    11<h2>Departments</h2>
    2 
    32
    43<div tal:condition="python: not len(context.keys())">
     
    1110      <th>Code</th>
    1211      <th>Title</th>
    13       <th>&nbsp;</th>
    1412    </tr>
    1513  </thead>
    1614  <tbody>
    17     <tr tal:repeat="value context/values"
    18         tal:attributes="class python: repeat['value'].odd() and 'odd' or 'even'">
     15    <tr tal:repeat="value context/values">
    1916      <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td>
    2017      <td tal:content="value/title">Title</td>
    2118      <td class="text-right">
    22       <form method="post">
    23          <input type="hidden" name="code"
    24                  tal:attributes="value value/__name__"/>
    25          <input type="submit" name="delete" value="remove"
    26                 onclick="return confirmPost('All courses and certificates of this faculty will be removed too. Are you sure?')">
    27       </form>
    2819      </td>
    2920    </tr>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/removesubobjectspage.pt

    r5917 r5942  
    33  </div>
    44  <form method="POST" tal:condition="python: len(context.keys())">
     5    <div tal:condition="python: not len(context.keys())">
     6    There are no faculties registered yet.
     7    </div>
     8   
    59    <table>
    6       <tr tal:repeat="val context/values"
    7           tal:attributes="class python: repeat['val'].odd() and 'odd' or 'even'">
    8         <td>
    9           <input type="checkbox"
    10                  name="val_id"
    11                  tal:attributes="value val/code" />
    12         </td>
    13         <td>
    14           <a href="."
    15              tal:content="val/code"
    16              tal:attributes="href python:view.url(val)">
    17             Subobject Code
    18           </a>
    19         </td>
    20         <td>
    21           <a href="."
    22              tal:content="val/title"
    23              tal:attributes="href python:view.url(val)">
    24             Subobject Name
    25           </a>
    26         </td>
    27       </tr>
     10      <thead>
     11        <tr>
     12          <th>&nbsp;</th>
     13          <th>Code</th>
     14          <th>Title</th>
     15        </tr>
     16      </thead>
     17      <tbody>
     18        <tr tal:repeat="value context/values"
     19        tal:attributes="class python: repeat['value'].odd() and 'odd' or 'even'">
     20          <td>
     21          <input type="checkbox"
     22                 name="val_id"
     23                 tal:attributes="value value/__name__" />
     24          </td>         
     25          <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td>
     26          <td tal:content="value/title">Title</td>
     27        </tr>
     28      </tbody>
    2829    </table>
    29     <input type="submit" name="REMOVE" value="Remove selected" />
     30    <input type="submit" name="REMOVE" value="Remove selected" onclick="return confirmPost('All sububjects will be removed too. Are you sure?')"/>
    3031    <input type="submit" name="CANCEL" value="Cancel" />
    3132  </form>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/usercontainerpage.pt

    r5927 r5942  
    1515  </thead>
    1616  <tbody>
    17     <tr tal:repeat="account context/values"
    18         tal:attributes="class python: repeat['account'].odd() and 'odd' or 'even'">
     17    <tr tal:repeat="account context/values">
    1918      <td tal:content="account/name">username</td>
    2019      <td tal:content="account/title">Title</td>
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r5936 r5942  
    392392
    393393
    394 #class RemoveFacultyActionButton(RemoveActionButton):
    395 #    grok.context(IFacultyContainer)
    396 #    grok.view(FacultyContainerPage)
    397 #    text = 'Remove faculty'
    398     
    399 #class RemoveDepartmentActionButton(RemoveActionButton):
    400 #    grok.context(IFaculty)
    401 #    grok.view(FacultyPage)
    402 #    text = 'Remove department'
     394class RemoveFacultyActionButton(RemoveActionButton):
     395    grok.context(IFacultyContainer)
     396    grok.view(FacultyContainerPage)
     397    text = 'Remove faculty'
     398   
     399class RemoveDepartmentActionButton(RemoveActionButton):
     400    grok.context(IFaculty)
     401    grok.view(FacultyPage)
     402    text = 'Remove department'
    403403
    404404
Note: See TracChangeset for help on using the changeset viewer.