diff options
Diffstat (limited to 'apps/calendar/templates/part.newevent.php')
-rw-r--r-- | apps/calendar/templates/part.newevent.php | 75 |
1 files changed, 62 insertions, 13 deletions
diff --git a/apps/calendar/templates/part.newevent.php b/apps/calendar/templates/part.newevent.php index bc19042f10c..837e032c734 100644 --- a/apps/calendar/templates/part.newevent.php +++ b/apps/calendar/templates/part.newevent.php @@ -1,15 +1,16 @@ <div id="newevent" title="<?php echo $l -> t("Create a new event");?>"> + <form id="newevent_form"> <table id="newevent_table" width="100%"> <tr> <td width="75px"><?php echo $l -> t("Title");?>:</td> <td> - <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l -> t("Title of the Event");?>" maxlength="100" /> + <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l -> t("Title of the Event");?>" maxlength="100" id="newevent_title"/> </td> </tr> <tr> <td width="75px"><?php echo $l -> t("Location");?>:</td> <td> - <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l -> t("Location of the Event");?>" maxlength="100" /> + <input type="text" style="width:350px;" size="100" placeholder="<?php echo $l -> t("Location of the Event");?>" maxlength="100" id="newevent_location" /> </td> </tr> </table> @@ -17,14 +18,14 @@ <tr> <td width="75px"><?php echo $l -> t("Category");?>:</td> <td> - <select class="formselect" id="formcategorie_select" style="width:140px;"> - <option>Coming soon</option><!-- + <select class="formselect" id="formcategorie_select" style="width:140px;" id="newevent_cat"> + <option>Coming soon</option> <option>Work</option> - <option>Call</option>--> + <option>Call</option> </select></td> <td width="75px"> <?php echo $l -> t("Calendar");?>:</td> <td> - <select class="formselect" id="formcalendar_select" style="width:140px;"> + <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++){ @@ -83,7 +84,7 @@ <input type="time" value="<?php echo $time . ":" . $minutes;?>" id="totime"> </td><!--use jquery--> - </tr> + </tr><!-- <tr> <td width="75px"><?php echo $l -> t("Repeat");?>:</td> <td> @@ -96,28 +97,30 @@ <option id="repeat_monthly"><?php echo $l->t("Monthly");?></option> <option id="repeat_yearly"><?php echo $l->t("Yearly");?></option> </select></td> - </tr> + </tr>--> </table> <hr> - <table> + <table><!-- <tr> <td width="75px"><?php echo $l -> t("Attendees");?>:</td> <td style="height: 50px;"></td> </tr> </table> - <hr> + <hr>--> <table> <tr> <td width="75px" style="vertical-align: top;"><?php echo $l -> t("Description");?>:</td> - <td> <textarea style="width:350px;height: 150px;"placeholder="<?php echo $l->t("Description of the Event");?>"></textarea></td> + <td><textarea style="width:350px;height: 150px;"placeholder="<?php echo $l->t("Description of the Event");?>" id="description"></textarea></td> </tr> </table> + <div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div> <span id="newcalendar_actions"> - <input type="button" style="float: left;" value="<?php echo $l -> t("Submit");?>"> + <input type="button" class="submit" style="float: left;" value="<?php echo $l -> t("Submit");?>" onclick="validate_newevent_form();"> </span> + </form> </div> <script type="text/javascript"> - $( "#newevent" ).dialog({ + $("#newevent").dialog({ width : 500, close : function() { oc_cal_opendialog = 0; @@ -147,4 +150,50 @@ document.getElementById("totime").style.color = "#A9A9A9"; } } + function validate_newevent_form(){ + var newevent_title = document.getElementById("newevent_title").value; + var newevent_location = document.getElementById("newevent_location").value; + var newevent_cat;// = document.getElementById("newevent_cat").options[document.getElementById("newevent_cat").selectedIndex].value; + var newevent_cal;// = document.getElementById("newevent_cal").options[document.getElementById("newevent_cal").selectedIndex].value; + var newevent_allday = document.getElementById("newcalendar_allday_checkbox").checked; + var newevent_from = document.getElementById("from").value; + var newevent_fromtime = document.getElementById("fromtime").value; + var newevent_to = document.getElementById("to").value; + var newevent_totime = document.getElementById("totime").value; + var newevent_description = document.getElementById("description").value; + $.post("ajax/newevent.php", { title: newevent_title, location: newevent_location, cat: newevent_cat, cal: newevent_cal, allday: newevent_allday, from: newevent_from, fromtime: newevent_fromtime, to: newevent_to, totime: newevent_totime, description: newevent_description}, + function(data){ + if(data.error == "true"){ + document.getElementById("errorbox").innerHTML = ""; + var output = "Missing fields: <br />"; + if(data.title == "true"){ + output = output + "Title<br />"; + } + if(data.cal == "true"){ + output = output + "Calendar<br />"; + } + if(data.from == "true"){ + output = output + "From Date<br />"; + } + if(data.fromtime == "true"){ + output = output + "From Time<br />"; + } + if(data.to == "true"){ + output = output + "To Date<br />"; + } + if(data.totime == "true"){ + output = output + "To Time<br />"; + } + if(data.endbeforestart == "true"){ + output = "The event ends before it starts!"; + } + if(data.dberror == "true"){ + output = "There was a database fail!"; + } + document.getElementById("errorbox").innerHTML = output; + }else{ + window.location.reload(); + } + },"json"); + } </script>
\ No newline at end of file |