appypod-rattail/gen/ui/import.pt

126 lines
5.4 KiB
Plaintext
Raw Normal View History

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="here/main_template/macros/master">
<tal:comment replace="nothing">Disable standard Plone green tabs</tal:comment>
<div metal:fill-slot="top_slot">
<metal:block metal:use-macro="here/global_defines/macros/defines" />
<div tal:define="dummy python:request.set('disable_border', 1)" />
</div>
<tal:comment replace="nothing">Fill main slot of Plone main_template</tal:comment>
<body>
<metal:fill fill-slot="main"
tal:define="appFolder context/getParentNode;
2011-11-25 11:01:20 -06:00
className request/className;
tool python: portal.get('portal_%s' % appFolder.id.lower());
2011-11-25 11:01:20 -06:00
importElems python: tool.getImportElements(className);
global allAreImported python:True">
2011-11-25 11:01:20 -06:00
<div metal:use-macro="context/ui/page/macros/prologue"/>
<script language="javascript">
<!--
var importedElemsShown = false;
function toggleViewableElements() {
var rows = document.getElementsByName('importedElem');
var newDisplay = 'table-row';
if (isIe) newDisplay = 'block';
if (importedElemsShown) newDisplay = 'none';
for (var i=0; i<rows.length; i++) {
rows[i].style.display = newDisplay;
}
importedElemsShown = !importedElemsShown;
}
var checkBoxesChecked = true;
function toggleCheckboxes() {
var checkBoxes = document.getElementsByName('cbElem');
var newCheckValue = true;
if (checkBoxesChecked) newCheckValue = false;
for (var i=0; i<checkBoxes.length; i++) {
checkBoxes[i].checked = newCheckValue;
}
checkBoxesChecked = newCheckValue;
}
function importSingleElement(importPath) {
var f = document.forms['importElements'];
f.importPath.value = importPath;
f.submit();
}
function importManyElements() {
var f = document.forms['importElements'];
var importPaths = '';
// Get the values of the checkboxes
var checkBoxes = document.getElementsByName('cbElem');
for (var i=0; i<checkBoxes.length; i++) {
if (checkBoxes[i].checked) {
importPaths += checkBoxes[i].value + '|';
}
}
if (! importPaths) alert(no_elem_selected);
else {
f.importPath.value = importPaths;
f.submit();
}
}
-->
</script>
<tal:comment replace="nothing">Form for importing several meetings at once.</tal:comment>
<form name="importElements"
2011-11-25 11:01:20 -06:00
tal:attributes="action python: appFolder.absolute_url()+'/do'" method="post">
<input type="hidden" name="action" value="ImportObjects"/>
2011-11-25 11:01:20 -06:00
<input type="hidden" name="className" tal:attributes="value className"/>
<input type="hidden" name="importPath" value=""/>
</form>
<h1 tal:content="python: tool.translate('import_title')"></h1><br/>
<table class="list" width="100%">
<tr>
<th tal:repeat="columnHeader python: importElems[0]">
<img tal:condition="python: repeat['columnHeader'].number() == 1"
2011-11-25 11:01:20 -06:00
tal:attributes="src string:$appUrl/ui/eye.png;
title python: tool.translate('import_show_hide')"
style="cursor:pointer" onClick="toggleViewableElements()" align="left" />
<span tal:replace="columnHeader"/>
</th>
<th tal:content="python: tool.translate('ref_actions')"></th>
<th width="20px"><img
2011-11-25 11:01:20 -06:00
tal:attributes="src string: $appUrl/ui/select_elems.png;
title python: tool.translate('select_delesect')"
onClick="toggleCheckboxes()" style="cursor:pointer"/>
</tr>
<tal:row repeat="row python: importElems[1]">
2011-11-25 11:01:20 -06:00
<tr tal:define="alreadyImported python: tool.isAlreadyImported(className, row[0]);
2009-12-15 14:30:43 -06:00
global allAreImported python: allAreImported and alreadyImported;
odd repeat/row/odd"
tal:attributes="id python: alreadyImported and 'importedElem' or 'notImportedElem';
name python: alreadyImported and 'importedElem' or 'notImportedElem';
style python: alreadyImported and 'display:none' or 'display:table-row';
class python: odd and 'even' or 'odd'">
<td tal:repeat="elem python: row[1:]" tal:content="elem">
</td>
<td>
<input type="button" tal:condition="not: alreadyImported"
tal:attributes="onClick python: 'importSingleElement(\'%s\')' % row[0];
value python: tool.translate('query_import')"/>
<span tal:condition="alreadyImported" tal:replace="python: tool.translate('import_already')"/>
</td>
<td align="center">
<input type="checkbox" checked="checked" id="cbElem" name="cbElem"
tal:attributes="value python: row[0]" tal:condition="not: alreadyImported"/>
</td>
</tr>
</tal:row>
<tr tal:condition="python: not importElems[1] or allAreImported"><td colspan="15" tal:content="python: tool.translate('query_no_result')"></td></tr>
</table>
<tal:comment replace="nothing">Button for importing several elements at once.</tal:comment>
<p align="right"><br/>
<input type="button" onClick="importManyElements()"
tal:condition="python: importElems[1] and not allAreImported"
tal:attributes="value python:tool.translate('import_many')"/>
</p>
</metal:fill>
</body>
</html>