mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Merge branch 'rhymix:master' into master
This commit is contained in:
commit
b894362419
48 changed files with 664 additions and 379 deletions
|
|
@ -757,13 +757,20 @@ class HTMLDisplayHandler
|
||||||
'plugins/cookie/js.cookie.min.js',
|
'plugins/cookie/js.cookie.min.js',
|
||||||
'plugins/blankshield/blankshield.min.js',
|
'plugins/blankshield/blankshield.min.js',
|
||||||
'plugins/uri/URI.min.js',
|
'plugins/uri/URI.min.js',
|
||||||
'x.js',
|
|
||||||
'common.js',
|
|
||||||
'js_app.js',
|
|
||||||
'xml_handler.js',
|
|
||||||
'xml_js_filter.js',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (str_contains($_SERVER['HTTP_USER_AGENT'] ?? '', 'Trident/'))
|
||||||
|
{
|
||||||
|
$original_file_list[] = 'polyfills/formdata.min.js';
|
||||||
|
$original_file_list[] = 'polyfills/promise.min.js';
|
||||||
|
}
|
||||||
|
|
||||||
|
$original_file_list[] = 'x.js';
|
||||||
|
$original_file_list[] = 'common.js';
|
||||||
|
$original_file_list[] = 'js_app.js';
|
||||||
|
$original_file_list[] = 'xml_handler.js';
|
||||||
|
$original_file_list[] = 'xml_js_filter.js';
|
||||||
|
|
||||||
if(config('view.minify_scripts') === 'none')
|
if(config('view.minify_scripts') === 'none')
|
||||||
{
|
{
|
||||||
Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.js', 'head', '', -1800000000), true);
|
Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.js', 'head', '', -1800000000), true);
|
||||||
|
|
|
||||||
|
|
@ -430,6 +430,10 @@ class FrontEndFileHandler extends Handler
|
||||||
public function unloadFile($fileName, $unused = '', $media = 'all')
|
public function unloadFile($fileName, $unused = '', $media = 'all')
|
||||||
{
|
{
|
||||||
$file = $this->getFileInfo($fileName, $unused, $media);
|
$file = $this->getFileInfo($fileName, $unused, $media);
|
||||||
|
if (!isset($file->key))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($file->fileExtension == 'css')
|
if($file->fileExtension == 'css')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -254,15 +254,15 @@ class ModuleObject extends BaseObject
|
||||||
// Get privileges(granted) information for target module by <permission check> of module.xml
|
// 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)
|
if(($permission = $this->xml_info->action->{$this->act}->permission) && $permission->check_var)
|
||||||
{
|
{
|
||||||
// Check parameter
|
// Ensure that the list of modules to check is the right type and not empty
|
||||||
if(empty($check_module_srl = trim(Context::get($permission->check_var))))
|
$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 |@|
|
// Convert string to array. delimiter is ,(comma) or |@|
|
||||||
if(preg_match('/,|\|@\|/', $check_module_srl, $delimiter) && $delimiter[0])
|
if(preg_match('/,|\|@\|/', $check_module_srl, $delimiter) && $delimiter[0])
|
||||||
{
|
{
|
||||||
|
|
@ -273,6 +273,14 @@ class ModuleObject extends BaseObject
|
||||||
$check_module_srl = array($check_module_srl);
|
$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
|
// Check permission by privileges(granted) information for target module
|
||||||
foreach($check_module_srl as $target_srl)
|
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.
|
// 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))
|
if(!$this->checkPermission($grant, $this->user, $failed_requirement))
|
||||||
{
|
{
|
||||||
$this->stop($this->_generatePermissionError($failed_requirement));
|
$this->stop($this->_generatePermissionError($failed_requirement));
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* RX_VERSION is the version number of the Rhymix CMS.
|
* RX_VERSION is the version number of the Rhymix CMS.
|
||||||
*/
|
*/
|
||||||
define('RX_VERSION', '2.1.23');
|
define('RX_VERSION', '2.1.25');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch.
|
* RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch.
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ class TemplateParser_v2
|
||||||
}, $content);
|
}, $content);
|
||||||
|
|
||||||
// Inline scripts.
|
// 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\'; ?>"';
|
return $match[1] . '<?php $this->config->context = \'JS\'; ?>' . $match[2] . '<?php $this->config->context = \'HTML\'; ?>"';
|
||||||
}, $content);
|
}, $content);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -262,14 +262,37 @@ Rhymix.isSameHost = function(url) {
|
||||||
* Redirect to a URL, but reload instead if the target is the same as the current page
|
* Redirect to a URL, but reload instead if the target is the same as the current page
|
||||||
*
|
*
|
||||||
* @param string url
|
* @param string url
|
||||||
|
* @param int delay
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
Rhymix.redirectToUrl = function(url) {
|
Rhymix.redirectToUrl = function(url, delay) {
|
||||||
if (this.isCurrentUrl(url)) {
|
const callback = function() {
|
||||||
window.location.href = url;
|
if (Rhymix.isCurrentUrl(url)) {
|
||||||
window.location.reload();
|
window.location.href = url;
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (delay) {
|
||||||
|
this.pendingRedirect = setTimeout(callback, delay);
|
||||||
} else {
|
} else {
|
||||||
window.location.href = url;
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel any pending redirect
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
Rhymix.cancelPendingRedirect = function() {
|
||||||
|
if (this.pendingRedirect) {
|
||||||
|
clearTimeout(this.pendingRedirect);
|
||||||
|
this.pendingRedirect = null;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -398,16 +421,26 @@ Rhymix.modal.close = function(id) {
|
||||||
*
|
*
|
||||||
* @param string action
|
* @param string action
|
||||||
* @param object params
|
* @param object params
|
||||||
* @param function success
|
* @param function callback_success
|
||||||
* @param function error
|
* @param function callback_error
|
||||||
* @return void
|
* @return Promise
|
||||||
*/
|
*/
|
||||||
Rhymix.ajax = function(action, params, success, error) {
|
Rhymix.ajax = function(action, params, callback_success, callback_error) {
|
||||||
|
|
||||||
// Extract module and act
|
// Extract module and act
|
||||||
let isFormData = params instanceof FormData;
|
let isFormData = params instanceof FormData;
|
||||||
let module, act;
|
let module, act, url, promise;
|
||||||
if (!action) {
|
if (action) {
|
||||||
|
if (typeof action === 'string' && action.match(/^[a-z0-9_]+\.[a-z0-9_]+$/i)) {
|
||||||
|
let parts = action.split('.');
|
||||||
|
params = params || {};
|
||||||
|
params.module = module = parts[0];
|
||||||
|
params.act = act = parts[1];
|
||||||
|
} else {
|
||||||
|
url = action;
|
||||||
|
action = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (isFormData) {
|
if (isFormData) {
|
||||||
module = params.get('module');
|
module = params.get('module');
|
||||||
act = params.get('act');
|
act = params.get('act');
|
||||||
|
|
@ -421,26 +454,22 @@ Rhymix.ajax = function(action, params, success, error) {
|
||||||
} else {
|
} else {
|
||||||
action = null;
|
action = null;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
action = action.split('.');
|
|
||||||
params = params || {};
|
|
||||||
params.module = module = action[0];
|
|
||||||
params.act = act = action[1];
|
|
||||||
action = action.join('.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add action to URL if the current rewrite level supports it
|
// Add action to URL if the current rewrite level supports it
|
||||||
let url = this.URI(window.request_uri).pathname() + 'index.php';
|
if (!url) {
|
||||||
if (act) {
|
url = this.URI(window.request_uri).pathname() + 'index.php';
|
||||||
url = url + '?act=' + act;
|
if (act) {
|
||||||
|
url = url + '?act=' + act;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (this.getRewriteLevel() >= 2 && action !== null) {
|
||||||
|
url = url + '_' + action.replace('.', '/');
|
||||||
|
} else {
|
||||||
|
url = url + 'index.php';
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (this.getRewriteLevel() >= 2 && action !== null) {
|
|
||||||
url = url + action.replace('.', '/');
|
|
||||||
} else {
|
|
||||||
url = url + 'index.php';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Add a CSRF token to the header, and remove it from the parameters
|
// Add a CSRF token to the header, and remove it from the parameters
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|
@ -453,175 +482,137 @@ Rhymix.ajax = function(action, params, success, error) {
|
||||||
delete params._rx_csrf_token;
|
delete params._rx_csrf_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate AJAX parameters
|
// Create and return a Promise for this AJAX request
|
||||||
const args = {
|
return promise = new Promise(function(resolve, reject) {
|
||||||
type: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
url: url,
|
|
||||||
data: isFormData ? params : JSON.stringify(params),
|
|
||||||
contentType: isFormData ? false : 'application/json; charset=UTF-8',
|
|
||||||
processData: false,
|
|
||||||
headers: headers,
|
|
||||||
success: function(data, textStatus, xhr) {
|
|
||||||
Rhymix._ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error);
|
|
||||||
},
|
|
||||||
error: function(xhr, textStatus, errorThrown) {
|
|
||||||
Rhymix._ajaxErrorHandler(xhr, textStatus, action, url, params, success, error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Send the AJAX request
|
// Define the success wrapper.
|
||||||
try {
|
const successWrapper = function(data, textStatus, xhr) {
|
||||||
$.ajax(args);
|
|
||||||
} catch(e) {
|
|
||||||
alert(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// Add debug information.
|
||||||
* Default success handler for AJAX requests
|
if (data._rx_debug) {
|
||||||
*
|
data._rx_debug.page_title = "AJAX : " + action;
|
||||||
* @param object xhr
|
if (Rhymix.addDebugData) {
|
||||||
* @param string textStatus
|
Rhymix.addDebugData(data._rx_debug);
|
||||||
* @param string action
|
} else {
|
||||||
* @param object data
|
Rhymix.pendingDebugData.push(data._rx_debug);
|
||||||
* @param object params
|
}
|
||||||
* @param function success
|
|
||||||
* @param function errror
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
Rhymix._ajaxSuccessHandler = function(xhr, textStatus, action, data, params, success, error) {
|
|
||||||
|
|
||||||
// Add debug information.
|
|
||||||
if (data._rx_debug) {
|
|
||||||
data._rx_debug.page_title = "AJAX : " + action;
|
|
||||||
if (this.addDebugData) {
|
|
||||||
this.addDebugData(data._rx_debug);
|
|
||||||
} else {
|
|
||||||
this.pendingDebugData.push(data._rx_debug);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the response contains a Rhymix error code, display the error message.
|
|
||||||
if (typeof data.error !== 'undefined' && data.error != 0) {
|
|
||||||
|
|
||||||
// If an error callback is defined, call it. Abort if it returns false.
|
|
||||||
if ($.isFunction(error) && error(data, xhr) === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If an error message was supplied, display it.
|
|
||||||
if (data.message) {
|
|
||||||
let msg = data.message.replace(/\\n/g, "\n");
|
|
||||||
if (data.errorDetail) {
|
|
||||||
msg += "\n\n" + data.errorDetail;
|
|
||||||
}
|
}
|
||||||
alert(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rhymix should never return an error code without a message, but if someone does, we handle it here.
|
// If the response contains a Rhymix error code, display the error message.
|
||||||
let msg = 'AJAX error: ' + (action || 'form submission') + "\n\n" + xhr.responseText;
|
if (typeof data.error !== 'undefined' && data.error != 0) {
|
||||||
if (msg.length > 1000) {
|
return errorWrapper(data, textStatus, xhr);
|
||||||
msg = msg.substring(0, 1000) + '...';
|
}
|
||||||
}
|
|
||||||
console.error(msg.trim().replace(/\n+/g, "\n"));
|
|
||||||
if (this.showAjaxErrors.indexOf('ALL') >= 0 || this.showAjaxErrors.indexOf(xhr.status) >= 0) {
|
|
||||||
alert(msg.trim());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a success callback was defined, call it.
|
// If a success callback was defined, call it.
|
||||||
if ($.isFunction(success)) {
|
if (typeof callback_success === 'function') {
|
||||||
success(data, xhr);
|
callback_success(data, xhr);
|
||||||
return;
|
resolve(data);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the response contains a redirect URL, follow the redirect.
|
// If the response contains a redirect URL, follow the redirect.
|
||||||
if (data.redirect_url) {
|
// This can be canceled by Rhymix.cancelPendingRedirect() within 100 milliseconds.
|
||||||
this.redirectToUrl(data.redirect_url.replace(/&/g, '&'));
|
if (data.redirect_url) {
|
||||||
return;
|
Rhymix.redirectToUrl(data.redirect_url.replace(/&/g, '&'), 100);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// Resolve the promise with the response data.
|
||||||
* Default error handler for AJAX requests
|
resolve(data);
|
||||||
*
|
};
|
||||||
* @param object xhr
|
|
||||||
* @param string textStatus
|
|
||||||
* @param string action
|
|
||||||
* @param string url
|
|
||||||
* @param object params
|
|
||||||
* @param function success
|
|
||||||
* @param function errror
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
Rhymix._ajaxErrorHandler = function(xhr, textStatus, action, url, params, success, error) {
|
|
||||||
|
|
||||||
// If the user is navigating away, don't do anything.
|
// Define the error wrapper.
|
||||||
if (xhr.status == 0 && this.unloading) {
|
const errorWrapper = function(data, textStatus, xhr) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the response contains valid JSON, call the success callback instead.
|
// If an error callback is defined, call it.
|
||||||
if (xhr.status >= 400 && xhr.responseText) {
|
// The promise will still be rejected, but silently.
|
||||||
let data;
|
if (typeof callback_error === 'function') {
|
||||||
try {
|
callback_error(data, xhr);
|
||||||
data = JSON.parse(xhr.responseText);
|
promise.catch(function(dummy) { });
|
||||||
} catch (e) { }
|
let dummy = new Error('Rhymix.ajax() error already handled by callback function');
|
||||||
if (data && typeof data.error !== 'undefined') {
|
dummy._rx_ajax_error = true;
|
||||||
this._ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error);
|
dummy.cause = data;
|
||||||
return;
|
dummy.details = '';
|
||||||
}
|
dummy.xhr = xhr;
|
||||||
}
|
reject(dummy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If an error callback is defined, call it. Abort if it returns false.
|
// Otherwise, generate a generic error message.
|
||||||
if ($.isFunction(error)) {
|
let error_message = 'AJAX error: ' + (action || 'form submission');
|
||||||
let fakedata = { error: -3, message: textStatus };
|
let error_details = '';
|
||||||
if (error(fakedata, xhr) === false) {
|
if (data.error != 0 && data.message) {
|
||||||
return;
|
error_message = data.message.replace(/\\n/g, "\n");
|
||||||
}
|
if (data.errorDetail) {
|
||||||
}
|
error_details = data.errorDetail;
|
||||||
|
}
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
error_details = 'Connection failed: ' + url + "\n\n" + (xhr.responseText || '');
|
||||||
|
} else {
|
||||||
|
error_details = (xhr.responseText || '');
|
||||||
|
}
|
||||||
|
if (error_details.length > 1000) {
|
||||||
|
error_details = error_details.substring(0, 1000) + '...';
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, generate a simple error message.
|
// Reject the promise with an error object.
|
||||||
let error_info, msg;
|
// If uncaught, this will be handled by the 'unhandledrejection' event listener.
|
||||||
if (xhr.status == 0) {
|
const err = new Error(error_message);
|
||||||
error_info = 'Connection failed: ' + url + "\n\n" + (xhr.responseText || '');
|
err._rx_ajax_error = true;
|
||||||
} else {
|
err.cause = data;
|
||||||
error_info = 'Response code: ' + xhr.status + "\n\n" + (xhr.responseText || '');
|
err.details = error_details;
|
||||||
}
|
err.xhr = xhr;
|
||||||
msg = 'AJAX error: ' + (action || 'form submission') + "\n\n" + error_info;
|
reject(err);
|
||||||
if (msg.length > 1000) {
|
};
|
||||||
msg = msg.substring(0, 1000) + '...';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the error message.
|
// Pass off to jQuery with another wrapper around the success and error wrappers.
|
||||||
console.error(msg.trim().replace(/\n+/g, "\n"));
|
// This allows us to handle HTTP 400+ error codes with valid JSON responses.
|
||||||
if (this.showAjaxErrors.indexOf('ALL') >= 0 || this.showAjaxErrors.indexOf(xhr.status) >= 0) {
|
$.ajax({
|
||||||
alert(msg.trim());
|
type: 'POST',
|
||||||
}
|
dataType: 'json',
|
||||||
|
url: url,
|
||||||
|
data: isFormData ? params : JSON.stringify(params),
|
||||||
|
contentType: isFormData ? false : 'application/json; charset=UTF-8',
|
||||||
|
processData: false,
|
||||||
|
headers: headers,
|
||||||
|
success: successWrapper,
|
||||||
|
error: function(xhr, textStatus, errorThrown) {
|
||||||
|
if (xhr.status == 0 && Rhymix.unloading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xhr.status >= 400 && xhr.responseText) {
|
||||||
|
try {
|
||||||
|
let data = JSON.parse(xhr.responseText);
|
||||||
|
if (data) {
|
||||||
|
successWrapper(data, textStatus, xhr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
}
|
||||||
|
errorWrapper({ error: 0, message: textStatus }, textStatus, xhr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit a form using AJAX instead of navigating away
|
* Submit a form using AJAX instead of navigating away
|
||||||
*
|
*
|
||||||
* @param HTMLElement form
|
* @param HTMLElement form
|
||||||
* @param function success
|
* @param function callback_success
|
||||||
* @param function error
|
* @param function callback_error
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
Rhymix.ajaxForm = function(form, success, error) {
|
Rhymix.ajaxForm = function(form, callback_success, callback_error) {
|
||||||
const $form = $(form);
|
const $form = $(form);
|
||||||
// Get success and error callback functions.
|
// Get success and error callback functions.
|
||||||
if (typeof success === 'undefined') {
|
if (typeof callback_success === 'undefined') {
|
||||||
success = $form.data('callbackSuccess');
|
callback_success = $form.data('callbackSuccess');
|
||||||
if (success && $.isFunction(success)) {
|
if (callback_success && typeof callback_success === 'function') {
|
||||||
// no-op
|
// no-op
|
||||||
} else if (success && window[success] && $.isFunction(window[success])) {
|
} else if (callback_success && window[callback_success] && typeof window[callback_success] === 'function') {
|
||||||
success = window[success];
|
callback_success = window[callback_success];
|
||||||
} else {
|
} else {
|
||||||
success = function(data) {
|
callback_success = function(data) {
|
||||||
if (data.message && data.message !== 'success') {
|
if (data.message && data.message !== 'success') {
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
}
|
}
|
||||||
|
|
@ -631,17 +622,17 @@ Rhymix.ajaxForm = function(form, success, error) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof error === 'undefined') {
|
if (typeof callback_error === 'undefined') {
|
||||||
error = $form.data('callbackError');
|
callback_error = $form.data('callbackError');
|
||||||
if (error && $.isFunction(error)) {
|
if (callback_error && typeof callback_error === 'function') {
|
||||||
// no-op
|
// no-op
|
||||||
} else if (error && window[error] && $.isFunction(window[error])) {
|
} else if (callback_error && window[callback_error] && typeof window[callback_error] === 'function') {
|
||||||
error = window[error];
|
callback_error = window[callback_error];
|
||||||
} else {
|
} else {
|
||||||
error = null;
|
callback_error = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.ajax(null, new FormData($form[0]), success, error);
|
this.ajax(null, new FormData($form[0]), callback_success, callback_error);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -653,7 +644,7 @@ Rhymix.ajaxForm = function(form, success, error) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
Rhymix.checkboxToggleAll = function(name) {
|
Rhymix.checkboxToggleAll = function(name) {
|
||||||
if (!window[name]) {
|
if (typeof name === 'undefined') {
|
||||||
name='cart';
|
name='cart';
|
||||||
}
|
}
|
||||||
let options = {
|
let options = {
|
||||||
|
|
@ -1012,7 +1003,7 @@ $(function() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
if (window[Rhymix.loadedPopupMenus[params.menu_id]]) {
|
if (Rhymix.loadedPopupMenus[params.menu_id]) {
|
||||||
return Rhymix.displayPopupMenu(params, response_tags, params);
|
return Rhymix.displayPopupMenu(params, response_tags, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1101,6 +1092,20 @@ window.addEventListener('beforeunload', function() {
|
||||||
Rhymix.unloading = true;
|
Rhymix.unloading = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// General handler for unhandled Promise rejections
|
||||||
|
window.addEventListener('unhandledrejection', function(event) {
|
||||||
|
if (event.reason && typeof event.reason['_rx_ajax_error'] === 'boolean') {
|
||||||
|
event.preventDefault();
|
||||||
|
const error_message = event.reason.message.trim();
|
||||||
|
const error_details = event.reason.details || '';
|
||||||
|
const error_xhr = event.reason.xhr || {};
|
||||||
|
console.error(error_message.replace(/\n+/g, "\n" + error_details));
|
||||||
|
if (Rhymix.showAjaxErrors.indexOf('ALL') >= 0 || Rhymix.showAjaxErrors.indexOf(error_xhr.status) >= 0) {
|
||||||
|
alert(error_message.trim() + (error_details ? ("\n\n" + error_details) : ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// General handler for popstate events
|
// General handler for popstate events
|
||||||
window.addEventListener('popstate', function(event) {
|
window.addEventListener('popstate', function(event) {
|
||||||
// Close modal if it is open
|
// Close modal if it is open
|
||||||
|
|
@ -1122,6 +1127,15 @@ window.addEventListener('popstate', function(event) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fix for browsers that don't support the unhandledrejection event
|
||||||
|
if (typeof Promise._unhandledRejectionFn !== 'undefined') {
|
||||||
|
Promise._unhandledRejectionFn = function(error) {
|
||||||
|
if (error['_rx_ajax_error']) {
|
||||||
|
alert(error.message.trim());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* =================
|
* =================
|
||||||
* jQuery extensions
|
* jQuery extensions
|
||||||
|
|
@ -1457,12 +1471,16 @@ function popopen(url, target) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function doAddDocumentCart(obj) {
|
function doAddDocumentCart(obj) {
|
||||||
Rhymix.addedDocument.push(obj.value);
|
if (obj && obj.value) {
|
||||||
|
Rhymix.addedDocument.push(obj.value);
|
||||||
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
exec_json('document.procDocumentAddCart', {
|
if (Rhymix.addedDocument.length > 0) {
|
||||||
srls: Rhymix.addedDocument.join(',')
|
exec_json('document.procDocumentAddCart', {
|
||||||
});
|
srls: Rhymix.addedDocument
|
||||||
Rhymix.addedDocument = [];
|
});
|
||||||
|
Rhymix.addedDocument = [];
|
||||||
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
21
common/js/polyfills/formdata.min.js
vendored
Normal file
21
common/js/polyfills/formdata.min.js
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */
|
||||||
|
;(function(){var h;function l(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var m="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
|
||||||
|
function n(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var q=n(this);function r(a,b){if(b)a:{var c=q;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&m(c,a,{configurable:!0,writable:!0,value:b})}}
|
||||||
|
r("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.A=f;m(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;c.prototype.toString=function(){return this.A};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b});
|
||||||
|
r("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=q[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&m(d.prototype,a,{configurable:!0,writable:!0,value:function(){return u(l(this))}})}return a});function u(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
|
||||||
|
function v(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:l(a)}}var w;if("function"==typeof Object.setPrototypeOf)w=Object.setPrototypeOf;else{var y;a:{var z={a:!0},A={};try{A.__proto__=z;y=A.a;break a}catch(a){}y=!1}w=y?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var B=w;function C(){this.m=!1;this.j=null;this.v=void 0;this.h=1;this.u=this.C=0;this.l=null}
|
||||||
|
function D(a){if(a.m)throw new TypeError("Generator is already running");a.m=!0}C.prototype.o=function(a){this.v=a};C.prototype.s=function(a){this.l={D:a,F:!0};this.h=this.C||this.u};C.prototype.return=function(a){this.l={return:a};this.h=this.u};function E(a,b){a.h=3;return{value:b}}function F(a){this.g=new C;this.G=a}F.prototype.o=function(a){D(this.g);if(this.g.j)return G(this,this.g.j.next,a,this.g.o);this.g.o(a);return H(this)};
|
||||||
|
function I(a,b){D(a.g);var c=a.g.j;if(c)return G(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.g.return);a.g.return(b);return H(a)}F.prototype.s=function(a){D(this.g);if(this.g.j)return G(this,this.g.j["throw"],a,this.g.o);this.g.s(a);return H(this)};
|
||||||
|
function G(a,b,c,d){try{var e=b.call(a.g.j,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.g.m=!1,e;var f=e.value}catch(g){return a.g.j=null,a.g.s(g),H(a)}a.g.j=null;d.call(a.g,f);return H(a)}function H(a){for(;a.g.h;)try{var b=a.G(a.g);if(b)return a.g.m=!1,{value:b.value,done:!1}}catch(c){a.g.v=void 0,a.g.s(c)}a.g.m=!1;if(a.g.l){b=a.g.l;a.g.l=null;if(b.F)throw b.D;return{value:b.return,done:!0}}return{value:void 0,done:!0}}
|
||||||
|
function J(a){this.next=function(b){return a.o(b)};this.throw=function(b){return a.s(b)};this.return=function(b){return I(a,b)};this[Symbol.iterator]=function(){return this}}function K(a,b){b=new J(new F(b));B&&a.prototype&&B(b,a.prototype);return b}function L(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}
|
||||||
|
r("Array.prototype.entries",function(a){return a?a:function(){return L(this,function(b,c){return[b,c]})}});
|
||||||
|
if("undefined"!==typeof Blob&&("undefined"===typeof FormData||!FormData.prototype.keys)){var M=function(a,b){for(var c=0;c<a.length;c++)b(a[c])},N=function(a){return a.replace(/\r?\n|\r/g,"\r\n")},O=function(a,b,c){if(b instanceof Blob){c=void 0!==c?String(c+""):"string"===typeof b.name?b.name:"blob";if(b.name!==c||"[object Blob]"===Object.prototype.toString.call(b))b=new File([b],c);return[String(a),b]}return[String(a),String(b)]},P=function(a,b){if(a.length<b)throw new TypeError(b+" argument required, but only "+
|
||||||
|
a.length+" present.");},Q="object"===typeof globalThis?globalThis:"object"===typeof window?window:"object"===typeof self?self:this,R=Q.FormData,S=Q.XMLHttpRequest&&Q.XMLHttpRequest.prototype.send,T=Q.Request&&Q.fetch,U=Q.navigator&&Q.navigator.sendBeacon,V=Q.Element&&Q.Element.prototype,W=Q.Symbol&&Symbol.toStringTag;W&&(Blob.prototype[W]||(Blob.prototype[W]="Blob"),"File"in Q&&!File.prototype[W]&&(File.prototype[W]="File"));try{new File([],"")}catch(a){Q.File=function(b,c,d){b=new Blob(b,d||{});
|
||||||
|
Object.defineProperties(b,{name:{value:c},lastModified:{value:+(d&&void 0!==d.lastModified?new Date(d.lastModified):new Date)},toString:{value:function(){return"[object File]"}}});W&&Object.defineProperty(b,W,{value:"File"});return b}}var escape=function(a){return a.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},X=function(a){this.i=[];var b=this;a&&M(a.elements,function(c){if(c.name&&!c.disabled&&"submit"!==c.type&&"button"!==c.type&&!c.matches("form fieldset[disabled] *"))if("file"===
|
||||||
|
c.type){var d=c.files&&c.files.length?c.files:[new File([],"",{type:"application/octet-stream"})];M(d,function(e){b.append(c.name,e)})}else"select-multiple"===c.type||"select-one"===c.type?M(c.options,function(e){!e.disabled&&e.selected&&b.append(c.name,e.value)}):"checkbox"===c.type||"radio"===c.type?c.checked&&b.append(c.name,c.value):(d="textarea"===c.type?N(c.value):c.value,b.append(c.name,d))})};h=X.prototype;h.append=function(a,b,c){P(arguments,2);this.i.push(O(a,b,c))};h.delete=function(a){P(arguments,
|
||||||
|
1);var b=[];a=String(a);M(this.i,function(c){c[0]!==a&&b.push(c)});this.i=b};h.entries=function b(){var c,d=this;return K(b,function(e){1==e.h&&(c=0);if(3!=e.h)return c<d.i.length?e=E(e,d.i[c]):(e.h=0,e=void 0),e;c++;e.h=2})};h.forEach=function(b,c){P(arguments,1);for(var d=v(this),e=d.next();!e.done;e=d.next()){var f=v(e.value);e=f.next().value;f=f.next().value;b.call(c,f,e,this)}};h.get=function(b){P(arguments,1);var c=this.i;b=String(b);for(var d=0;d<c.length;d++)if(c[d][0]===b)return c[d][1];
|
||||||
|
return null};h.getAll=function(b){P(arguments,1);var c=[];b=String(b);M(this.i,function(d){d[0]===b&&c.push(d[1])});return c};h.has=function(b){P(arguments,1);b=String(b);for(var c=0;c<this.i.length;c++)if(this.i[c][0]===b)return!0;return!1};h.keys=function c(){var d=this,e,f,g,k,p;return K(c,function(t){1==t.h&&(e=v(d),f=e.next());if(3!=t.h){if(f.done){t.h=0;return}g=f.value;k=v(g);p=k.next().value;return E(t,p)}f=e.next();t.h=2})};h.set=function(c,d,e){P(arguments,2);c=String(c);var f=[],g=O(c,
|
||||||
|
d,e),k=!0;M(this.i,function(p){p[0]===c?k&&(k=!f.push(g)):f.push(p)});k&&f.push(g);this.i=f};h.values=function d(){var e=this,f,g,k,p,t;return K(d,function(x){1==x.h&&(f=v(e),g=f.next());if(3!=x.h){if(g.done){x.h=0;return}k=g.value;p=v(k);p.next();t=p.next().value;return E(x,t)}g=f.next();x.h=2})};X.prototype._asNative=function(){for(var d=new R,e=v(this),f=e.next();!f.done;f=e.next()){var g=v(f.value);f=g.next().value;g=g.next().value;d.append(f,g)}return d};X.prototype._blob=function(){var d="----formdata-polyfill-"+
|
||||||
|
Math.random(),e=[],f="--"+d+'\r\nContent-Disposition: form-data; name="';this.forEach(function(g,k){return"string"==typeof g?e.push(f+escape(N(k))+('"\r\n\r\n'+N(g)+"\r\n")):e.push(f+escape(N(k))+('"; filename="'+escape(g.name)+'"\r\nContent-Type: '+(g.type||"application/octet-stream")+"\r\n\r\n"),g,"\r\n")});e.push("--"+d+"--");return new Blob(e,{type:"multipart/form-data; boundary="+d})};X.prototype[Symbol.iterator]=function(){return this.entries()};X.prototype.toString=function(){return"[object FormData]"};
|
||||||
|
V&&!V.matches&&(V.matches=V.matchesSelector||V.mozMatchesSelector||V.msMatchesSelector||V.oMatchesSelector||V.webkitMatchesSelector||function(d){d=(this.document||this.ownerDocument).querySelectorAll(d);for(var e=d.length;0<=--e&&d.item(e)!==this;);return-1<e});W&&(X.prototype[W]="FormData");if(S){var Y=Q.XMLHttpRequest.prototype.setRequestHeader;Q.XMLHttpRequest.prototype.setRequestHeader=function(d,e){Y.call(this,d,e);"content-type"===d.toLowerCase()&&(this.B=!0)};Q.XMLHttpRequest.prototype.send=
|
||||||
|
function(d){d instanceof X?(d=d._blob(),this.B||this.setRequestHeader("Content-Type",d.type),S.call(this,d)):S.call(this,d)}}T&&(Q.fetch=function(d,e){e&&e.body&&e.body instanceof X&&(e.body=e.body._blob());return T.call(this,d,e)});U&&(Q.navigator.sendBeacon=function(d,e){e instanceof X&&(e=e._asNative());return U.call(this,d,e)});Q.FormData=X};})();
|
||||||
1
common/js/polyfills/promise.min.js
vendored
Normal file
1
common/js/polyfills/promise.min.js
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function t(e){return new this(function(t,n){function r(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var f=n.then;if("function"==typeof f)return void f.call(n,function(t){r(e,t)},function(n){o[e]={status:"rejected",reason:n},0==--i&&t(o)})}o[e]={status:"fulfilled",value:n},0==--i&&t(o)}if(!e||"undefined"==typeof e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var o=Array.prototype.slice.call(e);if(0===o.length)return t([]);for(var i=o.length,f=0;o.length>f;f++)r(f,o[f])})}function n(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}function r(e){var t=this;return new t(function(r,o){if(!e||"undefined"==typeof e.length)return o(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return o();for(var f=[],u=0;i.length>u;u++)try{t.resolve(i[u]).then(r)["catch"](function(e){f.push(e),f.length===i.length&&o(new n(f,"All promises were rejected"))})}catch(c){o(c)}})}function o(e){return!(!e||"undefined"==typeof e.length)}function i(){}function f(e){if(!(this instanceof f))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],s(e,this)}function u(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,f._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(o){return void a(t.promise,o)}c(t.promise,r)}else(1===e._state?c:a)(t.promise,e._value)})):e._deferreds.push(t)}function c(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof f)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void s(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,l(e)}catch(r){a(e,r)}}function a(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&f._immediateFn(function(){e._handled||f._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;n>t;t++)u(e,e._deferreds[t]);e._deferreds=null}function s(e,t){var n=!1;try{e(function(e){n||(n=!0,c(t,e))},function(e){n||(n=!0,a(t,e))})}catch(r){if(n)return;n=!0,a(t,r)}}n.prototype=Error.prototype;var d=setTimeout;f.prototype["catch"]=function(e){return this.then(null,e)},f.prototype.then=function(e,t){var n=new this.constructor(i);return u(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},f.prototype["finally"]=e,f.all=function(e){return new f(function(t,n){function r(e,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var u=o.then;if("function"==typeof u)return void u.call(o,function(t){r(e,t)},n)}i[e]=o,0==--f&&t(i)}catch(c){n(c)}}if(!o(e))return n(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},f.any=r,f.allSettled=t,f.resolve=function(e){return e&&"object"==typeof e&&e.constructor===f?e:new f(function(t){t(e)})},f.reject=function(e){return new f(function(t,n){n(e)})},f.race=function(e){return new f(function(t,n){if(!o(e))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=e.length;i>r;r++)f.resolve(e[r]).then(t,n)})},f._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){d(e,0)},f._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var p=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"function"!=typeof p.Promise?p.Promise=f:(p.Promise.prototype["finally"]||(p.Promise.prototype["finally"]=e),p.Promise.allSettled||(p.Promise.allSettled=t),p.Promise.any||(p.Promise.any=r))});
|
||||||
|
|
@ -467,13 +467,13 @@ function legacy_filter(filter_name, form, module, act, callback, responses, conf
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!hasFile) {
|
if (!hasFile) {
|
||||||
Rhymix.ajax(module + '.' + act, params, callback_wrapper);
|
exec_json(module + '.' + act, params, callback_wrapper);
|
||||||
} else {
|
} else {
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
for (let key in params) {
|
for (let key in params) {
|
||||||
fd.append(key, params[key]);
|
fd.append(key, params[key]);
|
||||||
}
|
}
|
||||||
Rhymix.ajax(null, fd, callback_wrapper);
|
exec_json('raw', fd, callback_wrapper);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
const iframe_sequence = '{{ $iframe_sequence }}';
|
const iframe_sequence = '{{ $iframe_sequence }}';
|
||||||
window.opener = window.parent;
|
window.opener = window.parent;
|
||||||
window.close = function() {
|
window.close = function() {
|
||||||
parent.closeModal('_rx_iframe_' + iframe_sequence);
|
setTimeout(function() {
|
||||||
|
parent.closeModal('_rx_iframe_' + iframe_sequence);
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<config autoescape="on" />
|
<config autoescape="on" />
|
||||||
|
|
||||||
<include target="./_admin_common.html" />
|
<include target="./_admin_common.html" />
|
||||||
{@ Context::addMetaTag("viewport", "width=device-width, user-scalable=yes")}
|
|
||||||
<script>
|
<script>
|
||||||
var admin_menu_srl = "{$admin_menu_srl}";
|
var admin_menu_srl = "{$admin_menu_srl}";
|
||||||
xe.lang.cmd_find = "{$lang->cmd_find}";
|
xe.lang.cmd_find = "{$lang->cmd_find}";
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@
|
||||||
<title xml:lang="zh-TW">發表評論</title>
|
<title xml:lang="zh-TW">發表評論</title>
|
||||||
<title xml:lang="es">yorum yaz</title>
|
<title xml:lang="es">yorum yaz</title>
|
||||||
</grant>
|
</grant>
|
||||||
<grant name="vote_log_view" default="guest">
|
<grant name="vote_log_view" default="member">
|
||||||
<title xml:lang="ko">추천인 보기</title>
|
<title xml:lang="ko">추천인 보기</title>
|
||||||
<title xml:lang="en">view recommender</title>
|
<title xml:lang="en">view recommender</title>
|
||||||
</grant>
|
</grant>
|
||||||
<grant name="update_view" default="guest">
|
<grant name="update_view" default="member">
|
||||||
<title xml:lang="ko">수정 내역 보기</title>
|
<title xml:lang="ko">수정 내역 보기</title>
|
||||||
<title xml:lang="en">view update history</title>
|
<title xml:lang="en">view update history</title>
|
||||||
</grant>
|
</grant>
|
||||||
|
|
|
||||||
|
|
@ -2002,6 +2002,41 @@ class CommentController extends Comment
|
||||||
$this->setMessage('success_declared_cancel');
|
$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
|
* Method to add a pop-up menu when clicking for displaying child comments
|
||||||
* @param string $url
|
* @param string $url
|
||||||
|
|
|
||||||
|
|
@ -816,10 +816,15 @@ class CommentItem extends BaseObject
|
||||||
|
|
||||||
// Call trigger for custom thumbnails.
|
// Call trigger for custom thumbnails.
|
||||||
$trigger_obj = (object)[
|
$trigger_obj = (object)[
|
||||||
'document_srl' => $this->document_srl, 'comment_srl' => $this->comment_srl,
|
'document_srl' => $this->document_srl,
|
||||||
'width' => $width, 'height' => $height,
|
'comment_srl' => $this->comment_srl,
|
||||||
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
|
'width' => $width,
|
||||||
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
|
'height' => $height,
|
||||||
|
'image_type' => 'jpg',
|
||||||
|
'type' => $thumbnail_type,
|
||||||
|
'quality' => $config->thumbnail_quality,
|
||||||
|
'filename' => $thumbnail_file,
|
||||||
|
'url' => $thumbnail_url,
|
||||||
];
|
];
|
||||||
$output = ModuleHandler::triggerCall('comment.getThumbnail', 'before', $trigger_obj);
|
$output = ModuleHandler::triggerCall('comment.getThumbnail', 'before', $trigger_obj);
|
||||||
clearstatcache(true, $thumbnail_file);
|
clearstatcache(true, $thumbnail_file);
|
||||||
|
|
@ -877,8 +882,16 @@ class CommentItem extends BaseObject
|
||||||
// get an image file from the doc content if no file attached.
|
// get an image file from the doc content if no file attached.
|
||||||
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
||||||
{
|
{
|
||||||
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
|
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
|
||||||
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
|
if($trigger_obj->height === 'auto')
|
||||||
|
{
|
||||||
|
$external_image_min_height = min(100, $external_image_min_width * 0.5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
|
||||||
|
}
|
||||||
|
|
||||||
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $this->get('content'), $matches, PREG_SET_ORDER);
|
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $this->get('content'), $matches, PREG_SET_ORDER);
|
||||||
foreach($matches as $match)
|
foreach($matches as $match)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
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>
|
||||||
|
|
@ -3307,16 +3307,23 @@ class DocumentController extends Document
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get document_srl
|
// Get document_srl
|
||||||
$srls = explode(',',Context::get('srls'));
|
$srls = Context::get('srls');
|
||||||
for($i = 0; $i < count($srls); $i++)
|
if (is_array($srls))
|
||||||
{
|
{
|
||||||
$srl = trim($srls[$i]);
|
$document_srls = array_map('intval', $srls);
|
||||||
|
}
|
||||||
if(!$srl) continue;
|
else
|
||||||
|
{
|
||||||
$document_srls[] = $srl;
|
$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
|
// Get module_srl of the documents
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
|
|
@ -3787,7 +3794,17 @@ Content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A typo of updateUploadedCount, maintained for backward compatibility.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public function updateUploaedCount($document_srl_list)
|
public function updateUploaedCount($document_srl_list)
|
||||||
|
{
|
||||||
|
return $this->updateUploadedCount($document_srl_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateUploadedCount($document_srl_list)
|
||||||
{
|
{
|
||||||
if(!is_array($document_srl_list))
|
if(!is_array($document_srl_list))
|
||||||
{
|
{
|
||||||
|
|
@ -3803,7 +3820,8 @@ Content;
|
||||||
|
|
||||||
foreach($document_srl_list as $document_srl)
|
foreach($document_srl_list as $document_srl)
|
||||||
{
|
{
|
||||||
if(!$document_srl = (int) $document_srl)
|
$document_srl = (int)$document_srl;
|
||||||
|
if ($document_srl <= 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -3823,7 +3841,7 @@ Content;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->updateUploaedCount($file->upload_target_srl);
|
$this->updateUploadedCount($file->upload_target_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1146,9 +1146,14 @@ class DocumentItem extends BaseObject
|
||||||
|
|
||||||
// Call trigger for custom thumbnails.
|
// Call trigger for custom thumbnails.
|
||||||
$trigger_obj = (object)[
|
$trigger_obj = (object)[
|
||||||
'document_srl' => $this->document_srl, 'width' => $width, 'height' => $height,
|
'document_srl' => $this->document_srl,
|
||||||
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
|
'width' => $width,
|
||||||
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
|
'height' => $height,
|
||||||
|
'image_type' => 'jpg',
|
||||||
|
'type' => $thumbnail_type,
|
||||||
|
'quality' => $config->thumbnail_quality,
|
||||||
|
'filename' => $thumbnail_file,
|
||||||
|
'url' => $thumbnail_url,
|
||||||
];
|
];
|
||||||
$output = ModuleHandler::triggerCall('document.getThumbnail', 'before', $trigger_obj);
|
$output = ModuleHandler::triggerCall('document.getThumbnail', 'before', $trigger_obj);
|
||||||
clearstatcache(true, $thumbnail_file);
|
clearstatcache(true, $thumbnail_file);
|
||||||
|
|
@ -1220,8 +1225,16 @@ class DocumentItem extends BaseObject
|
||||||
// If not exists, file an image file from the content
|
// If not exists, file an image file from the content
|
||||||
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
||||||
{
|
{
|
||||||
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
|
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
|
||||||
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
|
if($trigger_obj->height === 'auto')
|
||||||
|
{
|
||||||
|
$external_image_min_height = min(100, $external_image_min_width * 0.5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
|
||||||
|
}
|
||||||
|
|
||||||
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
|
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
|
||||||
foreach($matches as $match)
|
foreach($matches as $match)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
<div class="x_control-group" data-invisible-types="file">
|
<div class="x_control-group" data-invisible-types="file">
|
||||||
<label class="x_control-label" for="default">{$lang->default_value}</label>
|
<label class="x_control-label" for="default">{$lang->default_value}</label>
|
||||||
<div class="x_controls">
|
<div class="x_controls">
|
||||||
<input type="text" name="default" id="default" value="{$selected_var->default}" />
|
<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>
|
<p class="x_help-block">{$lang->about_extra_vars_default_value}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -195,9 +195,9 @@ class Value
|
||||||
{
|
{
|
||||||
return $this->default;
|
return $this->default;
|
||||||
}
|
}
|
||||||
elseif ($this->default)
|
elseif ($this->default && $this->parent_type !== 'member' && !in_array($this->type, ['checkbox', 'radio']))
|
||||||
{
|
{
|
||||||
return array_first($this->getOptions());
|
return is_array($this->default) ? array_first($this->default) : array_first(explode(',', $this->default));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
(function($) {
|
$(function() {
|
||||||
$(function() {
|
$('.ev_file_upload').each(function() {
|
||||||
$('button.evFileRemover').on('click', function() {
|
const container = $(this);
|
||||||
const container = $(this).parents('.ev_file_upload');
|
container.find('button.evFileRemover').on('click', function() {
|
||||||
container.find('span.filename').text('');
|
container.find('span.filename').text('');
|
||||||
container.find('span.filesize').text('');
|
container.find('span.filesize').text('');
|
||||||
container.find('input[type=hidden][name^=_delete_]').val('Y');
|
container.find('input[type=hidden][name^=_delete_]').val('Y');
|
||||||
container.find('input[type=file]').val('');
|
container.find('input[type=file]').val('');
|
||||||
|
$(this).remove();
|
||||||
});
|
});
|
||||||
$('input.rx_ev_file').on('change', function() {
|
container.find('input.rx_ev_file').on('change', function() {
|
||||||
const container = $(this).parents('.ev_file_upload');
|
|
||||||
const max_size = parseInt($(this).data('allowedFilesize'), 10);
|
const max_size = parseInt($(this).data('allowedFilesize'), 10);
|
||||||
const file_count = this.files.length;
|
const file_count = this.files.length;
|
||||||
for (let i = 0; i < file_count; i++) {
|
for (let i = 0; i < file_count; i++) {
|
||||||
|
|
@ -23,4 +23,4 @@
|
||||||
container.find('input[type=hidden][name^=_delete_]').val('N');
|
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"
|
id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password"
|
||||||
style="{{ $definition->style }}"|if="$definition->style"
|
style="{{ $definition->style }}"|if="$definition->style"
|
||||||
value="{{ strval($value) !== '' ? $value : strval($default) }}"
|
value="{{ strval($value) !== '' ? $value : strval($default) }}"
|
||||||
|
autocomplete="off" autocapitalize="none"
|
||||||
@required(toBool($definition->is_required))
|
@required(toBool($definition->is_required))
|
||||||
@disabled(toBool($definition->is_disabled))
|
@disabled(toBool($definition->is_disabled))
|
||||||
@readonly(toBool($definition->is_readonly))
|
@readonly(toBool($definition->is_readonly))
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
@readonly(toBool($definition->is_readonly))
|
@readonly(toBool($definition->is_readonly))
|
||||||
/>
|
/>
|
||||||
@elseif ($type === 'number')
|
@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"
|
id="{{ $input_id }}"|if="$input_id" class="number rx_ev_number"
|
||||||
style="{{ $definition->style }}"|if="$definition->style"
|
style="{{ $definition->style }}"|if="$definition->style"
|
||||||
value="{{ strval($value) !== '' ? $value : strval($default) }}"
|
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->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)
|
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->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)
|
function triggerCopyModule(&$obj)
|
||||||
|
|
|
||||||
|
|
@ -878,21 +878,27 @@ class MemberAdminController extends Member
|
||||||
$args->column_type = Context::get('column_type');
|
$args->column_type = Context::get('column_type');
|
||||||
$args->column_name = strtolower(Context::get('column_id'));
|
$args->column_name = strtolower(Context::get('column_id'));
|
||||||
$args->column_title = Context::get('column_title');
|
$args->column_title = Context::get('column_title');
|
||||||
$args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value')));
|
$args->default_value = trim(utf8_clean(Context::get('default_value')));
|
||||||
$args->required = Context::get('required');
|
$args->options = trim(utf8_clean(Context::get('options')));
|
||||||
$args->is_active = (isset($args->required));
|
if ($args->options !== '')
|
||||||
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 = 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
|
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
|
// Check ID duplicated
|
||||||
if (Context::isReservedWord($args->column_name))
|
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.
|
// Fix if member_join_form_srl exists. Add if not exists.
|
||||||
$isInsert;
|
$isInsert = false;
|
||||||
if(!$args->member_join_form_srl)
|
if(!$args->member_join_form_srl)
|
||||||
{
|
{
|
||||||
$isInsert = true;
|
$isInsert = true;
|
||||||
|
|
|
||||||
|
|
@ -288,13 +288,24 @@ class MemberAdminModel extends Member
|
||||||
if($output->toBool() && $output->data)
|
if($output->toBool() && $output->data)
|
||||||
{
|
{
|
||||||
$formInfo = $output->data;
|
$formInfo = $output->data;
|
||||||
$default_value = $formInfo->default_value;
|
$default_value = '';
|
||||||
if($default_value)
|
$options = '';
|
||||||
|
if (isset($formInfo->options) && $formInfo->options !== '')
|
||||||
{
|
{
|
||||||
$default_value = unserialize($default_value);
|
$default_value = $formInfo->default_value;
|
||||||
Context::set('default_value', $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('formInfo', $output->data);
|
||||||
|
Context::set('default_value', $default_value);
|
||||||
|
Context::set('options', $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
|
|
@ -314,7 +325,7 @@ class MemberAdminModel extends Member
|
||||||
$oTemplate = TemplateHandler::getInstance();
|
$oTemplate = TemplateHandler::getInstance();
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
|
$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);
|
$extend_form_list = MemberModel::getCombineJoinForm($memberInfo);
|
||||||
$security = new Security($extend_form_list);
|
$security = new Security($extend_form_list);
|
||||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||||
|
|
||||||
if ($memberInfo)
|
if ($memberInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -725,6 +725,7 @@ class MemberAdminView extends Member
|
||||||
$input->input_id = $extendForm->column_name;
|
$input->input_id = $extendForm->column_name;
|
||||||
$input->value = $extendForm->value ?? '';
|
$input->value = $extendForm->value ?? '';
|
||||||
$input->default = $extendForm->default_value ?? null;
|
$input->default = $extendForm->default_value ?? null;
|
||||||
|
$input->options = $extendForm->options ?? null;
|
||||||
if ($extendForm->column_type === 'tel' || $extendForm->column_type === 'tel_intl')
|
if ($extendForm->column_type === 'tel' || $extendForm->column_type === 'tel_intl')
|
||||||
{
|
{
|
||||||
$input->style = 'width:33.3px';
|
$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', 'idx_member_srl')) return true;
|
||||||
if($oDB->isIndexExists('member_auth_mail', 'unique_key')) 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
|
// Update status column
|
||||||
$output = executeQuery('member.getDeniedAndStatus');
|
$output = executeQuery('member.getDeniedAndStatus');
|
||||||
if ($output->data->count)
|
if ($output->data->count)
|
||||||
|
|
@ -403,6 +406,12 @@ class Member extends ModuleObject
|
||||||
$oDB->dropIndex('member_auth_mail', 'unique_key');
|
$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
|
// Update status column
|
||||||
$output = executeQuery('member.getDeniedAndStatus');
|
$output = executeQuery('member.getDeniedAndStatus');
|
||||||
if ($output->data->count)
|
if ($output->data->count)
|
||||||
|
|
|
||||||
|
|
@ -2867,7 +2867,7 @@ class MemberController extends Member
|
||||||
|
|
||||||
$extend_form_list = MemberModel::getJoinFormlist();
|
$extend_form_list = MemberModel::getJoinFormlist();
|
||||||
$security = new Security($extend_form_list);
|
$security = new Security($extend_form_list);
|
||||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||||
if($config->signupForm)
|
if($config->signupForm)
|
||||||
{
|
{
|
||||||
foreach($config->signupForm as $no => $formInfo)
|
foreach($config->signupForm as $no => $formInfo)
|
||||||
|
|
@ -3163,7 +3163,7 @@ class MemberController extends Member
|
||||||
|
|
||||||
$extend_form_list = MemberModel::getJoinFormlist();
|
$extend_form_list = MemberModel::getJoinFormlist();
|
||||||
$security = new Security($extend_form_list);
|
$security = new Security($extend_form_list);
|
||||||
$security->encodeHTML('..column_title', '..description', '..default_value.');
|
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
|
||||||
if($config->signupForm)
|
if($config->signupForm)
|
||||||
{
|
{
|
||||||
foreach($config->signupForm as $no => $formInfo)
|
foreach($config->signupForm as $no => $formInfo)
|
||||||
|
|
|
||||||
|
|
@ -806,31 +806,38 @@ class MemberModel extends Member
|
||||||
if(!$join_form_list) return NULL;
|
if(!$join_form_list) return NULL;
|
||||||
// Need to unserialize because serialized array is inserted into DB in case of default_value
|
// 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);
|
if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
|
||||||
$join_form_count = count($join_form_list);
|
foreach ($join_form_list as $i => $join_form)
|
||||||
for($i=0;$i<$join_form_count;$i++)
|
|
||||||
{
|
{
|
||||||
$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
|
// Add language variable
|
||||||
if(!isset($lang->extend_vars)) $lang->extend_vars = array();
|
$column_name = $join_form->column_name;
|
||||||
$lang->extend_vars[$column_name] = $column_title;
|
$column_title = $join_form->column_title;
|
||||||
// unserialize if the data type if checkbox, select and so on
|
if (!isset($lang->extend_vars))
|
||||||
if(in_array($column_type, array('checkbox','select','radio')))
|
|
||||||
{
|
{
|
||||||
$join_form_list[$i]->default_value = unserialize($default_value);
|
$lang->extend_vars = array();
|
||||||
if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
|
}
|
||||||
|
$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
|
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;
|
self::$_join_form_list = $list;
|
||||||
}
|
}
|
||||||
|
|
@ -958,12 +965,17 @@ class MemberModel extends Member
|
||||||
$join_form = $output->data;
|
$join_form = $output->data;
|
||||||
if(!$join_form) return NULL;
|
if(!$join_form) return NULL;
|
||||||
|
|
||||||
$column_type = $join_form->column_type;
|
if (in_array($join_form->column_type, ['checkbox','select','radio']))
|
||||||
$default_value = $join_form->default_value;
|
|
||||||
|
|
||||||
if(in_array($column_type, array('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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,7 @@ class MemberView extends Member
|
||||||
$extvalue->input_id = $formInfo->name;
|
$extvalue->input_id = $formInfo->name;
|
||||||
$extvalue->value = $extendFormInfo[$formInfo->member_join_form_srl]->value ?? null;
|
$extvalue->value = $extendFormInfo[$formInfo->member_join_form_srl]->value ?? null;
|
||||||
$extvalue->default = $extendFormInfo[$formInfo->member_join_form_srl]->default_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();
|
$item->value = $extvalue->getValueHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
<column name="column_title" var="column_title" />
|
<column name="column_title" var="column_title" />
|
||||||
<column name="required" var="required" default="N" />
|
<column name="required" var="required" default="N" />
|
||||||
<column name="default_value" var="default_value" />
|
<column name="default_value" var="default_value" />
|
||||||
|
<column name="options" var="options" />
|
||||||
<column name="is_active" var="is_active" default="N" />
|
<column name="is_active" var="is_active" default="N" />
|
||||||
<column name="description" var="description" />
|
<column name="description" var="description" />
|
||||||
<column name="regdate" default="curdate()" />
|
<column name="regdate" default="curdate()" />
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<column name="column_title" var="column_title" />
|
<column name="column_title" var="column_title" />
|
||||||
<column name="required" var="required" default="N" />
|
<column name="required" var="required" default="N" />
|
||||||
<column name="default_value" var="default_value" />
|
<column name="default_value" var="default_value" />
|
||||||
|
<column name="options" var="options" />
|
||||||
<column name="is_active" var="is_active" default="N" />
|
<column name="is_active" var="is_active" default="N" />
|
||||||
<column name="description" var="description" />
|
<column name="description" var="description" />
|
||||||
</columns>
|
</columns>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
<column name="column_title" type="varchar" size="60" notnull="notnull" />
|
<column name="column_title" type="varchar" size="60" notnull="notnull" />
|
||||||
<column name="required" type="char" size="1" default="N" notnull="notnull" />
|
<column name="required" type="char" size="1" default="N" notnull="notnull" />
|
||||||
<column name="default_value" type="text" />
|
<column name="default_value" type="text" />
|
||||||
|
<column name="options" type="text" />
|
||||||
<column name="is_active" type="char" size="1" default="Y" />
|
<column name="is_active" type="char" size="1" default="Y" />
|
||||||
<column name="description" type="text" />
|
<column name="description" type="text" />
|
||||||
<column name="list_order" type="number" size="11" notnull="notnull" default="1" index="idx_list_order" />
|
<column name="list_order" type="number" size="11" notnull="notnull" default="1" index="idx_list_order" />
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,17 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="x_control-group multiExample">
|
<div class="x_control-group">
|
||||||
<label for="multiSelect" class="x_control-label"><em style="color:red">*</em> {$lang->options}</label>
|
<label for="default_value" class="x_control-label"> {$lang->default_value}</label>
|
||||||
<div class="x_controls">
|
<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>
|
<input type="text" id="default_value" name="default_value" value="{$default_value}" />
|
||||||
<p class="x_help-inline">{$lang->about_multi_type}</p>
|
</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>
|
</div>
|
||||||
<div class="x_control-group">
|
<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>
|
<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>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var $ = jQuery;
|
|
||||||
var typeSelect = $('.typeSelect');
|
var typeSelect = $('.typeSelect');
|
||||||
var multiOption = $('.typeSelect>option[value=checkbox], .typeSelect>option[value=radio], .typeSelect>option[value=select_multiple], .typeSelect>option[value=select]');
|
var multiOption = $('.typeSelect>option[value=checkbox], .typeSelect>option[value=radio], .typeSelect>option[value=select_multiple], .typeSelect>option[value=select]');
|
||||||
var multiExample = $('.multiExample');
|
var multiExample = $('.multiExample');
|
||||||
|
|
|
||||||
|
|
@ -2003,7 +2003,7 @@ class MenuAdminController extends Menu
|
||||||
// If the value of node->group_srls exists
|
// If the value of node->group_srls exists
|
||||||
if($node->group_srls) {
|
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_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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2099,7 +2099,7 @@ class MenuAdminController extends Menu
|
||||||
if($node->group_srls)
|
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_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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,10 @@ class MenuAdminModel extends Menu
|
||||||
{
|
{
|
||||||
$menuItem->grant = 'manager';
|
$menuItem->grant = 'manager';
|
||||||
}
|
}
|
||||||
|
else if($menuItem->group_srls[0] == -4)
|
||||||
|
{
|
||||||
|
$menuItem->grant = 'not_member';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$menuItem->grant = 'group';
|
$menuItem->grant = 'group';
|
||||||
|
|
|
||||||
|
|
@ -2361,39 +2361,29 @@ jQuery(function($){
|
||||||
$node.find('._groups').append($groupNode);
|
$node.find('._groups').append($groupNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i === 0){
|
/*
|
||||||
$node.find('._group_signedup').remove();
|
guest : 모든 옵션 사용 가능, 항상 권한 있음.
|
||||||
//$node.find('._group_manager').remove();
|
member : '모든 사용자' 제외하고 사용 가능, 로그인 정보가 있을 경우 true
|
||||||
}else{
|
not_member : 비로그인 사용자, 로그인 정보가 *없을* 경우 true
|
||||||
/*
|
manager : '관리자만','선택그룹 사용자' 옵션만 사용가능, 관리자일 경우에만 true
|
||||||
guest : 모든 옵션 사용 가능, 항상 권한 있음.
|
root : manager와 동일.
|
||||||
member : '모든 사용자' 제외하고 사용 가능, 로그인 정보가 있을 경우 true
|
*/
|
||||||
not_member : 비로그인 사용자, 로그인 정보가 *없을* 경우 true
|
switch(sDefault) {
|
||||||
manager : '관리자만','선택그룹 사용자' 옵션만 사용가능, 관리자일 경우에만 true
|
case 'guest':
|
||||||
root : manager와 동일.
|
|
||||||
*/
|
|
||||||
switch(sDefault){
|
|
||||||
case 'guest':
|
|
||||||
//
|
|
||||||
break;
|
break;
|
||||||
case 'member':
|
case 'member':
|
||||||
$node.find('._group_all').remove();
|
case 'not_member':
|
||||||
|
case 'site':
|
||||||
|
$node.find('._group_loggedin').prop('selected', true);
|
||||||
break;
|
break;
|
||||||
case 'not_member':
|
case 'manager':
|
||||||
$node.find('._group_all').remove();
|
case 'root':
|
||||||
break;
|
default:
|
||||||
case 'site':
|
$node.find('._group_manager').prop('selected', true);
|
||||||
$node.find('._group_all').remove();
|
$node.find('._group_all').remove();
|
||||||
break;
|
$node.find('._group_loggedin').remove();
|
||||||
case 'manager':
|
$node.find('._group_not_loggedin').remove();
|
||||||
case 'root':
|
|
||||||
default:
|
|
||||||
$node.find('._group_all').remove();
|
|
||||||
$node.find('._group_loggedin').remove();
|
|
||||||
$node.find('._group_signedup').remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//console.log(22, $node);
|
|
||||||
$List.append($node);
|
$List.append($node);
|
||||||
$('#auth select').trigger('change');
|
$('#auth select').trigger('change');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,9 @@ class MessageView extends Message
|
||||||
|
|
||||||
Context::set('ssl_mode', \RX_SSL);
|
Context::set('ssl_mode', \RX_SSL);
|
||||||
Context::set('system_message', nl2br($this->getMessage()));
|
Context::set('system_message', nl2br($this->getMessage()));
|
||||||
Context::set('system_message_detail', nl2br($detail));
|
Context::set('system_message_detail', nl2br($detail ?? ''));
|
||||||
Context::set('system_message_help', self::getErrorHelp(strval($detail)));
|
Context::set('system_message_help', self::getErrorHelp(strval($detail ?? '')));
|
||||||
Context::set('system_message_location', escape($location));
|
Context::set('system_message_location', escape($location ?? ''));
|
||||||
|
|
||||||
if ($this->getError())
|
if ($this->getError())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,11 @@ class Permission
|
||||||
// Check if each permission is granted to the current user.
|
// Check if each permission is granted to the current user.
|
||||||
foreach ($this->_spec as $key => $requirement)
|
foreach ($this->_spec as $key => $requirement)
|
||||||
{
|
{
|
||||||
if ($requirement === 'guest')
|
if ($key === 'manager' && $this->manager)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
elseif ($requirement === 'guest')
|
||||||
{
|
{
|
||||||
$this->{$key} = true;
|
$this->{$key} = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,9 +171,18 @@ class ModuleAdminModel extends Module
|
||||||
$grant_list->manager->title = lang('grant_manager');
|
$grant_list->manager->title = lang('grant_manager');
|
||||||
$grant_list->manager->default = 'manager';
|
$grant_list->manager->default = 'manager';
|
||||||
Context::set('grant_list', $grant_list);
|
Context::set('grant_list', $grant_list);
|
||||||
|
|
||||||
// Get a permission group granted to the current module
|
// Get a permission group granted to the current module
|
||||||
$selected_group = array();
|
$selected_group = array();
|
||||||
$default_grant = array();
|
$default_grant = array();
|
||||||
|
foreach ($grant_list as $key => $val)
|
||||||
|
{
|
||||||
|
if (!empty($val->default))
|
||||||
|
{
|
||||||
|
$default_grant[$key] = $val->default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$output = executeQueryArray('module.getModuleGrants', $args);
|
$output = executeQueryArray('module.getModuleGrants', $args);
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{@$suggestion_id = 0}
|
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||||
<block loop="$widget_info->extra_var => $id, $var">
|
<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="!$not_first && !$var->group"><section class="extra_vars section"></block>
|
||||||
<block cond="$group != $var->group">
|
<block cond="$group != $var->group">
|
||||||
<block cond="$not_first"></section></block>
|
<block cond="$not_first"></section></block>
|
||||||
<section class="extra_vars section">
|
<section class="extra_vars section">
|
||||||
<h1>{$var->group}</h1>
|
<h1>{$var->group}</h1>
|
||||||
{@$group = $var->group}
|
{@ $group = $var->group; }
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
{@$not_first = true}
|
{@$not_first = true}
|
||||||
|
|
@ -53,21 +53,21 @@
|
||||||
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
|
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
|
||||||
<div class="x_controls">
|
<div class="x_controls">
|
||||||
<block cond="$var->type == 'text'">
|
<block cond="$var->type == 'text'">
|
||||||
<input type="text" name="{$id}" />
|
<input type="text" name="{$id}" value="{$var->default}" />
|
||||||
</block>
|
</block>
|
||||||
<block cond="$var->type == 'color'">
|
<block cond="$var->type == 'color'">
|
||||||
<input type="text" name="{$id}" value="" id="{$id}" class="rx-spectrum" style="width:178px" />
|
<input type="text" name="{$id}" value="" id="{$id}" class="rx-spectrum" style="width:178px" />
|
||||||
</block>
|
</block>
|
||||||
<block cond="$var->type == 'textarea'">
|
<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>
|
||||||
<block cond="$var->type == 'select'">
|
<block cond="$var->type == 'select'">
|
||||||
<select name="{$id}" id="{$id}">
|
<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>
|
</select>
|
||||||
</block>
|
</block>
|
||||||
<block cond="$var->type == 'select-multi-order'">
|
<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)}
|
{@$inits = array_keys($var->init_options)}
|
||||||
<input type="hidden" name="{$id}" value="{implode(',', $inits)}" />
|
<input type="hidden" name="{$id}" value="{implode(',', $inits)}" />
|
||||||
<!--@else-->
|
<!--@else-->
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
<div style="display:inline-block;padding-top:3px">
|
<div style="display:inline-block;padding-top:3px">
|
||||||
<label>{$lang->display_no}</label>
|
<label>{$lang->display_no}</label>
|
||||||
<select class="multiorder_show" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
<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>
|
</select>
|
||||||
<br>
|
<br>
|
||||||
<button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button>
|
<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">
|
<div style="display:inline-block;padding-top:3px">
|
||||||
<label>{$lang->display_yes}</label>
|
<label>{$lang->display_yes}</label>
|
||||||
<select class="multiorder_selected" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
|
<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>
|
</select>
|
||||||
<br>
|
<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>
|
<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>
|
||||||
<div id="content" class="x_modal-body">
|
<div id="content" class="x_modal-body">
|
||||||
<p>{$widget_info->description} {$lang->about_widget_code_in_page}</p>
|
<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="module" value="widget" />
|
||||||
<input type="hidden" name="type" value="faceoff" />
|
<input type="hidden" name="type" value="faceoff" />
|
||||||
<input type="hidden" name="act" value="dispWidgetGenerateCodeInPage" />
|
<input type="hidden" name="act" value="dispWidgetGenerateCodeInPage" />
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="x_modal-body x_form-horizontal">
|
<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 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">
|
<block cond="$widgetstyle_info">
|
||||||
|
|
||||||
<h2>{$widgetstyle_info->title} ver {$widgetstyle_info->version}</h2>
|
<h2>{$widgetstyle_info->title} ver {$widgetstyle_info->version}</h2>
|
||||||
<div class="x_control-group">
|
<div class="x_control-group">
|
||||||
<label class="x_control-label">{$lang->description}</label>
|
<label class="x_control-label">{$lang->description}</label>
|
||||||
|
|
@ -52,45 +52,46 @@
|
||||||
{zdate($widgetstyle_info->date,'Y-m-d')}
|
{zdate($widgetstyle_info->date,'Y-m-d')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
|
||||||
<block loop="$widgetstyle_info->extra_var => $id, $var">
|
<block loop="$widgetstyle_info->extra_var => $id, $var">
|
||||||
{@$suggestion_id++}
|
{@ $suggestion_id++; }
|
||||||
<block cond="!$not_first && !$var->group"><section class="section"></block>
|
<block cond="!$not_first && !$var->group"><section class="section"></block>
|
||||||
<block cond="$group != $var->group">
|
<block cond="$group != $var->group">
|
||||||
<block cond="$not_first"></section></block>
|
<block cond="$not_first"></section></block>
|
||||||
<h1>{$var->group}</h1>
|
<h1>{$var->group}</h1>
|
||||||
<section class="section">
|
<section class="section">
|
||||||
{@$group = $var->group}
|
{@ $group = $var->group; }
|
||||||
</block>
|
</block>
|
||||||
{@$not_first = true}
|
{@ $not_first = true; }
|
||||||
<div class="x_control-group">
|
<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>
|
<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 class="x_controls extra_vars">
|
||||||
<div cond="$var->type == 'text'">
|
<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>
|
</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'">
|
<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>
|
</div>
|
||||||
|
|
||||||
<select cond="$var->type == 'select'" name="{$id}">
|
<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>
|
</select>
|
||||||
|
|
||||||
<block cond="$var->type == 'filebox'">
|
<block cond="$var->type == 'filebox'">
|
||||||
<input type="hidden" name="{$id}" />
|
<input type="hidden" name="{$id}" />
|
||||||
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
|
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
|
||||||
{@$use_filebox = TRUE}
|
{@$use_filebox = TRUE}
|
||||||
</block>
|
</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}
|
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||||
</label>
|
</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}
|
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
|
||||||
</label>
|
</label>
|
||||||
<span class="x_help-block">{$var->description}</span>
|
<span class="x_help-block">{$var->description}</span>
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ class WidgetController extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
$args->widget_sequence = $args->widget_sequence ?? 0;
|
$args->widget_sequence = $args->widget_sequence ?? 0;
|
||||||
$args->colorset = $args->colorset ?? null;
|
$args->colorset = $args->colorset ?? '';
|
||||||
|
|
||||||
foreach ($lang_list as $lang_type => $val)
|
foreach ($lang_list as $lang_type => $val)
|
||||||
{
|
{
|
||||||
|
|
@ -430,6 +430,14 @@ class WidgetController extends Widget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
|
||||||
|
{
|
||||||
|
if (!isset($args->{$key}))
|
||||||
|
{
|
||||||
|
$args->{$key} = $val->default !== '' ? $val->default : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$widget_content = $oWidget->proc($args);
|
$widget_content = $oWidget->proc($args);
|
||||||
return Context::replaceUserLang($widget_content);
|
return Context::replaceUserLang($widget_content);
|
||||||
}
|
}
|
||||||
|
|
@ -453,6 +461,14 @@ class WidgetController extends Widget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
|
||||||
|
{
|
||||||
|
if (!isset($args->{$key}))
|
||||||
|
{
|
||||||
|
$args->{$key} = $val->default !== '' ? $val->default : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$oFrontEndFileHandler = FrontEndFileHandler::getInstance();
|
$oFrontEndFileHandler = FrontEndFileHandler::getInstance();
|
||||||
$oFrontEndFileHandler->startLog();
|
$oFrontEndFileHandler->startLog();
|
||||||
|
|
||||||
|
|
@ -498,7 +514,7 @@ class WidgetController extends Widget
|
||||||
// Set default
|
// Set default
|
||||||
$args->widget_sequence = $args->widget_sequence ?? 0;
|
$args->widget_sequence = $args->widget_sequence ?? 0;
|
||||||
$args->widget_cache = $args->widget_cache ?? 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
|
* Widgets widgetContent/widgetBox Wanted If you are not content
|
||||||
|
|
@ -600,25 +616,30 @@ class WidgetController extends Widget
|
||||||
{
|
{
|
||||||
foreach($args as $key => $val)
|
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(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);
|
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
|
||||||
$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
|
$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oWidgetController = getController('widget');
|
$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>'.
|
||||||
$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>'.
|
|
||||||
'<div class="widgetResize"></div>'.
|
'<div class="widgetResize"></div>'.
|
||||||
'<div class="widgetResizeLeft"></div>'.
|
'<div class="widgetResizeLeft"></div>'.
|
||||||
'<div class="widgetBorder">'.
|
'<div class="widgetBorder">'.
|
||||||
'<div style="%s">',$args->widgetstyle,
|
'<div style="%s">',
|
||||||
|
[
|
||||||
|
$args->widgetstyle ?? '',
|
||||||
$style,
|
$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,
|
$args->document_srl,
|
||||||
implode(' ',$attribute),
|
implode(' ', $attribute),
|
||||||
$inner_style);
|
$inner_style,
|
||||||
|
]);
|
||||||
|
|
||||||
$widget_content_body = $body;
|
$widget_content_body = $body;
|
||||||
$widget_content_footer = sprintf('</div>'.
|
$widget_content_footer = sprintf('</div>'.
|
||||||
|
|
@ -642,11 +663,21 @@ class WidgetController extends Widget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$widget_content_header = sprintf(
|
$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="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="widgetBoxResize"></div>'.
|
||||||
'<div class="widgetBoxResizeLeft"></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;
|
$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="widgetResize"></div>'.
|
||||||
'<div class="widgetResizeLeft"></div>'.
|
'<div class="widgetResizeLeft"></div>'.
|
||||||
'<div class="widgetBorder">',$args->widgetstyle,$style,
|
'<div class="widgetBorder">',
|
||||||
$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
|
[
|
||||||
$widget, implode(' ',$attribute));
|
$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);
|
$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->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
|
||||||
$vars->document_srl= trim($request_vars->document_srl);
|
$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)
|
if($request_vars->widgetstyle)
|
||||||
{
|
{
|
||||||
$widgetStyle_info = WidgetModel::getWidgetStyleInfo($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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the cache.
|
// Check the local cache.
|
||||||
$xml_mtime = filemtime($xml_file);
|
$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);
|
$cache_key = sprintf('widget_info:%s:%d', $widget, $xml_mtime);
|
||||||
$widget_info = Rhymix\Framework\Cache::get($cache_key);
|
$widget_info = Rhymix\Framework\Cache::get($cache_key);
|
||||||
if ($widget_info)
|
if ($widget_info)
|
||||||
{
|
{
|
||||||
|
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
|
||||||
return $widget_info;
|
return $widget_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,6 +152,7 @@ class WidgetModel extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
Rhymix\Framework\Cache::set($cache_key, $widget_info);
|
Rhymix\Framework\Cache::set($cache_key, $widget_info);
|
||||||
|
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
|
||||||
return $widget_info;
|
return $widget_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +163,7 @@ class WidgetModel extends Widget
|
||||||
public static function getWidgetStyleInfo($widgetStyle)
|
public static function getWidgetStyleInfo($widgetStyle)
|
||||||
{
|
{
|
||||||
// Check the widget style path.
|
// 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);
|
$widgetStyle_path = self::getWidgetStylePath($widgetStyle);
|
||||||
if (!$widgetStyle_path)
|
if (!$widgetStyle_path)
|
||||||
{
|
{
|
||||||
|
|
@ -169,12 +177,19 @@ class WidgetModel extends Widget
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the cache.
|
// Check the local cache.
|
||||||
$xml_mtime = filemtime($xml_file);
|
$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);
|
$cache_key = sprintf('widgetstyle_info:%s:%d', $widgetStyle, $xml_mtime);
|
||||||
$widgetStyle_info = Rhymix\Framework\Cache::get($cache_key);
|
$widgetStyle_info = Rhymix\Framework\Cache::get($cache_key);
|
||||||
if ($widgetStyle_info)
|
if ($widgetStyle_info)
|
||||||
{
|
{
|
||||||
|
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
|
||||||
return $widgetStyle_info;
|
return $widgetStyle_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,6 +201,7 @@ class WidgetModel extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
Rhymix\Framework\Cache::set($cache_key, $widgetStyle_info);
|
Rhymix\Framework\Cache::set($cache_key, $widgetStyle_info);
|
||||||
|
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
|
||||||
return $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>';
|
$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));
|
$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
|
// <style> tag
|
||||||
$source = '<style> body { font-size: 16px; } </style>';
|
$source = '<style> body { font-size: 16px; } </style>';
|
||||||
$target = '<style<?php $this->config->context = \'CSS\'; ?>> body { font-size: 16px; } <?php $this->config->context = \'HTML\'; ?></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>
|
<name xml:lang="tr">UL (list)</name>
|
||||||
</options>
|
</options>
|
||||||
</var>
|
</var>
|
||||||
<var id="list_count" type="text">
|
<var id="list_count" type="text" default="5">
|
||||||
<name xml:lang="ko">목록수</name>
|
<name xml:lang="ko">목록수</name>
|
||||||
<name xml:lang="zh-CN">目录数</name>
|
<name xml:lang="zh-CN">目录数</name>
|
||||||
<name xml:lang="jp">リスト数</name>
|
<name xml:lang="jp">リスト数</name>
|
||||||
|
|
@ -266,7 +266,7 @@
|
||||||
<description xml:lang="zh-TW">設置要顯示的目錄數。(預設是5個)</description>
|
<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>
|
<description xml:lang="tr">Görüntülenecek yazıların sayısını ayarlayabilirsiniz. (varsayılan değer 5'tir)</description>
|
||||||
</var>
|
</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="ko">가로 이미지 수</name>
|
||||||
<name xml:lang="jp">横並びイメージ数</name>
|
<name xml:lang="jp">横並びイメージ数</name>
|
||||||
<name xml:lang="zh-CN">横向图片数</name>
|
<name xml:lang="zh-CN">横向图片数</name>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue