private function __construct()
 {
     global $objInit;
     $backOrFrontend = $objInit->mode;
     // TODO: Unused
     //        global $objFWUser;
     //        $langId;
     if ($backOrFrontend == "frontend") {
         $langId = $objInit->getFrontendLangId();
     } else {
         //backend
         $langId = $objInit->getBackendLangId();
     }
     $langCode = FWLanguage::getLanguageCodeById($langId);
     $this->setVariable(array('path' => ASCMS_PATH_OFFSET . '/' . $langCode . '/', 'basePath' => ASCMS_PATH_OFFSET . '/', 'cadminPath' => \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteBackendPath() . '/', 'mode' => $objInit->mode, 'language' => $langCode, 'csrf' => \Cx\Core\Csrf\Controller\Csrf::code()), 'contrexx');
     //let i18n set it's variables
     $i18n = new ContrexxJavascriptI18n($langCode);
     $i18n->variablesTo($this);
     //determine the correct jquery ui css' path.
     //the user might have overridden the default css in the theme, so look out for this too.
     $jQUiCssPath = 'themes/' . $objInit->getCurrentThemesPath() . '/jquery-ui.css';
     //customized css would be here
     if ($objInit->mode != 'frontend' || !file_exists(ASCMS_DOCUMENT_ROOT . '/' . $jQUiCssPath)) {
         //use standard css
         $jQUiCssPath = 'lib/javascript/jquery/ui/css/jquery-ui.css';
     }
     $this->setVariable(array('jQueryUiCss' => $jQUiCssPath), 'contrexx-ui');
 }
 /**
  * Constructor
  */
 function __construct($tplPath, $name)
 {
     $this->_objTpl = new \Cx\Core\Html\Sigma($tplPath);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->moduleName = $name;
     $this->moduleNameLC = strtolower($this->moduleName);
     $this->_objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName, 'MODULE_NAME_LC' => $this->moduleNameLC, 'CSRF' => 'csrf=' . \Cx\Core\Csrf\Controller\Csrf::code()));
 }
