Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _processCmsTags
  • addArtspec
  • addslashes_deep
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • endsWith
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAktuellType
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • modTestModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • putFileContents
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setHelpContext
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • stripslashes_deep
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the module template handler class.
  4:  * TODO: Rework comments of this class.
  5:  *
  6:  * @package    Core
  7:  * @subpackage Backend
  8:  * @version    SVN Revision $Rev:$
  9:  *
 10:  * @author     Rusmir Jusufovic
 11:  * @copyright  four for business AG <www.4fb.de>
 12:  * @license    http://www.contenido.org/license/LIZENZ.txt
 13:  * @link       http://www.4fb.de
 14:  * @link       http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: cInclude('external', 'codemirror/class.codemirror.php');
 20: cInclude('includes', 'functions.file.php');
 21: 
 22: /**
 23:  * Class handels the view, creation, edit, delete of modul templates.
 24:  *
 25:  * @package    Core
 26:  * @subpackage Backend
 27:  */
 28: class cModuleTemplateHandler extends cModuleHandler {
 29: 
 30:     // Form fields
 31:     private $_code;
 32:     private $_file;
 33:     private $_tmp_file;
 34:     private $_area;
 35:     private $_frame;
 36:     private $_status;
 37:     private $_action;
 38:     private $_new;
 39:     private $_delete;
 40:     private $_selectedFile;
 41:     private $_reloadScript;
 42:     private $_page = NULL;
 43:     private $_notification = NULL;
 44: 
 45:     /**
 46:      * The file end of template files.
 47:      *
 48:      * @var string
 49:      */
 50:     private $_templateFileEnding = 'html';
 51: 
 52:     /**
 53:      * The name of the new file.
 54:      *
 55:      * @var string
 56:      */
 57:     private $_newFileName = 'newfilename';
 58: 
 59:     /**
 60:      * Action name for create htmltpl
 61:      *
 62:      * @var string
 63:      */
 64:     private $_actionCreate = 'htmltpl_create';
 65: 
 66:     /**
 67:      * Action name for edit htmltpl
 68:      *
 69:      * @var string
 70:      */
 71:     private $_actionEdit = 'htmltpl_edit';
 72: 
 73:     /**
 74:      * Action name for delete htmltpl_edit
 75:      *
 76:      * @var string
 77:      */
 78:     private $_actionDelete = 'htmltpl_delete';
 79: 
 80:     /**
 81:      * In template we test if we have premission for htmltpl.
 82:      *
 83:      * @var string
 84:      */
 85:     private $_testArea = 'htmltpl';
 86: 
 87:     public function __construct($idmod, $page) {
 88:         parent::__construct($idmod);
 89:         $this->_page = $page;
 90:         $this->_notification = new cGuiNotification();
 91:     }
 92: 
 93:     /**
 94:      * Set the new delete from Form.
 95:      * This are set if user had push the delete or new button.
 96:      *
 97:      * @param string $new
 98:      * @param string $delete
 99:      */
100:     public function setNewDelete($new, $delete) {
101:         $this->_new = $new;
102:         $this->_delete = $delete;
103:     }
104: 
105:     /**
106:      * Set the code from Form!
107:      *
108:      * @param string $code
109:      */
110:     public function setCode($code) {
111:         $this->_code = stripslashes($code);
112:     }
113: 
114:     /**
115:      * Set the selected file from Form.
116:      *
117:      * @param string $selectedFile
118:      */
119:     public function setSelectedFile($selectedFile) {
120:         $this->_selectedFile = $selectedFile;
121:     }
122: 
123:     /**
124:      * Set the file and tmpFile from Form.
125:      * (get it with $_Request...)
126:      *
127:      * @param string $file
128:      * @param string $tmpFile
129:      */
130:     public function setFiles($file, $tmpFile) {
131:         $this->_file = $file;
132:         $this->_tmp_file = $tmpFile;
133:     }
134: 
135:     /**
136:      * Set the status it can be send or empty ''
137:      *
138:      * @param string $status
139:      */
140:     public function setStatus($status) {
141:         $this->_status = $status;
142:     }
143: 
144:     /**
145:      * Set $frame and idmod and are.
146:      *
147:      * @param int $frame
148:      * @param int $idmod
149:      * @param int $area
150:      */
151:     public function setFrameIdmodArea($frame, $idmod, $area) {
152:         $this->_frame = $frame;
153:         $this->_idmod = $idmod;
154:         $this->_area = $area;
155:     }
156: 
157:     /**
158:      * We have two actions wich could send from form.
159:      *
160:      * @param string $action
161:      */
162:     public function setAction($action) {
163:         $this->_action = $action;
164:     }
165: 
166:     /**
167:      * Checks write permissions for module template
168:      *
169:      * @return $this warning notification
170:      * @return boolean true
171:      */
172:     public function checkWritePermissions() {
173:         if ($this->moduleWriteable('template') == false) {
174:             return $this->_notification->displayNotification(cGuiNotification::LEVEL_WARNING, i18n("You have no write permissions for this module"));
175:         } else {
176:             return true;
177:         }
178:     }
179: 
180:     /**
181:      * The method decide what action is send from
182:      * user (form).
183:      *
184:      * @throws cException if one of the filenames is not set
185:      * @return string [new, delete,empty,save,rename, default]
186:      */
187:     private function _getAction() {
188:         global $newModTpl, $deleteModTpl;
189: 
190:         if (isset($this->_status)) {
191: 
192:             if (isset($newModTpl)) {
193:                 return 'new';
194:             }
195: 
196:             if (isset($deleteModTpl)) {
197:                 return 'delete';
198:             }
199: 
200:             if (isset($this->_file) && isset($this->_tmp_file)) {
201:                 if ($this->_file == $this->_tmp_file) {
202:                     // file ist empty also no file in template
203:                     // directory
204:                     if (empty($this->_file)) {
205:                         return 'empty';
206:                     } else {
207:                         return 'save';
208:                     }
209:                 }
210: 
211:                 if ($this->_file != $this->_tmp_file) {
212:                     return 'rename';
213:                 }
214:             } else {
215:                 // one of files (file or tmp_file) is not set
216:                 throw new cException(i18n('Field of the file name is empty!'));
217:             }
218:         } else {
219:             return 'default';
220:         }
221:     }
222: 
223:     /**
224:      * Has the selected file changed.
225:      *
226:      * @return boolean is the filename changed
227:      */
228:     private function _hasSelectedFileChanged() {
229:         if ($this->_file != $this->_selectedFile) {
230:             return true;
231:         } else {
232:             return false;
233:         }
234:     }
235: 
236:     /**
237:      * Save the code in the file
238:      */
239:     private function _save() {
240:         // save the contents of file
241:         $ret = $this->createModuleFile('template', $this->_file, $this->_code);
242:         // show message
243:         if ($ret) {
244:             $this->_notification->displayNotification(cGuiNotification::LEVEL_INFO, i18n('Saved changes successfully!'));
245:         }
246:         // if user selected other file display it
247:         if ($this->_hasSelectedFileChanged()) {
248:             $this->_file = $this->_selectedFile;
249:             $this->_tmp_file = $this->_selectedFile;
250:         }
251:     }
252: 
253:     /**
254:      * rename a file in template directory
255:      *
256:      * @throws cException if rename was not successfull
257:      */
258:     private function _rename() {
259:         if ($this->renameModuleFile('template', $this->_tmp_file, $this->_file) == false) {
260:             throw new cException(i18n('Rename of the file failed!'));
261:         } else {
262:             $this->createModuleFile('template', $this->_file, $this->_code);
263:             $this->_notification->displayNotification(cGuiNotification::LEVEL_INFO, i18n('Renamed the template file successfully!'));
264:             $this->_tmp_file = $this->_file;
265:         }
266:     }
267: 
268:     /**
269:      * Make new file
270:      */
271:     private function _new() {
272:         $fileName = '';
273:         if ($this->existFile('template', $this->_newFileName . '.' . $this->_templateFileEnding)) {
274:             $fileName = $this->_newFileName . $this->getRandomCharacters(5) . '.' . $this->_templateFileEnding;
275:             $this->createModuleFile('template', $fileName, '');
276:             $this->_notification->displayNotification(cGuiNotification::LEVEL_INFO, i18n('Created a new template file successfully!'));
277:         } else {
278:             $this->createModuleFile('template', $this->_newFileName . '.' . $this->_templateFileEnding, '');
279:             $this->_notification->displayNotification(cGuiNotification::LEVEL_INFO, i18n('Created a new template file successfully!'));
280:             $fileName = $this->_newFileName . '.' . $this->_templateFileEnding;
281:         }
282:         // set to new fileName
283:         $this->_file = $fileName;
284:         $this->_tmp_file = $fileName;
285:     }
286: 
287:     /**
288:      * Delete a file
289:      */
290:     private function _delete() {
291:         $ret = $this->deleteFile('template', $this->_tmp_file);
292:         if ($ret == true) {
293:             $this->_notification->displayNotification(cGuiNotification::LEVEL_INFO, i18n('Deleted the template file successfully!'));
294:         }
295:         $files = $this->getAllFilesFromDirectory('template');
296: 
297:         if (is_array($files)) {
298:             if (!key_exists('0', $files)) {
299:                 $this->_file = '';
300:                 $this->_tmp_file = '';
301:             } else {
302:                 $this->_file = $files[0];
303:                 $this->_tmp_file = $files[0];
304:             }
305:         }
306:     }
307: 
308:     /**
309:      * Default case
310:      */
311:     public function _default() {
312:         $files = $this->getAllFilesFromDirectory('template');
313: 
314:         // one or more templates files are in template direcotry
315:         if (count($files) > 0) {
316:             $this->_tmp_file = $files[0];
317:             $this->_file = $files[0];
318:         } else {
319:             // template directory is empty
320:             $this->_file = '';
321:             $this->_tmp_file = '';
322:         }
323:     }
324: 
325:     /**
326:      * Have the user premissions for the actions.
327:      *
328:      * @param cPermission $perm
329:      * @param cGuiNotification $notification
330:      * @param string $action
331:      *
332:      * @return int if user dont have permission return -1
333:      */
334:     private function _havePremission($perm, $notification, $action) {
335:         switch ($action) {
336:             case 'new':
337:                 if (!$perm->have_perm_area_action($this->_testArea, $this->_actionCreate)) {
338:                     $notification->displayNotification('error', i18n('Permission denied'));
339:                     return -1;
340:                 }
341:                 break;
342:             case 'save':
343:             case 'rename':
344:                 if (!$perm->have_perm_area_action($this->_testArea, $this->_actionEdit)) {
345:                     $notification->displayNotification('error', i18n('Permission denied'));
346:                     return -1;
347:                 }
348:                 break;
349:             case 'delete':
350:                 if (!$perm->have_perm_area_action($this->_testArea, $this->_actionDelete)) {
351:                     $notification->displayNotification('error', i18n('Permission denied'));
352:                     return -1;
353:                 }
354:                 break;
355:             default:
356:                 return true;
357:                 break;
358:         }
359:     }
360: 
361:     /**
362:      * This method test the code if the client setting htmlvalidator
363:      * is not set to false.
364:      */
365:     private function _validateHTML($notification) {
366:         /* Try to validate html */
367:         if (getEffectiveSetting('layout', 'htmlvalidator', 'true') == 'true' && $this->_code !== '') {
368:             $v = new cHTMLValidator();
369:             $v->validate($this->_code);
370:             $msg = '';
371: 
372:             foreach ($v->missingNodes as $value) {
373:                 $idqualifier = '';
374: 
375:                 $attr = array();
376: 
377:                 if ($value['name'] != '') {
378:                     $attr['name'] = "name '" . $value['name'] . "'";
379:                 }
380: 
381:                 if ($value['id'] != '') {
382:                     $attr['id'] = "id '" . $value['id'] . "'";
383:                 }
384: 
385:                 $idqualifier = implode(', ', $attr);
386: 
387:                 if ($idqualifier != '') {
388:                     $idqualifier = "($idqualifier)";
389:                 }
390:                 $msg .= sprintf(i18n("Tag '%s' %s has no end tag (start tag is on line %s char %s)"), $value['tag'], $idqualifier, $value['line'], $value['char']) . '<br>';
391:             }
392: 
393:             if ($msg != '') {
394:                 $notification->displayNotification('warning', $msg) . '<br>';
395:             }
396:         }
397:     }
398: 
399:     private function _makeFormular($belang) {
400:         $fileForm = new cGuiTableForm("file_editor");
401:         $fileForm->addHeader(i18n('Choose file'));
402:         $fileForm->setTableid('choose_mod_template_file');
403:         $fileForm->setVar('area', $this->_area);
404:         $fileForm->setVar('action', $this->_action);
405:         $fileForm->setVar('frame', $this->_frame);
406:         $fileForm->setVar('status', 'send');
407:         $fileForm->setVar('tmp_file', $this->_tmp_file);
408:         $fileForm->setVar('idmod', $this->_idmod);
409:         $fileForm->setVar('file', $this->_file);
410: 
411:         $form = new cGuiTableForm('file_editor');
412:         $form->setTableid('mod_template');
413:         $form->addHeader(i18n('Edit file'));
414:         $form->setVar('area', $this->_area);
415:         $form->setVar('action', $this->_action);
416:         $form->setVar('frame', $this->_frame);
417:         $form->setVar('status', 'send');
418:         $form->setVar('tmp_file', $this->_tmp_file);
419:         $form->setVar('idmod', $this->_idmod);
420:         $form->setVar('file', $this->_file);
421:         $form->setVar('selectedFile', $this->_file);
422: 
423:         $selectFile = new cHTMLSelectElement('selectedFile');
424:         $selectFile->setClass("fileChooser");
425:         // array with all files in template directory
426:         $filesArray = $this->getAllFilesFromDirectory('template');
427: 
428:         // make options fields
429:         foreach ($filesArray as $key => $file) {
430:             $optionField = new cHTMLOptionElement($file, $file);
431: 
432:             // select the current file
433:             if ($file == $this->_file) {
434:                 $optionField->setAttribute('selected', 'selected');
435:             }
436: 
437:             $selectFile->addOptionElement($key, $optionField);
438:         }
439: 
440:         $aDelete = new cHTMLLink('main.php');
441:         $aDelete->setId("deleteLink");
442:         $aDelete->setContent(i18n("Delete template"));
443:         $aDelete->setClass('deletefunction');
444:         $aDelete->setCustom("deleteModTpl", "1");
445:         $aDelete->setCustom('area', $this->_area);
446:         $aDelete->setCustom('action', $this->_action);
447:         $aDelete->setCustom('frame', $this->_frame);
448:         $aDelete->setCustom('status', 'send');
449:         $aDelete->setCustom('idmod', $this->_idmod);
450:         $aDelete->setCustom('file', $this->_file);
451:         $aDelete->setCustom('tmp_file', $this->_tmp_file);
452: 
453:         $aAdd = new cHTMLLink('main.php');
454:         $aAdd->setContent(i18n('New template'));
455:         $aAdd->setClass('addfunction');
456:         $aAdd->setCustom("newModTpl", "1");
457:         $aAdd->setCustom('area', $this->_area);
458:         $aAdd->setCustom('action', $this->_action);
459:         $aAdd->setCustom('frame', $this->_frame);
460:         $aAdd->setCustom('status', 'send');
461:         $aAdd->setCustom('tmp_file', $this->_tmp_file);
462:         $aAdd->setCustom('idmod', $this->_idmod);
463:         $aAdd->setCustom('file', $this->_file);
464: 
465:         // $tb_name = new cHTMLLabel($sFilename, '');
466:         $tb_name = new cHTMLTextbox('file', $this->_file, 60);
467: 
468:         $ta_code = new cHTMLTextarea('code', conHtmlSpecialChars($this->_code), 100, 35, 'code');
469: 
470:         $ta_code->setStyle('font-family: monospace;width: 100%;');
471: 
472:         $ta_code->updateAttributes(array(
473:             'wrap' => getEffectiveSetting('html_editor', 'wrap', 'off')
474:         ));
475: 
476:         $fileForm->add(i18n('Action'), $aAdd->toHTML());
477:         // show only if file exists
478:         if ($this->_file) {
479:             $fileForm->add(i18n('Action'), $aDelete->toHTML());
480:             $fileForm->add(i18n('File'), $selectFile);
481:         }
482: 
483:         // add fields only if template file exists
484:         if ($this->_file) {
485:             $form->add(i18n('Name'), $tb_name);
486:             $form->add(i18n('Code'), $ta_code);
487:         }
488:         $this->_page->setContent(array(
489:             $fileForm
490:         ));
491:         if ($this->_file) {
492:             $this->_page->appendContent($form);
493:         }
494: 
495:         $oCodeMirror = new CodeMirror('code', 'html', substr(strtolower($belang), 0, 2), true, $this->_cfg);
496:         $this->_page->addScript($oCodeMirror->renderScript());
497: 
498:         // $this->_page->addScript('reload', $this->_reloadScript);
499:     }
500: 
501:     /**
502:      * Display the form and evaluate the action and excute the action.
503:      *
504:      * @param cPermission $perm
505:      * @param cGuiNotification $notification
506:      */
507:     public function display($perm, $notification, $belang) {
508:         $myAction = $this->_getAction();
509: 
510:         // if the user doesn't have premissions
511:         if ($this->_havePremission($perm, $notification, $myAction) === -1) {
512:             return;
513:         }
514: 
515:         try {
516:             switch ($myAction) {
517:                 case 'save':
518:                     $this->_save();
519:                     break;
520:                 case 'rename':
521:                     $this->_rename();
522:                     break;
523:                 case 'new':
524:                     $this->_new();
525:                     break;
526:                 case 'delete':
527:                     $this->_delete();
528:                     break;
529:                 default:
530:                     $this->_default();
531:                     break;
532:             }
533: 
534:             $this->_code = $this->getFilesContent('template', '', $this->_file);
535:             $this->_validateHTML($notification);
536:             $this->_makeFormular($belang);
537:         } catch (Exception $e) {
538:             $this->_page->displayError(i18n($e->getMessage()));
539:         }
540:     }
541: 
542: }
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0