mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Merge branch 'master' into pr/async-ajax
This commit is contained in:
commit
f64a15d971
34 changed files with 356 additions and 144 deletions
|
|
@ -254,15 +254,15 @@ class ModuleObject extends BaseObject
|
|||
// Get privileges(granted) information for target module by <permission check> of module.xml
|
||||
if(($permission = $this->xml_info->action->{$this->act}->permission) && $permission->check_var)
|
||||
{
|
||||
// Check parameter
|
||||
if(empty($check_module_srl = trim(Context::get($permission->check_var))))
|
||||
// Ensure that the list of modules to check is the right type and not empty
|
||||
$check_var = Context::get($permission->check_var);
|
||||
if (is_scalar($check_var))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (empty($check_module_srl = trim($check_var)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If value is not array
|
||||
if(!is_array($check_module_srl))
|
||||
{
|
||||
// Convert string to array. delimiter is ,(comma) or |@|
|
||||
if(preg_match('/,|\|@\|/', $check_module_srl, $delimiter) && $delimiter[0])
|
||||
{
|
||||
|
|
@ -273,6 +273,14 @@ class ModuleObject extends BaseObject
|
|||
$check_module_srl = array($check_module_srl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$check_module_srl = array_map('trim', $check_var);
|
||||
if (!count($check_var))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check permission by privileges(granted) information for target module
|
||||
foreach($check_module_srl as $target_srl)
|
||||
|
|
@ -295,7 +303,15 @@ class ModuleObject extends BaseObject
|
|||
}
|
||||
|
||||
// Check permission based on the grant information for the current module.
|
||||
$grant = ModuleModel::getInstance()->getGrant($this->module_info, $this->user, $this->xml_info);
|
||||
if (isset($check_grant))
|
||||
{
|
||||
$grant = $check_grant;
|
||||
}
|
||||
else
|
||||
{
|
||||
$grant = ModuleModel::getInstance()->getGrant($this->module_info, $this->user, $this->xml_info);
|
||||
}
|
||||
|
||||
if(!$this->checkPermission($grant, $this->user, $failed_requirement))
|
||||
{
|
||||
$this->stop($this->_generatePermissionError($failed_requirement));
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class TemplateParser_v2
|
|||
}, $content);
|
||||
|
||||
// Inline scripts.
|
||||
$content = preg_replace_callback('#(?<=\s)(href="javascript:|on[a-z]+=")([^"]*?)"#i', function($match) {
|
||||
$content = preg_replace_callback('#(?<=\s)(href="javascript:|pattern="|on[a-z]+=")([^"]*?)"#i', function($match) {
|
||||
return $match[1] . '<?php $this->config->context = \'JS\'; ?>' . $match[2] . '<?php $this->config->context = \'HTML\'; ?>"';
|
||||
}, $content);
|
||||
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ Rhymix.ajaxForm = function(form, success, error) {
|
|||
* @return void
|
||||
*/
|
||||
Rhymix.checkboxToggleAll = function(name) {
|
||||
if (!window[name]) {
|
||||
if (typeof name === 'undefined') {
|
||||
name='cart';
|
||||
}
|
||||
let options = {
|
||||
|
|
@ -1027,7 +1027,7 @@ $(function() {
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (window[Rhymix.loadedPopupMenus[params.menu_id]]) {
|
||||
if (Rhymix.loadedPopupMenus[params.menu_id]) {
|
||||
return Rhymix.displayPopupMenu(params, response_tags, params);
|
||||
}
|
||||
|
||||
|
|
@ -1472,12 +1472,16 @@ function popopen(url, target) {
|
|||
* @return void
|
||||
*/
|
||||
function doAddDocumentCart(obj) {
|
||||
Rhymix.addedDocument.push(obj.value);
|
||||
if (obj && obj.value) {
|
||||
Rhymix.addedDocument.push(obj.value);
|
||||
}
|
||||
setTimeout(function() {
|
||||
exec_json('document.procDocumentAddCart', {
|
||||
srls: Rhymix.addedDocument.join(',')
|
||||
});
|
||||
Rhymix.addedDocument = [];
|
||||
if (Rhymix.addedDocument.length > 0) {
|
||||
exec_json('document.procDocumentAddCart', {
|
||||
srls: Rhymix.addedDocument
|
||||
});
|
||||
Rhymix.addedDocument = [];
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -467,13 +467,13 @@ function legacy_filter(filter_name, form, module, act, callback, responses, conf
|
|||
};
|
||||
|
||||
if (!hasFile) {
|
||||
Rhymix.ajax(module + '.' + act, params, callback_wrapper);
|
||||
exec_json(module + '.' + act, params, callback_wrapper);
|
||||
} else {
|
||||
var fd = new FormData();
|
||||
for (let key in params) {
|
||||
fd.append(key, params[key]);
|
||||
}
|
||||
Rhymix.ajax(null, fd, callback_wrapper);
|
||||
exec_json('raw', fd, callback_wrapper);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2001,6 +2001,41 @@ class CommentController extends Comment
|
|||
$this->setMessage('success_declared_cancel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the number of uploaded files in the comment
|
||||
*
|
||||
* @param int|array $comment_srl_list
|
||||
* @return void
|
||||
*/
|
||||
public function updateUploadedCount($comment_srl_list)
|
||||
{
|
||||
if (!is_array($comment_srl_list))
|
||||
{
|
||||
$comment_srl_list = array($comment_srl_list);
|
||||
}
|
||||
|
||||
if (!count($comment_srl_list))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$comment_srl_list = array_unique($comment_srl_list);
|
||||
|
||||
foreach($comment_srl_list as $comment_srl)
|
||||
{
|
||||
$comment_srl = (int)$comment_srl;
|
||||
if ($comment_srl <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$args = new stdClass;
|
||||
$args->comment_srl = $comment_srl;
|
||||
$args->uploaded_count = FileModel::getFilesCount($comment_srl);
|
||||
executeQuery('comment.updateUploadedCount', $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to add a pop-up menu when clicking for displaying child comments
|
||||
* @param string $url
|
||||
|
|
|
|||
11
modules/comment/queries/updateUploadedCount.xml
Normal file
11
modules/comment/queries/updateUploadedCount.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="updateUploadedCount" action="update">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="uploaded_count" var="uploaded_count" default="0" filter="number" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -3301,16 +3301,23 @@ class DocumentController extends Document
|
|||
}
|
||||
|
||||
// Get document_srl
|
||||
$srls = explode(',',Context::get('srls'));
|
||||
for($i = 0; $i < count($srls); $i++)
|
||||
$srls = Context::get('srls');
|
||||
if (is_array($srls))
|
||||
{
|
||||
$srl = trim($srls[$i]);
|
||||
|
||||
if(!$srl) continue;
|
||||
|
||||
$document_srls[] = $srl;
|
||||
$document_srls = array_map('intval', $srls);
|
||||
}
|
||||
else
|
||||
{
|
||||
$document_srls = array_map('intval', explode(',', $srls));
|
||||
}
|
||||
|
||||
$document_srls = array_unique(array_filter($document_srls, function($srl) {
|
||||
return $srl > 0;
|
||||
}));
|
||||
if (!count($document_srls))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!count($document_srls)) return;
|
||||
|
||||
// Get module_srl of the documents
|
||||
$args = new stdClass;
|
||||
|
|
@ -3781,7 +3788,17 @@ Content;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A typo of updateUploadedCount, maintained for backward compatibility.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function updateUploaedCount($document_srl_list)
|
||||
{
|
||||
return $this->updateUploadedCount($document_srl_list);
|
||||
}
|
||||
|
||||
public function updateUploadedCount($document_srl_list)
|
||||
{
|
||||
if(!is_array($document_srl_list))
|
||||
{
|
||||
|
|
@ -3797,7 +3814,8 @@ Content;
|
|||
|
||||
foreach($document_srl_list as $document_srl)
|
||||
{
|
||||
if(!$document_srl = (int) $document_srl)
|
||||
$document_srl = (int)$document_srl;
|
||||
if ($document_srl <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -3817,7 +3835,7 @@ Content;
|
|||
return;
|
||||
}
|
||||
|
||||
$this->updateUploaedCount($file->upload_target_srl);
|
||||
$this->updateUploadedCount($file->upload_target_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<div class="x_control-group" data-invisible-types="file">
|
||||
<label class="x_control-label" for="default">{$lang->default_value}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="default" id="default" value="{$selected_var->getDefaultValue()}" />
|
||||
<input type="text" name="default" id="default" value="{$selected_var ? $selected_var->getDefaultValue() : ''}" />
|
||||
<p class="x_help-block">{$lang->about_extra_vars_default_value}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
(function($) {
|
||||
$(function() {
|
||||
$('button.evFileRemover').on('click', function() {
|
||||
const container = $(this).parents('.ev_file_upload');
|
||||
$(function() {
|
||||
$('.ev_file_upload').each(function() {
|
||||
const container = $(this);
|
||||
container.find('button.evFileRemover').on('click', function() {
|
||||
container.find('span.filename').text('');
|
||||
container.find('span.filesize').text('');
|
||||
container.find('input[type=hidden][name^=_delete_]').val('Y');
|
||||
container.find('input[type=file]').val('');
|
||||
$(this).remove();
|
||||
});
|
||||
$('input.rx_ev_file').on('change', function() {
|
||||
const container = $(this).parents('.ev_file_upload');
|
||||
container.find('input.rx_ev_file').on('change', function() {
|
||||
const max_size = parseInt($(this).data('allowedFilesize'), 10);
|
||||
const file_count = this.files.length;
|
||||
for (let i = 0; i < file_count; i++) {
|
||||
|
|
@ -23,4 +23,4 @@
|
|||
container.find('input[type=hidden][name^=_delete_]').val('N');
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
});
|
||||
|
|
|
|||
7
modules/extravar/skins/default/assets/number.js
Normal file
7
modules/extravar/skins/default/assets/number.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
$(function() {
|
||||
$('input.rx_ev_number').on('input', function() {
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
});
|
||||
});
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password"
|
||||
style="{{ $definition->style }}"|if="$definition->style"
|
||||
value="{{ strval($value) !== '' ? $value : strval($default) }}"
|
||||
autocomplete="off" autocapitalize="none"
|
||||
@required(toBool($definition->is_required))
|
||||
@disabled(toBool($definition->is_disabled))
|
||||
@readonly(toBool($definition->is_readonly))
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
@readonly(toBool($definition->is_readonly))
|
||||
/>
|
||||
@elseif ($type === 'number')
|
||||
<input type="number" name="{{ $input_name }}"
|
||||
@load('../assets/number.js')
|
||||
<input type="text" inputmode="numeric" name="{{ $input_name }}"
|
||||
id="{{ $input_id }}"|if="$input_id" class="number rx_ev_number"
|
||||
style="{{ $definition->style }}"|if="$definition->style"
|
||||
value="{{ strval($value) !== '' ? $value : strval($default) }}"
|
||||
|
|
|
|||
|
|
@ -2002,6 +2002,8 @@ class FileController extends File
|
|||
}
|
||||
|
||||
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
|
||||
$this->setFilesValid($obj->copied->document_srl, 'doc');
|
||||
DocumentController::getInstance()->updateUploadedCount($obj->copied->document_srl);
|
||||
}
|
||||
|
||||
function triggerAddCopyCommentByDocument(&$obj)
|
||||
|
|
@ -2012,6 +2014,8 @@ class FileController extends File
|
|||
}
|
||||
|
||||
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
|
||||
$this->setFilesValid($obj->copied->comment_srl, 'com');
|
||||
CommentController::getInstance()->updateUploadedCount($obj->copied->comment_srl);
|
||||
}
|
||||
|
||||
function triggerCopyModule(&$obj)
|
||||
|
|
|
|||
|
|
@ -878,21 +878,27 @@ class MemberAdminController extends Member
|
|||
$args->column_type = Context::get('column_type');
|
||||
$args->column_name = strtolower(Context::get('column_id'));
|
||||
$args->column_title = Context::get('column_title');
|
||||
$args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value')));
|
||||
$args->required = Context::get('required');
|
||||
$args->is_active = (isset($args->required));
|
||||
if(!in_array(strtoupper($args->required), array('Y','N')))$args->required = 'N';
|
||||
$args->description = Context::get('description') ? Context::get('description') : '';
|
||||
// Default values
|
||||
if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value))
|
||||
$args->default_value = trim(utf8_clean(Context::get('default_value')));
|
||||
$args->options = trim(utf8_clean(Context::get('options')));
|
||||
if ($args->options !== '')
|
||||
{
|
||||
$args->default_value = serialize($args->default_value);
|
||||
$args->options = array_map('trim', explode("\n", $args->options));
|
||||
$args->options = json_encode($args->options, \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->default_value = '';
|
||||
$args->options = null;
|
||||
}
|
||||
|
||||
$args->required = Context::get('required');
|
||||
if (!in_array(strtoupper($args->required), array('Y','N')))
|
||||
{
|
||||
$args->required = 'N';
|
||||
}
|
||||
|
||||
$args->is_active = (isset($args->required));
|
||||
$args->description = Context::get('description') ? Context::get('description') : '';
|
||||
|
||||
// Check ID duplicated
|
||||
if (Context::isReservedWord($args->column_name))
|
||||
{
|
||||
|
|
@ -909,7 +915,7 @@ class MemberAdminController extends Member
|
|||
}
|
||||
}
|
||||
// Fix if member_join_form_srl exists. Add if not exists.
|
||||
$isInsert;
|
||||
$isInsert = false;
|
||||
if(!$args->member_join_form_srl)
|
||||
{
|
||||
$isInsert = true;
|
||||
|
|
|
|||
|
|
@ -288,13 +288,24 @@ class MemberAdminModel extends Member
|
|||
if($output->toBool() && $output->data)
|
||||
{
|
||||
$formInfo = $output->data;
|
||||
$default_value = $formInfo->default_value;
|
||||
if($default_value)
|
||||
$default_value = '';
|
||||
$options = '';
|
||||
if (isset($formInfo->options) && $formInfo->options !== '')
|
||||
{
|
||||
$default_value = unserialize($default_value);
|
||||
Context::set('default_value', $default_value);
|
||||
$default_value = $formInfo->default_value;
|
||||
$options = json_decode($formInfo->options, true);
|
||||
}
|
||||
elseif (preg_match('/^a:\d+:\{i:/', $formInfo->default_value))
|
||||
{
|
||||
$options = unserialize($formInfo->default_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$default_value = $formInfo->default_value;
|
||||
}
|
||||
Context::set('formInfo', $output->data);
|
||||
Context::set('default_value', $default_value);
|
||||
Context::set('options', $options);
|
||||
}
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
|
|
@ -314,7 +325,7 @@ class MemberAdminModel extends Member
|
|||
$oTemplate = TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
|
||||
|
||||
$this->add('tpl', str_replace("\n"," ",$tpl));
|
||||
$this->add('tpl', $tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ class MemberAdminView extends Member
|
|||
{
|
||||
$extend_form_list = MemberModel::getCombineJoinForm($memberInfo);
|
||||
$security = new Security($extend_form_list);
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||
|
||||
if ($memberInfo)
|
||||
{
|
||||
|
|
@ -725,6 +725,7 @@ class MemberAdminView extends Member
|
|||
$input->input_id = $extendForm->column_name;
|
||||
$input->value = $extendForm->value ?? '';
|
||||
$input->default = $extendForm->default_value ?? null;
|
||||
$input->options = $extendForm->options ?? null;
|
||||
if ($extendForm->column_type === 'tel' || $extendForm->column_type === 'tel_intl')
|
||||
{
|
||||
$input->style = 'width:33.3px';
|
||||
|
|
|
|||
|
|
@ -167,6 +167,9 @@ class Member extends ModuleObject
|
|||
if(!$oDB->isIndexExists('member_auth_mail', 'idx_member_srl')) return true;
|
||||
if($oDB->isIndexExists('member_auth_mail', 'unique_key')) return true;
|
||||
|
||||
// Check join form options column
|
||||
if(!$oDB->isColumnExists('member_join_form', 'options')) return true;
|
||||
|
||||
// Update status column
|
||||
$output = executeQuery('member.getDeniedAndStatus');
|
||||
if ($output->data->count)
|
||||
|
|
@ -403,6 +406,12 @@ class Member extends ModuleObject
|
|||
$oDB->dropIndex('member_auth_mail', 'unique_key');
|
||||
}
|
||||
|
||||
// Check join form options column
|
||||
if(!$oDB->isColumnExists('member_join_form', 'options'))
|
||||
{
|
||||
$oDB->addColumn('member_join_form', 'options', 'text', null, null, null, 'default_value');
|
||||
}
|
||||
|
||||
// Update status column
|
||||
$output = executeQuery('member.getDeniedAndStatus');
|
||||
if ($output->data->count)
|
||||
|
|
|
|||
|
|
@ -2871,7 +2871,7 @@ class MemberController extends Member
|
|||
|
||||
$extend_form_list = MemberModel::getJoinFormlist();
|
||||
$security = new Security($extend_form_list);
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||
if($config->signupForm)
|
||||
{
|
||||
foreach($config->signupForm as $no => $formInfo)
|
||||
|
|
@ -3167,7 +3167,7 @@ class MemberController extends Member
|
|||
|
||||
$extend_form_list = MemberModel::getJoinFormlist();
|
||||
$security = new Security($extend_form_list);
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
||||
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||
if($config->signupForm)
|
||||
{
|
||||
foreach($config->signupForm as $no => $formInfo)
|
||||
|
|
|
|||
|
|
@ -806,31 +806,38 @@ class MemberModel extends Member
|
|||
if(!$join_form_list) return NULL;
|
||||
// Need to unserialize because serialized array is inserted into DB in case of default_value
|
||||
if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
|
||||
$join_form_count = count($join_form_list);
|
||||
for($i=0;$i<$join_form_count;$i++)
|
||||
foreach ($join_form_list as $i => $join_form)
|
||||
{
|
||||
$join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name);
|
||||
$join_form->column_name = strtolower($join_form->column_name);
|
||||
|
||||
$member_join_form_srl = $join_form_list[$i]->member_join_form_srl;
|
||||
$column_type = $join_form_list[$i]->column_type;
|
||||
$column_name = $join_form_list[$i]->column_name;
|
||||
$column_title = $join_form_list[$i]->column_title;
|
||||
$default_value = $join_form_list[$i]->default_value;
|
||||
// Add language variable
|
||||
if(!isset($lang->extend_vars)) $lang->extend_vars = array();
|
||||
$lang->extend_vars[$column_name] = $column_title;
|
||||
// unserialize if the data type if checkbox, select and so on
|
||||
if(in_array($column_type, array('checkbox','select','radio')))
|
||||
$column_name = $join_form->column_name;
|
||||
$column_title = $join_form->column_title;
|
||||
if (!isset($lang->extend_vars))
|
||||
{
|
||||
$join_form_list[$i]->default_value = unserialize($default_value);
|
||||
if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
|
||||
$lang->extend_vars = array();
|
||||
}
|
||||
$lang->extend_vars[$column_name] = $column_title;
|
||||
|
||||
// unserialize if the data type if checkbox, select and so on
|
||||
if (in_array($join_form->column_type, ['checkbox','select','radio']))
|
||||
{
|
||||
if (isset($join_form->options) && $join_form->options !== '')
|
||||
{
|
||||
$join_form->options = json_decode($join_form->options, true);
|
||||
}
|
||||
elseif (preg_match('/^a:\d+:\{i:/', $join_form->default_value))
|
||||
{
|
||||
$join_form->options = unserialize($join_form->default_value);
|
||||
$join_form->default_value = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$join_form_list[$i]->default_value = '';
|
||||
$join_form->default_value = '';
|
||||
}
|
||||
|
||||
$list[$member_join_form_srl] = $join_form_list[$i];
|
||||
$list[$join_form->member_join_form_srl] = $join_form;
|
||||
}
|
||||
self::$_join_form_list = $list;
|
||||
}
|
||||
|
|
@ -958,12 +965,17 @@ class MemberModel extends Member
|
|||
$join_form = $output->data;
|
||||
if(!$join_form) return NULL;
|
||||
|
||||
$column_type = $join_form->column_type;
|
||||
$default_value = $join_form->default_value;
|
||||
|
||||
if(in_array($column_type, array('checkbox','select','radio')))
|
||||
if (in_array($join_form->column_type, ['checkbox','select','radio']))
|
||||
{
|
||||
$join_form->default_value = unserialize($default_value);
|
||||
if (isset($join_form->options) && $join_form->options !== '')
|
||||
{
|
||||
$join_form->options = json_decode($join_form->options, true);
|
||||
}
|
||||
elseif (preg_match('/^a:\d+:\{i:/', $join_form->default_value))
|
||||
{
|
||||
$join_form->options = unserialize($join_form->default_value);
|
||||
$join_form->default_value = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ class MemberView extends Member
|
|||
$extvalue->input_id = $formInfo->name;
|
||||
$extvalue->value = $extendFormInfo[$formInfo->member_join_form_srl]->value ?? null;
|
||||
$extvalue->default = $extendFormInfo[$formInfo->member_join_form_srl]->default_value ?? null;
|
||||
$extvalue->options = $extendFormInfo[$formInfo->member_join_form_srl]->options ?? null;
|
||||
$item->value = $extvalue->getValueHTML();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<column name="column_title" var="column_title" />
|
||||
<column name="required" var="required" default="N" />
|
||||
<column name="default_value" var="default_value" />
|
||||
<column name="options" var="options" />
|
||||
<column name="is_active" var="is_active" default="N" />
|
||||
<column name="description" var="description" />
|
||||
<column name="regdate" default="curdate()" />
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<column name="column_title" var="column_title" />
|
||||
<column name="required" var="required" default="N" />
|
||||
<column name="default_value" var="default_value" />
|
||||
<column name="options" var="options" />
|
||||
<column name="is_active" var="is_active" default="N" />
|
||||
<column name="description" var="description" />
|
||||
</columns>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<column name="column_title" type="varchar" size="60" notnull="notnull" />
|
||||
<column name="required" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="default_value" type="text" />
|
||||
<column name="options" type="text" />
|
||||
<column name="is_active" type="char" size="1" default="Y" />
|
||||
<column name="description" type="text" />
|
||||
<column name="list_order" type="number" size="11" notnull="notnull" default="1" index="idx_list_order" />
|
||||
|
|
|
|||
|
|
@ -26,11 +26,17 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group multiExample">
|
||||
<label for="multiSelect" class="x_control-label"><em style="color:red">*</em> {$lang->options}</label>
|
||||
<div class="x_control-group">
|
||||
<label for="default_value" class="x_control-label"> {$lang->default_value}</label>
|
||||
<div class="x_controls">
|
||||
<textarea rows="4" cols="42" id="multiSelect" name="default_value" style="vertical-align:top"><block cond="$default_value">{implode('|@|', $default_value)}</block></textarea>
|
||||
<p class="x_help-inline">{$lang->about_multi_type}</p>
|
||||
<input type="text" id="default_value" name="default_value" value="{$default_value}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group multiExample">
|
||||
<label for="multiSelect" class="x_control-label"> {$lang->options}</label>
|
||||
<div class="x_controls">
|
||||
<textarea rows="4" cols="42" id="multiSelect" name="options" style="vertical-align:top"><block cond="$options">{implode("\n", $options)}</block></textarea>
|
||||
<p class="x_help-block">{$lang->about_multi_type}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
|
|
@ -51,7 +57,6 @@
|
|||
<span class="x_pull-right"><button class="x_btn x_btn-primary" type="submit" name="mode" <!--@if($formInfo)-->value="update"<!--@else-->value="insert"<!--@end--> >{$lang->cmd_save}</button></span>
|
||||
</div>
|
||||
<script>
|
||||
var $ = jQuery;
|
||||
var typeSelect = $('.typeSelect');
|
||||
var multiOption = $('.typeSelect>option[value=checkbox], .typeSelect>option[value=radio], .typeSelect>option[value=select_multiple], .typeSelect>option[value=select]');
|
||||
var multiExample = $('.multiExample');
|
||||
|
|
|
|||
|
|
@ -2003,7 +2003,7 @@ class MenuAdminController extends Menu
|
|||
// If the value of node->group_srls exists
|
||||
if($node->group_srls) {
|
||||
$group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
|
||||
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged&&%s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
|
||||
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged&&%s)||(!$is_logged&&%s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0, $node->group_srls == '-4' ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2099,7 +2099,7 @@ class MenuAdminController extends Menu
|
|||
if($node->group_srls)
|
||||
{
|
||||
$group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
|
||||
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged && %s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
|
||||
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged && %s)||(!$is_logged && %s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0, $node->group_srls == '-4' ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -216,6 +216,10 @@ class MenuAdminModel extends Menu
|
|||
{
|
||||
$menuItem->grant = 'manager';
|
||||
}
|
||||
else if($menuItem->group_srls[0] == -4)
|
||||
{
|
||||
$menuItem->grant = 'not_member';
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuItem->grant = 'group';
|
||||
|
|
|
|||
|
|
@ -103,7 +103,11 @@ class Permission
|
|||
// Check if each permission is granted to the current user.
|
||||
foreach ($this->_spec as $key => $requirement)
|
||||
{
|
||||
if ($requirement === 'guest')
|
||||
if ($key === 'manager' && $this->manager)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
elseif ($requirement === 'guest')
|
||||
{
|
||||
$this->{$key} = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{@$suggestion_id = 0}
|
||||
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||
<block loop="$widget_info->extra_var => $id, $var">
|
||||
{@$suggestion_id++}
|
||||
{@ $suggestion_id++; }
|
||||
<block cond="!$not_first && !$var->group"><section class="extra_vars section"></block>
|
||||
<block cond="$group != $var->group">
|
||||
<block cond="$not_first"></section></block>
|
||||
<section class="extra_vars section">
|
||||
<h1>{$var->group}</h1>
|
||||
{@$group = $var->group}
|
||||
{@ $group = $var->group; }
|
||||
</block>
|
||||
|
||||
{@$not_first = true}
|
||||
|
|
@ -53,21 +53,21 @@
|
|||
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
|
||||
<div class="x_controls">
|
||||
<block cond="$var->type == 'text'">
|
||||
<input type="text" name="{$id}" />
|
||||
<input type="text" name="{$id}" value="{$var->default}" />
|
||||
</block>
|
||||
<block cond="$var->type == 'color'">
|
||||
<input type="text" name="{$id}" value="" id="{$id}" class="rx-spectrum" style="width:178px" />
|
||||
</block>
|
||||
<block cond="$var->type == 'textarea'">
|
||||
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42"></textarea>
|
||||
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42">{$var->default}</textarea>
|
||||
</block>
|
||||
<block cond="$var->type == 'select'">
|
||||
<select name="{$id}" id="{$id}">
|
||||
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" value="{$key}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
|
||||
</select>
|
||||
</block>
|
||||
<block cond="$var->type == 'select-multi-order'">
|
||||
<!--@if($var->init_options && is_array($var->init_options))-->
|
||||
<!--@if(isset($var->init_options) && is_array($var->init_options))-->
|
||||
{@$inits = array_keys($var->init_options)}
|
||||
<input type="hidden" name="{$id}" value="{implode(',', $inits)}" />
|
||||
<!--@else-->
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<div style="display:inline-block;padding-top:3px">
|
||||
<label>{$lang->display_no}</label>
|
||||
<select class="multiorder_show" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
||||
<option loop="$var->options => $key, $val" cond="!$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" cond="empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
|
||||
</select>
|
||||
<br>
|
||||
<button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button>
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
<div style="display:inline-block;padding-top:3px">
|
||||
<label>{$lang->display_yes}</label>
|
||||
<select class="multiorder_selected" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
||||
<option loop="$var->options => $key, $val" cond="$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
|
||||
<option loop="$var->options => $key, $val" cond="!empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
|
||||
</select>
|
||||
<br>
|
||||
<button type="button" class="x_btn multiorder_up" style="margin:0 -5px 0 0;border-radius:2px 0 0 2px">{$lang->cmd_move_up}</button>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
<div id="content" class="x_modal-body">
|
||||
<p>{$widget_info->description} {$lang->about_widget_code_in_page}</p>
|
||||
<form cond="$type=='faceoff'" class="x_form-horizontal">
|
||||
<form cond="isset($type) && $type === 'faceoff'" class="x_form-horizontal">
|
||||
<input type="hidden" name="module" value="widget" />
|
||||
<input type="hidden" name="type" value="faceoff" />
|
||||
<input type="hidden" name="act" value="dispWidgetGenerateCodeInPage" />
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
</div>
|
||||
<div class="x_modal-body x_form-horizontal">
|
||||
<a href="{getUrl('widgetstyle','none')}" class="widgetStyle"><img src="images/widgetstyle_none.gif" title="{$lang->notuse}" /></a>
|
||||
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle==$widgetstyle)-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
|
||||
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle == ($widgetstyle ?? ''))-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
|
||||
<block cond="$widgetstyle_info">
|
||||
|
||||
|
||||
<h2>{$widgetstyle_info->title} ver {$widgetstyle_info->version}</h2>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->description}</label>
|
||||
|
|
@ -52,45 +52,46 @@
|
|||
{zdate($widgetstyle_info->date,'Y-m-d')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||
<block loop="$widgetstyle_info->extra_var => $id, $var">
|
||||
{@$suggestion_id++}
|
||||
{@ $suggestion_id++; }
|
||||
<block cond="!$not_first && !$var->group"><section class="section"></block>
|
||||
<block cond="$group != $var->group">
|
||||
<block cond="$not_first"></section></block>
|
||||
<h1>{$var->group}</h1>
|
||||
<section class="section">
|
||||
{@$group = $var->group}
|
||||
{@ $group = $var->group; }
|
||||
</block>
|
||||
{@$not_first = true}
|
||||
{@ $not_first = true; }
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="{$id}"|cond="$var->type!='text'&&$var->type!='textarea'" for="lang_{$id}"|cond="$var->type=='text'||$var->type=='textarea'">{$var->name}</label>
|
||||
<div class="x_controls extra_vars">
|
||||
<div cond="$var->type == 'text'">
|
||||
<input type="text" name="{$id}" value="" class="lang_code" />
|
||||
<input type="text" name="{$id}" value="{$var->default}" class="lang_code" />
|
||||
</div>
|
||||
|
||||
<input cond="$var->type == 'color'" type="text" name="{$id}" class="rx-spectrum" />
|
||||
|
||||
|
||||
<input cond="$var->type == 'color'" type="text" name="{$id}" value="{$var->default}" class="rx-spectrum" />
|
||||
|
||||
<div cond="$var->type == 'textarea'">
|
||||
<textarea name="{$id}" rows="8" cols="42" class="lang_code"></textarea>
|
||||
<textarea name="{$id}" rows="8" cols="42" class="lang_code">{$var->default}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<select cond="$var->type == 'select'" name="{$id}">
|
||||
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
|
||||
<option loop="$var->options ?? [] => $key, $val" value="{$key}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
|
||||
</select>
|
||||
|
||||
|
||||
<block cond="$var->type == 'filebox'">
|
||||
<input type="hidden" name="{$id}" />
|
||||
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
|
||||
{@$use_filebox = TRUE}
|
||||
</block>
|
||||
|
||||
<label loop="$var->options => $key, $val" cond="$var->type == 'radio'">
|
||||
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'radio'">
|
||||
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||
</label>
|
||||
|
||||
<label loop="$var->options => $key, $val" cond="$var->type == 'checkbox'">
|
||||
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'checkbox'">
|
||||
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||
</label>
|
||||
<span class="x_help-block">{$var->description}</span>
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ class WidgetController extends Widget
|
|||
}
|
||||
|
||||
$args->widget_sequence = $args->widget_sequence ?? 0;
|
||||
$args->colorset = $args->colorset ?? null;
|
||||
$args->colorset = $args->colorset ?? '';
|
||||
|
||||
foreach ($lang_list as $lang_type => $val)
|
||||
{
|
||||
|
|
@ -430,6 +430,14 @@ class WidgetController extends Widget
|
|||
return;
|
||||
}
|
||||
|
||||
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
|
||||
{
|
||||
if (!isset($args->{$key}))
|
||||
{
|
||||
$args->{$key} = $val->default;
|
||||
}
|
||||
}
|
||||
|
||||
$widget_content = $oWidget->proc($args);
|
||||
return Context::replaceUserLang($widget_content);
|
||||
}
|
||||
|
|
@ -453,6 +461,14 @@ class WidgetController extends Widget
|
|||
return;
|
||||
}
|
||||
|
||||
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
|
||||
{
|
||||
if (!isset($args->{$key}))
|
||||
{
|
||||
$args->{$key} = $val->default;
|
||||
}
|
||||
}
|
||||
|
||||
$oFrontEndFileHandler = FrontEndFileHandler::getInstance();
|
||||
$oFrontEndFileHandler->startLog();
|
||||
|
||||
|
|
@ -498,7 +514,7 @@ class WidgetController extends Widget
|
|||
// Set default
|
||||
$args->widget_sequence = $args->widget_sequence ?? 0;
|
||||
$args->widget_cache = $args->widget_cache ?? 0;
|
||||
$args->colorset = $args->colorset ?? null;
|
||||
$args->colorset = $args->colorset ?? '';
|
||||
|
||||
/**
|
||||
* Widgets widgetContent/widgetBox Wanted If you are not content
|
||||
|
|
@ -600,25 +616,30 @@ class WidgetController extends Widget
|
|||
{
|
||||
foreach($args as $key => $val)
|
||||
{
|
||||
$val = (string)$val;
|
||||
if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
|
||||
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
|
||||
$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
|
||||
}
|
||||
}
|
||||
|
||||
$oWidgetController = getController('widget');
|
||||
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="rhymix_content xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
|
||||
$widget_content_header = vsprintf(
|
||||
'<div class="rhymix_content xe_content widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">'.
|
||||
'<div style="%s">',$args->widgetstyle,
|
||||
'<div style="%s">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
|
||||
$args->widget_padding_left,
|
||||
$args->widget_padding_right,
|
||||
$args->widget_padding_top,
|
||||
$args->widget_padding_bottom,
|
||||
$args->document_srl,
|
||||
implode(' ',$attribute),
|
||||
$inner_style);
|
||||
implode(' ', $attribute),
|
||||
$inner_style,
|
||||
]);
|
||||
|
||||
$widget_content_body = $body;
|
||||
$widget_content_footer = sprintf('</div>'.
|
||||
|
|
@ -642,11 +663,21 @@ class WidgetController extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
$widget_content_header = sprintf(
|
||||
'<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
|
||||
$widget_content_header = vsprintf(
|
||||
'<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
|
||||
'<div class="widgetBoxResize"></div>'.
|
||||
'<div class="widgetBoxResizeLeft"></div>'.
|
||||
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style);
|
||||
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$widget_padding_top,
|
||||
$widget_padding_right,
|
||||
$widget_padding_bottom,
|
||||
$widget_padding_left,
|
||||
implode(' ', $attribute),
|
||||
$inner_style,
|
||||
]);
|
||||
|
||||
$widget_content_body = $widgetbox_content;
|
||||
|
||||
|
|
@ -667,12 +698,20 @@ class WidgetController extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
$widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
$widget_content_header = vsprintf('<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
|
||||
'<div class="widgetResize"></div>'.
|
||||
'<div class="widgetResizeLeft"></div>'.
|
||||
'<div class="widgetBorder">',$args->widgetstyle,$style,
|
||||
$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
|
||||
$widget, implode(' ',$attribute));
|
||||
'<div class="widgetBorder">',
|
||||
[
|
||||
$args->widgetstyle ?? '',
|
||||
$style,
|
||||
$widget_padding_top,
|
||||
$widget_padding_right,
|
||||
$widget_padding_bottom,
|
||||
$widget_padding_left,
|
||||
$widget,
|
||||
implode(' ', $attribute),
|
||||
]);
|
||||
|
||||
$widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content);
|
||||
|
||||
|
|
@ -831,25 +870,20 @@ class WidgetController extends Widget
|
|||
$vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
|
||||
$vars->document_srl= trim($request_vars->document_srl);
|
||||
|
||||
if(countobj($widget_info->extra_var))
|
||||
foreach ($widget_info->extra_var ?? [] as $key => $val)
|
||||
{
|
||||
foreach($widget_info->extra_var as $key=>$val)
|
||||
{
|
||||
$vars->{$key} = trim($request_vars->{$key} ?? '');
|
||||
}
|
||||
$vars->{$key} = trim($request_vars->{$key} ?? '');
|
||||
}
|
||||
// If the widget style
|
||||
|
||||
// Additional configuration for widget styles
|
||||
if($request_vars->widgetstyle)
|
||||
{
|
||||
$widgetStyle_info = WidgetModel::getWidgetStyleInfo($request_vars->widgetstyle);
|
||||
if(countobj($widgetStyle_info->extra_var))
|
||||
foreach ($widgetStyle_info->extra_var ?? [] as $key => $val)
|
||||
{
|
||||
foreach($widgetStyle_info->extra_var as $key=>$val)
|
||||
if (in_array($val->type, ['color', 'text', 'select', 'filebox', 'textarea']))
|
||||
{
|
||||
if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea')
|
||||
{
|
||||
$vars->{$key} = trim($request_vars->{$key} ?? '');
|
||||
}
|
||||
$vars->{$key} = trim($request_vars->{$key} ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,12 +128,19 @@ class WidgetModel extends Widget
|
|||
return;
|
||||
}
|
||||
|
||||
// Check the cache.
|
||||
// Check the local cache.
|
||||
$xml_mtime = filemtime($xml_file);
|
||||
if (isset($GLOBALS['__widget_info__'][$widget][$xml_mtime]))
|
||||
{
|
||||
return $GLOBALS['__widget_info__'][$widget][$xml_mtime];
|
||||
}
|
||||
|
||||
// Check the system cache.
|
||||
$cache_key = sprintf('widget_info:%s:%d', $widget, $xml_mtime);
|
||||
$widget_info = Rhymix\Framework\Cache::get($cache_key);
|
||||
if ($widget_info)
|
||||
{
|
||||
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
|
||||
return $widget_info;
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +152,7 @@ class WidgetModel extends Widget
|
|||
}
|
||||
|
||||
Rhymix\Framework\Cache::set($cache_key, $widget_info);
|
||||
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
|
||||
return $widget_info;
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +163,7 @@ class WidgetModel extends Widget
|
|||
public static function getWidgetStyleInfo($widgetStyle)
|
||||
{
|
||||
// Check the widget style path.
|
||||
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', $widgetStyle);
|
||||
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', (string)$widgetStyle);
|
||||
$widgetStyle_path = self::getWidgetStylePath($widgetStyle);
|
||||
if (!$widgetStyle_path)
|
||||
{
|
||||
|
|
@ -169,12 +177,19 @@ class WidgetModel extends Widget
|
|||
return;
|
||||
}
|
||||
|
||||
// Check the cache.
|
||||
// Check the local cache.
|
||||
$xml_mtime = filemtime($xml_file);
|
||||
if (isset($GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime]))
|
||||
{
|
||||
return $GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime];
|
||||
}
|
||||
|
||||
// Check the system cache.
|
||||
$cache_key = sprintf('widgetstyle_info:%s:%d', $widgetStyle, $xml_mtime);
|
||||
$widgetStyle_info = Rhymix\Framework\Cache::get($cache_key);
|
||||
if ($widgetStyle_info)
|
||||
{
|
||||
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
|
||||
return $widgetStyle_info;
|
||||
}
|
||||
|
||||
|
|
@ -186,6 +201,7 @@ class WidgetModel extends Widget
|
|||
}
|
||||
|
||||
Rhymix\Framework\Cache::set($cache_key, $widgetStyle_info);
|
||||
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
|
||||
return $widgetStyle_info;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,6 +265,14 @@ class TemplateParserV2Test extends \Codeception\Test\Unit
|
|||
$target = '<div class="foo" onClick="<?php $this->config->context = \'JS\'; ?>bar.barr()<?php $this->config->context = \'HTML\'; ?>">Hello</div>';
|
||||
$this->assertEquals($target, $this->_parse($source, true, false));
|
||||
|
||||
// pattern attribute in <input> tag
|
||||
$source = '<input type="text" pattern="[a-z0-9]{4,8}" value="Hello" />';
|
||||
$target = '<input type="text" pattern="<?php $this->config->context = \'JS\'; ?>[a-z0-9]{4,8}<?php $this->config->context = \'HTML\'; ?>" value="Hello" />';
|
||||
$this->assertEquals($target, $this->_parse($source, true, false));
|
||||
$source = '<input type="text" pattern="[{{ $chars }}]{4,8}" value="Hello" />';
|
||||
$target = '<input type="text" pattern="<?php $this->config->context = \'JS\'; ?>[<?php echo $this->config->context === \'HTML\' ? htmlspecialchars($__Context->chars ?? \'\', \ENT_QUOTES, \'UTF-8\', false) : $this->_v2_escape($__Context->chars ?? \'\'); ?>]{4,8}<?php $this->config->context = \'HTML\'; ?>" value="Hello" />';
|
||||
$this->assertEquals($target, $this->_parse($source, true, false));
|
||||
|
||||
// <style> tag
|
||||
$source = '<style> body { font-size: 16px; } </style>';
|
||||
$target = '<style<?php $this->config->context = \'CSS\'; ?>> body { font-size: 16px; } <?php $this->config->context = \'HTML\'; ?></style>';
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@
|
|||
<name xml:lang="tr">UL (list)</name>
|
||||
</options>
|
||||
</var>
|
||||
<var id="list_count" type="text">
|
||||
<var id="list_count" type="text" default="5">
|
||||
<name xml:lang="ko">목록수</name>
|
||||
<name xml:lang="zh-CN">目录数</name>
|
||||
<name xml:lang="jp">リスト数</name>
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
<description xml:lang="zh-TW">設置要顯示的目錄數。(預設是5個)</description>
|
||||
<description xml:lang="tr">Görüntülenecek yazıların sayısını ayarlayabilirsiniz. (varsayılan değer 5'tir)</description>
|
||||
</var>
|
||||
<var id="cols_list_count" type="text">
|
||||
<var id="cols_list_count" type="text" default="5">
|
||||
<name xml:lang="ko">가로 이미지 수</name>
|
||||
<name xml:lang="jp">横並びイメージ数</name>
|
||||
<name xml:lang="zh-CN">横向图片数</name>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue