fixed holiday-management:

- holidays not complying to a (simple) rule like Eastern can now be entered as a one-time holiday for a fixed year
- fixed some wrong links and other stuff in the UI
- added a error-msg to accept_holiday on phpgroupware.org if there is already a file for the locale
- added download for holiday-files
This commit is contained in:
Ralf Becker 2003-02-27 19:28:25 +00:00
parent 8727041c6b
commit 02a7b96abe
9 changed files with 270 additions and 292 deletions

View File

@ -1,33 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$send_back_to = str_replace('submitlocale','holiday_admin',$HTTP_REFERER);
if(!$locale)
{
Header('Location: '.$send_back_to);
}
$send_back_to = str_replace('&locale='.$locale,'',$send_back_to);
$file = './holidays.'.$locale;
if(!file_exists($file) && count($name))
{
$c_holidays = count($name);
$fp = fopen($file,'w');
for($i=0;$i<$c_holidays;$i++)
{
fwrite($fp,$locale."\t".$name[$i]."\t".$day[$i]."\t".$month[$i]."\t".$occurence[$i]."\t".$dow[$i]."\t".$observance[$i]."\n");
}
fclose($fp);
}
Header('Location: '.$send_back_to);
?>

View File

@ -50,7 +50,7 @@
if(isset($GLOBALS['locale'])) { $this->locales[] = $GLOBALS['locale']; }
if(isset($GLOBALS['start'])) { $this->start = $GLOBALS['start']; } else { $this->start = 0; }
if(isset($GLOBALS['start'])) { $this->start = intval($GLOBALS['start']); } else { $this->start = 0; }
if(isset($GLOBALS['query'])) { $this->query = $GLOBALS['query']; }
@ -60,12 +60,14 @@
if(isset($GLOBALS['id'])) { $this->id = $GLOBALS['id']; }
if(isset($GLOBALS['year'])) { $this->year = $GLOBALS['year']; } else { $this->year = date('Y'); }
if($this->debug)
{
echo '<-- Locale = '.$this->locales[0].' -->'."\n";
}
$this->total = $this->so->holiday_total($this->locales[0],$this->query);
$this->total = $this->so->holiday_total($this->locales[0],$this->query,$this->year);
}
/* Begin Calendar functions */
@ -154,13 +156,14 @@
Header('Location: '.$send_back_to);
}
function get_holiday_list($locale='', $sort='', $order='', $query='', $total='')
function get_holiday_list($locale='', $sort='', $order='', $query='', $total='', $year=0)
{
$locale = ($locale?$locale:$this->locales[0]);
$sort = ($sort?$sort:$this->sort);
$order = ($order?$order:$this->order);
$query = ($query?$query:$this->query);
return $this->so->read_holidays($locale,$query,$order);
$year = ($$year?$$year:$this->year);
return $this->so->read_holidays($locale,$query,$order,$year);
}
function get_locale_list($sort='', $order='', $query='')
@ -293,34 +296,56 @@
{
if(@$GLOBALS['HTTP_POST_VARS']['submit'])
{
if(empty($GLOBALS['HTTP_POST_VARS']['holiday']['mday']))
$holiday = $GLOBALS['HTTP_POST_VARS']['holiday'];
if(empty($holiday['mday']))
{
$GLOBALS['HTTP_POST_VARS']['holiday']['mday'] = 0;
$holiday['mday'] = 0;
}
if(!isset($this->bo->locales[0]) || $this->bo->locales[0]=='')
{
$this->bo->locales[0] = $GLOBALS['HTTP_POST_VARS']['holiday']['locale'];
$this->bo->locales[0] = $holiday['locale'];
}
elseif(!isset($GLOBALS['HTTP_POST_VARS']['holiday']['locale']) || $GLOBALS['HTTP_POST_VARS']['holiday']['locale']=='')
elseif(!isset($holiday['locale']) || $holiday['locale']=='')
{
$GLOBALS['HTTP_POST_VARS']['holiday']['locale'] = $this->bo->locales[0];
$holiday['locale'] = $this->bo->locales[0];
}
if(!isset($GLOBALS['HTTP_POST_VARS']['holiday']['hol_id']))
if(!isset($holiday['hol_id']))
{
$GLOBALS['HTTP_POST_VARS']['holiday']['hol_id'] = $this->bo->id;
$holiday['hol_id'] = $this->bo->id;
}
// some input validation
if (!$holiday['mday'] == !$holiday['occurence'])
{
$errors[] = lang('You need to set either a day or a occurence !!!');
}
if($holiday['year'] && $holiday['occurence'])
{
$errors[] = lang('You can only set a year or a occurence !!!');
}
else
{
$holiday['occurence'] = intval($holiday['occurence'] ? $holiday['occurence'] : $holiday['year']);
unset($holiday['year']);
}
// Still need to put some validation in here.....
$this->ui = CreateObject('calendar.uiholiday');
if (is_array($errors))
{
$this->ui->add($errors,$GLOBALS['HTTP_POST_VARS']['holiday']);
$holiday['month'] = $holiday['month_num'];
$holiday['day'] = $holiday['mday'];
$this->ui->edit_holiday($errors,$holiday);
}
else
{
$this->so->save_holiday($GLOBALS['HTTP_POST_VARS']['holiday']);
$this->ui->edit_locale();
$this->so->save_holiday($holiday);
$this->ui->edit_locale($holiday['locale']);
}
}
}
@ -360,8 +385,7 @@
{
return $this->cached_holidays;
}
$holidays = $this->so->read_holidays($this->locales);
$holidays = $this->so->read_holidays($this->locales,'','',$this->year);
if(count($holidays) == 0)
{
@ -404,5 +428,35 @@
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php'));
}
}
function rule_string($holiday)
{
if (!is_array($holiday))
{
return false;
}
$sbox = CreateObject('phpgwapi.sbox');
$month = $holiday['month'] ? lang($sbox->monthnames[$holiday['month']]) : '';
unset($sbox);
if (!$holiday['day'])
{
$occ = $holiday['occurence'] == 99 ? lang('last') : $holiday['occurence'].'.';
$dow_str = Array(lang('Sun'),lang('Mon'),lang('Tue'),lang('Wed'),lang('Thu'),lang('Fri'),lang('Sat'));
$dow = $dow_str[$holiday['dow']];
$str = lang('%1 %2 in %3',$occ,$dow,$month);
}
else
{
$str = $GLOBALS['phpgw']->common->dateformatorder($holiday['occurence']>1900?$holiday['occurence']:'',$month,$holiday[day]);
}
if ($holiday['observance_rule'])
{
$str .= ' ('.lang('Observance Rule').')';
}
return $str;
}
}
?>

