[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/GTypecast.py forms/samples/zipc...
From: |
Jason Cater |
Subject: |
gnue common/src/GTypecast.py forms/samples/zipc... |
Date: |
Wed, 26 Jun 2002 18:31:10 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/06/26 18:31:10
Modified files:
common/src : GTypecast.py
forms/samples/zipcode: zipcode.gfd
forms/src : GFConfig.py
forms/src/GFObjects: GFEntry.py
Log message:
[W/O #73] Added support for multiple foreign key descriptions
(comma-separated list)
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTypecast.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/zipcode/zipcode.gfd.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFConfig.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFEntry.py.diff?tr1=1.61&tr2=1.62&r1=text&r2=text
Patches:
Index: gnue/common/src/GTypecast.py
diff -c gnue/common/src/GTypecast.py:1.4 gnue/common/src/GTypecast.py:1.5
*** gnue/common/src/GTypecast.py:1.4 Thu Jun 13 12:10:10 2002
--- gnue/common/src/GTypecast.py Wed Jun 26 18:31:10 2002
***************
*** 16,25 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # Copyright 2000 Free Software Foundation
#
# FILE:
! # GTypecast.py
#
# DESCRIPTION:
# Methods used to typecast data
--- 16,25 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # Copyright 2000-2002 Free Software Foundation
#
# FILE:
! # GTypecast.py
#
# DESCRIPTION:
# Methods used to typecast data
***************
*** 52,64 ****
#
# name
#
! # This is for typecasting a string that
# will be used as a name or identifier
! # (Characters: A-Z, a-z, 0-9, ['#$_-'])
#
#######################################################
def name (value):
! # TODO: name should make sure the string
# TODO: containts only valid characters.
return string.strip(str(value))
--- 52,64 ----
#
# name
#
! # This is for typecasting a string that
# will be used as a name or identifier
! # (Characters: A-Z, a-z, 0-9, ['#$_-'])
#
#######################################################
def name (value):
! # TODO: name should make sure the string
# TODO: containts only valid characters.
return string.strip(str(value))
***************
*** 67,80 ****
#
# uppername
#
! # This is for typecasting a string that
# will be used as a name or identifier
# it will be automaticly converted to uppercase
! # (Characters: A-Z, a-z, 0-9, ['#$_-'])
#
#######################################################
def uppername (value):
! # TODO: name should make sure the string
# TODO: containts only valid characters.
return string.upper(string.strip(str(value)))
--- 67,80 ----
#
# uppername
#
! # This is for typecasting a string that
# will be used as a name or identifier
# it will be automaticly converted to uppercase
! # (Characters: A-Z, a-z, 0-9, ['#$_-'])
#
#######################################################
def uppername (value):
! # TODO: name should make sure the string
# TODO: containts only valid characters.
return string.upper(string.strip(str(value)))
***************
*** 83,97 ****
#
# names
#
! # This is used for typecasting a comma
# separated list of names
#
#######################################################
def names (value):
! a = string.split(value,',')
for i in range(0, len(a)):
! a[i] = name(a[i])
! return str(value)
#######################################################
--- 83,97 ----
#
# names
#
! # This is used for typecasting a comma
# separated list of names
#
#######################################################
def names (value):
! a = string.split(value,',')
for i in range(0, len(a)):
! a[i] = name(a[i])
! return a
#######################################################
Index: gnue/forms/samples/zipcode/zipcode.gfd
diff -c gnue/forms/samples/zipcode/zipcode.gfd:1.21
gnue/forms/samples/zipcode/zipcode.gfd:1.22
*** gnue/forms/samples/zipcode/zipcode.gfd:1.21 Mon Jun 17 20:57:34 2002
--- gnue/forms/samples/zipcode/zipcode.gfd Wed Jun 26 18:31:10 2002
***************
*** 1,4 ****
! <?xml version="1.0"?
<!-- GNUe Designer (0.1.0)
Form saved on: 2001-11-04 22:12:53 -->
--- 1,4 ----
! <?xml version="1.0"?>
<!-- GNUe Designer (0.1.0)
Form saved on: 2001-11-04 22:12:53 -->
***************
*** 22,28 ****
</entry>
<label x="17" y="1" name="Label_2" text="State"/>
<entry x="17" y="2" field="state" style="dropdown" name="state"
width="15"
! fk_source="validator" fk_key="state
fk_description="description">
<options>
<option name="tip" value="State"/>
--- 22,28 ----
</entry>
<label x="17" y="1" name="Label_2" text="State"/>
<entry x="17" y="2" field="state" style="dropdown" name="state"
width="15"
! fk_source="validator" fk_key="state"
fk_description="description">
<options>
<option name="tip" value="State"/>
Index: gnue/forms/src/GFConfig.py
diff -c gnue/forms/src/GFConfig.py:1.8 gnue/forms/src/GFConfig.py:1.9
*** gnue/forms/src/GFConfig.py:1.8 Mon Jun 17 20:29:26 2002
--- gnue/forms/src/GFConfig.py Wed Jun 26 18:31:10 2002
***************
*** 1,6 ****
#
- # Copyright 2001 Free Software Foundation
- #
# This file is part of GNU Enterprise.
#
# GNU Enterprise is free software; you can redistribute it
--- 1,4 ----
***************
*** 18,23 ****
--- 16,23 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
+ # Copyright 2001-2002 Free Software Foundation
+ #
# FILE:
# GFConfig.py
#
***************
*** 237,242 ****
--- 237,249 ----
'Description': 'The default value stored in the database for false
values',
'Typecast' : GTypecast.text,
'Default' : 'N' },
+
+ { 'Name' : 'DropdownSeparator',
+ 'Type' : 'Setting',
+ 'Comment' : 'Text used to concatenation dropdown descriptions',
+ 'Description': 'Text used to concatenation dropdown descriptions (when
multiple description fields are used)',
+ 'Typecast' : GTypecast.text,
+ 'Default' : ', ' },
#
# Do not alter below here unless you really, really want to (and you know
what you are doing)
Index: gnue/forms/src/GFObjects/GFEntry.py
diff -c gnue/forms/src/GFObjects/GFEntry.py:1.61
gnue/forms/src/GFObjects/GFEntry.py:1.62
*** gnue/forms/src/GFObjects/GFEntry.py:1.61 Mon Jun 17 20:57:34 2002
--- gnue/forms/src/GFObjects/GFEntry.py Wed Jun 26 18:31:10 2002
***************
*** 160,165 ****
--- 160,166 ----
self._block._dataSourceLink.referenceField(self.field, default)
self._bound = 1
+ # Initialize the foreign key lookup (if necessary)
if hasattr(self,'fk_source'):
try:
self.fk_key
***************
*** 167,185 ****
raise "fk_source specified, but no fk_key"
try:
! self.fk_description
except NameError:
self.fk_description = self.fk_key
self._fk_datasource = \
self._block._form._datasourceDictionary[string.lower(self.fk_source)]
if hasattr(self, 'queryDefault') and \
self.queryDefault != None and \
self._bound and \
len(self.queryDefault):
self._block._queryDefaults[self] = self.queryDefault
# Create an appropriate display handler
if self.style == 'checkbox':
self._displayHandler = GFDisplayHandler.CheckboxDisplayHandler(self,
--- 168,194 ----
raise "fk_source specified, but no fk_key"
try:
! self._fk_descr = string.split(self.fk_description,',')
except NameError:
self.fk_description = self.fk_key
+ self._fk_descr = string.split(self.fk_key,',')
self._fk_datasource = \
self._block._form._datasourceDictionary[string.lower(self.fk_source)]
+ # Reference the foreign keys to their datasources
+ # (so they are selected)
+ for field in [self.fk_key] + self._fk_descr:
+ self._fk_datasource.referenceField(field, None)
+
+
if hasattr(self, 'queryDefault') and \
self.queryDefault != None and \
self._bound and \
len(self.queryDefault):
self._block._queryDefaults[self] = self.queryDefault
+
# Create an appropriate display handler
if self.style == 'checkbox':
self._displayHandler = GFDisplayHandler.CheckboxDisplayHandler(self,
***************
*** 276,285 ****
self._allowedValues = {"":""}
self._allowedValuesDescr = [""]
self._allowedValuesReverse = {"":""}
while more:
try:
key = "%s" % rs.current.getField(self.fk_key)
! descr = "%s" % rs.current.getField(self.fk_description)
self._allowedValues[key] = descr
self._allowedValuesDescr.append(descr)
--- 285,298 ----
self._allowedValues = {"":""}
self._allowedValuesDescr = [""]
self._allowedValuesReverse = {"":""}
+ dropdownSeparator = gConfig('DropdownSeparator')
while more:
try:
key = "%s" % rs.current.getField(self.fk_key)
! descriptions = []
! for i in self._fk_descr:
! descriptions.append("%s" % rs.current.getField(i))
! descr = string.join(descriptions,dropdownSeparator)
self._allowedValues[key] = descr
self._allowedValuesDescr.append(descr)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/GTypecast.py forms/samples/zipc...,
Jason Cater <=