Example #3
0
 /**
  * This function finds out what we want to render and then renders the form
  *
  * @param boolean $isSingle if we only render one entry
  * @access public
  * @return string rendered view
  */
 public function render(&$isSingle = false)
 {
     global $_ARRAYLANG;
     // this case is used to generate the add entry form, where we can create an new entry
     if (!empty($_GET['add']) && !empty($this->options['functions']['add'])) {
         $isSingle = true;
         return $this->renderFormForEntry(null);
     }
     $renderObject = $this->object;
     $entityId = $this->getEntryId();
     // this case is used to get the right entry if we edit a existing one
     if ($this->object instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet && $entityId != 0) {
         if ($this->object->entryExists($entityId)) {
             $renderObject = $this->object->getEntry($entityId);
         }
     }
     // this case is used for the overview off all entities
     if ($renderObject instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
         if (!empty($this->options['order']['overview'])) {
             $renderObject->sortColumns($this->options['order']['overview']);
         }
         $addBtn = '';
         $actionUrl = clone \Env::get('cx')->getRequest()->getUrl();
         if (!empty($this->options['functions']['add'])) {
             $actionUrl->setParam('add', 1);
             //remove the parameter 'vg_increment_number' from actionUrl
             //if the baseUrl contains the parameter 'vg_increment_number'
             $params = $actionUrl->getParamArray();
             if (isset($params['vg_increment_number'])) {
                 \Html::stripUriParam($actionUrl, 'vg_increment_number');
             }
             $addBtn = '<br /><br /><input type="button" name="addEtity" value="' . $_ARRAYLANG['TXT_ADD'] . '" onclick="location.href=' . "'" . $actionUrl . "&csrf=" . \Cx\Core\Csrf\Controller\Csrf::code() . "'" . '" />';
         }
         if (!count($renderObject) || !count(current($renderObject))) {
             // make this configurable
             $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic');
             $tpl->loadTemplateFile('NoEntries.html');
             return $tpl->get() . $addBtn;
         }
         $listingController = new \Cx\Core_Modules\Listing\Controller\ListingController($renderObject, array(), $this->options['functions']);
         $renderObject = $listingController->getData();
         $this->options['functions']['vg_increment_number'] = $this->viewId;
         $backendTable = new \BackendTable($renderObject, $this->options) . '<br />' . $listingController;
         return $backendTable . $addBtn;
     }
     // render form for single entry view like editEntry
     $isSingle = true;
     return $this->renderFormForEntry($entityId);
 }
 /**
  * Show the last run's crawler result
  * 
  * @global array $_ARRAYLANG 
  */
 public function showCrawlerResult()
 {
     global $_ARRAYLANG;
     \JS::activate('cx');
     $objCx = \ContrexxJavascript::getInstance();
     $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager');
     if (isset($_POST['checkAgain'])) {
         $this->recheckSelectedLinks();
     }
     //show crawler results
     //get parameters
     $pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
     //set the settings value from DB
     \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
     $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager');
     $parameter = './index.php?cmd=' . $this->moduleName . '&act=crawlerResult';
     $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos'));
     $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit);
     $i = 1;
     $objUser = new \Cx\Core_Modules\LinkManager\Controller\User();
     if ($brokenLinks && $brokenLinks->count() > 0) {
         foreach ($brokenLinks as $brokenLink) {
             $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1)));
             $this->template->parse($this->moduleName . 'CrawlerResultList');
         }
         $this->template->hideBlock('LinkManagerNoCrawlerResultFound');
     } else {
         $this->template->touchBlock('LinkManagerNoCrawlerResultFound');
     }
 }
 /**
  * Assign the template path
  * Sets the Global variable for the calendar module
  * 
  * @param string $tplPath Template path
  */
 function __construct($tplPath)
 {
     $this->_objTpl = new \Cx\Core\Html\Sigma($tplPath);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_MODULE_NAME' => $this->moduleName, $this->moduleLangVar . '_CSRF' => 'csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleLangVar . '_DATE_FORMAT' => self::getDateFormat(1), $this->moduleLangVar . '_JAVASCRIPT' => self::getJavascript()));
 }
 protected function getFunctionsCode($rowname, $rowData, $functions, $virtual = false)
 {
     global $_ARRAYLANG;
     $baseUrl = $functions['baseUrl'];
     $code = '<span class="functions">';
     if (!$virtual) {
         $editUrl = clone $baseUrl;
         $params = $editUrl->getParamArray();
         $editId = '';
         if (!empty($params['editid'])) {
             $editId = $params['editid'] . ',';
         }
         $editId .= '{' . $functions['vg_increment_number'] . ',' . $rowname . '}';
         if (isset($functions['actions']) && is_callable($functions['actions'])) {
             $code .= $functions['actions']($rowData, $editId);
         }
         if (isset($functions['edit']) && $functions['edit']) {
             $editUrl->setParam('editid', $editId);
             $code .= '<a href="' . $editUrl . '" class="edit" title="' . $_ARRAYLANG['TXT_CORE_RECORD_EDIT_TITLE'] . '"></a>';
         }
         if (isset($functions['delete']) && $functions['delete']) {
             $deleteUrl = clone $baseUrl;
             $deleteUrl->setParam('deleteid', $rowname);
             $deleteUrl->setParam('vg_increment_number', $functions['vg_increment_number']);
             $deleteUrl .= '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code();
             $onclick = 'if (confirm(\'' . $_ARRAYLANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))' . 'window.location.replace(\'' . $deleteUrl . '\');';
             $_uri = 'javascript:void(0);';
             $code .= '<a onclick="' . $onclick . '" href="' . $_uri . '" class="delete" title="' . $_ARRAYLANG['TXT_CORE_RECORD_DELETE_TITLE'] . '"></a>';
         }
     }
     return $code . '</span>';
 }