View File

@ -70,7 +70,7 @@
}
}
function read_holidays($locales='',$query='',$order='')
function read_holidays($locales='',$query='',$order='',$year=0)
{
global $phpgw;
@ -81,7 +81,7 @@
return $holidays;
}
$sql = $this->build_query($locales,$query,$order);
$sql = $this->build_query($locales,$query,$order,$year);
if($this->debug)
{
@ -117,7 +117,7 @@
}
/* Private functions */
function build_query($locales,$query='',$order='')
function build_query($locales,$query='',$order='',$year=0)
{
if(is_string($locales))
@ -142,12 +142,12 @@
{
$querymethod = " AND name like '%".$query."%'";
}
if($order)
if (intval($year) > 1900)
{
$querymethod .= ' ORDER BY '.$order;
$querymethod .= " AND (occurence < 1900 OR occurence = $year)";
}
$querymethod .= ' ORDER BY '.($order ? $order : 'month_num,mday');
return 'SELECT * FROM phpgw_cal_holidays WHERE locale in ('.$find.')'.$querymethod;
}
@ -171,13 +171,17 @@
return $locale;
}
function holiday_total($locale,$query='')
function holiday_total($locale,$query='',$year=0)
{
$querymethod='';
if($query)
{
$querymethod = " AND name like '%".$query."%'";
}
if (intval($year) >= 1900)
{
$querymethod .= " AND (occurence < 1900 OR occurence = $year)";
}
$sql = "SELECT count(*) FROM phpgw_cal_holidays WHERE locale='".$locale."'".$querymethod;
if($this->debug)

View File

@ -27,9 +27,10 @@
'admin' => True,
'edit_locale' => True,
'edit_holiday' => True,
'add_holiday' => True,
'copy_holiday' => True,
'delete_holiday' => True,
'delete_locale' => True
'delete_locale' => True,
'submit' => True
);
function uiholiday()
@ -40,6 +41,8 @@
$this->bo->check_admin();
$this->base_url = $this->bo->base_url;
$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar');
$this->sb = CreateObject('phpgwapi.sbox');
}
function admin()
@ -58,19 +61,20 @@
$var = Array(
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'left_next_matchs' => $GLOBALS['phpgw']->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$this->bo->start,$this->bo->total),
'right_next_matchs' => $GLOBALS['phpgw']->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$this->bo->start,$this->bo->total),
'lang_groups' => lang('Countries'),
'left_next_matchs' => $GLOBALS['phpgw']->nextmatchs->left('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total),
'right_next_matchs' => $GLOBALS['phpgw']->nextmatchs->right('/index.php?menuaction=calendar.uiholiday.admin',$this->bo->start,$this->bo->total),
'center' => '<td align="center">'.lang('Countries').'</td>',
'sort_name' => $GLOBALS['phpgw']->nextmatchs->show_sort_order($this->bo->sort,'locale',$this->bo->order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Country')),
'header_edit' => lang('Edit'),
'header_delete' => lang('Delete'),
'submit_extra' => '',
'submit_link' => lang('Submit to Repository'),
'header_extra' => lang('Submit to Repository'),
'extra_width' => 'width="45%"',
'rule' => '',
'header_rule' => '',
'back_button' => ''
);
$p->set_var($var);
$p->parse('header_submit','submit_column',False);
$locales = $this->bo->get_locale_list($this->bo->sort, $this->bo->order, $this->bo->query, $this->bo->total);
@reset($locales);
@ -92,16 +96,16 @@
'group_name' => $value,
'edit_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$value)) . '"> '.lang('Edit').' </a>',
'delete_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_locale','locale'=>$value)).'"> '.lang('Delete').' </a>',
'submit_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value)).'"> '.lang('Submit').' </a>'
'extra_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value)).'"> '.lang('Submit').' </a>'.
' &nbsp; &nbsp; <a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.submit','locale'=>$value,'download'=>1)).'"> '.lang('Download').' </a>'
);
$p->set_var($var);
$p->parse('submit_link_column','submit_column',False);
$p->parse('rows','row',True);
}
}
$var = Array(
'new_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.add_holiday','id'=>0)),
'new_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','id'=>0)),
'lang_add' => lang('add'),
'search_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')),
'lang_search' => lang('search')
@ -111,8 +115,13 @@
$p->pparse('out','list');
}
function edit_locale()
function edit_locale($locale='')
{
if ($locale)
{
$this->bo->locales = array($locale);
$this->bo->total = $this->bo->so->holiday_total($locale,$this->bo->query);
}
if(!$this->bo->total && !isset($this->bo->query))
{
$link_params = Array(
@ -120,7 +129,6 @@
);
Header('Location: ' . $GLOBALS['phpgw']->link($this->base_url,$link_params));
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
@ -132,22 +140,28 @@
$p->set_block('locale','row_empty','row_empty');
$p->set_block('locale','back_button_form','back_button_form');
$html = CreateObject('calendar.html');
$year_form = str_replace('<option value=""></option>','',$html->form($html->sbox_submit($this->sb->getYears('year',$this->bo->year),true),array(),
$this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0])));
unset($html);
$holidays = $this->bo->get_holiday_list();
$var = Array(
'th_bg' => $phpgw_info['theme']['th_bg'],
'left_next_matchs' => $GLOBALS['phpgw']->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$this->bo->start,$this->bo->total,'&locale='.$this->bo->locales[0]),
'right_next_matchs' => $GLOBALS['phpgw']->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$this->bo->start,$this->bo->total,'&locale='.$this->bo->locales[0]),
'lang_groups' => lang('Holidays').' ('.$this->bo->locales[0].')',
'sort_name' => $GLOBALS['phpgw']->nextmatchs->show_sort_order($this->bo->sort,'name',$this->bo->order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Holiday'),'&locale='.$this->bo->locales[0]),
'header_edit' => lang('Edit'),
'left_next_matchs' => $GLOBALS['phpgw']->nextmatchs->left('/index.php',$this->bo->start,$this->bo->total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
'right_next_matchs' => $GLOBALS['phpgw']->nextmatchs->right('/index.php',$this->bo->start,$this->bo->total,'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
'center' => '<td align="right">'.lang('Holidays').' ('.$this->bo->locales[0].')</td><td align="left">'.$year_form.'</td>',
'sort_name' => $GLOBALS['phpgw']->nextmatchs->show_sort_order($this->bo->sort,'name',$this->bo->order,'/index.php',lang('Holiday'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year),
'header_edit' => lang('Edit'),
'header_delete' => lang('Delete'),
'header_submit' => '',
'submit_link_column' => ''
'header_rule' => '<td>'.$GLOBALS['phpgw']->nextmatchs->show_sort_order($this->bo->sort,'month_num,mday',$this->bo->order,'/index.php',lang('Rule'),'&menuaction=calendar.uiholiday.edit_locale&locale='.$this->bo->locales[0].'&year='.$this->bo->year).'</td>',
'header_extra' => lang('Copy'),
'extra_width' => 'width="5%"'
);
$p->set_var($var);
$holidays = $this->bo->get_holiday_list();
if (!count($holidays))
{
$p->set_var('message',lang('No matchs found'));
@ -155,7 +169,8 @@
}
else
{
for($i=0;$i<count($holidays);$i++)
$maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
for($i=$this->bo->start; $i < count($holidays) && $i < $this->bo->start+$maxmatchs; $i++)
{
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
if (!$holidays[$i]['name'])
@ -167,8 +182,10 @@
'tr_color' => $tr_color,
'header_delete'=> lang('Delete'),
'group_name' => $holidays[$i]['name'],
'edit_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'])).'"> '.lang('Edit').' </a>',
'delete_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'])).'"> '.lang('Delete').' </a>'
'rule' => '<td>'.$this->bo->rule_string($holidays[$i]).'</td>',
'edit_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Edit').' </a>',
'extra_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.copy_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Copy').' </a>',
'delete_link' => '<a href="'.$GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$holidays[$i]['index'],'year'=>$this->bo->year)).'"> '.lang('Delete').' </a>'
);
$p->set_var($var);
@ -177,11 +194,11 @@
}
$var = Array(
'new_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.add_holiday','locale'=>$this->bo->locales[0],'id'=>0)),
'new_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_holiday','locale'=>$this->bo->locales[0],'id'=>0,'year'=>$this->bo->year)),
'lang_add' => lang('add'),
'back_action' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.admin')),
'lang_back' => lang('Back'),
'search_action'=> $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0])),
'search_action'=> $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)),
'lang_search' => lang('search')
);
$p->set_var($var);
@ -189,30 +206,42 @@
$p->pparse('out','list');
}
function edit_holiday()
function copy_holiday()
{
if(@$this->bo->id)
{
$holiday = $this->bo->read_entry($this->bo->id);
}
if(!$holiday || !@$this->bo->id)
{
Header('Location: ' . $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0])));
}
$this->bo->id = 0;
if (!$holiday['occurence'] || $holiday['occurence'] >= 1900)
{
$holiday['occurence'] = date('Y');
}
$this->edit_holiday('',$holiday);
}
function edit_holiday($error='',$holiday='')
{
if(@$this->bo->id && !$holiday)
{
$holiday = $this->bo->read_entry($this->bo->id);
}
if ($GLOBALS['HTTP_GET_VARS']['locale'])
{
$holiday['locale'] = $GLOBALS['HTTP_GET_VARS']['locale'];
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
$GLOBALS['phpgw']->common->phpgw_header();
$sb = CreateObject('phpgwapi.sbox');
$t = CreateObject('phpgwapi.Template',$this->template_dir);
$t->set_file(Array('holiday'=>'holiday.tpl','form_button'=>'form_button_script.tpl'));
$t->set_block('holiday','form','form');
$t->set_block('holiday','list','list');
if (@$errorcount)
if (@count($error))
{
$message = $GLOBALS['phpgw']->common->error_list($error);
}
@ -222,32 +251,32 @@
}
$var = Array(
'title_holiday'=> lang('Edit').' '.lang('Holiday'),
'title_holiday'=> ($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday'),
'message' => $message,
'actionurl' => $GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.add'),
'actionurl' => $GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.add&year='.$this->bo->year),
'hidden_vars' => '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n"
. '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n"
);
$t->set_var($var);
// Locale
$this->display_item($t,lang('Country'),'<input name="holiday[locale]" size="2" maxlength="2" value="'.$holiday[locale].'">');
$this->display_item($t,lang('Country'),'<input name="holiday[locale]" size="3" maxlength="2" value="'.$holiday[locale].'">');
// Title/Name
$this->display_item($t,lang('title'),'<input name="holiday[name]" size="25" maxlength="50" value="'.$holiday['name'].'">');
$this->display_item($t,lang('title'),'<input name="holiday[name]" size="60" maxlength="50" value="'.$holiday['name'].'">');
// Date
$this->display_item($t,lang('Date'),$GLOBALS['phpgw']->common->dateformatorder('',$sb->getMonthText('holiday[month_num]',$holiday['month']),$sb->getDays('holiday[mday]',$holiday['day'])));
$this->display_item($t,lang('Date'),$GLOBALS['phpgw']->common->dateformatorder($this->sb->getYears('holiday[year]',$holiday['occurence']>1900?$holiday['occurence']:0),$this->sb->getMonthText('holiday[month_num]',$holiday['month']),$this->sb->getDays('holiday[mday]',$holiday['day'])));
// Occurence
$occur = Array(
0 => '0',
1 => '1st',
2 => '2nd',
3 => '3rd',
4 => '4th',
5 => '5th',
99 => 'Last'
0 => '',
1 => '1.',
2 => '2.',
3 => '3.',
4 => '4.',
5 => '5.',
99 => lang('Last')
);
$out = '';
while(list($key,$value) = each($occur))
@ -281,6 +310,7 @@
{
$link_params = Array(
'menuaction' => 'calendar.uiholiday.edit_locale',
'year' => $this->bo->year,
'locale' => $this->bo->locales[0]
);
}
@ -303,128 +333,13 @@
}
function add_holiday($messages='',$holiday='')
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
$GLOBALS['phpgw']->common->phpgw_header();
$sb = CreateObject('phpgwapi.sbox');
$t = CreateObject('phpgwapi.Template',$this->template_dir);
$t->set_file(Array('holiday'=>'holiday.tpl','form_button'=>'form_button_script.tpl'));
$t->set_block('holiday','form','form');
$t->set_block('holiday','list','list');
if($messages)
{
if (is_array($messages))
{
$message = $GLOBALS['phpgw']->common->error_list($messages);
}
else
{
$message = '';
}
}
$var = Array(
'title_holiday' => lang('Add').' '.lang('Holiday'),
'message' => $message,
'actionurl' => $GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.add'),
'hidden_vars' => '<input type="hidden" name="locale" value="'.$this->bo->locales[0].'">'."\n"
. '<input type="hidden" name="id" value="'.$this->bo->id.'">'."\n"
. '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n"
. '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n"
);
$t->set_var($var);
// Locale
if($this->bo->locales[0])
{
$holiday['locale'] = $this->bo->locales[0];
}
$this->display_item($t,lang('Country'),'<input name="holiday[locale]" size="2" maxlength="2" value="'.$holiday[locale].'">');
// Title/Name
$this->display_item($t,lang('title'),'<input name="holiday[name]" size="25" maxlength="50" value="'.$holiday['name'].'">');
// Date
$day_html = $sb->getDays('holiday[mday]',$holiday['day']);
$month_html = $sb->getMonthText('holiday[month_num]',$holiday['month']);
$year_html = '';
$this->display_item($t,lang('Date'),$GLOBALS['phpgw']->common->dateformatorder($year_html,$month_html,$day_html));
// Occurence
$occur = Array(
0 => '0',
1 => '1st',
2 => '2nd',
3 => '3rd',
4 => '4th',
5 => '5th',
99 => 'Last'
);
$out = '';
while(list($key,$value) = each($occur))
{
$out .= '<option value="'.$key.'"'.($holiday['occurence']==$key?' selected':'').'>'.$value.'</option>'."\n";
}
$occurence_html = '<select name="holiday[occurence]">'."\n".$out.'</select>'."\n";
$dow = Array(
0 => lang('Sun'),
1 => lang('Mon'),
2 => lang('Tue'),
3 => lang('Wed'),
4 => lang('Thu'),
5 => lang('Fri'),
6 => lang('Sat')
);
$out = '';
for($i=0;$i<7;$i++)
{
$out .= '<option value="'.$i.'"'.($holiday['dow']==$i?' selected':'').'>'.$dow[$i].'</option>'."\n";
}
$dow_html = '<select name="holiday[dow]">'."\n".$out.'</select>'."\n";
$this->display_item($t,lang('Occurence'),$occurence_html.'&nbsp;'.$dow_html);
$this->display_item($t,lang('Observance Rule'),'<input type="checkbox" name="holiday[observance_rule]" value="True"'.($holiday['observance_rule']?' checked':'').'>');
$t->set_var('lang_add',lang('Save'));
$t->set_var('lang_reset',lang('Reset'));
if(@$this->bo->locales[0])
{
$link_params = Array(
'menuaction' => 'calendar.uiholiday.edit_locale',
'locale' => $this->bo->locales[0]
);
}
else
{
$link_params = Array(
'menuaction' => 'calendar.uiholiday.admin'
);
}
$var = Array(
'action_url_button' => $GLOBALS['phpgw']->link($this->base_url,$link_params),
'action_text_button' => lang('Cancel'),
'action_confirm_button' => '',
'action_extra_field' => ''
);
$t->set_var($var);
$t->parse('cancel_button','form_button');
$t->pparse('out','form');
}
function delete_locale()
{
if(!$this->bo->total)
{
$this->admin();
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
@ -473,10 +388,10 @@
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_file(Array('form'=>'delete_common.tpl','form_button'=>'form_button_script.tpl'));
$p->set_var('messages',lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].')');
$p->set_var('messages',lang('Are you sure you want to delete this holiday ?')."<br>".$holiday['name'].' ('.$this->bo->locales[0].') '.$this->bo->rule_string($holiday));
$var = Array(
'action_url_button' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0])),
'action_url_button' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.uiholiday.edit_locale','locale'=>$this->bo->locales[0],'year'=>$this->bo->year)),
'action_text_button' => lang('No'),
'action_confirm_button' => '',
'action_extra_field' => ''
@ -485,7 +400,7 @@
$p->parse('no','form_button');
$var = Array(
'action_url_button' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$this->bo->id)),
'action_url_button' => $GLOBALS['phpgw']->link($this->base_url,Array('menuaction'=>'calendar.boholiday.delete_holiday','locale'=>$this->bo->locales[0],'id'=>$this->bo->id,'year'=>$this->bo->year)),
'action_text_button' => lang('Yes'),
'action_confirm_button' => '',
'action_extra_field' => ''
@ -502,21 +417,37 @@
{
$this->admin();
}
$this->bo->year = 0; // for a complete list with all years
$holidays = $this->bo->get_holiday_list();
if (isset($GLOBALS['HTTP_GET_VARS']['download']))
{
$locale = $this->bo->locales[0];
$browser = CreateObject('phpgwapi.browser');
$browser->content_header('holidays.'.$locale,'text/text');
unset($browser);
while (list(,$holiday) = @each($holidays))
{
echo "$locale\t$holiday[name]\t$holiday[day]\t$holiday[month]\t$holiday[occurence]\t$holiday[dow]\t$holiday[observance_rule]\n";
}
$GLOBALS['phpgw']->common->phpgw_exit();
}
elseif($this->debug)
{
$action = $GLOBALS['phpgw']->link('/calendar/phpgroupware.org/accept_holiday.php');
}
else
{
$action = 'http://www.phpgroupware.org/cal/accept_holiday.php';
}
$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
$GLOBALS['phpgw']->common->phpgw_header();
echo '<body onLoad="document.submitform.submit()">'."\n";
if($this->debug)
{
echo '<form action="'.$GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.accept_holiday').'" method="post" name="submitform">'."\n";
}
else
{
echo '<form action="http://www.phpgroupware.org/cal/accept_holiday.php" method="post" name="submitform">'."\n";
}
echo '<form action="'.$action.'" method="post" name="submitform">'."\n";
$c_holidays = count($holidays);
echo '<input type="hidden" name="locale" value="'.$this->bo->locales[0].'">'."\n";
@ -529,6 +460,10 @@
. '<input type="hidden" name="dow[]" value="'.$holidays[$i]['dow'].'">'."\n"
. '<input type="hidden" name="observance[]" value="'.$holidays[$i]['observance_rule'].'">'."\n";
}
if ($mailto)
{
echo "<input type='submit' value='Mail to $mailto'>\n";
}
echo "</form>\n</body>\n</head>";
}

