mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
preference.php now template based
This commit is contained in:
parent
6e9adb8334
commit
f50b8cc6fe
@ -9,145 +9,144 @@
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True, "noheader" => True, "nonavbar" => True, "noappheader" => True, "noappfooter" => True);
|
||||
include("../header.inc.php");
|
||||
$phpgw_flags = Array(
|
||||
'currentapp' => 'calendar',
|
||||
'enable_nextmatchs_class' => True,
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'noappheader' => True,
|
||||
'noappfooter' => True
|
||||
);
|
||||
|
||||
if ($submit) {
|
||||
$phpgw->preferences->read_repository();
|
||||
$phpgw->preferences->add("calendar","weekdaystarts");
|
||||
$phpgw->preferences->add("calendar","workdaystarts");
|
||||
$phpgw->preferences->add("calendar","workdayends");
|
||||
$phpgw->preferences->add("calendar","defaultcalendar");
|
||||
$phpgw->preferences->add("calendar","defaultfilter");
|
||||
if ($mainscreen_showevents) {
|
||||
$phpgw->preferences->add("calendar","mainscreen_showevents");
|
||||
} else {
|
||||
$phpgw->preferences->delete("calendar","mainscreen_showevents");
|
||||
}
|
||||
$phpgw->preferences->save_repository(True);
|
||||
$phpgw_info['flags'] = $phpgw_flags;
|
||||
include('../header.inc.php');
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$phpgw->preferences->read_repository();
|
||||
$phpgw->preferences->add('calendar','weekdaystarts');
|
||||
$phpgw->preferences->add('calendar','workdaystarts');
|
||||
$phpgw->preferences->add('calendar','workdayends');
|
||||
$phpgw->preferences->add('calendar','defaultcalendar');
|
||||
$phpgw->preferences->add('calendar','defaultfilter');
|
||||
if ($mainscreen_showevents)
|
||||
{
|
||||
$phpgw->preferences->add('calendar','mainscreen_showevents');
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw->preferences->delete('calendar','mainscreen_showevents');
|
||||
}
|
||||
$phpgw->preferences->save_repository(True);
|
||||
|
||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
Header('Location: '.$phpgw->link('/preferences/index.php'));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
function display_item($field,$data)
|
||||
{
|
||||
global $phpgw, $p, $tr_color;
|
||||
|
||||
if ($totalerrors) {
|
||||
echo "<p><center>" . $phpgw->common->error_list($errors) . "</center>";
|
||||
}
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
$var = Array(
|
||||
'bg_color' => $tr_color,
|
||||
'field' => $field,
|
||||
'data' => $data
|
||||
);
|
||||
$p->set_var($var);
|
||||
$p->parse('row','pref_list',True);
|
||||
}
|
||||
|
||||
echo "<p><b>" . lang("Calendar preferences") . ":" . "</b><hr><p>";
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
|
||||
$templates = Array(
|
||||
'pref' => 'pref.tpl',
|
||||
'pref_colspan' => 'pref_colspan.tpl',
|
||||
'pref_list' => 'pref_list.tpl',
|
||||
);
|
||||
$p->set_file($templates);
|
||||
|
||||
$var = Array(
|
||||
'title' => lang('Calendar preferences'),
|
||||
'action_url' => $phpgw->link(''),
|
||||
'bg_color' => $phpgw_info['theme']['th_bg'],
|
||||
'submit_lang' => lang('submit')
|
||||
);
|
||||
|
||||
$p->set_var($var);
|
||||
$p->set_var('text',' ');
|
||||
$p->parse('row','pref_colspan',True);
|
||||
|
||||
// if ($totalerrors)
|
||||
// {
|
||||
// echo '<p><center>' . $phpgw->common->error_list($errors) . '</center>';
|
||||
// }
|
||||
|
||||
$str = '<input type="checkbox" name="mainscreen_showevents" value="Y"'.($phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == 'Y'?' checked':'').'>';
|
||||
display_item(lang('show day view on main screen'),$str);
|
||||
|
||||
$t_weekday[$phpgw_info['user']['preferences']['calendar']['weekdaystarts']] = ' selected';
|
||||
$str = '<select name="weekdaystarts">'
|
||||
. '<option value="Monday"'.$t_weekday['Monday'].'>'.lang('Monday').'</option>'
|
||||
. '<option value="Sunday"'.$t_weekday['Sunday'].'>'.lang('Sunday').'</option>'
|
||||
. '</select>';
|
||||
display_item(lang('weekday starts on'),$str);
|
||||
|
||||
$t_workdaystarts[$phpgw_info['user']['preferences']['calendar']['workdaystarts']] = ' selected';
|
||||
$str = '<select name="workdaystarts">';
|
||||
for ($i=0; $i<24; $i++)
|
||||
{
|
||||
$str .= '<option value="'.$i.'"'.$t_workdaystarts[$i].'>'
|
||||
. $phpgw->common->formattime($i+1,'00') . '</option>';
|
||||
}
|
||||
$str .= '</select>';
|
||||
display_item(lang('work day starts on'),$str);
|
||||
|
||||
$t_workdayends[$phpgw_info['user']['preferences']['calendar']['workdayends']] = ' selected';
|
||||
$str = '<select name="workdayends">';
|
||||
for ($i=0; $i<24; $i++)
|
||||
{
|
||||
$str .= '<option value="'.$i.'"'.$t_workdayends[$i].'>'
|
||||
. $phpgw->common->formattime($i+1,'00') . '</option>';
|
||||
}
|
||||
$str .= '</select>';
|
||||
display_item(lang('work day ends on'),$str);
|
||||
|
||||
$selected[$phpgw_info['user']['preferences']['calendar']['defaultcalendar']] = ' selected';
|
||||
if (!isset($phpgw_info['user']['preferences']['calendar']['defaultcalendar']))
|
||||
{
|
||||
$selected['month.php'] = ' selected';
|
||||
}
|
||||
$str = '<select name="defaultcalendar">'
|
||||
. '<option value="year.php"'.$selected['year.php'].'>'.lang('Yearly').'</option>'
|
||||
. '<option value="month.php"'.$selected['month.php'].'>'.lang('Monthly').'</option>'
|
||||
. '<option value="week.php"'.$selected['week.php'].'>'.lang('Weekly').'</option>'
|
||||
. '<option value="day.php"'.$selected['day.php'].'>'.lang('Daily').'</option>'
|
||||
. '</select>';
|
||||
display_item(lang('default calendar view'),$str);
|
||||
|
||||
|
||||
$selected = array();
|
||||
$selected[$phpgw_info['user']['preferences']['calendar']['defaultfilter']] = ' selected';
|
||||
if (! isset($phpgw_info['user']['preferences']['calendar']['defaultfilter']) || $phpgw_info['user']['preferences']['calendar']['defaultfilter'] == 'private')
|
||||
{
|
||||
$selected['private'] = ' selected';
|
||||
}
|
||||
$str = '<select name="defaultfilter">'
|
||||
. '<option value="all"'.$selected['all'].'>'.lang('all').'</option>'
|
||||
. '<option value="private"'.$selected['private'].'>'.lang('private only').'</option>'
|
||||
. '<option value="public"'.$selected['public'].'>'.lang('global public only').'</option>'
|
||||
. '<option value="group"'.$selected['group'].'>'.lang('group public only').'</option>'
|
||||
. '<option value="private+public"'.$selected['private+public'].'>'.lang('private and global public').'</option>'
|
||||
. '<option value="private+group"'.$selected['private+group'].'>'.lang('private and group public').'</option>'
|
||||
. '<option value="public+group"'.$selected['public+group'].'>'.lang('global public and group public').'</option>'
|
||||
. '</select>';
|
||||
display_item(lang('default calendar filter'),$str);
|
||||
|
||||
$p->pparse('out','pref');
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
<form action="<?php echo $phpgw->link(); ?>" method="POST">
|
||||
<table border="0" align="center" width="50%">
|
||||
<tr bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<?php $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); ?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("show day view on main screen"); ?> ?</td>
|
||||
<td align="center"><input type="checkbox" name="mainscreen_showevents" value="Y" <?php
|
||||
if ($phpgw_info["user"]["preferences"]["calendar"]["mainscreen_showevents"] == "Y") echo " checked";
|
||||
?>>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$t_weekday[$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]] = " selected";
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("weekday starts on"); ?></td>
|
||||
<td align="center">
|
||||
<select name="weekdaystarts">
|
||||
<option value="Monday"<?php echo $t_weekday["Monday"]; ?>><?php echo lang("Monday"); ?></option>
|
||||
<option value="Sunday"<?php echo $t_weekday["Sunday"]; ?>><?php echo lang("Sunday"); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
$t_workdaystarts[$phpgw_info["user"]["preferences"]["calendar"]["workdaystarts"]] = " selected";
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("work day starts on"); ?></td>
|
||||
<td align="center">
|
||||
<select name="workdaystarts">
|
||||
<?php
|
||||
for ($i=0; $i<24; $i++)
|
||||
echo "<option value=\"$i\"" . $t_workdaystarts[$i] . ">"
|
||||
. $phpgw->common->formattime($i+1,"00") . "</option>";
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$t_workdayends[$phpgw_info["user"]["preferences"]["calendar"]["workdayends"]] = " selected";
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("work day ends on"); ?></td>
|
||||
<td align="center">
|
||||
<select name="workdayends">
|
||||
<?php
|
||||
for ($i=0; $i<24; $i++) {
|
||||
echo "<option value=\"$i\"" . $t_workdayends[$i] . ">"
|
||||
. $phpgw->common->formattime($i+1,"00") . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("default calendar view"); ?></td>
|
||||
<td align="center">
|
||||
<select name="defaultcalendar">
|
||||
<?php
|
||||
$selected = array();
|
||||
$selected[$phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"]] = " selected";
|
||||
if (! isset($phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"])) {
|
||||
$selected["month.php"] = " selected";
|
||||
}
|
||||
?>
|
||||
<option value="year.php"<?php echo $selected["year.php"] . ">" . lang("Yearly"); ?></option>
|
||||
<option value="month.php"<?php echo $selected["month.php"] . ">" . lang("Monthly"); ?></option>
|
||||
<option value="week.php"<?php echo $selected["week.php"] . ">" . lang("Weekly"); ?></option>
|
||||
<option value="day.php"<?php echo $selected["day.php"] . ">" . lang("Daily"); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
?>
|
||||
<tr bgcolor="<?php echo $tr_color; ?>">
|
||||
<td><?php echo lang("default calendar filter"); ?></td>
|
||||
<td align="center">
|
||||
<select name="defaultfilter">
|
||||
<?php
|
||||
$selected = array();
|
||||
$selected[$phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]] = " selected";
|
||||
if (! isset($phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]) || $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"] == "private") {
|
||||
$selected["private"] = " selected";
|
||||
}
|
||||
?>
|
||||
<option value="all"<?php echo $selected["all"].">".lang("all"); ?></option>
|
||||
<option value="private"<?php echo $selected["private"]. ">".lang("private only"); ?></option>
|
||||
<option value="public"<?php echo $selected["public"].">".lang("global public only"); ?></option>
|
||||
<option value="group"<?php echo $selected["group"].">".lang("group public only"); ?></option>
|
||||
<option value="private+public"<?php echo $selected["private+public"].">".lang("private and global public"); ?></option>
|
||||
<option value="private+group"<?php echo $selected["private+group"].">".lang("private and group public"); ?></option>
|
||||
<option value="public+group"<?php echo $selected["public+group"].">".lang("global public and group public") ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td align="center"><input type="submit" name="submit" value="<?php echo lang("submit"); ?>"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php $phpgw->common->phpgw_footer(); ?>
|
||||
|
7
calendar/templates/default/pref.tpl
Executable file
7
calendar/templates/default/pref.tpl
Executable file
@ -0,0 +1,7 @@
|
||||
<p><b>{title}:</b><hr><p>
|
||||
<form action="{action_url}" method="POST">
|
||||
<table border="0" align="center" width="50%">
|
||||
{row}
|
||||
</table>
|
||||
<center><input type="submit" name="submit" value="{submit_lang}"></center>
|
||||
</form>
|
4
calendar/templates/default/pref_colspan.tpl
Executable file
4
calendar/templates/default/pref_colspan.tpl
Executable file
@ -0,0 +1,4 @@
|
||||
<tr bgcolor="{bg_color}">
|
||||
<td colspan="2">{text}</td>
|
||||
</tr>
|
||||
|
5
calendar/templates/default/pref_list.tpl
Executable file
5
calendar/templates/default/pref_list.tpl
Executable file
@ -0,0 +1,5 @@
|
||||
<tr bgcolor="{bg_color}">
|
||||
<td align="right">{field}</td>
|
||||
<td align="center">{data}</td>
|
||||
</tr>
|
||||
|
7
calendar/templates/verdilak/pref.tpl
Executable file
7
calendar/templates/verdilak/pref.tpl
Executable file
@ -0,0 +1,7 @@
|
||||
<p><b>{title}:</b><hr><p>
|
||||
<form action="{action_url}" method="POST">
|
||||
<table border="0" align="center" width="50%">
|
||||
{row}
|
||||
</table>
|
||||
<center><input type="submit" name="submit" value="{submit_lang}"></center>
|
||||
</form>
|
4
calendar/templates/verdilak/pref_colspan.tpl
Executable file
4
calendar/templates/verdilak/pref_colspan.tpl
Executable file
@ -0,0 +1,4 @@
|
||||
<tr bgcolor="{bg_color}">
|
||||
<td colspan="2">{text}</td>
|
||||
</tr>
|
||||
|
5
calendar/templates/verdilak/pref_list.tpl
Executable file
5
calendar/templates/verdilak/pref_list.tpl
Executable file
@ -0,0 +1,5 @@
|
||||
<tr bgcolor="{bg_color}">
|
||||
<td align="right">{field}</td>
|
||||
<td align="center">{data}</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user