From: Bart Visscher Date: Wed, 14 Sep 2011 21:29:35 +0000 (+0200) Subject: Move php code out of part.eventform X-Git-Tag: v3.0~202 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b6c69e580a5f89026a59d380a4cfe42a84a53680;p=nextcloud-server.git Move php code out of part.eventform --- diff --git a/apps/calendar/ajax/newevent.php b/apps/calendar/ajax/newevent.php index 3c5f779b664..32fe964170f 100644 --- a/apps/calendar/ajax/newevent.php +++ b/apps/calendar/ajax/newevent.php @@ -34,7 +34,7 @@ $fromtime = $_POST["fromtime"]; $to = $_POST["to"]; $totime = $_POST["totime"]; $description = $_POST["description"]; -$repeat = $_POST["repeat"]; +//$repeat = $_POST["repeat"]; /*switch($_POST["repeatfreq"]){ case "DAILY": $repeatfreq = "DAILY"; @@ -154,4 +154,4 @@ if($errnum != 0){ $result = OC_Calendar_Calendar::addCalendarObject($cal, $data); echo json_encode(array("success"=>"true")); } -?> \ No newline at end of file +?> diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index b1cb6d5b816..d331be40e15 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -18,10 +18,75 @@ * MA 02111-1307 USA * *************************************************/ require_once('../../../lib/base.php'); + $l10n = new OC_L10N('calendar'); + if(!OC_USER::isLoggedIn()) { - die(""); + die(''); } -$output = new OC_TEMPLATE("calendar", "part.newevent"); -$output -> printpage(); -?> \ No newline at end of file + +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$categories = array( + $l10n->t('None'), + $l10n->t('Birthday'), + $l10n->t('Business'), + $l10n->t('Call'), + $l10n->t('Clients'), + $l10n->t('Deliverer'), + $l10n->t('Holidays'), + $l10n->t('Ideas'), + $l10n->t('Journey'), + $l10n->t('Jubilee'), + $l10n->t('Meeting'), + $l10n->t('Other'), + $l10n->t('Personal'), + $l10n->t('Projects'), + $l10n->t('Questions'), + $l10n->t('Work'), +); +$repeat_options = array( + 'doesnotrepeat' => $l10n->t('Does not repeat'), + 'daily' => $l10n->t('Daily'), + 'weekly' => $l10n->t('Weekly'), + 'weekday' => $l10n->t('Every Weekday'), + 'biweekly' => $l10n->t('Bi-Weekly'), + 'monthly' => $l10n->t('Monthly'), + 'yearly' => $l10n->t('Yearly'), +); +$startday = substr($_GET['d'], 0, 2); +$startmonth = substr($_GET['d'], 2, 2); +$startyear = substr($_GET['d'], 4, 4); +$starttime = $_GET['t']; +$allday = $starttime == 'allday'; +if($starttime != 'undefined' && !is_nan($starttime) && !$allday){ + $startminutes = '00'; +}elseif($allday){ + $starttime = '0'; + $startminutes = '00'; +}else{ + $starttime = date('H'); + $startminutes = date('i'); +} + +$endday = $startday; +$endmonth = $startmonth; +$endyear = $startyear; +$endtime = $starttime; +$endminutes = $startminutes; +if($endtime == 23) { + $endday++; + $endtime = 0; +} else { + $endtime++; +} + +$tmpl = new OC_Template('calendar', 'part.newevent'); +$tmpl->assign('calendars', $calendars); +$tmpl->assign('categories', $categories); +$tmpl->assign('startdate', $startday . '-' . $startmonth . '-' . $startyear); +$tmpl->assign('starttime', ($starttime <= 9 ? '0' : '') . $starttime . ':' . $startminutes); +$tmpl->assign('enddate', $endday . '-' . $endmonth . '-' . $endyear); +$tmpl->assign('endtime', ($endtime <= 9 ? '0' : '') . $endtime . ':' . $endminutes); +$tmpl->assign('allday', $allday); +$tmpl->printpage(); +?> diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index 772cc2c7915..450f6417624 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -16,97 +16,59 @@ t("Category");?>: - + ' . $category . ''; + } + ?>    t("Calendar");?>:
- -
- id="newcalendar_allday_checkbox"> - document.getElementById(\"fromtime\").disabled = true;document.getElementById(\"totime\").disabled = true;document.getElementById(\"fromtime\").style.color = \"#A9A9A9\";document.getElementById(\"totime\").style.color = \"#A9A9A9\";";}?> + id="newcalendar_allday_checkbox"> + document.getElementById("fromtime").disabled = true;document.getElementById("totime").disabled = true;document.getElementById("fromtime").style.color = "#A9A9A9";document.getElementById("totime").style.color = "#A9A9A9";';}?>
t("From");?>: - " id="from"> +    - " id="fromtime"> +
t("To");?>: - " id="to"> +    - " id="totime"> +