View File

@ -0,0 +1,57 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$send_back_to = str_replace('submitlocale','holiday_admin',$HTTP_REFERER);
$send_back_to = str_replace('submit','admin',$HTTP_REFERER); // 0.9.14.xxx
if(!$locale)
{
Header('Location: '.$send_back_to);
}
$send_back_to = str_replace('&locale='.$locale,'',$send_back_to);
$file = './holidays.'.$locale;
if(!file_exists($file))
{
if (count($name))
{
$c_holidays = count($name);
$fp = fopen($file,'w');
for($i=0;$i<$c_holidays;$i++)
{
fwrite($fp,$locale."\t".$name[$i]."\t".$day[$i]."\t".$month[$i]."\t".$occurence[$i]."\t".$dow[$i]."\t".$observance[$i]."\n");
}
fclose($fp);
}
Header('Location: '.$send_back_to);
}
else
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>phpGroupWare.org: There is already a holiday-file for '<?php echo $locale; ?>' !!!</title>
</head>
<body>
<h1>There is already a holiday-file for '<?php echo $locale; ?>' !!!</h1>
<p>If you think your version of the holidays for '<?php echo $locale; ?>' should replace
the existing one, please <a href="<?php echo $HTTP_REFERER; ?>&download=1">download</a> the file
and <a href="mailto:phpgroupware-developers@gnu.org">mail it</a> to us.</p>
<p>To get back to your own phpGroupWare-install <a href="<?php echo $send_back_to; ?>">click here</a>.</p>
</body>
</html>
<?php
}
?>

