Added a Password widget (new String.format) and minor GUI improvements.

This commit is contained in:
Gaetan Delannay 2009-11-25 20:37:22 +01:00
parent 253e61612d
commit b541ecb651
6 changed files with 23 additions and 14 deletions

View file

@ -243,6 +243,7 @@ class String(Type):
LINE = 0 LINE = 0
TEXT = 1 TEXT = 1
XHTML = 2 XHTML = 2
PASSWORD = 3
def __init__(self, validator=None, multiplicity=(0,1), index=None, def __init__(self, validator=None, multiplicity=(0,1), index=None,
default=None, optional=False, editDefault=False, format=LINE, default=None, optional=False, editDefault=False, format=LINE,
show=True, page='main', group=None, move=0, indexed=False, show=True, page='main', group=None, move=0, indexed=False,

View file

@ -130,9 +130,11 @@ class ArchetypeFieldDescriptor:
self.widgetType = 'RichWidget' self.widgetType = 'RichWidget'
self.fieldParams['allowable_content_types'] = ('text/html',) self.fieldParams['allowable_content_types'] = ('text/html',)
self.fieldParams['default_output_type'] = "text/html" self.fieldParams['default_output_type'] = "text/html"
else: elif self.appyType.format == String.PASSWORD:
self.fieldType = 'StringField' self.fieldType = 'StringField'
self.widgetType = 'StringWidget' self.widgetType = 'PasswordWidget'
if self.appyType.width:
self.widgetParams['size'] = self.appyType.width
def walkComputed(self): def walkComputed(self):
'''How to generate a computed field? We generate an Archetypes String '''How to generate a computed field? We generate an Archetypes String

BIN
gen/plone25/skin/edit.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

View file

@ -128,7 +128,7 @@
fmt python: appyType['format']; fmt python: appyType['format'];
maxMult python: appyType['multiplicity'][1]; maxMult python: appyType['multiplicity'][1];
severalValues python: (maxMult == None) or (maxMult > 1)"> severalValues python: (maxMult == None) or (maxMult > 1)">
<tal:simpleString condition="python: fmt == 0"> <tal:simpleString condition="python: fmt in (0, 3)">
<span tal:condition="showLabel" tal:content="label" class="appyLabel" <span tal:condition="showLabel" tal:content="label" class="appyLabel"
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False); tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
id python: v"></span> id python: v"></span>
@ -150,12 +150,15 @@
<tal:select condition="appyType/isSelect"> <tal:select condition="appyType/isSelect">
<span tal:replace="python: tool.translate('%s_%s_list_%s' % (contextObj.meta_type, field.getName(), v))"/> <span tal:replace="python: tool.translate('%s_%s_list_%s' % (contextObj.meta_type, field.getName(), v))"/>
</tal:select> </tal:select>
<tal:noSelect condition="not: appyType/isSelect"> <tal:noSelect condition="python: not appyType['isSelect'] and (fmt != 3)">
<span tal:replace="structure v"/> <span tal:replace="structure v"/>
</tal:noSelect> </tal:noSelect>
<tal:password condition="python: not appyType['isSelect'] and (fmt == 3)">
********
</tal:password>
</tal:singleValue> </tal:singleValue>
</tal:simpleString> </tal:simpleString>
<tal:formattedString condition="python: appyType['format'] != 0"> <tal:formattedString condition="python: fmt not in (0, 3)">
<fieldset> <fieldset>
<legend tal:condition="showLabel" tal:content="label"></legend> <legend tal:condition="showLabel" tal:content="label"></legend>
<span tal:condition="python: appyType['format'] == 1" <span tal:condition="python: appyType['format'] == 1"
@ -492,9 +495,9 @@
</span> </span>
<tal:comment replace="nothing">When no tabs are shown, we provide an edit icon.</tal:comment> <tal:comment replace="nothing">When no tabs are shown, we provide an edit icon.</tal:comment>
<img tal:define="editPageName python:test(pageName=='main', 'default', pageName)" <img tal:define="editPageName python:test(pageName=='main', 'default', pageName)"
src="edit.gif" title="Edit" i18n:domain="plone" i18n:attributes="title" title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
style="cursor:pointer" tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s\'' % (contextObj.absolute_url(), editPageName, phase);
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s\'' % (contextObj.absolute_url(), editPageName, phase)" src string: $portal_url/skyn/edit.gif"
tal:condition="python: (len(appyPages)==1) and member.has_permission('Modify portal content', contextObj)"/> tal:condition="python: (len(appyPages)==1) and member.has_permission('Modify portal content', contextObj)"/>
</td> </td>
<td><metal:actions use-macro="here/document_actions/macros/document_actions"/> <td><metal:actions use-macro="here/document_actions/macros/document_actions"/>
@ -539,9 +542,9 @@
tal:attributes="href python: contextObj.absolute_url() + '/skyn/view?phase=%s&pageName=%s' % (phase, thePage)"> tal:attributes="href python: contextObj.absolute_url() + '/skyn/view?phase=%s&pageName=%s' % (phase, thePage)">
</a> </a>
<img tal:define="editPageName python:test(thePage=='main', 'default', thePage)" <img tal:define="editPageName python:test(thePage=='main', 'default', thePage)"
src="edit.gif" title="Edit" i18n:domain="plone" i18n:attributes="title" title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer" class="appyPlusImg"
style="cursor:pointer" class="appyPlusImg" tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s\'' % (contextObj.absolute_url(), editPageName, phase);
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s\'' % (contextObj.absolute_url(), editPageName, phase)" src string: $portal_url/skyn/edit.gif"
tal:condition="python: member.has_permission('Modify portal content', contextObj)"/> tal:condition="python: member.has_permission('Modify portal content', contextObj)"/>
</tal:tab> </tal:tab>
</li> </li>
@ -718,7 +721,8 @@
<tal:comment replace="nothing">Edit the element</tal:comment> <tal:comment replace="nothing">Edit the element</tal:comment>
<td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'" <td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'"
tal:condition="python: member.has_permission('Modify portal content', obj)"> tal:condition="python: member.has_permission('Modify portal content', obj)">
<img src="edit.gif" title="Edit" i18n:domain="plone" i18n:attributes="title" /> <img title="Edit" i18n:domain="plone" i18n:attributes="title"
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
</a></td> </a></td>
<tal:comment replace="nothing">Delete the element</tal:comment> <tal:comment replace="nothing">Delete the element</tal:comment>
<td class="noPadding"> <td class="noPadding">

View file

@ -39,7 +39,8 @@
<tal:comment replace="nothing">Edit the element</tal:comment> <tal:comment replace="nothing">Edit the element</tal:comment>
<td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'" <td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'"
tal:condition="python: member.has_permission('Modify portal content', obj)"> tal:condition="python: member.has_permission('Modify portal content', obj)">
<img src="edit.gif" title="label_edit" i18n:domain="plone" i18n:attributes="title" /> <img title="label_edit" i18n:domain="plone" i18n:attributes="title"
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
</a></td> </a></td>
<tal:comment replace="nothing">Delete the element</tal:comment> <tal:comment replace="nothing">Delete the element</tal:comment>
<td class="noPadding"> <td class="noPadding">

View file

@ -91,7 +91,8 @@ class Converter:
raise ConverterError(CANNOT_WRITE_RESULT % (res, oe)) raise ConverterError(CANNOT_WRITE_RESULT % (res, oe))
def connect(self): def connect(self):
'''Connects to OpenOffice''' '''Connects to OpenOffice'''
import socket if os.name == 'nt':
import socket
import uno import uno
from com.sun.star.connection import NoConnectException from com.sun.star.connection import NoConnectException
try: try: