From dda38958eaf20efccbec3cfab8a52dd388b850bb Mon Sep 17 00:00:00 2001 From: skeeter Date: Tue, 15 May 2001 04:13:20 +0000 Subject: [PATCH] Condensing template files. --- calendar/edit_entry.php | 53 ++++++++++----------- calendar/templates/default/edit.tpl | 24 ++++++---- calendar/templates/default/head.tpl | 2 +- calendar/templates/default/header.inc.php | 2 +- calendar/templates/idsociety/header.inc.php | 2 +- 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index 02e6cec200..a0ada38285 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -32,13 +32,11 @@ $cal_info = CreateObject('calendar.calendar_item'); - function display_item($field,$data) + function display_item(&$p,$field,$data) { - global $p; - $p->set_var('field',$field); $p->set_var('data',$data); - $p->parse('output','list',True); + $p->parse('row','list',True); } if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') @@ -146,13 +144,13 @@ $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir); $templates = Array( - 'edit_entry_begin'=> 'edit.tpl', - 'list' => 'list.tpl', - 'hr' => 'hr.tpl', - 'edit_entry_end' => 'edit.tpl', + 'edit' => 'edit.tpl', 'form_button' => 'form_button_script.tpl' ); $p->set_file($templates); + $p->set_block('edit','edit_entry','edit_entry'); + $p->set_block('edit','list','list'); + $p->set_block('edit','hr','hr'); if($id > 0) { @@ -184,22 +182,21 @@ ); $p->set_var($vars); - $p->parse('out','edit_entry_begin'); // Brief Description - display_item(lang('Title'),''); + display_item($p,lang('Title'),''); // Full Description - display_item(lang('Full Description'),''); + display_item($p,lang('Full Description'),''); // Display Categories - display_item(lang('Category'),''); + display_item($p,lang('Category'),''); // Date $day_html = $sb->getDays('start[mday]',intval($phpgw->common->show_date($start,'d'))); $month_html = $sb->getMonthText('start[month]',intval($phpgw->common->show_date($start,'n'))); $year_html = $sb->getYears('start[year]',intval($phpgw->common->show_date($start,'Y')),intval($phpgw->common->show_date($start,'Y'))); - display_item(lang('Start Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); + display_item($p,lang('Start Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); // Time $amsel = ' checked'; $pmsel = ''; @@ -217,13 +214,13 @@ $str .= 'pm'; } - display_item(lang('Start Time'),$str); + display_item($p,lang('Start Time'),$str); // End Date $day_html = $sb->getDays('end[mday]',intval($phpgw->common->show_date($end,'d'))); $month_html = $sb->getMonthText('end[month]',intval($phpgw->common->show_date($end,'n'))); $year_html = $sb->getYears('end[year]',intval($phpgw->common->show_date($end,'Y')),intval($phpgw->common->show_date($end,'Y'))); - display_item(lang('End Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); + display_item($p,lang('End Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); // End Time $amsel = ' checked'; $pmsel = ''; @@ -242,10 +239,10 @@ $str .= 'pm'; } - display_item(lang("End Time"),$str); + display_item($p,lang("End Time"),$str); // Priority - display_item(lang('Priority'),$sb->getPriority('priority',$event->priority)); + display_item($p,lang('Priority'),$sb->getPriority('priority',$event->priority)); // Access $str = 'acl->get_ids_for_location('run',1,'calendar'); @@ -299,7 +296,7 @@ } } $str .= ' '; - display_item(lang('Participants'),$str); + display_item($p,lang('Participants'),$str); // I Participate $participate = False; @@ -319,13 +316,13 @@ $str .= ' checked'; } $str .= '>'; - display_item($phpgw->common->grab_owner_name($owner).' '.lang('Participates'),$str); + display_item($p,$phpgw->common->grab_owner_name($owner).' '.lang('Participates'),$str); // Repeat Type $p->set_var('hr_text','
'); - $p->parse('output','hr',True); + $p->parse('row','hr',True); $p->set_var('hr_text','
'.lang('Repeating Event Information').'

'); - $p->parse('output','hr',True); + $p->parse('row','hr',True); $str = ''; - display_item(lang('Repeat Type'),$str); + display_item($p,lang('Repeat Type'),$str); - $p->set_var('field',lang('Repeat End Date')); $str = 'recur_enddate->year != 0 && $event->recur_enddate->month != 0 && $event->recur_enddate->mday != 0) @@ -377,7 +373,7 @@ $year_html = $sb->getYears('recur_enddate[year]',intval($phpgw->common->show_date($recur_end,'Y')),intval($phpgw->common->show_date($recur_end,'Y'))); $str .= $phpgw->common->dateformatorder($year_html,$month_html,$day_html); - display_item(lang('Repeat End Date'),$str); + display_item($p,lang('Repeat End Date'),$str); $str = 'recur_data & M_SUNDAY) ?' checked':'').'> '.lang('Sunday').' '; $str .= 'recur_data & M_MONDAY) ?' checked':'').'> '.lang('Monday').' '; @@ -387,9 +383,9 @@ $str .= 'recur_data & M_FRIDAY) ?' checked':'').'> '.lang('Friday').' '; $str .= 'recur_data & M_SATURDAY) ?' checked':'').'> '.lang('Saturday').' '; - display_item(lang('Repeat Day').'
'.lang('(for weekly)'),$str); + display_item($p,lang('Repeat Day').'
'.lang('(for weekly)'),$str); - display_item(lang('Frequency'),''); + display_item($p,lang('Frequency'),''); $p->set_var('submit_button',lang('Submit')); @@ -406,12 +402,11 @@ ); $p->set_var($var); $p->parse('delete_button','form_button'); - $p->pparse('out','edit_entry_end'); } else { $p->set_var('delete_button',''); - $p->pparse('out','edit_entry_end'); } + $p->pparse('out','edit_entry'); $phpgw->common->phpgw_footer(); ?> diff --git a/calendar/templates/default/edit.tpl b/calendar/templates/default/edit.tpl index 8d334100aa..82b18f5a72 100755 --- a/calendar/templates/default/edit.tpl +++ b/calendar/templates/default/edit.tpl @@ -1,5 +1,5 @@ - +

{calendar_action}

@@ -13,16 +13,24 @@
- - -{output} - - +{row} {delete_button}
- - + + + + {field}: + {data} + + + + + + {hr_text} + + + diff --git a/calendar/templates/default/head.tpl b/calendar/templates/default/head.tpl index 95ae38f434..7135c6bc79 100755 --- a/calendar/templates/default/head.tpl +++ b/calendar/templates/default/head.tpl @@ -1,6 +1,6 @@ - +
{header_column}
diff --git a/calendar/templates/default/header.inc.php b/calendar/templates/default/header.inc.php index eeee49f371..843a12cde4 100755 --- a/calendar/templates/default/header.inc.php +++ b/calendar/templates/default/header.inc.php @@ -99,7 +99,7 @@ 'button_value' => lang('Go!') ); $tpl->set_var($var); - $tpl->parse('header_column','form_button_dropdown',True); + $tpl->fp('header_column','form_button_dropdown',True); } if(count($grants) > 0) diff --git a/calendar/templates/idsociety/header.inc.php b/calendar/templates/idsociety/header.inc.php index eeee49f371..843a12cde4 100755 --- a/calendar/templates/idsociety/header.inc.php +++ b/calendar/templates/idsociety/header.inc.php @@ -99,7 +99,7 @@ 'button_value' => lang('Go!') ); $tpl->set_var($var); - $tpl->parse('header_column','form_button_dropdown',True); + $tpl->fp('header_column','form_button_dropdown',True); } if(count($grants) > 0)