Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2011-09-15 01:29:35 +0400
committerBart Visscher <bartv@thisnet.nl>2011-09-15 01:36:23 +0400
commitb6c69e580a5f89026a59d380a4cfe42a84a53680 (patch)
treebf6009ea4491124dbd3e69028758552c3704fe2f /apps/calendar
parentcb9a67906d53110f8c98ef6a8743fc2ecc8ba13f (diff)
Move php code out of part.eventform
Diffstat (limited to 'apps/calendar')
-rw-r--r--apps/calendar/ajax/newevent.php4
-rw-r--r--apps/calendar/ajax/neweventform.php73
-rw-r--r--apps/calendar/templates/part.eventform.php76
3 files changed, 90 insertions, 63 deletions
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("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
+ die('<script type="text/javascript">document.location = oc_webroot;</script>');
}
-$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 @@
<tr>
<th width="75px"><?php echo $l->t("Category");?>:</th>
<td>
- <select class="formselect" id="formcategorie_select" style="width:140px;" id="newevent_cat">
- <option><?php echo $l->t("None"); ?></option>
- <option><?php echo $l->t("Birthday"); ?></option>
- <option><?php echo $l->t("Business"); ?></option>
- <option><?php echo $l->t("Call"); ?></option>
- <option><?php echo $l->t("Clients"); ?></option>
- <option><?php echo $l->t("Deliverer"); ?></option>
- <option><?php echo $l->t("Holidays"); ?></option>
- <option><?php echo $l->t("Ideas"); ?></option>
- <option><?php echo $l->t("Journey"); ?></option>
- <option><?php echo $l->t("Jubilee"); ?></option>
- <option><?php echo $l->t("Meeting"); ?></option>
- <option><?php echo $l->t("Other"); ?></option>
- <option><?php echo $l->t("Personal"); ?></option>
- <option><?php echo $l->t("Projects"); ?></option>
- <option><?php echo $l->t("Questions"); ?></option>
- <option><?php echo $l->t("Work"); ?></option>
+ <select class="formselect" id="formcategorie_select" style="width:140px;">
+ <?php
+ foreach($_['categories'] as $category){
+ echo '<option value="' . $category . '">' . $category . '</option>';
+ }
+ ?>
</select></td>
<th width="75px">&nbsp;&nbsp;&nbsp;<?php echo $l->t("Calendar");?>:</th>
<td>
<select class="formselect" id="formcalendar_select" style="width:140px;" id="newevent_cal">
<?php
- $option_calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
- for($i = 0; $i < count($option_calendars); $i++){
- echo "<option id=\"option_" . $option_calendars[$i]["id"] . "\">" . $option_calendars[$i]["displayname"] . "</option>";
+ foreach($_['calendars'] as $calendar){
+ echo '<option id="option_' . $calendar['id'] . '">' . $calendar['displayname'] . '</option>';
}
?>
</select></td>
</tr>
</table>
<hr>
- <?php $day = substr($_GET["d"], 0, 2);
- $month = substr($_GET["d"], 2, 2);
- $year = substr($_GET["d"], 4, 4);
- $time = $_GET["t"];
- if($time != "undefined" && !is_nan($_GET["t"]) && $_GET["t"] != "allday"){
- $time = $_GET["t"];
- $minutes = "00";
- }elseif($_GET["t"] == "allday"){
- $time = "0";
- $minutes = "00";
- $allday = true;
- }else{
- $time = date("H");
- $minutes = date("i");
- }
- ?>
<table>
<tr>
<th width="75px"></th>
<td>
- <input onclick="lock_time();" type="checkbox"<?php if($allday == true){echo "checked=\"checked\"";} ?> id="newcalendar_allday_checkbox">
- <?php if($allday == true){echo "<script type=\"text/javascript\">document.getElementById(\"fromtime\").disabled = true;document.getElementById(\"totime\").disabled = true;document.getElementById(\"fromtime\").style.color = \"#A9A9A9\";document.getElementById(\"totime\").style.color = \"#A9A9A9\";</script>";}?>
+ <input onclick="lock_time();" type="checkbox"<?php if($_['allday']){echo 'checked="checked"';} ?> id="newcalendar_allday_checkbox">
+ <?php if($_['allday']){echo '<script type="text/javascript">document.getElementById("fromtime").disabled = true;document.getElementById("totime").disabled = true;document.getElementById("fromtime").style.color = "#A9A9A9";document.getElementById("totime").style.color = "#A9A9A9";</script>';}?>
<label for="newcalendar_allday_checkbox"><?php echo $l->t("All Day Event");?></label></td>
</tr>
<tr>
<th width="75px"><?php echo $l->t("From");?>:</th>
<td>
- <input type="text" value="<?php echo $day . "-" . $month . "-" . $year;?>" id="from">
+ <input type="text" value="<?php echo $_['startdate'];?>" id="from">
&nbsp;&nbsp;
- <input type="time" value="<?php echo date("H:i");?>" id="fromtime">
+ <input type="time" value="<?php echo $_['starttime'];?>" id="fromtime">
</td><!--use jquery-->
</tr>
<tr>
- <?php
- if(date("H") == 23) {
- $day++;
- $time = 0;
- } else {
- $time++;
- }
- ?>
<th width="75px"><?php echo $l->t("To");?>:</th>
<td>
- <input type="text" value="<?php echo $day . "-" . $month . "-" . $year;?>" id="to">
+ <input type="text" value="<?php echo $_['enddate'];?>" id="to">
&nbsp;&nbsp;
- <input type="time" value="<?php echo $time . ":" . $minutes;?>" id="totime">
+ <input type="time" value="<?php echo $_['endtime'];?>" id="totime">
</td><!--use jquery-->
</tr><!--
<tr>
<th width="75px"><?php echo $l->t("Repeat");?>:</th>
<td>
<select class="formselect" id="formrepeat_select" style="width:350px;">
- <option id="repeat_doesnotrepeat" selected="selected"><?php echo $l->t("Does not repeat");?></option>
- <option id="repeat_daily"><?php echo $l->t("Daily");?></option>
- <option id="repeat_weekly"><?php echo $l->t("Weekly");?></option>
- <option id="repeat_weekday"><?php echo $l->t("Every Weekday");?></option>
- <option id="repeat_biweekly"><?php echo $l->t("Bi-Weekly");?></option>
- <option id="repeat_monthly"><?php echo $l->t("Monthly");?></option>
- <option id="repeat_yearly"><?php echo $l->t("Yearly");?></option>
+ <?php
+ foreach($_['repeat_options'] as $id => $label){
+ echo '<option id="repeat_' . $id . '">' . $label . '</option>';
+ }
+ ?>
</select></td>
</tr>-->
</table>