| 1 | ################################################################################
|
|---|
| 2 | # _sequence.py
|
|---|
| 3 | #
|
|---|
| 4 | # This program is free software; you can redistribute it and/or
|
|---|
| 5 | # modify it under the terms of the GNU General Public License
|
|---|
| 6 | # as published by the Free Software Foundation; either version 2
|
|---|
| 7 | # of the License, or (at your option) any later version.
|
|---|
| 8 | #
|
|---|
| 9 | # This program is distributed in the hope that it will be useful,
|
|---|
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | # GNU General Public License for more details.
|
|---|
| 13 | #
|
|---|
| 14 | # You should have received a copy of the GNU General Public License
|
|---|
| 15 | # along with this program; if not, write to the Free Software
|
|---|
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 17 | ################################################################################
|
|---|
| 18 |
|
|---|
| 19 | # Imports.
|
|---|
| 20 | from App.special_dtml import HTMLFile
|
|---|
| 21 | import urllib
|
|---|
| 22 | # Product Imports.
|
|---|
| 23 | import ZMSItem
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | ################################################################################
|
|---|
| 27 | ################################################################################
|
|---|
| 28 | ###
|
|---|
| 29 | ### Class
|
|---|
| 30 | ###
|
|---|
| 31 | ################################################################################
|
|---|
| 32 | ################################################################################
|
|---|
| 33 | class Sequence(ZMSItem.ZMSItem):
|
|---|
| 34 |
|
|---|
| 35 | # Properties.
|
|---|
| 36 | # -----------
|
|---|
| 37 | meta_type = 'Sequence'
|
|---|
| 38 | icon = "misc_/zms/Sequence.gif"
|
|---|
| 39 |
|
|---|
| 40 | # Management Options.
|
|---|
| 41 | # -------------------
|
|---|
| 42 | manage_options = (
|
|---|
| 43 | {'label': 'TAB_CONFIGURATION','action': '../manage_customize'},
|
|---|
| 44 | )
|
|---|
| 45 |
|
|---|
| 46 | # Management Permissions.
|
|---|
| 47 | # -----------------------
|
|---|
| 48 | __administratorPermissions__ = (
|
|---|
| 49 | 'manage_changeProperties', 'manage_main',
|
|---|
| 50 | )
|
|---|
| 51 | __ac_permissions__=(
|
|---|
| 52 | ('ZMS Administrator', __administratorPermissions__),
|
|---|
| 53 | )
|
|---|
| 54 |
|
|---|
| 55 | # Management Interface.
|
|---|
| 56 | # ---------------------
|
|---|
| 57 | manage_main = HTMLFile('dtml/Sequence/manage_main', globals())
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | """
|
|---|
| 61 | ############################################################################
|
|---|
| 62 | ###
|
|---|
| 63 | ### Constructor
|
|---|
| 64 | ###
|
|---|
| 65 | ############################################################################
|
|---|
| 66 | """
|
|---|
| 67 |
|
|---|
| 68 | ############################################################################
|
|---|
| 69 | # Sequence.__init__:
|
|---|
| 70 | #
|
|---|
| 71 | # Initialise a new instance.
|
|---|
| 72 | ############################################################################
|
|---|
| 73 | def __init__(self, startvalue=0):
|
|---|
| 74 | self.id = 'acl_sequence'
|
|---|
| 75 | self.value = startvalue
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | """
|
|---|
| 79 | ############################################################################
|
|---|
| 80 | ###
|
|---|
| 81 | ### Functions
|
|---|
| 82 | ###
|
|---|
| 83 | ############################################################################
|
|---|
| 84 | """
|
|---|
| 85 |
|
|---|
| 86 | # --------------------------------------------------------------------------
|
|---|
| 87 | # Sequence.nextVal
|
|---|
| 88 | # --------------------------------------------------------------------------
|
|---|
| 89 | def nextVal(self):
|
|---|
| 90 | self.value = self.value + 1
|
|---|
| 91 | return self.currVal()
|
|---|
| 92 |
|
|---|
| 93 | # --------------------------------------------------------------------------
|
|---|
| 94 | # Sequence.currVal
|
|---|
| 95 | # --------------------------------------------------------------------------
|
|---|
| 96 | def currVal(self):
|
|---|
| 97 | return self.value
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | """
|
|---|
| 101 | ############################################################################
|
|---|
| 102 | ###
|
|---|
| 103 | ### Properties
|
|---|
| 104 | ###
|
|---|
| 105 | ############################################################################
|
|---|
| 106 | """
|
|---|
| 107 |
|
|---|
| 108 | ############################################################################
|
|---|
| 109 | # Sequence.manage_changeProperties:
|
|---|
| 110 | #
|
|---|
| 111 | # Change Sequence properties.
|
|---|
| 112 | ############################################################################
|
|---|
| 113 | def manage_changeProperties(self, submit, currentvalue, REQUEST, RESPONSE):
|
|---|
| 114 | """ Sequence.manage_changeProperties """
|
|---|
| 115 |
|
|---|
| 116 | message = ''
|
|---|
| 117 |
|
|---|
| 118 | # Set current value.
|
|---|
| 119 | if submit == 'Change':
|
|---|
| 120 | if currentvalue >= self.value:
|
|---|
| 121 | self.value = currentvalue
|
|---|
| 122 |
|
|---|
| 123 | # Fetch next value.
|
|---|
| 124 | if submit == 'Next':
|
|---|
| 125 | self.nextVal()
|
|---|
| 126 |
|
|---|
| 127 | # Return.
|
|---|
| 128 | if RESPONSE is not None:
|
|---|
| 129 | RESPONSE.redirect('%s?manage_tabs_message=%s'%(REQUEST[ 'HTTP_REFERER'],urllib.quote(message)))
|
|---|
| 130 |
|
|---|
| 131 | ################################################################################
|
|---|