View File

@ -1,3 +1,4 @@
%1 %2 in %3 calendar de %1 %2 im %3
(for weekly) calendar de (für wöchentlich)
(i/v)cal calendar de [iv]Cal
1 match found calendar de 1 Treffer gefunden
@ -12,7 +13,7 @@ alarm management calendar de Alarm Management
alarms calendar de Alarme
all day calendar de ganztägig
are you sure you want to delete this country ? calendar de Sind Sie sicher, dass Sie dieses Land löschen wollen ?
are you sure you want to delete this holiday ? calendar de Sind Sie sicher, dass Sie diesen Alarm löschen wollen ?
are you sure you want to delete this holiday ? calendar de Sind Sie sicher, dass Sie diesen Feiertag löschen wollen ?
are you sure\nyou want to\ndelete this entry ? calendar de Sind Sie sicher,\ndass Sie diesen\nEintrag löschen wollen ?
are you sure\nyou want to\ndelete this entry ?\n\nthis will delete\nthis entry for all users. calendar de Sind Sie sicher,\ndass Sie diesen\nEintrag löschen wollen ?\n\nDieser Eintrag wird damit\nfür alle Benutzer gelöscht.
are you sure\nyou want to\ndelete this single occurence ?\n\nthis will delete\nthis entry for all users. calendar de Sind Sie sicher,\ndass Sie diesen einzelnen\nEintrag löschen wollen ?\n\nDieser Eintrag wird damit\nfür alle Benutzer gelöscht.
@ -44,6 +45,7 @@ display interval in day view calendar de Intervall der Tagesansicht
display mini calendars when printing calendar de zeige einen kleinen Kalender beim drucken
display status of events calendar de Status von Terminen anzeigen
do you wish to autoload calendar holidays files dynamically? admin de Sollen die Feiertage automatisch geladen werden?
download calendar de Herunterladen
duration calendar de Dauer
edit series calendar de Serie bearbeiten
edit single calendar de Einzel bearbeiten
@ -75,6 +77,7 @@ ignore conflict calendar de Konflikt ignorieren
import calendar de Importieren
interval calendar de Interval
invalid entry id. calendar de ungültige Id des Eintrags.
last calendar de letzte
load [iv]cal calendar de [iv]Cal Laden
location calendar de Ort
location to autoload from admin de Von wo sollen sie geladen werden
@ -128,6 +131,7 @@ repeat type calendar de Wiederholungstyp
repeating event information calendar de Informationen zu sich wiederholenden Ereignissen
repetition calendar de Wiederholung
reset calendar de Zurücksetzen
rule calendar de Regel
sa calendar de Sa
sat calendar de Sa
scheduling conflict calendar de Terminüberschneidung
@ -175,6 +179,7 @@ work day starts on calendar de Arbeitstag beginnt um
x matches found calendar de %1 Treffer gefunden
year calendar de Jahr
yearly calendar de Jährlich
you can only set a year or a occurence !!! calendar de Sie können nur ein Jahr oder eine Wiederholung angeben !!!
you do not have permission to read this record! calendar de Sie haben keine Berechtigung diesen Eintrag zu lesen!
you have 1 high priority event on your calendar today. common de Sie haben heute einen Eintrag mit hoher Priorität auf Ihrer Liste!
you have a meeting scheduled for calendar de Sie haben einen Termin am
@ -187,6 +192,7 @@ you have not entered participants calendar de Sie haben keine Teilnehmer angegeb
you have x high priority events on your calendar today. common de Sie haben heute %1 Einträge mit hoher Priorität auf Ihrer Liste!
you must enter one or more search keywords calendar de Sie müssen einen oder mehrere Suchbegriffe angeben
you must select a [iv]cal. (*.[iv]cs) calendar de Sie müssen einen [iv]Cal (*.[iv]cs) auswählen.
you need to set either a day or a occurence !!! calendar de Sie müssen entweder einen Tag oder eine Wiederholung angeben !!!
your meeting scheduled for calendar de Ihr Termin am
your meeting that had been scheduled for calendar de Ihr Termin am
your suggested time of <b> x - x </b> conflicts with the following existing calendar entries: calendar de Der von Ihnen gewählte Zeitraum <B> %1 - %2 </B> führt zu Konflikten mit folgenden bereits existierenden Kalendereinträgen:

