本文整理汇总了PHP中sensitiveIO::sanitizeJSString方法的典型用法代码示例。如果您正苦于以下问题:PHP sensitiveIO::sanitizeJSString方法的具体用法?PHP sensitiveIO::sanitizeJSString怎么用?PHP sensitiveIO::sanitizeJSString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sensitiveIO
的用法示例。
在下文中一共展示了sensitiveIO::sanitizeJSString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sizeof
$checkedElements['templates'] = true;
}
$searchPanel .= "{\n\t\txtype: \t\t'checkboxgroup',\n\t\tid: \t\t'searchCheckboxgroup',\n\t\tfieldLabel: '" . $cms_language->getJsMessage(MESSAGE_PAGE_FIELD_SEARCH_IN) . "',\n\t\tcolumns: \t1,\n\t\titems: [\n\t\t\t{boxLabel: '<em style=\"font-style:italic;\">" . $cms_language->getJSMessage(MESSAGE_PAGE_CHECK_ALL) . "</em>', checked: " . (sizeof($elements) == sizeof($checkedElements) ? 'true' : 'false') . ", listeners: {'check':function(field, checked) {\n\t\t\t\tif (searchWindow.ok) {\n\t\t\t\t\tsearchWindow.ok = false;\n\t\t\t\t\tExt.getCmp('searchCheckboxgroup').items.each(function(el, group, index){\n\t\t\t\t\t\tif (index == 0) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel.setValue(checked);\n\t\t\t\t\t}, this);\n\t\t\t\t\tsearchWindow.ok = true;\n\t\t\t\t\t//launch search\n\t\t\t\t\tsearchWindow.search();\n\t\t\t\t}\n\t\t\t}, scope:this}},\n\t\t";
foreach ($elements as $element => $label) {
$label = io::htmlspecialchars($label);
//if search use special search code, only search on standard module
$checked = !$search || isset($checkedElements[$element]) && $checkedElements[$element] ? 'true' : 'false';
$searchPanel .= "{boxLabel: '{$label}', ctCls:'x-masked', inputValue:'{$element}', checked: {$checked}, name: 'elements[]', listeners: {'check':searchWindow.search}},";
}
//remove last comma from groups
$searchPanel = substr($searchPanel, 0, -1);
$searchPanel .= "]\n\t},";
}
$searchCodes = sensitiveIO::jsonEncode($searchCodes);
$searchPanel = io::substr($searchPanel, 0, -1);
$appTitle = sensitiveIO::sanitizeJSString(APPLICATION_LABEL);
$jscontent = <<<END
\tvar searchWindow = Ext.getCmp('{$winId}');
\t
\t//set window title
\tsearchWindow.setTitle('{$cms_language->getJsMessage(MESSAGE_PAGE_FIELD_SEARCH_INTO, array($appTitle))}');
\t//set help button on top of page
\tsearchWindow.tools['help'].show();
\t//add a tooltip on button
\tvar propertiesTip = new Ext.ToolTip({
\t\ttarget: \t\tsearchWindow.tools['help'],
\t\ttitle: \t\t\t'{$cms_language->getJsMessage(MESSAGE_TOOLBAR_HELP)}',
\t\thtml: \t\t\t'{$cms_language->getJsMessage(MESSAGE_TOOLBAR_HELP_DESC)}',
\t\tdismissDelay:\t0
\t});
\t
示例2: switch
$cms_message = '';
switch ($action) {
case 'save':
case 'save-validate':
//checks and assignments
$item->setDebug(false);
$fieldsObjects = $item->getFieldsObjects();
//first, check mandatory values
$allOK = true;
foreach ($fieldsObjects as $fieldID => $aFieldObject) {
$return = $item->checkMandatory($fieldID, $fieldsValues, '', true);
if ($return !== true) {
$allOK = false;
$cms_message .= "<br />- " . $aFieldObject->getFieldLabel($cms_language);
if ($return !== false) {
$jscontent = "\n\t\t\t\t\tAutomne.message.popup({\n\t\t\t\t\t\tmsg: \t\t\t\t'" . sensitiveIO::sanitizeJSString($return) . "',\n\t\t\t\t\t\tbuttons: \t\t\tExt.MessageBox.OK,\n\t\t\t\t\t\tclosable: \t\t\ttrue,\n\t\t\t\t\t\ticon: \t\t\t\tExt.MessageBox.ERROR\n\t\t\t\t\t});";
$view->addJavascript($jscontent);
}
}
}
if (!$allOK) {
$cms_message = $cms_language->getMessage(MESSAGE_FORM_ERROR_FOLLOWING_FIELDS_MANDATORY, false, MOD_POLYMOD_CODENAME) . $cms_message;
} else {
//second, set values for all fields
foreach ($fieldsObjects as $fieldID => $aFieldObject) {
if (!$item->setValues($fieldID, $fieldsValues, '', true)) {
$cms_message .= "\n" . $cms_language->getMessage(MESSAGE_FORM_ERROR_MALFORMED_FIELD, array($aFieldObject->getFieldLabel($cms_language)));
}
}
}
//set publication dates if needed
示例3: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
//is this field mandatory ?
$mandatory = $this->_field->getValue('required') ? '<span class="atm-red">*</span> ' : '';
$desc = $this->getFieldDescription($language);
if (POLYMOD_DEBUG) {
$values = array();
foreach (array_keys($this->_subfieldValues) as $subFieldID) {
if (is_object($this->_subfieldValues[$subFieldID])) {
$values[$subFieldID] = sensitiveIO::ellipsis(strip_tags($this->_subfieldValues[$subFieldID]->getValue()), 50);
}
}
$desc .= $desc ? '<br />' : '';
$desc .= '<span class="atm-red">Field : ' . $fieldID . ' - Value(s) : <ul>';
foreach ($values as $subFieldID => $value) {
$desc .= '<li>' . $subFieldID . ' : ' . $value . '</li>';
}
$desc .= '</ul></span>';
}
$label = $desc ? '<span class="atm-help" ext:qtip="' . io::htmlspecialchars($desc) . '">' . $mandatory . $this->getFieldLabel($language) . '</span>' : $mandatory . $this->getFieldLabel($language);
$ids = 'oembed-' . md5(mt_rand() . microtime());
$oembedURL = PATH_ADMIN_MODULES_WR . '/' . MOD_POLYMOD_CODENAME . '/oembed.php';
$loadingURL = PATH_ADMIN_IMAGES_WR . '/loading-old.gif';
$params = $this->getParamsValues();
$fields = array();
$fields[] = array('fieldLabel' => '<span class="atm-help" ext:qtip="' . io::htmlspecialchars($language->getMessage(self::MESSAGE_OBJECT_OEMBED_MEDIA_URL_DESC, false, MOD_POLYMOD_CODENAME)) . '">' . $language->getMessage(self::MESSAGE_OBJECT_OEMBED_MEDIA_URL, false, MOD_POLYMOD_CODENAME) . '</span>', 'xtype' => 'textfield', 'name' => 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_0]', 'value' => $this->_subfieldValues[0]->getValue() ? sensitiveIO::decodeEntities($this->_subfieldValues[0]->getValue()) : '', 'enableKeyEvents' => true, 'listeners' => array('blur' => array('fn' => sensitiveIO::sanitizeJSString('function(el){
/*call server for oembed HTML content*/
Ext.get(\'' . $ids . '-view\').update(\'<img src="' . $loadingURL . '" />\');
Automne.server.call({
url: \'' . $oembedURL . '\',
scope: this,
fcnCallback: function(response, options, htmlResponse){
Ext.get(\'' . $ids . '-view\').update(htmlResponse);
},
params: {
module: \'' . $moduleCodename . '\',
url: el.getValue(),
width: 600,
height: 250,
key: \'' . $params['embedlyKey'] . '\'
}
});
}', false, false), 'buffer' => 600)));
$fields[] = array('xtype' => 'panel', 'border' => false, 'html' => '<div id="' . $ids . '-view" style="overflow:auto;text-align:center;">' . ($this->getValue('hasValue') ? $this->getValue('html', '600,250') : '') . '</div>');
$return = array();
$return = array('title' => $label, 'xtype' => 'fieldset', 'autoHeight' => true, 'defaultType' => 'textfield', 'defaults' => array('anchor' => '97%', 'allowBlank' => !$this->_field->getValue('required')), 'items' => $fields);
return $return;
}
示例4: CMS_file
} else {
CMS_grandFather::raiseError('Error, can\'t get block class : ' . $blockClass);
$view->show();
}
$maxFileSize = CMS_file::getMaxUploadFileSize('K');
if ($rawDatas['file'] && file_exists(PATH_MODULES_FILES_STANDARD_FS . '/edition/' . $rawDatas['file'])) {
$file = new CMS_file(PATH_MODULES_FILES_STANDARD_FS . '/edition/' . $rawDatas['file']);
$fileDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$filePath = $fileDatas['filepath'];
$fileDatas = sensitiveIO::jsonEncode($fileDatas);
$flashvars = sensitiveIO::sanitizeJSString($rawDatas["flashvars"]);
$params = sensitiveIO::sanitizeJSString($rawDatas["params"]);
$attributes = sensitiveIO::sanitizeJSString($rawDatas["attributes"]);
$jscontent = <<<END
\tvar blockWindow = Ext.getCmp('{$winId}');
\t//set window title
\tblockWindow.setTitle('{$cms_language->getJsMessage(MESSAGE_EDIT_FLASH)}');
\t//set help button on top of page
\tblockWindow.tools['help'].show();
\t//add a tooltip on button
\tvar propertiesTip = new Ext.ToolTip({
\t\ttarget:\t\t blockWindow.tools['help'],
\t\ttitle:\t\t\t '{$cms_language->getJsMessage(MESSAGE_TOOLBAR_HELP)}',
\t\thtml:\t\t\t '{$cms_language->getJsMessage(MESSAGE_WINDOW_INFO)}',
\t\tdismissDelay:\t0
\t});
\t
\t//create center panel
示例5: array
} else {
$item->lock($cms_user);
}
}
//check user rights on item
if (!$item->userHasClearance($cms_user, CLEARANCE_MODULE_EDIT)) {
CMS_grandFather::raiseError('Error, user has no rights item ' . $itemId);
$jscontent = "\n\t\tvar window = Ext.getCmp('{$winId}');\n\t\tif (window) {\n\t\t\twindow.close();\n\t\t}\n\t\tAutomne.message.popup({\n\t\t\tmsg: \t\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_ELEMENT_EDIT_RIGHTS_ERROR, array($itemLabel), MOD_POLYMOD_CODENAME)}',\n\t\t\tbuttons: \t\t\tExt.MessageBox.OK,\n\t\t\tclosable: \t\t\tfalse,\n\t\t\ticon: \t\t\t\tExt.MessageBox.ERROR\n\t\t});";
$view->addJavascript($jscontent);
$view->show();
}
} else {
//instanciate clean object (creation)
$item = new CMS_poly_object($object->getID(), '');
}
$winLabel = sensitiveIO::sanitizeJSString($cms_language->getMessage(MESSAGE_PAGE_TITLE_MODULE, array($cms_module->getLabel($cms_language))) . " :: " . $cms_language->getMessage(MESSAGE_PAGE_TITLE, array($object->getLabel($cms_language)), MOD_POLYMOD_CODENAME));
$fieldsObjects = $item->getFieldsObjects();
$itemFields = '';
foreach ($fieldsObjects as $fieldID => $aFieldObject) {
$fieldAdmin = $item->getHTMLAdmin($fieldID, $cms_language, '');
if (is_array($fieldAdmin)) {
$itemFields .= sensitiveIO::jsonEncode($fieldAdmin) . ',';
}
}
//do some search and replace to allow use of js functions in returned code
$itemFields = str_replace('"scope":"this"', '"scope":this', $itemFields);
function replaceCallBack($parts)
{
return 'function(' . str_replace(array('\\"', '\\/'), array('"', '/'), $parts[1]) . '}';
}
$itemFields = preg_replace_callback('#"function\\((.*)}"#U', 'replaceCallBack', $itemFields);
示例6: foreach
if ($polymodule) {
foreach ($pluginDefinitions as $id => $pluginDefinition) {
$items .= $items ? ',' : '';
$objectWinId = 'module' . $aPolyModuleCodename . '-' . $id . 'Plugin';
if ($pluginDefinition->needSelection() && !$content && $selectedPluginID != $id) {
$disabled = 'disabled:true,';
$label = '<span ext:qtip="' . sensitiveIO::sanitizeJSString($polymodule->getLabel($cms_language) . ' : ' . $pluginDefinition->getDescription($cms_language) . '<br /><br /><strong>' . $cms_language->getMessage(MESSAGE_PAGE_TAB_DISABLED_SELECT_TEXT, false, MOD_POLYMOD_CODENAME)) . '</strong>">' . sensitiveIO::sanitizeJSString($pluginDefinition->getLabel($cms_language)) . '</span>';
} elseif (!$pluginDefinition->needSelection() && $content && $selectedPluginID != $id) {
$disabled = 'disabled:true,';
$label = '<span ext:qtip="' . sensitiveIO::sanitizeJSString($polymodule->getLabel($cms_language) . ' : ' . $pluginDefinition->getDescription($cms_language) . '<br /><br /><strong>' . $cms_language->getMessage(MESSAGE_PAGE_TAB_DISABLED_NO_SELECT_TEXT, false, MOD_POLYMOD_CODENAME)) . '</strong>">' . sensitiveIO::sanitizeJSString($pluginDefinition->getLabel($cms_language)) . '</span>';
} else {
if ($selectedPluginID == $id || $activeTab === 0) {
$activeTab = $objectWinId;
}
$disabled = '';
$label = '<span ext:qtip="' . sensitiveIO::sanitizeJSString($polymodule->getLabel($cms_language) . ' : ' . $pluginDefinition->getDescription($cms_language)) . '">' . sensitiveIO::sanitizeJSString($pluginDefinition->getLabel($cms_language)) . '</span>';
}
$params = sensitiveIO::jsonEncode(array('winId' => $objectWinId, 'objectId' => $pluginDefinition->getValue('objectID'), 'plugin' => $id, 'selectedItem' => $selectedItem, 'content' => $content, 'module' => $aPolyModuleCodename));
$items .= "{\n\t\t\t\t{$disabled}\n\t\t\t\ttitle:\t'{$label}',\n\t\t\t\tid:\t\t'{$objectWinId}',\n\t\t\t\txtype:\t'atmPanel',\n\t\t\t\tlayout:\t'atm-border',\n\t\t\t\tautoLoad:\t\t{\n\t\t\t\t\turl:\t\t'{$url}',\n\t\t\t\t\tparams:\t\t{$params},\n\t\t\t\t\tnocache:\ttrue,\n\t\t\t\t\tscope:\t\tcenter\n\t\t\t\t},\n\t\t\t\tselectItem:\t\tfunction(id, params) {\n\t\t\t\t\tfieldPluginCode.setValue('');\n\t\t\t\t\tif (id) {\n\t\t\t\t\t\t//grab code to paste from selected item id\n\t\t\t\t\t\tAutomne.server.call('{$pluginControler}', function(response, option, content){\n\t\t\t\t\t\t\tfieldPluginCode.setValue(content);\n\t\t\t\t\t\t}, Ext.apply({\n\t\t\t\t\t\t\titem:\t\tid,\n\t\t\t\t\t\t\ttype:\t\tparams.objectId,\n\t\t\t\t\t\t\taction:\t\t'pluginSelection'\n\t\t\t\t\t\t}, params), this);\n\t\t\t\t\t}\n\t\t\t\t}.createDelegate(this, [{$params}], true)\n\t\t\t}";
}
}
}
$jscontent = <<<END
\tvar moduleWindow = Ext.getCmp('{$winId}');
\t//create center panel
\tvar center = new Ext.TabPanel({
activeTab: \t\t\t'{$activeTab}',
id:\t\t\t\t\t'modulePluginsPanel',
\t\tregion:\t\t\t\t'center',
\t\tplain:\t\t\t\ttrue,
enableTabScroll:\ttrue,
示例7: base64_encode
//check for view rights for user
if (!$cms_user->hasPageClearance($cms_page->getID(), CLEARANCE_PAGE_VIEW)) {
CMS_grandFather::raiseError('Error, user has no rights on page : ' . $cms_page->getID());
$view->show();
}
$pageId = $cms_page->getID();
$pageTitle = sensitiveIO::sanitizeJSString($cms_page->getTitle(true));
$onClick = base64_encode("\n\tthis.node.select();\n");
//Page templates replacement
$pageTemplate = $cms_page->getTemplate();
//hack if page has no valid template attached
if (!is_a($pageTemplate, "CMS_pageTemplate")) {
$pageTemplate = new CMS_pageTemplate();
}
$pageTplId = CMS_pageTemplatesCatalog::getTemplateIDForCloneID($pageTemplate->getID());
$pageTplLabel = sensitiveIO::sanitizeJSString($pageTemplate->getLabel());
$jscontent = <<<END
\tvar copyPageWindow = Ext.getCmp('{$winId}');
\t//if we are in a window context
\t
\t//set window title
\tcopyPageWindow.setTitle('{$cms_language->getJsMessage(MESSAGE_PAGE_COPY)} \\'{$pageTitle}\\'');
\t//set help button on top of page
\tcopyPageWindow.tools['help'].show();
\t//add a tooltip on button
\tvar pageTip = new Ext.ToolTip({
\t\ttarget: \t\tcopyPageWindow.tools['help'],
\t\ttitle: \t\t\t'{$cms_language->getJsMessage(MESSAGE_TOOLBAR_HELP)}',
\t\thtml: \t\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_COPY_INFO)}',
\t\tdismissDelay:\t0
\t});
示例8: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
$return = parent::getHTMLAdmin($fieldID, $language, $prefixName);
global $cms_user;
$params = $this->getParamsValues();
$prefixName = isset($inputParams['prefix']) ? $inputParams['prefix'] : '';
$rootCategory = isset($inputParams['root']) && SensitiveIO::isPositiveInteger($inputParams['root']) ? $inputParams['root'] : false;
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
if ($params['multiCategories']) {
// Get categories
$a_all_categories = $this->getAllCategoriesAsArray($language, false, $moduleCodename, CLEARANCE_MODULE_EDIT, $rootCategory, true);
$checkedValues = array();
if (isset($this->_subfieldValues[0]) && is_object($this->_subfieldValues[0]) && !is_null($this->_subfieldValues[0]->getValue()) && $this->_subfieldValues[0]->getID()) {
foreach (array_keys($this->_subfieldValues) as $subFieldID) {
if (is_object($this->_subfieldValues[$subFieldID])) {
$checkedValues[$this->_subfieldValues[$subFieldID]->getValue()] = $this->_subfieldValues[$subFieldID]->getValue();
}
}
} elseif (sensitiveIO::isPositiveInteger($params['defaultValue'])) {
$checkedValues[$params['defaultValue']] = $params['defaultValue'];
}
$valueString = implode(',', $checkedValues);
if (is_array($a_all_categories) && $a_all_categories) {
$fathers = array(0 => false);
foreach ($a_all_categories as $id => $category) {
$level = substr_count($category, '- ');
$father = false;
if ($level && isset($fathers[$level - 1])) {
$father = $fathers[$level - 1];
}
$cat = new stdClass();
$cat->id = $id;
$cat->checked = isset($checkedValues[$id]);
$cat->cls = isset($checkedValues[$id]) ? 'x-tree-checked' : '';
$cat->level = $level;
$cat->text = str_replace('- ', '', $category);
if (strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8') {
$cat->text = io::utf8Encode($cat->text);
}
$cat->leaf = true;
$fathers[$level] = $cat;
if ($father) {
$father->children[] = $cat;
$father->leaf = false;
$father->expanded = true;
} else {
$availableCategories[] = $cat;
}
}
} else {
$availableCategories[] = array('id' => '', 'text' => $language->getMessage(self::MESSAGE_EMPTY_OBJECTS_SET), 'leaf' => true);
}
$fieldId = md5(mt_rand() . microtime());
$field = array();
$field['id'] = 'tree-' . $fieldId;
$field['xtype'] = 'treepanel';
$field['height'] = io::isPositiveInteger($params['selectHeight']) ? (int) $params['selectHeight'] : 150;
$field['width'] = io::isPositiveInteger($params['selectWidth']) ? (int) $params['selectWidth'] : '100%';
$field['autoScroll'] = true;
$field['animate'] = true;
$field['containerScroll'] = true;
$field['rootVisible'] = false;
$field['root'] = array('expanded' => true, 'children' => $availableCategories);
$field['listeners'] = array('checkchange' => array('fn' => sensitiveIO::sanitizeJSString('function(node, checked){
var tree = Ext.getCmp(\'tree-' . $fieldId . '\');
var input = Ext.getCmp(\'cat-' . $fieldId . '\');
if (tree && input) {
input.setValue(tree.getChecked(\'id\').toString());
}
if(checked){
node.getUI().addClass(\'x-tree-checked\');
}else{
node.getUI().removeClass(\'x-tree-checked\');
}
}', false, false)));
$return['xtype'] = 'compositefield';
$return['labelWidth'] = 120;
$return['items'] = array($field, array('id' => 'cat-' . $fieldId, 'xtype' => 'hidden', 'name' => 'polymodFieldsValue[list' . $prefixName . $this->_field->getID() . '_0]', 'value' => $valueString));
} else {
if (isset($this->_subfieldValues[0]) && is_object($this->_subfieldValues[0]) && !is_null($this->_subfieldValues[0]->getValue()) && $this->_subfieldValues[0]->getID()) {
$selectedValue = $this->_subfieldValues[0]->getValue() ? $this->_subfieldValues[0]->getValue() : '';
} elseif (sensitiveIO::isPositiveInteger($params['defaultValue'])) {
$selectedValue = $params['defaultValue'];
} else {
$selectedValue = '';
}
$return['xtype'] = 'atmCombo';
$return['name'] = 'polymodFieldsValue[list' . $prefixName . $this->_field->getID() . '_0]';
$return['hiddenName'] = $return['name'];
$return['forceSelection'] = true;
//.........这里部分代码省略.........
示例9: CMS_pageTemplate
}
//load template if any
if (sensitiveIO::isPositiveInteger($templateId)) {
$template = CMS_pageTemplatesCatalog::getByID($templateId);
if (!$template || $template->hasError()) {
CMS_grandFather::raiseError('Unknown template for given Id : ' . $templateId);
$view->show();
}
} else {
//create new user
$template = new CMS_pageTemplate();
}
//MAIN TAB
//Need to sanitize all datas which can contain single quotes
$label = sensitiveIO::sanitizeJSString($template->getLabel());
$description = sensitiveIO::sanitizeJSString($template->getDescription(), false, true, true);
//this is a textarea, we must keep cariage return
$templateDefinition = $template->getDefinition();
$imageName = $template->getImage();
$templateGroups = $template->getGroups();
$websitesDenied = $template->getWebsitesDenied();
//image
$maxFileSize = CMS_file::getMaxUploadFileSize('K');
if ($imageName && file_exists(PATH_TEMPLATES_IMAGES_FS . '/' . $imageName) && $imageName != 'nopicto.gif') {
$image = new CMS_file(PATH_TEMPLATES_IMAGES_FS . '/' . $imageName);
$imageDatas = array('filename' => $image->getName(false), 'filepath' => $image->getFilePath(CMS_file::WEBROOT), 'filesize' => $image->getFileSize(), 'fileicon' => $image->getFileIcon(CMS_file::WEBROOT), 'extension' => $image->getExtension());
} else {
$imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
$imageDatas = sensitiveIO::jsonEncode($imageDatas);
$fileDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
示例10: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
$return = parent::getHTMLAdmin($fieldID, $language, $prefixName);
$params = $this->getParamsValues();
$maxFileSize = CMS_file::getMaxUploadFileSize('K');
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
//Image datas
if ($this->_subfieldValues[0]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
$imageDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$imageDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
//move title from offset 1 to offset 0
$titleField = $return['items'][1];
$return['items'][1] = $return['items'][0];
$return['items'][0] = $titleField;
//Title
unset($return['items'][0]['hideLabel']);
if (isset($params['legendMandatory']) && $params['legendMandatory']) {
$return['items'][0]['fieldLabel'] = '<span class="atm-red">*</span> ' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_LABEL, false, MOD_POLYMOD_CODENAME);
} else {
$return['items'][0]['fieldLabel'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_LABEL, false, MOD_POLYMOD_CODENAME);
}
$return['items'][0]['allowBlank'] = $this->_field->getValue('required') && isset($params['legendMandatory']) && $params['legendMandatory'] ? false : true;
//Thumbnail
unset($return['items'][1]['hideLabel']);
$return['items'][1]['xtype'] = 'atmImageUploadField';
$return['items'][1]['emptyText'] = $language->getMessage(self::MESSAGE_SELECT_PICTURE);
$return['items'][1]['fieldLabel'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_THUMBNAIL, false, MOD_POLYMOD_CODENAME);
if (!$params['makeZoom']) {
if ($params['maxWidth']) {
$return['items'][1]['maxWidth'] = $params['maxWidth'];
}
if ($params['maxHeight']) {
$return['items'][1]['maxHeight'] = $params['maxHeight'];
}
}
$return['items'][1]['uploadCfg'] = array('file_size_limit' => $maxFileSize, 'file_types' => '*.jpg;*.jpeg;*.png;*.gif', 'file_types_description' => $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_THUMBNAIL, false, MOD_POLYMOD_CODENAME) . ' ...');
$return['items'][1]['fileinfos'] = $imageDatas;
$return['items'][1]['fileinfos']['module'] = $moduleCodename;
$return['items'][1]['fileinfos']['visualisation'] = RESOURCE_DATA_LOCATION_EDITED;
$checkBoxId = 'check' . md5(mt_rand() . microtime());
//Image datas
if ($params['useDistinctZoom'] || $params['makeZoom']) {
$zoomId = 'zoom' . md5(mt_rand() . microtime());
if ($this->_subfieldValues[2]->getValue() && file_exists(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue())) {
$file = new CMS_file(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
$zoomDatas = array('filename' => $file->getName(false), 'filepath' => $file->getFilePath(CMS_file::WEBROOT), 'filesize' => $file->getFileSize(), 'fileicon' => $file->getFileIcon(CMS_file::WEBROOT), 'extension' => $file->getExtension());
} else {
$zoomDatas = array('filename' => '', 'filepath' => '', 'filesize' => '', 'fileicon' => '', 'extension' => '');
}
unset($return['items'][2]['hideLabel']);
$return['items'][2]['id'] = $zoomId;
$return['items'][2]['allowBlank'] = true;
$return['items'][2]['xtype'] = 'atmImageUploadField';
$return['items'][2]['emptyText'] = $language->getMessage(self::MESSAGE_SELECT_PICTURE);
$return['items'][2]['fieldLabel'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_ZOOM, false, MOD_POLYMOD_CODENAME);
$return['items'][2]['uploadCfg'] = array('file_size_limit' => $maxFileSize, 'file_types' => '*.jpg;*.jpeg;*.png;*.gif', 'file_types_description' => $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_THUMBNAIL, false, MOD_POLYMOD_CODENAME) . ' ...');
$return['items'][2]['fileinfos'] = $zoomDatas;
$return['items'][2]['fileinfos']['module'] = $moduleCodename;
$return['items'][2]['fileinfos']['visualisation'] = RESOURCE_DATA_LOCATION_EDITED;
if ($params['maxZoomWidth']) {
$return['items'][2]['maxWidth'] = $params['maxZoomWidth'];
}
if ($params['maxZoomHeight']) {
$return['items'][2]['maxHeight'] = $params['maxZoomHeight'];
}
if (!$this->_subfieldValues[2]->getValue() && $params['makeZoom']) {
$return['items'][2]['listeners'] = array('render' => sensitiveIO::sanitizeJSString('function(el){
var fieldCt = el.label.parent();
if (fieldCt) {
fieldCt.setVisibilityMode(Ext.Element.DISPLAY);
fieldCt.hide();
}
}', false, false));
}
} else {
$return['items'][2]['xtype'] = 'hidden';
}
if ($params['makeZoom']) {
$boxLabel = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_USE_ORIGINAL_AS_ZOOM, false, MOD_POLYMOD_CODENAME);
if ($params['maxWidth'] > 0 && !$params['maxHeight']) {
$boxLabel .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC, array($params['maxWidth']), MOD_POLYMOD_CODENAME) . '</small>';
} elseif ($params['maxHeight'] && !$params['maxWidth']) {
$boxLabel .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT, array($params['maxHeight']), MOD_POLYMOD_CODENAME) . '</small>';
} elseif ($params['maxWidth'] && $params['maxHeight']) {
$boxLabel .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT_AND_WIDTH, array($params['maxWidth'], $params['maxHeight']), MOD_POLYMOD_CODENAME) . '</small>';
}
$checkField = array('allowBlank' => true, 'xtype' => 'checkbox', 'id' => $checkBoxId, 'checked' => !$params['useDistinctZoom'] && !$this->_subfieldValues[2]->getValue(), 'inputValue' => 1, 'name' => 'polymodFieldsValue[' . $prefixName . $this->_field->getID() . '_makeZoom]', 'boxLabel' => $boxLabel, 'height' => 'auto', 'labelSeparator' => '');
//.........这里部分代码省略.........
示例11: foreach
foreach ($items_possible as $key => $label) {
$dirValues[] = array('id' => $key, 'label' => $label);
}
$dirValues = sensitiveIO::jsonEncode($dirValues);
$searchPanel .= "{\n\tlayout:\t\t\t'column',\n\txtype:\t\t\t'panel',\n\tborder:\t\t\tfalse,\n\tanchor:\t\t\t'-20px',\n\titems:[{\n\t\tcolumnWidth:\t.65,\n\t\tlayout: \t\t'form',\n\t\tborder:\t\t\tfalse,\n\t\titems: \t\t\t[{$sortItem}]\n\t},{\n\t\tcolumnWidth:\t.35,\n\t\tlayout: \t\t'form',\n\t\tborder:\t\t\tfalse,\n\t\titems: [{\n\t\t\txtype:\t\t\t\t'combo',\n\t\t\tname:\t\t\t\t'direction_{$object->getID()}',\n\t\t\thiddenName:\t\t \t'direction_{$object->getID()}',\n\t\t\tforceSelection:\t\ttrue,\n\t\t\tfieldLabel:\t\t\t' ',\n\t\t\tlabelSeparator:\t\t'',\n\t\t\tmode:\t\t\t\t'local',\n\t\t\ttriggerAction:\t\t'all',\n\t\t\tvalueField:\t\t\t'id',\n\t\t\tdisplayField:\t\t'label',\n\t\t\tvalue:\t\t\t\t'{$dirValue}',\n\t\t\tanchor:\t\t\t\t'100%',\n\t\t\tstore:\t\t\t\tnew Ext.data.JsonStore({\n\t\t\t\tfields:\t\t\t\t['id', 'label'],\n\t\t\t\tdata:\t\t\t\t{$dirValues}\n\t\t\t}),\n\t\t\tvalidateOnBlur:\t\tfalse,\n\t\t\tallowBlank:\t\t \tfalse,\n\t\t\tselectOnFocus:\t\ttrue,\n\t\t\teditable:\t\t\tfalse,\n\t\t\tlisteners:\t\t\t{'valid':moduleObjectWindow.search}\n\t\t}]\n\t}]\n},";
$description = sensitiveIO::sanitizeJSString($object->getDescription($cms_language));
if ($description) {
$searchPanel .= "{\n\t\txtype:\t\t\t'panel',\n\t\tborder:\t\t\tfalse,\n\t\thtml:\t\t\t'<div style=\"color:grey;padding-top:15px;\">{$description}</div>'\n\t},";
}
//check for included file
$filename = PATH_ADMIN_FS . '/inc/' . $codename . "_" . $objectId . "_" . $cms_language->getCode() . ".inc.php";
if (file_exists($filename)) {
ob_start();
include_once $filename;
$return = ob_get_clean();
$includeDesc = sensitiveIO::sanitizeJSString($return);
$searchPanel .= "{\n\t\txtype:\t\t\t'panel',\n\t\tborder:\t\t\tfalse,\n\t\thtml:\t\t\t'<div style=\"color:grey;padding-top:15px;\">{$includeDesc}</div>'\n\t},";
}
//help for multiple selection
$searchPanel .= "{\n\txtype:\t\t\t'panel',\n\tborder:\t\t\tfalse,\n\thtml:\t\t\t'<div style=\"color:grey;padding-top:15px;font-size:x-small;\">{$cms_language->getJSMessage(MESSAGE_PAGE_HELP_MULTIPLE, false, MOD_POLYMOD_CODENAME)}</div>'\n},";
//remove last comma from search panel items
$searchPanel = io::substr($searchPanel, 0, -1);
$jscontent = <<<END
\tvar moduleObjectWindow = Ext.getCmp('{$winId}');
\tvar fatherWindow = Ext.getCmp('{$fatherId}');
\t
\t//define update function into window (to be accessible by parent window)
\tmoduleObjectWindow.updateTab = function() {
\t\t//reload all already loaded combos in search form
\t\tvar combos = searchPanel.findByType('atmCombo');
\t\tvar combosLen = combos.length;
示例12: array
}
//load module
$module = CMS_modulesCatalog::getByCodename($codename);
if (!$module || !$module->isPolymod()) {
CMS_grandFather::raiseError('Unknown module or module is not polymod for codename : ' . $codename);
$view->show();
}
//CHECKS user has module clearance
if (!$cms_user->hasModuleClearance($codename, CLEARANCE_MODULE_EDIT)) {
CMS_grandFather::raiseError('User has no rights on module : ' . $codename);
$view->setActionMessage($cms_language->getmessage(MESSAGE_ERROR_MODULE_RIGHTS, array($module->getLabel($cms_language))));
$view->show();
}
//load current object definition
$object = CMS_poly_object_catalog::getObjectDefinition($objectId);
$winLabel = sensitiveIO::sanitizeJSString($cms_language->getMessage(MESSAGE_MULTI_OBJECT_CHOOSE_ELEMENT, array($object->getObjectLabel($cms_language)), MOD_POLYMOD_CODENAME));
$md5 = md5(mt_rand() . microtime());
$url = PATH_ADMIN_MODULES_WR . '/polymod/item-selector.php';
$params = sensitiveIO::jsonEncode(array('winId' => 'selector-' . $md5, 'objectId' => $object->getID(), 'module' => $codename, 'multiple' => $unique ? 0 : 1));
$unique = $unique ? '1' : '0';
//this is only an single item selection, so help selection a little
$jscontent = <<<END
\tvar window = Ext.getCmp('{$winId}');
\t//set window title
\twindow.setTitle('{$winLabel}');
\t//set help button on top of page
\twindow.tools['help'].show();
\t//add a tooltip on button
\tvar propertiesTip = new Ext.ToolTip({
\t\ttarget:\t\t window.tools['help'],
\t\ttitle:\t\t\t '{$cms_language->getJsMessage(MESSAGE_TOOLBAR_HELP)}',
示例13: unset
$groupsTab = $modulesTab = $adminTab = $logsTab = '';
//Get modules and remove standard (which is already treated in this file)
$modules = CMS_modulesCatalog::getAll();
unset($modules[MOD_STANDARD_CODENAME]);
//OTHERS TABS
if ($cms_user->hasAdminClearance(CLEARANCE_ADMINISTRATION_EDITUSERS)) {
$groupsDisabled = '';
if ($user->getUserId() == ROOT_PROFILEUSER_ID) {
$groupsDisabled = "disabled:\t\t\ttrue,tabTip:'{$cms_language->getJSMessage(MESSAGE_PAGE_ADMIN_NO_GROUPS)}',";
}
//GROUPS TAB
$groupsTab = ",{\n\t\t\tid:\t\t\t\t\t'userGroups-{$userId}',\n\t\t\ttitle:\t\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_GROUPS)}',\n\t\t\txtype:\t\t\t\t'grid',\n\t\t\tstore: \t\t\t\tstore,\n\t\t\t{$groupsDisabled}\n\t\t\tborder:\t\t\t\tfalse,\n\t\t\tautoExpandColumn:\t'description',\n\t\t\tcm: \t\t\t\tnew Ext.grid.ColumnModel([\n\t\t\t\tsm,\n\t\t\t\t{header: \"ID\", \t\t\t\t\t\t\t\t\t\t\t\twidth: 30, \tdataIndex: 'id', \t\t\tsortable: true, \thidden:true},\n\t\t\t\t{header: \"{$cms_language->getMessage(MESSAGE_PAGE_LABEL)}\", \twidth: 50, \tdataIndex: 'label', \t\tsortable: true,\t\t\t\t\t\trenderer:renderGroups},\n\t\t\t\t{header: \"{$cms_language->getMessage(MESSAGE_PAGE_DESC)}\", \twidth: 170, dataIndex: 'description',\tsortable: true, \t\t\t\t\trenderer:function(value) {return '<span ext:qtip=\"'+value+'\">'+value+'</span>';}}\n\t\t\t]),\n\t\t\tsm: \t\t\t\tsm,\n\t\t\tanchor:\t\t\t\t'100%',\n\t\t\tviewConfig: \t\t{\n\t\t\t\tforceFit:\t\t\ttrue\n\t\t\t},\n\t\t\ttbar:[{\n\t\t\t\txtype: \t\t\t'textfield',\n\t\t\t\temptyText:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_SEARCH)} ...',\n\t\t\t\tid: \t\t\t'search-{$userId}',\n\t\t\t\tselectOnFocus: \ttrue,\n\t\t\t\twidth:\t\t\t300,\n\t\t\t\tlisteners: \t\t{\n\t\t\t\t\t'render': {fn:function(){\n\t\t\t\t\t\tExt.getCmp('search-{$userId}').getEl().on('keyup', filter, this, {buffer:500});\n\t\t\t\t\t}, scope:userWindow}\n\t\t\t\t}\n\t\t\t},'-',{\n\t\t\t\txtype:\t\t\t'checkbox',\n\t\t\t\tboxLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_ALL_GROUPS)}',\n\t\t\t\tlisteners:\t\t{'check': function(item, checked) {\n\t\t\t\t\tif (checked) {\n\t\t\t\t\t\tfilterUsersGroups = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfilterUsersGroups = true;\n\t\t\t\t\t}\n\t\t\t\t\tfilter();\n\t\t\t\t}}\n\t\t\t}],\n\t\t\tbbar:\t\t\t\tnew Ext.PagingToolbar({\n\t\t\t\tpageSize: \t\t\t{$recordsPerPage},\n\t\t\t\tstore: \t\t\t\tstore,\n\t\t\t\tdisplayInfo: \t\ttrue,\n\t\t\t\tdisplayMsg: \t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_GROUP_X_ON)}',\n\t\t\t\temptyMsg: \t\t\t\"{$cms_language->getJsMessage(MESSAGE_PAGE_NO_SEARCHED_GROUP)}\"\n\t\t\t})\n\t\t}";
//Modules tabs
$modulesTab = ",{\n\t\t\tid:\t\t\t\t\t'userPages-{$userId}',\n\t\t\ttitle:\t\t\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_PAGE)}',\n\t\t\tborder:\t\t\t\tfalse,\n\t\t\txtype:\t\t\t\t'atmPanel',\n\t\t\tautoScroll:\t\t\ttrue,\n\t\t\tautoLoad:\t\t{\n\t\t\t\turl:\t\t'user-modules-rights.php',\n\t\t\t\tparams:\t\t\t{\n\t\t\t\t\tfatherId:\t\tuserWindow.id,\n\t\t\t\t\twinId:\t\t\t'userPages-{$userId}',\n\t\t\t\t\tuserId:\t\t\tuserWindow.userId\n\t\t\t\t},\n\t\t\t\tnocache:\ttrue\n\t\t\t}\n\t\t}";
foreach ($modules as $codename => $module) {
$label = sensitiveIO::sanitizeJSString($module->getLabel($cms_language));
if ($label) {
$modulesTab .= ",{\n\t\t\t\tid:\t\t\t\t\t'user-{$codename}-{$userId}',\n\t\t\t\ttitle:\t\t\t\t'{$label}',\n\t\t\t\tborder:\t\t\t\tfalse,\n\t\t\t\txtype:\t\t\t\t'atmPanel',\n\t\t\t\tautoScroll:\t\t\ttrue,\n\t\t\t\tautoLoad:\t\t{\n\t\t\t\t\turl:\t\t'user-modules-rights.php',\n\t\t\t\t\tparams:\t\t\t{\n\t\t\t\t\t\tfatherId:\t\tuserWindow.id,\n\t\t\t\t\t\tmodule:\t\t\t'{$codename}',\n\t\t\t\t\t\twinId:\t\t\t'user-{$codename}-{$userId}',\n\t\t\t\t\t\tuserId:\t\t\tuserWindow.userId\n\t\t\t\t\t},\n\t\t\t\t\tnocache:\ttrue\n\t\t\t\t}\n\t\t\t}";
}
}
//ADMIN TAB
$adminTab = ",{\n\t\t\tid:\t\t\t\t'userAdmin-{$userId}',\n\t\t\ttitle:\t\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_ADMINISTRATION)}',\n\t\t\tborder:\t\t\tfalse,\n\t\t\txtype:\t\t\t'atmPanel',\n\t\t\tautoScroll:\t\ttrue,\n\t\t\tautoLoad:\t\t{\n\t\t\t\turl:\t\t'user-admin-rights.php',\n\t\t\t\tparams:\t\t\t{\n\t\t\t\t\twinId:\t\t\t'userAdmin-{$userId}',\n\t\t\t\t\tuserId:\t\t\tuserWindow.userId\n\t\t\t\t},\n\t\t\t\tnocache:\ttrue\n\t\t\t}\n\t\t}";
//LOGS TAB
$logsTab = ", {\n\t\t\tid:\t\t\t\t'userLogs-{$userId}',\n\t\t\ttitle:\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_LOG_LABEL)}',\n\t\t\tborder:\t\t\tfalse,\n\t\t\txtype:\t\t\t'atmPanel',\n\t\t\tlayout:\t\t\t'fit',\n\t\t\tautoScroll:\t\ttrue,\n\t\t\tautoLoad:\t\t{\n\t\t\t\turl:\t\t\t'user-logs.php',\n\t\t\t\tparams:\t\t\t{\n\t\t\t\t\twinId:\t\t\t'userLogs-{$userId}',\n\t\t\t\t\tuser:\t\t\t'{$userId}',\n\t\t\t\t\taction:\t\t\t'view'\n\t\t\t\t},\n\t\t\t\tnocache:\t\ttrue,\n\t\t\t\tscope:\t\t\tthis\n\t\t\t}\n }";
}
//create dynamic vars
// Local passwords (root password is allowed only for root, and disabled for anonymous user)
if ($user->getUserId() != ANONYMOUS_PROFILEUSER_ID && ($user->getUserId() != ROOT_PROFILEUSER_ID || $user->getUserId() == ROOT_PROFILEUSER_ID && $cms_user->getUserId() == ROOT_PROFILEUSER_ID)) {
$authentificationField = "{\n\t\tlayout:\t\t\t'column',\n\t\txtype:\t\t\t'panel',\n\t\tborder:\t\t\tfalse,\n\t\titems:[{\n\t\t\tcolumnWidth:\t.5,\n\t\t\tlayout: \t\t'form',\n\t\t\tborder:\t\t\tfalse,\n\t\t\titems: [{\n\t\t\t\tfieldLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_PASSWORD)}',\n\t\t\t\txtype:\t\t\t'textfield',\n\t\t\t\tname:\t\t\t'pass1',\n\t\t\t\tinputType:\t\t'password',\n\t\t\t\tanchor:\t\t\t'98%',\n\t\t\t\tallowBlank:\t\ttrue\n\t\t\t}]\n\t\t},{\n\t\t\tcolumnWidth:\t.5,\n\t\t\tlayout: \t\t'form',\n\t\t\tborder:\t\t\tfalse,\n\t\t\titems: [{\n\t\t\t\tfieldLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_CONFIRM)}',\n\t\t\t\txtype:\t\t\t'textfield',\n\t\t\t\tname:\t\t\t'pass2',\n\t\t\t\tinputType:\t\t'password',\n\t\t\t\tanchor:\t\t\t'100%',\n\t\t\t\tallowBlank:\t\ttrue,\n\t\t\t\tvalidator:\t\tvalidatePass\n\t\t\t}]\n\t\t}]\n\t},";
if (!$user->havePassword() && $user->getUserId()) {
$authentificationField .= "{\n\t\t\tbodyStyle:\t\t'padding:0 0 10px 105px',\n\t\t\txtype:\t\t\t'panel',\n\t\t\thtml:\t\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_NO_PASSWORD)}',\n\t\t\tborder:\t\t\tfalse\n\t\t},";
示例14: getHTMLAdmin
/**
* get HTML admin (used to enter object values in admin)
*
* @param integer $fieldID, the current field id (only for poly object compatibility)
* @param CMS_language $language, the current admin language
* @param string prefixname : the prefix to use for post names
* @return string : the html admin
* @access public
*/
function getHTMLAdmin($fieldID, $language, $prefixName)
{
$return = parent::getHTMLAdmin($fieldID, $language, $prefixName);
$params = $this->getParamsValues();
unset($return['items'][0]['hideLabel']);
unset($return['items'][1]['hideLabel']);
$return['items'][0]['fieldLabel'] = $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_LONGITUDE_DESCRIPTION, false, $this->_messagesModule);
$return['items'][1]['fieldLabel'] = $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_LATITUDE_DESCRIPTION, false, $this->_messagesModule);
$ids = 'coord-' . md5(mt_rand() . microtime());
$return['items'][0]['id'] = $ids . '-long';
$return['items'][1]['id'] = $ids . '-lat';
//Move the first two fields
$return['items'][2] = $return['items'][1];
$return['items'][1] = $return['items'][0];
//Add on change listeners to update image
$return['items'][1]['listeners'] = $return['items'][2]['listeners'] = array('change' => sensitiveIO::sanitizeJSString('function(el){
Ext.get(\'' . $ids . '-view\').update(\'<img style="border:1px solid #C0C7CB;" src="http://maps.google.com/maps/api/staticmap?center=\'+Ext.getCmp(\'' . $ids . '-lat\').getValue()+\',\'+Ext.getCmp(\'' . $ids . '-long\').getValue()+\'&zoom=15&size=600x200&markers=\'+Ext.getCmp(\'' . $ids . '-lat\').getValue()+\',\'+Ext.getCmp(\'' . $ids . '-long\').getValue()+\'&sensor=false" />\');
}', false, false));
//Create toolbar
$return['items'][0] = array('xtype' => 'toolbar', 'items' => array());
if ($params['useFieldsAsAddress']) {
$return['items'][0]['items'][] = array('xtype' => 'button', 'text' => $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_FIELD_UPDATE_FROM_ADDRESS, false, $this->_messagesModule), 'handler' => sensitiveIO::sanitizeJSString('function(button){
var addrFields = \'' . $params['fieldsForAddress'] . '\'.split(\';\');
var form = button.findParentByType(\'atmForm\').form;
var addr = \'\';
for(var i = 0; i < addrFields.length; i++) {
var field = form.findField(\'polymodFieldsValue[\' + addrFields[i] + \'_0]\');
var listfield = form.findField(\'polymodFieldsValue[list\' + addrFields[i] + \'_0]\');
if (field) {
addr += \' \' + Ext.util.Format.stripTags(field.getValue());
} else if (listfield) {
addr += \' \' + Ext.util.Format.stripTags(listfield.lastSelectionText);
}
}
addr = Ext.util.Format.stripLines(addr);
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address:addr}, function(results, status) {
if (status == \'OK\') {
Ext.getCmp(\'' . $ids . '-long\').setValue(results[0].geometry.location.lng());
Ext.getCmp(\'' . $ids . '-lat\').setValue(results[0].geometry.location.lat());
Ext.get(\'' . $ids . '-view\').update(\'<img style="border:1px solid #C0C7CB;" src="http://maps.google.com/maps/api/staticmap?center=\'+results[0].geometry.location.lat()+\',\'+results[0].geometry.location.lng()+\'&zoom=15&size=600x200&markers=\'+results[0].geometry.location.lat()+\',\'+results[0].geometry.location.lng()+\'&sensor=false" />\');
} else {
Automne.message.popup({
msg: String.format(\'' . $language->getJsMessage(self::MESSAGE_OBJECT_COORDINATES_FIELD_UNKOWN_ADDRESS, false, $this->_messagesModule) . '\', addr),
buttons: Ext.MessageBox.OK,
closable: false,
icon: Ext.MessageBox.ERROR
});
}
});
}', false, false), 'scope' => 'this');
}
$return['items'][0]['items'][] = '->';
$return['items'][0]['items'][] = array('xtype' => 'button', 'text' => $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_FIELD_PUT_ON_MAP, false, $this->_messagesModule), 'handler' => sensitiveIO::sanitizeJSString('function(button){
var lat = Ext.getCmp(\'' . $ids . '-lat\').getValue();
var long = Ext.getCmp(\'' . $ids . '-long\').getValue();
if (lat && long) {
var mapwin = new Automne.Window({
layout: \'fit\',
title: \'' . $language->getJSMessage(self::MESSAGE_OBJECT_COORDINATES_FIELD_MAP_WINDOW, false, $this->_messagesModule) . '\',
modal:true,
width:600,
height:600,
items: {
xtype: \'gmappanel\',
zoomLevel: 13,
gmapType: \'map\',
id: \'map-' . $ids . '\',
mapConfOpts: [\'enableScrollWheelZoom\',\'enableDoubleClickZoom\',\'enableDragging\'],
mapControls: [\'GSmallMapControl\',\'GMapTypeControl\',\'NonExistantControl\'],
setCenter: {
lat: lat,
lng: long,
marker: {draggable: true}
}
},
listeners:{\'beforeclose\':function(window){
var map = Ext.getCmp(\'map-' . $ids . '\');
if (map.gmarks && map.gmarks[0]) {
Ext.getCmp(\'' . $ids . '-long\').setValue(map.gmarks[0].getPosition().lng());
Ext.getCmp(\'' . $ids . '-lat\').setValue(map.gmarks[0].getPosition().lat());
Ext.get(\'' . $ids . '-view\').update(\'<img style="border:1px solid #C0C7CB;" src="http://maps.google.com/maps/api/staticmap?center=\'+map.gmarks[0].getPosition().lat()+\',\'+map.gmarks[0].getPosition().lng()+\'&zoom=15&size=600x200&markers=\'+map.gmarks[0].getPosition().lat()+\',\'+map.gmarks[0].getPosition().lng()+\'&sensor=false" />\');
}
}}
});
mapwin.show(button);
} else {
var gmapWindow = function(button, value) {
if (button == \'ok\') {
var mapwin = new Automne.Window({
layout: \'fit\',
//.........这里部分代码省略.........
示例15: function
$codemirrorConf = '
mode: "text/javascript",
';
$title = sensitiveIO::sanitizeJSString($fileCreation ? $cms_language->getMessage(MESSAGE_PAGE_CREATE_JS) : $cms_language->getMessage(MESSAGE_PAGE_EDIT_JS) . ' ' . $node);
break;
case 'xml':
$codemirrorConf = '
mode: "text/html",
';
$title = sensitiveIO::sanitizeJSString($cms_language->getMessage(MESSAGE_PAGE_EDIT_WYSIWYG) . ' ' . $node);
break;
default:
$codemirrorConf = '
mode: "text/html",
';
$title = sensitiveIO::sanitizeJSString($cms_language->getMessage(MESSAGE_PAGE_CREATE_FILE));
break;
}
$automnePath = PATH_MAIN_WR;
$colorcoding = '';
if ($codemirrorConf) {
$colorcoding = "{\n\t\txtype:\t\t\t'checkbox',\n\t\tboxLabel:\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_SYNTAX_COLOR)}',\n\t\thideLabel:\t\ttrue,\n\t\tlisteners:\t\t{'check':function(field, checked) {\n\t\t\tif (checked) {\n\t\t\t\tvar textarea = Ext.get('defText-{$fileId}');\n\t\t\t\tvar width = textarea.getWidth();\n\t\t\t\tvar height = textarea.getHeight();\n\t\t\t\tvar foldFunc = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);\n\t\t\t\teditor = CodeMirror.fromTextArea(document.getElementById('defText-{$fileId}'), {\n\t\t\t lineNumbers: true,\n\t\t\t matchBrackets: true,\n\t\t\t {$codemirrorConf}\n\t\t\t\t\tindentWithTabs: true,\n\t\t\t enterMode: \"keep\",\n\t\t\t tabMode: \"shift\",\n\t\t\t\t\ttabSize: 2,\n\t\t\t\t\tonGutterClick: foldFunc,\n\t\t\t\t\textraKeys: {\n\t\t\t\t\t\t\"Ctrl-Q\": function(cm){\n\t\t\t\t\t\t\tfoldFunc(cm, cm.getCursor().line);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"Ctrl-S\": function() {\n\t\t\t\t\t\t\tExt.getCmp('save-{$fileId}').handler();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t });\n\t\t\t\tExt.select('.CodeMirror-scroll').setHeight((height - 6));\n\t\t\t\tExt.select('.CodeMirror-scroll').setWidth(width);\n\t\t\t\t\n\t\t\t\tfield.disable();\n\t\t\t\tExt.getCmp('reindent-{$fileId}').show();\n\t\t\t}\n\t\t}, scope:this}\n\t},";
}
$jscontent = <<<END
\tvar fileWindow = Ext.getCmp('{$winId}');
\tfileWindow.fileId = '{$fileId}';
\t//set window title
\tfileWindow.setTitle('{$title}');
\t//set help button on top of page
\tfileWindow.tools['help'].show();
\t//add a tooltip on button