diff --git a/calendar/accept_holiday.php b/calendar/accept_holiday.php new file mode 100755 index 0000000000..022f1f59c0 --- /dev/null +++ b/calendar/accept_holiday.php @@ -0,0 +1,33 @@ + * + * -------------------------------------------- * + * 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); +?> diff --git a/calendar/editlocale.php b/calendar/editlocale.php index 819a87134c..4192d2abad 100755 --- a/calendar/editlocale.php +++ b/calendar/editlocale.php @@ -74,6 +74,7 @@ $p->set_block('locale','list','list'); $p->set_block('locale','row','row'); $p->set_block('locale','row_empty','row_empty'); + $p->set_block('locale','back_button_form','back_button_form'); $total = country_total($locale,$query); if(!$total && !isset($query)) @@ -81,15 +82,19 @@ Header('Location: ' . $phpgw->link('/calendar/holiday_admin.php')); } - $p->set_var('th_bg',$phpgw_info['theme']['th_bg']); + $var = Array( + 'th_bg' => $phpgw_info['theme']['th_bg'], + 'left_next_matchs' => $phpgw->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale), + 'right_next_matchs' => $phpgw->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale), + 'lang_groups' => lang('Holidays').' ('.$locale.')', + 'sort_name' => $phpgw->nextmatchs->show_sort_order($sort,'name',$order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Holiday'),'&locale='.$locale), + 'header_edit' => lang('Edit'), + 'header_delete' => lang('Delete'), + 'header_submit' => '', + 'submit_link_column' => '' + ); - $p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale)); - $p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$start,$total,'&locale='.$locale)); - $p->set_var('lang_groups',lang('Holidays').' ('.$locale.')'); - - $p->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'name',$order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Holiday'),'&locale='.$locale)); - $p->set_var('header_edit',lang('Edit')); - $p->set_var('header_delete',lang('Delete')); + $p->set_var($var); $holidays = get_holiday_list($locale, $sort, $order, $query, $total); @@ -103,26 +108,31 @@ while (list($index,$name) = each($holidays)) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $p->set_var('tr_color',$tr_color); - if (! $name) $name = ' '; - $p->set_var('group_name',$name); - $p->set_var('edit_link',' ' . lang('Edit') . ' '); - $p->set_var('delete_link',' ' . lang('Delete') . ' '); - $p->parse('rows','row',True); + $var = Array( + 'tr_color' => $tr_color, + 'header_delete' => lang('Delete'), + 'group_name' => $name, + 'edit_link' => ' ' . lang('Edit') . ' ', + 'delete_link' => ' ' . lang('Delete') . ' ' + ); + $p->set_var($var); + $p->parse('rows','row',True); } } - $p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id=0')); - $p->set_var('lang_add',lang('add')); - - $p->set_var('back_action',$phpgw->link('/calendar/holiday_admin.php')); - $p->set_var('lang_back',lang('Back')); - - $p->set_var('search_action',$phpgw->link('/calendar/editlocale.php','locale='.$locale)); - $p->set_var('lang_search',lang('search')); + $var = Array( + 'new_action' => $phpgw->link('/calendar/editholiday.php','locale='.$locale.'&id=0'), + 'lang_add' => lang('add'), + 'back_action' => $phpgw->link('/calendar/holiday_admin.php'), + 'lang_back' => lang('Back'), + 'search_action' => $phpgw->link('/calendar/editlocale.php','locale='.$locale), + 'lang_search' => lang('search') + ); + $p->set_var($var); + $p->parse('back_button','back_button_form',False); $phpgw->common->phpgw_header(); echo parse_navbar(); diff --git a/calendar/holiday_admin.php b/calendar/holiday_admin.php index 0b6fb867ae..b9f97785cc 100755 --- a/calendar/holiday_admin.php +++ b/calendar/holiday_admin.php @@ -68,26 +68,34 @@ return $locale; } - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); + $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $templates = Array( - 'group' => 'groups.tpl' + 'locales' => 'locales.tpl' ); $p->set_file($templates); - $p->set_block('group','list','list'); - $p->set_block('group','row','row'); - $p->set_block('group','row_empty','row_empty'); + $p->set_block('locales','list','list'); + $p->set_block('locales','row','row'); + $p->set_block('locales','row_empty','row_empty'); + $p->set_block('locales','submit_column','submit_column'); $total = country_total($query); - - $p->set_var('th_bg',$phpgw_info['theme']['th_bg']); - $p->set_var('left_next_matchs',$phpgw->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$start,$total)); - $p->set_var('right_next_matchs',$phpgw->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$start,$total)); - $p->set_var('lang_groups',lang('Countries')); + $var = Array( + 'th_bg' => $phpgw_info['theme']['th_bg'], + 'left_next_matchs' => $phpgw->nextmatchs->left('/calendar/'.basename($SCRIPT_FILENAME),$start,$total), + 'right_next_matchs' => $phpgw->nextmatchs->right('/calendar/'.basename($SCRIPT_FILENAME),$start,$total), + 'lang_groups' => lang('Countries'), + 'sort_name' => $phpgw->nextmatchs->show_sort_order($sort,'locale',$order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Country')), + 'header_edit' => lang('Edit'), + 'header_delete' => lang('Delete'), + 'submit_extra' => '', + 'submit_link' => lang('Submit to Repository'), + 'back_button' => '' + ); - $p->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'locale',$order,'/calendar/'.basename($SCRIPT_FILENAME),lang('Country'))); - $p->set_var('header_edit',lang('Edit')); - $p->set_var('header_delete',lang('Delete')); + $p->set_var($var); + + $p->parse('header_submit','submit_column',False); $locales = get_locale_list($sort, $order, $query, $total); @@ -98,6 +106,7 @@ } else { + $p->set_var('submit_extra',' width="5%"'); while (list(,$value) = each($locales)) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); @@ -105,20 +114,27 @@ if (! $value) $value = ' '; - $p->set_var('group_name',$value); - $p->set_var("edit_link",' ' . lang('Edit') . ' '); - $p->set_var("delete_link",' ' . lang('Delete') . ' '); + $var = Array( + 'tr_color' => $tr_color, + 'group_name' => $value, + 'edit_link' => ' ' . lang('Edit') . ' ', + 'delete_link' => ' ' . lang('Delete') . ' ', + 'submit_link' => ' ' . lang('Submit') . ' ' + ); + $p->set_var($var); + $p->parse('submit_link_column','submit_column',False); $p->parse('rows','row',True); - } } - $p->set_var('new_action',$phpgw->link('/calendar/editholiday.php','id=0')); - $p->set_var("lang_add",lang('add')); - - $p->set_var('search_action',$phpgw->link('/calendar/holiday_admin.php')); - $p->set_var('lang_search',lang('search')); + $var = Array( + 'new_action' => $phpgw->link('/calendar/editholiday.php','id=0'), + 'lang_add' => lang('add'), + 'search_action' => $phpgw->link('/calendar/holiday_admin.php'), + 'lang_search' => lang('search') + ); + $p->set_var($var); $p->pparse('out','list'); $phpgw->common->phpgw_footer(); diff --git a/calendar/inc/class.calendar_holiday.inc.php b/calendar/inc/class.calendar_holiday.inc.php index 47a32ab48a..67f0d023b6 100755 --- a/calendar/inc/class.calendar_holiday.inc.php +++ b/calendar/inc/class.calendar_holiday.inc.php @@ -124,7 +124,7 @@ class calendar_holiday $lines = $network->gethttpsocketfile($load_from.'/holidays.'.strtoupper($locale)); if (!$lines) return false; $c_lines = count($lines); - for($i=10;$i<$c_lines;$i++) + for($i=0;$i<$c_lines;$i++) { // echo 'Line #'.$i.' : '.$lines[$i]."
\n"; $holiday = explode("\t",$lines[$i]); @@ -250,6 +250,26 @@ class calendar_holiday return $this->holidays; } + function build_list_for_submission($locale) + { + global $phpgw; + + $i = -1; + $this->db->query("SELECT * FROM phpgw_cal_holidays WHERE locale='".$locale."'"); + while($this->db->next_record()) + { + $i++; + $holidays[$i]['locale'] = $this->db->f('locale'); + $holidays[$i]['name'] = $phpgw->strip_html($this->db->f('name')); + $holidays[$i]['day'] = intval($this->db->f('mday')); + $holidays[$i]['month'] = intval($this->db->f('month_num')); + $holidays[$i]['occurence'] = intval($this->db->f('occurence')); + $holidays[$i]['dow'] = intval($this->db->f('dow')); + $holidays[$i]['observance_rule'] = $this->db->f('observance_rule'); + } + return $holidays; + } + function build_holiday_query() { $sql = 'SELECT * FROM phpgw_cal_holidays WHERE locale in ('; diff --git a/calendar/submitlocale.php b/calendar/submitlocale.php new file mode 100755 index 0000000000..f1d007e427 --- /dev/null +++ b/calendar/submitlocale.php @@ -0,0 +1,52 @@ + * + * -------------------------------------------- * + * 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(); +?> + +
+ +'."\n"; + for($i=0;$i<$c_holidays;$i++) + { + echo ''."\n" + . ''."\n" + . ''."\n" + . ''."\n" + . ''."\n" + . ''."\n"; + } +?> +
+ + diff --git a/calendar/templates/default/locales.tpl b/calendar/templates/default/locales.tpl index c405125297..a7a083c420 100755 --- a/calendar/templates/default/locales.tpl +++ b/calendar/templates/default/locales.tpl @@ -13,6 +13,7 @@ {sort_name} {header_edit} {header_delete} + {header_submit} {rows} @@ -26,11 +27,7 @@ - -
- -
- + {back_button} {lang_search} 
@@ -39,17 +36,26 @@ - {group_name} {edit_link} {delete_link} + {submit_link_column} - {message} + +{submit_link} + + + + + + + +