WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
So need to patch that!Question still stands.
<?php#gnore this line, Please!// put it into backend_body.jsvar MODULE_URL = WB_URL + '/modules/mymodule'; // replace by module dir name$(window).load(function(){ if($('textarea').length){ //Use a significant selector (by Element-ID, Element-Class, Element type etc) $.insert(MODULE_URL+"/date.js"); // date.js (for datefunctions)datePicker.js $.insert(MODULE_URL+"/datePicker.js"); // datePicker.js }});
var MODULE_URL = WB_URL + '/modules/someothercalendar'; $.insert(MODULE_URL + '/js/date.js'); $.insert(MODULE_URL + '/js/jquery.datePicker.js');
hmmm,The above did work when I load jquery.min.js from modify.phpWich isn't the good way to do.When I don't load jquery it won't work.
<script type="text/javascript">var VARIABLE_ONE = '<?php echo $the_php_value_for_variable_one; ?>';var VARIABLE_TWO = '<?php echo $the_php_value_for_variable_two; ?>';</script>
<script type="text/javascript" charset="utf-8">Date.firstDayOfWeek = 1;Date.format = 'Y-m-d H:i';$(function(){$('.date-pick').datePicker({ clickInput:false, autoFocusNextInput: true, startDate:'01/01/2011'}).val(new Date().asString()) $('#date1').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date2').dpSetStartDate(d.addDays(0).asString()); } } ).val(new Date(2011,5,5).asString()); $('#date2').bind( 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date1').dpSetEndDate(d.addDays(0).asString()); } } ).val(new Date(2011,6,6).asString()); });</script>
var firstDayOfWeek = <?php echo $jscal_firstday; ?>;
Date.firstDayOfWeek = firstDayOfWeek;
</php ?> // start php colours, not needed...!!<script type="text/javascript" charset="utf-8">// Adding variables for datepicker - sent to backend_body.js:var MODULE_URL = WB_URL + '/modules/anopthercalendar';var firstDay = <?php echo $jscal_firstday; ?>; // Firstday, 0=sunday/1=mondayvar format = '<?php echo $jscal_format; ?>'; // format of date, mm.dd.yyy etc var datestart = '<?php echo date($jscal_ifformat,$datetime_start); ?>'; // datestart in input fieldvar dateend = '<?php echo date($jscal_ifformat,$datetime_end); ?>'; // dateedn in inputfieldvar datefrom = '<?php echo date($jscal_ifformat,mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); ?>'; // How long back?<?php // Set language file, if it exists $jscal_lang = defined('LANGUAGE')?strtolower(LANGUAGE):'en'; $jscal_lang = $jscal_lang!=''?$jscal_lang:'en'; if(file_exists(WB_PATH."/modules/".$module_directory."/js/lang/date_".$jscal_lang.".js")) { echo 'var datelang = "date_'.$jscal_lang.'.js"'; } else { echo 'var datelang = "none"'; }?></script>
// Test to see if it needs to do something, called from the correct page // MODULE_URL is set in modify.phpif (typeof MODULE_URL != 'undefined') { // Include datepicker files: $.insert(MODULE_URL + '/js/date.js'); $.insert(MODULE_URL + '/js/jquery.datePicker.js'); // This is only needed for ie 6 and smaller if ($.browser.msie && $.browser.version.substr(0,1)<7) { $.insert(MODULE_URL + '/js/jquery.bgiframe.js'); } // Insert language file if it is not none! if (datelang !== "none") { $.insert(MODULE_URL + '/js/lang/'+ datelang); } // firstday 0=sunday, 1=monday -- Fomat = datefomat yyyy/mm/dd or dd mm yyy or ... Date.firstDayOfWeek = firstDay; Date.format = format; // set up the calendars and make them work together, date from first will be minimum date for second $(function() { $('.date-pick').datePicker({ clickInput:false, autoFocusNextInput: true, startDate:datefrom} // datefrom! ); $('#date1').bind( // Update date2 when date changes, set starting date to date1 'dpClosed', function(e, selectedDates) { var d = selectedDates[0]; if (d) { d = new Date(d); $('#date2').dpSetStartDate(d.addDays(0).asString()); } } ).datestart; // datestart!! $('#date2').datePicker().dpSetStartDate(datestart).dateend; // dateend!! });// End of MODULE_URL test}