Index: /trunk/phpgwapi/inc/class.sbox.inc.php
===================================================================
--- /trunk/phpgwapi/inc/class.sbox.inc.php (revision 2)
+++ /trunk/phpgwapi/inc/class.sbox.inc.php (revision 588)
@@ -164,4 +164,15 @@
{
$out .= ''."\n";
+ }
+ return ''."\n";
+ }
+
+ function getMonths($name, $selected=0)
+ {
+ $out = '';
+ for($i=0;$i<=12;$i++)
+ {
+ $out .= ''."\n";
+// $out .= ''."\n";
}
return ''."\n";
Index: /trunk/contactcenter/inc/class.bo_ldap_manager.inc.php
===================================================================
--- /trunk/contactcenter/inc/class.bo_ldap_manager.inc.php (revision 383)
+++ /trunk/contactcenter/inc/class.bo_ldap_manager.inc.php (revision 588)
@@ -104,4 +104,5 @@
$op_iop = array(
+ 'contact.uidnumber' => array('uidNumber'),
'contact.id_contact' => array('dn'),
'contact.photo' => array('jpegPhoto'),
Index: /trunk/mobile/calendar.php
===================================================================
--- /trunk/mobile/calendar.php (revision 524)
+++ /trunk/mobile/calendar.php (revision 588)
@@ -49,4 +49,5 @@
$data[] = array();
@ksort($daily);
+ $p->set_block("view","body");
//print_r($daily);
//echo "accountId - $accountId\n";
@@ -95,5 +96,6 @@
}
}
- $p->pfp('out','views');
+ $p->parse('events','views');
+ //$p->pfp('out','views');
}
else {
@@ -107,9 +109,13 @@
$p->set_var("start_date",$sday."/".$smonth."/".$syear);
$p->set_var("end_date", $eday."/".$emonth."/".$eyear);
- $p->pfp('out','no_event');
+ $p->parse('events','no_event');
+// $p->pfp('out','no_event');
}
+ $p->set_var("lang_schedule",lang("schedule"));
+ $p->pfp('out','body');
// Utiliza o novo header para a página principal.
print_header();
+
// Utiliza o novo footer.
print_footer();
Index: /trunk/mobile/setup/phpgw_pt-br.lang
===================================================================
--- /trunk/mobile/setup/phpgw_pt-br.lang (revision 524)
+++ /trunk/mobile/setup/phpgw_pt-br.lang (revision 588)
@@ -33,2 +33,18 @@
Start Date/Time mobile pt-br Data/Hora Início
End Date/Time mobile pt-br Data/Hora Término
+schedule mobile pt-br Agendar
+continue scheduling mobile pt-br Continuar o agendamento
+already_addeds: mobile pt-br Já adicionados:
+Start Date mobile pt-br Data(Início)
+End Date mobile pt-br Data(Término)
+Start Time mobile pt-br Hora(Início)
+End Time mobile pt-br Hora(Término)
+keep add participants mobile pt-br Adicionar participantes
+your suggested time of %1 - %2 conflicts with the following existing calendar entries: mobile pt-br Horário sugerido: %1 - %2 está em conflito com as seguintes entradas no calendário:
+scheduling conflict mobile pt-br Conflito de agendamento
+ignore conflict mobile pt-br Ignorar conflito
+re-edit event mobile pt-br Re-Editar evento
+username_mobile mobile pt-br Usuário
+password_mobile mobile pt-br Senha
+the search argument must have at least 4 digits mobile pt-br O argumento da busca deve possuir pelo menos 4 dígitos
+choose the participants mobile pt-br Escolha os participantes
Index: /trunk/mobile/inc/class.ui_mobilecalendar.inc.php
===================================================================
--- /trunk/mobile/inc/class.ui_mobilecalendar.inc.php (revision 588)
+++ /trunk/mobile/inc/class.ui_mobilecalendar.inc.php (revision 588)
@@ -0,0 +1,827 @@
+ true,
+ 'init_schedule' => true,
+ 'add_participants' => true,
+ 'add_participant' => true,
+ 'edit' => true,
+ 'update' =>true,
+ 'overlap' => true,
+ 'index' => true
+ );
+
+ function ui_mobilecalendar() {
+ $this->bo = CreateObject('calendar.bocalendar',1);
+ $this->cat = &$this->bo->cat;
+ $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+
+ $this->link_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+ $this->link_tpl->set_unknowns('remove');
+ $this->link_tpl->set_file(
+ Array(
+ 'link_picture' => 'link_pict.tpl'
+ )
+ );
+ $this->link_tpl->set_block('link_picture','link_pict','link_pict');
+ $this->link_tpl->set_block('link_picture','pict','pict');
+ $this->link_tpl->set_block('link_picture','link_open','link_open');
+ $this->link_tpl->set_block('link_picture','link_close','link_close');
+ $this->link_tpl->set_block('link_picture','link_text','link_text');
+ }
+
+ function index() {
+ $GLOBALS['phpgw']->redirect_link('calendar.php');
+ }
+
+ function page($_page='',$params='')
+ {
+ if($_page == '')
+ {
+ $page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']);
+ $_page = $page_[0];
+
+ if ($_page=='planner_cat' || $_page=='planner_user')
+ {
+ $_page = 'planner';
+ }
+ elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
+ {
+ $_page = 'month';
+ $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month');
+ $GLOBALS['phpgw']->preferences->save_repository();
+ }
+ }
+ if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' ||
+ strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ...
+ {
+ $page_app = 'calendar';
+ }
+ else
+ {
+ $page_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+ }
+ if (is_array($params))
+ {
+ $params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page;
+ }
+ else
+ {
+ $params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params;
+ }
+ return $GLOBALS['phpgw']->link('/index.php',$params);
+ }
+
+ function init_schedule() {
+ $_SESSION['mobile_calendar'] = NULL;
+ $this->add_participants();
+ }
+
+ function add_participants() {
+
+ $ui_cc = CreateObject('mobile.ui_mobilecc');
+ $ui_cc->contacts_list(true);
+ }
+
+ function add_participant() {
+
+ $participants = $_SESSION["mobile_calendar"];
+
+ if(!is_array($participants))
+ $participants = array();
+
+ $participants[$_GET['user']] = $_GET['cn'];
+
+ $_SESSION["mobile_calendar"] = $participants;
+
+ $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+ $p->set_file(Array('continue' => 'keep_add_participants.tpl'));
+ $p->set_block('continue','body');
+ $p->set_var('lang_add_participants',lang('keep add participants'));
+ $p->set_var('lang_continue',lang('continue scheduling'));
+ $p->pfp('out','body');
+ }
+
+ function add($cd=0,$readsess=0)
+ {
+ if(!$this->bo->check_perms(PHPGW_ACL_ADD))
+ {
+ $this->index();
+ }
+
+ if($readsess)
+ {
+ $event = $this->bo->restore_from_appsession;
+ if(!$event['owner'])
+ {
+ $this->bo->add_attribute('owner',$this->bo->owner);
+ }
+ $can_edit = True;
+ }
+ else
+ {
+ $this->bo->event_init();
+ $this->bo->add_attribute('id',0);
+
+ $can_edit = True;
+ $participants = (string)(get_var('participants',array('GET'),FALSE));
+ $starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts']));
+ $startmin = (int)(get_var('minute',array('GET'),0));
+ $endmin = $startmin + (int)$this->bo->prefs['calendar']['defaultlength'];
+ $endhour = $starthour + $this->bo->normalizeminutes($endmin);
+
+ $subject = (string)(get_var('title',array('GET'),0));
+ if ($subject != '0')
+ {
+ $description = (string)(get_var('description',array('GET'),0));
+ $location = (string)(get_var('location',array('GET'),0));
+ }
+ else
+ unset($subject);
+
+ $this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
+ $this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
+ $this->bo->set_title($subject);
+ $this->bo->set_description($description);
+ $this->bo->add_attribute('location',$location);
+ $this->bo->set_ex_participants('');
+ $this->bo->add_attribute('uid','');
+ $this->bo->add_attribute('priority',2);
+ if(@$this->bo->prefs['calendar']['default_private'])
+ {
+ $this->bo->set_class(False);
+ }
+ else
+ {
+ $this->bo->set_class(True);
+ }
+
+ $this->bo->add_attribute('participants','A',$this->bo->owner);
+ $this->bo->set_recur_none();
+ $event = $this->bo->get_cached_event();
+
+ }
+ $this->edit_form(
+ Array(
+ 'event' => $event,
+ 'cd' => $cd
+ )
+ );
+ //$GLOBALS['phpgw']->common->phpgw_footer();
+ }
+
+ function edit($params='')
+ {
+ if($this->debug)
+ {
+ echo ''."\n";
+ echo ''."\n";
+ }
+
+ if(isset($_GET['readsess']))
+ {
+ $params['readsess'] = $_GET['readsess'];
+ $params['cd'] = 0;
+ }
+
+ if($this->debug)
+ {
+ echo ''."\n";
+ echo ''."\n";
+ }
+
+ if($params != '' && @is_array($params) && @isset($params['readsess']))
+ {
+ $can_edit = True;
+ $this->edit_form(
+ Array(
+ 'event' => $this->bo->restore_from_appsession(),
+ 'cd' => $params['cd']
+ )
+ );
+ }
+ elseif(isset($_GET['cal_id']))
+ {
+ $cal_id = (int)$_GET['cal_id'];
+ $event = $this->bo->read_entry($cal_id);
+
+ if(!$this->bo->check_perms(PHPGW_ACL_EDIT,$event))
+ {
+ Header('Location: '.$this->page('view','&cal_id='.$cal_id));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ if(@isset($_POST['edit_type']) && $_POST['edit_type'] == 'single')
+ {
+ $event['id'] = 0;
+ $this->bo->set_recur_date($event,$_POST['date']);
+ $event['recur_type'] = MCAL_RECUR_NONE;
+ $event['recur_interval'] = 0;
+ $event['recur_data'] = 0;
+ $event['recur_enddate']['month'] = 0;
+ $event['recur_enddate']['mday'] = 0;
+ $event['recur_enddate']['year'] = 0;
+ $event['recur_exception'] = array();
+ }
+ $this->edit_form(
+ Array(
+ 'event' => $event,
+ 'cd' => $cd
+ )
+ );
+ }
+ }
+
+ function update() {
+ $params = array();
+ $params['from_mobile'] = true;
+ $this->bo->update($params);
+ }
+
+ function edit_form($param)
+ {
+ if(!is_array($param))
+ {
+ $this->index();
+ }
+
+ if(isset($param['event']))
+ {
+ $event = $param['event'];
+ }
+
+ $hourformat = substr($this->bo->users_timeformat,0,1);
+
+ // $sb = CreateObject('phpgwapi.sbox');
+ $sb = CreateObject('phpgwapi.sbox2');
+ $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!!
+
+ unset($GLOBALS['phpgw_info']['flags']['noheader']);
+ unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+ $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+ $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+ $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding event');
+ //$GLOBALS['phpgw']->common->phpgw_header();
+
+ $p = &$GLOBALS['phpgw']->template;
+ $p->set_file(
+ Array(
+ 'edit' => 'edit.tpl',
+ 'form_button' => 'form_button_script.tpl'
+ )
+ );
+ $p->set_block('edit','edit_entry','edit_entry');
+ $p->set_block('edit','list','list');
+ $p->set_block('edit','hr','hr');
+
+ $vars = Array(
+ 'font' => $this->theme['font'],
+ 'bg_color' => $this->theme['bg_text'],
+ 'action_url' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update')),
+ 'accounts_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'),
+ 'common_hidden' => ''."\n"
+ . ''."\n"
+ . ''."\n"
+ . ($_GET['cal_id'] && $event['id'] == 0?''."\n":
+ (@isset($event['reference'])?''."\n":''))
+ . (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
+ ''."\n":''),
+ 'errormsg' => ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):''),
+ 'row_owner' => ''
+ );
+
+ $p->set_var($vars);
+
+// Brief Description
+ $var['title'] = Array(
+ 'tr_color' => $this->theme['th_bg'],
+ 'field' => lang('Title'),
+ 'data' => ''
+ );
+
+// Location
+ $var['location'] = Array(
+ 'field' => lang('Location'),
+ 'data' => ''
+ );
+
+// Date
+
+ $start = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+ $var['startdate'] = Array(
+ 'field' => lang('Start Date'),
+
+ 'data' => $GLOBALS['phpgw']->common->dateformatorder(
+ $sb->getYears('start[year]',(int)$GLOBALS['phpgw']->common->show_date($start,'Y')),
+ $sb->getMonths('start[month]',(int)$GLOBALS['phpgw']->common->show_date($start,'n')),
+ $sb->getDays('start[mday]',(int)$GLOBALS['phpgw']->common->show_date($start,'d')),
+ true
+ )
+
+// 'data' => $jscal->input('start[str]',$start)
+ );
+
+// Time
+ if ($this->bo->prefs['common']['timeformat'] == '12')
+ {
+ $str .= '= 12?'':' checked').'>am'."\n"
+ . '= 12?' checked':'').'>pm'."\n";
+ }
+ $var['starttime'] = Array(
+ 'field' => lang('Start Time'),
+ 'data' => ':'."\n".$str
+ );
+
+// End Date
+ $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+ $var['enddate'] = Array(
+ 'field' => lang('End Date'),
+
+ 'data' => $GLOBALS['phpgw']->common->dateformatorder(
+ $sb->getYears('end[year]',(int)$GLOBALS['phpgw']->common->show_date($end,'Y')),
+ $sb->getMonths('end[month]',(int)$GLOBALS['phpgw']->common->show_date($end,'n')),
+ $sb->getDays('end[mday]',(int)$GLOBALS['phpgw']->common->show_date($end,'d')),true
+ )
+
+// 'data' => $jscal->input('end[str]',$end)
+ );
+
+// End Time
+ if ($this->bo->prefs['common']['timeformat'] == '12')
+ {
+ $str = '= 12?'':' checked').'>am'."\n"
+ . '= 12?' checked':'').'>pm'."\n";
+ }
+ $var['endtime'] = Array(
+ 'field' => lang('End Time'),
+ 'data' => ':'."\n".$str
+ );
+
+
+ $participants = $_SESSION['mobile_calendar'];
+ $str = " ";
+ foreach($participants as $id => $nome) {
+ $str.="";
+ }
+
+
+ $var['participants'] = array
+ (
+ 'field' => lang('Participants'),
+ 'data' => "
+
+
+ "
+ );
+
+
+ /*$var['owner'] = Array(
+ 'field' => $GLOBALS['phpgw']->common->grab_owner_name($event['owner']).' '.lang('Participates'),
+ 'data' => ''
+ );*/
+
+
+ if (!isset($this->fields))
+ {
+ $this->custom_fields = CreateObject('calendar.bocustom_fields');
+ $this->fields = &$this->custom_fields->fields;
+ $this->stock_fields = &$this->custom_fields->stock_fields;
+ }
+ $preserved = False;
+ foreach($this->fields as $field => $data)
+ {
+ /*if($field=='owner')
+ $p->set_var('display',"visibility:hidden");
+ else
+ $p->set_var('display'," ");*/
+ if (!$data['disabled'])
+ {
+ if (isset($var[$field]))
+ {
+ switch($field)
+ {
+ case 'startdate':
+ $this->output_template_array($p,'row','list',$var['startdate']);
+ $this->output_template_array($p,'row','list',$var['starttime']);
+ break;
+ case 'enddate':
+ $this->output_template_array($p,'row','list',$var['enddate']);
+ $this->output_template_array($p,'row','list',$var['endtime']);
+ break;
+ default:
+ $this->output_template_array($p,'row','list',$var[$field]);
+ }
+ }
+ elseif (!isset($this->stock_fields[$field])) // Custom field
+ {
+ $lang = lang($name = substr($field,1));
+ $size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)).
+ ' MAXLENGTH='.($data['length'] ? $data['length'] : 255);
+ $v = array(
+ 'field' => $lang == $name.'*' ? $name : $lang,
+ 'data' => ''
+ );
+ if ($data['title'])
+ {
+ $v['tr_color'] = $this->theme['th_bg'];
+ }
+ if (!$data['length'] && $data['title'])
+ {
+ $p->set_var('tr_color',$this->theme['th_bg']);
+ $p->set_var('hr_text','
'.$v['field'].'');
+ $p->parse('row','hr',True);
+ }
+ else
+ {
+ $this->output_template_array($p,'row','list',$v);
+ }
+ }
+ }
+ else // preserve disabled fields
+ {
+ switch ($field)
+ {
+ case 'owner':
+ $preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A';
+ break;
+ case 'recure_type':
+ foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field)
+ {
+ $preserved[$field] = $event[$field];
+ }
+ break;
+ case 'startdate':
+ case 'enddate':
+ $field = substr($field,0,-4);
+ default:
+ $preserved[$field] = $event[$field];
+ }
+ }
+ }
+ unset($var);
+ if (is_array($preserved))
+ {
+ //echo "preserving"; print_r($preserved); echo "
\n";
+ $p->set_var('common_hidden',$p->get_var('common_hidden').''."\n");
+ }
+ $p->set_var('submit_button',lang('Save'));
+
+
+
+ $delete_button = $cancel_button = '';
+ if ($event['id'] > 0)
+ {
+ $var = Array(
+ 'action_url_button' => $this->page('delete','&cal_id='.$event['id']),
+ 'action_text_button' => lang('Delete'),
+ 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
+ 'action_extra_field' => ''
+ );
+ $p->set_var($var);
+ $delete_button = $p->fp('out','form_button');
+ }
+ $p->set_var('delete_button',$delete_button);
+
+ if ($this->bo->return_to)
+ {
+ $var = Array(
+ 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
+ 'action_text_button' => lang('Cancel'),
+ 'action_confirm_button' => '',
+ 'action_extra_field' => ''
+ );
+ $p->set_var($var);
+ $cancel_button = $p->fp('out','form_button');
+ }
+
+ $p->set_var('lang_add_participants',lang("keep add participants"));
+
+ $p->set_var('cancel_button',$cancel_button);
+ $p->pparse('out','edit_entry');
+
+ }
+
+ function get_organizations($context, $selected='', $recursive = false)
+ {
+ $s = CreateObject('phpgwapi.sector_search_ldap');
+
+ return ($recursive ?
+ $s->get_organizations($context, $selected, false ,false) :
+ $s->get_sectors($selected, false, false));
+ }
+
+ function output_template_array(&$p,$row,$list,$var)
+ {
+ if (!isset($var['hidden_vars']))
+ {
+ $var['hidden_vars'] = '';
+ }
+ if (!isset($var['tr_color']))
+ {
+ $var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color();
+ }
+ $p->set_var($var);
+ $p->parse($row,$list,True);
+ }
+
+ function overlap($params) {
+ ini_set("display_errors","1");
+ if(!is_array($params))
+ {
+ }
+ else
+ {
+ $overlapping_events = $params['o_events'];
+ $event = $params['this_event'];
+ }
+
+ $month = $event['start']['month'];
+ $mday = $event['start']['mday'];
+ $year = $event['start']['year'];
+
+ $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
+ $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+ $overlap = '';
+ for($i=0;$ibo->read_entry($overlapping_events[$i],True);
+ $overlap .= ''.$this->link_to_entry($overlapped_event,$month,$mday,$year);
+ $overlap .= '';
+ foreach($overlapped_event['participants'] as $id => $status)
+ {
+ $conflict = isset($event['participants'][$id]);
+ $overlap .= '- '.($conflict?'':'').
+ $GLOBALS['phpgw']->common->grab_owner_name($id).
+ ($conflict?' - '.lang('Scheduling conflict'):'')."
\n";
+ }
+ $overlap .= "
\n";
+ }
+
+ unset($GLOBALS['phpgw_info']['flags']['noheader']);
+ unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+ $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+ $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+ $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict');
+ //$GLOBALS['phpgw']->common->phpgw_header();
+
+ $p = $GLOBALS['phpgw']->template;
+ $p->set_file(
+ Array(
+ 'overlap' => 'overlap.tpl',
+ 'form_button' => 'form_button_script.tpl'
+ )
+ );
+
+ $var = Array(
+ 'color' => $this->theme['bg_text'],
+ 'overlap_title' => lang('Scheduling Conflict'),
+ 'overlap_text' => lang('Your suggested time of %1 - %2 conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)),
+ 'overlap_list' => $overlap
+ );
+ $p->set_var($var);
+
+ $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday);
+ $var = Array(
+ 'action_url_button' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update','readsess'=>1)),
+ 'action_text_button' => lang('Ignore Conflict'),
+ 'action_confirm_button' => '',
+ 'action_extra_field' => ''
+ );
+ $this->output_template_array($p,'resubmit_button','form_button',$var);
+
+ $var = Array(
+ 'action_url_button' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.edit','readsess'=>1,'date'=>$date)),
+ 'action_text_button' => lang('Re-Edit Event'),
+ 'action_confirm_button' => '',
+ 'action_extra_field' => ''
+ );
+ $this->output_template_array($p,'reedit_button','form_button',$var);
+ $p->pparse('out','overlap');
+ }
+
+ function link_to_entry($event,$month,$day,$year)
+ {
+ $str = '';
+ $is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event);
+ $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event);
+
+ $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+ $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+ $rawdate = mktime(0,0,0,$month,$day,$year);
+ $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset;
+ $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
+ if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime)
+ {
+ $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+ }
+ elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60)
+ {
+ $time = '[ '.lang('All Day').' ]';
+ }
+ elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime)
+ {
+ if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE)
+ {
+ $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat);
+ }
+ else
+ {
+ $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+ }
+
+ if($endtime >= ($rawdate_offset + 86400))
+ {
+ $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat);
+ }
+ else
+ {
+ $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat);
+ }
+ $time = $start_time.'-'.$end_time;
+ }
+ else
+ {
+ $time = '';
+ }
+
+ $texttitle = $texttime = $textdesc = $textlocation = $textstatus = '';
+
+
+
+ if(!$is_private)
+ {
+ //$text .= $this->bo->display_status($event['users_status']);
+
+ // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation
+ $textstatus=$this->bo->display_status($event['users_status']);
+
+ }
+
+ /*
+ $text = ' '.$time.' '.$this->bo->get_short_field($event,$is_private,'title').$text.
+ (!$is_private && $event['description'] ? ': '.$this->bo->get_short_field($event,$is_private,'description').'':'').
+ $GLOBALS['phpgw']->browser->br;
+ */
+
+ $texttime=$time;
+ $texttitle=$this->bo->get_short_field($event,$is_private,'title');
+ $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):'');
+ // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set
+ $textlocation=$this->bo->get_short_field($event,$is_private,'location');
+
+ if ($viewable)
+ {
+ $date = sprintf('%04d%02d%02d',$year,$month,$day);
+ $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date));
+ $this->link_tpl->set_var('lang_view',lang('View this entry'));
+ $this->link_tpl->set_var('desc', $textdesc);
+ $this->link_tpl->set_var('location', $textlocation);
+ $this->link_tpl->parse('picture','link_open',True);
+ }
+ if (!$is_private)
+ {
+ if($event['priority'] == 3)
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','high'),
+ 'width' => 16,
+ 'height'=> 16,
+ 'title' => lang('high priority')
+ );
+ }
+ if($event['recur_type'] == MCAL_RECUR_NONE)
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle'),
+ 'width' => 9,
+ 'height'=> 9,
+ 'title' => lang('single event')
+ );
+ }
+ else
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur'),
+ 'width' => 12,
+ 'height'=> 12,
+ 'title' => lang('recurring event')
+ );
+ }
+ }
+ $participants = $this->planner_participants($event['participants']);
+ if(count($event['participants']) > 1)
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','multi_3'),
+ 'width' => 14,
+ 'height'=> 14,
+ 'title' => $participants
+ );
+ }
+ else
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','single'),
+ 'width' => 14,
+ 'height'=> 14,
+ 'title' => $participants
+ );
+ }
+ if($event['public'] == 0)
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','private'),
+ 'width' => 13,
+ 'height'=> 13,
+ 'title' => lang('private')
+ );
+ }
+ if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private)
+ {
+ // if the alarm is to go off the day before the event
+ // the icon does not show up because of 'alarm_today'
+ // - TOM
+ if($this->bo->alarm_today($event,$rawdate_offset,$starttime))
+ {
+ $picture[] = Array(
+ 'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'),
+ 'width' => 13,
+ 'height'=> 13,
+ 'title' => lang('alarm')
+ );
+ }
+ }
+
+ $description = $this->bo->get_short_field($event,$is_private,'description');
+ for($i=0;$i $picture[$i]['pict'],
+ 'width' => $picture[$i]['width'],
+ 'height' => $picture[$i]['height'],
+ 'title' => $picture[$i]['title']
+ );
+ $this->output_template_array($this->link_tpl,'picture','pict',$var);
+ }
+ if ($texttitle)
+ {
+ $var = Array(
+ // 'text' => $text,
+ 'time'=> $texttime,
+ 'title'=> $texttitle,
+ 'users_status'=>$textstatus,
+ 'desc'=> $textdesc,
+ 'location'=> "
Local: ".$textlocation
+ );
+ $this->output_template_array($this->link_tpl,'picture','link_text',$var);
+ }
+
+ if ($viewable)
+ {
+ $this->link_tpl->parse('picture','link_close',True);
+ }
+ $str = $this->link_tpl->fp('out','link_pict');
+ $this->link_tpl->set_var('picture','');
+ $this->link_tpl->set_var('out','');
+// unset($p);
+ return $str;
+ }
+
+
+ function planner_participants($parts)
+ {
+ static $id2lid;
+
+ $names = '';
+ while (list($id,$status) = each($parts))
+ {
+ $status = substr($this->bo->get_long_status($status),0,1);
+
+ if (!isset($id2lid[$id]))
+ {
+ $id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id);
+ }
+ if (strlen($names))
+ {
+ $names .= ",\n";
+ }
+ $names .= $id2lid[$id]." ($status)";
+ }
+ if($this->debug)
+ {
+ echo ''."\n";
+ }
+ return $names;
+ }
+
+
+ }
+
+
+
+?>
Index: /trunk/mobile/inc/class.mobilemail.inc.php
===================================================================
--- /trunk/mobile/inc/class.mobilemail.inc.php (revision 534)
+++ /trunk/mobile/inc/class.mobilemail.inc.php (revision 588)
@@ -344,5 +344,4 @@
$messages = $this->imap_functions->get_range_msgs2($params);
-
$this->print_mails_list($messages);
$this->print_page_navigation($this->pages, $this->current_page);
Index: /trunk/mobile/inc/class.ui_mobilecc.inc.php
===================================================================
--- /trunk/mobile/inc/class.ui_mobilecc.inc.php (revision 546)
+++ /trunk/mobile/inc/class.ui_mobilecc.inc.php (revision 588)
@@ -129,5 +129,5 @@
*/
- function contacts_list() {
+ function contacts_list($from_calendar=false) {
$entries = array();
@@ -163,5 +163,5 @@
else { //Só pego os dados completos caso haja resultado na busca
if($this->page_info['actual_catalog']!="bo_group_manager") { //Se não for grupo, tenho que ordenar as connections
- $entries = $this->bo->get_multiple_entries($ids,array("names_ordered"=>true,"id_contact"=>true,"connections"=>true));
+ $entries = $this->bo->get_multiple_entries($ids,array("names_ordered"=>true,"uidnumber"=>true,"id_contact"=>true,"connections"=>true));
/**
* As entradas vindas de get_multiple_entries não vem com as connections
@@ -187,9 +187,14 @@
$entries = $this->bo->get_multiple_entries($ids,array("id_group"=>true,"title"=>true,"short_name"=>true));
}
+
}
///////////////// Monto os dados gerais da página no template.
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
- $p->set_file(Array('entries' => 'cc_main.tpl'));
+
+ if(!$from_calendar)
+ $p->set_file(Array('entries' => 'cc_main.tpl'));
+ else
+ $p->set_file(Array('entries' => 'add_participants.tpl'));
$p->set_block('entries','body');
@@ -202,4 +207,5 @@
$p->set_block('entries','page');
$p->set_block('entries','page_no_link');
+ $p->set_block('entries','row_addeds');
@@ -211,4 +217,9 @@
$p->set_var($texts);
+ $p->set_var('lang_already_addeds:',lang('already_addeds:'));
+
+ if($from_calendar)
+ $p->set_var('lang_continue_scheduling',lang('continue scheduling'));
+
/////////// Preenche o combo de catálogos
@@ -216,16 +227,17 @@
$branchs = $bo_cc->get_catalog_tree();
+ if(!$from_calendar) {
+ foreach($branchs as $branch) { //Pego apenas a estrutura dos ramos vindos do banco, pois as do ldap estão confusas e com dados aparentemente inconsistentes.
+ if($branch['class']!="bo_global_ldap_catalog" && $branch['class']!="bo_catalog_group_catalog") {
+ $p->set_var(array('option_value'=>$branch['class'],'option_text'=>$branch['name']));
- foreach($branchs as $branch) { //Pego apenas a estrutura dos ramos vindos do banco, pois as do ldap estão confusas e com dados aparentemente inconsistentes.
- if($branch['class']!="bo_global_ldap_catalog" && $branch['class']!="bo_catalog_group_catalog") {
- $p->set_var(array('option_value'=>$branch['class'],'option_text'=>$branch['name']));
-
- if($this->page_info['actual_catalog']==$branch['class'])
- $p->set_var('selected','selected');
- else
- $p->set_var('selected','');
- $p->parse('options','option',True);
- }
-
+ if($this->page_info['actual_catalog']==$branch['class'])
+ $p->set_var('selected','selected');
+ else
+ $p->set_var('selected','');
+ $p->parse('options','option',True);
+ }
+
+ }
}
@@ -248,18 +260,20 @@
}
- $branchs = $bo_ldap_manager->get_external_ldap_sources();
-
- foreach($branchs as $id=>$branch) { //Ldaps externos
- $p->set_var(array('option_value'=>"bo_global_ldap_catalog#".
- $id."#".
- $branch['dn']."#".
- 1,
- 'option_text'=>$branch['name'])); //No value eu passo também o id, o contexto e se é externo, quando é um ldap
-
- if($this->page_info['actual_catalog']=="bo_global_ldap_catalog#".$id."#".$branch['dn']."#". 1)
- $p->set_var('selected','selected');
- else
- $p->set_var('selected','');
- $p->parse('options','option',True);
+ if(!$from_calendar) {
+ $branchs = $bo_ldap_manager->get_external_ldap_sources();
+
+ foreach($branchs as $id=>$branch) { //Ldaps externos
+ $p->set_var(array('option_value'=>"bo_global_ldap_catalog#".
+ $id."#".
+ $branch['dn']."#".
+ 1,
+ 'option_text'=>$branch['name'])); //No value eu passo também o id, o contexto e se é externo, quando é um ldap
+
+ if($this->page_info['actual_catalog']=="bo_global_ldap_catalog#".$id."#".$branch['dn']."#". 1)
+ $p->set_var('selected','selected');
+ else
+ $p->set_var('selected','');
+ $p->parse('options','option',True);
+ }
}
@@ -296,7 +310,7 @@
$p->parse('header','group_header',True);
}
-
+
/////////// Preencho as linhas do resultado
- foreach($entries as $entry) {
+ foreach($entries as $id => $entry) {
$this->nextmatchs->template_alternate_row_color($p);
if(($this->page_info['actual_catalog']!="bo_group_manager") &&
@@ -352,8 +366,28 @@
$var['row_telefone'] = $conn1['connection_value'];
}
- $var['form_action'] = "index.php?menuaction=mobile.mobilemail.new_msg";
+ if(!$from_calendar)
+ $var['form_action'] = "index.php?menuaction=mobile.mobilemail.new_msg";
+ else {
+ $var['id_contact'] = $entry['uidnumber'][0].'U';
+ $var['form_action'] = "index.php?menuaction=mobile.ui_mobilecalendar.add_participant";
+ }
+ $var['lang_select'] = lang("select");
$p->set_var($var);
$p->parse('rows','row',True);
}
+ }
+ }
+
+ if($from_calendar) {
+ $p->set_var('lang_choose_the_participants',lang("choose the participants"));
+ $participants = $_SESSION['mobile_calendar'];
+ reset($participants);
+ while (($participant = current($participants))!==false) {
+ $p->set_var('row_contact_name',$participant);
+ if(next($participants)!==false)
+ $p->set_var('row_separate',',');
+ else
+ $p->set_var('row_separate','.');
+ $p->parse('rows_addeds','row_addeds',True);
}
}
Index: /trunk/mobile/login.php
===================================================================
--- /trunk/mobile/login.php (revision 454)
+++ /trunk/mobile/login.php (revision 588)
@@ -111,7 +111,12 @@
$tmpl->set_var('charset',$GLOBALS['phpgw']->translation->charset());
$tmpl->set_var('cookie',$last_loginid);
- $tmpl->set_var('lang_username',lang('username'));
+ /*$tmpl->set_var('lang_username',lang('username'));
$tmpl->set_var('lang_password',lang('password'));
- $tmpl->set_var('lang_login',lang('login'));
+ $tmpl->set_var('lang_login',lang('login'));*/
+ //a função lang não funciona no login em dispositivos móveis... verificar o motivo...
+ $tmpl->set_var('lang_username',"Usuário");
+ $tmpl->set_var('lang_password',"Senha");
+ $tmpl->set_var('lang_login',"Login");
+
$tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']);
$tmpl->set_var('template_set',$GLOBALS['phpgw_info']['login_template_set']);
Index: /trunk/mobile/templates/default/form_button_script.tpl
===================================================================
--- /trunk/mobile/templates/default/form_button_script.tpl (revision 588)
+++ /trunk/mobile/templates/default/form_button_script.tpl (revision 588)
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
Index: /trunk/mobile/templates/default/edit.tpl
===================================================================
--- /trunk/mobile/templates/default/edit.tpl (revision 588)
+++ /trunk/mobile/templates/default/edit.tpl (revision 588)
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+{lang_add_participants}
+
+
+
+
+ {field}: |
+ {data} |
+
+
+
+
+
+ {hr_text}
+ |
+
+
Index: /trunk/mobile/templates/default/login.tpl
===================================================================
--- /trunk/mobile/templates/default/login.tpl (revision 454)
+++ /trunk/mobile/templates/default/login.tpl (revision 588)
@@ -27,5 +27,5 @@
- |
+ |
Index: /trunk/mobile/templates/default/overlap.tpl
===================================================================
--- /trunk/mobile/templates/default/overlap.tpl (revision 588)
+++ /trunk/mobile/templates/default/overlap.tpl (revision 588)
@@ -0,0 +1,30 @@
+
+
+
+
+
+ {overlap_text}
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ {resubmit_button}
+ |
+
+ {reedit_button}
+ |
+
+
+ |
+
+
+
+
Index: /trunk/mobile/templates/default/add_participants.tpl
===================================================================
--- /trunk/mobile/templates/default/add_participants.tpl (revision 588)
+++ /trunk/mobile/templates/default/add_participants.tpl (revision 588)
@@ -0,0 +1,105 @@
+
+
+
+
+ {header}
+
+ {rows}
+
+
+
+
+ {back} {pages}{next}
+ |
+
+
+
+
+
+
+
+
+
+{lang_already_addeds:} {rows_addeds}
+
+
+
+
+ | {lang_people_name} |
+ |
+
+
+
+
+
+
+
+
+
+ {row_group_name} |
+ {row_title} |
+
+
+
+
+
+ {message} |
+
+
+
+
+
+
+
+
+
+ {display_page}
+
+
+
+ {num_page}
+
+
+
+ {row_contact_name}{row_separate}
+
Index: /trunk/mobile/templates/default/calendar.tpl
===================================================================
--- /trunk/mobile/templates/default/calendar.tpl (revision 524)
+++ /trunk/mobile/templates/default/calendar.tpl (revision 588)
@@ -1,22 +1,29 @@
+
+{events}
+
+{lang_schedule}
+
+
+
-{header_date}
-
-
+{header_date}
+
+
{title_field}: |
{title_data} |
-
+
{location_field}: |
{location_data} |
-
+
{startdate_field}: |
{startdate_data} |
-
+
{enddate_field}: |
{enddate_data} |
-
+
{description_field}: |
{description_data} |
Index: /trunk/mobile/templates/default/link_pict.tpl
===================================================================
--- /trunk/mobile/templates/default/link_pict.tpl (revision 588)
+++ /trunk/mobile/templates/default/link_pict.tpl (revision 588)
@@ -0,0 +1,25 @@
+
+
+{picture}
+
+
+
+
+
Index: /trunk/mobile/templates/default/keep_add_participants.tpl
===================================================================
--- /trunk/mobile/templates/default/keep_add_participants.tpl (revision 588)
+++ /trunk/mobile/templates/default/keep_add_participants.tpl (revision 588)
@@ -0,0 +1,22 @@
+
+
+
Index: /trunk/calendar/inc/class.bocalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.bocalendar.inc.php (revision 583)
+++ /trunk/calendar/inc/class.bocalendar.inc.php (revision 588)
@@ -758,4 +758,16 @@
function update($params='')
{
+
+ if($params['from_mobile']) {
+ $ui_return = "mobile.ui_mobilecalendar.edit";
+ $ui_index = "mobile.ui_mobilecalendar.index";
+ $ui_overlap = "mobile.ui_mobilecalendar.overlap";
+ }
+ else {
+ $ui_return = "calendar.uicalendar.edit";
+ $ui_index = "calendar.uicalendar.index";
+ $ui_overlap = "calendar.uicalendar.overlap";
+ }
+
if(!is_object($GLOBALS['phpgw']->datetime))
{
@@ -769,4 +781,5 @@
$l_end = (@isset($params['end']) && $params['end']?$params['end']:$_POST['end']);
$l_recur_enddate = (@isset($params['recur_enddate']) && $params['recur_enddate']?$params['recur_enddate']:$_POST['recur_enddate']);
+
$send_to_ui = True;
@@ -837,5 +850,5 @@
if($datetime_check)
{
- ExecMethod('calendar.uicalendar.edit',
+ ExecMethod($ui_return,
Array(
'cd' => $datetime_check,
@@ -843,5 +856,8 @@
)
);
- $GLOBALS['phpgw']->common->phpgw_exit(True);
+ if(!$params['from_mobile'])
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ else
+ return;
}
$overlapping_events = False;
@@ -860,6 +876,9 @@
return array(($l_cal['id']?1:2) => 'permission denied');
}
- ExecMethod('calendar.uicalendar.index');
- $GLOBALS['phpgw']->common->phpgw_exit();
+ ExecMethod($ui_index);
+ if(!$params['from_mobile'])
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ else
+ return;
}
@@ -1141,5 +1160,5 @@
return array($datetime_check => 'invalid input data');
}
- ExecMethod('calendar.uicalendar.edit',
+ ExecMethod($ui_return,
Array(
'cd' => $datetime_check,
@@ -1147,5 +1166,8 @@
)
);
- $GLOBALS['phpgw']->common->phpgw_exit(True);
+ if(!$params['from_mobile'])
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ else
+ return;
}
@@ -1176,5 +1198,5 @@
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
- ExecMethod('calendar.uicalendar.overlap',
+ ExecMethod($ui_overlap,
Array(
'o_events' => $overlapping_events,
@@ -1182,5 +1204,8 @@
)
);
- $GLOBALS['phpgw']->common->phpgw_exit(True);
+ if(!$params['from_mobile'])
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ else
+ return;
}
else
@@ -1229,5 +1254,5 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
- Execmethod('calendar.uicalendar.index');
+ Execmethod($ui_index);
}
else