View File

@ -1,4 +1,6 @@
1 match found calendar en 1 match found
%1 %2 in %3 calendar en %1 %2 in %3
(for weekly) calendar en (for Weekly)
(i/v)cal calendar en (i/v)Cal
a calendar en a
accept calendar en Accept
@ -40,6 +42,8 @@ do you wish to autoload calendar holidays files dynamically? admin en Do you wis
display interval in day view calendar en Display interval in Day View
display mini calendars when printing calendar en Display mini calendars when printing
display status of events calendar en Display Status of Events
do you wish to autoload calendar holidays files dynamically? admin en Do you wish to autoload calendar holidays files dynamically?
download calendar en Download
duration calendar en Duration
edit series calendar en Edit Series
edit single calendar en Edit Single
@ -71,6 +75,7 @@ i participate calendar en I Participate
import calendar en Import
interval calendar en Interval
invalid entry id. calendar en Invalid entry id.
last calendar en last
load [iv]cal calendar en Load [iv]Cal
location calendar en Location
location to autoload from admin en Location to autoload from
@ -119,6 +124,7 @@ repeating event information calendar en Repeating Event Information
repeat type calendar en Repeat type
repetition calendar en Repetition
reset calendar en Reset
rule calendar en Rule
sa calendar en Sa
sat calendar en Sat
scheduling conflict calendar en Scheduling Conflict
@ -164,6 +170,7 @@ work day ends on calendar en Work day ends on
work day starts on calendar en Work day starts on
x matches found calendar en %1 matches found
yearly calendar en Yearly
you can only set a year or a occurence !!! calendar en You can only set a year or a occurence !!!
you do not have permission to read this record! calendar en You do not have permission to read this record!
you have 1 high priority event on your calendar today. common en You have 1 high priority event on your calendar today.
you have x high priority events on your calendar today. common en You have %1 high priority events on your calendar today.
@ -174,6 +181,7 @@ you have not entered a valid time of day calendar en You have not entered a vali
you have not entered participants calendar en You have not entered participants
you must enter one or more search keywords calendar en You must enter one or more search keywords
you must select a [iv]cal. (*.[iv]cs) calendar en You must select a [iv]Cal. (*.[iv]cs)
you need to set either a day or a occurence !!! calendar en You need to set either a day or a occurence !!!
your meeting scheduled for calendar en Your meeting scheduled for
your meeting that had been scheduled for calendar en Your meeting that had been scheduled for
your suggested time of <b> x - x </b> conflicts with the following existing calendar entries: calendar en Your suggested time of <B> %1 - %2 </B> conflicts with the following existing calendar entries:

