added button for file upload on account lists

This commit is contained in:
Roland Gruber 2010-10-31 13:48:15 +00:00
parent a71e80f082
commit 56ca67879e
3 changed files with 57 additions and 19 deletions

View File

@ -465,8 +465,8 @@ class lamList {
* Manages all POST actions (e.g. button pressed) for the account lists.
*/
protected function listDoPost() {
// check if button was pressed and if we have to add/delete an account
if (isset($_POST['new']) || isset($_POST['del'])){
// check if button was pressed and if we have to add/delete an account or call file upload
if (isset($_POST['new']) || isset($_POST['del']) || isset($_POST['fileUpload'])){
if (!checkIfWriteAccessIsAllowed()) {
die();
}
@ -489,6 +489,11 @@ class lamList {
exit;
}
}
// file upload
elseif (isset($_POST['fileUpload'])){
metaRefresh("../masscreate.php?type=" . $this->type);
exit;
}
}
// PDF button
foreach ($_POST as $key => $value) {
@ -677,11 +682,37 @@ class lamList {
echo "<td align=\"left\">\n";
if (checkIfWriteAccessIsAllowed()) {
// add/delete buttons
echo ("<button id=\"newButton\" name=\"new\">" . $this->labels['newEntry'] . "</button>\n");
echo "<button id=\"newButton\" name=\"new\">" . $this->labels['newEntry'] . "</button>\n";
if (!$createOnly) {
echo ("<button id=\"delButton\" name=\"del\">" . $this->labels['deleteEntry'] . "</button>\n");
echo "<button id=\"delButton\" name=\"del\">" . $this->labels['deleteEntry'] . "</button>\n";
}
echo "&nbsp;&nbsp;&nbsp;";
$type = new $this->type();
if ($type->supportsFileUpload()) {
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo "<button id=\"fileUploadButton\" name=\"fileUpload\">" . _('File upload') . "</button>\n";
}
?>
&nbsp;&nbsp;&nbsp;
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#newButton').button({
icons: {
primary: 'createButton'
}
});
jQuery('#delButton').button({
icons: {
primary: 'deleteButton'
}
});
jQuery('#fileUploadButton').button({
icons: {
primary: 'upButton'
}
});
});
</script>
<?php
}
echo "</td>\n";
echo "<td align=\"right\">\n";
@ -715,16 +746,6 @@ class lamList {
window.onload = listResizeITabContentDiv;
window.onresize = listResizeITabContentDiv;
jQuery('#filterButton').button();
jQuery('#newButton').button({
icons: {
primary: 'createButton'
}
});
jQuery('#delButton').button({
icons: {
primary: 'deleteButton'
}
});
});
</script>
<?php

View File

@ -202,12 +202,29 @@ class lamDHCPList extends lamList {
if (!$createOnly) {
echo ("<button id=\"delButton\" name=\"del\">" . $this->labels['deleteEntry'] . "</button>\n");
}
echo "&nbsp;&nbsp;";
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo "<button id=\"fileUploadButton\" name=\"fileUpload\">" . _('File upload') . "</button>\n";
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo ("<button id=\"dhcpDefaultsButton\" name=\"dhcpDefaults\">" . $this->labels['dhcpDefaults'] . "</button>\n");
echo "&nbsp;&nbsp;&nbsp;";
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#newButton').button({
icons: {
primary: 'createButton'
}
});
jQuery('#delButton').button({
icons: {
primary: 'deleteButton'
}
});
jQuery('#fileUploadButton').button({
icons: {
primary: 'upButton'
}
});
jQuery('#dhcpDefaultsButton').button({
icons: {
primary: 'settingsButton'

View File

@ -134,7 +134,7 @@ echo "<table style=\"border-color: grey\" cellpadding=\"10\" border=\"0\" cellsp
natcasesort($sortedTypes);
foreach ($sortedTypes as $key => $value) {
$selected = '';
if (isset($_POST['type']) && ($_POST['type'] == $key)) {
if (isset($_REQUEST['type']) && ($_REQUEST['type'] == $key)) {
$selected = 'selected';
}
echo "<option value=\"" . $key . "\" $selected>" . $value . "</option>\n";
@ -149,7 +149,7 @@ echo "<table style=\"border-color: grey\" cellpadding=\"10\" border=\"0\" cellsp
$counter = 0;
foreach ($sortedTypes as $type => $label) {
$style = 'style="display:none;"';
if ((!isset($_POST['type']) && ($counter == 0)) || (isset($_POST['type']) && ($_POST['type'] == $type))) {
if ((!isset($_REQUEST['type']) && ($counter == 0)) || (isset($_REQUEST['type']) && ($_REQUEST['type'] == $type))) {
// show first account type or last selected one
$style = '';
}
@ -176,7 +176,7 @@ echo "<table style=\"border-color: grey\" cellpadding=\"10\" border=\"0\" cellsp
echo "<input type=\"checkbox\" name=\"" . $type . '_' . $modules[$m] . "\" $checked>";
}
echo getModuleAlias($modules[$m], $type);
echo "</td>";
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
if (($m%3 == 2) && ($m != (sizeof($modules) - 1))) {
echo "</tr>\n";
}