PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/mth_feedit_sm/class.tx_mthfeedit.php.backup_no_tabs

https://github.com/michael-cannon/typo3-extensions
Unknown | 1255 lines | 1095 code | 160 blank | 0 comment | 0 complexity | 07faa530b0c5b93b065d3df63059354a MD5 | raw file
Possible License(s): LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 2005 Morten Tranberg Hansen (mth@daimi.au.dk)
  6. * All rights reserved
  7. *
  8. * This script is part of the TYPO3 project. The TYPO3 project is
  9. * free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * The GNU General Public License can be found at
  15. * http://www.gnu.org/copyleft/gpl.html.
  16. *
  17. * This script is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * This copyright notice MUST APPEAR in all copies of the script!
  23. ***************************************************************/
  24. /**
  25. * This is a API for crating and editing records in the frontend.
  26. * The API is build on top of fe_adminLib.
  27. * See documentation or extensions 'news_feedit' and 'joboffers_feedit' for examples how to use this API
  28. *
  29. * @author Morten Tranberg Hansen <mth@daimi.au.dk>
  30. */
  31. require_once(PATH_tslib.'class.tslib_pibase.php');
  32. require_once(PATH_site.TYPO3_mainDir.'sysext/lang/lang.php');
  33. if(t3lib_extmgm::isLoaded('rtehtmlarea')) require_once(t3lib_extMgm::extPath('rtehtmlarea').'pi2/class.tx_rtehtmlarea_pi2.php');
  34. if(t3lib_extmgm::isLoaded('rlmp_dateselectlib')) require_once(t3lib_extMgm::extPath('rlmp_dateselectlib').'class.tx_rlmpdateselectlib.php');
  35. class tx_mthfeedit {
  36. // Private fields
  37. var $prefixId = 'tx_mthfeedit'; // Same as class name
  38. var $scriptRelPath = 'class.tx_mthfeedit.php'; // Path to this script relative to the extension dir.
  39. var $extKey = 'mth_feedit'; // The extension key.
  40. var $conf;
  41. var $cObj; // contains an initialized cObj, so we can use the cObj functions whenever we want to.
  42. var $caller; // the caller
  43. var $table; // the table
  44. var $TCA; // contains the complete TCA of the $table
  45. var $cmd; // this is 'hopefully' the same value as fe_adminLib's cmd.
  46. var $id_field = ''; // the field from a record witch will identify the record.
  47. var $additionalJS_end = array(); // JS to be added after the end of the content.
  48. # var $LANG; // language object, used to translate 'complicated' label strings to the single label.
  49. // Fields for the RTE API
  50. var $RTEObj;
  51. var $strEntryField;
  52. var $docLarge = 0;
  53. var $RTEcounter = 0;
  54. var $formName;
  55. var $additionalJS_post = array(); // Additional JavaScript to be printed after the form
  56. var $additionalJS_submit = array(); // Additional JavaScript to be executed on submit
  57. var $PA = array(
  58. 'itemFormElName' => '',
  59. 'itemFormElValue' => '',
  60. );
  61. var $specConf = array();
  62. var $thisConfig = array();
  63. var $RTEtypeVal = 'text';
  64. var $thePidValue;
  65. /**
  66. * [Put your description here]
  67. */
  68. function init($caller,$conf) {
  69. $GLOBALS['TSFE']->set_no_cache();
  70. /**** SET PRIVATE VARS ****/
  71. $this->conf = $this->array_merge_recursive2($this->getDefaultConfArray(),$conf);
  72. $this->cObj = t3lib_div::makeInstance('tslib_cObj');
  73. $this->table = $conf["table"];
  74. $this->caller = $caller;
  75. # debug($this->conf);
  76. $this->cmd = (string)t3lib_div::_GP('cmd') ? (string)t3lib_div::_GP('cmd') : $this->conf['defaultCmd'];
  77. if (!$this->cmd) debug("WARNING:: NO COMMAND SPECIFIED FOR THE SCRIPT","NO COMMAND");
  78. $this->id_field = $GLOBALS["TCA"][$this->table]["ctrl"]["label"];
  79. // init $this->RTEObj id rtehtmlarea is availiable
  80. if(t3lib_extmgm::isLoaded('rtehtmlarea') && !$this->RTEObj)
  81. $this->RTEObj = t3lib_div::makeInstance('tx_rtehtmlarea_pi2');//&t3lib_BEfunc::RTEgetObj();//
  82. /**** LOAD LOCALLANG ****/
  83. // loads default locallang
  84. $this->LOCAL_LANG = $GLOBALS['TSFE']->readLLfile(t3lib_extMgm::extPath($this->extKey).'locallang.php');
  85. // loads callers locallang
  86. $this->LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($this->LOCAL_LANG,$caller->LOCAL_LANG);
  87. /**** LOAD TCA ****/
  88. $GLOBALS['TSFE']->includeTCA();
  89. t3lib_div::loadTCA($this->table);
  90. // Set private TCA var
  91. $this->TCA = &$GLOBALS["TCA"][$this->table];
  92. # debug($this->TCA,'TCA');
  93. /**** CONFIGURE TCA ****/
  94. $GLOBALS["TCA"][$this->table]["feInterface"]["fe_admin_fieldList"] = $this->conf['create.']['fields'] ? $this->conf['create.']['fields'].($this->conf['edit.']['fields']?','.$this->conf['edit.']['fields']:'') : $this->conf['edit.']['fields'];
  95. if($this->conf['fe_cruser_id'])
  96. $GLOBALS["TCA"][$this->table]['ctrl']['fe_cruser_id'] = $this->conf['fe_cruser_id'];
  97. if($this->conf['fe_crgroup_id'] && $this->conf['allowedGroups']) {
  98. $GLOBALS["TCA"][$this->table]['ctrl']['fe_crgroup_id'] = $this->conf['fe_crgroup_id'];
  99. }
  100. # debug($this->TCA);
  101. # debug(t3lib_div::_GP('FE'));
  102. /**** Init language object (used for translation of labels) ****/
  103. $GLOBALS['TSFE']->initLLvars();
  104. /**** Init Robert Lemkes dateselectlib if it is loaded ****/
  105. if(t3lib_extmgm::isLoaded('rlmp_dateselectlib')) tx_rlmpdateselectlib::includeLib();
  106. /**** DO ADDITIONAL REQUIRED STUFF FOR THE FIELDS ****/
  107. $fieldArray = explode(',',$this->conf[$this->cmd.'.']['show_fields']);
  108. foreach((array)$fieldArray as $fN) { //runs through the different fields
  109. switch((string)$this->TCA['columns'][$fN]['config']['type']) {
  110. case 'group':
  111. if($this->TCA['columns'][$fN]['config']['internal_type']=='file') {
  112. $this->conf[$this->cmd.'.']['fields'] .= ','.$fN.'_file'; // add the upload field to the allowed fields
  113. $GLOBALS['TCA'][$this->table]['columns'][$fN.'_file']['config']['uploadfolder'] = $GLOBALS['TCA'][$this->table]['columns'][$fN]['config']['uploadfolder']; // the new upload field should have the same upload folder as the original field
  114. $this->conf['parseValues.'][$fN.'_file'] = 'files['.ereg_replace(',',';',$this->TCA['columns'][$fN]['config']['allowed']).']['.$this->TCA['columns'][$fN]['config']['max_size'].']'; // adds the parse options for the new field, so it will be parsed as a file.
  115. }
  116. }
  117. }
  118. /**** CHECK IF LOGIN IS REQUIRED ****/
  119. if($this->conf['requireLogin'] && !$GLOBALS['TSFE']->loginUser) return $this->getLL("login_required_message");
  120. /**** FE ADMIN LIB ****/
  121. $feAConf = $this->conf;
  122. $feAConf["templateContent"]= $this->getDefaultTemplate(); // gets the default template
  123. # debug($feAConf);
  124. $content = $this->cObj->cObjGetSingle('USER_INT',$feAConf);
  125. /**** ADDS THE REQUIRED JAVASCRIPTS ****/
  126. $content = $this->getJSBefore() . $content;
  127. $content .= $this->getJSAfter();
  128. # debug($content,'content');
  129. return $content;
  130. }
  131. /*
  132. * Default configurations for fe_adminLib
  133. */
  134. function getDefaultConfArray() {
  135. return array(
  136. 'userFunc' => 'user_feAdmin->init',
  137. 'includeLibs' => 'media/scripts/fe_adminLib.inc',
  138. 'userFunc_updateArray' => 'tx_mthfeedit->updateArray',
  139. 'evalFunc' => 'tx_mthfeedit->processDataArray',
  140. 'create' => 1,
  141. 'create.' => array(
  142. 'preview' => 1,
  143. 'userFunc_afterSave' => 'tx_mthfeedit->afterSave',
  144. ),
  145. 'edit' => 1,
  146. 'edit.' => array(
  147. 'preview' => 1,
  148. 'menuLockPid' => 1,
  149. 'userFunc_afterSave' => 'tx_mthfeedit->afterSave',
  150. ),
  151. 'delete' => 1,
  152. 'delete.' => array(
  153. 'preview' => 1,
  154. ),
  155. 'setfixed' => 1,
  156. 'setfixed.' => array(
  157. 'approve.' => array(
  158. 'hidden' => 0,
  159. '_FIELDLIST' => 'uid,pid',
  160. ),
  161. 'DELETE' => 1,
  162. 'DELETE.' => array(
  163. '_FIELDLIST' => 'uid,pid',
  164. ),
  165. ),
  166. 'no_cache' => 1,
  167. 'no_header' => 0,
  168. 'keep_piVars' => '',
  169. 'defaultCmd' => 'edit',
  170. 'infomail' => 0,
  171. 'required_marker' => '*',
  172. 'clearCacheOfPages' => $GLOBALS['TSFE']->id,
  173. );
  174. }
  175. /**********************************************************************************************
  176. * TEMPLATE FUNCTIONS
  177. **********************************************************************************************/
  178. /**
  179. * Gets a default template made from the TCA.
  180. * The template there is returned depends on what $this->cmd is.
  181. */
  182. function getDefaultTemplate() {
  183. $callerMethods = get_class_methods(get_class($this->caller));
  184. $template = array_search('getrequiredtemplate',$callerMethods) ? $this->caller->getRequiredTemplate() : $this->getRequiredTemplate();
  185. $template .= array_search('getemailtemplate',$callerMethods) ? $this->caller->getEmailTemplate() : $this->getEmailTemplate();
  186. switch((string)$this->cmd) {
  187. case 'edit':
  188. $template .= array_search('getedittemplate',$callerMethods) ? $this->caller->getEditTemplate() : $this->getEditTemplate();
  189. $template .= array_search('geteditmenutemplate',$callerMethods) ? $this->caller->getEditMenuTemplate() : $this->getEditMenuTemplate();
  190. break;
  191. case 'create':
  192. $template .= array_search('getcreatetemplate',$callerMethods) ? $this->caller->getCreateTemplate() : $this->getCreateTemplate();
  193. break;
  194. case 'delete':
  195. $template .= array_search('getdeletetemplate',$callerMethods) ? $this->caller->getDeleteTemplate() : $this->getDeleteTemplate();
  196. break;
  197. case 'setfixed':
  198. $template .= array_search('getsetfixedtemplate',$callerMethods) ? $this->caller->getSetfixedTemplate() : $this->getSetfixedTemplate();
  199. break;
  200. default:
  201. debug('mth_feedit->getDefaultTemplate():: No template found for cmd='.$this->cmd,'No Template');
  202. $template = '';
  203. }
  204. # debug(array($template));
  205. return $template;
  206. }
  207. /**
  208. * Makes the form content from the TCA according to the configuration for the $cmd
  209. * @param string The cmd. Should be 'edit' or 'create'.
  210. */
  211. function makeHTMLForm($cmd) {
  212. $fields = array_intersect( array_unique(t3lib_div::trimExplode(",",$this->conf[$cmd.'.']['show_fields'],1)) , array_unique(t3lib_div::trimExplode(",",$this->conf[$cmd.'.']['fields'],1)));
  213. $reqFields = array_intersect( array_unique(t3lib_div::trimExplode(",",$this->conf[$cmd.'.']["required"],1)) , array_unique(t3lib_div::trimExplode(",",$this->conf[$cmd.'.']['show_fields'],1)));
  214. $result = array();
  215. while(list(,$fN)=each($fields)) {
  216. $fieldCode = $this->getFormFieldCode($cmd,$fN);
  217. if ($fieldCode) {
  218. // NOTE: There are two ways to make a field required. The new way is to include 'required' in evalValues for a field. The old one is to have the the field in the required list.
  219. // The new way take precedence over the old way. So if the new field has some evalValues, it makes no different if the field is in the required list or not.
  220. $feData=t3lib_div::_GP('FE');
  221. if($this->conf[$cmd.'.']['evalValues.'][$fN]) { // evalValues defined
  222. $msg = is_array($feData[$this->table]) ? '<div'.$this->caller->pi_classParam('form-error-field').'>###EVAL_ERROR_FIELD_'.$fN.'###</div>' : ''; // if no data is sent, no data is evaluated, and then no error msg should be displayed
  223. $reqMarker = in_array('required',t3lib_div::trimExplode(',',$this->conf[$cmd.'.']['evalValues.'][$fN])) ? $this->conf['required_marker'] : '';
  224. } elseif (in_array($fN,$reqFields)) { // No evalValues, but field listed in required list.
  225. $msg = '<!--###SUB_REQUIRED_FIELD_'.$fN.'###--><div'.$this->caller->pi_classParam('form-required-message').'>'.$this->getLL("required_message").'</div><!--###SUB_REQUIRED_FIELD_'.$fN.'###-->';
  226. $reqMarker = $this->conf['required_marker'];
  227. } else {
  228. $msg = '';
  229. $reqMarker = '';
  230. }
  231. $helpIcon = ($this->conf['show_help_icons'] ? '<div'.$this->caller->pi_classParam('form-help-icon').'>'.$this->helpIcon($fN).'</div>' : '');
  232. $result[]='<div'.$this->caller->pi_classParam('form-row').'>
  233. <div class="'.$this->caller->pi_getClassName('form-label').' '.$this->caller->pi_getClassName('form-label-'.$fN).'">
  234. <div'.$this->caller->pi_classParam('form-required-marker').'>'.$reqMarker.'</div>
  235. '.$this->getLLFromLabel($this->TCA["columns"][$fN]["label"]). '
  236. '.$helpIcon.'
  237. </div>
  238. <div'.$this->caller->pi_classParam('form-field').'>'.$fieldCode.'</div>
  239. '.$msg.'
  240. </div>';
  241. }
  242. }
  243. // Keep callers piVars
  244. $result = $this->addCallersPiVars($result);
  245. return implode(chr(10),$result);
  246. }
  247. /**
  248. * Returns a help icon for the field
  249. * @param string The field to get the help icon for
  250. * @param boolean The help icon with link to javascript popup, with help in.
  251. */
  252. function helpIcon($field) {
  253. // debug($this->conf);
  254. foreach($GLOBALS['TCA_DESCR'][$this->table]['refs'] as $ref) {
  255. $fieldDescription = $GLOBALS['TSFE']->sL('LLL:'.$ref.':'.$field.'.description') .' ';
  256. }
  257. if(empty($fieldDescription)) return '';
  258. else {
  259. // $aOnClick = 'confirm(\''.$fieldDescription.'\');return false;';
  260. $fieldDescription = '<html><head><title>'.$field.'</title><style type="text/css">'.preg_replace("(\r)"," ",preg_replace("(\n)"," ",$this->conf['help_window_style'])).'</style></head><body'.$this->caller->pi_classParam('help-body').'><div'.$this->caller->pi_classParam('help-text').'>'.$fieldDescription.'</div></body></html>';
  261. $aOnClick = 'top.vHWin=window.open(\'\',\'viewFieldHelpFE\',\'height=20,width=300,status=0,menubar=0,scrollbars=1\');top.vHWin.document.writeln(\''.$fieldDescription.'\');top.vHWin.document.close();top.vHWin.focus();return false;';
  262. $script =
  263. '<script type="text/javascript">' .
  264. '' .
  265. '</script>';
  266. require_once(PATH_t3lib . 'class.t3lib_iconworks.php');
  267. return
  268. '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
  269. '<img'.t3lib_iconWorks::skinImg('typo3/','gfx/helpbubble.gif','width="14" height="14"').' hspace="2" border="0" class="absmiddle"'.($GLOBALS['CLIENT']['FORMSTYLE']?' style="cursor:help;"':'').' alt="" />'.
  270. '</a>';
  271. }
  272. }
  273. /**
  274. * Makes a preview of the form content according to the configuration for the $cmd
  275. * @param string The cmd. Should be 'edit' or 'create' or 'all'.
  276. * @param boolean Should the output be wrapped in html or not.
  277. */
  278. function makeHTMLPreview($cmd, $withHTML = true) {
  279. $fields = (string)$cmd=='all' ? t3lib_div::trimExplode(",",($this->conf['create.']['show_fields'] ? $this->conf['create.']['show_fields'].($this->conf['edit.']['show_fields']?','.$this->conf['edit.']['show_fields']:'') : $this->conf['edit.']['show_fields'])) : t3lib_div::trimExplode(",",$this->conf[$cmd.'.']['show_fields']);
  280. $result = array();
  281. $hiddenFields = array();
  282. foreach((array)$fields as $fN) {
  283. $label = $this->getLLFromLabel($this->TCA['columns'][$fN]['label']);
  284. $fieldCode = $this->getPreviewFieldCode($cmd, $fN, $withHTML);
  285. if(!$withHTML) {
  286. $result[] = $label.chr(10).$fieldCode.chr(10);
  287. } else {
  288. $result[] = '<div'.$this->caller->pi_classParam('preview-row').'>
  289. <div class="'.$this->caller->pi_getClassName('preview-label').' '.$this->caller->pi_getClassName('preview-label-'.$fN).'">
  290. '.$label.'
  291. </div>
  292. <div class="'.$this->caller->pi_getClassName('preview-value').' '.$this->caller->pi_getClassName('preview-value-'.$fN).'">
  293. '.$fieldCode.'
  294. </div>
  295. </div>';
  296. # $hiddenFields[] = '<input type="hidden" name="FE['.$this->table.']['.$fN.']" />';
  297. }
  298. }
  299. # $result[] = ''.implode(chr(10),$hiddenFields);
  300. // Keep callers piVars
  301. if($withHTML)
  302. $result = $this->addCallersPiVars($result);
  303. return implode(chr(10),$result);
  304. }
  305. /**
  306. * A dummy methor for making a NON HTML preview of the form content according to the configurations for the $cmd
  307. * @param string The cmd. Should be 'edit' or 'create'.
  308. */
  309. function makeTEXTPreview($cmd) {
  310. return $this->makeHTMLPreview($cmd,false);
  311. }
  312. /**
  313. * Add callers piVars as hidden input fields to the result array
  314. * @param array The array to add piVars as input fields to
  315. * @result array The result array with added piVars input fields
  316. */
  317. function addCallersPiVars($result = array()) {
  318. $keep_piVars = t3lib_div::trimExplode(',',$this->conf['keep_piVars']);
  319. foreach($keep_piVars as $piVar) {
  320. if(!empty($piVar))
  321. $result[] = '<input type="hidden" name="'.$this->caller->prefixId.'['.$piVar.']" value="'.$this->caller->piVars[$piVar].'" />';
  322. }
  323. return $result;
  324. }
  325. /**
  326. * Gets the PREVIEW fieldcode for field ($fN) of the form. This depends on the fields type.
  327. * @param string The field to get the fieldcode for.
  328. * @param boolean Should the output be with html (input fields) or not.
  329. */
  330. function getPreviewFieldCode($cmd,$fN,$withHTML) {
  331. # debug('getPreviewFieldCode():: fN='.$fN.', cmd='.$cmd,'function call');
  332. $fieldName = 'FE['.$this->table.']['.$fN.']';
  333. $type = $this->TCA["columns"][$fN]["config"]["type"];
  334. $feData = t3lib_div::_POST('FE');
  335. # debug(intval($feData[$this->table]['datetime']),'datetime');
  336. switch((string)$type) {
  337. case "input":
  338. $evalValuesArr = t3lib_div::trimExplode(',',$this->conf[$cmd.'.']['evalValues.'][$fN]);
  339. $displayTwice = false;
  340. $isPassword = false;
  341. foreach((array)$evalValuesArr as $eval) {
  342. switch((string)$eval) {
  343. case 'twice':
  344. $displayTwice = true;
  345. break;
  346. case 'password':
  347. $isPassword = true;
  348. break;
  349. }
  350. }
  351. $values = '###FIELD_'.$fN.'###';
  352. $feData = t3lib_div::_POST("FE");
  353. // Format the values. TODO: This only shows the date on a nice format if it is send to the page, not if it is from an overrideValue.
  354. if($isPassword) $values = '********';
  355. else if($this->TCA['columns'][$fN]["config"]["eval"]=='date' && !empty($feData[$this->table][$fN])) {
  356. $values = strftime("%e-%m-%Y",$feData[$this->table][$fN]);
  357. } else if($this->TCA['columns'][$fN]["config"]["eval"]=='datetime' && !empty($feData[$this->table][$fN])) {
  358. $values = strftime("%H:%M %e-%m-%Y",$feData[$this->table][$fN]);
  359. }
  360. if($displayTwice) {
  361. $fieldName_again = 'FE['.$this->table.']['.$fN.'_again]';
  362. return $withHTML?'<input type="hidden" name="'.$fieldName.'" /><input type="hidden" name="'.$fieldName_again.'" />'.$values:$values;
  363. } else {
  364. return $withHTML?'<input type="hidden" name="'.$fieldName.'" />'.$values:$values;
  365. }
  366. break;
  367. case "group":
  368. return $withHTML?'<input type="hidden" name="'.$fieldName.'" /><input type="hidden" name="FE['.$this->table.']['.$fN.'_file]" />###FIELD_'.$fN.'###,###FIELD_'.$fN.'_file###':'###FIELD_'.$fN.'###, ###FIELD_'.$fN.'_file###';
  369. break;
  370. case "select":
  371. $values = '###FIELD_'.$fN.'###';
  372. if($this->TCA['columns'][$fN]["config"]["foreign_table"]) { // reference to elements from another table
  373. $label = $GLOBALS["TCA"][$this->TCA['columns'][$fN]["config"]["foreign_table"]]["ctrl"]["label"];
  374. $feData = t3lib_div::_POST('FE');
  375. if($feData[$this->table][$fN]) {
  376. $uids = t3lib_div::trimExplode(',',$feData[$this->table][$fN]);
  377. $orClause = '';
  378. foreach($uids as $uid) $orClause .= $orClause ? 'OR uid LIKE \''.$uid.'\'' : 'uid = \''.$uid.'\'';
  379. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$this->TCA['columns'][$fN]["config"]["foreign_table"],$orClause);
  380. if($GLOBALS['TYPO3_DB']->sql_error()) debug($GLOBALS['TYPO3_DB']->sql_error(),'sql error');
  381. $values = '';
  382. while($resRow = mysql_fetch_assoc($res)) {
  383. $values .= $values ? ', ' . $resRow[$label] : $resRow[$label];
  384. }
  385. }
  386. } elseif($this->TCA['columns'][$fN]["config"]["items"]) { // fixed items
  387. $feData = t3lib_div::_POST('FE');
  388. if($feData[$this->table][$fN]) {
  389. $vals = t3lib_div::trimExplode(',',$feData[$this->table][$fN]);
  390. $values = '';
  391. foreach($this->TCA['columns'][$fN]["config"]["items"] as $item) {
  392. if(!empty($item)) {
  393. list($label,$val) = $item;
  394. if(in_array($val,$vals)) {
  395. $values .= $values ? ', ' . $label : $label;
  396. }
  397. }
  398. }
  399. }
  400. }
  401. return $withHTML?'<input type="hidden" name="'.$fieldName.'" />'.$values:$values;
  402. break;
  403. case "text":
  404. $values = '###FIELD_'.$fN.'###';
  405. $feData = t3lib_div::_POST('FE');
  406. if($feData[$this->table]['_TRANSFORM_'.$fN]) { // if rte output, this makes sure that it's not passed through htmlspecialchar
  407. $values = $feData[$this->table][$fN];
  408. }
  409. return $withHTML?'<input type="hidden" name="'.$fieldName.'" />'.$values:$values;
  410. break;
  411. default:
  412. return $withHTML?'<input type="hidden" name="'.$fieldName.'" />###FIELD_'.$fN.'###':'###FIELD_'.$fN.'###';
  413. break;
  414. }
  415. }
  416. /**
  417. * Gets the preview fieldcode for field ($fN) of the form. This depends on the fields type.
  418. * @param string The cmd. Should be 'edit' or 'create'.
  419. * @param string The field to get the fieldcode for.
  420. */
  421. function getFormFieldCode($cmd,$fN) {
  422. # $this->TCA['columns']['title']["config"]["eval"] = 'date';
  423. $fieldName = 'FE['.$this->table.']['.$fN.']';
  424. $class = $this->caller->pi_classParam('form-data-'.$fN);
  425. $defaultParams = ' name="'.$fieldName.'"'.$class;
  426. $type = $this->TCA["columns"][$fN]["config"]["type"];
  427. # debug($this->TCA['columns']);
  428. switch((string)$type) {
  429. case "input":
  430. $onChange = 'onChange="feedit_'.$this->table.'_formGet('."'".$fieldName."','".$this->TCA['columns'][$fN]["config"]["eval"]."','".$is_in."','".$checkbox."','".$checkboxVal."','".$checkbox_off."');".'"';
  431. $evalValuesArr = t3lib_div::trimExplode(',',$this->conf[$cmd.'.']['evalValues.'][$fN]);
  432. $displayTwice = false;
  433. $isPassword = false;
  434. foreach((array)$evalValuesArr as $eval) {
  435. switch((string)$eval) {
  436. case 'twice':
  437. $displayTwice = true;
  438. break;
  439. case 'password':
  440. $isPassword = true;
  441. break;
  442. }
  443. }
  444. $type = 'text';
  445. if($isPassword) $type = 'password';
  446. # debug($this->TCA['columns'][$fN]['config'],'config '.$fN);
  447. if($displayTwice) {
  448. $fieldName_again = 'FE['.$this->table.']['.$fN.'_again]';
  449. $onChange_again = 'onChange="feedit_'.$this->table.'_formGet('."'".$fieldName_again."','".$this->TCA['columns'][$fN]["config"]["eval"]."','".$is_in."','".$checkbox."','".$checkboxVal."','".$checkbox_off."');".'"';
  450. $this->additionalJS_end['feedit_'.$fN.'_set_data'] = 'feedit_'.$this->table.'_formSet('."'".$fieldName."','".$this->TCA['columns'][$fN]["config"]["eval"]."','".$is_in."','".$checkbox. "','".$checkboxVal."','".$checkbox_off."')".';';
  451. $this->additionalJS_end['feedit_'.$fN.'_again_set_data'] = 'feedit_'.$this->table.'_formSet('."'".$fieldName_again."','".$this->TCA['columns'][$fN]["config"]["eval"]."','".$is_in."','".$checkbox. "','".$checkboxVal."','".$checkbox_off."')".';';
  452. return '<input type="'.$type.'" name="'.$fieldName.'_feVal" '.$class.' maxlength="'.$this->TCA["columns"][$fN]["config"]["max"].'" '.$onChange.' />
  453. <input type="hidden" name="'.$fieldName.'" />
  454. <input type="'.$type.'" name="'.$fieldName_again.'_feVal" '.$class.' maxlength="'.$this->TCA["columns"][$fN]["config"]["max"].'" '.$onChange_again.' />
  455. <input type="hidden" name="'.$fieldName_again.'" />';
  456. } else {
  457. $this->additionalJS_end['feedit_'.$fN.'_set_data'] = 'feedit_'.$this->table.'_formSet('."'".$fieldName."','".$this->TCA['columns'][$fN]["config"]["eval"]."','".$is_in."','".$checkbox. "','".$checkboxVal."','".$checkbox_off."')".';';
  458. return
  459. '<input type="'.$type.'" name="'.$fieldName.'_feVal" id="'.$fieldName.'_feVal" '.$class.' maxlength="'.$this->TCA["columns"][$fN]["config"]["max"].'" '.$onChange.' />' .
  460. '<input type="hidden" name="'.$fieldName.'" />' .
  461. // inserts button for rlmp_dateselectlib
  462. (t3lib_extmgm::isLoaded('rlmp_dateselectlib') &&
  463. !empty($this->TCA['columns'][$fN]["config"]["eval"]) ?
  464. (is_int(array_search('date',t3lib_div::trimExplode(',',$this->TCA['columns'][$fN]["config"]["eval"])))
  465. ?
  466. tx_rlmpdateselectlib::getInputButton($fieldName.'_feVal',array('calConf.'=>array('inputFieldDateTimeFormat'=>'%e-%m-%Y')))
  467. :
  468. (is_int(array_search('datetime',t3lib_div::trimExplode(',',$this->TCA['columns'][$fN]["config"]["eval"])))
  469. ?
  470. tx_rlmpdateselectlib::getInputButton($fieldName.'_feVal',array('calConf.'=>array('inputFieldDateTimeFormat'=>'%H:%M %e-%m-%Y')))
  471. : ''))
  472. : '');
  473. }
  474. break;
  475. case "text":
  476. /**** GET THE SPECIELCONF FOR THE FIELD AND CHECK FOR USE OF AN RTE****/
  477. $useRTE = false;
  478. $specialConf = array();
  479. // Get the type value
  480. $type = 0; // default value
  481. $typeField = $this->TCA['ctrl']['type'];
  482. $uid = $feData[$this->table]['uid'] ? $feData[$this->table]['uid'] : t3lib_div::_GET('rU');
  483. if($typeField && $uid) { // get the type from the database else use default value
  484. $rec = $GLOBALS['TSFE']->sys_page->getRawRecord($this->table,$uid);
  485. $type = intval($rec[$typeField]);
  486. }
  487. // get the special configurations and check for an existing richtext configuration
  488. $showitem = $this->TCA['types'][$type]['showitem'] ? explode(',',$this->TCA['types'][$type]['showitem']) : explode(',',$this->TCA['types'][1]['showitem']); // if ['types'][$type] we should try with ['types'][1] according to TCA doc
  489. foreach((array)$showitem as $fieldConfig) {
  490. $fC = explode(';',$fieldConfig);
  491. if(trim($fC[0])==$fN) { // if field is $fN
  492. foreach(explode(':',$fC[3]) as $sC) {
  493. if(substr($sC,0,8)=='richtext') { // if there is a richtext configuration we found what we were looking for
  494. $buttons = substr(trim($sC),9,strlen(trim($sC))-10);
  495. $specialConf['richtext']['parameters'] = t3lib_div::trimExplode('|',$buttons);
  496. $useRTE = true;
  497. break;
  498. }
  499. }
  500. }
  501. }
  502. /**** USE RTE OR NOT ****/
  503. if($useRTE && is_object($this->RTEObj) && $this->RTEObj->isAvailable()) { // use RTE
  504. $this->RTEcounter++;
  505. $this->formName = $this->table.'_form';
  506. $this->strEntryField = $fN;
  507. $this->PA['itemFormElName'] = $fieldName;
  508. $feData = t3lib_div::_POST('FE');
  509. $this->PA['itemFormElValue'] = $feData[$this->table][$fN];
  510. $this->specConf = $specialConf;
  511. $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
  512. $this->thisConfig = $pageTSConfig['RTE.']['default.']['FE.'];
  513. # debug($this->thisConfig,'thisConfig');
  514. $this->thePidValue = $GLOBALS['TSFE']->id;
  515. $RTEItem = $this->RTEObj->drawRTE($this,$this->table,$fN,$row=array(), $this->PA, $this->specConf, $this->thisConfig, $this->RTEtypeVal, '', $this->thePidValue);
  516. return $RTEItem . '<div'.$this->caller->pi_classParam('rte-clearer').'></div>';
  517. } else { // dont use RTE
  518. return '<textarea'.$defaultParams.' cols="'.$this->TCA["columns"][$fN]["config"]["cols"].'" rows="'.$this->TCA["columns"][$fN]["config"]["rows"].'" wrap="VIRTUAL"></textarea>';
  519. }
  520. break;
  521. case "check":
  522. if($this->TCA['columns'][$fN]['config']['cols']>1) debug("getFormFieldCode():: WARNING, checkbox have more cols, not implementet yet.");
  523. return '<input type="hidden" '.$defaultParams.' value="0"><input type="checkbox" '.$defaultParams.' value="1">';
  524. break;
  525. case "group":
  526. if($this->TCA['columns'][$fN]["config"]["internal_type"]=='file') {
  527. // fetch data from table
  528. $feData = t3lib_div::_POST('FE');
  529. $uid = $feData[$this->table]['uid'] ? $feData[$this->table]['uid'] : t3lib_div::_GET('rU');
  530. $rec = $GLOBALS['TSFE']->sys_page->getRawRecord($this->table,$uid);
  531. // make option tags from existing data.
  532. $options = "";
  533. foreach(explode(",",$rec[$fN]) as $opt)
  534. $options .= '<option value="'.$opt.'">'.$opt.'</option>';
  535. $result .= '<select size="'.$this->TCA['columns'][$fN]["config"]["size"].'" name="FE['.$this->table.']['.$fN.']_select" style="width:250px;">
  536. '.$options.'
  537. </select>
  538. <input type="hidden" name="'.$fieldName.'">
  539. <a onClick="feedit_manipulateGroup(\''.$fieldName.'\');return false;"><img border="0" src="typo3/gfx/group_clear.gif"></a>';
  540. # unset($result);
  541. if($this->TCA['columns'][$fN]["config"]["maxitems"]>sizeof(explode(",",$rec[$fN]))) {
  542. $result .= $this->TCA['columns'][$fN]["config"]["allowed"].'<input type="file" name="FE['.$this->table.']['.$fN.'_file][]" />';
  543. }
  544. return $result;
  545. } else {
  546. debug("getFormFieldCode()::GROUP TYPE 'DB' NOT SUPPORTET YET");
  547. }
  548. break;
  549. case "select":
  550. $feData = t3lib_div::_POST('FE');
  551. $uid = $feData[$this->table]['uid'] ? $feData[$this->table]['uid'] : t3lib_div::_GET('rU');
  552. $rec = $GLOBALS['TSFE']->sys_page->getRawRecord($this->table,$uid);
  553. if($this->TCA['columns'][$fN]["config"]["foreign_table"]) { // reference to elements from another table
  554. $label = $GLOBALS["TCA"][$this->TCA['columns'][$fN]["config"]["foreign_table"]]["ctrl"]["label"];
  555. $foreignTable = $this->TCA['columns'][$fN]["config"]["foreign_table"];
  556. $whereClause = $this->TCA['columns'][$fN]["config"]["foreign_table_where"];
  557. $storageAndSiteroot = $GLOBALS["TSFE"]->getStorageSiterootPids();
  558. $whereClause = str_replace('###CURRENT_PID###',intval($storageAndSiteroot["_STORAGE_PID"])/*intval($GLOBALS["TSFE"]->page['uid'])*/,$whereClause); // replaced with STORAGE_PID cause it makes more sende ;)
  559. # $whereClause = str_replace('###THIS_UID###',,$whereClause);
  560. # $whereClause = str_replace('###THIS_CID###',,$whereClause);
  561. $whereClause = str_replace('###STORAGE_PID###',intval($storageAndSiteroot["_STORAGE_PID"]),$whereClause);
  562. $whereClause = str_replace('###SITEROOT###',intval($storageAndSiteroot['_SITEROOT']),$whereClause);
  563. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$foreignTable,'1=1 '.$whereClause . $this->cObj->enableFields($foreignTable));
  564. if (mysql_error()) debug(array(mysql_error()),'getFormFieldCode()::field='.$fN);
  565. // gets uids of selected records.
  566. $uids = array();
  567. if($feData[$this->table][$fN]) { // from post var
  568. $uids = explode(",",$feData[$this->table][$fN]);
  569. } elseif($this->TCA['columns'][$fN]["config"]["MM"] && $uid) { // from mm-relation
  570. #debug($GLOBALS['TYPO3_DB']->SELECTquery('*',$this->TCA['columns'][$fN]["config"]["MM"],'uid_local=\''.$uid.'\'','sorting'),'hej');
  571. $MMres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$this->TCA['columns'][$fN]["config"]["MM"],'uid_local=\''.$uid.'\'','sorting');
  572. if (mysql_error()) debug(array(mysql_error(),$query),'getFormFieldCode()::field='.$fN);
  573. if(mysql_num_rows($MMres)!=$rec[$fN])
  574. debug("Wrong number of selections reached");
  575. while($MMrow = mysql_fetch_assoc($MMres))
  576. $uids[] = $MMrow["uid_foreign"];
  577. } else { // clean from DB
  578. $uids = explode(",",$rec[$fN]);
  579. }
  580. # debug($uids,'uids');
  581. # debug($GLOBALS['TYPO3_DB']->sql_num_rows($res));
  582. while($resRow = mysql_fetch_assoc($res)) {
  583. $selected = in_array($resRow["uid"],$uids)?"selected":"";
  584. $options .= '<option value="'.$resRow["uid"].'" '.$selected.'>'.$resRow[$label].'</option>';
  585. }
  586. } elseif($this->TCA['columns'][$fN]["config"]["items"]) { // fixed items
  587. // Get selected uids.
  588. $uids = array();
  589. if($feData[$this->table][$fN]) { // from post var
  590. $uids = explode(",",$feData[$this->table][$fN]);
  591. } else { // clean from DB
  592. $uids = explode(",",$rec[$fN]);
  593. }
  594. $options = '<option value="0">-----</option>';
  595. foreach((array)$this->TCA['columns'][$fN]["config"]["items"] as $key => $item) {
  596. $selected = in_array($item[1],$uids)?"selected":"";
  597. if($key!=0)
  598. $options .= '<option value="'.$item[1].'"'.$selected.'>'.$this->getLLFromLabel($item[0]).'</option>';
  599. }
  600. } else { // unknown TCA config
  601. $options = '<option><em>Unknown TCA-configuration</em></option>';
  602. }
  603. if($this->TCA['columns'][$fN]["config"]["size"]) {
  604. $size = ' size="'.$this->TCA['columns'][$fN]["config"]["size"].'" ';
  605. if($this->TCA['columns'][$fN]["config"]["maxitems"]>1) {
  606. $size .= ' multiple ';
  607. $onChange = ' onChange="feedit_manipulateMultipleSelect(\''.$fieldName.'\')" ';
  608. $hr = '<input type="hidden" name="'.$fieldName.'" value="'.implode(",",$uids).'">';
  609. $name = substr($name,0,-1).'_select" ';
  610. }
  611. }
  612. $row .= '<select '.$size.' '.$onChange.' name="FE['.$this->table.']['.$fN.']_select">
  613. '.$options.'
  614. </select>'.$hr;
  615. return $row;
  616. break;
  617. case "radio":
  618. debug("getFormFieldCode():: radio buttons not implementet yet.");
  619. default:
  620. debug("getFormFieldCode():: Unknown type (".$type.") with field ".$fN);
  621. return '<input type="text"'.$defaultParams.' />';
  622. break;
  623. }
  624. }
  625. function getEditMenuTemplate() {
  626. return '
  627. <!-- ###TEMPLATE_EDITMENU### begin -->
  628. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-editmenu').'">'.$this->getLL("edit_menu_header").'</h1>').'
  629. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-editmenu').'">'.$this->getLL("edit_menu_description").'</div>
  630. <div'.$this->caller->pi_classParam('editmenu-list').'>
  631. <!-- ###ALLITEMS### begin -->
  632. <!-- ###ITEM### begin -->
  633. <div><a href="###FORM_URL###&rU=###FIELD_uid###&cmd=edit&backURL=###FORM_URL_ENC###'.rawurlencode('&cmd=edit').'">###FIELD_'.strtolower($this->id_field).'###</a></div>
  634. <!-- ###ITEM### end -->
  635. <!-- ###ALLITEMS### end -->
  636. </div>
  637. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-editmenu').'"><div><a href="###FORM_URL###&cmd=create">'.$this->getLL("edit_menu_createnew_label").'</a></div></div>
  638. <!-- ###TEMPLATE_EDITMENU### -->
  639. <!-- ###TEMPLATE_EDITMENU_NOITEMS### begin -->
  640. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-editmenu-noitems').'">'.$this->getLL("edit_menu_noitems_header").'</h1>').'
  641. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-editmenu-noitems').'">'.$this->getLL("edit_menu_noitems_description").'</div>
  642. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-editmenu-noitems').'"><div><a href="###FORM_URL###&cmd=create">'.$this->getLL("edit_menu_createnew_label").'</a></div></div>
  643. <!-- ###TEMPLATE_EDITMENU_NOITEMS### -->
  644. ';
  645. }
  646. function getEditTemplate() {
  647. $HTMLFormEdit = $this->makeHTMLForm('edit');
  648. $HTMLPreviewEdit = $this->makeHTMLPreview('edit');
  649. if($this->conf['delete.']['preview']) {
  650. $deleteLink = '<div><a href="###FORM_URL###&cmd=delete&preview=1&backURL=###FORM_URL_ENC###&rU=###REC_UID###">'.$this->getLL("edit_delete_label").'</a></div>';
  651. } else {
  652. $deleteLink = '<div><a href="###FORM_URL###&cmd=delete&backURL=###FORM_URL_ENC###&rU=###REC_UID###" onClick="return confirm(\''.$this->getLL("edit_delete_confirm").'\');">'.$this->getLL("edit_delete_label").'</a></div>';
  653. }
  654. if(!$this->conf['delete']) $deleteLink = '';
  655. return '
  656. <!-- ###TEMPLATE_EDIT### -->
  657. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-edit').'">'.$this->getLL("edit_header_prefix").' "###FIELD_'.strtolower($this->id_field).'###"</h1>').'
  658. '.($this->conf['text_in_top_of_form']?'<div'.$this->caller->pi_classParam('form-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_form'],$this->conf['text_in_top_of_form.']).'</div>':'').'
  659. <div'.$this->caller->pi_classParam('form-wrap').'>
  660. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'" onsubmit="'.implode(';', $this->additionalJS_submit).'">
  661. '.$HTMLFormEdit.'
  662. <div'.$this->caller->pi_classParam('form-row').'>
  663. ###HIDDENFIELDS###
  664. <input type="Submit" name="submit" value="'.$this->getLL("edit_submit_label").'"'.$this->caller->pi_classParam('form-submit').'>
  665. </div>
  666. </form>
  667. <script type="text/javascript">
  668. '.implode(chr(10), $this->additionalJS_post).'
  669. </script>
  670. </div>
  671. </div>
  672. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-edit').'">
  673. '.$deleteLink.'
  674. <div><a href="###FORM_URL###&cmd=edit">'.$this->getLL("back_label").'</a></div>
  675. </div>
  676. <!-- ###TEMPLATE_EDIT### end-->
  677. <!-- ###TEMPLATE_EDIT_PREVIEW### -->
  678. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-edit-preview').'">'.$this->getLL("edit_header_prefix").' "###FIELD_'.strtolower($this->id_field).'###"</h1>').'
  679. '.($this->conf['text_in_top_of_preview']?'<div'.$this->caller->pi_classParam('preview-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_preview'],$this->conf['text_in_top_of_preview.']).'</div>':'').'
  680. <div'.$this->caller->pi_classParam('preview-wrap').'>
  681. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'">
  682. '.$HTMLPreviewEdit.'
  683. <div'.$this->caller->pi_classParam('preview-row').'>
  684. ###HIDDENFIELDS###
  685. <input type="Submit" name="doNotSave" value="'.$this->getLL("edit_preview_donotsave_label").'"'.$this->caller->pi_classParam('preview-donotsave').'>
  686. <input type="Submit" name="submit" value="'.$this->getLL("edit_preview_submit_label").'"'.$this->caller->pi_classParam('preview-submit').'>
  687. </div>
  688. </form>
  689. </div>
  690. <!-- ###TEMPLATE_EDIT_PREVIEW### end-->
  691. <!-- ###TEMPLATE_EDIT_SAVED### begin-->
  692. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-edit-saved').'">'.$this->getLL("edit_saved_header").'</h1>').'
  693. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-edit-saved').'">'.$this->getLL("edit_saved_message").'</div>
  694. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-edit-saved').'"><div><a href="###FORM_URL###&cmd=edit">'.$this->getLL("back_label").'</a></div></div>
  695. <!-- ###TEMPLATE_EDIT_SAVED### end-->
  696. ';
  697. }
  698. function getCreateTemplate() {
  699. $HTMLFormCreate = $this->makeHTMLForm('create');
  700. $HTMLPreviewCreate = $this->makeHTMLPreview('create');
  701. return '
  702. <!-- ###TEMPLATE_CREATE_LOGIN### -->
  703. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-create-login').'">'.$this->getLL("create_header_prefix").' '.$this->getLLFromLabel($this->TCA["ctrl"]["title"]).'</h1>').'
  704. '.($this->conf['text_in_top_of_form']?'<div'.$this->caller->pi_classParam('form-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_form'],$this->conf['text_in_top_of_form.']).'</div>':'').'
  705. <div'.$this->caller->pi_classParam('form-wrap').'>
  706. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'" onsubmit="'.implode(';', $this->additionalJS_submit).'">
  707. '.$HTMLFormCreate.'
  708. <div'.$this->caller->pi_classParam('form-row').'>
  709. ###HIDDENFIELDS###
  710. <input type="Submit" name="submit" value="'.$this->getLL("create_submit_label").'"'.$this->caller->pi_classParam('form-submit').'>
  711. </div>
  712. </form>
  713. <script type="text/javascript">
  714. '.implode(chr(10), $this->additionalJS_post).'
  715. </script>
  716. </div>
  717. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-create-login').'"><div><a href="###FORM_URL###&cmd=edit">'.$this->getLL("create_edit_link").'</a></div></div>
  718. <!-- ###TEMPLATE_CREATE_LOGIN### end-->
  719. <!-- ###TEMPLATE_CREATE_LOGIN_PREVIEW### begin-->
  720. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-create-login-preview').'">'.$this->getLL("create_header_prefix").' '.$this->getLLFromLabel($this->TCA["ctrl"]["title"]).'</h1>').'
  721. '.($this->conf['text_in_top_of_preview']?'<div'.$this->caller->pi_classParam('preview-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_preview'],$this->conf['text_in_top_of_preview.']).'</div>':'').'
  722. <div'.$this->caller->pi_classParam('preview-wrap').'>
  723. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'">
  724. '.$HTMLPreviewCreate.'
  725. <div'.$this->caller->pi_classParam('preview-row').'>
  726. ###HIDDENFIELDS###
  727. <input type="Submit" name="doNotSave" value="'.$this->getLL("create_preview_donotsave_label").'"'.$this->caller->pi_classParam('preview-donotsave').'>
  728. <input type="Submit" name="submit" value="'.$this->getLL("create_preview_submit_label").'"'.$this->caller->pi_classParam('preview-submit').'>
  729. </div>
  730. </form>
  731. </div>
  732. <!-- ###TEMPLATE_CREATE_LOGIN_PREVIEW### end-->
  733. <!-- ###TEMPLATE_CREATE### -->
  734. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-create').'">'.$this->getLL("create_header_prefix").' '.$this->getLLFromLabel($this->TCA["ctrl"]["title"]).'</h1>').'
  735. '.($this->conf['text_in_top_of_form']?'<div'.$this->caller->pi_classParam('form-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_form'],$this->conf['text_in_top_of_form.']).'</div>':'').'
  736. <div'.$this->caller->pi_classParam('form-wrap').'>
  737. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'" onsubmit="'.implode(';', $this->additionalJS_submit).'">
  738. '.$HTMLFormCreate.'
  739. <div'.$this->caller->pi_classParam('form-row').'>
  740. ###HIDDENFIELDS###
  741. <input type="Submit" name="submit" value="'.$this->getLL("create_submit_label").'"'.$this->caller->pi_classParam('form-submit').'>
  742. </div>
  743. </form>
  744. <script type="text/javascript">
  745. '.implode(chr(10), $this->additionalJS_post).'
  746. </script>
  747. </div>
  748. </div>
  749. <!-- ###TEMPLATE_CREATE### end-->
  750. <!-- ###TEMPLATE_CREATE_PREVIEW### begin-->
  751. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-create-preview').'">'.$this->getLL("create_header_prefix").' '.$this->getLLFromLabel($this->TCA["ctrl"]["title"]).'</h1>').'
  752. '.($this->conf['text_in_top_of_preview']?'<div'.$this->caller->pi_classParam('preview-text').'>'.$this->cObj->stdWrap($this->conf['text_in_top_of_preview'],$this->conf['text_in_top_of_preview.']).'</div>':'').'
  753. <div'.$this->caller->pi_classParam('preview-wrap').'>
  754. <form name="'.$this->table.'_form" method="post" action="###FORM_URL###" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'">
  755. '.$HTMLPreviewCreate.'
  756. <div'.$this->caller->pi_classParam('preview-row').'>
  757. ###HIDDENFIELDS###
  758. <input type="Submit" name="doNotSave" value="'.$this->getLL("create_preview_donotsave_label").'"'.$this->caller->pi_classParam('preview-donotsave').'>
  759. <input type="Submit" name="submit" value="'.$this->getLL("create_preview_submit_label").'"'.$this->caller->pi_classParam('preview-submit').'>
  760. </div>
  761. </form>
  762. </div>
  763. <!-- ###TEMPLATE_CREATE_PREVIEW### end-->
  764. <!-- ###TEMPLATE_CREATE_SAVED### begin-->
  765. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-create-saved').'">'.$this->getLL("create_saved_header").'</h1>').'
  766. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-create-saved').'">'.$this->getLL("create_saved_message").'</div>
  767. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-create-saved').'"><div><a href="###FORM_URL###&cmd=create">'.$this->getLL("back_label").'</a></div></div>
  768. <!-- ###TEMPLATE_CREATE_SAVED### end-->
  769. ';
  770. }
  771. function getDeleteTemplate() {
  772. return '
  773. <!-- ###TEMPLATE_DELETE_PREVIEW### begin-->
  774. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-delete-preview').'">'.$this->getLL("delete_preview_header").'</h1>').'
  775. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-delete-preview').'">'.$this->getLL("delete_preview_message").'</div>
  776. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-delete-preview').'">
  777. <div><a href="###FORM_URL###&cmd=delete&backURL=###FORM_URL_ENC###&rU=###REC_UID###">'.$this->getLL("delete_preview_delete_label").'</a></div>
  778. <div><a href="###FORM_URL###&cmd=edit&rU=###REC_UID###&backURL=###BACK_URL###" >'.$this->getLL("delete_preview_dont_delete_label").'</a></div>
  779. </div>
  780. <!-- ###TEMPLATE_DELETE_PREVIEW### end-->
  781. <!-- ###TEMPLATE_DELETE_SAVED### begin-->
  782. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-delete-saved').'">'.$this->getLL("delete_saved_header").'</h1>').'
  783. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-delete-saved').'">'.$this->getLL("delete_saved_message").'</div>
  784. <div class="'.$this->caller->pi_getClassName('link').' '.$this->caller->pi_getClassName('link-delete-saved').'"><div><a href="###FORM_URL###&cmd=edit">'.$this->getLL("back_label").'</a></div></div>
  785. <!-- ###TEMPLATE_DELETE_SAVED### end-->
  786. ';
  787. }
  788. function getSetfixedTemplate() {
  789. return '
  790. <!-- ###TEMPLATE_SETFIXED_OK### -->
  791. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-setfixed-ok').'">Setfixed succeeded</h1>').'
  792. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-setfixed-ok').'">Record uid; ###FIELD_uid###</div>
  793. <!-- ###TEMPLATE_SETFIXED_OK### end-->
  794. <!-- ###TEMPLATE_SETFIXED_OK_DELETE### -->
  795. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-setfixed-ok-delete').'">Setfixed delete record "###FIELD_uid###"</h1>').'
  796. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-setfixed-ok').'">Record uid; ###FIELD_uid###</div>
  797. <!-- ###TEMPLATE_SETFIXED_OK_DELETE### end-->
  798. <!-- ###TEMPLATE_SETFIXED_FAILED### -->
  799. '.($this->conf['no_header']?'':'<h1 class="'.$this->caller->pi_getClassName('header').' '.$this->caller->pi_getClassName('header-setfixed-failed').'">Setfixed failed!</h1>').'
  800. <div class="'.$this->caller->pi_getClassName('message').' '.$this->caller->pi_getClassName('message-setfixed-failed').'">May happen if you click the setfixed link a second time (if the record has changed since the setfixed link was generated this error will happen!)</div>
  801. <!-- ###TEMPLATE_SETFIXED_FAILED### end-->
  802. ';
  803. }
  804. function getEmailTemplate() {
  805. return '
  806. <!-- ###EMAIL_TEMPLATE_CREATE_SAVED### begin -->
  807. [Auto Generated Message] Your informations has been saved.
  808. <!--###SUB_RECORD###-->
  809. You have submitted the following informations at '.t3lib_div::getIndpEnv('TYPO3_SITE_URL').':'.chr(10).'
  810. '.$this->makeTEXTPreview('all').'
  811. <!--###SUB_RECORD###-->
  812. <!-- ###EMAIL_TEMPLATE_CREATE_SAVED### end-->
  813. <!-- ###EMAIL_TEMPLATE_CREATE_SAVED-ADMIN### begin -->
  814. [Auto Generated Message] New record created.
  815. <!--###SUB_RECORD###-->
  816. '.$this->makeTEXTPreview('all').'
  817. Approve:
  818. ###THIS_URL######FORM_URL######SYS_SETFIXED_approve###
  819. Delete:
  820. ###THIS_URL######FORM_URL######SYS_SETFIXED_DELETE###
  821. <!--###SUB_RECORD###-->
  822. <!-- ###EMAIL_TEMPLATE_CREATE_SAVED-ADMIN### end-->
  823. <!-- ###EMAIL_TEMPLATE_EDIT_SAVED-ADMIN### begin -->
  824. [Auto Generated Message] Consultancy record edited.
  825. <!--###SUB_RECORD###-->
  826. '.$this->makeTEXTPreview('all').'
  827. Approve:
  828. ###THIS_URL######FORM_URL######SYS_SETFIXED_approve###
  829. Delete:
  830. ###THIS_URL######FORM_URL######SYS_SETFIXED_DELETE###
  831. <!--###SUB_RECORD###-->
  832. <!-- ###EMAIL_TEMPLATE_EDIT_SAVED-ADMIN### end-->
  833. <!-- ###EMAIL_TEMPLATE_SETFIXED_DELETE### begin -->
  834. Consultancy DELETED!
  835. <!--###SUB_RECORD###-->
  836. Record name: ###FIELD_'.$this->id_field.'###
  837. Your entry has been deleted by the admin for some reason.
  838. - kind regards.
  839. <!--###SUB_RECORD###-->
  840. <!-- ###EMAIL_TEMPLATE_SETFIXED_DELETE### begin -->
  841. <!-- ###EMAIL_TEMPLATE_SETFIXED_approve### begin -->
  842. Consultancy approved
  843. <!--###SUB_RECORD###-->
  844. Record name: ###FIELD_'.$this->id_field.'###
  845. Your consultancy entry has been approved!
  846. - kind regards.
  847. <!--###SUB_RECORD###-->
  848. <!-- ###EMAIL_TEMPLATE_SETFIXED_approve### begin -->
  849. ';
  850. }
  851. function getRequiredTemplate() {
  852. return '
  853. <!-- ###TEMPLATE_AUTH### -->
  854. '.($this->conf['no_h

Large files files are truncated, but you can click here to view the full file