appy.pod: bugfix when importing images under Windows (https://answers.launchpad.net/appy/+question/171611); appy.gen: bugfix while validating file fields which are mandatory; stopped using uid_catalog and added index 'UID' in portal_catalog; bugfix while searching objects in the limits of a Ref field; display user info in the main template (name, id, roles); when creating an object from a reference, after creation, appy brings the user back to the view page where the Ref field was.

This commit is contained in:
Gaetan Delannay 2011-09-20 19:21:48 +02:00
parent 7ff56a6520
commit 96a592f125
22 changed files with 141 additions and 179 deletions

View file

@ -8,12 +8,17 @@ table { font-size: 100%; border-spacing: 0px; border-collapse:collapse;}
form { margin: 0; padding: 0;}
p { margin: 0;}
acronym {cursor: help;}
input { border: 1px solid #a79e9e;
font-family: Lucida,Helvetica,Arial,sans-serif; }
input { border: 1px solid #a79e9e; background-color: #f8f8f8;
font-family: Lucida,Helvetica,Arial,sans-serif; margin-bottom: 1px}
input[type=image] { border-width: 0px; background: none; }
textarea { width: 99%; font: 100% Lucida,Helvetica,Arial,sans-serif;
border: 1px solid #a79e9e;}
border: 1px solid #a79e9e; background-color: #f8f8f8;}
label { font-weight: 600; font-style: italic; line-height: 1.4em;}
legend { padding-bottom: 2px; padding-right: 3px;}
ul { line-height: 1.2em; margin: 0 0 0.2em 0.6em; padding: 0;
list-style: none outside none;}
li { margin: 0; background-image: url("skyn/li.gif"); padding-left: 10px;
background-repeat: no-repeat; background-position: 0 0.5em;}
.main { width: 900px; background-color: white; box-shadow: 3px 3px 3px #A9A9A9;
border-style: solid; border-width: 1px; border-color: grey; }
@ -22,7 +27,7 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;}
.userStrip { background-color: #a2a2a2; height: 30px;
border-top: 3px solid #525252; border-bottom: 2px solid #9b0000; }
.login { margin-top: 2px; margin-bottom: 2px; color: white;}
.buttons { margin-left: 4px; }
.buttons { margin-left: 4px;}
.message { color: #9b0000; font-style: italic;
position: absolute; top: -15px; right: 5px}
.discreet { font-size: 90%; }
@ -41,7 +46,7 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;}
border: 1px solid grey; }
.list { border: 1px solid grey; margin-bottom: 3px;}
.list td, .list th { border: 1px solid grey;
padding-left: 3px; padding-right: 3px;}
padding-left: 5px; padding-right: 5px; padding-top: 3px;}
.list th { background-color: #cbcbcb; font-style: italic; font-weight: normal;}
.noStyle { border: 0 !important; padding: 0 !important; margin: 0 !important; }
.noStyle td { border:0 !important; padding:0 !important; margin:0 !important; }
@ -62,3 +67,4 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;}
.by { background-color: #ededed; font-style: italic; padding-top: 3px;}
.workflow { background-color: #ededed; text-align: center;}
.objectNavigate { margin-top: 3px;}
.underline {border-bottom: 1px dotted grey;}

View file

@ -232,6 +232,42 @@ function updateSlaves(masterValues, appyTypeId) {
}
}
function initSlaves() {
// When the current page is loaded, we must set the correct state for all
// slave fields.
var masters = cssQuery('.appyMaster');
for (var i=0; i < masters.length; i++) {
var cssClasses = masters[i].className.split(' ');
for (var j=0; j < cssClasses.length; j++) {
if (cssClasses[j].indexOf('master_') == 0) {
var appyId = cssClasses[j].split('_')[1];
var masterValue = [];
if (masters[i].nodeName == 'SPAN'){
var idField = masters[i].id;
if (idField == '') {
masterValue.push(idField);
}
else {
if ((idField[0] == '(') || (idField[0] == '[')) {
// There are multiple values, split it
var subValues = idField.substring(1, idField.length-1).split(',');
for (var k=0; k < subValues.length; k++){
var subValue = subValues[k].replace(' ','');
masterValue.push(subValue.substring(1, subValue.length-1));
}
}
else { masterValue.push(masters[i].id);
}
}
}
else { masterValue = getMasterValue(masters[i]);
}
updateSlaves(masterValue, appyId);
}
}
}
}
// Function used for triggering a workflow transition
function triggerTransition(transitionId, msg) {
var theForm = document.getElementById('triggerTransitionForm');

View file

@ -5,7 +5,7 @@ rq = context.REQUEST
# Get the object impacted by the action.
if rq.get('objectUid', None):
obj = context.uid_catalog(UID=rq['objectUid'])[0].getObject()
obj = context.portal_catalog(UID=rq['objectUid'])[0].getObject()
else:
obj = context.getParentNode() # An appy obj or in some cases the app folder.
if obj.portal_type == 'AppyFolder':

View file

@ -1,7 +1,7 @@
<tal:main define="tool context/getTool">
<html metal:use-macro="context/skyn/template/macros/main">
<metal:fill fill-slot="content"
tal:define="contextObj python:context.getParentNode();
tal:define="contextObj context/getParentNode;
errors request/errors | python:{};
layoutType python:'edit';
layout python: contextObj.getPageLayout(layoutType);

View file

@ -249,45 +249,12 @@
</table>
</div>
<tal:comment replace="nothing">
The page footer.
</tal:comment>
<tal:comment replace="nothing">The page footer.</tal:comment>
<metal:footer define-macro="footer">
<tal:dummy define="messages app/plone_utils/showPortalMessages"/>
<script language="javascript">
<!--
// When the current page is loaded, we must set the correct state for all slave fields.
var masters = cssQuery('.appyMaster');
for (var i=0; i < masters.length; i++) {
var cssClasses = masters[i].className.split(' ');
for (var j=0; j < cssClasses.length; j++) {
if (cssClasses[j].indexOf('master_') == 0) {
var appyId = cssClasses[j].split('_')[1];
var masterValue = [];
if (masters[i].nodeName == 'SPAN'){
var idField = masters[i].id;
if (idField == '') {
masterValue.push(idField);
}
else {
if ((idField[0] == '(') || (idField[0] == '[')) {
// There are multiple values, split it
var subValues = idField.substring(1, idField.length-1).split(',');
for (var k=0; k < subValues.length; k++){
var subValue = subValues[k].replace(' ','');
masterValue.push(subValue.substring(1, subValue.length-1));
}
}
else { masterValue.push(masters[i].id);
}
}
}
else { masterValue = getMasterValue(masters[i]);
}
updateSlaves(masterValue, appyId);
}
}
}
initSlaves();
-->
</script>
</metal:footer>

View file

@ -1,8 +1,9 @@
<metal:queryResults define-macro="queryResult"
tal:define="contentType request/type_name;
refInfo tool/getRefInfo;
refObject python: refInfo[0];
refField python: refInfo[1];
refInfo python: refInfo[0];
refUrlPart python: refObject and ('&ref=%s:%s' % (refObject.UID(), refField)) or '';
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
@ -14,13 +15,13 @@
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
queryResult python: tool.executeQuery(contentType, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refField=refField);
queryResult python: tool.executeQuery(contentType, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
ajaxHookId python:'queryResult';
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), contentType, searchName);
newSearchUrl python: '%s/skyn/search?type_name=%s&ref=%s' % (tool.absolute_url(), contentType, refInfo);">
newSearchUrl python: '%s/skyn/search?type_name=%s%s' % (tool.absolute_url(), contentType, refUrlPart)">
<tal:result condition="objs">
@ -29,7 +30,7 @@
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&nbsp;—&nbsp;&nbsp;<i><a tal:attributes="href newSearchUrl"
&nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl"
tal:content="python: tool.translate('search_new')"></a></i>
</tal:newSearch>
</legend>
@ -60,7 +61,7 @@
</tr>
</table>
<table tal:define="fieldNames python: tool.getResultColumnsNames(contentType, refField);
<table tal:define="fieldNames python: tool.getResultColumnsNames(contentType, refInfo);
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
class="list" width="100%">
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 367 B

Before After
Before After

View file

@ -110,7 +110,7 @@
</td></tr>
</table>
<tal:comment replace="nothing">User info and controls for authenticated users</tal:comment>
<table tal:condition="not: isAnon" class="buttons">
<table tal:condition="not: isAnon" class="buttons" width="99%">
<tr>
<td>
<!-- Go home -->
@ -128,6 +128,7 @@
<img tal:attributes="src string: $appUrl/skyn/logout.gif"/>
</a>
</td>
<td align="right" tal:content="python: tool.getUserLine(user)"></td>
</tr>
</table>
</td>

View file

@ -19,7 +19,7 @@
<tal:comment replace="nothing">Edit macro for an File.</tal:comment>
<metal:edit define-macro="edit">
<tal:showFile condition="python: value and value.size">
<metal:call use-macro="portal/skyn/widgets/file/macros/view"/><br/>
<metal:call use-macro="app/skyn/widgets/file/macros/view"/><br/>
</tal:showFile>
<tal:editButtons condition="python: value and value.size">
<tal:comment replace="nothing">Keep the file untouched.</tal:comment>
@ -29,8 +29,7 @@
id string:${name}_nochange;
onclick string:document.getElementById('${name}_file').disabled=true;"/>
<label tal:attributes="for string:${name}_nochange"
i18n:translate="nochange_file" i18n:domain="plone">
</label>
i18n:translate="nochange_file" i18n:domain="plone">Keep the file unchanged</label>
<br/>
<tal:comment replace="nothing">Delete the file.</tal:comment>
<tal:delete condition="not: widget/required">
@ -39,8 +38,7 @@
id string:${name}_delete;
onclick string:document.getElementById('${name}_file').disabled=true;"/>
<label tal:attributes="for string:${name}_delete"
i18n:translate="delete_file" i18n:domain="plone">
</label>
i18n:translate="delete_file" i18n:domain="plone">Delete the file</label>
<br/>
</tal:delete>
<tal:comment replace="nothing">Replace with a new file.</tal:comment>
@ -50,8 +48,7 @@
id string:${name}_upload;
onclick string:document.getElementById('${name}_file').disabled=false"/>
<label tal:attributes="for string:${name}_upload;"
i18n:translate="upload_file" i18n:domain="plone">
</label>
i18n:translate="upload_file" i18n:domain="plone">Replace it with a new file</label>
<br/>
</tal:editButtons>
<tal:comment replace="nothing">The upload field.</tal:comment>
@ -66,7 +63,7 @@
<tal:comment replace="nothing">Cell macro for an File.</tal:comment>
<metal:cell define-macro="cell">
<metal:call use-macro="portal/skyn/widgets/file/macros/view"/>
<metal:call use-macro="app/skyn/widgets/file/macros/view"/>
</metal:cell>
<tal:comment replace="nothing">Search macro for an File.</tal:comment>

View file

@ -161,7 +161,7 @@
<metal:plusIcon use-macro="app/skyn/widgets/ref/macros/plusIcon"/>
<tal:comment replace="nothing">The search icon if field is queryable</tal:comment>
<a tal:condition="appyType/queryable"
tal:attributes="href python: '%s/skyn/search?type_name=%s&ref=%s:%s' % (tool.getAppFolder().absolute_url(), linkedPortalType, contextObj.meta_type, appyType['name'])">
tal:attributes="href python: '%s/skyn/search?type_name=%s&ref=%s:%s' % (tool.absolute_url(), linkedPortalType, contextObj.UID(), appyType['name'])">
<img src="search.gif" tal:attributes="title python: tool.translate('search_objects')"/></a>
</legend>

View file

@ -3,8 +3,8 @@
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 isMultiple">
<li class="appyBullet" tal:repeat="sv value"><i tal:content="structure sv"></i></li>
<ul tal:condition="python: value and isMultiple">
<li tal:repeat="sv value"><i tal:content="structure sv"></i></li>
</ul>
<tal:singleValue condition="python: value and not isMultiple">
<span tal:condition="python: fmt != 3" tal:replace="structure value"/>