📄 class.tx_tstemplateinfo.php
字号:
} } } $resList=implode(t3lib_div::trimExplode(",",$resList,1),","); if (strcmp($resList,$tplRow["resources"])) { $recData["sys_template"][$saveId]["resources"] = $resList; // debug("update resource - ".$resList); } if (count($recData)) { // Create new tce-object $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->stripslashes_values=0; $tce->alternativeFileName = $alternativeFileName; // Initialize // debug($recData); $tce->start($recData,Array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd("all"); // re-read the template ... $this->initialize_editor($this->pObj->id,$template_uid); } // Unlink any uploaded/new temp files there was: t3lib_div::unlink_tempfile($tmp_upload_name); t3lib_div::unlink_tempfile($tmp_newresource_name); // If files has been edited: if (is_array($edit)) { if ($edit["filename"] && $tplRow["resources"] && t3lib_div::inList($tplRow["resources"], $edit["filename"])) { // Check if there are resources, and that the file is in the resourcelist. $path = PATH_site.$TCA["sys_template"]["columns"]["resources"]["config"]["uploadfolder"]."/".$edit["filename"]; $fI=t3lib_div::split_fileref($edit["filename"]); if (@is_file($path) && t3lib_div::getFileAbsFileName($path) && t3lib_div::inList($this->pObj->textExtensions,$fI["fileext"])) { // checks that have already been done.. Just to make sure if (filesize($path)<(30*1024)) { // checks that have already been done.. Just to make sure t3lib_div::writeFile($path,$edit['file']); $theOutput.=$this->pObj->doc->spacer(10); $theOutput.=$this->pObj->doc->section("<font color=red>FILE CHANGED</font>","Resource '".$edit["filename"]."' has been updated.",0,0,0,1); // Clear cache - the file has probably affected the template setup $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->stripslashes_values=0; $tce->start(Array(),Array()); $tce->clear_cacheCmd("all"); } } } } } $theOutput.=$this->pObj->doc->spacer(5); $theOutput.=$this->pObj->doc->section("Template information:",'<img src="'.$BACK_PATH.t3lib_iconWorks::getIcon("sys_template",$tplRow).'" width=18 height=16 align=top><b>'.htmlspecialchars($tplRow["title"]).'</b>'.htmlspecialchars(trim($tplRow["sitetitle"])?' - ('.$tplRow["sitetitle"].')':''),0,1); if ($manyTemplatesMenu) { $theOutput.=$this->pObj->doc->section("",$manyTemplatesMenu); $theOutput.=$this->pObj->doc->divider(5); } /* $e[constants]=1; $e[config]=1; $e[title]=1; $e[sitetitle]=1; */ #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150); #if (!$numberOfRows) $numberOfRows = 35; if (t3lib_div::_POST('abort')) {unset($e);} // If abort pressed, nothing should be edited. if (is_array($e)) { $theOutput.=$this->pObj->doc->section("",'<BR><input type="Submit" name="submit" value="Update"> <input type="Submit" name="abort" value="Cancel">'); } if ($e["title"]) { $outCode='<input type="Text" name="data[title]" value="'.htmlspecialchars($tplRow[title]).'"'.$this->pObj->doc->formWidth().'>'; $outCode.='<input type="Hidden" name="e[title]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Title:",$outCode); } if ($e["sitetitle"]) { $outCode='<input type="Text" name="data[sitetitle]" value="'.htmlspecialchars($tplRow[sitetitle]).'"'.$this->pObj->doc->formWidth().'>'; $outCode.='<input type="Hidden" name="e[sitetitle]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Sitetitle:",$outCode); } if ($e["description"]) { $outCode='<textarea name="data[description]" rows="5" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48,"","").'>'.t3lib_div::formatForTextarea($tplRow[description]).'</textarea>'; $outCode.='<input type="Hidden" name="e[description]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Description:",$outCode); } if ($e["resources"]) { // Upload $outCode='<input type="File" name="resources"'.$this->pObj->doc->formWidth().' size="50">'; $outCode.='<input type="Hidden" name="data[resources]" value="1">'; $outCode.='<input type="Hidden" name="e[resources]" value="1">'; $outCode.='<BR>Allowed extensions: <b>'.$TCA["sys_template"]["columns"]["resources"]["config"]["allowed"].'</b>'; $outCode.='<BR>Max file size: <b>'.t3lib_div::formatSize($TCA["sys_template"]["columns"]["resources"]["config"]["max_size"]*1024).'</b>'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Upload resource:",$outCode); // New $opt=explode(",",$this->pObj->textExtensions); $optTags=""; while(list(,$extVal)=each($opt)) { $optTags.='<option value="'.$extVal.'">.'.$extVal.'</option>'; } $outCode='<input type="text" name="new_resource"'.$this->pObj->doc->formWidth(20).'> <select name="new_resource_ext">'.$optTags.'</select>'; $outCode.='<input type="Hidden" name="data[new_resource]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("New text resource (enter name):",$outCode); // Make copy $rL = $this->resourceListForCopy($this->pObj->id,$template_uid); if ($rL) { $theOutput.=$this->pObj->doc->spacer(20); $theOutput.=$this->pObj->doc->section("Make a copy of resource:",$rL); } // Update resource list $rL = $this->procesResources($tplRow["resources"],1); if ($rL) { $theOutput.=$this->pObj->doc->spacer(20); $theOutput.=$this->pObj->doc->section("Update resource list:",$rL); } } if ($e["constants"]) { $outCode='<textarea name="data[constants]" rows="'.$numberOfRows.'" wrap="off" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48,"width:98%;height:70%","off").' class="fixed-font">'.t3lib_div::formatForTextarea($tplRow["constants"]).'</textarea>'; $outCode.='<input type="Hidden" name="e[constants]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Constants:",""); $theOutput.=$this->pObj->doc->sectionEnd().$outCode; } if ($e["file"]) { $path = PATH_site.$TCA["sys_template"]["columns"]["resources"]["config"]["uploadfolder"]."/".$e[file]; $fI=t3lib_div::split_fileref($e[file]); if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions,$fI["fileext"])) { if (filesize($path)<($TCA['sys_template']['columns']['resources']['config']['max_size']*1024)) { $fileContent = t3lib_div::getUrl($path); $outCode='File: <b>'.$e[file].'</b><BR>'; $outCode.='<textarea name="edit[file]" rows="'.$numberOfRows.'" wrap="off" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48,"width:98%;height:70%","off").' class="fixed-font">'.t3lib_div::formatForTextarea($fileContent).'</textarea>'; $outCode.='<input type="Hidden" name="edit[filename]" value="'.$e[file].'">'; $outCode.='<input type="Hidden" name="e[file]" value="'.htmlspecialchars($e[file]).'">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Edit Resource:",""); $theOutput.=$this->pObj->doc->sectionEnd().$outCode; } else { $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section('<font color=red>Filesize exceeded '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' Kbytes</font>','Files larger than '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' KByes are not allowed to be edited.',0,0,0,1); } } } if ($e["config"]) { $outCode='<textarea name="data[config]" rows="'.$numberOfRows.'" wrap="off" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48,"width:98%;height:70%","off").' class="fixed-font">'.t3lib_div::formatForTextarea($tplRow["config"]).'</textarea>'; if (t3lib_extMgm::isLoaded("tsconfig_help")) { $url=$BACK_PATH."wizard_tsconfig.php?mode=tsref"; $params=array(); $params["formName"]="editForm"; $params["itemName"]="data[config]"; $outCode.='<a href="#" onClick="vHWin=window.open(\''.$url.t3lib_div::implodeArrayForUrl("",array("P"=>$params)).'\',\'popUp'.$md5ID.'\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;"><img '.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/wizard_tsconfig.gif').' width="22" height="27" border="0" title="TSref reference"></a>'; } $outCode.='<input type="Hidden" name="e[config]" value="1">'; $theOutput.=$this->pObj->doc->spacer(15); $theOutput.=$this->pObj->doc->section("Setup:",""); $theOutput.=$this->pObj->doc->sectionEnd().$outCode; } if (is_array($e)) { $theOutput.=$this->pObj->doc->section("",'<BR><input type="Submit" name="submit" value="Update"> <input type="Submit" name="abort" value="Cancel">'); } // Processing: // debug($tplRow); $outCode=""; $outCode.=$this->tableRow("Title:",htmlspecialchars($tplRow["title"]),"title"); $outCode.=$this->tableRow("Sitetitle:",htmlspecialchars($tplRow["sitetitle"]),"sitetitle"); $outCode.=$this->tableRow("Description:",nl2br(htmlspecialchars($tplRow["description"])),"description"); $outCode.=$this->tableRow("Resources:",$this->procesResources($tplRow["resources"]),"resources"); $outCode.=$this->tableRow("Constants:","(edit to view, ".(trim($tplRow[constants]) ? count(explode(chr(10), $tplRow[constants])):0)." lines)","constants"); $outCode.=$this->tableRow("Setup:","(edit to view, ".(trim($tplRow[config]) ? count(explode(chr(10), $tplRow[config])):0)." lines)","config"); $outCode='<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$outCode.'</table>'; $outCode='<table border=0 cellpadding=0 cellspacing=0> <tr><td class="bgColor2">'.$outCode.'<img src=clear.gif width=465 height=1></td></tr> </table>'; // Edit all icon: $outCode.='<BR><a href="#" onClick="'.t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0').'&edit[sys_template]['.$tplRow['uid'].']=edit',$BACK_PATH,'').'"><strong>Click here to edit whole template record</strong></a>'; $theOutput.=$this->pObj->doc->spacer(25); $theOutput.=$this->pObj->doc->section("",$outCode); $theOutput.=$this->pObj->doc->spacer(10); $theOutput.=$this->pObj->doc->section("Cache",'Click here to <a href="index.php?id='.$this->pObj->id.'&clear_all_cache=1"><strong>clear all cache</strong></a>.<BR><br> Status: '.$this->pObj->getCountCacheTables(1),0,1); // $theOutput.=$this->pObj->doc->divider(5);# $menu = htmlspecialchars("Rows in <TEXTAREA> fields: ").t3lib_BEfunc::getFuncInput($this->pObj->id,"SET[ts_template_editor_TArows]",$this->pObj->MOD_SETTINGS["ts_template_editor_TArows"]);# $theOutput.=$this->pObj->doc->section("CONFIG:",$menu,0,1); } else { $theOutput.=$this->pObj->noTemplate(1); } return $theOutput; }}if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_info/class.tx_tstemplateinfo.php"]) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_info/class.tx_tstemplateinfo.php"]);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -