mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 07:47:00 +02:00
Update Modules/ProcessModules to skip showing configurable modules with no visible configuration fields. Plus a few other small additions.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
* @property Languages $languages If LanguageSupport installed
|
||||
* @property Config $config
|
||||
* @property Fuel $fuel
|
||||
* @property WireProfilerInterface $profiler
|
||||
*
|
||||
*/
|
||||
class Fuel implements \IteratorAggregate {
|
||||
@@ -56,6 +57,16 @@ class Fuel implements \IteratorAggregate {
|
||||
*/
|
||||
protected $lock = array();
|
||||
|
||||
/**
|
||||
* API vars that require specific interfaces
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
*/
|
||||
protected $requiredInterfaces = array(
|
||||
'profiler' => 'WireProfilerInterface'
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string $key API variable name to set - should be valid PHP variable name.
|
||||
* @param object|mixed $value Value for the API variable.
|
||||
@@ -68,6 +79,13 @@ class Fuel implements \IteratorAggregate {
|
||||
if(isset($this->lock[$key]) && $value !== $this->data[$key]) {
|
||||
throw new WireException("API variable '$key' is locked and may not be set again");
|
||||
}
|
||||
if(isset($this->requiredInterfaces[$key])) {
|
||||
$requiredInterface = $this->requiredInterfaces[$key];
|
||||
$hasInterfaces = wireClassImplements($value, false);
|
||||
if(!isset($hasInterfaces[$requiredInterface]) && !in_array($requiredInterface, $hasInterfaces)) {
|
||||
throw new WireException("API variable '$key' must implement interface: $requiredInterface");
|
||||
}
|
||||
}
|
||||
$this->data[$key] = $value;
|
||||
if($lock) $this->lock[$key] = true;
|
||||
return $this;
|
||||
|
@@ -443,6 +443,43 @@ interface LanguagesValueInterface {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for tracking runtime events
|
||||
*
|
||||
*/
|
||||
interface WireProfilerInterface {
|
||||
|
||||
/**
|
||||
* Start profiling an event
|
||||
*
|
||||
* Return the event array to be used for stop profiling
|
||||
*
|
||||
* @param string $name Name of event in format "method" or "method.id" or "something"
|
||||
* @param Wire|object|string|null Source of event (may be object instance)
|
||||
* @param array $data
|
||||
* @return mixed Event to be used for stop call
|
||||
*
|
||||
*/
|
||||
public function start($name, $source = null, $data = array());
|
||||
|
||||
/**
|
||||
* Stop profiling an event
|
||||
*
|
||||
* @param array|object|string $event Event returned by start()
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function stop($event);
|
||||
|
||||
/**
|
||||
* End of request maintenance
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function maintenance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inputfields that implement this interface always have a $value attribute that is an array
|
||||
*
|
||||
|
@@ -65,7 +65,13 @@ class Modules extends WireArray {
|
||||
* When combined with flagsAutoload, indicates that the module's autoload state is temporarily disabled
|
||||
*
|
||||
*/
|
||||
const flagsDisabled = 16;
|
||||
const flagsDisabled = 16;
|
||||
|
||||
/**
|
||||
* Indicates module that maintains a configurable interface but with no interactive Inputfields
|
||||
*
|
||||
*/
|
||||
const flagsNoUserConfig = 32;
|
||||
|
||||
/**
|
||||
* Filename for module info cache file
|
||||
@@ -3521,60 +3527,88 @@ class Modules extends WireArray {
|
||||
|
||||
// check for file-based config
|
||||
$file = $this->isConfigurable($moduleName, "file");
|
||||
if(!$file || !is_string($file) || !is_file($file)) return $form;
|
||||
|
||||
$config = null;
|
||||
$ns = $this->getModuleNamespace($moduleName);
|
||||
$configClass = $ns . $moduleName . "Config";
|
||||
if(!class_exists($configClass)) {
|
||||
$configFile = $this->compile($moduleName, $file, $ns);
|
||||
if($configFile) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
include_once($configFile);
|
||||
}
|
||||
}
|
||||
$configModule = null;
|
||||
|
||||
if(wireClassExists($configClass)) {
|
||||
// file contains a ModuleNameConfig class
|
||||
$configModule = $this->wire(new $configClass());
|
||||
|
||||
if(!$file || !is_string($file) || !is_file($file)) {
|
||||
// config is not file-based
|
||||
} else {
|
||||
if(is_null($config)) {
|
||||
// file-based config
|
||||
$config = null;
|
||||
$ns = $this->getModuleNamespace($moduleName);
|
||||
$configClass = $ns . $moduleName . "Config";
|
||||
if(!class_exists($configClass)) {
|
||||
$configFile = $this->compile($moduleName, $file, $ns);
|
||||
// if(!$configFile) $configFile = $compile ? $this->wire('files')->compile($file) : $file;
|
||||
if($configFile) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
include($configFile); // in case of previous include_once
|
||||
include_once($configFile);
|
||||
}
|
||||
}
|
||||
if(is_array($config)) {
|
||||
// file contains a $config array
|
||||
$configModule = $this->wire(new ModuleConfig());
|
||||
$configModule->add($config);
|
||||
$configModule = null;
|
||||
|
||||
if(wireClassExists($configClass)) {
|
||||
// file contains a ModuleNameConfig class
|
||||
$configModule = $this->wire(new $configClass());
|
||||
|
||||
} else {
|
||||
if(is_null($config)) {
|
||||
$configFile = $this->compile($moduleName, $file, $ns);
|
||||
// if(!$configFile) $configFile = $compile ? $this->wire('files')->compile($file) : $file;
|
||||
if($configFile) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
include($configFile); // in case of previous include_once
|
||||
}
|
||||
}
|
||||
if(is_array($config)) {
|
||||
// file contains a $config array
|
||||
$configModule = $this->wire(new ModuleConfig());
|
||||
$configModule->add($config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($configModule && $configModule instanceof ModuleConfig) {
|
||||
$defaults = $configModule->getDefaults();
|
||||
$data = array_merge($defaults, $data);
|
||||
$configModule->setArray($data);
|
||||
$fields = $configModule->getInputfields();
|
||||
if($fields instanceof InputfieldWrapper) {
|
||||
foreach($fields as $field) {
|
||||
$form->append($field);
|
||||
}
|
||||
foreach($data as $key => $value) {
|
||||
$f = $form->getChildByName($key);
|
||||
if(!$f) continue;
|
||||
if($f instanceof InputfieldCheckbox && $value) {
|
||||
$f->attr('checked', 'checked');
|
||||
} else {
|
||||
$f->attr('value', $value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error("$configModule.getInputfields() did not return InputfieldWrapper");
|
||||
}
|
||||
}
|
||||
} // file-based config
|
||||
|
||||
if($configModule && $configModule instanceof ModuleConfig) {
|
||||
$defaults = $configModule->getDefaults();
|
||||
$data = array_merge($defaults, $data);
|
||||
$configModule->setArray($data);
|
||||
$fields = $configModule->getInputfields();
|
||||
if($fields instanceof InputfieldWrapper) {
|
||||
foreach($fields as $field) {
|
||||
$form->append($field);
|
||||
}
|
||||
foreach($data as $key => $value) {
|
||||
$f = $form->getChildByName($key);
|
||||
if(!$f) continue;
|
||||
if($f instanceof InputfieldCheckbox && $value) {
|
||||
$f->attr('checked', 'checked');
|
||||
} else {
|
||||
$f->attr('value', $value);
|
||||
if($form) {
|
||||
// determine how many visible Inputfields there are in the module configuration
|
||||
// for assignment or removal of flagsNoUserConfig flag when applicable
|
||||
$numVisible = 0;
|
||||
foreach($form->getAll() as $inputfield) {
|
||||
if($inputfield instanceof InputfieldHidden || $inputfield instanceof InputfieldWrapper) continue;
|
||||
$numVisible++;
|
||||
}
|
||||
$flags = $this->getFlags($moduleName);
|
||||
if($numVisible) {
|
||||
if($flags & self::flagsNoUserConfig) {
|
||||
$info = $this->getModuleInfoVerbose($moduleName);
|
||||
if(empty($info['addFlag']) || !($info['addFlag'] & self::flagsNoUserConfig)) {
|
||||
$this->setFlag($moduleName, self::flagsNoUserConfig, false); // remove flag
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error("$configModule.getInputfields() did not return InputfieldWrapper");
|
||||
if(!($flags & self::flagsNoUserConfig)) {
|
||||
if(empty($info['removeFlag']) || !($info['removeFlag'] & self::flagsNoUserConfig)) {
|
||||
$this->setFlag($moduleName, self::flagsNoUserConfig, true); // add flag
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4298,6 +4332,23 @@ class Modules extends WireArray {
|
||||
if($flags & self::flagsSingular) $this->setFlag($moduleID, self::flagsSingular, false);
|
||||
}
|
||||
|
||||
// handle addFlag and removeFlag moduleInfo properties
|
||||
foreach(array(0 => 'removeFlag', 1 => 'addFlag') as $add => $flagsType) {
|
||||
if(empty($info[$flagsType])) continue;
|
||||
if($flags & $info[$flagsType]) {
|
||||
// already has the flags
|
||||
if(!$add) {
|
||||
// remove the flag(s)
|
||||
$this->setFlag($moduleID, $info[$flagsType], false);
|
||||
}
|
||||
} else {
|
||||
// does not have the flags
|
||||
if($add) {
|
||||
// add the flag(s)
|
||||
$this->setFlag($moduleID, $info[$flagsType], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -430,9 +430,11 @@ class ProcessWire extends Wire {
|
||||
$config = $this->wire('config');
|
||||
$session = $this->wire('session');
|
||||
$cache = $this->wire('cache');
|
||||
$profiler = $this->wire('profiler');
|
||||
|
||||
if($session) $session->maintenance();
|
||||
if($cache) $cache->maintenance();
|
||||
if($profiler) $profiler->maintenance();
|
||||
|
||||
if($config->templateCompile) {
|
||||
$compiler = new FileCompiler($this->wire('config')->paths->templates);
|
||||
@@ -443,6 +445,7 @@ class ProcessWire extends Wire {
|
||||
$compiler = new FileCompiler($this->wire('config')->paths->siteModules);
|
||||
$compiler->maintenance();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -954,6 +954,7 @@ class Session extends Wire implements \IteratorAggregate {
|
||||
if(!strpos($url, 'modal=')) $url .= (strpos($url, '?') !== false ? '&' : '?') . 'modal=1';
|
||||
}
|
||||
}
|
||||
$this->wire()->setStatus(ProcessWire::statusFinished);
|
||||
if($http301) header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location: $url");
|
||||
exit(0);
|
||||
|
@@ -38,13 +38,59 @@
|
||||
*/
|
||||
class WireInput extends Wire {
|
||||
|
||||
/**
|
||||
* @var WireInputVars|null
|
||||
*
|
||||
*/
|
||||
protected $getVars = null;
|
||||
protected $postVars = null;
|
||||
protected $cookieVars = null;
|
||||
protected $whitelist = null;
|
||||
protected $urlSegments = array();
|
||||
protected $pageNum = 1;
|
||||
|
||||
/**
|
||||
* @var WireInputVars|null
|
||||
*
|
||||
*/
|
||||
protected $postVars = null;
|
||||
|
||||
/**
|
||||
* @var WireInputVars|null
|
||||
*
|
||||
*/
|
||||
protected $cookieVars = null;
|
||||
|
||||
/**
|
||||
* @var WireInputVars|null
|
||||
*
|
||||
*/
|
||||
protected $whitelist = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
*/
|
||||
protected $urlSegments = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
*/
|
||||
protected $pageNum = 1;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
*/
|
||||
protected $requestMethods = array(
|
||||
'GET' => 'GET',
|
||||
'POST' => 'POST',
|
||||
'HEAD' => 'HEAD',
|
||||
'PUT' => 'PUT',
|
||||
'DELETE' => 'DELETE',
|
||||
'OPTIONS' => 'OPTIONS',
|
||||
);
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->useFuel(false);
|
||||
$this->unregisterGLOBALS();
|
||||
@@ -537,6 +583,22 @@ class WireInput extends Wire {
|
||||
return $this->wire('config')->https ? 'https' : 'http';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current request method (i.e. GET, POST) or blank if not known
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function requestMethod() {
|
||||
if(isset($_SERVER['REQUEST_METHOD'])) {
|
||||
$m = strtoupper($_SERVER['REQUEST_METHOD']);
|
||||
$requestMethod = isset($this->requestMethods[$m]) ? $this->requestMethods[$m] : '';
|
||||
} else {
|
||||
$requestMethod = '';
|
||||
}
|
||||
return $requestMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Emulate register globals OFF
|
||||
*
|
||||
|
@@ -63,6 +63,7 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
|
||||
'summary' => 'Build a page finding selector visually.',
|
||||
'author' => 'Avoine + ProcessWire',
|
||||
'autoload' => "template=admin",
|
||||
'addFlag' => Modules::flagsNoUserConfig
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,8 @@ class LanguageSupport extends WireData implements Module, ConfigurableModule {
|
||||
'installs' => array(
|
||||
'ProcessLanguage',
|
||||
'ProcessLanguageTranslator',
|
||||
)
|
||||
),
|
||||
'addFlag' => Modules::flagsNoUserConfig
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@ class ProcessField extends Process implements ConfigurableModule {
|
||||
'permission' => 'field-admin', // add this permission if you want this Process available for roles other than Superuser
|
||||
'icon' => 'cube',
|
||||
'useNavJSON' => true,
|
||||
'addFlag' => Modules::flagsNoUserConfig
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -21,10 +21,10 @@ $(document).ready(function() {
|
||||
|
||||
$("button.ProcessModuleSettings").click(function() {
|
||||
var $a = $(this).parents('tr').find('.ConfigurableModule').parent('a');
|
||||
window.location.href = $a.attr('href');
|
||||
window.location.href = $a.attr('href') + '&collapse_info=1';
|
||||
});
|
||||
|
||||
if($('#modules_form').size() > 0) {
|
||||
if($('#modules_form').length > 0) {
|
||||
$('#modules_form').WireTabs({
|
||||
items: $(".Inputfields li.WireTab"),
|
||||
rememberTabs: true
|
||||
|
@@ -1 +1 @@
|
||||
$(document).ready(function(){$(".not_installed").parent("a").css("opacity",0.6).click(function(){var b=$(this).children(".not_installed").attr("data-name");var d=$(".install_"+b+":visible");var c=d.attr("disabled");if(d.size()){d.effect("highlight",1000)}else{var a=$(this).css("color");$(this).closest("tr").find(".requires").attr("data-color",$(this).css("color")).css("color",a).effect("highlight",1000)}return false});$("button.ProcessModuleSettings").click(function(){var a=$(this).parents("tr").find(".ConfigurableModule").parent("a");window.location.href=a.attr("href")});if($("#modules_form").size()>0){$("#modules_form").WireTabs({items:$(".Inputfields li.WireTab"),rememberTabs:true})}$("select.modules_section_select").change(function(){var b=$(this).val();var a=$(this).parent("p").siblings(".modules_section");if(b==""){a.show()}else{a.hide();a.filter(".modules_"+b).show()}document.cookie=$(this).attr("name")+"="+b;return true}).change();$(document).on("click","#head_button a",function(){document.cookie="WireTabs=tab_new_modules";return true});$("#Inputfield_new_seconds").change(function(){$(this).parents("form").submit()});$("#wrap_upload_module").removeClass("InputfieldItemList")});
|
||||
$(document).ready(function(){$(".not_installed").parent("a").css("opacity",0.6).click(function(){var b=$(this).children(".not_installed").attr("data-name");var d=$(".install_"+b+":visible");var c=d.attr("disabled");if(d.size()){d.effect("highlight",1000)}else{var a=$(this).css("color");$(this).closest("tr").find(".requires").attr("data-color",$(this).css("color")).css("color",a).effect("highlight",1000)}return false});$("button.ProcessModuleSettings").click(function(){var a=$(this).parents("tr").find(".ConfigurableModule").parent("a");window.location.href=a.attr("href")+"&collapse_info=1"});if($("#modules_form").length>0){$("#modules_form").WireTabs({items:$(".Inputfields li.WireTab"),rememberTabs:true})}$("select.modules_section_select").change(function(){var b=$(this).val();var a=$(this).parent("p").siblings(".modules_section");if(b==""){a.show()}else{a.hide();a.filter(".modules_"+b).show()}document.cookie=$(this).attr("name")+"="+b;return true}).change();$(document).on("click","#head_button a",function(){document.cookie="WireTabs=tab_new_modules";return true});$("#Inputfield_new_seconds").change(function(){$(this).parents("form").submit()});$("#wrap_upload_module").removeClass("InputfieldItemList")});
|
@@ -188,10 +188,18 @@ class ProcessModule extends Process {
|
||||
sort($moduleNames);
|
||||
|
||||
foreach($moduleNames as $moduleName) {
|
||||
|
||||
$info = $this->wire('modules')->getModuleInfoVerbose($moduleName);
|
||||
|
||||
if($site && $info['core']) continue;
|
||||
if($core && !$info['core']) continue;
|
||||
if($configurable && (!$info['configurable'] || !$info['installed'])) continue;
|
||||
|
||||
if($configurable) {
|
||||
if(!$info['configurable'] || !$info['installed']) continue;
|
||||
$flags = $this->wire('modules')->getFlags($moduleName);
|
||||
if($flags & Modules::flagsNoUserConfig) continue;
|
||||
}
|
||||
|
||||
if($install) {
|
||||
// exclude already installed modules
|
||||
if($info['installed']) continue;
|
||||
@@ -206,6 +214,7 @@ class ProcessModule extends Process {
|
||||
|
||||
$url = $install ? "installConfirm" : "edit";
|
||||
$url .= "?name=$info[name]";
|
||||
if($configurable) $url .= "&collapse_info=1";
|
||||
|
||||
$data['list'][$_label] = array(
|
||||
'url' => $url,
|
||||
@@ -366,7 +375,12 @@ class ProcessModule extends Process {
|
||||
$siteModulesArray[$name] = $installed;
|
||||
}
|
||||
|
||||
if($info['configurable'] && $info['installed']) $configurableArray[$name] = $installed;
|
||||
if($info['configurable'] && $info['installed']) {
|
||||
$flags = $this->modules->getFlags($name);
|
||||
if(!($flags & Modules::flagsNoUserConfig)) {
|
||||
$configurableArray[$name] = $installed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form = $this->modules->get('InputfieldForm');
|
||||
@@ -713,10 +727,12 @@ class ProcessModule extends Process {
|
||||
$editUrl = '#';
|
||||
|
||||
} else if($configurable) {
|
||||
|
||||
$buttons .=
|
||||
"<button type='button' class='ProcessModuleSettings ui-state-default ui-button'>" .
|
||||
"<span class='ui-button-text'><i class='fa fa-cog'></i> " . $this->_x('Settings', 'button') . "</span></button>"; // Text for 'Settings' button
|
||||
$flags = $this->modules->getFlags($name);
|
||||
if(!($flags & Modules::flagsNoUserConfig)) {
|
||||
$buttons .=
|
||||
"<button type='button' class='ProcessModuleSettings ui-state-default ui-button'>" .
|
||||
"<span class='ui-button-text'><i class='fa fa-cog'></i> " . $this->_x('Settings', 'button') . "</span></button>"; // Text for 'Settings' button
|
||||
}
|
||||
}
|
||||
|
||||
if($buttons) $buttons = "<small class='buttons'>$buttons</small>";
|
||||
@@ -1132,7 +1148,11 @@ class ProcessModule extends Process {
|
||||
$out = '';
|
||||
$moduleId = $this->modules->getModuleID($moduleName);
|
||||
$languages = $this->wire('languages');
|
||||
$collapseInfo = $this->wire('input')->get('collapse_info') || $this->wire('input')->get('modal') ? '&collapse_info=1': '';
|
||||
$submitSave = $this->input->post('submit_save_module');
|
||||
$collapseInfo = '';
|
||||
if($submitSave || $this->wire('input')->get('collapse_info') || $this->wire('input')->get('modal')) {
|
||||
$collapseInfo = '&collapse_info=1';
|
||||
}
|
||||
if(!$moduleId) {
|
||||
$this->error("Unknown module");
|
||||
return $this->session->redirect('./');
|
||||
@@ -1254,7 +1274,6 @@ class ProcessModule extends Process {
|
||||
}
|
||||
|
||||
// check for submitted form
|
||||
$submitSave = $this->input->post('submit_save_module');
|
||||
if($submitSave) {
|
||||
|
||||
if(is_null($data)) $data = $this->modules->getModuleConfigData($moduleName);
|
||||
|
@@ -10,5 +10,6 @@
|
||||
"permissions": {
|
||||
"page-lister": "Use Page Lister"
|
||||
},
|
||||
"useNavJSON": true
|
||||
"useNavJSON": true,
|
||||
"addFlag": 32
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ class ProcessPageType extends Process implements ConfigurableModule, WirePageEdi
|
||||
'summary' => __('List, Edit and Add pages of a specific type', __FILE__), // getModuleInfo summary
|
||||
'permanent' => true,
|
||||
'useNavJSON' => true,
|
||||
'addFlag' => Modules::flagsNoUserConfig
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -152,7 +152,7 @@ $(document).ready(function() {
|
||||
|
||||
// instantiate the WireTabs
|
||||
var $templateEdit = $("#ProcessTemplateEdit");
|
||||
if($templateEdit.size() > 0) {
|
||||
if($templateEdit.length > 0) {
|
||||
$templateEdit.find('script').remove();
|
||||
$templateEdit.WireTabs({
|
||||
items: $(".Inputfields li.WireTab"),
|
||||
|
@@ -1 +1 @@
|
||||
$(document).ready(function(){$("#wrap_filter_system input").click(function(){$(this).parents("form").submit()});$("#filter_field").change(function(){$(this).parents("form").submit()});var a=function(){if($("#redirectLogin_-1:checked").size()>0){$("#wrap_redirectLoginURL").slideDown()}else{$("#wrap_redirectLoginURL").hide()}};var f=function(){var g=["#wrap_redirectLogin","#wrap_guestSearchable"];if($("#roles_37").is(":checked")){$("#wrap_redirectLoginURL").hide();$(g).each(function(i,j){var h=$(j);if(h.is(".InputfieldStateCollapsed")){h.hide()}else{h.slideUp()}});$("input.viewRoles").attr("checked","checked")}else{$(g).each(function(i,j){var h=$(j);if(h.is(":visible")){return}h.slideDown("fast",function(){if(!h.is(".InputfieldStateCollapsed")){return}h.find(".InputfieldStateToggle").click()})});a()}};$("#wrap_useRoles input").click(function(){if($("#useRoles_1:checked").size()>0){$("#wrap_redirectLogin").hide();$("#wrap_guestSearchable").hide();$("#useRolesYes").slideDown();$("#wrap_useRoles > label").click();$("input.viewRoles").attr("checked","checked")}else{$("#useRolesYes").slideUp();$("#accessOverrides:visible").slideUp()}});if($("#useRoles_0:checked").size()>0){$("#useRolesYes").hide();$("#accessOverrides").hide()}$("#roles_37").click(f);$("input.viewRoles:not(#roles_37)").click(function(){var g=$(this);if($("#roles_37").is(":checked")){return false}return true});var d=function(){var h=$("#roles_editor input.editRoles");var g=0;h.each(function(){var j=$(this);if(j.is(":disabled")){return false}var i=$("input.createRoles[value="+j.attr("value")+"]");if(j.is(":checked")){g++;i.removeAttr("disabled")}else{i.removeAttr("checked").attr("disabled","disabled")}});if(g){$("#accessOverrides").slideDown()}else{$("#accessOverrides").hide()}return true};var e=function(){var g=0;$("#roles_editor input.editRoles").each(function(){if(!$(this).is(":disabled")&&$(this).is(":checked")){g++}});$("#roles_editor input.addRoles").each(function(){if(!$(this).is(":disabled")&&$(this).is(":checked")){g++}});g>0?$("#wrap_noInherit").slideDown():$("#wrap_noInherit").hide()};$("#roles_editor input.editRoles").click(d);$("#roles_editor input.editRoles, #roles_editor input.addRoles").click(e);d();e();$("#wrap_redirectLogin input").click(a);var c=function(){$ol=$("#fieldgroup_fields").prev("ol.asmList");$ol.find("span.asmFieldsetIndent").remove();$ol.children("li").children("span.asmListItemLabel").children("a:contains('_END')").each(function(){var h=$(this).text();if(h.substring(h.length-4)!="_END"){return}h=h.substring(0,h.length-4);var j=$(this).parents("li.asmListItem");j.addClass("asmFieldset asmFieldsetEnd");while(1){j=j.prev("li.asmListItem");if(j.size()<1){break}var g=j.children("span.asmListItemLabel");var i=g.text();if(i==h){j.addClass("asmFieldset asmFieldsetStart");break}g.prepend($('<span class="asmFieldsetIndent"></span>'))}})};$("#fieldgroup_fields").change(c).bind("init",c);f();a();var b=$("#ProcessTemplateEdit");if(b.size()>0){b.find("script").remove();b.WireTabs({items:$(".Inputfields li.WireTab"),id:"TemplateEditTabs",skipRememberTabIDs:["WireTabDelete"]})}$("#export_data").click(function(){$(this).select()});$(".import_toggle input[type=radio]").change(function(){var g=$(this).parents("p.import_toggle").next("table");var h=$(this).closest(".InputfieldFieldset");if($(this).is(":checked")&&$(this).val()==0){g.hide();h.addClass("ui-priority-secondary")}else{g.show();h.removeClass("ui-priority-secondary")}}).change();$("#import_form table td:not(:first-child)").each(function(){var g=$(this).html();var h=false;if(g.substring(0,1)=="{"){g="<pre>"+g+"</pre>";g=g.replace(/<br>/g,"");h=true}if(h){$(this).html(g)}});$("#fieldgroup_fields").change(function(){$("#_fieldgroup_fields_changed").val("changed")})});
|
||||
$(document).ready(function(){$("#wrap_filter_system input").click(function(){$(this).parents("form").submit()});$("#filter_field").change(function(){$(this).parents("form").submit()});var a=function(){if($("#redirectLogin_-1:checked").size()>0){$("#wrap_redirectLoginURL").slideDown()}else{$("#wrap_redirectLoginURL").hide()}};var f=function(){var g=["#wrap_redirectLogin","#wrap_guestSearchable"];if($("#roles_37").is(":checked")){$("#wrap_redirectLoginURL").hide();$(g).each(function(i,j){var h=$(j);if(h.is(".InputfieldStateCollapsed")){h.hide()}else{h.slideUp()}});$("input.viewRoles").attr("checked","checked")}else{$(g).each(function(i,j){var h=$(j);if(h.is(":visible")){return}h.slideDown("fast",function(){if(!h.is(".InputfieldStateCollapsed")){return}h.find(".InputfieldStateToggle").click()})});a()}};$("#wrap_useRoles input").click(function(){if($("#useRoles_1:checked").size()>0){$("#wrap_redirectLogin").hide();$("#wrap_guestSearchable").hide();$("#useRolesYes").slideDown();$("#wrap_useRoles > label").click();$("input.viewRoles").attr("checked","checked")}else{$("#useRolesYes").slideUp();$("#accessOverrides:visible").slideUp()}});if($("#useRoles_0:checked").size()>0){$("#useRolesYes").hide();$("#accessOverrides").hide()}$("#roles_37").click(f);$("input.viewRoles:not(#roles_37)").click(function(){var g=$(this);if($("#roles_37").is(":checked")){return false}return true});var d=function(){var h=$("#roles_editor input.editRoles");var g=0;h.each(function(){var j=$(this);if(j.is(":disabled")){return false}var i=$("input.createRoles[value="+j.attr("value")+"]");if(j.is(":checked")){g++;i.removeAttr("disabled")}else{i.removeAttr("checked").attr("disabled","disabled")}});if(g){$("#accessOverrides").slideDown()}else{$("#accessOverrides").hide()}return true};var e=function(){var g=0;$("#roles_editor input.editRoles").each(function(){if(!$(this).is(":disabled")&&$(this).is(":checked")){g++}});$("#roles_editor input.addRoles").each(function(){if(!$(this).is(":disabled")&&$(this).is(":checked")){g++}});g>0?$("#wrap_noInherit").slideDown():$("#wrap_noInherit").hide()};$("#roles_editor input.editRoles").click(d);$("#roles_editor input.editRoles, #roles_editor input.addRoles").click(e);d();e();$("#wrap_redirectLogin input").click(a);var c=function(){$ol=$("#fieldgroup_fields").prev("ol.asmList");$ol.find("span.asmFieldsetIndent").remove();$ol.children("li").children("span.asmListItemLabel").children("a:contains('_END')").each(function(){var h=$(this).text();if(h.substring(h.length-4)!="_END"){return}h=h.substring(0,h.length-4);var j=$(this).parents("li.asmListItem");j.addClass("asmFieldset asmFieldsetEnd");while(1){j=j.prev("li.asmListItem");if(j.size()<1){break}var g=j.children("span.asmListItemLabel");var i=g.text();if(i==h){j.addClass("asmFieldset asmFieldsetStart");break}g.prepend($('<span class="asmFieldsetIndent"></span>'))}})};$("#fieldgroup_fields").change(c).bind("init",c);f();a();var b=$("#ProcessTemplateEdit");if(b.length>0){b.find("script").remove();b.WireTabs({items:$(".Inputfields li.WireTab"),id:"TemplateEditTabs",skipRememberTabIDs:["WireTabDelete"]})}$("#export_data").click(function(){$(this).select()});$(".import_toggle input[type=radio]").change(function(){var g=$(this).parents("p.import_toggle").next("table");var h=$(this).closest(".InputfieldFieldset");if($(this).is(":checked")&&$(this).val()==0){g.hide();h.addClass("ui-priority-secondary")}else{g.show();h.removeClass("ui-priority-secondary")}}).change();$("#import_form table td:not(:first-child)").each(function(){var g=$(this).html();var h=false;if(g.substring(0,1)=="{"){g="<pre>"+g+"</pre>";g=g.replace(/<br>/g,"");h=true}if(h){$(this).html(g)}});$("#fieldgroup_fields").change(function(){$("#_fieldgroup_fields_changed").val("changed")})});
|
@@ -1253,7 +1253,7 @@ jQuery(document).ready(function($) {
|
||||
$(window).resize(windowResized);
|
||||
$("ul.WireTabs > li > a").click(tabClicked);
|
||||
|
||||
$(document).on('reload', '.Inputfield', function(event) {
|
||||
$(document).on('reload', '.Inputfield', function(event, extraData) {
|
||||
var $t = $(this);
|
||||
var $form = $t.closest('form');
|
||||
var fieldName = $t.attr('id').replace('wrap_Inputfield_', '');
|
||||
@@ -1265,6 +1265,11 @@ jQuery(document).ready(function($) {
|
||||
}
|
||||
url += url.indexOf('?') > -1 ? '&' : '?';
|
||||
url += 'field=' + fieldName + '&reloadInputfieldAjax=' + fieldName;
|
||||
if(typeof extraData != "undefined") {
|
||||
if(typeof extraData['queryString'] != "undefined") {
|
||||
url += '&' + extraData['queryString'];
|
||||
}
|
||||
}
|
||||
consoleLog('Inputfield reload: ' + fieldName);
|
||||
$.get(url, function(data) {
|
||||
var id = $t.attr('id');
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user