2 global $groups_enabled,$WORK_DAY_START_HOUR,$WORK_DAY_END_HOUR;
3 ?><script type="text/javascript">
5 // do a little form verifying
6 function validate_and_submit () {
7 if ( document.editentryform.name.value == "" ) {
8 document.editentryform.name.select ();
10 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) ||
11 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?>
12 showTab ( "details" );
14 document.editentryform.name.focus ();
15 alert ( "<?php etranslate("You have not entered a Brief Description")?>." );
18 // Leading zeros seem to confuse parseInt()
19 if ( document.editentryform.hour.value.charAt ( 0 ) == '0' )
20 document.editentryform.hour.value = document.editentryform.hour.value.substring ( 1, 2 );
21 if ( document.editentryform.timetype.selectedIndex == 1 ) {
22 h = parseInt ( document.editentryform.hour.value );
23 m = parseInt ( document.editentryform.minute.value );
24 <?php if ($GLOBALS["TIME_FORMAT"] == "12") { ?>
25 if ( document.editentryform.ampm[1].checked ) {
35 if ( h >= 24 || m > 59 ) {
37 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) ||
38 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?>
39 showTab ( "details" );
41 alert ( "<?php etranslate ("You have not entered a valid time of day")?>." );
42 document.editentryform.hour.select ();
43 document.editentryform.hour.focus ();
46 // Ask for confirmation for time of day if it is before the user's
48 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) ||
49 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?>
50 showTab ( "details" );
52 // preference for work hours.
53 <?php if ($GLOBALS["TIME_FORMAT"] == "24") {
54 echo "if ( h < $WORK_DAY_START_HOUR ) {";
56 echo "if ( h < $WORK_DAY_START_HOUR && document.editentryform.ampm[0].checked ) {";
59 if ( ! confirm ( "<?php etranslate ("The time you have entered begins before your preferred work hours. Is this correct?")?> "))
63 // is there really a change?
65 form=document.editentryform;
66 for ( i = 0; i < form.elements.length; i++ ) {
67 field = form.elements[i];
68 switch ( field.type ) {
71 if ( field.checked != field.defaultChecked )
76 if ( field.value != field.defaultValue )
80 // case "select-multiple":
81 for( j = 0; j < field.length; j++ ) {
82 if ( field.options[j].selected != field.options[j].defaultSelected )
89 form.entry_changed.value = "yes";
91 //Add code to make HTMLArea code stick in TEXTAREA
92 if (typeof editor != "undefined") editor._textArea.value = editor.getHTML();
93 // would be nice to also check date to not allow Feb 31, etc...
94 document.editentryform.submit ();
98 function selectDate ( day, month, year, current, evt ) {
99 // get currently selected day/month/year
100 monthobj = eval ( 'document.editentryform.' + month );
101 curmonth = monthobj.options[monthobj.selectedIndex].value;
102 yearobj = eval ( 'document.editentryform.' + year );
103 curyear = yearobj.options[yearobj.selectedIndex].value;
106 if (document.getElementById) {
107 mX = evt.clientX + 40;
108 mY = evt.clientY + 120;
114 var MyPosition = 'scrollbars=no,toolbar=no,left=' + mX + ',top=' + mY + ',screenx=' + mX + ',screeny=' + mY ;
119 url = "datesel.php?form=editentryform&fday=" + day +
120 "&fmonth=" + month + "&fyear=" + year + "&date=" + date;
121 var colorWindow = window.open(url,"DateSelection","width=300,height=200," + MyPosition);
124 <?php if ( $groups_enabled == "Y" ) {
125 ?>function selectUsers () {
126 // find id of user selection object
128 for ( i = 0; i < document.editentryform.elements.length; i++ ) {
129 if ( document.editentryform.elements[i].name == "participants[]" )
132 url = "usersel.php?form=editentryform&listid=" + listid + "&users=";
133 // add currently selected users
134 for ( i = 0, j = 0; i < document.editentryform.elements[listid].length; i++ ) {
135 if ( document.editentryform.elements[listid].options[i].selected ) {
139 url += document.editentryform.elements[listid].options[i].value;
142 //alert ( "URL: " + url );
144 window.open ( url, "UserSelection",
145 "width=500,height=500,resizable=yes,scrollbars=yes" );
149 <?php // This function is called when the event type combo box
150 // is changed. If the user selectes "untimed event" or "all day event",
151 // the times & duration fields are hidden.
152 // If they change their mind & switch it back, the original
153 // values are restored for them
154 ?>function timetype_handler () {
155 var i = document.editentryform.timetype.selectedIndex;
156 var val = document.editentryform.timetype.options[i].text;
157 //alert ( "val " + i + " = " + val );
158 // i == 1 when set to timed event
161 makeInvisible ( "timeentrystart" );
162 if ( document.editentryform.duration_h ) {
163 makeInvisible ( "timeentryduration" );
165 makeInvisible ( "timeentryend" );
169 makeVisible ( "timeentrystart" );
170 if ( document.editentryform.duration_h ) {
171 makeVisible ( "timeentryduration" );
173 makeVisible ( "timeentryend" );
178 function rpttype_handler () {
179 var i = document.editentryform.rpttype.selectedIndex;
180 var val = document.editentryform.rpttype.options[i].text;
181 //alert ( "val " + i + " = " + val );
182 //i == 0 when event does not repeat
184 // none (not repeating)
185 makeVisible ( "rptenddate" );
186 makeVisible ( "rptfreq" );
188 makeVisible ( "rptday" );
190 makeInvisible ( "rptday" );
194 makeInvisible ( "rptenddate" );
195 makeInvisible ( "rptfreq" );
196 makeInvisible ( "rptday" );
200 <?php //see the showTab function in includes/js/visible.php for common code shared by all pages
201 //using the tabbed GUI.
203 var tabs = new Array();
205 tabs[1] = "participants";
210 function getUserList () {
212 for ( i = 0; i < document.editentryform.elements.length; i++ ) {
213 if ( document.editentryform.elements[i].name == "participants[]" )
219 // Show Availability for the first selection
220 function showSchedule () {
221 //var agent=navigator.userAgent.toLowerCase();
222 //var agent_isIE=(agent.indexOf("msie") > -1);
223 var myForm = document.editentryform;
224 var userlist = myForm.elements[getUserList()];
227 var cols = <?php echo $WORK_DAY_END_HOUR - $WORK_DAY_START_HOUR ?>;
228 //var w = 140 + ( cols * 31 );
231 for ( i = 0; i < userlist.length; i++ ) {
232 if (userlist.options[i].selected) {
233 users += delim + userlist.options[i].value;
239 alert("<?php etranslate("Please add a participant")?>" );
242 var features = 'width='+ w +',height='+ h +',resizable=yes,scrollbars=no';
243 var url = 'availability.php?users=' + users +
244 '&year=' + myForm.year.value +
245 '&month=' + myForm.month.value +
246 '&day=' + myForm.day.options[myForm.day.selectedIndex].text;
248 if (sch_win != null && !sch_win.closed) {
250 sch_win.location.replace( url );
251 sch_win.resizeTo(w,h);
253 sch_win = window.open( url, "showSchedule", features );