[Zope-Checkins] CVS: Zope/lib/python/OFS/dtml - properties.dtml:1.8.18.3.2.1

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 27 Jan 2003 11:22:03 -0500


Update of /cvs-repository/Zope/lib/python/OFS/dtml
In directory cvs.zope.org:/tmp/cvs-serv22232/lib/python/OFS/dtml

Modified Files:
      Tag: toby-charset-branch
	properties.dtml 
Log Message:
collector 737 - Fixed bug that caused problems for non-latin1 users who are not using unicode

=== Zope/lib/python/OFS/dtml/properties.dtml 1.8.18.3 => 1.8.18.3.2.1 ===
--- Zope/lib/python/OFS/dtml/properties.dtml:1.8.18.3	Mon Dec 16 14:36:45 2002
+++ Zope/lib/python/OFS/dtml/properties.dtml	Mon Jan 27 11:21:59 2003
@@ -1,5 +1,23 @@
-<dtml-call "REQUEST.set('management_page_charset','UTF-8')">
+<dtml-if management_page_charset>
+    <dtml-comment>
+    A site-global encoding specification in a property.
+    Note that this feature only works if there are no unicode objects
+    around. This means that this feature is not likely to be supported
+    in all future versions of zope.
+    </dtml-comment>
+    <dtml-call "REQUEST.set('management_page_charset_tag','')">
+<dtml-else>
+    <dtml-comment>
+    Thankfully no site-global encoding specification in a property.
+    We can set UTF-8, and unicode properties will work.
+    </dtml-comment>
+    <dtml-call "REQUEST.set('management_page_charset','UTF-8')">
+    <dtml-call "REQUEST.set('management_page_charset_tag','UTF-8:')">
+</dtml-if>
+    
+<dtml-if "REQUEST.get('management_page_charset',None)=='UTF-8'">
 <dtml-var "u' '">
+</dtml-if>
 <dtml-var manage_page_header>
 <dtml-with "_(management_view='Properties')">
 <dtml-var manage_tabs>
@@ -44,7 +62,7 @@
 <tr>
   <td align="left" valign="top" width="16">
   <dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
-  <input type="checkbox" name="_ids:utf8:string:list" value="<dtml-var id html_quote>"
+  <input type="checkbox" name="_ids:<dtml-var "REQUEST['management_page_charset_tag']">string:list" value="<dtml-var id html_quote>"
    id="cb-<dtml-var id>">
   <dtml-else>
   </dtml-if>
@@ -66,22 +84,22 @@
    value="<dtml-if "hasProperty(id)"><dtml-var 
    "('%s' % getProperty(id))" html_quote></dtml-if>">
   <dtml-elif "type in ('float', 'date')">
-  <input type="text" name="<dtml-var id>:utf8:<dtml-var type>" size="35"
+  <input type="text" name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" size="35"
    value="<dtml-var "getProperty(id)" html_quote>">
   <dtml-elif "type in ['string','ustring']">
-  <input type="text" name="<dtml-var id>:utf8:<dtml-var type>" size="35"
+  <input type="text" name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" size="35"
    value="<dtml-var "getProperty(id)" html_quote>">
   <dtml-elif "type=='boolean'">
   <input type="checkbox" name="<dtml-var id>:boolean" size="35"
    <dtml-if "getProperty(id)">CHECKED</dtml-if>>
   <dtml-elif "type in ['tokens','utokens']">
-  <input type="text" name="<dtml-var id>:utf8:<dtml-var type>" size="35"
+  <input type="text" name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" size="35"
    value="<dtml-in "getProperty(id)"><dtml-var sequence-item html_quote> </dtml-in>">
   <dtml-elif "type in ['text','utext']">
-  <textarea name="<dtml-var id>:utf8:<dtml-var type>" rows="6" cols="35"><dtml-var
+  <textarea name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" rows="6" cols="35"><dtml-var
    "getProperty(id)" html_quote></textarea>
   <dtml-elif "type in ['lines','ulines']">
-  <textarea name="<dtml-var id>:utf8:<dtml-var type>" rows="6" cols="35"><dtml-in
+  <textarea name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" rows="6" cols="35"><dtml-in
   "getProperty(id)"><dtml-var sequence-item html_quote><dtml-if
    sequence-end><dtml-else><dtml-var "'\n'"></dtml-if></dtml-in></textarea>
 
@@ -89,7 +107,7 @@
 
     <dtml-if "hasProperty(select_variable)">
     <div class="form-element">
-    <select name="<dtml-var id>:utf8:text">
+    <select name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']">text">
       <dtml-in "getProperty(select_variable)">
          <option
           <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if>
@@ -99,7 +117,7 @@
     </div>
     <dtml-elif "_.has_key(select_variable)">
     <div class="form-element">
-    <select name="<dtml-var id>:utf8:text">
+    <select name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']">text">
       <dtml-in "_[select_variable]">
          <option
           <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if>
@@ -213,7 +231,7 @@
   </div>
   </td>
   <td align="left" valign="top">
-  <input type="text" name="id:utf8:string" size="30" value=""/>
+  <input type="text" name="id:<dtml-var "REQUEST['management_page_charset_tag']">string" size="30" value=""/>
   </td>
   <td align="left" valign="top" class="form-label">
   Type
@@ -228,12 +246,14 @@
       <option>lines</option>
       <option>long</option>
       <option selected>string</option>
-      <option>ustring</option>
-      <option>text</option>
-      <option>tokens</option>
-      <option>utext</option>
-      <option>utokens</option>
-      <option>ulines</option>
+      <dtml-if "REQUEST['management_page_charset']=='UTF-8'">
+          <option>ustring</option>
+          <option>text</option>
+          <option>tokens</option>
+          <option>utext</option>
+          <option>utokens</option>
+          <option>ulines</option>
+      </dtml-if>
       <option>selection</option>
       <option>multiple selection</option>
     </select>
@@ -247,7 +267,11 @@
   </div>
   </td>
   <td colspan=2 align="left" valign="top">
-  <input type="text" name="value:utf8:ustring" size="30" />
+  <dtml-if "REQUEST['management_page_charset']=='UTF-8'">
+    <input type="text" name="value:UTF-8:ustring" size="30" />
+  <dtml-else>
+    <input type="text" name="value:string" size="30" />
+  </dtml-if>
   </td>
   <td align="right" valign="top">
   <div class="form-element">