Example #7
0
 protected function getFunctionsCode($rowname, $rowData, $functions, $virtual = false)
 {
     global $_ARRAYLANG;
     $baseUrl = $functions['baseUrl'];
     $code = '<span class="functions">';
     if (!$virtual) {
         $editUrl = clone $baseUrl;
         $params = $editUrl->getParamArray();
         $editId = '';
         if (!empty($params['editid'])) {
             $editId = $params['editid'] . ',';
         }
         $editId .= '{' . $functions['vg_increment_number'] . ',' . $rowname . '}';
         /* We use json to do the action callback. So all callbacks are functions in the json controller of the
          * corresponding component. The 'else if' is for backwards compatibility so you can declare the function
          * directly without using json. This is not recommended and not working over session */
         if (isset($functions['actions']) && is_array($functions['actions']) && isset($functions['actions']['adapter']) && isset($functions['actions']['method'])) {
             $json = new \Cx\Core\Json\JsonData();
             $jsonResult = $json->data($functions['actions']['adapter'], $functions['actions']['method'], array('rowData' => $rowData, 'editId' => $editId));
             if ($jsonResult['status'] == 'success') {
                 $code .= $jsonResult["data"];
             }
         } else {
             if (isset($functions['actions']) && is_callable($functions['actions'])) {
                 $code .= $functions['actions']($rowData, $editId);
             }
         }
         if (isset($functions['edit']) && $functions['edit']) {
             $editUrl->setParam('editid', $editId);
             //remove the parameter 'vg_increment_number' from editUrl
             //if the baseUrl contains the parameter 'vg_increment_number'
             if (isset($params['vg_increment_number'])) {
                 \Html::stripUriParam($editUrl, 'vg_increment_number');
             }
             $code .= '<a href="' . $editUrl . '" class="edit" title="' . $_ARRAYLANG['TXT_CORE_RECORD_EDIT_TITLE'] . '"></a>';
         }
         if (isset($functions['delete']) && $functions['delete']) {
             $deleteUrl = clone $baseUrl;
             $deleteUrl->setParam('deleteid', $rowname);
             $deleteUrl->setParam('vg_increment_number', $functions['vg_increment_number']);
             $deleteUrl .= '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code();
             $onclick = 'if (confirm(\'' . $_ARRAYLANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))' . 'window.location.replace(\'' . $deleteUrl . '\');';
             $_uri = 'javascript:void(0);';
             $code .= '<a onclick="' . $onclick . '" href="' . $_uri . '" class="delete" title="' . $_ARRAYLANG['TXT_CORE_RECORD_DELETE_TITLE'] . '"></a>';
         }
     }
     return $code . '</span>';
 }
