Changeset 1849
- Timestamp:
- 12/16/09 11:18:41 (14 years ago)
- Location:
- trunk/calendar/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/inc/class.bocalendar.inc.php
r1720 r1849 1504 1504 return False; 1505 1505 } 1506 1507 function participants_unanswered($participants,$event) 1508 { 1509 foreach($participants as $uid => $status) 1510 { 1511 if (isset($event['participants'][$uid]) && $event['participants'][$uid] == 'U' && $status == 'U') 1512 { 1513 return False; 1514 } 1515 } 1516 return True; 1517 } 1506 1518 1507 1519 function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False) … … 1613 1625 $temp_start_time >= $temp_event_start && 1614 1626 $temp_end_time <= $temp_event_end) && 1615 $this->participants_not_rejected($participants,$event) )1627 $this->participants_not_rejected($participants,$event) && $this->participants_unanswered($participants,$event)) 1616 1628 { 1617 1629 if($this->debug) … … 3088 3100 </form>"; 3089 3101 $lang2 = lang("To accept"); 3090 $varbuttom1 ="<input type='submit' value='$lang2' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=calendar.uicalendar.set_action&cal_id=$event[id]&action=3&response=1 \",\"frontpage\",\"height=100,width=400,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>";3102 $varbuttom1 ="<input type='submit' value='$lang2' onClick='javascript:window.open(\"".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=calendar.uicalendar.set_action&cal_id=$event[id]&action=3&response=1&user_id=$userid\",\"frontpage\",\"height=200,width=450,statusbar=no,toolbar=no,scrollbars=no,menubar=no,left=300,top=200\")'>"; 3091 3103 3092 3104 $lang3 = lang("To reject"); -
trunk/calendar/inc/class.uicalendar.inc.php
r1720 r1849 1916 1916 $tmpbody1 = $body1->pfp('out','list'); 1917 1917 } 1918 1919 function confirm_conflict($user_id,$event,$overlapping_events) 1920 { 1921 if(!$overlapping_events){ 1922 $notify_message = lang('Este evento entra em conflito com outro que você participa.'); 1923 1924 $action_ignore = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'response' => 1,'user_id' => $user_id, 'ignore_conflict' => 1)); 1925 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0)); 1926 1927 $body1 = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 1928 $body1->set_file(Array('calendar' => 'conflict.tpl')); 1929 $body1->set_block('calendar','list'); 1930 $var = Array( 'notify_message' => $notify_message, 1931 'action_url' => $action_url, 1932 'ignore_conflict' => 'Ignorar Conflito', 1933 'reject_event' => 'Rejeitar Evento', 1934 'action_reject' => $action_reject, 1935 'action_ignore' => $action_ignore); 1936 $body1->set_var($var); 1937 $tmpbody1 = $body1->pfp('out','list'); 1938 } 1939 else 1940 { 1941 $month = $event['start']['month']; 1942 $mday = $event['start']['mday']; 1943 $year = $event['start']['year']; 1944 1945 $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset; 1946 $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; 1947 1948 $overlap = ''; 1949 for($i=0;$i<count($overlapping_events);$i++) 1950 { 1951 $overlapped_event = $this->bo->read_entry($overlapping_events[$i],True); 1952 foreach($overlapped_event['participants'] as $id => $status) 1953 { 1954 $conflict = isset($event['participants'][$user_id]); 1955 $overlap .= '<li>'.($conflict?'<b>':''). 1956 $GLOBALS['phpgw']->common->grab_owner_name($id). 1957 ($conflict?'</b> - '.lang('Scheduling conflict'):'')."</li>"; 1958 } 1959 if ($this->bo->prefs['calendar']['hide_event_conflict']) 1960 $overlap .= '<ul><font size="1"><span>'. 1961 $this->normDec($overlapped_event['start']['hour']).":". 1962 $this->normDec($overlapped_event['start']['min'])."-". 1963 $this->normDec($overlapped_event['end']['hour']).":". 1964 $this->normDec($overlapped_event['end']['min']). 1965 '<br><b>'.lang('title').": ".lang("Hidden"). 1966 '</b><br>'.lang('description').": ".lang("Hidden").'<br></span></ul><br>'; 1967 else 1968 $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year)."</ul><br>"; 1969 } 1970 1971 unset($GLOBALS['phpgw_info']['flags']['noheader']); 1972 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 1973 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 1974 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 1975 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict'); 1976 $GLOBALS['phpgw']->common->phpgw_header(); 1977 1978 $p = $GLOBALS['phpgw']->template; 1979 $p->set_file( 1980 Array( 1981 'overlap' => 'overlap.tpl', 1982 'form_button' => 'form_button_script.tpl' 1983 ) 1984 ); 1985 1986 $var = Array( 1987 'color' => $this->theme['bg_text'], 1988 'overlap_title' => lang('Scheduling Conflict'), 1989 'overlap_text' => lang('Your suggested time of <B> %1 - %2 </B> conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)), 1990 'overlap_list' => $overlap 1991 ); 1992 $p->set_var($var); 1993 1994 $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); 1995 $var = Array( 1996 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'user_id' => $user_id, 'ignore_conflict' => 1)), 1997 'action_text_button' => lang('Ignore Conflict'), 1998 'action_confirm_button' => '', 1999 'action_extra_field' => '', 2000 'button_id' => 'ignore_button' 2001 ); 2002 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0)); 2003 2004 $this->output_template_array($p,'resubmit_button','form_button',$var); 2005 2006 $var = Array( 2007 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0)), 2008 'action_text_button' => lang('Reject'), 2009 'action_confirm_button' => '', 2010 'action_extra_field' => '', 2011 'button_id' => 'redit_button' 2012 ); 2013 $this->output_template_array($p,'reedit_button','form_button',$var); 2014 $p->pparse('out','overlap'); 2015 } 2016 } 2017 1918 2018 function set_action() 1919 2019 { … … 1924 2024 } 1925 2025 1926 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 2026 $overlapping_events = false; 2027 $event = $this->bo->read_entry((int)$_GET['cal_id']); 2028 if((!$_GET['response'] == 0 && !$_GET['ignore_conflict'] == 1) || 2029 (!isset($_GET['response']) && $_GET['action'] == 3 && !$_GET['ignore_conflict'] == 1)) 2030 { 2031 if($event['reference']) 2032 { 2033 $event_ids[] = $event['reference']; 2034 } 2035 $event['participants'] = Array($_GET['user_id'] => $event['participants'][$_GET['user_id']]); 2036 $overlapping_events = $this->bo->overlap( 2037 $this->bo->maketime($event['start']), 2038 $this->bo->maketime($event['end']), 2039 $event['participants'], 2040 $event['owner'], 2041 $event_ids 2042 ); 2043 } 1927 2044 1928 2045 if(isset($_GET['response'])) 1929 2046 { 2047 if($overlapping_events) 2048 { 2049 $this->confirm_conflict($_GET['user_id'],$event); 2050 }else 2051 { 2052 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 1930 2053 $this->confirm_action($confirm_status); 1931 2054 $GLOBALS['phpgw']->common->phpgw_exit(False); 1932 } 1933 else 1934 { 2055 } 2056 }else 2057 { 2058 if($overlapping_events) 2059 { 2060 $this->confirm_conflict($_GET['user_id'],$event,$overlapping_events); 2061 }else 2062 { 2063 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 1935 2064 if ($this->bo->return_to) 1936 2065 { … … 1942 2071 } 1943 2072 $GLOBALS['phpgw']->common->phpgw_exit(); 1944 } 2073 } 2074 } 2075 1945 2076 1946 2077 } … … 4719 4850 { 4720 4851 $var = Array( 4721 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param ),4852 'action_url_button' => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user_id='.$this->bo->owner), 4722 4853 'action_text_button' => ' '.$text.' ', 4723 4854 'action_confirm_button' => '', … … 5037 5168 'field' => ' 5038 5169 <script src="calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/js/edit.js" type="text/javascript"></script><div id=\'disponibility\' style=\'display:none;position:absolute\' bgcolor=\'#FFFFFF\'> 5039 <iframe src=\'#\' id=\'frame_disponibility\' width=\'500\' marginHeight=\'0\' marginWidth=\'0\' ></iframe>5170 <iframe src=\'#\' id=\'frame_disponibility\' width=\'500\' marginHeight=\'0\' marginWidth=\'0\' height=\'200px\'></iframe> 5040 5171 </div> 5041 5172 '.lang('Participants'),
Note: See TracChangeset
for help on using the changeset viewer.