/** @brief The Workhorse that does the actuall inserting. Inserts all necessary settings and configurations into the Template using the I(Insert) class */ public function linkSciptsAndStylesheets() { // DateTimePicker CSS $cssFile = WB_URL . '/modules/date_time_picker/XDSoftDateTimePicker/css/jquery.datetimepicker.css'; I::AddCss(array('setname' => "datetimepicker_css", 'href' => $cssFile, 'media' => "screen")); // DateTimePicker_overrides.css $cssOverrides = THEME_URL . '/css/date_time_picker_override.css'; if (is_readable(str_replace(WB_URL, WB_PATH, $cssOverrides))) { I::AddCss(array('setname' => "datetimepicker_overrides_css", 'href' => $cssOverrides, 'media' => "screen")); } // DateTimePicker Plugin JS File $jsFile = WB_URL . '/modules/date_time_picker/XDSoftDateTimePicker/js/jquery.datetimepicker.full.min.js'; I::AddJs(array('setname' => "datetimepicker_js", 'position' => "HeadLow", 'src' => $jsFile)); echo '<script type="text/javascript" src="' . $jsFile . '"></script>'; $sPluginCfg = " lang: '" . strtolower(LANGUAGE) . "'"; // take care of the leading comma (,) before each new setting $sPluginCfg .= $this->mask == true ? '", mask: "true' : ''; $sPluginCfg .= $this->lazyInit == true ? ", lazyInit: 'true'" : ''; $sPluginCfg .= $this->step != 60 ? ", step: " . $this->step : ''; if ($this->timepicker == false) { $sPluginCfg .= ", timepicker: 'false'"; } else { $sPluginCfg .= ", formatTimeScroller: '" . $this->sTimeFormat . "'"; } if ($this->datepicker == false) { $sPluginCfg .= ", datepicker: 'false'"; } $sPluginCfg .= ", format: '" . $this->sDateTimeFormat . "'"; //generate inlineJS from above string and add to Queue if ($this->selector != '') { global $TEXT; $sJS = "\r\n\t\t\t\tvar THEME_URL = '" . THEME_URL . "';\r\n\t\t\t\t\$(document).ready(function(){\r\n\t\t\t\t\t\r\n\t\t\t\t\t\$.datetimepicker.setLocale('" . strtolower(LANGUAGE) . "');\r\n\t\t\t\t\tvar DELETE_DATE = Boolean(" . $this->delete_date_handle . ");\r\n\t\t\t\t\tvar SELECTOR = \$(\"[rel='" . $this->selector . "']\");\r\n\t\t\t\t\tSELECTOR.datetimepicker({" . $sPluginCfg . "});\r\n\t\t\t\t\t\r\n\t\t\t\t\t// add ICONS\r\n\t\t\t\t\tSELECTOR.each(function() {\t\t\r\n\t\t\t\t\t\tvar oInputField = this;\r\n\t\t\t\t\t\tvar sFieldID = this.getAttribute('id');\r\n\t\t\t\t\t\tvar CAL_ICON = ' <img alt=\"[show cal]\" rel=\"' + sFieldID + '\" id=\"show_' + sFieldID + '\" class=\"showcal\" src=\"' + THEME_URL +'/images/calendar_16.png\" title=\"" . $TEXT['CALENDAR'] . "\">';\r\n\t\t\t\t\t\tif(DELETE_DATE == true){\r\n\t\t\t\t\t\t\tvar RESET_ICON = ' <img alt=\"[reset]\" rel=\"reset_' + sFieldID + '\" class=\"reset_datetime\" src=\"' + THEME_URL +'/images/clock_del_16.png\" title=\"" . $TEXT['DELETE_DATE'] . "\">';\r\n\t\t\t\t\t\t}else{ \r\n\t\t\t\t\t\t\tvar RESET_ICON = '';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\$(this).after(CAL_ICON + RESET_ICON);\r\n\t\t\t\t\t\tvar RESET_ICON2 = \$(\"img.reset[rel=\" + sFieldID + \"]\");\r\n\t\t\t\t\t\tif(\$(this).val() == ''){\r\n\t\t\t\t\t\t\tRESET_ICON2.css({ opacity: 0.2 });\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tRESET_ICON2.css('cursor', 'pointer').click(function() {\r\n\t\t\t\t\t\t\t \$('input#' + sFieldID).val('');\r\n\t\t\t\t\t\t\t RESET_ICON2.css({ opacity: 0.8 });\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\$('#show_' + sFieldID).css('cursor', 'pointer').click(function(){\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t oInputField.focus();\t\t\r\n\t\t\t\t\t\t});\t\t\r\n\t\t\t\t\t});\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// empty date input\r\n\t\t\t\t\tif(DELETE_DATE == true){\r\n\t\t\t\t\t\t\$('.reset_datetime').click(function () {\r\n\t\t\t\t\t\t\tvar FIELD = this.getAttribute('rel');\r\n\t\t\t\t\t\t\tvar ID = '#' + FIELD.replace('reset_', '');\r\n\t\t\t\t\t\t\t\$(ID).attr('value', '');\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t});\r\n\t\t\t"; I::AddJs(array('setname' => "DateTimePicker", 'position' => "BodyLow", 'script' => $sJS)); } }