submit_button('send','>').'';
- }
- return $html;
- }
-
- function image( $app,$name,$title='',$options='' )
- {
- if (strstr($name,'.') === False)
- {
- $name .= '.gif';
- }
- if (!($path = $GLOBALS['phpgw']->common->image($app,$name)))
- {
- $path = $name; // name may already contain absolut path
- }
- if (!@is_readable($_SERVER['DOCUMENT_ROOT'] . $path))
- {
- return $title;
- }
- if ($title)
- {
- $options .= " $this->prefered_img_title=\"".htmlspecialchars($title).'"';
- }
- return " ";
- }
-
- function a_href( $content,$url,$vars='',$options='')
- {
- if (!strstr($url,'/') && count(explode('.',$url)) == 3)
- {
- $url = "/index.php?menuaction=$url";
- }
- if (is_array($url))
- {
- $vars = $url;
- $url = '/index.php';
- }
- return ''.$content.' ';
- }
-
- function bold($content)
- {
- return ''.$content.' ';
- }
-
- function italic($content)
- {
- return ''.$content.' ';
- }
-
- function hr($width,$options='')
- {
- if ($width)
- $options .= " WIDTH=$width";
- return " \n";
- }
-
- /*!
- @function formatOptions
- @abstract formats option-string for most of the above functions
- @param $options String (or Array) with option-values eg. '100%,,1'
- @param $names String (or Array) with the option-names eg. 'WIDTH,HEIGHT,BORDER'
- @example formatOptions('100%,,1','WIDTH,HEIGHT,BORDER') = ' WIDTH="100%" BORDER="1"'
- @result option string
- */
- function formatOptions($options,$names)
- {
- if (!is_array($options)) $options = explode(',',$options);
- if (!is_array($names)) $names = explode(',',$names);
-
- while (list($n,$val) = each($options))
- if ($val != '' && $names[$n] != '')
- $html .= ' '.$names[$n].'="'.$val.'"';
-
- return $html;
- }
-
- /*!
- @function themeStyles
- @abstract returns simple stylesheet (incl. " : '';
- }
-
- function label($content,$id='',$accesskey='',$options='')
- {
- if ($id != '')
- {
- $id = " FOR=\"$id\"";
- }
- if ($accesskey != '')
- {
- $accesskey = " ACCESSKEY=\"$accesskey\"";
- }
- return "$content ";
- }
-}
diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php
index 782ff2d86a..2ef632ab8d 100755
--- a/calendar/inc/class.socalendar.inc.php
+++ b/calendar/inc/class.socalendar.inc.php
@@ -203,17 +203,17 @@
function save_alarm($cal_id,$alarm,$id=0)
{
- $this->cal->save_alarm($cal_id,$alarm,$id);
+ return $this->cal->save_alarm($cal_id,$alarm,$id);
}
function delete_alarm($id)
{
- $this->cal->delete_alarm($id);
+ return $this->cal->delete_alarm($id);
}
function delete_entry($id)
{
- $this->cal->delete_event($id);
+ return $this->cal->delete_event($id);
}
function expunge()
diff --git a/calendar/inc/class.socalendar_sql.inc.php b/calendar/inc/class.socalendar_sql.inc.php
index 1321793fa0..1751cb4ac8 100755
--- a/calendar/inc/class.socalendar_sql.inc.php
+++ b/calendar/inc/class.socalendar_sql.inc.php
@@ -153,6 +153,7 @@ class socalendar_ extends socalendar__
@syntax save_alarm($cal_id,$alarm,$id=False)
@param $cal_id Id of the calendar-entry
@param $alarm array with fields: text, owner, enabled, ..
+ @returns the id of the alarm
*/
function save_alarm($cal_id,$alarm)
{
diff --git a/calendar/inc/class.uialarm.inc.php b/calendar/inc/class.uialarm.inc.php
index 55b3c82b1a..aedf25028a 100755
--- a/calendar/inc/class.uialarm.inc.php
+++ b/calendar/inc/class.uialarm.inc.php
@@ -47,7 +47,11 @@
}
$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar');
- $this->html = CreateObject('calendar.html');
+ if (!is_object($GLOBALS['phpgw']->html))
+ {
+ $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
+ }
+ $this->html = &$GLOBALS['phpgw']->html;
}
function prep_page()
@@ -94,6 +98,10 @@
function manager()
{
+ if ($_POST['cancel'])
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.($_POST['return_to'] ? $_POST['return_to'] : 'calendar.uicalendar.index'));
+ }
if ($_POST['delete'] && count($_POST['alarm']))
{
if ($this->bo->delete($_POST['alarm']) < 0)
@@ -159,9 +167,8 @@
//'data' => $alarm['text'],
'data' => lang('Email Notification'),
'owner' => $GLOBALS['phpgw']->common->grab_owner_name($alarm['owner']),
- 'enabled' => ($alarm['enabled']?' ':
- ' '),
- 'select' => ' '
+ 'enabled' => $this->html->image('calendar',$alarm['enabled']?'enabled':'disabled',$alarm['enabled']?'enabled':'disabled','width="13" height="13"'),
+ 'select' => $this->html->checkbox("alarm[$alarm[id]]")
);
if ($this->bo->check_perms(PHPGW_ACL_DELETEALARM,$alarm['owner']))
{
@@ -189,9 +196,13 @@
}
$this->template->set_var(Array(
'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uialarm.manager')),
- 'hidden_vars' => $this->html->input_hidden('cal_id',$this->bo->cal_id),
+ 'hidden_vars' => $this->html->input_hidden(array(
+ 'cal_id' => $this->bo->cal_id,
+ 'return_to' => $_POST['return_to']
+ )),
'lang_enable' => lang('Enable'),
- 'lang_disable' => lang('Disable')
+ 'lang_disable' => lang('Disable'),
+ 'input_cancel' => $this->html->submit_button('cancel','Cancel')
));
//echo "alarm_management='".htmlspecialchars($this->template->get_var('alarm_management'))."'
\n";
$this->template->pfp('out','alarm_management');
diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php
index 38f210cea3..ccd5a0e639 100755
--- a/calendar/inc/class.uicalendar.inc.php
+++ b/calendar/inc/class.uicalendar.inc.php
@@ -33,8 +33,6 @@
var $link_tpl;
// planner related variables
- var $planner_html;
-
var $planner_header;
var $planner_rows;
@@ -133,6 +131,12 @@
$this->always_app_header = $this->bo->prefs['common']['template_set'] == 'idots';
print_debug('UI',$this->_debug_sqsof());
+
+ if (!is_object($GLOBALS['phpgw']->html))
+ {
+ $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
+ }
+ $this->html = &$GLOBALS['phpgw']->html;
}
/* Public functions */
@@ -730,8 +734,10 @@
'action_url_button' => $this->page('edit','&cal_id='.$cal_id),
'action_text_button' => lang('Edit Single'),
'action_confirm_button' => '',
- 'action_extra_field' => ' '."\n"
- . ' '
+ 'action_extra_field' => $this->html->input_hidden(array(
+ 'edit_type' => 'single',
+ 'date' => sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day)
+ ))
);
$p->set_var($var);
$button_left .= ''.$p->fp('button','form_button').' ';
@@ -740,7 +746,7 @@
'action_url_button' => $this->page('edit','&cal_id='.$cal_id),
'action_text_button' => lang('Edit Series'),
'action_confirm_button' => '',
- 'action_extra_field' => ' '
+ 'action_extra_field' => $this->html->input_hidden('edit_type','series')
);
$p->set_var($var);
$button_left .= ''.$p->fp('button','form_button').' ';
@@ -761,7 +767,10 @@
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'),
'action_text_button' => lang('Alarm Management'),
'action_confirm_button' => '',
- 'action_extra_field' => ' '
+ 'action_extra_field' => $this->html->input_hidden(array(
+ 'cal_id' => $cal_id,
+ 'return_to' => $this->bo->return_to
+ ))
);
$p->set_var($var);
$button_center .= ''.$p->fp('button','form_button').' ';
@@ -775,8 +784,10 @@
'action_url_button' => $this->page('delete','&cal_id='.$cal_id),
'action_text_button' => lang('Delete Single'),
'action_confirm_button' => "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this single occurence ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
- 'action_extra_field' => ' '
- . ' '
+ 'action_extra_field' => $this->html->input_hidden(array(
+ 'delete_type' => 'single',
+ 'date' => sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day)
+ ))
);
$p->set_var($var);
$button_right .= ''.$p->fp('button','form_button').' ';
@@ -785,7 +796,7 @@
'action_url_button' => $this->page('delete','&cal_id='.$cal_id),
'action_text_button' => lang('Delete Series'),
'action_confirm_button' => "onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
- 'action_extra_field' => ' '
+ 'action_extra_field' => $this->html->input_hidden('delete_type','series')
);
$p->set_var($var);
$button_right .= ''.$p->fp('button','form_button').' ';
@@ -827,7 +838,10 @@
'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'),
'action_text_button' => lang('Alarm Management'),
'action_confirm_button' => '',
- 'action_extra_field' => ' '
+ 'action_extra_field' => $this->html->input_hidden(array(
+ 'cal_id' => $cal_id,
+ 'return_to' => $this->bo->return_to
+ ))
);
$p->set_var($var);
echo $p->fp('out','form_button');
@@ -839,7 +853,7 @@
'action_url_button' => $this->page('export'),
'action_text_button' => lang('Export'),
'action_confirm_button' => '',
- 'action_extra_field' => ' '
+ 'action_extra_field' => $this->html->input_hidden('cal_id',$cal_id)
);
$p->set_var($var);
$button_center .= ''.$p->fp('button','form_button').' ';
@@ -993,11 +1007,11 @@
}
if ($this->bo->return_to)
{
- Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to));
+ $GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->bo->return_to);
}
else
{
- Header('Location: '.$this->index());
+ $GLOBALS['phpgw']->redirect($this->index());
}
$GLOBALS['phpgw']->common->phpgw_exit();
}
@@ -1320,10 +1334,6 @@
{
if (is_array($todos) && count($todos))
{
- if (!is_object($GLOBALS['phpgw']->html))
- {
- $GLOBALS['phpgw']->html = CreateObject('calendar.html');
- }
foreach($todos as $todo)
{
$icons = '';
@@ -1332,7 +1342,7 @@
$icons .= ($icons?' ':'').$GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"');
}
$class = $class == 'row_on' ? 'row_off' : 'row_on';
- $content .= " \n ".
+ $content .= " \n ".
($this->bo->printer_friendly?$icons:$GLOBALS['phpgw']->html->a_href($icons,$todo['view'])).
" \n ".($this->bo->printer_friendly?$todo['title']:
$GLOBALS['phpgw']->html->a_href($todo['title'],$todo['view']))." \n \n";
@@ -1342,8 +1352,7 @@
}
if (!empty($content))
{
- //echo "todos=\n";
- return "\n";
+ return "\n";
}
return False;
}
@@ -1510,7 +1519,6 @@
// create/initialize variables directly used for HTML code generation
//
- $this->planner_html = CreateObject('calendar.html');
$this->planner_header = array();
$this->planner_rows = array();
@@ -1582,7 +1590,7 @@
$hdr[2]['.'.$index] .= " bgcolor=\"$color\"";
- $hdr[2][$index] = 'html->link('/index.php',
array(
'menuaction' => 'calendar.uicalendar.add',
'date' => $date
@@ -1661,7 +1669,7 @@
$intervals_per_day = $this->bo->prefs['calendar']['planner_intervals_per_day'];
$is_private = !$this->bo->check_perms(PHPGW_ACL_READ,$event);
- $view = $this->planner_html->link('/index.php',
+ $view = $this->html->link('/index.php',
array(
'menuaction' => 'calendar.uicalendar.view',
'cal_id' => $event['id'],
@@ -1782,13 +1790,13 @@
if ($event['priority'] == 3)
{
- $cel .= $this->planner_html->image('calendar','mini-calendar-bar.gif','','border="0"');
+ $cel .= $this->html->image('calendar','mini-calendar-bar.gif','','border="0"');
}
if ($event['recur_type'])
{
- $cel .= $this->planner_html->image('calendar','recur.gif','','border="0"');
+ $cel .= $this->html->image('calendar','recur.gif','','border="0"');
}
- $cel .= $this->planner_html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"');
+ $cel .= $this->html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"');
$cel .= ' ';
if (isset($event['print_title']) && $event['print_title'] == 'yes')
@@ -1948,7 +1956,7 @@
_debug_array($this->planner_rows);
reset($this->planner_rows);
}
- return $this->planner_html->table(
+ return $this->html->table(
array(
'_hdr0' => $this->planner_header[0],
'._hdr0' => $bgcolor,
diff --git a/calendar/templates/default/alarm.tpl b/calendar/templates/default/alarm.tpl
index 7f30c013d3..568028dfa5 100755
--- a/calendar/templates/default/alarm.tpl
+++ b/calendar/templates/default/alarm.tpl
@@ -4,8 +4,10 @@
{hidden_vars}
{rows}
-
- {input_days} {input_hours} {input_minutes} {input_owner} {input_add}
+
+ {input_days} {input_hours} {input_minutes} {input_owner} {input_add}
+
+ {input_cancel}