View File

@ -1,52 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True,
'admin_header' => True,
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True,
'parent_page' => '../admin/index.php'
);
$phpgw_info['flags'] = $phpgw_flags;
include('../header.inc.php');
if(!isset($locale) || !$locale)
{
Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php'));
}
$holidays = $phpgw->calendar->holidays->build_list_for_submission($locale);
$phpgw->common->phpgw_header();
?>
<body onLoad="document.submitform.submit()">
<form action="http://www.phpgroupware.org/cal/accept_holiday.php" method="post" name="submitform">
<!-- <form action="<?php echo $phpgw->link('/calendar/accept_holiday.php'); ?>" method="post" name="submitform"> -->
<?php
$c_holidays = count($holidays);
echo '<input type="hidden" name="locale" value="'.$locale.'">'."\n";
for($i=0;$i<$c_holidays;$i++)
{
echo '<input type="hidden" name="name[]" value="'.$holidays[$i]['name'].'">'."\n"
. '<input type="hidden" name="day[]" value="'.$holidays[$i]['day'].'">'."\n"
. '<input type="hidden" name="month[]" value="'.$holidays[$i]['month'].'">'."\n"
. '<input type="hidden" name="occurence[]" value="'.$holidays[$i]['occurence'].'">'."\n"
. '<input type="hidden" name="dow[]" value="'.$holidays[$i]['dow'].'">'."\n"
. '<input type="hidden" name="observance[]" value="'.$holidays[$i]['observance_rule'].'">'."\n";
}
?>
</form>
</body>
</head>

