/** * Main Method, rendering either colorpicker or frameset depending on ->showPicker * * @return void * @todo Define visibility */ public function main() { // Show frameset by default: if (!\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('showPicker')) { $this->frameSet(); } else { // Putting together the items into a form: $content = ' <form name="colorform" method="post" action="wizard_colorpicker.php"> ' . $this->colorMatrix() . ' ' . $this->colorList() . ' ' . $this->colorImage() . ' <!-- Value box: --> <p class="c-head">' . $GLOBALS['LANG']->getLL('colorpicker_colorValue', 1) . '</p> <table border="0" cellpadding="0" cellspacing="3"> <tr> <td><input type="text" ' . $this->doc->formWidth(7) . ' maxlength="10" name="colorValue" value="' . htmlspecialchars($this->colorValue) . '" /></td> <td style="background-color:' . htmlspecialchars($this->colorValue) . '; border: 1px solid black;"> <span style="color: black;">' . $GLOBALS['LANG']->getLL('colorpicker_black', 1) . '</span> <span style="color: white;">' . $GLOBALS['LANG']->getLL('colorpicker_white', 1) . '</span> </td> <td><input type="submit" name="save_close" value="' . $GLOBALS['LANG']->getLL('colorpicker_setClose', 1) . '" /></td> </tr> </table> <!-- Hidden fields with values that has to be kept constant --> <input type="hidden" name="showPicker" value="1" /> <input type="hidden" name="fieldChangeFunc" value="' . htmlspecialchars($this->fieldChangeFunc) . '" /> <input type="hidden" name="fieldChangeFuncHash" value="' . htmlspecialchars($this->fieldChangeFuncHash) . '" /> <input type="hidden" name="fieldName" value="' . htmlspecialchars($this->fieldName) . '" /> <input type="hidden" name="formName" value="' . htmlspecialchars($this->formName) . '" /> <input type="hidden" name="md5ID" value="' . htmlspecialchars($this->md5ID) . '" /> <input type="hidden" name="exampleImg" value="' . htmlspecialchars($this->exampleImg) . '" /> </form>'; // If the save/close button is clicked, then close: if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('save_close')) { $content .= $this->doc->wrapScriptTags(' setValue(\'' . $this->colorValue . '\'); parent.close(); '); } // Output: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('colorpicker_title'), $content, 0, 1); } }
/** * Constructor function for class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->number = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('number'); $this->target = $combinedIdentifier = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); // create the folder object if ($combinedIdentifier) { $this->folderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); } // Cleaning and checking target directory if (!$this->folderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586843); } // Setting the title and the icon $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->folderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->folderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_newfolder.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' var path = "' . $this->target . '"; function reload(a) { // if (!changed || (changed && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . '))) { var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . rawurlencode($this->returnUrl) . '"; window.location.href = "file_newfolder.php?"+params; } } function backToList() { // top.goToModule("file_list"); } var changed = 0; '); }
/** * Constructor function for class * * @return void * @todo Define visibility */ public function init() { // Initialize GPvars: $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target'); $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl')); // Cleaning and checking target if ($this->target) { $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target); } if (!$this->fileOrFolderObject) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE); $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE); throw new \RuntimeException($title . ': ' . $message, 1294586844); } // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced // so the redirect will NOT end in a error message // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to // rename the folder if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) { $parsedUrl = parse_url($this->returnUrl); $queryParts = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query'])); if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) { $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl); } } // Setting icon and title $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root'); $this->title = $icon . htmlspecialchars($this->fileOrFolderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileOrFolderObject->getIdentifier()); // Setting template object $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->setModuleTemplate('templates/file_rename.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->JScode = $this->doc->wrapScriptTags(' function backToList() { // top.goToModule("file_list"); } '); }