use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-29 16:47:39 +00:00
parent 24ed4cdc97
commit c192a245a8
1 changed files with 86 additions and 71 deletions

View File

@ -357,10 +357,10 @@ class quota extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return array HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = new htmlTable();
$this->initQuotas(); $this->initQuotas();
if (!is_array($this->quota)) return $return; if (!is_array($this->quota)) return $return;
// get list of lamdaemon servers // get list of lamdaemon servers
@ -376,52 +376,59 @@ class quota extends baseModule {
for ($q = 0; $q < sizeof($servers); $q++) { for ($q = 0; $q < sizeof($servers); $q++) {
$server = $servers[$q]; $server = $servers[$q];
$id = $this->replaceSpecialChars($server); $id = $this->replaceSpecialChars($server);
$fieldContent = array(); $title = $server;
$fieldContent[] = array( if (isset($serverDescriptions[$server])) {
array('kind' => 'text', 'text' => _('Mountpoint')), $title = $serverDescriptions[$server] . " (" . $server . ")";
array('kind' => 'text', 'text' => _('Used blocks')), }
array('kind' => 'text', 'text' => _('Soft block limit')), $return->addElement(new htmlSubTitle($title), true);
array('kind' => 'text', 'text' => _('Hard block limit')), $return->addElement(new htmlOutputText('&nbsp;' . _('Mountpoint') . '&nbsp;', false));
array('kind' => 'text', 'text' => _('Grace block period')), $return->addElement(new htmlOutputText('&nbsp;' . _('Used blocks') . '&nbsp;', false));
array('kind' => 'text', 'text' => _('Used inodes')), $return->addElement(new htmlOutputText('&nbsp;' . _('Soft block limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => _('Soft inode limit')), $return->addElement(new htmlOutputText('&nbsp;' . _('Hard block limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => _('Hard inode limit')), $return->addElement(new htmlOutputText('&nbsp;' . _('Grace block period') . '&nbsp;', false));
array('kind' => 'text', 'text' => _('Grace inode period'))); $return->addElement(new htmlOutputText('&nbsp;' . _('Used inodes') . '&nbsp;', false));
$return->addElement(new htmlOutputText('&nbsp;' . _('Soft inode limit') . '&nbsp;', false));
$fieldContent[] = array( $return->addElement(new htmlOutputText('&nbsp;' . _('Hard inode limit') . '&nbsp;', false));
array('kind' => 'help', 'value' => 'Mountpoint'), $return->addElement(new htmlOutputText('&nbsp;' . _('Grace inode period') . '&nbsp;', false));
array('kind' => 'help', 'value' => 'UsedBlocks'), $return->addNewLine();
array('kind' => 'help', 'value' => 'SoftBlockLimit'), $return->addElement(new htmlHelpLink('Mountpoint'));
array('kind' => 'help', 'value' => 'HardBlockLimit'), $return->addElement(new htmlHelpLink('UsedBlocks'));
array('kind' => 'help', 'value' => 'GraceBlockPeriod'), $return->addElement(new htmlHelpLink('SoftBlockLimit'));
array('kind' => 'help', 'value' => 'UsedInodes'), $return->addElement(new htmlHelpLink('HardBlockLimit'));
array('kind' => 'help', 'value' => 'SoftInodeLimit'), $return->addElement(new htmlHelpLink('GraceBlockPeriod'));
array('kind' => 'help', 'value' => 'HardInodeLimit'), $return->addElement(new htmlHelpLink('UsedInodes'));
array('kind' => 'help', 'value' => 'GraceInodePeriod') $return->addElement(new htmlHelpLink('SoftInodeLimit'));
); $return->addElement(new htmlHelpLink('HardInodeLimit'));
$return->addElement(new htmlHelpLink('GraceInodePeriod'));
$return->addNewLine();
$i=0; $i=0;
// loop for every mointpoint with enabled quotas // loop for every mointpoint with enabled quotas
while (isset($this->quota[$server][$i][0])) { while (isset($this->quota[$server][$i][0])) {
$fieldContent[] = array( $return->addElement(new htmlOutputText($this->quota[$server][$i][0]));
array('kind' => 'text', 'text' => $this->quota[$server][$i][0]), $return->addElement(new htmlOutputText($this->quota[$server][$i][1]));
array('kind' => 'text', 'text' => $this->quota[$server][$i][1]), $sbLimitInput = new htmlInputField($i . '_2_' . $id, $this->quota[$server][$i][2]);
array('kind' => 'input', 'name' => $i . '_2_' . $id, 'type' => 'text', 'size' => '12', 'maxlength' => '20', 'value' => $this->quota[$server][$i][2]), $sbLimitInput->setFieldSize(12);
array('kind' => 'input', 'name' => $i . '_3_' . $id, 'type' => 'text', 'size' => '12', 'maxlength' => '20', 'value' => $this->quota[$server][$i][3]), $sbLimitInput->setFieldMaxLength(20);
array('kind' => 'text', 'text' => $this->quota[$server][$i][4]), $return->addElement($sbLimitInput);
array('kind' => 'text', 'text' => $this->quota[$server][$i][5]), $hbLimit = new htmlInputField($i . '_3_' . $id, $this->quota[$server][$i][3]);
array('kind' => 'input', 'name' => $i . '_6_' . $id, 'type' => 'text', 'size' => '12', 'maxlength' => '20', 'value' => $this->quota[$server][$i][6]), $hbLimit->setFieldSize(12);
array('kind' => 'input', 'name' => $i . '_7_' . $id, 'type' => 'text', 'size' => '12', 'maxlength' => '20', 'value' => $this->quota[$server][$i][7]), $hbLimit->setFieldMaxLength(20);
array('kind' => 'text', 'text' => $this->quota[$server][$i][8])); $return->addElement($hbLimit);
$return->addElement(new htmlOutputText($this->quota[$server][$i][4]));
$return->addElement(new htmlOutputText($this->quota[$server][$i][5]));
$siLimit = new htmlInputField($i . '_6_' . $id, $this->quota[$server][$i][6]);
$siLimit->setFieldMaxLength(20);
$siLimit->setFieldSize(12);
$return->addElement($siLimit);
$hiLimit = new htmlInputField($i . '_7_' . $id, $this->quota[$server][$i][7]);
$hiLimit->setFieldMaxLength(20);
$hiLimit->setFieldSize(12);
$return->addElement($hiLimit);
$return->addElement(new htmlOutputText($this->quota[$server][$i][8]));
$return->addNewLine();
$i++; $i++;
} }
$legend = $server;
if (isset($serverDescriptions[$server])) {
$legend = $serverDescriptions[$server] . " (" . $server . ")";
}
$return[] = array(
array('kind' => 'fieldset', 'legend' => $legend, 'value' => $fieldContent)
);
} }
return $return; return $return;
} }
@ -440,10 +447,10 @@ class quota extends baseModule {
/** /**
* Returns a list of elements for the account profiles. * Returns a list of elements for the account profiles.
* *
* @return profile elements * @return htmlElement profile elements
*/ */
function get_profileOptions() { function get_profileOptions() {
$return = array(); $return = new htmlTable();
// get list of lamdaemon servers // get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
for ($s = 0; $s < sizeof($lamdaemonServers); $s++) { for ($s = 0; $s < sizeof($lamdaemonServers); $s++) {
@ -451,8 +458,9 @@ class quota extends baseModule {
$server = $temp[0]; $server = $temp[0];
$id = $this->replaceSpecialChars($server); $id = $this->replaceSpecialChars($server);
$description = $temp[0]; $description = $temp[0];
if (isset($temp[1])) $description = $temp[1]; if (isset($temp[1])) {
$description = $temp[1] . ' (' . $temp[0] . ')';
}
// Get quotas // Get quotas
$quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array("+", "quota", "get", $this->get_scope())), $server); $quotas = lamdaemon(implode(quota::$SPLIT_DELIMITER, array("+", "quota", "get", $this->get_scope())), $server);
$dirs = explode(":", $quotas[0]); $dirs = explode(":", $quotas[0]);
@ -469,33 +477,40 @@ class quota extends baseModule {
} }
$dirs = array_values($dirs); $dirs = array_values($dirs);
if (sizeof($dirs) < 1) continue; // stop if no quota directories were found if (sizeof($dirs) < 1) continue; // stop if no quota directories were found
$fieldContent = array(); $return->addElement(new htmlSubTitle($description), true);
$fieldContent[] = array ( $return->addElement(new htmlOutputText('&nbsp;' . _('Mountpoint') . '&nbsp;', false));
array('kind' => 'text', 'text' => '<b>' . _('Mountpoint') . '&nbsp;&nbsp;</b>', 'align' => 'center'), $return->addElement(new htmlOutputText('&nbsp;' . _('Soft block limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => '<b>' . _('Soft block limit') . '&nbsp;&nbsp;</b>', 'align' => 'center'), $return->addElement(new htmlOutputText('&nbsp;' . _('Hard block limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => '<b>' . _('Hard block limit') . '&nbsp;&nbsp;</b>', 'align' => 'center'), $return->addElement(new htmlOutputText('&nbsp;' . _('Soft inode limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => '<b>' . _('Soft inode limit') . '&nbsp;&nbsp;</b>', 'align' => 'center'), $return->addElement(new htmlOutputText('&nbsp;' . _('Hard inode limit') . '&nbsp;', false));
array('kind' => 'text', 'text' => '<b>' . _('Hard inode limit') . '&nbsp;&nbsp;</b>', 'align' => 'center'), $return->addNewLine();
); $return->addElement(new htmlHelpLink('Mountpoint'));
$fieldContent[] = array ( $return->addElement(new htmlHelpLink('SoftBlockLimit'));
array('kind' => 'help', 'value' => 'Mountpoint', 'align' => 'center'), $return->addElement(new htmlHelpLink('HardBlockLimit'));
array('kind' => 'help', 'value' => 'SoftBlockLimit', 'align' => 'center'), $return->addElement(new htmlHelpLink('SoftInodeLimit'));
array('kind' => 'help', 'value' => 'HardBlockLimit', 'align' => 'center'), $return->addElement(new htmlHelpLink('HardInodeLimit'));
array('kind' => 'help', 'value' => 'SoftInodeLimit', 'align' => 'center'), $return->addNewLine();
array('kind' => 'help', 'value' => 'HardInodeLimit', 'align' => 'center'),
);
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
$fieldContent[] = array( $return->addElement(new htmlOutputText($dirs[$i]));
array('kind' => 'text', 'text' => $dirs[$i], 'align' => 'left'), $sbLimit = new htmlInputField("quota_softblock_" . $id . "_" . $dirs[$i]);
array('kind' => 'input', 'type' => 'text', 'align' => 'center', 'size' => '12', 'name' => "quota_softblock_" . $id . "_" . $dirs[$i]), $sbLimit->setFieldSize(12);
array('kind' => 'input', 'type' => 'text', 'align' => 'center', 'size' => '12', 'name' => "quota_hardblock_" . $id . "_" . $dirs[$i]), $sbLimit->setFieldMaxLength(20);
array('kind' => 'input', 'type' => 'text', 'align' => 'center', 'size' => '12', 'name' => "quota_softinode_" . $id . "_" . $dirs[$i]), $return->addElement($sbLimit);
array('kind' => 'input', 'type' => 'text', 'align' => 'center', 'size' => '12', 'name' => "quota_hardinode_" . $id . "_" . $dirs[$i]), $hbLimit = new htmlInputField("quota_hardblock_" . $id . "_" . $dirs[$i]);
); $hbLimit->setFieldSize(12);
$hbLimit->setFieldMaxLength(20);
$return->addElement($hbLimit);
$siLimit = new htmlInputField("quota_softinode_" . $id . "_" . $dirs[$i]);
$siLimit->setFieldSize(12);
$siLimit->setFieldMaxLength(20);
$return->addElement($siLimit);
$hiLimit = new htmlInputField("quota_hardinode_" . $id . "_" . $dirs[$i]);
$hiLimit->setFieldSize(12);
$hiLimit->setFieldMaxLength(20);
$return->addElement($hiLimit);
$return->addNewLine();
} }
$return[] = array(
array('kind' => 'fieldset', 'legend' => $description . " (" . $server . ")", 'value' => $fieldContent)
);
} }
return $return; return $return;
} }