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

View File

@ -202,12 +202,29 @@ class lamDHCPList extends lamList {
if (!$createOnly) { 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;"; 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 ("<button id=\"dhcpDefaultsButton\" name=\"dhcpDefaults\">" . $this->labels['dhcpDefaults'] . "</button>\n");
echo "&nbsp;&nbsp;&nbsp;"; echo "&nbsp;&nbsp;&nbsp;";
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { 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({ jQuery('#dhcpDefaultsButton').button({
icons: { icons: {
primary: 'settingsButton' primary: 'settingsButton'

View File

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