[ Index ] |
|
Code source de WebCalendar 1.0.5 |
1 <?php 2 global $groups_enabled,$WORK_DAY_START_HOUR,$WORK_DAY_END_HOUR; 3 ?><script type="text/javascript"> 4 <!-- <![CDATA[ 5 // do a little form verifying 6 function validate_and_submit () { 7 if ( document.editentryform.name.value == "" ) { 8 document.editentryform.name.select (); 9 <?php 10 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) || 11 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?> 12 showTab ( "details" ); 13 <?php } ?> 14 document.editentryform.name.focus (); 15 alert ( "<?php etranslate("You have not entered a Brief Description")?>." ); 16 return false; 17 } 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 ) { 26 // pm 27 if ( h < 12 ) 28 h += 12; 29 } else { 30 // am 31 if ( h == 12 ) 32 h = 0; 33 } 34 <?php } ?> 35 if ( h >= 24 || m > 59 ) { 36 <?php 37 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) || 38 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?> 39 showTab ( "details" ); 40 <?php } ?> 41 alert ( "<?php etranslate ("You have not entered a valid time of day")?>." ); 42 document.editentryform.hour.select (); 43 document.editentryform.hour.focus (); 44 return false; 45 } 46 // Ask for confirmation for time of day if it is before the user's 47 <?php 48 if ( empty ( $GLOBALS['EVENT_EDIT_TABS'] ) || 49 $GLOBALS['EVENT_EDIT_TABS'] == 'Y' ) { ?> 50 showTab ( "details" ); 51 <?php } ?> 52 // preference for work hours. 53 <?php if ($GLOBALS["TIME_FORMAT"] == "24") { 54 echo "if ( h < $WORK_DAY_START_HOUR ) {"; 55 } else { 56 echo "if ( h < $WORK_DAY_START_HOUR && document.editentryform.ampm[0].checked ) {"; 57 } 58 ?> 59 if ( ! confirm ( "<?php etranslate ("The time you have entered begins before your preferred work hours. Is this correct?")?> ")) 60 return false; 61 } 62 } 63 // is there really a change? 64 changed = false; 65 form=document.editentryform; 66 for ( i = 0; i < form.elements.length; i++ ) { 67 field = form.elements[i]; 68 switch ( field.type ) { 69 case "radio": 70 case "checkbox": 71 if ( field.checked != field.defaultChecked ) 72 changed = true; 73 break; 74 case "text": 75 // case "textarea": 76 if ( field.value != field.defaultValue ) 77 changed = true; 78 break; 79 case "select-one": 80 // case "select-multiple": 81 for( j = 0; j < field.length; j++ ) { 82 if ( field.options[j].selected != field.options[j].defaultSelected ) 83 changed = true; 84 } 85 break; 86 } 87 } 88 if ( changed ) { 89 form.entry_changed.value = "yes"; 90 } 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 (); 95 return true; 96 } 97 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; 104 date = curyear; 105 106 if (document.getElementById) { 107 mX = evt.clientX + 40; 108 mY = evt.clientY + 120; 109 } 110 else { 111 mX = evt.pageX + 40; 112 mY = evt.pageY +130; 113 } 114 var MyPosition = 'scrollbars=no,toolbar=no,left=' + mX + ',top=' + mY + ',screenx=' + mX + ',screeny=' + mY ; 115 if ( curmonth < 10 ) 116 date += "0"; 117 date += curmonth; 118 date += "01"; 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); 122 } 123 124 <?php if ( $groups_enabled == "Y" ) { 125 ?>function selectUsers () { 126 // find id of user selection object 127 var listid = 0; 128 for ( i = 0; i < document.editentryform.elements.length; i++ ) { 129 if ( document.editentryform.elements[i].name == "participants[]" ) 130 listid = i; 131 } 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 ) { 136 if ( j != 0 ) 137 url += ","; 138 j++; 139 url += document.editentryform.elements[listid].options[i].value; 140 } 141 } 142 //alert ( "URL: " + url ); 143 // open window 144 window.open ( url, "UserSelection", 145 "width=500,height=500,resizable=yes,scrollbars=yes" ); 146 } 147 <?php } ?> 148 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 159 if ( i != 1 ) { 160 // Untimed/All Day 161 makeInvisible ( "timeentrystart" ); 162 if ( document.editentryform.duration_h ) { 163 makeInvisible ( "timeentryduration" ); 164 } else { 165 makeInvisible ( "timeentryend" ); 166 } 167 } else { 168 // Timed Event 169 makeVisible ( "timeentrystart" ); 170 if ( document.editentryform.duration_h ) { 171 makeVisible ( "timeentryduration" ); 172 } else { 173 makeVisible ( "timeentryend" ); 174 } 175 } 176 } 177 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 183 if ( i != 0 ) { 184 // none (not repeating) 185 makeVisible ( "rptenddate" ); 186 makeVisible ( "rptfreq" ); 187 if ( i == 2 ) { 188 makeVisible ( "rptday" ); 189 } else { 190 makeInvisible ( "rptday" ); 191 } 192 } else { 193 // Timed Event 194 makeInvisible ( "rptenddate" ); 195 makeInvisible ( "rptfreq" ); 196 makeInvisible ( "rptday" ); 197 } 198 } 199 200 <?php //see the showTab function in includes/js/visible.php for common code shared by all pages 201 //using the tabbed GUI. 202 ?> 203 var tabs = new Array(); 204 tabs[0] = "details"; 205 tabs[1] = "participants"; 206 tabs[2] = "pete"; 207 208 var sch_win; 209 210 function getUserList () { 211 var listid = 0; 212 for ( i = 0; i < document.editentryform.elements.length; i++ ) { 213 if ( document.editentryform.elements[i].name == "participants[]" ) 214 listid = i; 215 } 216 return listid; 217 } 218 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()]; 225 var delim = ''; 226 var users = ''; 227 var cols = <?php echo $WORK_DAY_END_HOUR - $WORK_DAY_START_HOUR ?>; 228 //var w = 140 + ( cols * 31 ); 229 var w = 760; 230 var h = 180; 231 for ( i = 0; i < userlist.length; i++ ) { 232 if (userlist.options[i].selected) { 233 users += delim + userlist.options[i].value; 234 delim = ','; 235 h += 18; 236 } 237 } 238 if (users == '') { 239 alert("<?php etranslate("Please add a participant")?>" ); 240 return false; 241 } 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; 247 248 if (sch_win != null && !sch_win.closed) { 249 h = h + 30; 250 sch_win.location.replace( url ); 251 sch_win.resizeTo(w,h); 252 } else { 253 sch_win = window.open( url, "showSchedule", features ); 254 } 255 } 256 257 //]]> --> 258 </script>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Nov 30 19:09:19 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |