本文整理汇总了PHP中JS::activate方法的典型用法代码示例。如果您正苦于以下问题:PHP JS::activate方法的具体用法?PHP JS::activate怎么用?PHP JS::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JS
的用法示例。
在下文中一共展示了JS::activate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFrontendEditing
/**
* Init the frontend editing.
*
* Register the javascripts and css files
* Adds the used language variables to contrexx-js variables, so the toolbar has access to these variables
*
* @param ComponentController $componentController
*/
public function initFrontendEditing(\Cx\Core_Modules\FrontendEditing\Controller\ComponentController $componentController)
{
global $_ARRAYLANG;
// get necessary objects
$objInit = \Env::get('init');
$page = $this->cx->getPage();
// add css and javascript file
$jsFilesRoot = substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Script', 1);
\JS::registerCSS(substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Style/Main.css', 1));
\JS::registerJS($jsFilesRoot . '/Main.js');
\JS::activate('cx');
// not used for contrexx version 3.1
// \JS::registerJS($jsFilesRoot . '/CKEditorPlugins.js');
// activate ckeditor
\JS::activate('ckeditor');
\JS::activate('jquery-cookie');
// load language data
$_ARRAYLANG = $objInit->loadLanguageData('FrontendEditing');
$langVariables = array('TXT_FRONTEND_EDITING_SHOW_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SHOW_TOOLBAR'], 'TXT_FRONTEND_EDITING_HIDE_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_HIDE_TOOLBAR'], 'TXT_FRONTEND_EDITING_PUBLISH' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISH'], 'TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE'], 'TXT_FRONTEND_EDITING_REFUSE_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_REFUSE_RELEASE'], 'TXT_FRONTEND_EDITING_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE'], 'TXT_FRONTEND_EDITING_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_EDIT'], 'TXT_FRONTEND_EDITING_CANCEL_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CANCEL_EDIT'], 'TXT_FRONTEND_EDITING_FINISH_EDIT_MODE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_FINISH_EDIT_MODE'], 'TXT_FRONTEND_EDITING_THE_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_THE_DRAFT'], 'TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE'], 'TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE'], 'TXT_FRONTEND_EDITING_MODULE_PAGE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_MODULE_PAGE'], 'TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT'], 'TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT'], 'TXT_FRONTEND_EDITING_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_DRAFT'], 'TXT_FRONTEND_EDITING_PUBLISHED' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISHED']);
// add toolbar to html
$this->prepareTemplate($componentController);
// assign js variables
$contrexxJavascript = \ContrexxJavascript::getInstance();
$contrexxJavascript->setVariable('langVars', $langVariables, 'FrontendEditing');
$contrexxJavascript->setVariable('pageId', $page->getId(), 'FrontendEditing');
$contrexxJavascript->setVariable('hasPublishPermission', \Permission::checkAccess(78, 'static', true), 'FrontendEditing');
$contrexxJavascript->setVariable('contentTemplates', $this->getCustomContentTemplates(), 'FrontendEditing');
$contrexxJavascript->setVariable('defaultTemplate', $this->getDefaultTemplate(), 'FrontendEditing');
$configPath = ASCMS_PATH_OFFSET . substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT));
$contrexxJavascript->setVariable('configPath', $configPath . '?langId=' . FRONTEND_LANG_ID, 'FrontendEditing');
}
示例2: getData
/**
* Get the replacement content for the placeholder
* @param string $placeholder
* @return string
*/
function getData($placeholder)
{
global $objDatabase;
\JS::activate("shadowbox", array('players' => array('html', 'iframe')));
$matter = substr($placeholder, 6, -1);
if ($matter == "OVERVIEW") {
return $this->getOverview();
}
// get the data id for the placeholder
$query = "\n SELECT type, ref_id\n FROM " . DBPREFIX . "module_data_placeholders\n WHERE placeholder='{$matter}'";
$objRs = $objDatabase->Execute($query);
if ($objRs && $objRs->RecordCount()) {
$id = $objRs->fields['ref_id'];
if ($objRs->fields['type'] == "cat") {
$this->_arrLanguages = $this->createLanguageArray();
$this->arrCategories = $this->createCategoryArray();
if ($this->arrCategories[$id]['action'] == "subcategories") {
return $this->getSubcategories($id);
}
return $this->getCategory($id);
} else {
return $this->getDetail($id);
}
}
return '';
}
示例3: getPage
/**
* Reads the act and selects the right action
*/
function getPage()
{
if (empty($_GET['cmd'])) {
$_GET['cmd'] = '';
} else {
$this->strCmd = '&cmd=' . intval($_GET['cmd']);
}
\JS::activate('shadowbox');
if (isset($_GET['pId']) && !empty($_GET['pId'])) {
if (isset($_POST['frmGalComAdd_PicId'])) {
$this->addComment();
\Cx\Core\Csrf\Controller\Csrf::header('location:' . CONTREXX_DIRECTORY_INDEX . '?section=Gallery' . html_entity_decode($this->strCmd, ENT_QUOTES, CONTREXX_CHARSET) . '&cid=' . intval($_POST['frmGalComAdd_GalId']) . '&pId=' . intval($_POST['frmGalComAdd_PicId']));
exit;
}
if (isset($_GET['mark'])) {
$this->countVoting($_GET['pId'], $_GET['mark']);
\Cx\Core\Csrf\Controller\Csrf::header('location:' . CONTREXX_DIRECTORY_INDEX . '?section=Gallery' . html_entity_decode($this->strCmd, ENT_QUOTES, CONTREXX_CHARSET) . '&cid=' . intval($_GET['cid']) . '&pId=' . intval($_GET['pId']));
exit;
}
if ($this->arrSettings['enable_popups'] == "on") {
$this->showPicture(intval($_GET['pId']));
} else {
$this->showPictureNoPop(intval($_GET['pId']));
}
} else {
$_GET['cid'] = isset($_GET['cid']) ? intval($_GET['cid']) : intval($_GET['cmd']);
$this->showCategoryOverview($_GET['cid']);
}
return $this->_objTpl->get();
}
示例4: initUploader
/**
* Init the uploader which is directly included in the webpage
*
* @return integer the uploader id
*/
protected function initUploader()
{
\JS::activate('cx');
// the uploader needs the framework
$uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader();
//create an uploader
$uploadId = $uploader->getId();
$uploader->setCallback('fileSharingUploader');
$uploader->setOptions(array('id' => 'fileSharing_' . $uploadId, 'style' => 'display:none;'));
$folderWidget = new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($_SESSION->getTempPath() . '/' . $uploadId, true);
$folderWidgetId = $folderWidget->getId();
$extendedFileInputCode = <<<CODE
<script type="text/javascript">
cx.ready(function() {
var field = jQuery('#contactForm #file_upload');
//called if user clicks on the field
var inputClicked = function() {
jQuery('#fileSharing_{$uploadId}').trigger('click');
return false;
};
jQuery('#fileSharing_{$uploadId}').hide();
field.bind('click', inputClicked).removeAttr('disabled');
});
//uploader javascript callback function
function fileSharingUploader(callback) {
angular.element('#mediaBrowserfolderWidget_{$folderWidgetId}').scope().refreshBrowser();
}
</script>
CODE;
$this->objTemplate->setVariable(array('UPLOADER_CODE' => $uploader->getXHtml(), 'FILE_INPUT_CODE' => $extendedFileInputCode, 'FOLDER_WIDGET_CODE' => $folderWidget->getXHtml()));
return $uploadId;
// return the upload id
}
示例5: showImport
/**
* It displayes the import menu
*
* @return customer import screen
*/
function showImport()
{
global $_ARRAYLANG, $objDatabase;
\JS::activate('cx');
\JS::activate('jqueryui');
\JS::registerCSS('modules/Crm/View/Style/main.css');
\JS::registerJS('modules/Crm/View/Script/contactexport.js');
\JS::registerJS('lib/javascript/jquery.form.js');
\JS::registerJS('lib/javascript/jquery.tmpl.min.js');
\JS::registerJS('lib/javascript/jquery.base64.js');
\JS::registerJS('lib/javascript/jquery.format.js');
$objTpl = $this->_objTpl;
$objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', "module_{$this->moduleNameLC}_interface_import_options.html");
$objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName));
foreach ($this->_delimiter as $key => $value) {
$objTpl->setVariable(array('CRM_DELIMITER_VALUE' => $key, 'CRM_DELIMITER_TITLE' => $_ARRAYLANG[$value['placeholder']]));
$objTpl->parse('crm_delimiter');
}
foreach ($this->_enclosure as $key => $value) {
$objTpl->setVariable(array('CRM_ENCLOSURE_VALUE' => $key, 'CRM_ENCLOSURE_TITLE' => $_ARRAYLANG[$value['placeholder']]));
$objTpl->parse('crm_enclosure');
}
$options = array('upload-limit' => 1, 'id' => 'importUploader', 'style' => 'display:none;', 'allowed-extensions' => array('csv'));
$uploaderCode = $this->initUploader('uploadFinished', 'importCallbackJs', '', '', $options);
$redirectUrl = \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?cmd=Crm&act=getImportFilename');
$this->_objTpl->setVariable(array('COMBO_UPLOADER_CODE' => $uploaderCode, 'REDIRECT_URL' => $redirectUrl));
$objTpl->setVariable(array('TXT_CRM_TITLE_IMPORT_CONTACTS' => $_ARRAYLANG['TXT_CRM_TITLE_IMPORT_CONTACTS'], 'TXT_CRM_IMPORT_HEADER' => $_ARRAYLANG['TXT_CRM_IMPORT_HEADER'], 'TXT_CRM_IMPORT_NOTE' => $_ARRAYLANG['TXT_CRM_IMPORT_NOTE'], 'TXT_CRM_IMPORT_NOTE_DESCRIPTION' => $_ARRAYLANG['TXT_CRM_IMPORT_NOTE_DESCRIPTION'], 'TXT_CRM_CSV_SETTINGS' => $_ARRAYLANG['TXT_CRM_CSV_SETTINGS'], 'TXT_CRM_SKIP' => $_ARRAYLANG['TXT_CRM_SKIP'], 'TXT_CRM_OVERWRITE' => $_ARRAYLANG['TXT_CRM_OVERWRITE'], 'TXT_CRM_DUPLICATE' => $_ARRAYLANG['TXT_CRM_DUPLICATE'], 'TXT_CRM_CHOOSE_FILE' => $_ARRAYLANG['TXT_CRM_CHOOSE_FILE'], 'TXT_CRM_CSV_SEPARATOR' => $_ARRAYLANG['TXT_CRM_CSV_SEPARATOR'], 'TXT_CRM_CSV_ENCLOSURE' => $_ARRAYLANG['TXT_CRM_CSV_ENCLOSURE'], 'TXT_CRM_ON_DUPLICATES' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATES'], 'TXT_CRM_CHOOSE_CSV' => $_ARRAYLANG['TXT_CRM_CHOOSE_CSV'], 'TXT_CRM_ON_DUPLICATES_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATES_INFO'], 'TXT_CRM_ON_DUPLICATE_SKIP_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_SKIP_INFO'], 'TXT_CRM_ON_DUPLICATE_OVERWRITE_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_OVERWRITE_INFO'], 'TXT_CRM_ON_DUPLICATE_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_INFO'], 'TXT_CRM_IGNORE_FIRST_ROW' => $_ARRAYLANG['TXT_CRM_IGNORE_FIRST_ROW'], 'TXT_CRM_CONTINUE' => $_ARRAYLANG['TXT_CRM_CONTINUE'], 'TXT_CRM_CANCEL' => $_ARRAYLANG['TXT_CRM_CANCEL'], 'TXT_CRM_VERIFY_FIELDS' => $_ARRAYLANG['TXT_CRM_VERIFY_FIELDS'], 'TXT_CRM_VERIFY_INFO' => $_ARRAYLANG['TXT_CRM_VERIFY_INFO'], 'TXT_CRM_FILE_COLUMN' => $_ARRAYLANG['TXT_CRM_FILE_COLUMN'], 'TXT_CRM_CORRESPONDING_FIELD' => $_ARRAYLANG['TXT_CRM_CORRESPONDING_FIELD'], 'TXT_CRM_CSV_VALUE' => $_ARRAYLANG['TXT_CRM_CSV_VALUE'], 'TXT_CRM_CHANGE' => $_ARRAYLANG['TXT_CRM_CHANGE'], 'TXT_CRM_LOADING' => $_ARRAYLANG['TXT_CRM_LOADING'], 'TXT_CRM_PREVIOUS_RECORD' => $_ARRAYLANG['TXT_CRM_PREVIOUS_RECORD'], 'TXT_CRM_NEXT_RECORD' => $_ARRAYLANG['TXT_CRM_NEXT_RECORD'], 'TXT_CRM_TITLE_SAVING_CONTACTS' => $_ARRAYLANG['TXT_CRM_TITLE_SAVING_CONTACTS'], 'TXT_CRM_INTERFACE_FINAL_INFO' => $_ARRAYLANG['TXT_CRM_INTERFACE_FINAL_INFO'], 'TXT_CRM_RECORD_DONE' => $_ARRAYLANG['TXT_CRM_RECORD_DONE'], 'TXT_CRM_RECORD_SKIPPED' => $_ARRAYLANG['TXT_CRM_RECORD_SKIPPED'], 'TXT_CRM_RECORD_IMPORT' => $_ARRAYLANG['TXT_CRM_RECORD_IMPORT'], 'TXT_CRM_RECORD_PROCESS' => $_ARRAYLANG['TXT_CRM_RECORD_PROCESS'], 'TXT_CRM_IMPORT_NAME' => $_ARRAYLANG['TXT_CRM_IMPORT_NAME'], 'TXT_CRM_EXPORT_NAME' => $_ARRAYLANG['TXT_CRM_EXPORT_NAME']));
}
示例6: initUploader
/**
* init the pl uploader which is directly included in the webpage
*
* @return integer the uploader id
*/
protected function initUploader()
{
\JS::activate('cx');
// the uploader needs the framework
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
\Env::get('ClassLoader')->loadFile($cx->getCodeBaseCoreModulePath() . '/Upload/Controller/UploadFactory.class.php');
/**
* Name of the upload instance
*/
$uploaderInstanceName = 'exposed_combo_uploader';
$uploaderWidgetName = 'uploadWidget';
/**
* jQuery selector of the HTML-element where the upload folder-widget shall be put in
*/
$uploaderFolderWidgetContainer = '#uploadFormField_uploadWidget';
// create an exposedCombo uploader
$uploader = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newUploader('exposedCombo');
//set instance name so we are able to catch the instance with js
$uploader->setJsInstanceName($uploaderInstanceName);
// specifies the function to call when upload is finished. must be a static function
$uploader->setFinishedCallback(array($cx->getCodeBaseModulePath() . '/FileSharing/Controller/FileSharing.class.php', '\\Cx\\Modules\\FileSharing\\Controller\\FileSharing', 'uploadFinished'));
//insert the uploader into the HTML-template
$this->objTemplate->setVariable(array('UPLOADER_CODE' => $uploader->getXHtml(), 'EXTENDED_FILE_INPUT_CODE' => <<<CODE
<script type="text/javascript">
cx.include(
[
'core_modules/Upload/js/uploaders/exposedCombo/extendedFileInput.js'
],
function() {
var ef = new ExtendedFileInput({
field: \$J('#file_upload'),
instance: '{$uploaderInstanceName}',
widget: '{$uploaderWidgetName}'
});
}
);
cx.jQuery(document).ready(function(\$) {
\$J('a.toggle').click(function() {
\$J('div.toggle').toggle();
return false;
});
});
</script>
CODE
));
// optional: initialize the widget displaying the folder contents
$uploadId = $uploader->getUploadId();
$tempPaths = self::getTemporaryFilePaths($uploadId);
if (!is_dir($tempPaths[0] . '/' . $tempPaths[2])) {
\Cx\Lib\FileSystem\FileSystem::make_folder($tempPaths[0] . '/' . $tempPaths[2]);
//mkdir($tempPaths[0] . '/' . $tempPaths[2]);
\Cx\Lib\FileSystem\FileSystem::makeWritable($tempPaths[0] . '/' . $tempPaths[2]);
//chmod($tempPaths[0] . '/' . $tempPaths[2], 0777);
}
$folderWidget = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newFolderWidget($tempPaths[0] . '/' . $tempPaths[2], $uploaderInstanceName);
$this->objTemplate->setVariable('UPLOAD_WIDGET_CODE', $folderWidget->getXHtml($uploaderFolderWidgetContainer, 'uploadWidget'));
// return the upload id
return $uploadId;
}
示例7: showEcards
function showEcards()
{
global $objDatabase, $_ARRAYLANG;
\JS::activate('shadowbox');
$this->_objTpl->setTemplate($this->pageContent);
// Initialize POST variables
$selectedId = isset($_POST['selectedEcard']) ? intval($_POST['selectedEcard']) : 0;
$message = !empty($_POST['ecardMessage']) ? htmlentities(contrexx_stripslashes($_POST['ecardMessage']), ENT_QUOTES, CONTREXX_CHARSET) : "";
$recipientSalutation = !empty($_POST['ecardRecipientSalutation']) ? htmlentities(contrexx_stripslashes($_POST['ecardRecipientSalutation']), ENT_QUOTES, CONTREXX_CHARSET) : "";
$senderName = !empty($_POST['ecardSenderName']) ? htmlentities(contrexx_stripslashes($_POST['ecardSenderName']), ENT_QUOTES, CONTREXX_CHARSET) : "";
$senderEmail = !empty($_POST['ecardSenderEmail']) && \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : "";
$recipientName = !empty($_POST['ecardRecipientName']) ? htmlentities(contrexx_stripslashes($_POST['ecardRecipientName']), ENT_QUOTES, CONTREXX_CHARSET) : "";
$recipientEmail = !empty($_POST['ecardRecipientEmail']) && \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : "";
// Get max. number of characters and lines per message
$query = "\n SELECT `setting_name`, `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
switch ($objResult->fields['setting_name']) {
case "maxCharacters":
$maxCharacters = $objResult->fields['setting_value'];
break;
case "maxLines":
$maxLines = $objResult->fields['setting_value'];
break;
}
$objResult->MoveNext();
}
$this->_objTpl->setVariable(array('ECARD_MESSAGE' => $message, 'ECARD_SENDERNAME' => $senderName, 'ECARD_RECIPIENTNAME' => $recipientName, 'ECARD_SENDEREMAIL' => $senderEmail, 'ECARD_RECIPIENTEMAIL' => $recipientEmail, 'ECARD_SALUTATION_SELECTED_MALE' => $recipientSalutation == $_ARRAYLANG['TXT_ECARD_TITLE_MALE'] ? ' checked="checked"' : '', 'ECARD_SALUTATION_SELECTED_FEMALE' => $recipientSalutation == $_ARRAYLANG['TXT_ECARD_TITLE_FEMALE'] ? ' checked="checked"' : '', 'TXT_ECARD_CHOOSE_IMAGE' => $_ARRAYLANG['TXT_ECARD_CHOOSE_IMAGE'], 'TXT_ECARD_ENTER_RECIPIENT_INFO' => $_ARRAYLANG['TXT_ECARD_ENTER_RECIPIENT_INFO'], 'TXT_ECARD_TITLE_MALE' => $_ARRAYLANG['TXT_ECARD_TITLE_MALE'], 'TXT_ECARD_TITLE_FEMALE' => $_ARRAYLANG['TXT_ECARD_TITLE_FEMALE'], 'TXT_ECARD_RECIPIENT_TITLE' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_TITLE'], 'TXT_ECARD_RECIPIENT_NAME' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_NAME'], 'TXT_ECARD_SENDER_NAME' => $_ARRAYLANG['TXT_ECARD_SENDER_NAME'], 'TXT_ECARD_RECIPIENT_EMAIL' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_EMAIL'], 'TXT_ECARD_SENDER_EMAIL' => $_ARRAYLANG['TXT_ECARD_SENDER_EMAIL'], 'TXT_ECARD_ENTER_MESSAGE' => $_ARRAYLANG['TXT_ECARD_ENTER_MESSAGE'], 'TXT_ECARD_NUMBER_OF_CHARACTERS_LEFT' => sprintf($_ARRAYLANG['TXT_ECARD_NUMBER_OF_CHARACTERS_LEFT'], $maxCharacters), 'TXT_ECARD_NUMBER_OF_LINES_LEFT' => sprintf($_ARRAYLANG['TXT_ECARD_NUMBER_OF_LINES_LEFT'], $maxLines), 'TXT_ECARD_PREVIEW' => $_ARRAYLANG['TXT_ECARD_PREVIEW']));
// Select motives from DB
$query = "\n SELECT setting_value, setting_name\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name LIKE 'motive_%'\n ORDER BY setting_name ASC";
$i = 0;
$objResult = $objDatabase->Execute($query);
// Initialize DATA placeholder
while (!$objResult->EOF) {
$motive = $objResult->fields['setting_value'];
$motive = basename($motive);
if (empty($motive)) {
$objResult->MoveNext();
continue;
}
$arrMatch = array();
$id = 0;
if (preg_match('/(\\d+)$/', $objResult->fields['setting_name'], $arrMatch)) {
$id = $arrMatch[1];
}
$this->_objTpl->setVariable(array('ECARD_MOTIVE_OPTIMIZED_PATH' => ASCMS_ECARD_OPTIMIZED_WEB_PATH . '/' . $motive, 'ECARD_MOTIVE_ID' => $id, 'ECARD_THUMBNAIL_PATH' => ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . $motive, 'ECARD_CSSNUMBER' => $i % 3 + 1, 'ECARD_IMAGE_SELECTED' => $id == $selectedId ? ' checked="checked"' : ''));
$this->_objTpl->parse('motiveBlock');
if ($i % 3 == 0) {
$this->_objTpl->parse('motiveRow');
}
++$i;
$objResult->MoveNext();
}
$this->_objTpl->setVariable('ECARD_JAVASCRIPT', self::getJavascript($maxCharacters));
}
示例8: preResolve
/**
* Do something before resolving is done
*
* @param \Cx\Core\Routing\Url $request The URL object for this request
*/
public function preResolve(\Cx\Core\Routing\Url $request)
{
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
// Load the JS helper class and set the offset
\JS::setOffset('../');
\JS::activate('backend');
\JS::activate('cx');
\JS::activate('chosen');
break;
}
}
示例9: __construct
public function __construct(&$objTpl)
{
global $_ARRAYLANG, $objInit;
$_ARRAYLANG = array_merge($_ARRAYLANG, $objInit->loadLanguageData('FileSharing'));
$this->_objTpl = $objTpl;
$this->_objTpl->setRoot(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/FileSharing/View/Template/Backend');
if ($_GET['act'] == 'settings') {
$templateFile = 'module_filesharing_settings.html';
} else {
$templateFile = 'module_filesharing_detail.html';
}
$this->_objTpl->loadTemplateFile($templateFile, true, true);
\JS::activate("cx");
}
示例10: getXHtml
/**
* @override
*/
public function getXHtml()
{
global $_CORELANG;
//JS / CSS dependencies
\JS::activate('cx');
\JS::registerJS('lib/javascript/swfobject.js');
// JS::registerJS('lib/javascript/deployJava.js');
\JS::registerJS('core_modules/Upload/js/uploaders/combo/combo.js');
\JS::registerCSS('core_modules/Upload/css/uploaders/combo/combo.css');
\JS::registerJS('core_modules/Upload/js/uploaders/pl/plupload.full.js');
\JS::registerJS('core_modules/Upload/js/uploaders/pl/jquery.plupload.queue.js');
\JS::registerCSS('core_modules/Upload/css/uploaders/pl/plupload.queue.css');
$formUploader = UploadFactory::getInstance()->newUploader('form', $this->uploadId);
//i18n of uploader descriptions
$formUploaderDescription = $_CORELANG['FORM_UPLOADER'];
$plUploaderDescription = $_CORELANG['PL_UPLOADER'];
$jumpUploaderDescription = $_CORELANG['JUMP_UPLOADER'];
$alternativesCaption = $_CORELANG['OTHER_UPLOADERS'];
//combuploader js config: available uploaders
$uploaders = array("{type:'form',description:'" . $formUploaderDescription . "'}");
if (in_array('Pl', $this->enabledUploaders)) {
array_push($uploaders, "{type:'pl',description:'" . $plUploaderDescription . "'}");
}
if (in_array('Jump', $this->enabledUploaders)) {
array_push($uploaders, "{type:'jump',description:'" . $jumpUploaderDescription . "'}");
}
$uploaders = '[' . join(',', $uploaders) . ']';
$cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
$actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
//from where the combouploader gets the code on an uploader switch
$switchUrl;
//from where the combouploader gets the response for finished uploads
$responseUrl;
if ($this->isBackendRequest) {
$switchUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=ajaxUploaderCode';
$responseUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=response';
} else {
$switchUrl = CONTREXX_SCRIPT_PATH . '?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=ajaxUploaderCode';
$responseUrl = CONTREXX_SCRIPT_PATH . '?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=response';
}
$tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
$tpl->setErrorHandling(PEAR_ERROR_DIE);
$tpl->loadTemplateFile('combo.html');
$tpl->setVariable(array('CONFIG_UPLOADERS_JS' => $uploaders, 'RESPONSE_URL' => $responseUrl, 'UPLOAD_ID' => $this->uploadId, 'SWITCH_URL' => $switchUrl, 'OTHER_UPLOADERS_CAPTION' => $_CORELANG['OTHER_UPLOADERS'], 'TXT_CORE_UPLOAD_MORE' => $_CORELANG['TXT_CORE_UPLOAD_MORE'], 'TXT_CORE_FINISH_UPLOADING' => $_CORELANG['TXT_CORE_FINISH_UPLOADING'], 'TXT_CORE_FILES_UPLOADED' => $_CORELANG['TXT_CORE_FILES_UPLOADED'], 'TXT_CORE_FILES_NOT_UPLOADED' => $_CORELANG['TXT_CORE_FILES_NOT_UPLOADED']));
$tpl->setVariable('UPLOADER_CODE', $formUploader->getXHtml());
//see Uploader::handleInstanceBusiness
$this->handleInstanceBusiness($tpl, 'cu');
return $tpl->get();
}
示例11: setMotives
function setMotives()
{
global $objDatabase, $_ARRAYLANG;
\JS::activate('shadowbox');
$this->_objTpl->loadTemplateFile('module_ecard_overview.html', true, true);
$this->_pageTitle = $_ARRAYLANG['TXT_MOTIVE_SELECTION'];
$mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
$mediaBrowser->setCallback('mbCallback');
$mediaBrowser->setOptions(array('type' => 'button', 'data-cx-mb-views' => 'filebrowser', 'id' => 'mediabrowser_button', 'style' => 'display: none;'));
/* Update progress */
if (!empty($_POST['saveMotives'])) {
$i = 0;
$motiveInputArray = $_POST['motiveInputArray'];
while ($i < 9) {
$filepath = $motiveInputArray[$i];
$filename = basename($filepath);
$query = "\n UPDATE " . DBPREFIX . "module_ecard_settings\n SET setting_value='" . contrexx_addslashes($filename) . "'\n WHERE setting_name='motive_{$i}'";
$objResult = $objDatabase->Execute($query);
/* Create optimized picture for e-card dispatch */
if ($filepath != '' && file_exists(\Env::get('cx')->getWebsitePath() . $filepath)) {
$this->resizeMotive(2, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_OPTIMIZED_PATH . '/');
$this->resizeMotive(1, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_THUMBNAIL_PATH . '/');
}
++$i;
}
$this->_objTpl->setVariable(array('CONTENT_OK_MESSAGE' => $this->strOkMessage = $_ARRAYLANG['TXT_DATA_SAVED']));
}
$this->_objTpl->setGlobalVariable(array('TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_DELETE_MOTIVE' => $_ARRAYLANG['TXT_DELETE_MOTIVE'], 'TXT_PICTURE' => $_ARRAYLANG['TXT_PICTURE'], 'TXT_PATH' => $_ARRAYLANG['TXT_PATH'], 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_CHOOSE' => $_ARRAYLANG['TXT_CHOOSE'], 'TXT_DELETE' => $_ARRAYLANG['TXT_DELETE'], 'TXT_ECARD_IMAGES' => $_ARRAYLANG['TXT_ECARD_IMAGES'], 'MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
/* Display progress */
$query = "\n SELECT `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name LIKE 'motive_%'\n ORDER BY setting_name ASC";
$objResult = $objDatabase->Execute($query);
$i = 0;
/* Create thumbnails */
while (!$objResult->EOF) {
$motiveFilename = $objResult->fields['setting_value'];
$thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . "no_picture.gif";
$sourcePath = '';
if ($motiveFilename != '') {
$sourcePath = ASCMS_ECARD_OPTIMIZED_WEB_PATH . '/' . $motiveFilename;
$thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . $motiveFilename;
}
/* Initialize DATA placeholder */
$this->_objTpl->setVariable(array('MOTIVE_PATH' => $sourcePath, 'MOTIVE_THUMB_PATH' => $thumbnail, 'MOTIVE_ID' => $i++));
$this->_objTpl->parse('motiveBlock');
$objResult->MoveNext();
}
$this->_objTpl->replaceBlock('motiveBlock', '', true);
}
示例12: preFinalize
public function preFinalize(\Cx\Core\Html\Sigma $template)
{
if (count($this->uploaderInstances) == 0) {
return;
} else {
global $_ARRAYLANG;
\Env::get('init')->loadLanguageData('Uploader');
foreach ($_ARRAYLANG as $key => $value) {
if (preg_match("/UPLOADER(_[A-Za-z0-9]+)?/", $key)) {
\ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
}
}
\JS::activate('mediabrowser');
\JS::registerJS('core_modules/Uploader/View/Script/uploader.js');
}
}
示例13: getXHtml
/**
* @override
*/
public function getXHtml()
{
global $_CORELANG;
// CSS dependencies
\JS::activate('cx');
$uploadPath = $this->getUploadPath('pl');
$tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
$tpl->setErrorHandling(PEAR_ERROR_DIE);
$tpl->loadTemplateFile('pl.html');
$tpl->setVariable('UPLOAD_FLASH_URL', ASCMS_CORE_MODULE_WEB_PATH . '/Upload/ressources/uploaders/pl/plupload.flash.swf');
$tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getLiteralSizeFormat(\FWSystem::getMaxUploadFileSize() - 1000));
$tpl->setVariable('UPLOAD_URL', $uploadPath);
$tpl->setVariable('UPLOAD_ID', $this->uploadId);
//I18N
$tpl->setVariable(array('UPLOAD' => $_CORELANG['UPLOAD'], 'OTHER_UPLOADERS' => $_CORELANG['OTHER_UPLOADERS'], 'FORM_UPLOADER' => $_CORELANG['FORM_UPLOADER'], 'PL_UPLOADER' => $_CORELANG['PL_UPLOADER'], 'JUMP_UPLOADER' => $_CORELANG['JUMP_UPLOADER'], 'SELECT_FILES' => $_CORELANG['SELECT_FILES'], 'ADD_INSTRUCTIONS' => $_CORELANG['ADD_INSTRUCTIONS'], 'FILENAME' => $_CORELANG['FILENAME'], 'STATUS' => $_CORELANG['STATUS'], 'SIZE' => $_CORELANG['SIZE'], 'ADD_FILES' => $_CORELANG['ADD_FILES'], 'STOP_CURRENT_UPLOAD' => $_CORELANG['STOP_CURRENT_UPLOAD'], 'DRAG_FILES_HERE' => $_CORELANG['DRAG_FILES_HERE']));
return $tpl->get();
}
示例14: addDatepickerJs
/**
* Registers the JavaScript code for jQueryUi.Datepicker
*
* Also activates jQueryUi and tries to load the current language and use
* that as the default.
* Add element specific defaults and code in your method.
*/
static function addDatepickerJs()
{
static $language_code = null;
// Only run once
if ($language_code) {
return;
}
JS::activate('jqueryui');
$language_code = FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID);
//DBG::log("Language ID ".FRONTEND_LANG_ID.", code $language_code");
// Must load timepicker as well, because the region file accesses it
JS::registerJS('lib/javascript/jquery/ui/jquery-ui-timepicker-addon.js');
// TODO: Add more languages to the i18n folder!
JS::registerJS('lib/javascript/jquery/ui/i18n/' . 'jquery.ui.datepicker-' . $language_code . '.js');
JS::registerCode('
cx.jQuery(function() {
cx.jQuery.datepicker.setDefaults(cx.jQuery.datepicker.regional["' . $language_code . '"]);
});
');
}
示例15: getSourceCode
/**
* Get the html source code for the wysiwyg editor
*
* @return string
*/
public function getSourceCode()
{
$mediaBrowserCkeditor = new MediaBrowser();
$mediaBrowserCkeditor->setOptions(array('type' => 'button', 'style' => 'display:none'));
$mediaBrowserCkeditor->setCallback('ckeditor_image_callback');
$mediaBrowserCkeditor->setOptions(array('id' => 'ckeditor_image_button'));
\JS::activate('ckeditor');
\JS::activate('jquery');
$configPath = ASCMS_PATH_OFFSET . substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT));
$options = array("customConfig: CKEDITOR.getUrl('" . $configPath . "?langId=" . $this->langId . "')", "width: '" . $this->types[$this->type]['width'] . "'", "height: '" . $this->types[$this->type]['height'] . "'", "toolbar: '" . $this->types[$this->type]['toolbar'] . "'", "fullPage: " . $this->types[$this->type]['fullPage']);
$extraPlugins = array_merge($this->extraPlugins, $this->types[$this->type]['extraPlugins']);
if (!empty($extraPlugins)) {
$options[] = "extraPlugins: '" . implode(',', $extraPlugins) . "'";
}
$onReady = "CKEDITOR.replace('" . $this->name . "', { %s });";
\JS::registerCode('
$J(function(){
' . sprintf($onReady, implode(",\r\n", $options)) . '
});
');
return $mediaBrowserCkeditor->getXHtml('mediabrowser') . '<textarea name="' . $this->name . '" style="width: 100%; height: ' . $this->types[$this->type]['height'] . 'px">' . $this->value . '</textarea>';
}