00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once('class.jscalendar.php');
00026
00032 class tx_date2cal_wizard
00033 {
00035 var $extConfig = array();
00036
00037 function prepareExtConfig()
00038 {
00039
00040 $this->extConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['date2cal']);
00041
00042
00043 $this->extConfig['backPath'] = $GLOBALS['BACK_PATH'] . (TYPO3_MODE == 'BE' ? '../' : '');
00044
00045
00046 $this->extConfig['calImg'] = t3lib_div::getFileAbsFileName($this->extConfig['calImg']);
00047 $this->extConfig['calImg'] = $this->extConfig['backPath'] .
00048 substr($this->extConfig['calImg'], strlen(PATH_site));
00049
00050
00051 $this->extConfig['helpImg'] = t3lib_div::getFileAbsFileName($this->extConfig['helpImg']);
00052 $this->extConfig['helpImg'] = $this->extConfig['backPath'] .
00053 substr($this->extConfig['helpImg'], strlen(PATH_site));
00054
00055
00056 $userProps = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'], 'tx_date2cal');
00057 if (!is_array($userProps))
00058 $this->extConfig = array_merge($this->extConfig, $userProps['properties']);
00059 }
00060
00066 function secOptionsOn() {
00067 $GLOBALS['BE_USER']->pushModuleData('xMOD_alt_doc.php', array('showPalettes' => 1));
00068 }
00069
00077 function renderWizard($params, &$pObj)
00078 {
00079
00080 $this->prepareExtConfig();
00081
00082
00083 if ($this->extConfig['secOptionsAlwaysOn'])
00084 $this->secOptionsOn();
00085
00086
00087 $inputId = 'data_' . $params['table'] . '_' . $params['uid'] . '_' . $params['field'];
00088 $params['item'] = str_replace('<input type="checkbox"', '<input type="checkbox" ' .
00089 'id="' . $inputId . '_cb"', $params['item']);
00090 $params['item'] = str_replace('<input type="text"', '<input type="text" ' .
00091 'id="' . $inputId . '_hr"', $params['item']);
00092
00093
00094 $JSCalendar = JSCalendar::getInstance();
00095
00096
00097 $JSCalendar->setDateFormat(false);
00098 if ($params['wConf']['evalValue'] == 'datetime')
00099 $JSCalendar->setDateFormat(true);
00100
00101
00102 $JSCalendar->setInputField($inputId);
00103 $JSCalendar->setConfigOption('firstDay', $this->extConfig['firstDay'], true);
00104 $JSCalendar->setNLP($this->extConfig['natLangParser']);
00105 $JSCalendar->setCSS($this->extConfig['calendarCSS']);
00106 $JSCalendar->setLanguage($this->extConfig['lang']);
00107
00108
00109 $params['item'] .= $JSCalendar->renderImages($this->extConfig['calImg'],
00110 $this->extConfig['helpImg']);
00111
00112
00113 if (($jsCode = $JSCalendar->getMainJS()) == '')
00114 return '';
00115
00116
00117 $script = basename(PATH_thisScript);
00118 if (TYPO3_MODE == 'FE')
00119 $params['item'] = $jsCode . $params['item'];
00120 elseif (t3lib_div::int_from_ver(TYPO3_version) >= 4000000 || $script == 'db_layout.php')
00121
00122 $GLOBALS['SOBE']->doc->JScode .= $jsCode;
00123 elseif (is_object($GLOBALS['SOBE']->tceforms))
00124 $GLOBALS['SOBE']->tceforms->additionalCode_pre['date2cal'] = $jsCode;
00125 else
00126 $pObj->additionalCode_pre['date2cal'] = $jsCode;
00127
00128 return '';
00129 }
00130 }
00131
00132 ?>