Added:
trunk/edit-entry.php (contents, props changed)
- copied, changed from r706, /trunk/edit_entry.php
trunk/schoorbs-misc/themes/contented6/contented6.js
trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php
Removed:
trunk/edit_entry.php
trunk/schoorbs-misc/gfx/list-add-small.png
trunk/schoorbs-misc/gfx/microformat_hcalendar.png
trunk/schoorbs-misc/js/editentry.js
trunk/schoorbs-misc/js/jquery.idTabs.pack.js
trunk/schoorbs-misc/templates/accessdenied.tpl
trunk/schoorbs-misc/templates/edit_entry.tpl
Modified:
trunk/schoorbs-includes/authentication/schoorbs_auth.php
trunk/schoorbs-includes/database/entry.class.php
trunk/schoorbs-includes/schoorbstpl.class.php
trunk/schoorbs-misc/themes/contented6/day-view.tpl.php
trunk/schoorbs-misc/themes/contented6/document.tpl.php
trunk/schoorbs-misc/themes/contented6/style.css
trunk/schoorbs-misc/themes/contented6/view-entry.tpl.php
trunk/schoorbs-misc/themes/contented6/week-view.tpl.php
Log:
Updated edit_entry.php to new template system
Copied: trunk/edit-entry.php (from r706, /trunk/edit_entry.php)
==============================================================================
--- /trunk/edit_entry.php (original)
+++ trunk/edit-entry.php Mon Nov 3 08:19:01 2008
@@ -15,10 +15,13 @@
require_once 'schoorbs-includes/global.web.php';
/** The general functions */
require_once 'schoorbs-includes/global.functions.php';
+/** The modern ORM databse layer */
+require_once 'schoorbs-includes/database/schoorbsdb.class.php';
+/** The template system */
+require_once 'schoorbs-includes/schoorbstpl.class.php';
+
/** The database wrapper */
require_once "schoorbs-includes/database/$dbsys.php";
-/** The authetication wrappers */
-require_once 'schoorbs-includes/authentication/schoorbs_auth.php';
/** Database helper functions */
require_once 'schoorbs-includes/database/schoorbs_sql.php';
@@ -26,221 +29,44 @@
/// Var Init ///
/** day, month, year */
-list($day, $month, $year) = input_DayMonthYear();
-/** area */
-$area = input_Area();
-/** room */
-$room = input_Room();
-/** id **/
-if(isset($_REQUEST['id'])) $id = intval($_REQUEST['id']);
+list($nDay, $nMonth, $nYear) = input_DayMonthYear();
-if (isset($_REQUEST['edit_type'])) {
- $edit_type = trim(strtolower($_REQUEST['edit_type']));
-} else {
- $edit_type = '';
+/** id **/
+if(isset($_REQUEST['id'])) {
+ $nId = intval($_REQUEST['id']);
}
-
/// Main ///
if (!getAuthorised(1)) showAccessDenied();
-// We need to know:
-// Name of booker
-// Description of meeting
-// Date (option select box for day, month, year)
-// Time
-// Duration
-// Internal/External
-
-// Firstly we need to know if this is a new booking or modifying an old one
-// and if it's a modification we need to get all the old data from the db.
-// If we had $id passed in then it's a modification.
-if (isset($id)) {
- $sQuery = sprintf(
- 'SELECT name, create_by, description, start_time, end_time, type, '
- .'room_id, entry_type, repeat_id FROM %s WHERE id = %d',
- $tbl_entry, $id
- );
- $res = sql_query($sQuery);
- if (!$res) fatal_error(true, sql_error());
- if (sql_count($res) != 1) {
- fatal_error(true, get_vocab('entryid').$id.get_vocab('not_found'));
- }
-
- $row = sql_row($res, 0);
- sql_free($res);
-
- // Note: Removed stripslashes() calls from name and description. Previous
- // versions of MRBS mistakenly had the backslash-escapes in the actual
database
- // records because of an extra addslashes going on. Fix your database and
- // leave this code alone, please.
- $name = $row[0];
- $create_by = $row[1];
- $description = $row[2];
- $start_day = strftime('%d', $row[3]);
- $start_month = strftime('%m', $row[3]);
- $start_year = strftime('%Y', $row[3]);
- $start_hour = strftime('%H', $row[3]);
- $start_min = strftime('%M', $row[3]);
- $duration = $row[4] - $row[3] - cross_dst($row[3], $row[4]);
- $type = $row[5];
- $room_id = $row[6];
- $entry_type = $row[7];
- $rep_id = $row[8];
-
- if ($entry_type >= 1) {
- $res = sql_query(sprintf(
- 'SELECT rep_type, start_time, end_date, rep_opt, rep_num_weeks '
- .'FROM %s WHERE id = %d',
- $tbl_repeat, $rep_id
- ));
- if (!$res) fatal_error(1, sql_error());
- if (sql_count($res) != 1) {
- fatal_error(true, get_vocab('repeat_id').$rep_id
- .get_vocab('not_found'));
- }
-
- $row = sql_row($res, 0);
- sql_free($res);
-
- $rep_type = $row[0];
-
- if ($edit_type == 'series') {
- $start_day = intval(strftime('%d', $row[1]));
- $start_month = intval(strftime('%m', $row[1]));
- $start_year = intval(strftime('%Y', $row[1]));
- $rep_end_day = intval(strftime('%d', $row[2]));
- $rep_end_month = intval(strftime('%m', $row[2]));
- $rep_end_year = intval(strftime('%Y', $row[2]));
-
- switch($rep_type) {
- case 2:
- case 6:
- $rep_day[0] = $row[3][0] != '0';
- $rep_day[1] = $row[3][1] != '0';
- $rep_day[2] = $row[3][2] != '0';
- $rep_day[3] = $row[3][3] != '0';
- $rep_day[4] = $row[3][4] != '0';
- $rep_day[5] = $row[3][5] != '0';
- $rep_day[6] = $row[3][6] != '0';
-
- if ($rep_type == 6) {
- $rep_num_weeks = $row[4];
- }
- break;
- default: $rep_day = array(0, 0, 0, 0, 0, 0, 0);
- }
- } else {
- $rep_type = $row[0];
- $rep_end_date = utf8_strftime('%A %d %B %Y',$row[2]);
- $rep_opt = $row[3];
- }
- }
+if (isset($nId)) {
+ $oEntry = Entry::getById($nId);
} else {
- // It is a new booking. The data comes from whichever button the user
clicked
- $edit_type = 'series';
- $name = '';
- $create_by = getUserName();
- $description = '';
- $start_day = $day;
- $start_month = $month;
- $start_year = $year;
- // Avoid notices for $hour and $minute if periods is enabled
- if (isset($_REQUEST['hour'])) $start_hour = intval($_REQUEST['hour']);
- elseif ($enable_periods) $start_hour = 12;
- if (isset($_REQUEST['minute'])) $start_min = intval($_REQUEST['minute']);
- elseif (isset($_REQUEST['period']) && $enable_periods) {
- $start_min = intval($_REQUEST['period']);
+ $oEntry = null;
+
+ // Get the hour which the user selected to book
+ if (isset($_REQUEST['hour'])) {
+ $nHour = intval($_REQUEST['hour']);
+ } else {
+ $nHour = 12;
}
- $duration = ($enable_periods ? 60 : 60 * 60);
- $type = 'I';
- $room_id = $room;
- $id = -1;
-
- $rep_id = 0;
- $rep_type = 0;
- $rep_end_day = $day;
- $rep_end_month = $month;
- $rep_end_year = $year;
- $rep_day = array(0, 0, 0, 0, 0, 0, 0);
-}
-
-// These next 4 if statements handle the situation where
-// this page has been accessed directly and no arguments have
-// been passed to it.
-// If we have not been provided with starting time
-if (empty($start_hour) && ($morningstarts < 10)) {
- $start_hour = "0$morningstarts";
-}
-if (empty($start_hour)) $start_hour = "$morningstarts";
-if (empty($start_min)) $start_min = '00';
-if (!isset($rep_num_weeks)) {
- $rep_num_weeks = '';
-}
-
-if ($enable_periods) {
- toPeriodString($start_min, $duration, $dur_units);
-} else {
- toTimeString($duration, $dur_units);
-}
-// now that we know all the data to fill the form with we start drawing it
-if (!getWritable($create_by, getUserName())) showAccessDenied();
-
-print_header();
-
-// Determine the area id of the room in question first
-$area_id = mrbsGetRoomArea($room_id);
-// determine if there is more than one area
-$sQuery = 'SELECT id FROM '.$tbl_area;
-$res = sql_query($sQuery);
-$num_areas = sql_count($res);
-// if there is more than one area then give the option
-// to choose areas.
-$change_room_js_add = ''; $js_add1 = '';
-if ($num_areas > 1) {
- // get the area id for case statement
- $sQuery = "SELECT id, area_name FROM $tbl_area ORDER BY area_name";
- $res = sql_query($sQuery);
- if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) {
- $change_room_js_add.= ' case "'.$row[0]."\":\n";
- // get rooms for this area
- $res2 = sql_query(sprintf(
- 'SELECT id, room_name FROM %s WHERE area_id = %d ORDER BY
room_name',
- $tbl_room, $row[0]
- ));
- if ($res2) for ($j = 0; ($row2 = sql_row($res2, $j)); $j++) {
- $change_room_js_add.= " roomsObj.options[$j] = new
Option(\"".str_replace('"','\\"',$row2[1]).'",'.$row2[0] .")\n";
- }
- // select the first entry by default to ensure
- // that one room is selected to begin with
- $change_room_js_add.= " roomsObj.options[0].selected = true\n";
- $change_room_js_add.= " break\n";
+ // Get the minute which the user selected to book
+ if (isset($_REQUEST['minute'])) {
+ $nMinute = intval($_REQUEST['minute']);
+ } else {
+ $nMinute = 0;
}
- // get list of areas
- $sql = "SELECT id, area_name FROM $tbl_area ORDER BY area_name";
- $res = sql_query($sql);
- if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) {
- $selected = '';
- if ($row[0] == $area_id) {
- $selected = "selected=\\\"selected\\\"";
- }
- $js_add1.= "this.document.writeln(\" <option $selected
value=\\\"".$row[0]."\\\">".$row[1]."\")\n";
+ // Get the period which the user selected to book
+ if (isset($_REQUEST['period']) && $enable_periods) {
+ SchoorbsTPL::populateVar('referencePeriod', intval($_REQUEST['period']));
}
+ SchoorbsTPL::populateVar('referenceTime', mktime($nHour, $nMinute, 0,
$nMonth, $nDay, $nYear));
}
-// select the rooms in the area determined above
-$res = sql_query(sprintf(
- 'SELECT id, room_name FROM %s WHERE area_id = %d ORDER BY room_name',
- $tbl_room, $area_id
-));
-$aRooms = array();
-if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++) {
- $aRooms[] = array('id' => $row[0], 'name' => $row[1]);
-}
-
+// Get all booking types
$aTypes = array();
for ($c = 'A'; $c <= 'Z'; $c++) {
if (isset($typel[$c]) && (!empty($typel[$c]))) {
@@ -248,88 +74,6 @@
}
}
-$aRepTypes = array(); $aRepDays = array();
-if ($edit_type == 'series') {
- for ($i = 0; isset($vocab["rep_type_$i"]); $i++) {
- $aRepTypes[] = array('text' => get_vocab("rep_type_$i"), 'id' => $i);
- }
- // Display day name checkboxes according to language and preferred
weekday start.
- for ($i = 0; $i < 7; $i++) {
- $wday = ($i + $weekstarts) % 7;
- if ($rep_day[$wday]) {
- $checked = 'true';
- } else {
- $checked = 'false';
- }
- $aRepDays[] = array('checked' => $checked, 'wday' => $wday, 'name' =>
day_name($wday));
- }
-} else {
- $key = 'rep_type_'.(isset($rep_type) ? $rep_type : "0");
-
- $smarty->assign('rep_key',$key);
- $sRepAdd = '';
- if(isset($rep_type) && ($rep_type != 0)) {
- $opt = "";
- if ($rep_type == 2) {
- // Display day names according to language and preferred weekday start.
- for ($i = 0; $i < 7; $i++) {
- $wday = ($i + $weekstarts) % 7;
- if ($rep_opt[$wday]) $opt .= day_name($wday) . " ";
- }
- }
- if($opt) $sRepAdd.= '<tr><td
class="CR"><strong>'.get_vocab('rep_rep_day')."</strong></td><td
class=\"CL\">$opt</td></tr>\n";
-
- $sRepAdd.= '<tr><td
class="CR"><strong>'.get_vocab('rep_end_date')."</strong></td><td
class=\"CL\">$rep_end_date</td></tr>\n";
- }
- $smarty->assign('rep_add', $sRepAdd);
-}
-
-/* We display the rep_num_weeks box only if:
- - this is a new entry ($id is not set)
- Xor
- - we are editing an existing repeating entry ($rep_type is set and
- $rep_type != 0 and $edit_type == "series" )
-*/
-if(($id == -1) || (isset($rep_type) && ($rep_type != 0) && ('series' ==
$edit_type))) {
- $smarty->assign('display_rep_num_week', 'true');
- $smarty->assign('rep_num_weeks', $rep_num_weeks);
-} else {
- $smarty->assign('display_rep_num_week','false');
-}
-
-$smarty->assign(array(
- 'rep_days' => $aRepDays,
- 'rep_end_day' => $rep_end_day,
- 'rep_end_month' => $rep_end_month,
- 'rep_end_year' => $rep_end_year,
- 'rep_types' => $aRepTypes,
- 'rep_type' => $rep_type,
- 'rep_id' => $rep_id,
- 'edit_type' => $edit_type,
- 'type' => $type,
- 'types' => $aTypes,
- 'change_room_js_add' => $change_room_js_add,
- 'rooms' => $aRooms,
- 'room_id' => $room_id,
- 'js_add1' => $js_add1,
- 'num_areas' => $num_areas,
- 'enable_periods' => ($enable_periods ? 'true' : 'false'),
- 'twentyfourhour_format' => ($twentyfourhour_format ? 'true' : 'false'),
- 'id' => $id,
- 'edit_type' => $edit_type,
- 'name' => $name,
- 'description' => $description,
- 'start_day' => $start_day,
- 'start_month' => $start_month,
- 'start_year' => $start_year,
- 'start_hour' => $start_hour,
- 'start_min' => $start_min,
- 'periods' => $periods,
- 'duration' => $duration,
- 'dur_units' => $dur_units,
- 'create_by' => $create_by
-));
-
-$smarty->display('edit_entry.tpl');
-
-require_once 'schoorbs-includes/trailer.php';
+SchoorbsTPL::populateVar('types', $aTypes);
+SchoorbsTPL::populateVar('entry', $oEntry);
+SchoorbsTPL::renderPage('edit-entry');
Modified: trunk/schoorbs-includes/authentication/schoorbs_auth.php
==============================================================================
--- trunk/schoorbs-includes/authentication/schoorbs_auth.php (original)
+++ trunk/schoorbs-includes/authentication/schoorbs_auth.php Mon Nov 3
08:19:01 2008
@@ -74,9 +74,6 @@
*/
function showAccessDenied()
{
- global $smarty;
-
- print_header();
- $smarty->display('accessdenied.tpl');
- exit();
+ SchoorbsTPL::error(Lang::_('Access Denied').' - '
+ .Lang::_('You do not have access rights to modify this item.'));
}
Modified: trunk/schoorbs-includes/database/entry.class.php
==============================================================================
--- trunk/schoorbs-includes/database/entry.class.php (original)
+++ trunk/schoorbs-includes/database/entry.class.php Mon Nov 3 08:19:01
2008
@@ -333,7 +333,15 @@
/**
* Return the starttime of this entry
- *
+ *public static function formatTimePeriodString($nTime) {
+ global $periods;
+
+ $aTime = getdate($nTime);
+ $nPnum = $aTime['minutes'];
+ if($nPnum < 0 ) $nPnum = 0;
+ if($nPnum >= count($periods) - 1) $nPnum = count($periods) - 1;
+ return $periods[$nPnum];
+ }
* @author Uwe L. Korn <uw...@xhochy.org>
* @return int Unix Timestamp
*/
@@ -586,5 +594,22 @@
}
return sprintf('%d %s', $nDuration, $sUnits);
+ }
+
+ /**
+ * Get the starting period of this entry.
+ *
+ * Returns an integer from 0..(count(periods)-1), if
+ * the value is higher than count(periods)-1 then
+ * count(periods)-1 is returned.
+ *
+ * @return int
+ * @author Uwe L. Korn <uw...@xhochy.org>
+ */
+ public function getStartPeriod() {
+ $aTime = getdate($this->nStartTime);
+ $nPnum = $aTime['minutes'];
+ if($nPnum >= count($periods) - 1) $nPnum = count($periods) - 1;
+ return $nPnum;
}
}
Modified: trunk/schoorbs-includes/schoorbstpl.class.php
==============================================================================
--- trunk/schoorbs-includes/schoorbstpl.class.php (original)
+++ trunk/schoorbs-includes/schoorbstpl.class.php Mon Nov 3 08:19:01 2008
@@ -330,4 +330,57 @@
return 'yes-no.php?question='.urlencode($sQuestion).'&referto='
.urlencode($sReferTo).'&returnto='.urlencode($sReturnTo);
}
+
+ /**
+ * Generates a Date selector with 3 select elements.
+ *
+ * The select elements will have the following names/ids:
+ * - <prefix>day
+ * - <prefix>month
+ * - <prefix>year
+ *
+ * @author Uwe L. Korn <uw...@xhochy.com>
+ * @param $sPrefix string
+ * @param $nDate int
+ * @return string
+ */
+ public static function generateDateSelector($sPrefix, $nDate) {
+ // Get seperate Day, Month, Year values
+ $nDay = intval(date('j', $nDate));
+ $nMonth = intval(date('n', $nDate));
+ $nYear = intval(date('Y', $nDate));
+
+ // Make the day select element
+ //
+ // Make 31 always day-options, let JavaScript fit it always to
+ // right amount. If there is no JavaScript available, this
+ // ensures that there are always enough days to select.
+ $sOut = '<select class="schoorbstpl-dateselector-day"
name="'.$sPrefix.'day" id="'.$sPrefix.'day">';
+ for ($i = 1; $i <= 31; $i++) {
+ $sOut.= '<option'.($i == $nDay ? '
selected="selected"' : '').'>'.$i.'</option>';
+ }
+ $sOut.= '</select>';
+
+ // Make the month select element
+ $sOut.= '<select class="schoorbstpl-dateselector-month"
name="'.$sPrefix.'month" id="'.$sPrefix.'month">';
+ for ($i = 1; $i <= 12; $i++) {
+ $sMonth = Lang::_(date('M', mktime(12, 0, 0, $i, 1, 2000)));
+ $sOut.= '<option value="'.$i.'"'.($i == $nMonth ? '
selected="selected"' : '').'>'.$sMonth.'</option>';
+ }
+ $sOut.= '</select>';
+
+ // Start from the lower of (Today, StartTime) - 5 years
+ $nMinYear = min($nYear, date('Y')) - 5;
+ // to the upper of (Today, EndTime) + 5 years)
+ $nMaxYear = max($nYear, date('Y')) + 5;
+
+ // Make the year select element
+ $sOut.= '<select class="schoorbstpl-dateselector-year"
name="'.$sPrefix.'year" id="'.$sPrefix.'year">';
+ for($i = $nMinYear; $i <= $nMaxYear; $i++) {
+ $sOut.= '<option value="'.$i.'"'.($i == $nYear ? '
selected="selected"' : '').'>'.$i.'</option>';
+ }
+ $sOut.= '</select>';
+
+ return $sOut;
+ }
}
Added: trunk/schoorbs-misc/themes/contented6/contented6.js
==============================================================================
--- (empty file)
+++ trunk/schoorbs-misc/themes/contented6/contented6.js Mon Nov 3 08:19:01
2008
@@ -0,0 +1,71 @@
+// Handle the special case february
+function daysInFebruary (year) {
+ // February has 28 days unless the year is divisible by four,
+ // and if it is the turn of the century then the century year
+ // must also be divisible by 400 when it has 29 days
+ return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 ==
0))) ? 29 : 28 );
+}
+
+// Calculate how many days the specified month in the specified year has
+function DaysInMonth(WhichMonth, WhichYear) {
+ var DaysInMonth = 31;
+ if (WhichMonth == "4" || WhichMonth == "6" || WhichMonth == "9" ||
WhichMonth == "11")
+ DaysInMonth = 30;
+ if (WhichMonth == "2")
+ DaysInMonth = daysInFebruary( WhichYear );
+ return DaysInMonth;
+}
+
+$(document).ready(function() {
+ /** Assign all DateSelector onChange-handlers **/
+ $('select.schoorbstpl-dateselector-month,
select.schoorbstpl-dateselector-year').each(function() {
+ $(this).change(function() {
+ // Get the prefix of this element group
+ var groupPrefix = $(this).attr('id').replace(/(year)|(month)$/, '');
+
+ // Get 3 elements of this group
+ var dayObject = $('#'+ groupPrefix + 'day');
+ var monthObject = $('#'+ groupPrefix + 'month');
+ var yearObject = $('#'+ groupPrefix + 'year');
+
+ var DaySelIdx = parseInt(dayObject.val());
+ var Month = parseInt(monthObject.val());
+ var Year = parseInt(yearObject.val());
+
+ var DaysForThisSelection = DaysInMonth(Month, Year);
+ var CurrentDaysInSelection = dayObject.children('option').length;
+
+ // We have to many days, so remove some at the end
+ if (CurrentDaysInSelection > DaysForThisSelection) {
+ for (i = 0; i < (CurrentDaysInSelection - DaysForThisSelection); i++) {
+ var children = dayObject.children('option');
+ var lastIndex = dayObject.children('option').length - 1;
+ var lastChild = children.get(lastIndex);
+ // Since we cannot remove elements in all browser cleany,
+ // we will just hide it and assume, that a user will not
+ // change the date that often that he memory will not last.
+ // There might have to be about >10 000 changes to fill the
+ // memory, so we can ignore it at the moment.
+ $(lastChild).remove();
+ }
+ }
+
+ // We do not have enough days, so add some at the end
+ if (DaysForThisSelection > CurrentDaysInSelection) {
+ for (i = 0; i < DaysForThisSelection; i++) {
+ $('<option value="' + (i + 1) + '">' + (i + 1)
+ '</option>').appendTo(dayObject);
+ }
+ }
+
+ if (DaySelIdx >= DaysForThisSelection) {
+ // If a day was selected that now no longer
+ // exists, selected the last day.
+ dayObject.val(DaysForThisSelection);
+ } else {
+ // Restore the selected day
+ dayObject.val(DaySelIdx);
+ }
+ });
+ $(this).change();
+ });
+});
Modified: trunk/schoorbs-misc/themes/contented6/day-view.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/day-view.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/day-view.tpl.php Mon Nov 3
08:19:01 2008
@@ -31,7 +31,7 @@
<?php echo $mEntry->getName(); ?>
<?php } else { ?>
<td class="schoorbs-day-matrix-free">
- <a href="edit_entry.php?room=<?php echo $room->getId();
+ <a href="edit-entry.php?room=<?php echo $room->getId();
?>&day=<?php echo date('d', $entryTime[$sTime]);
?>&month=<?php echo date('n', $entryTime[$sTime]);
?>&year=<?php echo date('Y', $entryTime[$sTime]);
Modified: trunk/schoorbs-misc/themes/contented6/document.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/document.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/document.tpl.php Mon Nov 3
08:19:01 2008
@@ -7,7 +7,8 @@
<?php SchoorbsTPL::includeCSS('style.css'); ?>
<?php
SchoorbsTPL::includeCSS('yui-2.5.2/build/calendar/assets/skins/sam/calendar.css'); ?>
<?php SchoorbsTPL::includeJS('jquery-1.2.6.pack.js'); ?>
- <?php
SchoorbsTPL::includeJS('jquery-ui-personalized-1.5.2.packed.js'); ?>
+ <?php
SchoorbsTPL::includeJS('jquery-ui-personalized-1.5.2.packed.js'); ?>
+ <?php SchoorbsTPL::includeJS('contented6.js'); ?>
</head>
<body class="yui-skin-sam">
<?php SchoorbsTPL::render('header'); ?>
Added: trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php
==============================================================================
--- (empty file)
+++ trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php Mon Nov 3
08:19:01 2008
@@ -0,0 +1,115 @@
+<?php
+/**
+ * @todo Support series
+ */
+?>
+<div id="schoorbs-largecenteredbox">
+ <span class="headline">
+ <?php echo Lang::_($entry == null ? 'Add Entry' : 'Edit Entry'); ?>
+ </span>
+ <br /><br />
+ <div class="form">
+ <form method="post" action="<?php echo
self::makeInternalUrl('edit_entry_handler.php'); ?>">
+ <label for="main-name"><?php echo Lang::_('Brief
Description:'); ?></label> <input type="text" id="main-name" name="name"
value="<?php echo htmlentities($entry == null ? '' :
$oEntry->getName()); ?>" /><br />
+ <label for="main-description" style="width: 400px;"><?php echo
preg_replace('/\<br\s*\/?\>/i', '', Lang::_('Full Description:<br
/> (Number of people,<br /> Internal/External
etc)')); ?></label><br />
+ <textarea id="main-description" name="description" rows="8"
cols="40"><?php echo htmlentities($entry == null ? '' :
$oEntry->getDescription()); ?></textarea><br />
+ <label for="main-date"><?php echo Lang::_('Date:'); ?></label> <?php
echo SchoorbsTPL::generateDateSelector('edit_', ($entry == null ?
$referenceTime : $oEntry->getStartTime())); ?><br />
+ <?php if (Entry::perioded()) { ?>
+ <label for="main-period"><?php echo Lang::_('Period:'); ?></label>
+ <select name="period" id="main-period">
+ <?php for ($i = 0; $i < count($GLOBALS['periods']); $i++) { ?>
+ <option value="<?php echo $i ?>"<?php echo ($entry == null ?
$referencePeriod : ($i == $entry->getStartPeriod() ? '
selected="selected"' : '')); ?>><?php echo
$GLOBALS['periods'][$i]; ?></option>
+ <?php } ?>
+ </select>
+ <?php } else { ?>
+ <label for="main-hour"><?php echo Lang::_('Time:'); ?></label>
+ <input id="main-hour" name="hour" size="3" value="<?php echo
date('G', ($entry == null ? $referenceTime : $entry->getStartTime())); ?>"
maxlength="2" />
+ :
+ <input id="main-minute" name="minute" size="3" value="<?php echo
date('i', ($entry == null ? $referenceTime : $entry->getStartTime())); ?>"
maxlength="2" />
+ <?php } ?> <br />
+ <label for="main-duration"><?php echo
Lang::_('Duration:'); ?></label>
+ <?php
+ if ($entry != null) {
+ list($sDuration, $sDurationUnit) = explode(' ',
$entry->getDurationString());
+ } else {
+ $sDuration = 1;
+ $sDurationUnit =
Lang::_(Entry::perioded() ? 'periods' : 'minutes');
+ }
+ ?>
+ <input id="main-duration" name="duration" size="3" value="<?php echo
$sDuration; ?>" />
+ <select id="main-dur-units" name="dur_units" style="width: 100px">
+ <?php if (Entry::perioded()) { ?>
+ <option value="periods"<?php echo (Lang::_('periods') ==
$sDurationUnit ? ' selected="selected"' : ''); ?>><?php echo
Lang::_('periods'); ?></option>
+ <option value="days"<?php echo (Lang::_('days') ==
$sDurationUnit ? ' selected="selected"' : ''); ?>><?php echo
Lang::_('days'); ?></option>
+ <?php } else { ?>
+ <option value="minutes"<?php echo (Lang::_('minutes') ==
$sDurationUnit ? ' selected="selected"' : '') ?>><?php echo
Lang::_('minutes'); ?></option>
+ <option value="hours"<?php echo (Lang::_('hours') ==
$sDurationUnit ? ' selected="selected"' : '') ?>><?php echo
Lang::_('hours'); ?></option>
+ <option value="days"<?php echo (Lang::_('days') ==
$sDurationUnit ? ' selected="selected"' : '') ?>><?php echo
Lang::_('days'); ?></option>
+ <option value="weeks"<?php echo (Lang::_('weeks') ==
$sDurationUnit ? ' selected="selected"' : '') ?>><?php echo
Lang::_('weeks'); ?></option>
+ <?php } ?>
+ </select><br />
+ <label for="main-all-day"><?php echo Lang::_('All day'); ?>:</label>
<input name="all_day" id="main-all-day" type="checkbox" value="yes" /><br />
+ <label for="main-rooms"><?php echo Lang::_('Rooms'); ?>:</label><br
/>
+ <select name="rooms[]" id="main-rooms" multiple="multiple" size="5"
style="width: 300px;">
+ <?php $nActiveRoom = ($entry == null ? input_Room() :
$entry->getRoom()->getId()); ?>
+ <?php foreach (Area::getAreas() as $oArea) { ?>
+ <optgroup label="<?php echo $oArea->getName(); ?>">
+ <?php foreach (Room::getRooms($oArea) as $oRoom) { ?>
+ <option value="<?php $oRoom->getId(); ?>"<?php if
($oRoom->getId() == $nActiveRoom) echo '
selected="selected"'; ?>> <?php echo
$oRoom->getName(); ?></option>
+ <?php } ?>
+ </optgroup>
+ <?php } ?>
+ </select><br />
+ <label for="main-minute" style="width: 400px;"><?php echo
Lang::_('Use Control-Click to select more than one type'); ?></label><br />
+ <label for="main-type"><?php echo Lang::_('Type:'); ?></label>
+ <select id="main-type" name="type">
+ <?php
+ if ($entry == null) {
+ // Internal is the default type
+ $sTypeC = 'I';
+ } else {
+ $sTypeC = $entry->getType();
+ }
+ ?>
+ <?php foreach ($types as $aType) { ?>
+ <option value="<?php echo $aType['c']; ?>"<?php echo ($sTypeC ==
$aType['c'] ? ' selected="selected"' : ''); ?>><?php echo
$aType['text']; ?></option>
+ <?php } ?>
+ </select><br />
+ <label for="main-reptype"><?php echo Lang::_('Repeat
Type:'); ?></label><br />
+ <?php
+ if ($entry == null) {
+ $nRepType = 0;
+ } else {
+ $nRepType = $entry->getRepType();
+ }
+ ?>
+ <input name="reptype" type="radio" value="0"<?php echo ($nRepType ==
0 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('None'); ?>
+ <input name="reptype" type="radio" value="1"<?php echo ($nRepType ==
1 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('Daily'); ?>
+ <input name="reptype" type="radio" value="2"<?php echo ($nRepType ==
2 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('Weekly'); ?>
+ <input name="reptype" type="radio" value="3"<?php echo ($nRepType ==
3 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('Monthly'); ?>
+ <input name="reptype" type="radio" value="4"<?php echo ($nRepType ==
4 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('Yearly'); ?><br />
+ <input name="reptype" type="radio" value="5"<?php echo ($nRepType ==
5 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('Monthly,
corresponding day'); ?>
+ <input name="reptype" type="radio" value="6"<?php echo ($nRepType ==
6 ? ' checked="checked"' : ''); ?> /> <?php echo Lang::_('n-Weekly'); ?><br
/>
+ <label for="rep_end_day" style="width: 200px"><?php echo
Lang::_('Repeat End Date:'); ?></label> <?php echo
SchoorbsTPL::generateDateSelector('rep_end_', ($entry == null ?
$referenceTime : $oEntry->getEndTime())); ?><br />
+ <label for="main-rep_day_1" style="width: 300px"><?php echo
Lang::_('Repeat Day:'); ?> <?php echo Lang::_('(for
(n-)weekly)'); ?></label><br />
+ <input id="main-rep_day_1" name="rep_day[1]" type="checkbox" />
<?php echo Lang::_('Monday'); ?>
+ <input name="rep_day[2]" type="checkbox" /> <?php echo
Lang::_('Tuesday'); ?>
+ <input name="rep_day[3]" type="checkbox" /> <?php echo
Lang::_('Wednesday'); ?>
+ <input name="rep_day[4]" type="checkbox" /> <?php echo
Lang::_('Thursday'); ?><br />
+ <input name="rep_day[5]" type="checkbox" /> <?php echo
Lang::_('Friday'); ?>
+ <input name="rep_day[6]" type="checkbox" /> <?php echo
Lang::_('Saturday'); ?>
+ <input name="rep_day[0]" type="checkbox" /> <?php echo
Lang::_('Sunday'); ?><br />
+ <label for="main-rep-num-weeks" style="width: 250px"><?php echo
Lang::_('Number of weeks'); ?> <?php echo Lang::_('(for
n-weekly)'); ?></label>
+ <input type="text" id="main-rep-num-weeks" name="rep_num_weeks"
value="1" size="4" /><br /><br />
+ <!-- <input type="hidden" id="main-rep-id" name="rep_id"
value="{$rep_id}" /> -->
+ <?php if (isset($_SERVER['HTTP_REFERER'])) { ?>
+ <input type="hidden" name="returl" value="<?php echo
htmlentities($_SERVER['HTTP_REFERER']); ?>" />
+ <?php } ?>
+ <?php if ($entry != null) { ?>
+ <input type="hidden" id="main-id" name="id" value="<?php echo
$entry->getId(); ?>" />
+ <?php } ?>
+ <input type="submit"value="<?php echo Lang::_('Save'); ?>" />
+ </form>
+ </div>
+</div>
+</form>
Modified: trunk/schoorbs-misc/themes/contented6/style.css
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/style.css (original)
+++ trunk/schoorbs-misc/themes/contented6/style.css Mon Nov 3 08:19:01 2008
@@ -216,6 +216,30 @@
width: 100px;
}
+
+#schoorbs-largecenteredbox {
+ border: 1px solid #aaa;
+ margin: 50px auto;
+ width: 470px;
+ padding: 4px;
+ background-color: #f0f0f0;
+ color: #000;
+}
+
+#schoorbs-largecenteredbox .headline {
+ font-weight: bold;
+ font-size: 1.2em;
+}
+
+#schoorbs-largecenteredbox .form {
+ text-align: center;
+}
+
+#schoorbs-largecenteredbox label {
+ display: inline-block;
+ width: 150px;
+}
+
#schoorbs-yes-no-box {
border: 1px solid #aaa;
margin: 50px auto;
Modified: trunk/schoorbs-misc/themes/contented6/view-entry.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/view-entry.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/view-entry.tpl.php Mon Nov 3
08:19:01 2008
@@ -94,12 +94,12 @@
<br />
</div>
-<a href="edit_entry.php?id=<?php echo $entry->getId(); ?>">
+<a href="edit-entry.php?id=<?php echo $entry->getId(); ?>">
<?php echo Lang::_('Edit Entry'); ?>
</a>
<?php if ($entry->isRepeated()) { ?>
-
- <a href="edit_entry.php?id=<?php echo
$entry->getId(); ?>&edit_type=series"><?php echo Lang::_('Edit
Series'); ?></a>
+ <a href="edit-entry.php?id=<?php echo
$entry->getId(); ?>&edit_type=series"><?php echo Lang::_('Edit
Series'); ?></a>
<?php } ?>
<br />
Modified: trunk/schoorbs-misc/themes/contented6/week-view.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/week-view.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/week-view.tpl.php Mon Nov 3
08:19:01 2008
@@ -43,7 +43,7 @@
<a href="view-entry.php?id=<?php echo
$entries[$nDay][$sTime]->getId(); ?>">
<?php } else { ?>
<td class="schoorbs-week-matrix-free">
- <a href="edit_entry.php?room=<?php echo $room->getId();
+ <a href="edit-entry.php?room=<?php echo $room->getId();
?>&day=<?php echo date('d', $entryTime[$nDay][$sTime]);
?>&month=<?php echo date('n', $entryTime[$nDay][$sTime]);
?>&year=<?php echo date('Y', $entryTime[$nDay][$sTime]);