Add show_upload_boxes option, extend preferences for dropdown boxes

This commit is contained in:
zone 2001-08-24 07:47:01 +00:00
parent dcc1e05d85
commit 0bba61d6c4
2 changed files with 50 additions and 2 deletions

View File

@ -18,5 +18,6 @@ $pref->change ("phpwebhosting", "viewtextplain", True);
//$pref->change ("phpwebhosting", "dotdot", "False"); //$pref->change ("phpwebhosting", "dotdot", "False");
//$pref->change ("phpwebhosting", "dotfiles", "False"); //$pref->change ("phpwebhosting", "dotfiles", "False");
//$pref->change ("phpwebhosting", "show_help", "False"); //$pref->change ("phpwebhosting", "show_help", "False");
$pref->change ("phpwebhosting", "show_upload_boxes", "5");
?> ?>

View File

@ -11,14 +11,27 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "phpwebhosting", "enable_nextmatchs_class" => True, "noheader" => True, "nonavbar" => True); $phpgw_info["flags"] = array
(
"currentapp" => "phpwebhosting",
"enable_nextmatchs_class" => True,
"noheader" => True,
"nonavbar" => True
);
include("../header.inc.php"); include("../header.inc.php");
/* /*
To add a preference, just add it here. Key is internal name, value is displayed name To add an on/off preference, just add it here. Key is internal name, value is displayed name
*/ */
$other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", "dotdot" => "Show ..", "dotfiles" => "Show .files", "show_help" => "Show help"); $other_checkboxes = array ("viewinnewwin" => "View documents in new window", "viewonserver" => "View documents on server (if available)", "viewtextplain" => "Unknown MIME-type defaults to text/plain when viewing", "dotdot" => "Show ..", "dotfiles" => "Show .files", "show_help" => "Show help");
/*
To add a dropdown preferences, add it here. Key is internal name, value key is
displayed name, value values are choices in the dropdown
*/
$other_dropdown = array ("show_upload_boxes" => array ("Default number of upload fields to show", "5", "10", "20", "30"));
if ($submit) if ($submit)
{ {
$phpgw->preferences->read_repository (); $phpgw->preferences->read_repository ();
@ -35,6 +48,12 @@
$phpgw->preferences->add ($phpgw_info["flags"]["currentapp"], $internal, $$internal); $phpgw->preferences->add ($phpgw_info["flags"]["currentapp"], $internal, $$internal);
} }
reset ($other_dropdown);
while (list ($internal, $displayed) = each ($other_dropdown))
{
$phpgw->preferences->add ($phpgw_info["flags"]["currentapp"], $internal, $$internal);
}
$phpgw->preferences->save_repository (True); $phpgw->preferences->save_repository (True);
Header('Location: '.$phpgw->link('/preferences/index.php')); Header('Location: '.$phpgw->link('/preferences/index.php'));
@ -86,23 +105,51 @@
{ {
unset ($checked); unset ($checked);
if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal]) if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal])
{
$checked = 1; $checked = 1;
}
$str .= html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1) . " $displayed" . html_break (1, NULL, 1); $str .= html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1) . " $displayed" . html_break (1, NULL, 1);
} }
display_item (lang ('Display attributes'), $str); display_item (lang ('Display attributes'), $str);
reset ($other_checkboxes);
while (list ($internal, $displayed) = each ($other_checkboxes)) while (list ($internal, $displayed) = each ($other_checkboxes))
{ {
unset ($checked); unset ($checked);
if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal]) if ($phpgw_info["user"]["preferences"]["phpwebhosting"][$internal])
{
$checked = 1; $checked = 1;
}
$str = html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1); $str = html_form_input ("checkbox", $internal, NULL, NULL, NULL, $checked, NULL, 1);
display_item (lang ($displayed), $str); display_item (lang ($displayed), $str);
} }
reset ($other_dropdown);
while (list ($internal, $value_array) = each ($other_dropdown))
{
reset ($value_array);
unset ($options);
while (list ($num, $value) = each ($value_array))
{
if ($num == 0)
{
$displayed = $value;
continue;
}
$options .= html_form_option ($value, $value, $phpgw_info["user"]["preferences"]["phpwebhosting"][$internal] == $value, True);
}
$output = html_form_select_begin ($internal, True);
$output .= $options;
$output .= html_form_select_end (True);
display_item ($displayed, $output);
}
$p->pparse ('out', 'pref'); $p->pparse ('out', 'pref');
$phpgw->common->phpgw_footer (); $phpgw->common->phpgw_footer ();
?> ?>