Example #8
0
 /**
  * show the categories
  *
  * @global array module language array
  */
 function showCategories()
 {
     global $_ARRAYLANG;
     $catId = !empty($_REQUEST['catId']) ? intval($_REQUEST['catId']) : 0;
     $this->_pageTitle = $_ARRAYLANG['TXT_BLOCK_CATEGORIES'];
     $this->_objTpl->loadTemplateFile('module_block_categories.html');
     $this->_objTpl->setVariable(array('TXT_BLOCK_CATEGORIES' => $_ARRAYLANG['TXT_BLOCK_CATEGORIES'], 'TXT_BLOCK_CATEGORIES_MANAGE' => $_ARRAYLANG['TXT_BLOCK_CATEGORIES_MANAGE'], 'TXT_BLOCK_CATEGORIES_ADD' => $_ARRAYLANG['TXT_BLOCK_CATEGORIES_ADD'], 'TXT_BLOCK_FUNCTIONS' => $_ARRAYLANG['TXT_BLOCK_FUNCTIONS'], 'TXT_BLOCK_NAME' => $_ARRAYLANG['TXT_BLOCK_NAME'], 'TXT_BLOCK_CATEGORY_SEPERATOR' => $_ARRAYLANG['TXT_BLOCK_CATEGORY_SEPERATOR'], 'TXT_BLOCK_PLACEHOLDER' => $_ARRAYLANG['TXT_BLOCK_PLACEHOLDER'], 'TXT_BLOCK_SEPERATOR' => $_ARRAYLANG['TXT_BLOCK_SEPERATOR'], 'TXT_BLOCK_NONE' => $_ARRAYLANG['TXT_BLOCK_NONE'], 'TXT_BLOCK_PARENT' => $_ARRAYLANG['TXT_BLOCK_PARENT'], 'TXT_BLOCK_SELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_SELECT_ALL'], 'TXT_BLOCK_DESELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_DESELECT_ALL'], 'TXT_BLOCK_SUBMIT_SELECT' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_SELECT'], 'TXT_BLOCK_SUBMIT_DELETE' => $_ARRAYLANG['TXT_BLOCK_SUBMIT_DELETE'], 'TXT_BLOCK_NO_CATEGORIES_FOUND' => $_ARRAYLANG['TXT_BLOCK_NO_CATEGORIES_FOUND'], 'TXT_BLOCK_OPERATION_IRREVERSIBLE' => $_ARRAYLANG['TXT_BLOCK_OPERATION_IRREVERSIBLE'], 'BLOCK_CATEGORIES_PARENT_DROPDOWN' => $this->_getCategoriesDropdown(), 'DIRECTORY_INDEX' => CONTREXX_DIRECTORY_INDEX, 'CSRF_KEY' => \Cx\Core\Csrf\Controller\Csrf::key(), 'CSRF_CODE' => \Cx\Core\Csrf\Controller\Csrf::code()));
     $arrCategories = $this->_getCategories(true);
     if (count($arrCategories) == 0) {
         $this->_objTpl->touchBlock('noCategories');
         return;
     }
     $this->_objTpl->hideBlock('noCategories');
     $this->_parseCategories($arrCategories[0]);
     //first array contains all root categories (parent id 0)
 }
    function _getJavaScriptCodePreview()
    {
        global $_ARRAYLANG;
        \JS::activate('jquery');
        $delete_msg = $_ARRAYLANG['TXT_MEDIA_CONFIRM_DELETE_2'];
        $csrfCode = \Cx\Core\Csrf\Controller\Csrf::code();
        $code = <<<END
                    <script type="text/javascript">
                    /* <![CDATA[ */
                        function preview(file, width, height)
                        {
                            var f = file;
                            var w = width + 10;
                            var h = height + 10;
                            var l = (screen.availWidth - width) / 2;
                            var t = (screen.availHeight - 50 - height) / 2;
                            prev  = window.open('', '', "width="+w+", height="+h+", left="+l+", top="+t+", scrollbars=no, toolbars=no, status=no, resizable=yes");
                            prev.document.open();
                            prev.document.write('<html><title>'+f+'<\\/title><body style="margin: 5px; padding: 0px;">');
                            prev.document.write('<img src=\\"'+f+'\\" width='+width+' height='+height+' alt=\\"'+f+'\\">');
                            prev.document.write('<\\/body><\\/html>');
                            prev.document.close();
                            prev.focus();
                        }

                        function mediaConfirmDelete(file)
                        {
                            if (confirm('{$delete_msg}')) {
                                return true;
                            } else {
                                return false;
                            }
                        }

                        /*
                           **  Returns the caret (cursor) position of the specified text field.
                           **  Return value range is 0-oField.length.
                           */
                        function doGetCaretPosition (oField) {
                                var iCaretPos = 0;
                                // IE Support
                                if (document.selection) {
                                        var oSel = document.selection.createRange ();
                                        oSel.moveStart ('character', -oField.value.length);
                                        iCaretPos = oSel.text.length;
                                } else if (oField.selectionStart || oField.selectionStart == '0') {
                                        // Firefox support
                                        iCaretPos = oField.selectionStart;
                                }
                                return (iCaretPos);
                        }

                        /*
                        **  Sets the caret (cursor) position of the specified text field.
                        **  Valid positions are 0-oField.length.
                        */
                        function doSetCaretPosition(oField, pos){
                                if (oField.setSelectionRange) {
                                        oField.setSelectionRange(pos,pos);
                                } else if (oField.createTextRange) {
                                        var range = oField.createTextRange();
                                        range.collapse(true);
                                        range.moveEnd('character', pos);
                                        range.moveStart('character', pos);
                                        range.select();
                                }
                        }

                        \$J(document).ready(function() {

                            \$J('#filename').live('keyup', function(event){
                                pos = doGetCaretPosition(document.getElementById('filename'));
                                \$J(this).val(\$J(this).val().replace(/[^0-9a-zA-Z_\\-\\. ]/g,'_'));
                                doSetCaretPosition(document.getElementById('filename'), pos);
                                //submit the input value on hitting Enter key to rename action
                                if(event.keyCode == 13) {
                                    var newFileName = \$J('#filename').val();
                                    var oldFileName = \$J('#oldFilename').val();
                                    var actionPath  = \$J('#actionPath').val();
                                    var fileExt     = \$J('#fileExt').val();
                                    if (newFileName != oldFileName && \$J.trim(newFileName) != "") {
                                        actionPath += '&newfile='+newFileName+fileExt;
                                        window.location = actionPath;
                                    } else {
                                        \$J('#filename').focusout();
                                    }
                                }
                                return true;
                            });

                            \$J('.rename_btn').click(function(){
                                if (\$J('#filename').length == 0) {
                                    \$J(this).parent().parent().find('.file_name a').css('display','none');
                                    file_name = "";
                                    file = \$J(this).parent().parent().find('.file_name a').html();
                                    fileSplitLength = file.split('.').length;
                                    isFolder = (\$J(this).parent().parent().find('.file_size').html() == '&nbsp;-') ? 1 : 0;

                                    //Display Filename in input box without file extension (with multi dots in filename)
                                    file_ext = (isFolder != 1 && fileSplitLength > 1) ?
                                                    ("."+file.split('.')[fileSplitLength-1])
                                                    : "";
                                    loop     = (isFolder != 1 && fileSplitLength > 1) ?
                                                    (fileSplitLength - 1)
                                                    : fileSplitLength;

                                    for (i=0; i < loop; i++) {
                                        file_name += i > 0 ? "." : "";
                                        file_name += file.split('.')[i];
                                    }
                                    actionPath = \$J(this).data('actionUrl');

                                    //Rename Form
                                    \$J(this).parent().parent().find('.file_name')
                                    .append('<div id="insertform"><input type="text" id="filename" name="filename" style="padding:0px;" value="'+file_name+'"/>'+file_ext
                                            +'<input type="hidden" value="'+actionPath+'" id="actionPath" name="actionPath" />'
                                            +'<input type="hidden" value="'+file_name+'" id="oldFilename" name="oldFilename" />'
                                            +'<input type="hidden" value="'+file_ext+'" id="fileExt" name="fileExt" /></div>');
                                    \$J("#filename").focus();
                                }
                            });

                            //Hide added form and display file name link on blur
                            \$J("#filename").live('blur',function(){
                                \$J(this).parent().parent().find('a').css('display','block');
                                \$J(this).parent().remove();
                            });
                        });
                    /* ]]> */
                    </script>
END;
        return $code;
    }