View File

@ -3,24 +3,25 @@
<table border="0" width="45%" align="center">
<tr>
<td align="left">{left_next_matchs}</td>
<td align="center">{lang_groups}</td>
{center}
<td align="right">{right_next_matchs}</td>
</tr>
</table>
<table border="0" width="45%" align="center">
<table border="0" width="70%" align="center">
<tr class="th">
<td>{sort_name}</td>
{header_rule}
<td>{header_edit}</td>
<td>{header_delete}</td>
{header_submit}
<td>{header_extra}</td>
</tr>
{rows}
</table>
<table border="0" width="45%" align="center">
<table border="0" width="60%" align="center">
<tr>
<td align="left">
<form method="POST" action="{new_action}">
@ -39,9 +40,10 @@
<!-- BEGIN row -->
<tr class="{tr_color}">
<td>{group_name}</td>
{rule}
<td width="5%">{edit_link}</td>
<td width="5%">{delete_link}</td>
{submit_link_column}
<td align="center" {extra_width}>{extra_link}</td>
</tr>
<!-- END row -->
<!-- BEGIN row_empty -->
@ -49,9 +51,6 @@
<td colspan="5" align="center">{message}</td>
</tr>
<!-- END row_empty -->
<!-- BEGIN submit_column -->
<td{submit_extra}>{submit_link}</td>
<!-- END submit_column -->
<!-- BEGIN back_button_form -->
<td align="center">
<form method="POST" action="{back_action}">