2011-12-05 08:11:29 -06:00
|
|
|
<tal:main define="tool context/config">
|
|
|
|
<html metal:use-macro="context/ui/template/macros/main">
|
|
|
|
<metal:fill fill-slot="content"
|
|
|
|
tal:define="className request/className;
|
|
|
|
importElems python: tool.getImportElements(className);
|
|
|
|
global allAreImported python:True">
|
2009-10-20 09:57:00 -05:00
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
<div metal:use-macro="context/ui/page/macros/prologue"/>
|
2009-10-20 09:57:00 -05:00
|
|
|
<script language="javascript">
|
|
|
|
<!--
|
|
|
|
var importedElemsShown = false;
|
|
|
|
function toggleViewableElements() {
|
2011-10-01 15:40:13 -05:00
|
|
|
var rows = document.getElementsByName('importedElem');
|
2009-10-20 09:57:00 -05:00
|
|
|
var newDisplay = 'table-row';
|
2009-10-30 15:31:39 -05:00
|
|
|
if (isIe) newDisplay = 'block';
|
2009-10-20 09:57:00 -05:00
|
|
|
if (importedElemsShown) newDisplay = 'none';
|
|
|
|
for (var i=0; i<rows.length; i++) {
|
2009-10-30 15:31:39 -05:00
|
|
|
rows[i].style.display = newDisplay;
|
2009-10-20 09:57:00 -05:00
|
|
|
}
|
|
|
|
importedElemsShown = !importedElemsShown;
|
|
|
|
}
|
|
|
|
var checkBoxesChecked = true;
|
|
|
|
function toggleCheckboxes() {
|
2011-10-01 15:40:13 -05:00
|
|
|
var checkBoxes = document.getElementsByName('cbElem');
|
2009-10-20 09:57:00 -05:00
|
|
|
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
|
2011-10-01 15:40:13 -05:00
|
|
|
var checkBoxes = document.getElementsByName('cbElem');
|
2009-10-20 09:57:00 -05:00
|
|
|
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-12-05 08:11:29 -06:00
|
|
|
tal:attributes="action python: tool.absolute_url()+'/do'" method="post">
|
2009-10-20 09:57:00 -05:00
|
|
|
<input type="hidden" name="action" value="ImportObjects"/>
|
2011-11-25 11:01:20 -06:00
|
|
|
<input type="hidden" name="className" tal:attributes="value className"/>
|
2009-10-20 09:57:00 -05:00
|
|
|
<input type="hidden" name="importPath" value=""/>
|
|
|
|
</form>
|
|
|
|
|
2012-06-03 11:34:56 -05:00
|
|
|
<h1 tal:content="python: _('import_title')"></h1><br/>
|
2011-10-04 13:12:58 -05:00
|
|
|
<table class="list" width="100%">
|
2009-10-20 09:57:00 -05:00
|
|
|
<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;
|
2012-06-03 11:34:56 -05:00
|
|
|
title python: _('import_show_hide')"
|
2010-09-17 08:32:48 -05:00
|
|
|
style="cursor:pointer" onClick="toggleViewableElements()" align="left" />
|
2009-10-20 09:57:00 -05:00
|
|
|
<span tal:replace="columnHeader"/>
|
|
|
|
</th>
|
2012-10-31 15:17:31 -05:00
|
|
|
<th></th>
|
2009-10-20 09:57:00 -05:00
|
|
|
<th width="20px"><img
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:attributes="src string: $appUrl/ui/select_elems.png;
|
2012-06-03 11:34:56 -05:00
|
|
|
title python: _('select_delesect')"
|
2012-10-31 15:17:31 -05:00
|
|
|
onClick="toggleCheckboxes()" style="cursor:pointer"></th>
|
2009-10-20 09:57:00 -05:00
|
|
|
</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"
|
2011-10-01 15:40:13 -05:00
|
|
|
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'">
|
2009-10-20 09:57:00 -05:00
|
|
|
<td tal:repeat="elem python: row[1:]" tal:content="elem">
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type="button" tal:condition="not: alreadyImported"
|
2010-09-17 08:32:48 -05:00
|
|
|
tal:attributes="onClick python: 'importSingleElement(\'%s\')' % row[0];
|
2012-06-03 11:34:56 -05:00
|
|
|
value python: _('query_import')"/>
|
|
|
|
<span tal:condition="alreadyImported" tal:replace="python: _('import_already')"/>
|
2009-10-20 09:57:00 -05:00
|
|
|
</td>
|
2011-10-01 15:40:13 -05:00
|
|
|
<td align="center">
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="checkbox" checked="checked" id="cbElem" name="cbElem"
|
2011-10-01 15:40:13 -05:00
|
|
|
tal:attributes="value python: row[0]" tal:condition="not: alreadyImported"/>
|
|
|
|
</td>
|
2009-10-20 09:57:00 -05:00
|
|
|
</tr>
|
|
|
|
</tal:row>
|
2012-06-03 11:34:56 -05:00
|
|
|
<tr tal:condition="python: not importElems[1] or allAreImported"><td colspan="15" tal:content="python: _('query_no_result')"></td></tr>
|
2009-10-20 09:57:00 -05:00
|
|
|
</table>
|
|
|
|
<tal:comment replace="nothing">Button for importing several elements at once.</tal:comment>
|
|
|
|
<p align="right"><br/>
|
2010-09-17 08:32:48 -05:00
|
|
|
<input type="button" onClick="importManyElements()"
|
2009-10-20 09:57:00 -05:00
|
|
|
tal:condition="python: importElems[1] and not allAreImported"
|
2012-06-03 11:34:56 -05:00
|
|
|
tal:attributes="value python: _('import_many')"/>
|
2009-10-20 09:57:00 -05:00
|
|
|
</p>
|
2011-12-05 08:11:29 -06:00
|
|
|
</metal:fill>
|
2009-10-20 09:57:00 -05:00
|
|
|
</html>
|
2011-12-05 08:11:29 -06:00
|
|
|
</tal:main>
|