<?php

header("content-type: application/javascript");
if (strpos(dirname(__FILE__), 'customizing') === false) {
    $contrexx_path = dirname(dirname(dirname(__FILE__)));
} else {
    // this files resides within the customizing directory, therefore we'll have to strip
    // out one directory more than usually
    $contrexx_path = dirname(dirname(dirname(dirname(__FILE__))));
}
require_once $contrexx_path . '/core/Core/init.php';
$cx = init('minimal');
$sessionObj = \cmsSession::getInstance();
$_SESSION->cmsSessionStatusUpdate('backend');
$CSRF = '&' . \Cx\Core\Csrf\Controller\Csrf::key() . '=' . \Cx\Core\Csrf\Controller\Csrf::code();
$langId = !empty($_GET['langId']) ? $_GET['langId'] : null;
$pageId = !empty($_GET['pageId']) ? $_GET['pageId'] : null;
//'&' must not be htmlentities, used in javascript
$defaultBrowser = ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/' . CONTREXX_DIRECTORY_INDEX . '?cmd=FileBrowser&standalone=true&langId=' . $langId . $CSRF;
$linkBrowser = ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/' . CONTREXX_DIRECTORY_INDEX . '?cmd=FileBrowser&standalone=true&langId=' . $langId . '&type=webpages' . $CSRF;
//get the main domain
$domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
$mainDomain = $domainRepository->getMainDomain()->getName();
//find the right css files and put it into the wysiwyg
$em = $cx->getDb()->getEntityManager();
$componentRepo = $em->getRepository('Cx\\Core\\Core\\Model\\Entity\\SystemComponent');
$wysiwyg = $componentRepo->findOneBy(array('name' => 'Wysiwyg'));
$pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
\Cx\Core\Setting\Controller\Setting::init('Wysiwyg', 'config', 'Yaml');
$skinId = 0;
if (!empty($pageId) && $pageId != 'new') {
Example #11
0
 public function render()
 {
     global $_CORELANG;
     // if no child with name input and type submit is present, add one
     $hasSubmit = false;
     foreach ($this->getChildren() as $child) {
         if ($child->getName() == 'input' && $child->getAttribute('type') == 'submit') {
             $hasSubmit = true;
             break;
         }
     }
     if (!$hasSubmit && $this->addButtons) {
         $submitDiv = new FieldsetElement();
         $submitDiv->setAttribute('class', 'actions');
         $submit = new HtmlElement('input');
         $submit->setAttribute('type', 'submit');
         $submit->setAttribute('value', $_CORELANG['TXT_SAVE']);
         $submitDiv->addChild($submit);
         if (!empty($this->cancelUrl)) {
             $cancel = new HtmlElement('input');
             $cancel->setAttribute('type', 'button');
             $cancel->setAttribute('value', $_CORELANG['TXT_CANCEL']);
             $cancel->setAttribute('onclick', 'location.href="' . $this->cancelUrl . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code() . '"');
             $submitDiv->addChild($cancel);
         }
         $this->addChild($submitDiv);
     }
     return parent::render();
 }
 /**
  * Show on overview of the mail templates for the given section and group
  *
  * If empty, the $limit defaults to the
  * "numof_mailtemplate_per_page_backend" setting for the given section
  * and group.
  * @param   string    $section      The section
  * @param   string    $group        The group
  * @param   integer   $limit        The optional limit for the number
  *                                  of templates to be shown
  * @param   string   $act           The action of the mail template
  *                                  default set to mailtemplate_overview
  * @return  \Cx\Core\Html\Sigma     The template object
  */
 static function overview($section, $group, $limit = 0, $useDefaultActs = true, $act = 'mailtemplate_edit')
 {
     global $_CORELANG;
     $objTemplateLocal = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/MailTemplate/View/Template/Generic');
     $objTemplateLocal->setErrorHandling(PEAR_ERROR_DIE);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplateLocal);
     if (!$objTemplateLocal->loadTemplateFile('Overview.html')) {
         die("Failed to load template Overview.html");
     }
     if (empty($section) || empty($group)) {
         \Message::error($_CORELANG['TXT_CORE_MAILTEMPLATE_ERROR_NO_SECTION_OR_GROUP']);
         return false;
     }
     if (empty($limit)) {
         \Cx\Core\Setting\Controller\Setting::init($section, $group);
         $limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', $section);
         // TODO: TEMPORARY
         if (is_null($limit)) {
             $limit = 25;
             \Cx\Core\Setting\Controller\Setting::add('numof_mailtemplate_per_page_backend', $limit, 1001, 'text', '', $group);
         }
     }
     $uri = \Html::getRelativeUri_entities();
     $tab_index = \Cx\Core\Setting\Controller\Setting::tab_index();
     \Html::replaceUriParameter($uri, 'active_tab=' . $tab_index);
     \Html::replaceUriParameter($uri, 'userFrontendLangId=' . FRONTEND_LANG_ID);
     //echo("Made uri for sorting: ".htmlentities($uri)."<br />");
     \Html::stripUriParam($uri, 'key');
     \Html::stripUriParam($uri, 'delete_mailtemplate_key');
     $uri_edit = $uri_overview = $uri;
     //echo("Made uri for sorting: ".htmlentities($uri)."<br />");
     if ($useDefaultActs) {
         \Html::stripUriParam($uri, 'act');
         \Html::replaceUriParameter($uri_edit, 'act=mailtemplate_edit');
         \Html::replaceUriParameter($uri_overview, 'act=mailtemplate_overview');
     }
     $objSorting = new \Sorting($uri_overview, array('name' => $_CORELANG['TXT_CORE_MAILTEMPLATE_NAME'], 'key' => $_CORELANG['TXT_CORE_MAILTEMPLATE_KEY'], 'html' => $_CORELANG['TXT_CORE_MAILTEMPLATE_IS_HTML'], 'protected' => $_CORELANG['TXT_CORE_MAILTEMPLATE_PROTECTED']), true, 'order_mailtemplate');
     $count = 0;
     // Template titles are shown in the current language only, no need
     // (and no way either) to load them all.  Names are shown in the
     // currently active frontend language only.
     $pagingParameterName = $section . '_' . $group;
     $arrTemplates = self::getArray($section, FRONTEND_LANG_ID, $objSorting->getOrder(), \Paging::getPosition($pagingParameterName), $limit, $count);
     $arrLanguageName = \FWLanguage::getNameArray();
     $objTemplateLocal->setGlobalVariable($_CORELANG + array('CORE_MAILTEMPLATE_NAME' => $objSorting->getHeaderForField('name'), 'CORE_MAILTEMPLATE_KEY' => $objSorting->getHeaderForField('key'), 'CORE_MAILTEMPLATE_HTML' => $objSorting->getHeaderForField('html'), 'CORE_MAILTEMPLATE_PROTECTED' => $objSorting->getHeaderForField('protected'), 'PAGING' => \Paging::get($uri_overview, $_CORELANG['TXT_CORE_MAILTEMPLATE_PAGING'], $count, $limit, true, null, $pagingParameterName), 'URI_BASE' => $uri, 'URI_EDIT' => $uri_edit, 'CORE_MAILTEMPLATE_COLSPAN' => 5 + count($arrLanguageName)));
     foreach ($arrLanguageName as $language_name) {
         $objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE_HEADER', $language_name);
         $objTemplateLocal->parse('core_mailtemplate_language_header');
     }
     if (empty($arrTemplates)) {
         \Message::information($_CORELANG['TXT_CORE_MAILTEMPLATE_WARNING_NONE']);
         $arrTemplates = array();
     }
     // Load *all* templates and languages
     self::init($section);
     $i = 0;
     foreach ($arrTemplates as $arrTemplate) {
         $key = $arrTemplate['key'];
         $objTemplateLocal->setVariable(array('MAILTEMPLATE_ROWCLASS' => ++$i % 2 + 1, 'MAILTEMPLATE_PROTECTED' => \Html::getCheckmark($arrTemplate['protected']), 'MAILTEMPLATE_HTML' => \Html::getCheckmark($arrTemplate['html']), 'MAILTEMPLATE_NAME' => '<a href="' . $uri_edit . '&amp;key=' . urlencode($key) . '">' . contrexx_raw2xhtml($arrTemplate['name']) . '</a>', 'MAILTEMPLATE_KEY' => $arrTemplate['key'], 'MAILTEMPLATE_FUNCTIONS' => \Html::getBackendFunctions(array('copy' => $uri_edit . '&amp;copy=1&amp;key=' . $arrTemplate['key'], 'edit' => $uri_edit . '&amp;key=' . $arrTemplate['key'], 'delete' => $arrTemplate['protected'] ? '' : $uri_overview . '&amp;delete_mailtemplate_key=' . $arrTemplate['key'] . '&amp;csrf=' . \Cx\Core\Csrf\Controller\Csrf::code()), array('delete' => $_CORELANG['TXT_CORE_MAILTEMPLATE_DELETE_CONFIRM']))));
         foreach (array_keys($arrLanguageName) as $lang_id) {
             $available = isset(self::$arrTemplates[$lang_id][$key]) && self::$arrTemplates[$lang_id][$key]['available'];
             $title = $available ? $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_NEW'];
             $icon = '<a href="' . CONTREXX_DIRECTORY_INDEX . "?cmd={$section}&amp;act=" . $act . '&amp;key=' . $key . '&amp;userFrontendLangId=' . $lang_id . '"' . ' title="' . $title . '">' . '<img src="../core/Core/View/Media/icons/' . ($available ? 'edit.gif' : 'add.png') . '"' . ' width="16" height="16" alt="' . $title . '" border="0" /></a>';
             $objTemplateLocal->setVariable('MAILTEMPLATE_LANGUAGE', $icon);
             $objTemplateLocal->parse('core_mailtemplate_language_column');
         }
         $objTemplateLocal->parse('core_mailtemplate_row');
     }
     return $objTemplateLocal;
 }
 public function render(&$isSingle = false)
 {
     global $_ARRAYLANG;
     if (!empty($_GET['add']) && !empty($this->options['functions']['add'])) {
         $isSingle = true;
         return $this->renderFormForEntry(null);
     }
     $renderObject = $this->object;
     $entityClass = get_class($this->object);
     $entityId = '';
     if ($this->object instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet && $this->isInEditMode()) {
         $entityClass = $this->object->getDataType();
         $entityId = contrexx_input2raw($this->isInEditMode());
         if ($this->object->entryExists($entityId)) {
             $renderObject = $this->object->getEntry($entityId);
         }
     }
     if ($renderObject instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
         if (!empty($this->options['order']['overview'])) {
             $renderObject->sortColumns($this->options['order']['overview']);
         }
         $addBtn = '';
         $actionUrl = clone \Env::get('cx')->getRequest()->getUrl();
         if (!empty($this->options['functions']['add'])) {
             $actionUrl->setParam('add', 1);
             $addBtn = '<br /><br /><input type="button" name="addEtity" value="' . $_ARRAYLANG['TXT_ADD'] . '" onclick="location.href=' . "'" . $actionUrl . "&csrf=" . \Cx\Core\Csrf\Controller\Csrf::code() . "'" . '" />';
         }
         if (!count($renderObject) || !count(current($renderObject))) {
             // make this configurable
             $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic');
             $tpl->loadTemplateFile('NoEntries.html');
             return $tpl->get() . $addBtn;
         }
         $listingController = new \Cx\Core_Modules\Listing\Controller\ListingController($renderObject, array(), $this->options['functions']);
         $renderObject = $listingController->getData();
         $this->options['functions']['vg_increment_number'] = $this->number;
         $backendTable = new \BackendTable($renderObject, $this->options) . '<br />' . $listingController;
         return $backendTable . $addBtn;
     } else {
         $isSingle = true;
         return $this->renderFormForEntry($entityId);
     }
 }