Two important bugfixes: one security-related, one linked to Ref fields with link=True.
This commit is contained in:
parent
dbcadc506d
commit
fa974239f3
12 changed files with 149 additions and 138 deletions
|
@ -42,8 +42,9 @@
|
|||
selected python:contextObj.dateValueSelected(name, 'year', year, rawValue)"
|
||||
tal:content="year"></option>
|
||||
</select>
|
||||
<tal:comment replace="nothing">The icon for displaying the date chooser</tal:comment>
|
||||
<a tal:attributes="onclick python: 'return showJsCalendar(\'%s_month\', \'%s\', \'%s_year\', \'%s_month\', \'%s_day\', null, null, %d, %d)' % (name, dummyName, name, name, name, years[0], years[-1])"><img tal:attributes="src string: $portal_url/popup_calendar.gif"/></a>
|
||||
<tal:comment replace="nothing">The icon for displaying the calendar (=date chooser)</tal:comment>
|
||||
<a tal:condition="widget/calendar"
|
||||
tal:attributes="onclick python: 'return showJsCalendar(\'%s_month\', \'%s\', \'%s_year\', \'%s_month\', \'%s_day\', null, null, %d, %d)' % (name, dummyName, name, name, name, years[0], years[-1])"><img tal:attributes="src string: $portal_url/popup_calendar.gif"/></a>
|
||||
|
||||
<tal:hour condition="python: widget['format'] == 0">
|
||||
<select tal:define="hours python:range(0,24);"
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
on a forward reference, the "nav" parameter is added to the URL for allowing to navigate
|
||||
from one object to the next/previous on skyn/view.</tal:comment>
|
||||
<a tal:define="viewUrl obj/getUrl;
|
||||
includeShownInfo includeShownInfo | python:False;
|
||||
navInfo python:'nav=ref.%s.%s.%d.%d' % (contextObj.UID(), fieldName, repeat['obj'].number()+startNumber, totalNumber);
|
||||
fullUrl python: test(appyType['isBack'], viewUrl + '/?page=%s' % appyType['page'], viewUrl + '/?' + navInfo)"
|
||||
tal:attributes="href fullUrl" tal:content="obj/Title"></a>
|
||||
fullUrl python: appyType['isBack'] and (viewUrl + '/?page=%s' % appyType['backd']['page']) or (viewUrl + '/?' + navInfo)"
|
||||
tal:attributes="href fullUrl" tal:content="python: (not includeShownInfo) and obj.Title() or contextObj.getReferenceLabel(fieldName, obj.appy())"></a>
|
||||
</metal:objectTitle>
|
||||
|
||||
<metal:objectActions define-macro="objectActions">
|
||||
|
@ -99,7 +100,7 @@
|
|||
ajaxHookId python: contextObj.UID()+fieldName;
|
||||
startNumber python: int(request.get('%s_startNumber' % ajaxHookId, 0));
|
||||
tool contextObj/getTool;
|
||||
refObjects python:contextObj.getAppyRefs(appyType, startNumber);
|
||||
refObjects python:contextObj.getAppyRefs(fieldName, startNumber);
|
||||
objs refObjects/objects;
|
||||
totalNumber refObjects/totalNumber;
|
||||
batchSize refObjects/batchSize;
|
||||
|
@ -126,7 +127,8 @@
|
|||
<tal:comment replace="nothing">Display a simplified widget if maximum number of
|
||||
referenced objects is 1.</tal:comment>
|
||||
<table class="no-style-table" cellpadding="0" cellspacing="0"><tr valign="top">
|
||||
<td><span class="appyLabel" tal:condition="not: innerRef" tal:content="structure label"></span></td>
|
||||
<td><span class="appyLabel" tal:condition="python: not innerRef and not appyType['link']"
|
||||
tal:content="structure label"></span></td>
|
||||
|
||||
<tal:comment replace="nothing">If there is no object...</tal:comment>
|
||||
<tal:noObject condition="not:objs">
|
||||
|
@ -135,9 +137,9 @@
|
|||
</tal:noObject>
|
||||
|
||||
<tal:comment replace="nothing">If there is an object...</tal:comment>
|
||||
<tal:objectIsPresent condition="python: len(objs) == 1">
|
||||
<tal:objectIsPresent condition="objs">
|
||||
<tal:obj repeat="obj objs">
|
||||
<td><metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle" /></td>
|
||||
<td tal:define="includeShownInfo python:True"><metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle" /></td>
|
||||
<td tal:condition="not: appyType/isBack">
|
||||
<metal:showObjectActions use-macro="portal/skyn/widgets/ref/macros/objectActions" />
|
||||
</td>
|
||||
|
@ -240,31 +242,25 @@
|
|||
</div>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Ref.</tal:comment>
|
||||
<div define-macro="edit"
|
||||
<div metal:define-macro="edit"
|
||||
tal:condition="widget/link"
|
||||
tal:define="refPortalType python: contextObj.getAppyRefPortalType(name);
|
||||
allBrains python:here.uid_catalog(portal_type=refPortalType);
|
||||
brains python:contextObj.callAppySelect(widget['select'], allBrains);
|
||||
refUids python: [o.UID() for o in here.getAppyRefs(name)['objects']];
|
||||
isMultiple python:test(widget['multiplicity'][1]!=1, 'multiple', '');
|
||||
appyFieldName python: 'appy_ref_%s' % name;
|
||||
inError python:test(errors.has_key(name), True, False);
|
||||
isBeingCreated python: contextObj.isTemporary() or ('/portal_factory/' in contextObj.absolute_url())"
|
||||
tal:attributes="class python:'appyRefEdit field' + test(inError, ' error', '')">
|
||||
tal:define="rname python: 'appy_ref_%s' % name;
|
||||
requestValue python: request.get(rname, []);
|
||||
inRequest python: request.has_key(rname);
|
||||
allObjects python: contextObj.getSelectableAppyRefs(name);
|
||||
refUids python: [o.UID() for o in here.getAppyRefs(name)['objects']];
|
||||
isBeingCreated python: contextObj.isTemporary() or ('/portal_factory/' in contextObj.absolute_url())">
|
||||
|
||||
<tal:comment replace="nothing">This macro displays the Reference widget on an "edit" page</tal:comment>
|
||||
|
||||
<label tal:attributes="for python:appyFieldName" tal:content="label"></label>
|
||||
<span class="fieldRequired" tal:condition="python: appyType['multiplicity'][0]>0"></span><br/>
|
||||
<div tal:condition="inError" tal:content="python: errors[field.getName()]"></div>
|
||||
<select tal:define="valueIsInReq python:test(request.get(appyFieldName, None) != None, True, False)"
|
||||
tal:attributes="name python:'appy_ref_%s' % field.getName();
|
||||
multiple isMultiple">
|
||||
<option tal:condition="not: isMultiple" value="" i18n:translate="choose_a_value"/>
|
||||
<option tal:repeat="brain brains"
|
||||
tal:content="python: tool.getReferenceLabel(brain, appyType)"
|
||||
tal:attributes="value brain/UID;
|
||||
selected python:test((valueIsInReq and (brain.UID in request.get(appyFieldName, []))) or (not valueIsInReq and ((brain.UID in refUids) or (isBeingCreated and (brain.UID==defaultValueUID)))), True, False)"/>
|
||||
<select tal:attributes="name rname;
|
||||
multiple python: isMultiple and 'multiple' or ''">
|
||||
<option tal:condition="not: isMultiple" i18n:translate="choose_a_value"></option>
|
||||
<tal:ref repeat="refObj allObjects">
|
||||
<option tal:define="uid python: contextObj.getReferenceUid(refObj)"
|
||||
tal:content="python: contextObj.getReferenceLabel(name, refObj)"
|
||||
tal:attributes="value uid;
|
||||
selected python:(inRequest and (uid in requestValue) or (not inRequest and ((uid in refUids)))) and True or False">
|
||||
</option>
|
||||
</tal:ref>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -59,7 +59,9 @@
|
|||
requestValue python: request.get(name, None);
|
||||
inRequest python: request.has_key(name);
|
||||
errors errors | python: ();
|
||||
inError python: test(widget['name'] in errors, True, False)">
|
||||
inError python: (widget['name'] in errors) and True or False;
|
||||
isMultiple python: (widget['multiplicity'][1] == None) or (widget['multiplicity'][1] > 1)">
|
||||
|
||||
<metal:layout use-macro="here/skyn/widgets/show/macros/layout"/>
|
||||
</metal:field>
|
||||
|
||||
|
@ -89,7 +91,7 @@
|
|||
<tal:asTabs condition="python: widget['style'] == 'tabs'">
|
||||
<table cellpadding="0" cellspacing="0" tal:attributes="width python: test(widget['wide'], '100%', '')">
|
||||
<tal:comment replace="nothing">First row: the tabs.</tal:comment>
|
||||
<tr><td style="border-bottom: 1px solid #ff8040">
|
||||
<tr valign="middle"><td style="border-bottom: 1px solid #ff8040">
|
||||
<table cellpadding="0" cellspacing="0" style="position:relative; bottom:-1px;">
|
||||
<tr valign="bottom">
|
||||
<tal:tab repeat="widgetRow widget/widgets">
|
||||
|
@ -157,7 +159,7 @@
|
|||
</th>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The rows of widgets</tal:comment>
|
||||
<tr valign="top" tal:repeat="widgetRow widget/widgets">
|
||||
<tr tal:attributes="valign widget/valign" tal:repeat="widgetRow widget/widgets">
|
||||
<td tal:repeat="widget widgetRow"
|
||||
tal:attributes="colspan widget/colspan|python:1;
|
||||
style python: test(repeat['widget'].number() != len(widgetRow), 'padding-right: 0.6em', '')">
|
||||
|
@ -176,7 +178,7 @@
|
|||
<tal:comment replace="nothing">Displays a field label.</tal:comment>
|
||||
<tal:label metal:define-macro="label" condition="widget/hasLabel">
|
||||
<label tal:attributes="for widget/name"
|
||||
tal:condition="python: widget['type'] not in ('Action', 'Ref')"
|
||||
tal:condition="python: not ((widget['type'] == 'Action') or ((widget['type'] == 'Ref') and (widget['add'])))"
|
||||
tal:content="structure python: contextObj.translate(widget['labelId'])"></label>
|
||||
</tal:label>
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<tal:comment replace="nothing">View macro for a String.</tal:comment>
|
||||
<metal:view define-macro="view"
|
||||
tal:define="fmt widget/format;
|
||||
maxMult python: widget['multiplicity'][1];
|
||||
severalValues python: (maxMult == None) or (maxMult > 1)">
|
||||
tal:define="fmt widget/format">
|
||||
<span tal:condition="python: fmt in (0, 3)"
|
||||
tal:attributes="class widget/master_css; id rawValue">
|
||||
<ul class="appyList" tal:condition="python: value and severalValues">
|
||||
<ul class="appyList" tal:condition="python: value and isMultiple">
|
||||
<li class="appyBullet" tal:repeat="sv value"><i tal:content="structure sv"></i></li>
|
||||
</ul>
|
||||
<tal:singleValue condition="python: value and not severalValues">
|
||||
<tal:singleValue condition="python: value and not isMultiple">
|
||||
<span tal:condition="python: fmt != 3" tal:replace="structure value"/>
|
||||
<span tal:condition="python: fmt == 3">********</span>
|
||||
</tal:singleValue>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue