├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── LICENSE ├── README ├── _bootstrap └── index.php ├── _build ├── build.schema.php ├── build.transport.php ├── data │ ├── transport.events.php │ ├── transport.menus.php │ ├── transport.plugins.php │ └── transport.settings.php ├── events │ └── events.clientconfig.php ├── resolvers │ ├── setupoptions.resolver.php │ └── tables.resolver.php ├── setup.options.php └── validators │ └── requirements.validator.php ├── _packages └── clientconfig-2.4.0-pl.transport.zip ├── assets └── components │ └── clientconfig │ ├── connector.php │ ├── css │ └── mgr │ │ └── clientconfig.css │ └── js │ └── mgr │ ├── clientconfig.class.js │ ├── extras │ └── colorpicker │ │ ├── colorpicker.css │ │ ├── colorpicker.js │ │ ├── colorpickerfield.js │ │ ├── hue.png │ │ ├── mask.png │ │ └── slider-rgb.gif │ ├── sections │ ├── admin.js │ └── home.js │ └── widgets │ ├── combos.js │ ├── grid.groups.js │ ├── grid.settings.js │ ├── window.groups.js │ ├── window.import.js │ └── window.settings.js ├── config.core.sample.php └── core └── components └── clientconfig ├── controllers ├── admin.class.php └── home.class.php ├── docs ├── changelog.txt ├── license.txt └── readme.txt ├── elements └── plugins │ └── clientconfig.plugin.php ├── index.class.php ├── lexicon ├── de │ └── default.inc.php ├── en │ └── default.inc.php ├── fi │ └── default.inc.php ├── fr │ └── default.inc.php ├── nl │ └── default.inc.php ├── pt-br │ └── default.inc.php ├── pt │ └── default.inc.php ├── ru │ └── default.inc.php └── sv │ └── default.inc.php ├── model ├── clientconfig │ ├── cgcontextvalue.class.php │ ├── cggroup.class.php │ ├── cgsetting.class.php │ ├── clientconfig.class.php │ ├── metadata.mysql.php │ └── mysql │ │ ├── cgcontextvalue.class.php │ │ ├── cgcontextvalue.map.inc.php │ │ ├── cggroup.class.php │ │ ├── cggroup.map.inc.php │ │ ├── cgsetting.class.php │ │ └── cgsetting.map.inc.php └── schema │ └── clientconfig.mysql.schema.xml ├── processors └── mgr │ ├── contexts │ └── getlist.class.php │ ├── export.class.php │ ├── fonts │ └── google │ │ └── getlist.class.php │ ├── groups │ ├── create.class.php │ ├── export.class.php │ ├── getlist.class.php │ ├── import.class.php │ ├── remove.class.php │ ├── update.class.php │ └── updatefromgrid.class.php │ ├── import.class.php │ └── settings │ ├── create.class.php │ ├── export.class.php │ ├── getcontextaware.class.php │ ├── getglobal.class.php │ ├── getlist.class.php │ ├── import.class.php │ ├── remove.class.php │ ├── save.class.php │ ├── update.class.php │ └── updatefromgrid.class.php └── templates └── home.tpl /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Summary 2 | Quick summary what's this issue about. 3 | 4 | ### Step to reproduce 5 | How to reproduce the issue, including custom code if needed. 6 | 7 | ### Observed behavior 8 | How it behaved after following steps above. 9 | 10 | ### Expected behavior 11 | How it should behave after following steps above. 12 | 13 | ### Environment 14 | ClientConfig version, MODX version, Operating System, MySQL version, PHP version, etc. 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### What does it do ? 2 | Describe the changes you did. 3 | 4 | ### Why is it needed ? 5 | Describe the issue you are solving. 6 | 7 | ### Related issue(s)/PR(s) 8 | Let us know if this is related to any issue/pull request 9 | (see https://github.com/blog/1506-closing-issues-via-pull-requests) 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | config.core.php 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mark Hamstra Web Development 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ---------------------- 2 | ClientConfig 3 | ---------------------- 4 | Author: Mark Hamstra 5 | Contact: hello@markhamstra.com 6 | ---------------------- 7 | 8 | ClientConfig is the by product of a workshop at MODXpo Europe 2012, 9 | the "Developing Extras in MODX" one. See the session page at modxpo.eu 10 | http://modxpo.eu/2012/schedule/sessions/developing-extras-for-modx-hands-on 11 | for more information and footage of the workshop. 12 | 13 | ClientConfig gives your client an user-friendly interface for making site 14 | wide changes, while you as the administrator set up the different options 15 | available to the end-user. 16 | 17 | Possible uses include: 18 | - Regularly update a slogan or tag-line in header or footer 19 | - Change call-to-action button colors based on the season 20 | - Keep contact details updated in one central location 21 | - Update the email-address a form sends notifications to 22 | -------------------------------------------------------------------------------- /_bootstrap/index.php: -------------------------------------------------------------------------------- 1 | "; 8 | /* Boot up MODX */ 9 | echo "Loading modX...\n"; 10 | require_once dirname(dirname(__FILE__)).'/config.core.php'; 11 | require_once MODX_CORE_PATH.'model/modx/modx.class.php'; 12 | $modx = new modX(); 13 | echo "Initializing manager...\n"; 14 | $modx->initialize('mgr'); 15 | $modx->getService('error','error.modError', '', ''); 16 | 17 | $componentPath = dirname(dirname(__FILE__)); 18 | 19 | $ClientConfig = $modx->getService('clientconfig','ClientConfig', $componentPath.'/core/components/clientconfig/model/clientconfig/', array( 20 | 'clientconfig.core_path' => $componentPath.'/core/components/clientconfig/', 21 | )); 22 | 23 | 24 | /* Namespace */ 25 | if (!createObject('modNamespace',array( 26 | 'name' => 'clientconfig', 27 | 'path' => $componentPath.'/core/components/clientconfig/', 28 | 'assets_path' => $componentPath.'/assets/components/clientconfig/', 29 | ),'name', true)) { 30 | echo "Error creating namespace clientconfig.\n"; 31 | } 32 | 33 | /* Path settings */ 34 | if (!createObject('modSystemSetting', array( 35 | 'key' => 'clientconfig.core_path', 36 | 'value' => $componentPath.'/core/components/clientconfig/', 37 | 'xtype' => 'textfield', 38 | 'namespace' => 'clientconfig', 39 | 'area' => 'Paths', 40 | 'editedon' => time(), 41 | ), 'key', false)) { 42 | echo "Error creating clientconfig.core_path setting.\n"; 43 | } 44 | 45 | if (!createObject('modSystemSetting', array( 46 | 'key' => 'clientconfig.assets_path', 47 | 'value' => $componentPath.'/assets/components/clientconfig/', 48 | 'xtype' => 'textfield', 49 | 'namespace' => 'clientconfig', 50 | 'area' => 'Paths', 51 | 'editedon' => time(), 52 | ), 'key', false)) { 53 | echo "Error creating clientconfig.assets_path setting.\n"; 54 | } 55 | 56 | /* Fetch assets url */ 57 | $url = 'http'; 58 | if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) { 59 | $url .= 's'; 60 | } 61 | $url .= '://'.$_SERVER["SERVER_NAME"]; 62 | if ($_SERVER['SERVER_PORT'] != '80') { 63 | $url .= ':'.$_SERVER['SERVER_PORT']; 64 | } 65 | $requestUri = $_SERVER['REQUEST_URI']; 66 | $bootstrapPos = strpos($requestUri, '_bootstrap/'); 67 | $requestUri = rtrim(substr($requestUri, 0, $bootstrapPos), '/').'/'; 68 | $assetsUrl = "{$url}{$requestUri}assets/components/clientconfig/"; 69 | 70 | if (!createObject('modSystemSetting', array( 71 | 'key' => 'clientconfig.assets_url', 72 | 'value' => $assetsUrl, 73 | 'xtype' => 'textfield', 74 | 'namespace' => 'clientconfig', 75 | 'area' => 'Paths', 76 | 'editedon' => time(), 77 | ), 'key', false)) { 78 | echo "Error creating clientconfig.assets_url setting.\n"; 79 | } 80 | if (!createObject('modPlugin', array( 81 | 'name' => 'ClientConfig', 82 | 'static' => true, 83 | 'static_file' => $componentPath.'/core/components/clientconfig/elements/plugins/clientconfig.plugin.php', 84 | ), 'name', true)) { 85 | echo "Error creating ClientConfig Plugin.\n"; 86 | } 87 | $vcPlugin = $modx->getObject('modPlugin', array('name' => 'ClientConfig')); 88 | if ($vcPlugin) { 89 | if (!createObject('modPluginEvent', array( 90 | 'pluginid' => $vcPlugin->get('id'), 91 | 'event' => 'OnMODXInit', 92 | 'priority' => 0, 93 | ), array('pluginid','event'), false)) { 94 | echo "Error creating modPluginEvent.\n"; 95 | } 96 | } 97 | 98 | if (!createObject('modMenu', array( 99 | 'text' => 'clientconfig', 100 | 'parent' => 'components', 101 | 'description' => 'clientconfig.desc', 102 | 'menuindex' => '0', 103 | 'action' => 'home', 104 | 'namespace' => 'clientconfig', 105 | 'params' => '', 106 | 'handler' => '', 107 | ), 'text', true)) { 108 | echo "Error creating menu.\n"; 109 | } 110 | 111 | //$settings = include dirname(dirname(__FILE__)).'/_build/data/settings.php'; 112 | //foreach ($settings as $key => $opts) { 113 | // if (!createObject('modSystemSetting', array( 114 | // 'key' => 'clientconfig.' . $key, 115 | // 'value' => $opts['value'], 116 | // 'xtype' => (isset($opts['xtype'])) ? $opts['xtype'] : 'textfield', 117 | // 'namespace' => 'clientconfig', 118 | // 'area' => $opts['area'], 119 | // 'editedon' => time(), 120 | // ), 'key', false)) { 121 | // echo "Error creating clientconfig.".$key." setting.\n"; 122 | // } 123 | //} 124 | 125 | 126 | /* Create the tables */ 127 | $objectContainers = array( 128 | 'cgGroup', 129 | 'cgSetting', 130 | 'cgContextValue', 131 | ); 132 | echo "Creating tables...\n"; 133 | $manager = $modx->getManager(); 134 | foreach ($objectContainers as $oC) { 135 | $manager->createObjectContainer($oC); 136 | } 137 | $manager->addField('cgSetting', 'process_options'); 138 | echo "Done."; 139 | 140 | // Refresh the cache 141 | $modx->cacheManager->refresh(); 142 | 143 | 144 | /** 145 | * Creates an object. 146 | * 147 | * @param string $className 148 | * @param array $data 149 | * @param string $primaryField 150 | * @param bool $update 151 | * @return bool 152 | */ 153 | function createObject ($className = '', array $data = array(), $primaryField = '', $update = true) { 154 | global $modx; 155 | /* @var xPDOObject $object */ 156 | $object = null; 157 | 158 | /* Attempt to get the existing object */ 159 | if (!empty($primaryField)) { 160 | if (is_array($primaryField)) { 161 | $condition = array(); 162 | foreach ($primaryField as $key) { 163 | $condition[$key] = $data[$key]; 164 | } 165 | } 166 | else { 167 | $condition = array($primaryField => $data[$primaryField]); 168 | } 169 | $object = $modx->getObject($className, $condition); 170 | if ($object instanceof $className) { 171 | if ($update) { 172 | $object->fromArray($data); 173 | return $object->save(); 174 | } else { 175 | $condition = $modx->toJSON($condition); 176 | echo "Skipping {$className} {$condition}: already exists.\n"; 177 | return true; 178 | } 179 | } 180 | } 181 | 182 | /* Create new object if it doesn't exist */ 183 | if (!$object) { 184 | $object = $modx->newObject($className); 185 | $object->fromArray($data, '', true); 186 | return $object->save(); 187 | } 188 | 189 | return false; 190 | } 191 | -------------------------------------------------------------------------------- /_build/build.schema.php: -------------------------------------------------------------------------------- 1 | $root, 22 | 'core' => $root.'core/components/'.PKG_NAME_LOWER.'/', 23 | 'model' => $root.'core/components/'.PKG_NAME_LOWER.'/model/', 24 | 'assets' => $root.'assets/components/'.PKG_NAME_LOWER.'/', 25 | ); 26 | 27 | /* load modx and configs */ 28 | require_once dirname(dirname(__FILE__)) . '/config.core.php'; 29 | include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; 30 | $modx= new modX(); 31 | $modx->initialize('mgr'); 32 | $modx->loadClass('transport.modPackageBuilder','',false, true); 33 | $modx->setLogLevel(modX::LOG_LEVEL_INFO); 34 | $modx->setLogTarget('ECHO'); 35 | echo '
'; /* used for nice formatting of log messages */
36 | 
37 | $manager = $modx->getManager();
38 | $generator = $manager->getGenerator();
39 | 
40 | $generator->parseSchema($sources['model'] . 'schema/'.PKG_NAME_LOWER.'.mysql.schema.xml', $sources['model']);
41 | 
42 | 
43 | /* Create and/or dump data */
44 | $modx->addPackage(PKG_NAME_LOWER, $sources['model']);
45 | 
46 | $objects = array(
47 |     'cgSetting',
48 |     'cgGroup',
49 |     'cgContextValue',
50 | );
51 | 
52 | foreach ($objects as $object) {
53 |     if(isset($_REQUEST['dump']) && $_REQUEST['dump'] == 'true') {
54 |         $manager->removeObjectContainer($object);
55 |     }
56 |     $manager->createObjectContainer($object);
57 | }
58 | $manager->addField('cgSetting','options');
59 | $manager->addField('cgSetting','sortorder');
60 | $manager->addField('cgGroup','sortorder');
61 | $manager->alterField('cgSetting', 'value', array());
62 | $manager->alterField('cgSetting', 'default', array());
63 | $manager->alterField('cgSetting', 'options', array());
64 | $manager->alterField('cgSetting', 'description', array());
65 | $manager->alterField('cgGroup', 'description', array());
66 | $manager->addField('cgSetting', 'source');
67 | 
68 | $mtime= microtime();
69 | $mtime= explode(" ", $mtime);
70 | $mtime= $mtime[1] + $mtime[0];
71 | $tend= $mtime;
72 | $totalTime= ($tend - $tstart);
73 | $totalTime= sprintf("%2.4f s", $totalTime);
74 | 
75 | echo "\nExecution time: {$totalTime}\n";
76 | 
77 | exit ();
78 | 


--------------------------------------------------------------------------------
/_build/build.transport.php:
--------------------------------------------------------------------------------
  1 | ','',$o);
 12 |     $o = trim($o);
 13 |     return $o;
 14 | }
 15 | 
 16 | $mtime = microtime();
 17 | $mtime = explode(" ", $mtime);
 18 | $mtime = $mtime[1] + $mtime[0];
 19 | $tstart = $mtime;
 20 | set_time_limit(0);
 21 | 
 22 | if (!defined('MOREPROVIDER_BUILD')) {
 23 |     /* define version */
 24 |     define('PKG_NAME','ClientConfig');
 25 |     define('PKG_NAME_LOWER',strtolower(PKG_NAME));
 26 |     define('PKG_VERSION','2.5.0');
 27 |     define('PKG_RELEASE','pl');
 28 | 
 29 |     /* load modx */
 30 |     require_once dirname(dirname(__FILE__)) . '/config.core.php';
 31 |     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
 32 |     $modx= new modX();
 33 |     $modx->initialize('mgr');
 34 |     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
 35 |     $modx->setLogTarget('ECHO');
 36 | 
 37 | 
 38 |     echo '
';
 39 |     flush();
 40 |     $targetDirectory = dirname(dirname(__FILE__)) . '/_packages/';
 41 | }
 42 | else {
 43 |     $targetDirectory = MOREPROVIDER_BUILD_TARGET;
 44 | }
 45 | 
 46 | $root = dirname(dirname(__FILE__)).'/';
 47 | $sources= array (
 48 |     'root' => $root,
 49 |     'build' => $root .'_build/',
 50 |     'events' => $root . '_build/events/',
 51 |     'resolvers' => $root . '_build/resolvers/',
 52 |     'validators' => $root . '_build/validators/',
 53 |     'data' => $root . '_build/data/',
 54 |     'source_core' => $root.'core/components/'.PKG_NAME_LOWER,
 55 |     'source_assets' => $root.'assets/components/'.PKG_NAME_LOWER,
 56 |     'plugins' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/plugins/',
 57 |     'snippets' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/snippets/',
 58 |     'lexicon' => $root . 'core/components/'.PKG_NAME_LOWER.'/lexicon/',
 59 |     'docs' => $root.'core/components/'.PKG_NAME_LOWER.'/docs/',
 60 |     'model' => $root.'core/components/'.PKG_NAME_LOWER.'/model/',
 61 | );
 62 | 
 63 | $modx->loadClass('transport.modPackageBuilder','',false, true);
 64 | 
 65 | // Be sure to use MODX 2.x to build the package for cross compatability. If built with 3.x, the installer will only work on 3.x.
 66 | $builder = class_exists(\MODX\Revolution\Transport\modPackageBuilder::class) 
 67 |     ? new \MODX\Revolution\Transport\modPackageBuilder($modx) : new \modPackageBuilder($modx);
 68 | 
 69 | $builder->directory = $targetDirectory;
 70 | $builder->createPackage(PKG_NAME_LOWER,PKG_VERSION,PKG_RELEASE);
 71 | $builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/','{assets_path}components/'.PKG_NAME_LOWER.'/');
 72 | $modx->getService('lexicon','modLexicon');
 73 | 
 74 | /* create category */
 75 | $category= $modx->newObject('modCategory');
 76 | $category->set('id',1);
 77 | $category->set('category',PKG_NAME);
 78 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in category.'); flush();
 79 | 
 80 | /* Settings */
 81 | $settings = include_once $sources['data'].'transport.settings.php';
 82 | $attributes= array(
 83 |     xPDOTransport::UNIQUE_KEY => 'key',
 84 |     xPDOTransport::PRESERVE_KEYS => true,
 85 |     xPDOTransport::UPDATE_OBJECT => false,
 86 | );
 87 | if (!is_array($settings)) { $modx->log(modX::LOG_LEVEL_FATAL,'Adding settings failed.'); }
 88 | foreach ($settings as $setting) {
 89 |     $vehicle = $builder->createVehicle($setting,$attributes);
 90 |     $builder->putVehicle($vehicle);
 91 | }
 92 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($settings).' system settings.'); flush();
 93 | unset($settings,$setting,$attributes);
 94 | 
 95 | /* Events */
 96 | $events = include $sources['data'] . 'transport.events.php';
 97 | $attr =  array(
 98 |     xPDOTransport::UNIQUE_KEY => 'name',
 99 |     xPDOTransport::PRESERVE_KEYS => true,
100 |     xPDOTransport::UPDATE_OBJECT => false,
101 | );
102 | foreach ($events as $e) {
103 |     $vehicle = $builder->createVehicle($e, $attr);
104 |     $builder->putVehicle($vehicle);
105 | }
106 | 
107 | /* add plugins */
108 | $plugins = include $sources['data'].'transport.plugins.php';
109 | if (!is_array($plugins)) { $modx->log(modX::LOG_LEVEL_FATAL,'Adding plugins failed.'); }
110 | $attributes= array(
111 |     xPDOTransport::UNIQUE_KEY => 'name',
112 |     xPDOTransport::PRESERVE_KEYS => false,
113 |     xPDOTransport::UPDATE_OBJECT => true,
114 |     xPDOTransport::RELATED_OBJECTS => true,
115 |     xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
116 |         'PluginEvents' => array(
117 |             xPDOTransport::PRESERVE_KEYS => true,
118 |             xPDOTransport::UPDATE_OBJECT => false,
119 |             xPDOTransport::UNIQUE_KEY => array('pluginid','event'),
120 |         ),
121 |     ),
122 | );
123 | foreach ($plugins as $plugin) {
124 |     $vehicle = $builder->createVehicle($plugin, $attributes);
125 |     $builder->putVehicle($vehicle);
126 | }
127 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($plugins).' plugins.'); flush();
128 | unset($plugins,$plugin,$attributes);
129 | 
130 | /* Add actions */
131 | require_once ($sources['data'].'transport.menus.php');
132 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in actions');
133 | 
134 | $attr = array(
135 |     xPDOTransport::UNIQUE_KEY => 'category',
136 |     xPDOTransport::PRESERVE_KEYS => false,
137 |     xPDOTransport::UPDATE_OBJECT => true,
138 |     xPDOTransport::RELATED_OBJECTS => false,
139 |     /*xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
140 |         'Snippets' => array(
141 |             xPDOTransport::PRESERVE_KEYS => false,
142 |             xPDOTransport::UPDATE_OBJECT => true,
143 |             xPDOTransport::UNIQUE_KEY => 'name',
144 |         ),
145 |     ),*/
146 | );
147 | $vehicle = $builder->createVehicle($category,$attr);
148 | // Add the validator to check server requirements
149 | $vehicle->validate('php', array('source' => $sources['validators'] . 'requirements.validator.php'));
150 | // Add other resolves
151 | $vehicle->resolve('file',array(
152 |     'source' => $sources['source_core'],
153 |     'target' => "return MODX_CORE_PATH . 'components/';",
154 | ));
155 | $vehicle->resolve('file',array(
156 |     'source' => $sources['source_assets'],
157 |     'target' => "return MODX_ASSETS_PATH . 'components/';",
158 | ));
159 | 
160 | $vehicle->resolve('php',array(
161 |     'source' => $sources['resolvers'] . 'tables.resolver.php',
162 | ));
163 | $vehicle->resolve('php',array(
164 |     'source' => $sources['resolvers'] . 'setupoptions.resolver.php',
165 | ));
166 | 
167 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in resolvers.'); flush();
168 | $builder->putVehicle($vehicle);
169 | 
170 | /* now pack in the license file, readme and setup options */
171 | $builder->setPackageAttributes(array(
172 |     'license' => file_get_contents($sources['docs'] . 'license.txt'),
173 |     'readme' => file_get_contents($sources['docs'] . 'readme.txt'),
174 |     'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'),
175 |     'setup-options' => array(
176 |         'source' => $sources['build'].'setup.options.php',
177 |     ),
178 | ));
179 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in package attributes.'); flush();
180 | 
181 | $modx->log(modX::LOG_LEVEL_INFO,'Packing...'); flush();
182 | $builder->pack();
183 | 
184 | $mtime = microtime();
185 | $mtime = explode(" ", $mtime);
186 | $mtime = $mtime[1] + $mtime[0];
187 | $tend = $mtime;
188 | $totalTime = ($tend - $tstart);
189 | $totalTime = sprintf("%2.4f s", $totalTime);
190 | 
191 | $modx->log(modX::LOG_LEVEL_INFO,"\n
Package Built.
\nExecution time: {$totalTime}\n"); 192 | 193 | -------------------------------------------------------------------------------- /_build/data/transport.events.php: -------------------------------------------------------------------------------- 1 | newObject('modEvent'); 6 | $events[0]->set('name', 'ClientConfig_ConfigChange'); 7 | $events[0]->set('service', 6); 8 | $events[0]->set('groupname', 'clientconfig'); 9 | 10 | return $events; -------------------------------------------------------------------------------- /_build/data/transport.menus.php: -------------------------------------------------------------------------------- 1 | newObject('modMenu'); 4 | $menu->fromArray(array( 5 | 'text' => 'clientconfig', 6 | 'parent' => 'components', 7 | 'description' => 'clientconfig.desc', 8 | 'menuindex' => '0', 9 | 'action' => 'home', 10 | 'namespace' => 'clientconfig', 11 | 'params' => '', 12 | 'handler' => '', 13 | 'icon' => '', 14 | ),'',true,true); 15 | 16 | $vehicle = $builder->createVehicle($menu,array ( 17 | xPDOTransport::PRESERVE_KEYS => true, 18 | xPDOTransport::UPDATE_OBJECT => true, 19 | xPDOTransport::UNIQUE_KEY => 'text', 20 | xPDOTransport::RELATED_OBJECTS => false, 21 | )); 22 | $builder->putVehicle($vehicle); 23 | unset ($vehicle,$childActions,$action,$menu); 24 | -------------------------------------------------------------------------------- /_build/data/transport.plugins.php: -------------------------------------------------------------------------------- 1 | newObject('modPlugin'); 6 | $plugins[0]->set('id',1); 7 | $plugins[0]->set('name','ClientConfig'); 8 | $plugins[0]->set('description','Sets system settings from the Client Config CMP.'); 9 | $plugins[0]->set('plugincode', getSnippetContent($sources['plugins'] . 'clientconfig.plugin.php')); 10 | $plugins[0]->set('category', 0); 11 | 12 | $events = include $sources['events'].'events.clientconfig.php'; 13 | if (is_array($events) && !empty($events)) { 14 | $plugins[0]->addMany($events); 15 | $modx->log(xPDO::LOG_LEVEL_INFO,'Packaged in '.count($events).' Plugin Events for ClientConfig.'); flush(); 16 | } else { 17 | $modx->log(xPDO::LOG_LEVEL_ERROR,'Could not find plugin events for ClientConfig!'); 18 | } 19 | unset($events); 20 | 21 | return $plugins; 22 | -------------------------------------------------------------------------------- /_build/data/transport.settings.php: -------------------------------------------------------------------------------- 1 | 'Administrator', 5 | 'clear_cache' => true, 6 | 'vertical_tabs' => false, 7 | 'context_aware' => false, 8 | 'google_fonts_api_key' => '', 9 | ); 10 | 11 | $settings = array(); 12 | 13 | foreach ($s as $key => $value) { 14 | if (is_string($value) || is_int($value)) { $type = 'textfield'; } 15 | elseif (is_bool($value)) { $type = 'combo-boolean'; } 16 | else { $type = 'textfield'; } 17 | 18 | $parts = explode('.',$key); 19 | if (count($parts) == 1) { $area = 'Default'; } 20 | else { $area = $parts[0]; } 21 | 22 | $settings['clientconfig.'.$key] = $modx->newObject('modSystemSetting'); 23 | $settings['clientconfig.'.$key]->set('key', 'clientconfig.'.$key); 24 | $settings['clientconfig.'.$key]->fromArray(array( 25 | 'value' => $value, 26 | 'xtype' => $type, 27 | 'namespace' => 'clientconfig', 28 | 'area' => $area 29 | )); 30 | } 31 | 32 | return $settings; 33 | 34 | 35 | -------------------------------------------------------------------------------- /_build/events/events.clientconfig.php: -------------------------------------------------------------------------------- 1 | newObject('modPluginEvent'); 13 | $events[$ev]->fromArray(array( 14 | 'event' => $ev, 15 | // Lower OnHandleRequest priority to 1, to work reliably out of the box with context router plugins. 16 | 'priority' => $ev === 'OnHandleRequest' ? 1 : 0, 17 | 'propertyset' => 0 18 | ),'',true,true); 19 | } 20 | 21 | return $events; 22 | 23 | 24 | -------------------------------------------------------------------------------- /_build/resolvers/setupoptions.resolver.php: -------------------------------------------------------------------------------- 1 | xpdo)) { 7 | $modx = $object->xpdo; 8 | } 9 | 10 | // Check if the setup options form was submitted 11 | $isSetupOptions = array_key_exists('clientconfig_setup_options', $options); 12 | $contextAware = array_key_exists('clientconfig_context_aware', $options) ? (bool)$options['clientconfig_context_aware'] : false; 13 | 14 | $setting = $modx->getObject(modSystemSetting::class, ['key' => 'clientconfig.context_aware']); 15 | // Only update context aware value if set via setup options. Remote upgrades should keep the setting as is. 16 | if ($setting instanceof modSystemSetting && $isSetupOptions) { 17 | $setting->set('value', $contextAware); 18 | $setting->save(); 19 | } 20 | 21 | return true; 22 | -------------------------------------------------------------------------------- /_build/resolvers/tables.resolver.php: -------------------------------------------------------------------------------- 1 | xpdo) { 5 | switch ($options[xPDOTransport::PACKAGE_ACTION]) { 6 | case xPDOTransport::ACTION_UPGRADE: 7 | case xPDOTransport::ACTION_INSTALL: 8 | $modx =& $object->xpdo; 9 | 10 | $modelPath = $modx->getOption('clientconfig.core_path',null,$modx->getOption('core_path').'components/clientconfig/').'model/'; 11 | $modx->addPackage('clientconfig',$modelPath); 12 | $manager = $modx->getManager(); 13 | $loglevel = $modx->setLogLevel(modX::LOG_LEVEL_ERROR); 14 | 15 | $objects = array( 16 | 'cgSetting', 17 | 'cgGroup', 18 | 'cgContextValue', 19 | ); 20 | foreach ($objects as $obj) { 21 | $manager->createObjectContainer($obj); 22 | } 23 | 24 | // Don't show errors for adding/altering either 25 | $modx->setLogLevel(modX::LOG_LEVEL_FATAL); 26 | 27 | $manager->addField('cgSetting', 'sortorder'); 28 | $manager->addField('cgGroup', 'sortorder'); 29 | 30 | $manager->alterField('cgSetting', 'value', array()); 31 | $manager->alterField('cgSetting', 'default', array()); 32 | $manager->alterField('cgSetting', 'options', array()); 33 | $manager->alterField('cgSetting', 'description', array()); 34 | $manager->alterField('cgGroup', 'description', array()); 35 | 36 | $manager->addField('cgSetting', 'source'); 37 | $manager->addField('cgSetting', 'process_options'); 38 | 39 | $modx->setLogLevel($loglevel); 40 | break; 41 | } 42 | 43 | } 44 | return true; 45 | 46 | -------------------------------------------------------------------------------- /_build/setup.options.php: -------------------------------------------------------------------------------- 1 | getOption('clientconfig.context_aware', null, false); 11 | $globalChecked = $isContextAware ? '' : 'checked="checked"'; 12 | $contextChecked = $isContextAware ? 'checked="checked"' : ''; 13 | 14 | return << 16 |

ClientConfig 2.0 comes in two different flavours: global, and multi context mode.

17 |
18 |
    19 |
  • In global mode, your users can manage settings that affect the entire website.
  • 20 |
  • In multi-context mode, a context selector is added to the top right of the configuration screen, allowing the user to set different values for each independent context.
  • 21 |
22 | 23 |

Which mode would you like to use?

24 | 25 | 29 | 33 | 34 |

You can change the mode later through the clientconfig.context_aware system setting.

35 | 36 | HTML; 37 | break; 38 | } 39 | 40 | return ''; 41 | -------------------------------------------------------------------------------- /_build/validators/requirements.validator.php: -------------------------------------------------------------------------------- 1 | xpdo; 4 | $success = false; 5 | switch($options[xPDOTransport::PACKAGE_ACTION]) { 6 | case xPDOTransport::ACTION_INSTALL: 7 | case xPDOTransport::ACTION_UPGRADE: 8 | $success = true; 9 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Checking if server meets the minimum requirements...'); 10 | 11 | $level = xPDO::LOG_LEVEL_INFO; 12 | $modxVersion = $modx->getVersionData(); 13 | if (version_compare($modxVersion['full_version'], '2.5.2') < 0) { 14 | $level = xPDO::LOG_LEVEL_ERROR; 15 | $success = false; 16 | } 17 | $modx->log($level, '- MODX Revolution 2.5.2+: ' . $modxVersion['full_version']); 18 | 19 | $level = xPDO::LOG_LEVEL_INFO; 20 | if (version_compare(PHP_VERSION, '5.5.0') < 0) { 21 | $level = xPDO::LOG_LEVEL_ERROR; 22 | $success = false; 23 | } 24 | $modx->log($level, '- PHP version 5.5+: ' . PHP_VERSION); 25 | 26 | if ($success) { 27 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Requirements look good!'); 28 | } 29 | else { 30 | $modx->log(xPDO::LOG_LEVEL_ERROR, 'Unfortunately, your server does not meet the minimum requirements for ClientConfig and installation cannot continue.'); 31 | } 32 | 33 | break; 34 | case xPDOTransport::ACTION_UNINSTALL: 35 | $success = true; 36 | break; 37 | } 38 | return $success; -------------------------------------------------------------------------------- /_packages/clientconfig-2.4.0-pl.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/ClientConfig/d195b61a2059cf9723c8b92398460582fe2182fd/_packages/clientconfig-2.4.0-pl.transport.zip -------------------------------------------------------------------------------- /assets/components/clientconfig/connector.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * @var modX $modx 22 | */ 23 | 24 | require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php'; 25 | require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php'; 26 | require_once MODX_CONNECTORS_PATH.'index.php'; 27 | 28 | $corePath = $modx->getOption('clientconfig.core_path',null,$modx->getOption('core_path').'components/clientconfig/'); 29 | require_once $corePath.'model/clientconfig/clientconfig.class.php'; 30 | $modx->clientconfig = new ClientConfig($modx); 31 | 32 | $modx->lexicon->load('clientconfig:default'); 33 | 34 | /* handle request */ 35 | $path = $modx->getOption('processorsPath',$modx->clientconfig->config,$corePath.'processors/'); 36 | $modx->request->handleRequest(array( 37 | 'processors_path' => $path, 38 | 'location' => '', 39 | )); 40 | -------------------------------------------------------------------------------- /assets/components/clientconfig/css/mgr/clientconfig.css: -------------------------------------------------------------------------------- 1 | .x-color-palette { 2 | height: auto; 3 | } 4 | .modx-tv-image-preview { 5 | margin-top: 7px; 6 | } -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/clientconfig.class.js: -------------------------------------------------------------------------------- 1 | var ClientConfig = function(config) { 2 | config = config || {}; 3 | ClientConfig.superclass.constructor.call(this,config); 4 | }; 5 | Ext.extend(ClientConfig,Ext.Component,{ 6 | page:{},window:{},grid:{},tree:{},panel:{},tabs:{},combo:{},ux: {}, 7 | config: { 8 | connector_url: '' 9 | }, 10 | inVersion: false, 11 | 12 | destroyRTEs: function(rtes) { 13 | for (var i = 0; i < rtes.length; i++) { 14 | var rte = rtes[i]; 15 | if (window.tinymce 16 | && window.tinymce.editors 17 | && window.tinymce.editors[rte]) 18 | { 19 | window.tinymce.editors[rte].remove(); 20 | } 21 | else if (window.CKEDITOR 22 | && window.CKEDITOR.instances 23 | && window.CKEDITOR.instances[rte] 24 | ) { 25 | CKEDITOR.instances[rte].destroy() 26 | } 27 | // Redactor v2 28 | else if (window.$red) { 29 | var editor = $red('#' + rte); 30 | if (editor && editor.redactor) { 31 | editor.redactor('core.destroy'); 32 | } 33 | } 34 | // Redactor v3 35 | else if (window.Redactor) { 36 | if (window.Redactor('#' + rte)) { 37 | $R('#' + rte, 'destroy'); 38 | } 39 | } 40 | } 41 | } 42 | }); 43 | Ext.reg('clientconfig',ClientConfig); 44 | ClientConfig = new ClientConfig(); 45 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/extras/colorpicker/colorpicker.css: -------------------------------------------------------------------------------- 1 | .x-cp-rgbpicker { 2 | background-image: url(mask.png); 3 | background-repeat: no-repeat; 4 | background-color: red; 5 | width: 182px; 6 | height: 182px; 7 | margin: 7px; 8 | float: left; 9 | cursor: pointer; 10 | /*_margin: 7px 7px 7px 4px; 11 | _cursor: hand; 12 | _background-image:none; 13 | _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='mask.png',sizingMethod='scale');*/ 14 | } 15 | .x-cp-rgbslider { 16 | position: relative; 17 | left: -7px; 18 | top: -7px; 19 | width: 15px; 20 | height: 15px; 21 | background-image: url(slider-rgb.gif) !important; 22 | background-repeat: no-repeat; 23 | cursor: pointer; 24 | /*_cursor: hand;*/ 25 | } 26 | .x-cp-huepicker { 27 | height: 183px; 28 | width: 9px; 29 | float: left; 30 | margin: 7px 0 0 7px; 31 | background-image: url(hue.png) !important; 32 | background-repeat: no-repeat; 33 | cursor: pointer; 34 | /*_cursor: hand;*/ 35 | } 36 | .x-cp-hueslider { 37 | position: relative; 38 | left: -3px; 39 | top: -7px; 40 | width: 15px; 41 | height: 15px; 42 | background-image: url(slider-rgb.gif) !important; 43 | background-repeat: no-repeat; 44 | cursor: pointer; 45 | /*_cursor: hand;*/ 46 | } 47 | .x-cp-formcontainer { 48 | float: left; 49 | width: 165px; 50 | padding: 2px; 51 | border: none; 52 | margin: -24px 0 0 7px !important; 53 | } 54 | 55 | 56 | .x-cp-formcontainer input { 57 | width: 101px !important; 58 | } 59 | 60 | .x-cp-formcontainer .x-form-num-field { 61 | width: 25px !important; 62 | } 63 | .x-cp-clearfloat { 64 | clear: both; 65 | } 66 | .x-cp-colorbox { 67 | margin: 2px 5px 0 5px; 68 | border: 1px solid black; 69 | text-align: center; 70 | font-size: 10px; 71 | height: 12px; 72 | font-weight: bold; 73 | padding: 3px 0; 74 | cursor: pointer; 75 | width: 130px; 76 | /*_cursor: hand;*/ 77 | } 78 | .x-cp-formcontainer input { 79 | text-align: center; 80 | } 81 | 82 | .x-cp-mainpanel{ 83 | width: 394px !important; 84 | } 85 | 86 | .x-colorpicker{ 87 | text-shadow: none !important; 88 | text-align: center; 89 | } -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/extras/colorpicker/colorpickerfield.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @class Ext.ux.form.ColorPickerField 3 | * @extends Ext.form.TriggerField 4 | * This class makes Ext.ux.ColorPicker available as a form field. 5 | * @license: BSD 6 | * @author: Robert B. Williams (extjs id: vtswingkid) 7 | * @constructor 8 | * Creates a new ColorPickerField 9 | * @param {Object} config Configuration options 10 | * @version 1.1.2 11 | */ 12 | 13 | Ext.namespace("Ext.ux", "Ext.ux.menu", "Ext.ux.form"); 14 | if (Ext.version.substr(0, 1) == "2") { 15 | Ext.ux.menu.ColorItem = function(config){ 16 | if (!config) config = {}; 17 | config.style = "width:350px;"; 18 | Ext.ux.menu.ColorItem.superclass.constructor.call(this, new Ext.ux.ColorPicker(config), config); 19 | this.picker = this.component; 20 | this.addEvents('select'); 21 | this.picker.on("render", function(picker){ 22 | picker.getEl().swallowEvent("click"); 23 | }); 24 | this.picker.on("select", this.onSelect, this); 25 | }; 26 | Ext.extend(Ext.ux.menu.ColorItem, Ext.menu.Adapter, { 27 | // private 28 | onSelect: function(picker, color){ 29 | this.fireEvent("select", this, color, picker); 30 | Ext.ux.menu.ColorItem.superclass.handleClick.call(this); 31 | } 32 | }); 33 | Ext.ux.menu.ColorMenu = function(config){ 34 | Ext.ux.menu.ColorMenu.superclass.constructor.call(this, config); 35 | this.plain = true; 36 | var ci = new Ext.ux.menu.ColorItem(config); 37 | this.add(ci); 38 | this.picker = ci.picker; 39 | this.relayEvents(ci, ["select"]); 40 | }; 41 | Ext.extend(Ext.ux.menu.ColorMenu, Ext.menu.Menu, { 42 | beforeDestroy: function(){ 43 | this.picker.destroy(); 44 | } 45 | }); 46 | } else { 47 | Ext.ux.menu.ColorMenu = Ext.extend(Ext.menu.Menu, { 48 | enableScrolling: false, 49 | hideOnClick: true, 50 | initComponent: function(){ 51 | Ext.apply(this, { 52 | plain: true, 53 | showSeparator: false, 54 | items: this.picker = new Ext.ux.ColorPicker(Ext.apply({ 55 | // internalRender: this.strict || !Ext.isIE, 56 | style: 'width:350px;' 57 | }, this.initialConfig)) 58 | }); 59 | this.picker.purgeListeners(); 60 | Ext.ux.menu.ColorMenu.superclass.initComponent.call(this); 61 | this.relayEvents(this.picker, ['select']); 62 | this.on('select', this.menuHide, this); 63 | if (this.handler) { 64 | this.on('select', this.handler, this.scope || this) 65 | } 66 | }, 67 | menuHide: function(){ 68 | if (this.hideOnClick) { 69 | this.hide(true); 70 | } 71 | } 72 | }); 73 | } 74 | Ext.ux.form.ColorPickerField = Ext.extend(Ext.form.TriggerField, { 75 | initComponent : function(){ 76 | Ext.ux.form.ColorPickerField.superclass.initComponent.call(this); 77 | this.menu = new Ext.ux.menu.ColorMenu(); 78 | }, 79 | setValue : function(v){ 80 | if (/^[0-9a-fA-F]{6}$/.test(v)) { 81 | Ext.ux.form.ColorPickerField.superclass.setValue.apply(this, arguments); 82 | var i = this.menu.picker.rgbToHex(this.menu.picker.invert(this.menu.picker.hexToRgb(v))); 83 | this.el.applyStyles('background: #' + v + '; color: #' + i + ';'); 84 | } 85 | }, 86 | onDestroy : function(){ 87 | if(this.menu) { 88 | this.menu.destroy(); 89 | } 90 | if(this.wrap){ 91 | this.wrap.remove(); 92 | } 93 | Ext.ux.form.ColorPickerField.superclass.onDestroy.call(this); 94 | }, 95 | onBlur : function(){ 96 | Ext.ux.form.ColorPickerField.superclass.onBlur.call(this); 97 | var v = this.getValue(); 98 | if (/^[0-9a-fA-F]{6}$/.test(v)) { 99 | var i = this.menu.picker.rgbToHex(this.menu.picker.invert(this.menu.picker.hexToRgb(v))); 100 | this.el.applyStyles('background: #'+v+'; color: #'+i+';'); 101 | }else this.el.applyStyles('background: #ffffff; color: #000000;'); 102 | }, 103 | menuListeners : { 104 | select: function(m, c){ 105 | this.setValue(c); 106 | this.fireEvent("select", this, c); 107 | this.focus.defer(10, this); 108 | }, 109 | show : function(m){ // retain focus styling 110 | this.onFocus(); 111 | }, 112 | hide : function(){ 113 | this.focus.defer(10, this); 114 | var ml = this.menuListeners; 115 | this.menu.un("select", ml.select, this); 116 | this.menu.un("show", ml.show, this); 117 | this.menu.un("hide", ml.hide, this); 118 | } 119 | }, 120 | onTriggerClick : function(){ 121 | if(this.disabled){ 122 | return; 123 | } 124 | this.menu.on(Ext.apply({}, this.menuListeners, { 125 | scope:this 126 | })); 127 | this.menu.show(this.el, "tl-bl?"); 128 | this.menu.picker.setColor(this.getValue()); 129 | } 130 | }); 131 | Ext.reg("colorpickerfield", Ext.ux.form.ColorPickerField); -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/extras/colorpicker/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/ClientConfig/d195b61a2059cf9723c8b92398460582fe2182fd/assets/components/clientconfig/js/mgr/extras/colorpicker/hue.png -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/extras/colorpicker/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/ClientConfig/d195b61a2059cf9723c8b92398460582fe2182fd/assets/components/clientconfig/js/mgr/extras/colorpicker/mask.png -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/extras/colorpicker/slider-rgb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/ClientConfig/d195b61a2059cf9723c8b92398460582fe2182fd/assets/components/clientconfig/js/mgr/extras/colorpicker/slider-rgb.gif -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/sections/admin.js: -------------------------------------------------------------------------------- 1 | ClientConfig.page.Admin = function(config) { 2 | config = config || {}; 3 | Ext.applyIf(config,{ 4 | renderTo: 'clientconfig-wrapper-div', 5 | border: false, 6 | components: [{ 7 | cls: 'container form-with-labels', 8 | xtype: 'panel', 9 | items: [{ 10 | xtype: 'panel', 11 | html: '

' + _('clientconfig.adminpanel') + '

', 12 | border: false, 13 | cls: 'modx-page-header' 14 | }, { 15 | xtype: 'modx-tabs', 16 | width: '98%', 17 | border: true, 18 | defaults: { 19 | border: false, 20 | autoHeight: true, 21 | layout: 'anchor', 22 | defaults: { 23 | border: false 24 | } 25 | }, 26 | items: [{ 27 | title: _('clientconfig.settings'), 28 | cls: 'main-wrapper', 29 | items: [{ 30 | xtype: 'clientconfig-grid-settings' 31 | }] 32 | }, { 33 | title: _('clientconfig.groups'), 34 | cls: 'main-wrapper', 35 | items: [{ 36 | xtype: 'clientconfig-grid-groups' 37 | }] 38 | }], 39 | stateful: true, 40 | stateId: 'clientconfig-page-admin', 41 | stateEvents: ['tabchange'], 42 | getState: function () { 43 | return { 44 | activeTab: this.items.indexOf(this.getActiveTab()) 45 | }; 46 | } 47 | }] 48 | }], 49 | buttons: [{ 50 | text: _('clientconfig.to_client_view'), 51 | handler: this.toClientView, 52 | scope: this 53 | },'-',{ 54 | text: _('help_ex'), 55 | handler: MODx.loadHelpPane, 56 | scope: this 57 | }] 58 | }); 59 | ClientConfig.page.Admin.superclass.constructor.call(this,config); 60 | }; 61 | Ext.extend(ClientConfig.page.Admin,MODx.Component,{ 62 | toClientView: function() { 63 | MODx.loadPage('?a=home&namespace=clientconfig'); 64 | } 65 | }); 66 | Ext.reg('clientconfig-page-admin',ClientConfig.page.Admin); 67 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/combos.js: -------------------------------------------------------------------------------- 1 | ClientConfig.combo.Groups = function(config) { 2 | config = config || {}; 3 | Ext.applyIf(config,{ 4 | url: ClientConfig.config.connectorUrl, 5 | baseParams: { 6 | action: 'mgr/groups/getlist', 7 | combo: true 8 | }, 9 | fields: ['id','label'], 10 | hiddenName: config.name || 'group', 11 | pageSize: 15, 12 | valueField: 'id', 13 | displayField: 'label' 14 | }); 15 | ClientConfig.combo.Groups.superclass.constructor.call(this,config); 16 | 17 | if (config.storeLoadListener) { 18 | this.store.on('load', config.storeLoadListener, this); 19 | this.on('render', function() { 20 | if (!this.getValue()) { 21 | this.store.load(); 22 | } 23 | }); 24 | } 25 | }; 26 | Ext.extend(ClientConfig.combo.Groups,MODx.combo.ComboBox); 27 | Ext.reg('clientconfig-combo-groups',ClientConfig.combo.Groups); 28 | 29 | 30 | ClientConfig.combo.FieldTypes = function(config) { 31 | config = config || {}; 32 | Ext.applyIf(config,{ 33 | store: new Ext.data.ArrayStore({ 34 | mode: 'local', 35 | fields: ['xtype','label'], 36 | data: [ 37 | ['textfield', _('clientconfig.xtype.textfield')], 38 | ['textarea', _('clientconfig.xtype.textarea')], 39 | ['richtext', _('clientconfig.xtype.richtext')], 40 | ['code', _('clientconfig.xtype.code')], 41 | ['modx-panel-tv-image', _('clientconfig.xtype.image')], 42 | ['modx-panel-tv-file', _('clientconfig.xtype.file')], 43 | ['numberfield', _('clientconfig.xtype.numberfield')], 44 | ['colorpickerfield', _('clientconfig.xtype.colorpalette')], 45 | ['email', _('clientconfig.xtype.email')], 46 | ['xcheckbox', _('clientconfig.xtype.xcheckbox')], 47 | ['datefield', _('clientconfig.xtype.datefield')], 48 | ['timefield', _('clientconfig.xtype.timefield')], 49 | ['password', _('clientconfig.xtype.password')], 50 | ['modx-combo', _('clientconfig.xtype.combobox')], 51 | ['googlefontlist', _('clientconfig.xtype.googlefonts')], 52 | ['clientconfig-line', _('clientconfig.xtype.line')] 53 | ] 54 | }), 55 | hiddenName: config.name || 'xtype', 56 | valueField: 'xtype', 57 | displayField: 'label', 58 | mode: 'local', 59 | value: 'textfield' 60 | }); 61 | 62 | if (MODx.config['clientconfig.google_fonts_api_key'] == '') config.store.removeAt(config.store.find('xtype','googlefontlist')); 63 | ClientConfig.combo.FieldTypes.superclass.constructor.call(this,config); 64 | }; 65 | Ext.extend(ClientConfig.combo.FieldTypes,MODx.combo.ComboBox); 66 | Ext.reg('clientconfig-combo-fieldtypes',ClientConfig.combo.FieldTypes); 67 | 68 | ClientConfig.combo.GoogleFontList = function(config) { 69 | config = config || {}; 70 | Ext.applyIf(config,{ 71 | url: ClientConfig.config.connectorUrl, 72 | baseParams: { 73 | action: 'mgr/fonts/google/getlist', 74 | combo: true 75 | }, 76 | fields: ['family','name'], 77 | hiddenName: config.name || 'font', 78 | valueField: 'family', 79 | displayField: 'name' 80 | }); 81 | ClientConfig.combo.GoogleFontList.superclass.constructor.call(this,config); 82 | }; 83 | Ext.extend(ClientConfig.combo.GoogleFontList, MODx.combo.ComboBox); 84 | Ext.reg('googlefontlist',ClientConfig.combo.GoogleFontList); 85 | 86 | ClientConfig.combo.ContextList = function(config) { 87 | config = config || {}; 88 | Ext.applyIf(config,{ 89 | url: ClientConfig.config.connectorUrl, 90 | baseParams: { 91 | action: 'mgr/contexts/getlist', 92 | exclude: 'mgr', 93 | combo: true, 94 | sort: '`rank`', 95 | }, 96 | fields: ['key','name'], 97 | hiddenName: config.name || 'context', 98 | valueField: 'key', 99 | displayField: 'name', 100 | pageSize: 20 101 | // Typeahead prevents the dropdown from opening on click, needs a solution first 102 | // editable: true, 103 | // typeahead: true, 104 | // forceSelection: true, 105 | // queryParam: 'search', 106 | }); 107 | ClientConfig.combo.ContextList.superclass.constructor.call(this,config); 108 | }; 109 | Ext.extend(ClientConfig.combo.ContextList, MODx.combo.ComboBox); 110 | Ext.reg('clientconfig-combo-contexts',ClientConfig.combo.ContextList); 111 | 112 | 113 | ClientConfig.ux.Line = Ext.extend(Ext.Component, { 114 | autoEl: 'hr' 115 | }); 116 | Ext.reg('clientconfig-line', ClientConfig.ux.Line); 117 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/grid.groups.js: -------------------------------------------------------------------------------- 1 | ClientConfig.grid.Groups = function(config) { 2 | config = config || {}; 3 | Ext.applyIf(config,{ 4 | url: ClientConfig.config.connectorUrl, 5 | id: 'clientconfig-grid-groups', 6 | baseParams: { 7 | action: 'mgr/groups/getlist' 8 | }, 9 | save_action: 'mgr/groups/updatefromgrid', 10 | autosave: true, 11 | emptyText: _('clientconfig.error.noresults'), 12 | fields: [ 13 | {name: 'id', type: 'int'}, 14 | {name: 'label', type: 'string'}, 15 | {name: 'description', type: 'string'}, 16 | {name: 'sortorder', type: 'int'}, 17 | {name: 'settings_count', type: 'int'} 18 | ], 19 | paging: true, 20 | remoteSort: true, 21 | columns: [{ 22 | header: _('clientconfig.id'), 23 | dataIndex: 'id', 24 | sortable: true, 25 | width: .1 26 | },{ 27 | header: _('clientconfig.label'), 28 | dataIndex: 'label', 29 | editor: { xtype: 'textfield' }, 30 | sortable: true, 31 | width: .3 32 | },{ 33 | header: _('clientconfig.description'), 34 | dataIndex: 'description', 35 | editor: { xtype: 'textfield' }, 36 | sortable: true, 37 | width: .5 38 | },{ 39 | header: _('clientconfig.settings_count'), 40 | dataIndex: 'settings_count', 41 | sortable: true, 42 | width: .1 43 | },{ 44 | header: _('clientconfig.sortorder'), 45 | dataIndex: 'sortorder', 46 | editor: { 47 | xtype: 'numberfield', 48 | allowDecimal: false, 49 | allowNegative: false 50 | }, 51 | sortable: true, 52 | width: .1 53 | }], 54 | tbar: [{ 55 | text: _('clientconfig.add_group'), 56 | handler: this.addGroup, 57 | scope: this 58 | }, '->', { 59 | text: _('clientconfig.export_groups'), 60 | handler: this.exportGroups, 61 | scope: this 62 | }, '-', { 63 | text: _('clientconfig.import_groups'), 64 | handler: this.importGroups, 65 | scope: this 66 | }] 67 | }); 68 | ClientConfig.grid.Groups.superclass.constructor.call(this,config); 69 | }; 70 | Ext.extend(ClientConfig.grid.Groups,MODx.grid.Grid,{ 71 | addGroup: function() { 72 | var win = MODx.load({ 73 | xtype: 'clientconfig-window-group', 74 | listeners: { 75 | success: {fn: function(r) { 76 | this.refresh(); 77 | },scope: this}, 78 | scope: this 79 | } 80 | }); 81 | win.show(); 82 | }, 83 | updateGroup: function() { 84 | var record = this.menu.record; 85 | var win = MODx.load({ 86 | xtype: 'clientconfig-window-group', 87 | listeners: { 88 | success: {fn: function(r) { 89 | this.refresh(); 90 | },scope: this}, 91 | scope: this 92 | }, 93 | isUpdate: true 94 | }); 95 | win.setValues(record); 96 | win.show(); 97 | }, 98 | removeGroup: function() { 99 | var id = this.menu.record.id; 100 | MODx.msg.confirm({ 101 | title: _('clientconfig.remove_group'), 102 | text: _('clientconfig.remove_group.confirm'), 103 | url: this.config.url, 104 | params: { 105 | action: 'mgr/groups/remove', 106 | id: id 107 | }, 108 | listeners: { 109 | success: {fn: function(r) { 110 | this.refresh(); 111 | },scope: this}, 112 | scope: this 113 | } 114 | }); 115 | }, 116 | getMenu: function(node) { 117 | var m = []; 118 | 119 | m.push({ 120 | text: _('clientconfig.update_group'), 121 | handler: this.updateGroup, 122 | scope: this 123 | },'-',{ 124 | text: _('clientconfig.remove_group'), 125 | handler: this.removeGroup, 126 | scope: this 127 | }); 128 | return m; 129 | }, 130 | 131 | exportGroups: function() { 132 | Ext.Msg.confirm(_('clientconfig.export_groups'), _('clientconfig.export_groups.confirm'), function(e) { 133 | if (e == 'yes') { 134 | window.location = ClientConfig.config.connectorUrl + '?action=mgr/groups/export&HTTP_MODAUTH=' + MODx.siteId; 135 | } 136 | }); 137 | }, 138 | 139 | importGroups: function() { 140 | var win = MODx.load({ 141 | xtype: 'clientconfig-window-import', 142 | title: _('clientconfig.import_groups'), 143 | introduction: _('clientconfig.import_groups.desc'), 144 | what: _('clientconfig.groups'), 145 | baseParams: { 146 | action: 'mgr/groups/import' 147 | }, 148 | listeners: { 149 | success: {fn: function(r) { 150 | this.refresh(); 151 | },scope: this}, 152 | scope: this 153 | } 154 | }); 155 | win.show(); 156 | } 157 | }); 158 | Ext.reg('clientconfig-grid-groups',ClientConfig.grid.Groups); 159 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/grid.settings.js: -------------------------------------------------------------------------------- 1 | ClientConfig.grid.Settings = function(config) { 2 | config = config || {}; 3 | Ext.applyIf(config, { 4 | 5 | // Basic Grid Configuration 6 | url: ClientConfig.config.connectorUrl, 7 | id: 'clientconfig-grid-settings', 8 | baseParams: { 9 | action: 'mgr/settings/getlist' 10 | }, 11 | save_action: 'mgr/settings/updatefromgrid', 12 | autosave: true, 13 | emptyText: _('clientconfig.error.noresults'), 14 | paging: true, 15 | remoteSort: true, 16 | 17 | // Available Fields 18 | fields: [ 19 | {name: 'id', type: 'int'}, 20 | {name: 'key', type: 'string'}, 21 | {name: 'label', type: 'string'}, 22 | {name: 'xtype', type: 'string'}, 23 | {name: 'description', type: 'string'}, 24 | {name: 'is_required', type: 'bool'}, 25 | {name: 'value', type: 'string'}, 26 | {name: 'default', type: 'string'}, 27 | {name: 'source', type: 'int'}, 28 | {name: 'group', type: 'int'}, 29 | {name: 'group_label', type: 'string'}, 30 | {name: 'sortorder', type: 'int'}, 31 | {name: 'options', type: 'object'}, 32 | {name: 'process_options', type: 'bool'} 33 | ], 34 | 35 | // Visible Columns 36 | columns: [{ 37 | header: _('clientconfig.id'), 38 | dataIndex: 'id', 39 | sortable: true, 40 | width: .1 41 | },{ 42 | header: _('clientconfig.key'), 43 | dataIndex: 'key', 44 | editor: { xtype: 'textfield' }, 45 | sortable: true, 46 | width: .3 47 | },{ 48 | header: _('clientconfig.label'), 49 | dataIndex: 'label', 50 | editor: { xtype: 'textfield' }, 51 | sortable: true, 52 | width: .3 53 | },{ 54 | header: _('clientconfig.xtype'), 55 | dataIndex: 'xtype', 56 | editor: { 57 | xtype: 'clientconfig-combo-fieldtypes', 58 | renderer: true 59 | }, 60 | sortable: true, 61 | width: .15 62 | },{ 63 | header: _('clientconfig.is_required'), 64 | dataIndex: 'is_required', 65 | editor: { 66 | xtype: 'combo-boolean', 67 | renderer: 'boolean' 68 | }, 69 | sortable: true, 70 | width: .15, 71 | renderer: this.rendYesNo 72 | },{ 73 | header: _('clientconfig.group'), 74 | dataIndex: 'group', 75 | editor: { 76 | xtype: 'clientconfig-combo-groups', 77 | renderer: true 78 | }, 79 | sortable: true, 80 | width: .3 81 | },{ 82 | header: _('clientconfig.sortorder'), 83 | dataIndex: 'sortorder', 84 | editor: { 85 | xtype: 'numberfield', 86 | allowDecimal: false, 87 | allowNegative: false 88 | }, 89 | sortable: true, 90 | width: .2 91 | }], 92 | 93 | // Top-Bar 94 | tbar: [{ 95 | text: _('clientconfig.add_setting'), 96 | handler: this.addSetting, 97 | scope: this 98 | },'->',{ 99 | emptyText: _('clientconfig.filter_on_group'), 100 | xtype: 'clientconfig-combo-groups', 101 | id: 'clientconfig-settings-filter-group', 102 | listeners: { 103 | select: {fn: function(combo, record) { 104 | this.getStore().baseParams['group'] = record.id; 105 | this.getBottomToolbar().changePage(1); 106 | }, scope: this} 107 | }, 108 | width: 250 109 | }, '-', { 110 | text: _('clientconfig.export_settings'), 111 | handler: this.exportSettings, 112 | scope: this 113 | }, '-', { 114 | text: _('clientconfig.import_settings'), 115 | handler: this.importSettings, 116 | scope: this 117 | }] 118 | }); 119 | ClientConfig.grid.Settings.superclass.constructor.call(this,config); 120 | }; 121 | Ext.extend(ClientConfig.grid.Settings,MODx.grid.Grid,{ 122 | addSetting: function() { 123 | var groups = Ext.getCmp('clientconfig-grid-groups'); 124 | if (groups.store.data.items.length < 1) { 125 | MODx.msg.alert( 126 | _('clientconfig.create_groups_first'), 127 | _('clientconfig.create_groups_first.desc'), 128 | function() { 129 | groups.addGroup(); 130 | }, 131 | groups 132 | ); 133 | return; 134 | } 135 | 136 | var win = MODx.load({ 137 | xtype: 'clientconfig-window-setting', 138 | listeners: { 139 | success: {fn: function(r) { 140 | this.refresh(); 141 | },scope: this}, 142 | scope: this 143 | } 144 | }); 145 | win.show(); 146 | }, 147 | updateSetting: function() { 148 | var record = this.menu.record; 149 | var win = MODx.load({ 150 | xtype: 'clientconfig-window-setting', 151 | record: record, 152 | listeners: { 153 | success: {fn: function(r) { 154 | this.refresh(); 155 | },scope: this}, 156 | scope: this 157 | }, 158 | isUpdate: true 159 | }); 160 | win.setValues(record); 161 | win.show(); 162 | }, 163 | duplicateSetting: function() { 164 | var record = this.menu.record; 165 | record.id = 0; 166 | var win = MODx.load({ 167 | xtype: 'clientconfig-window-setting', 168 | record: record, 169 | listeners: { 170 | success: {fn: function(r) { 171 | this.refresh(); 172 | },scope: this}, 173 | scope: this 174 | }, 175 | isDuplicate: true 176 | }); 177 | win.setValues(record); 178 | win.show(); 179 | }, 180 | removeSetting: function() { 181 | var id = this.menu.record.id; 182 | MODx.msg.confirm({ 183 | title: _('clientconfig.remove_setting'), 184 | text: _('clientconfig.remove_setting.confirm'), 185 | url: this.config.url, 186 | params: { 187 | action: 'mgr/settings/remove', 188 | id: id 189 | }, 190 | listeners: { 191 | success: {fn: function(r) { 192 | this.refresh(); 193 | },scope: this}, 194 | scope: this 195 | } 196 | }); 197 | }, 198 | getMenu: function(node) { 199 | var m = []; 200 | 201 | m.push({ 202 | text: _('clientconfig.update_setting'), 203 | handler: this.updateSetting, 204 | scope: this 205 | },{ 206 | text: _('clientconfig.duplicate_setting'), 207 | handler: this.duplicateSetting, 208 | scope: this 209 | },'-',{ 210 | text: _('clientconfig.remove_setting'), 211 | handler: this.removeSetting, 212 | scope: this 213 | }); 214 | return m; 215 | }, 216 | 217 | filterOnGroup: function() { 218 | this.baseParams['group'] = Ext.getCmp('clientconfig-settings-filter-group').getValue(); 219 | this.getBottomToolbar().changePage(1); 220 | this.refresh(); 221 | }, 222 | 223 | exportSettings: function() { 224 | Ext.Msg.confirm(_('clientconfig.export_settings'), _('clientconfig.export_settings.confirm'), function(e) { 225 | if (e == 'yes') { 226 | window.location = ClientConfig.config.connectorUrl + '?action=mgr/settings/export&HTTP_MODAUTH=' + MODx.siteId; 227 | } 228 | }); 229 | }, 230 | 231 | importSettings: function() { 232 | var win = MODx.load({ 233 | xtype: 'clientconfig-window-import', 234 | title: _('clientconfig.import_settings'), 235 | introduction: _('clientconfig.import_settings.desc'), 236 | what: _('clientconfig.settings'), 237 | baseParams: { 238 | action: 'mgr/settings/import' 239 | }, 240 | listeners: { 241 | success: {fn: function(r) { 242 | this.refresh(); 243 | },scope: this}, 244 | scope: this 245 | } 246 | }); 247 | win.show(); 248 | } 249 | }); 250 | Ext.reg('clientconfig-grid-settings',ClientConfig.grid.Settings); 251 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/window.groups.js: -------------------------------------------------------------------------------- 1 | ClientConfig.window.Group = function(config) { 2 | config = config || {}; 3 | config.id = config.id || Ext.id(), 4 | Ext.applyIf(config,{ 5 | title: (config.isUpdate) ? 6 | _('clientconfig.update_group') : 7 | _('clientconfig.add_group'), 8 | autoHeight: true, 9 | url: ClientConfig.config.connectorUrl, 10 | baseParams: { 11 | action: (config.isUpdate) ? 12 | 'mgr/groups/update' : 13 | 'mgr/groups/create' 14 | }, 15 | width: 500, 16 | fields: [{ 17 | xtype: 'hidden', 18 | name: 'id' 19 | },{ 20 | xtype: 'textfield', 21 | name: 'label', 22 | fieldLabel: _('clientconfig.label'), 23 | allowBlank: false, 24 | anchor: '100%' 25 | },{ 26 | xtype: 'numberfield', 27 | name: 'sortorder', 28 | fieldLabel: _('clientconfig.sortorder'), 29 | allowBlank: false, 30 | minValue: 0, 31 | maxValue: 9999999999, 32 | anchor: '100%', 33 | value: 0 34 | },{ 35 | xtype: 'textarea', 36 | name: 'description', 37 | fieldLabel: _('clientconfig.description'), 38 | anchor: '100%' 39 | }], 40 | keys: [] //prevent enter in textarea from firing submit 41 | }); 42 | ClientConfig.window.Group.superclass.constructor.call(this,config); 43 | }; 44 | Ext.extend(ClientConfig.window.Group,MODx.Window); 45 | Ext.reg('clientconfig-window-group',ClientConfig.window.Group); 46 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/window.import.js: -------------------------------------------------------------------------------- 1 | ClientConfig.window.Import = function(config) { 2 | config = config || {}; 3 | config.id = config.id || Ext.id(), 4 | Ext.applyIf(config,{ 5 | url: ClientConfig.config.connectorUrl, 6 | autoHeight: true, 7 | fileUpload: true, 8 | modal: true, 9 | width: 450, 10 | fields: [{ 11 | xtype: 'panel', 12 | cls: 'panel-desc', 13 | html: '

' + config.introduction + '

', 14 | border: false 15 | },{ 16 | xtype: 'textfield', 17 | fieldLabel: _('clientconfig.import_file'), 18 | name: 'file', 19 | inputType: 'file' 20 | },{ 21 | xtype: 'radiogroup', 22 | fieldLabel: _('clientconfig.import_mode'), 23 | columns: 1, 24 | items: [{ 25 | boxLabel: _('clientconfig.import_mode.insert', {what: config.what}), 26 | name: 'mode', 27 | inputValue: 'insert', 28 | checked: true 29 | },{ 30 | boxLabel: _('clientconfig.import_mode.overwrite', {what: config.what}), 31 | name: 'mode', 32 | inputValue: 'overwrite' 33 | },{ 34 | boxLabel: _('clientconfig.import_mode.replace', {what: config.what}), 35 | name: 'mode', 36 | inputValue: 'replace' 37 | }] 38 | }], 39 | buttons: [{ 40 | text: _('cancel'), 41 | scope: this, 42 | handler: function() { this.hide(); } 43 | },'-',{ 44 | text: _('clientconfig.start_import'), 45 | scope: this, 46 | handler: this.submit, 47 | cls: 'primary-button' 48 | }] 49 | }); 50 | ClientConfig.window.Import.superclass.constructor.call(this,config); 51 | }; 52 | Ext.extend(ClientConfig.window.Import, MODx.Window); 53 | Ext.reg('clientconfig-window-import',ClientConfig.window.Import); 54 | -------------------------------------------------------------------------------- /assets/components/clientconfig/js/mgr/widgets/window.settings.js: -------------------------------------------------------------------------------- 1 | ClientConfig.window.Setting = function(config) { 2 | config = config || {}; 3 | config.id = config.id || Ext.id(); 4 | Ext.applyIf(config, { 5 | title: (config.isUpdate) ? 6 | _('clientconfig.update_setting') : 7 | (config.isDuplicate) ? _('clientconfig.duplicate_setting') : _('clientconfig.add_setting'), 8 | autoHeight: true, 9 | url: ClientConfig.config.connectorUrl, 10 | baseParams: { 11 | action: (config.isUpdate) ? 12 | 'mgr/settings/update' : 13 | 'mgr/settings/create' 14 | }, 15 | width: 750, 16 | fields: [{ 17 | xtype: 'hidden', 18 | name: 'id' 19 | },{ 20 | layout: 'column', 21 | items: [{ 22 | columnWidth: 0.5, 23 | layout: 'form', 24 | items: [{ 25 | xtype: 'textfield', 26 | name: 'key', 27 | fieldLabel: _('clientconfig.key') + ClientConfig.reqAsterisk, 28 | allowBlank: false, 29 | anchor: '100%' 30 | },{ 31 | xtype: 'textfield', 32 | name: 'label', 33 | fieldLabel: _('clientconfig.label') + ClientConfig.reqAsterisk, 34 | allowBlank: false, 35 | anchor: '100%' 36 | },{ 37 | xtype: 'textarea', 38 | name: 'description', 39 | fieldLabel: _('clientconfig.description'), 40 | anchor: '100%' 41 | },{ 42 | xtype: 'clientconfig-combo-groups', 43 | name: 'group', 44 | fieldLabel: _('clientconfig.group'), 45 | anchor: '100%', 46 | autoLoad: true, 47 | storeLoadListener: function(store, data, request) { 48 | if (this.getValue() < 1) { 49 | this.setValue(store.getAt(0).get(this.valueField)); 50 | } 51 | return true; 52 | } 53 | },{ 54 | xtype: 'numberfield', 55 | name: 'sortorder', 56 | fieldLabel: _('clientconfig.sortorder'), 57 | allowBlank: false, 58 | minValue: 0, 59 | maxValue: 9999999999, 60 | anchor: '100%', 61 | value: 0 62 | }] 63 | },{ 64 | columnWidth: 0.5, 65 | layout: 'form', 66 | items: [{ 67 | xtype: 'clientconfig-combo-fieldtypes', 68 | name: 'xtype', 69 | fieldLabel: _('clientconfig.xtype') + ClientConfig.reqAsterisk, 70 | allowBlank: false, 71 | anchor: '100%', 72 | listeners: { 73 | select: {fn: function(field, record) { 74 | if (record.data.xtype === 'modx-combo') { 75 | Ext.getCmp(config.id + '-options').show(); 76 | Ext.getCmp(config.id + '-process_options').show(); 77 | } else { 78 | Ext.getCmp(config.id + '-options').hide(); 79 | Ext.getCmp(config.id + '-process_options').hide(); 80 | } 81 | if (['modx-panel-tv-image', 'modx-panel-tv-file'].indexOf(record.data.xtype) !== -1) { 82 | Ext.getCmp(config.id + '-source').show(); 83 | } else { 84 | Ext.getCmp(config.id + '-source').hide(); 85 | } 86 | }, scope: this} 87 | } 88 | },{ 89 | xtype: (config.record && config.record.xtype && ['textarea', 'richtext'].indexOf(config.record.xtype) !== -1) ? 'textarea' : 'textfield', 90 | name: 'value', 91 | fieldLabel: _('clientconfig.value'), 92 | anchor: '100%' 93 | },{ 94 | xtype: 'textarea', 95 | id: config.id + '-options', 96 | name: 'options', 97 | fieldLabel: _('clientconfig.options'), 98 | description: _('clientconfig.options.desc'), 99 | anchor: '100%', 100 | hidden: (config.record && (config.record.xtype === 'modx-combo')) ? false : true 101 | },{ 102 | xtype: 'checkbox', 103 | id: config.id + '-process_options', 104 | name: 'process_options', 105 | boxLabel: _('clientconfig.process_options'), 106 | anchor: '100%' 107 | },{ 108 | xtype: 'modx-combo-source', 109 | id: config.id + '-source', 110 | name: 'source', 111 | fieldLabel: _('clientconfig.source'), 112 | description: _('clientconfig.source.desc'), 113 | anchor: '100%', 114 | hidden: (config.record && (['modx-panel-tv-image', 'modx-panel-tv-file'].indexOf(config.record.xtype) !== -1)) ? false : true, 115 | hideMode: 'offsets', 116 | value: 0 117 | },{ 118 | xtype: 'checkbox', 119 | name: 'is_required', 120 | boxLabel: _('clientconfig.is_required.long'), 121 | anchor: '100%' 122 | }] 123 | }] 124 | }], 125 | keys: [], //prevent enter in textarea from firing submit 126 | buttons: [{ 127 | text: _('cancel'), 128 | scope: this, 129 | handler: function() { this.hide(); } 130 | },'-',{ 131 | text: _('save'), 132 | scope: this, 133 | handler: function () { 134 | this.submit(false); 135 | }, 136 | cls: 'primary-button' 137 | }, { 138 | text: _('save_and_close'), 139 | scope: this, 140 | handler: this.submit, 141 | cls: 'primary-button' 142 | }] 143 | }); 144 | ClientConfig.window.Setting.superclass.constructor.call(this,config); 145 | }; 146 | Ext.extend(ClientConfig.window.Setting,MODx.Window); 147 | Ext.reg('clientconfig-window-setting',ClientConfig.window.Setting); 148 | -------------------------------------------------------------------------------- /config.core.sample.php: -------------------------------------------------------------------------------- 1 | clientconfig->hasAdminPermission()) { 14 | $url = $this->modx->getOption('manager_url') . '?a=' . $_GET['a']; 15 | $this->modx->sendRedirect($url); 16 | } 17 | } 18 | 19 | /** 20 | * The pagetitle to put in the attribute. 21 | * @return null|string 22 | */ 23 | public function getPageTitle() { 24 | return $this->modx->lexicon('clientconfig.adminpanel'); 25 | } 26 | 27 | /** 28 | * Register all the needed javascript files. Using this method, it will automagically 29 | * combine and compress them if enabled in system settings. 30 | */ 31 | public function loadCustomCssJs() { 32 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/grid.groups.js'); 33 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/grid.settings.js'); 34 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.groups.js'); 35 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.settings.js'); 36 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/window.import.js'); 37 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/combos.js'); 38 | 39 | $this->addLastJavascript($this->clientconfig->config['jsUrl'].'mgr/sections/admin.js'); 40 | 41 | $this->addHtml('<script type="text/javascript"> 42 | Ext.onReady(function() { 43 | MODx.config.help_url = "https://www.modmore.com/extras/clientconfig/documentation/?embed=1"; 44 | MODx.load({ xtype: "clientconfig-page-admin" }); 45 | }); 46 | </script>'); 47 | } 48 | 49 | /** 50 | * The name for the template file to load. 51 | * @return string 52 | */ 53 | public function getTemplateFile() { 54 | return $this->clientconfig->config['templatesPath'].'home.tpl'; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /core/components/clientconfig/controllers/home.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | require_once dirname(__DIR__) . '/index.class.php'; 4 | /** 5 | * The name of the controller is based on the path (home) and the 6 | * namespace (clientconfig). This home controller is the main client view. 7 | */ 8 | class ClientConfigHomeManagerController extends ClientConfigManagerController { 9 | public $tabs = []; 10 | 11 | /** 12 | * Any specific processing we need on the Home controller. 13 | * In this case, we get all groups and all settings in the group. 14 | * @param array $scriptProperties 15 | */ 16 | public function process(array $scriptProperties = []) { 17 | $tabs = []; 18 | 19 | /** 20 | * Get all the Groups 21 | * @var cgGroup $group 22 | * @var cgSetting $setting 23 | */ 24 | $c = $this->modx->newQuery('cgGroup'); 25 | $c->sortby('sortorder','ASC'); 26 | $c->sortby('label','ASC'); 27 | $groups = $this->modx->getCollection('cgGroup', $c); 28 | foreach ($groups as $group) { 29 | $grp = $group->toArray(); 30 | $grp['items'] = []; 31 | 32 | $c = $this->modx->newQuery('cgSetting'); 33 | $c->sortby('sortorder','ASC'); 34 | $c->sortby('label','ASC'); 35 | foreach ($group->getMany('Settings', $c) as $setting) { 36 | $sa = $setting->toArray(); 37 | if (in_array($sa['xtype'], ['checkbox','xcheckbox'], true)) { 38 | $sa['value'] = (bool)$sa['value']; 39 | } 40 | 41 | if ($sa['xtype'] === 'googlefontlist') { 42 | $googleFontsApiKey = $this->modx->getOption('clientconfig.google_fonts_api_key', null, ''); 43 | $sa['xtype'] = empty($googleFontsApiKey) ? 'textfield' : $sa['xtype']; 44 | } 45 | elseif ($sa['xtype'] === 'modx-combo' && $setting->get('process_options')) { 46 | $inputOpts = $setting->get('options'); 47 | $this->modx->getParser(); 48 | $this->modx->parser->processElementTags('', $inputOpts, true, true); 49 | $sa['options'] = $inputOpts; 50 | } 51 | $grp['items'][] = $sa; 52 | } 53 | $tabs[] = $grp; 54 | } 55 | $this->loadRichTextEditor(); 56 | $this->tabs = $tabs; 57 | 58 | if (array_key_exists('context', $scriptProperties) && $this->modx->getOption('clientconfig.context_aware')) { 59 | $key = $scriptProperties['context']; 60 | $context = $this->modx->getObject('modContext', ['key' => $key]); 61 | if ($context instanceof \modContext || $context instanceof \MODX\Revolution\modContext) { 62 | 63 | $this->addHtml('<script type="text/javascript"> 64 | Ext.onReady(function() { 65 | ClientConfig.initialContext = ' . $context->toJSON() . '; 66 | }); 67 | </script>'); 68 | } 69 | } 70 | } 71 | 72 | /** 73 | * The pagetitle to put in the <title> attribute. 74 | * @return null|string 75 | */ 76 | public function getPageTitle() { 77 | return $this->modx->lexicon('clientconfig'); 78 | } 79 | 80 | /** 81 | * Register all the needed javascript files. Using this method, it will automagically 82 | * combine and compress them if enabled in system settings. 83 | */ 84 | public function loadCustomCssJs() { 85 | $this->addCss($this->clientconfig->config['jsUrl'] . 'mgr/extras/colorpicker/colorpicker.css'); 86 | 87 | 88 | $mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL); 89 | $this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); 90 | 91 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/extras/colorpicker/colorpicker.js'); 92 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/extras/colorpicker/colorpickerfield.js'); 93 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/widgets/combos.js'); 94 | $this->addLastJavascript($this->clientconfig->config['jsUrl'].'mgr/sections/home.js'); 95 | 96 | $contextAware = $this->modx->getOption('clientconfig.context_aware') ? 'true' : 'false'; 97 | $this->addHtml('<script type="text/javascript"> 98 | Ext.onReady(function() { 99 | ClientConfig.data = '.$this->modx->toJSON($this->tabs).'; 100 | ClientConfig.contextAware = ' . $contextAware . '; 101 | ClientConfig.isAdmin = ' . (($this->clientconfig->hasAdminPermission()) ? '1' : '0') .'; 102 | MODx.load({ xtype: "clientconfig-page-home" }); 103 | }); 104 | </script>'); 105 | } 106 | 107 | /** 108 | * The name for the template file to load. 109 | * @return string 110 | */ 111 | public function getTemplateFile() { 112 | return $this->clientconfig->config['templatesPath'].'home.tpl'; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /core/components/clientconfig/docs/changelog.txt: -------------------------------------------------------------------------------- 1 | ClientConfig 2.5.0-pl 2 | ---------------------- 3 | Released on 2025-02-01 4 | 5 | - Add image preview for image fields (@Boshnik) [#212] 6 | - Check if settings exist before saving cache to prevent cache corruption (@Peeet93) [#213] 7 | 8 | ClientConfig 2.4.0-pl 9 | ---------------------- 10 | Released on 2023-11-07 11 | 12 | - Fix GoogleFontList on MODX3 [#204, #205] 13 | - Change when ClientConfig_ConfigChange event is run: the cache will now be cleared first [#200] 14 | - Fix Redactor not updating value on context switch [#199, #208] 15 | 16 | ClientConfig 2.3.3-pl 17 | --------------------- 18 | Released on 2022-09-17 19 | 20 | - Guard against pdoToolsOnFenomInit event from triggering more than once causing a fatal loop [#198] 21 | - Fix contexts dropdown not displaying in the same order as the resource tree. Now sorts by rank rather than key. [1eceff9] 22 | - Add tooltips showing placeholder syntax to image and file settings. [#183] 23 | - Fix context aware mode being disabled when upgrading remotely. [#177] 24 | 25 | ClientConfig 2.3.2-pl 26 | --------------------- 27 | Released on 2022-07-15 28 | 29 | - Fix strict type check in plugin for MODX 3.x [#195] 30 | - Lower priority of onHandleRequest event on install so context mode works reliably out of the box with routing plugins. [#196] 31 | 32 | ClientConfig 2.3.1-pl 33 | --------------------- 34 | Released on 2022-06-13 35 | 36 | - Fix "Choose Context" combobox not loading in MODX 3.x [#193] 37 | - Fix double asterisks being displayed on required fields in MODX 3.x [#189] 38 | - Fix admin grids not resizing when browser is resized [#194] 39 | 40 | ClientConfig 2.3.0-pl 41 | --------------------- 42 | Released on 2019-10-24 43 | 44 | - Add icon to the menu item (when moved to the top navigation) [#175] 45 | - Make placeholders available for inherited fenom templates [#173, #174] 46 | - Make textarea fields bigger and automatically growing with the content [#172] 47 | - Allow a hash in the url containing the ID of a group to automatically open to that tab [#169] 48 | - Add a line/divider field type to create simple sections [#149] 49 | - Add a code field type (requires Ace editor) for things like custom CSS or other markup [#144] 50 | - Add an email field type which validates the value to be an email address [#65] 51 | - Include OnHandleRequest plugin event (alongside OnMODXInit), to make ClientConfig play nicer with various context routing and other solutions that don't use OnMODXInit [#140] 52 | - Add separate "Save" and "Save and close" buttons to the setting window [#135] 53 | 54 | ClientConfig 2.2.0-pl 55 | --------------------- 56 | Released on 2019-08-19 57 | 58 | - Fix media source path being included for empty values [#152] 59 | - When context values are empty, it will now fall back to the global value 60 | 61 | ClientConfig 2.1.0-pl 62 | --------------------- 63 | Released on 2018-12-05 64 | 65 | - Update menu to no longer rely on modAction, instead using namespace routing [#158, #139] 66 | - Fix image/file fields not refreshing when switching context [#147, #155] 67 | - Adjust plugin to accept both OnMODXInit and OnHandleRequest so you can change the event it runs on, if needed [#140] 68 | - Prevent events (i.e., priority) from being overwritten on upgrade [#148] 69 | 70 | ClientConfig 2.0.0-pl 71 | --------------------- 72 | Released on 2018-06-26 73 | 74 | - Don't add _duplicate to the key when duplicating a setting [#142] 75 | - Updated German [#141], Russian [#145] and Dutch translations 76 | 77 | ClientConfig 2.0.0-rc1 78 | ---------------------- 79 | Released on 2017-10-04 80 | 81 | - ClientConfig can now (optionally) manage settings for different contexts [#4/#112] 82 | - Media fields (image/file) now prefix the media source url [#124] 83 | - Allow snippet/chunk tags in options for the dropdown field [#104] 84 | - Updated minimum requirements to PHP 5.5.0 and MODX 2.5.2. 85 | - Added separate clientconfig.categories lexicon for the vertical tabs interface [#91] 86 | 87 | ClientConfig 1.4.2-pl 88 | --------------------- 89 | Released on 2017-07-22 90 | 91 | - Restore PHP 5.3 compatibility in creating settings. Note: next release will require 5.5+! 92 | - Fix issue saving settings on certain environments due to missing value for source [#129] 93 | - Fix incorrect header/container alignment in both manager pages [#128] 94 | - Fix (unused) namespace assets path (on new installs) [#126] 95 | 96 | ClientConfig 1.4.1-pl 97 | --------------------- 98 | Released on 2017-02-02 99 | 100 | - Fix bug where the new source dropdown does not appear for image field types 101 | 102 | ClientConfig 1.4.0-pl 103 | --------------------- 104 | Released on 2017-01-31 105 | 106 | - Fix loading of TinyMCE RTE, causing it to be initialised without configuration [#122] 107 | - Add ClientConfig_ConfigChange event to be able of hooking into configuration changes [#117] 108 | - Change plugin event from OnHandleRequest to OnMODXInit [#87, #109, #115] 109 | - Enable inline editing in the admin component [#94, #95, #114] 110 | - Fix field-required errors not being shown by adding a popup 111 | - Accept 0 as valid required value on the number input [#119] 112 | - Add a Password input type [#105] 113 | - Add a File input type [#36] 114 | - Don't show "Error adding field" errors during installation/upgrade [#92] 115 | - Fix loading RTE if the field key contains a dot [#89] 116 | - Add CMD/CTRL + S shortcut for saving the configuration [#80] 117 | - Preserve linebreaks when editing a setting in the admin section by using a textarea for the value [#69] 118 | - Relicense under the MIT license instead of GPL [#67] 119 | - Allow specifying a media source for the image input type [#66] 120 | 121 | ClientConfig 1.3.2-pl 122 | --------------------- 123 | Released on 2015-12-09 124 | 125 | - Update French translation 126 | - Make sure image field uses the MODX default media source 127 | - Respect manager_date_format and manager_time_format settings 128 | 129 | ClientConfig 1.3.1-pl 130 | --------------------- 131 | Released on 2014-07-20 132 | 133 | - Update Dutch translation 134 | - More weird border fixes 135 | - Minor fix to when borders are added, specifically for 2.2. 136 | 137 | ClientConfig 1.3.0-pl 138 | --------------------- 139 | Released on 2014-07-19 140 | 141 | - #27 Ability to import/export groups and settings 142 | - #16 Auto-select first group when adding a setting 143 | - #15 Force admins to create a group before creating a setting, as settings need groups 144 | - #76 Fix issue where unchecking a checkbox would fail if the setting was required 145 | - #78 Make the is_required column show Yes/No instead of true/false 146 | - #60 Get rid of an extra border 147 | - #75 Update help link to point to modmore.com 148 | 149 | ClientConfig 1.2.1-pl 150 | --------------------- 151 | Released on 2014-01-07 152 | 153 | - #57 Add Google Font input type (Thanks @garryn) 154 | - #63 Fix issue loading more than one rich text field 155 | 156 | ClientConfig 1.2.0-pl 157 | --------------------- 158 | Released on 2013-08-16 159 | 160 | - #38 Add setting (vertical_tabs) to allow stacking groups vertically instead of horizontal tabs 161 | - #46 Add ability to duplicate a setting 162 | - #45 Show field options field when editing a select box setting. 163 | - #54 Add Rich Text input type. 164 | - Improved width consistency of input items. 165 | - #37 Added input type Image (thanks COEX!) 166 | - #3 Fix/add colorpicker input type (thanks COEX!) 167 | 168 | ClientConfig 1.1.2-pl 169 | --------------------- 170 | Released on 2013-03-07 171 | 172 | - Add/update translations: Russian (thx @Alroniks!), German (thx @enigmatic-user!), Swedish (thx @fractalwolfe!) and Dutch. 173 | - #47 Show field descriptions under the fields. (Thanks @fractalwolfe!) 174 | - #40 Add placeholder tooltips with the for admins. (Thanks @fractalwolfe!) 175 | 176 | ClientConfig 1.1.1-pl 177 | --------------------- 178 | Released on 2012-12-31 179 | 180 | - #35 Don't strip out tags when saving values (relies on allow_tags_in_post=true in mgr context). 181 | - #39 Increase database field max sizes for longer descriptions and values. 182 | - #33 Make sure to show message when no tabs are to be shown. 183 | - #34 Prevent E_WARNING when there are no settings configured. 184 | 185 | ClientConfig 1.1.0-pl 186 | --------------------- 187 | Released on 2012-12-16 188 | 189 | - #26 Add ability to manually sort Settings within a Group 190 | - #25 Add ability to manually sort Groups 191 | - #21 Add Filter on Group for settings. 192 | - #24 Remember last visited tab in both admin and client view. 193 | - #22 Add "Help!" button on Admin panel linking to RTFM instructions. 194 | - Improve checking if key exists on updating a setting. 195 | - #30 Fix bug with incorrectly checking cgSetting.is_required checkbox 196 | - Make controller a tad more portable. 197 | 198 | ClientConfig 1.0.0-pl 199 | --------------------- 200 | Released on 2012-12-09 201 | 202 | First release 203 | -------------------------------------------------------------------------------- /core/components/clientconfig/docs/license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mark Hamstra Web Development <hello@markhamstra.com> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | -------------------------------------------------------------------------------- /core/components/clientconfig/docs/readme.txt: -------------------------------------------------------------------------------- 1 | ------------------------- 2 | ClientConfig 3 | ------------------------- 4 | Author: Mark Hamstra 5 | Contact: mark@modmore.com 6 | ------------------------- 7 | 8 | ClientConfig is the by product of a workshop at MODXpo Europe 2012, 9 | the "Developing Extras in MODX" one. See the session page at modxpo.eu 10 | http://modxpo.eu/schedule/sessions/developing-extras-for-modx-hands-on 11 | for more information and footage of the workshop. 12 | 13 | ClientConfig gives your client a user-friendly interface for making site 14 | wide changes, while you as the administrator set up the different options 15 | available to the end-user. 16 | 17 | Possible uses include: 18 | - Regularly update a slogan or tag-line in header or footer 19 | - Change call-to-action button colors based on the season 20 | - Keep contact details updated in one central location 21 | - Update the email-address a form sends notifications to. 22 | 23 | Licensed under the MIT. -------------------------------------------------------------------------------- /core/components/clientconfig/elements/plugins/clientconfig.plugin.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * 22 | * @var modX $modx 23 | * @var int $id 24 | * @var string $mode 25 | * @var modResource $resource 26 | * @var modTemplate $template 27 | * @var modTemplateVar $tv 28 | * @var modChunk $chunk 29 | * @var modSnippet $snippet 30 | * @var modPlugin $plugin 31 | */ 32 | 33 | $eventName = $modx->event->name; 34 | 35 | switch($eventName) { 36 | case 'OnMODXInit': 37 | case 'OnHandleRequest': 38 | case 'pdoToolsOnFenomInit': 39 | // Measure to guard against pdoTools fenom parser loop bug: https://github.com/modmore/ClientConfig/issues/192 40 | // Here we only allow the pdoToolsOnFenomInit event to trigger the first time. 41 | if ($eventName === 'pdoToolsOnFenomInit') { 42 | if ($modx->getOption('clientconfig.fenom_initialized')) { 43 | return; 44 | } 45 | $modx->setOption('clientconfig.fenom_initialized', true); 46 | } 47 | 48 | /* Grab the class */ 49 | $path = $modx->getOption('clientconfig.core_path', null, $modx->getOption('core_path') . 'components/clientconfig/'); 50 | $path .= 'model/clientconfig/'; 51 | $clientConfig = $modx->getService('clientconfig','ClientConfig', $path); 52 | 53 | /* If we got the class (gotta be careful of failed migrations), grab settings and go! */ 54 | if ($clientConfig instanceof ClientConfig) { 55 | $contextKey = $modx->context instanceof modContext || $modx->context instanceof \MODX\Revolution\modContext 56 | ? $modx->context->get('key') : 'web'; 57 | $settings = $clientConfig->getSettings($contextKey); 58 | 59 | /* Make settings available as [[++tags]] */ 60 | $modx->setPlaceholders($settings, '+'); 61 | 62 | /* Make settings available for $modx->getOption() */ 63 | foreach ($settings as $key => $value) { 64 | $modx->setOption($key, $value); 65 | } 66 | } 67 | break; 68 | } 69 | 70 | return; -------------------------------------------------------------------------------- /core/components/clientconfig/index.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | /** 4 | * The main ClientConfig Manager Controller. 5 | * In this class, we define stuff we want on all of our controllers. 6 | */ 7 | abstract class ClientConfigManagerController extends modExtraManagerController { 8 | /** @var ClientConfig $clientconfig */ 9 | public $clientconfig = null; 10 | 11 | /** 12 | * Initializes the main manager controller. In this case we set up the 13 | * ClientConfig class and add the required javascript on all controllers. 14 | */ 15 | public function initialize() { 16 | /* Instantiate the ClientConfig class in the controller */ 17 | $path = $this->modx->getOption('clientconfig.core_path', null, $this->modx->getOption('core_path') . 'components/clientconfig/') . 'model/clientconfig/'; 18 | $this->clientconfig =& $this->modx->getService('clientconfig', 'ClientConfig', $path); 19 | 20 | // MODX 3.x automatically adds asterisks to required fields, MODX 2.x doesn't. 21 | $modxVersion = $this->modx->getVersionData(); 22 | $reqAsterisk = version_compare($modxVersion['full_version'], '3.0.0-dev', '>=') ? '' : '*'; 23 | 24 | /* Add the main javascript class and our configuration */ 25 | $this->addJavascript($this->clientconfig->config['jsUrl'].'mgr/clientconfig.class.js'); 26 | $this->addCss($this->clientconfig->config['cssUrl'].'mgr/clientconfig.css'); 27 | $this->addHtml('<script type="text/javascript"> 28 | Ext.onReady(function() { 29 | ClientConfig.config = '.$this->modx->toJSON($this->clientconfig->config).'; 30 | ClientConfig.reqAsterisk = "' . $reqAsterisk . '"; 31 | }); 32 | </script>'); 33 | } 34 | 35 | /** 36 | * Defines the lexicon topics to load in our controller. 37 | * @return array 38 | */ 39 | public function getLanguageTopics() { 40 | return array('clientconfig:default'); 41 | } 42 | 43 | /** 44 | * We can use this to check if the user has permission to see this 45 | * controller. We'll apply this in the admin section. 46 | * @return bool 47 | */ 48 | public function checkPermissions() { 49 | return true; 50 | } 51 | 52 | public function loadRichTextEditor() 53 | { 54 | $useEditor = $this->modx->getOption('use_editor'); 55 | $whichEditor = $this->modx->getOption('which_editor'); 56 | if ($useEditor && !empty($whichEditor)) 57 | { 58 | /* invoke OnRichTextEditorInit event */ 59 | $onRichTextEditorInit = $this->modx->invokeEvent('OnRichTextEditorInit',array( 60 | 'editor' => $whichEditor, 61 | 'elements' => array('foo'), 62 | )); 63 | if (is_array($onRichTextEditorInit)) 64 | { 65 | $onRichTextEditorInit = implode('', $onRichTextEditorInit); 66 | } 67 | $this->setPlaceholder('onRichTextEditorInit', $onRichTextEditorInit); 68 | } 69 | } 70 | } 71 | 72 | /** 73 | * The Index Manager Controller is the default one that gets called when no 74 | * action is present. It's most commonly used to define the default controller 75 | * which then hands over processing to the other controller ("home"). 76 | */ 77 | class IndexManagerController extends ClientConfigManagerController { 78 | /** 79 | * Defines the name or path to the default controller to load. 80 | * @return string 81 | */ 82 | public static function getDefaultController() { 83 | return 'home'; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/de/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | */ 22 | 23 | $_lang['clientconfig'] = 'Konfiguration'; 24 | $_lang['clientconfig.desc'] = 'Erstellen und bearbeiten Sie die Site-Konfiguration.'; 25 | $_lang['clientconfig.add_setting'] = 'Einstellung hinzufügen'; 26 | $_lang['clientconfig.update_setting'] = 'Einstellung bearbeiten'; 27 | $_lang['clientconfig.duplicate_setting'] = 'Einstellung duplizieren'; 28 | $_lang['clientconfig.remove_setting'] = 'Einstellung löschen'; 29 | $_lang['clientconfig.remove_setting.confirm'] = 'Sind Sie sicher, dass Sie diese Einstellung löschen möchten?'; 30 | $_lang['clientconfig.add_group'] = 'Gruppe hinzufügen'; 31 | $_lang['clientconfig.update_group'] = 'Gruppe bearbeiten'; 32 | $_lang['clientconfig.remove_group'] = 'Gruppe löschen'; 33 | $_lang['clientconfig.remove_group.confirm'] = 'Sind Sie sicher, dass Sie diese Gruppe löschen möchten? Alle Einstellungen in dieser Gruppe werden für den Kunden nicht sichtbar sein, wenn Sie sie nicht einer anderen Gruppe hinzufügen.'; 34 | $_lang['clientconfig.admin'] = 'Admin'; 35 | $_lang['clientconfig.adminpanel'] = 'Konfigurations-Admin-Bereich'; 36 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'Der Schlüssel für die Einstellung muss eingegeben werden.'; // ist erforderlich 37 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Eine andere Einstellung mit diesem Schlüssel existiert bereits.'; // Schlüssel mit diesem Schlüssel??? 38 | $_lang['clientconfig.description'] = 'Beschreibung'; 39 | $_lang['clientconfig.default'] = 'Standardwert'; 40 | $_lang['clientconfig.error.noresults'] = 'Keine Einstellungen gefunden.'; 41 | $_lang['clientconfig.filter_on_group'] = 'Nach Gruppe filtern'; 42 | $_lang['clientconfig.id'] = 'ID'; 43 | $_lang['clientconfig.is_required'] = 'Pflicht?'; // Erf.(orderlich)? 44 | $_lang['clientconfig.is_required.long'] = 'Einstellung ist erforderlich'; // Pflicht o. Ä. 45 | $_lang['clientconfig.group'] = 'Gruppe'; 46 | $_lang['clientconfig.groups'] = 'Gruppen'; 47 | $_lang['clientconfig.key'] = 'Schlüssel'; 48 | $_lang['clientconfig.label'] = 'Bezeichnung'; // Label - Name? 49 | $_lang['clientconfig.no_configuration_yet'] = 'Keine Konfiguration vorhanden'; 50 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Offenbar wurde noch keine Konfiguration eingerichtet. Wenn Sie der Administrator dieser Site sind, folgen Sie bitte der <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">offiziellen Dokumentation</a>, um eine Konfiguration für Ihren Kunden einzurichten.'; 51 | $_lang['clientconfig.options'] = 'Feld-Optionen'; 52 | $_lang['clientconfig.options.desc'] = 'Für bestimmte Feldtypen wie Selectboxen können Sie Optionen definieren. Trennen Sie die verschiedenen Optionen mit zwei senkrechten Strichen (||), auch Pipe-Symbol genannt, und wenn Sie möchten, dass dem Kunden etwas anderes angezeigt wird als der Wert, verwenden Sie die Schreibweise "Bezeichnung==Wert". '; // Label - Name? 53 | $_lang['clientconfig.save_config'] = 'Konfiguration speichern'; 54 | $_lang['clientconfig.sortorder'] = 'Sortierreihenfolge'; 55 | $_lang['clientconfig.settings'] = 'Einstellungen'; 56 | $_lang['clientconfig.settings_count'] = '# der Einstellungen'; 57 | $_lang['clientconfig.value'] = 'Wert'; 58 | $_lang['clientconfig.xtype'] = 'Feldtyp'; 59 | $_lang['clientconfig.xtype.textfield'] = 'Text'; 60 | $_lang['clientconfig.xtype.textarea'] = 'Textarea'; 61 | $_lang['clientconfig.xtype.richtext'] = 'RichText'; 62 | $_lang['clientconfig.xtype.numberfield'] = 'Zahl'; 63 | $_lang['clientconfig.xtype.colorpalette'] = 'Farbwähler'; // Colorpicker 64 | $_lang['clientconfig.xtype.xcheckbox'] = 'Checkbox'; 65 | $_lang['clientconfig.xtype.datefield'] = 'Datum'; 66 | $_lang['clientconfig.xtype.timefield'] = 'Zeit'; 67 | $_lang['clientconfig.xtype.combobox'] = 'Selectbox'; // Listbox (einfache Auswahl), Listenauswahlfeld, ... (s. a. clientconfig.options.desc) 68 | $_lang['clientconfig.xtype.image'] = 'Bild'; 69 | $_lang['clientconfig.xtype.googlefonts'] = 'Google-Schriftarten-Liste'; 70 | $_lang['clientconfig.to_client_view'] = 'Zur Kunden-Ansicht'; 71 | $_lang['clientconfig.saved'] = 'Gespeichert'; 72 | $_lang['clientconfig.saved.text'] = 'Die Einstellungen wurden gespeichert.'; 73 | $_lang['clientconfig.field_is_required'] = 'Diese Option kann nicht leer gelassen werden.'; 74 | 75 | // New 2014/07/20 76 | $_lang['clientconfig.create_groups_first'] = 'Erstellen Sie zuerst eine Gruppe'; 77 | $_lang['clientconfig.create_groups_first.desc'] = 'Entschuldigung, aber bevor Sie Einstellungen hinzufügen können, muss mindestens eine Gruppe existieren. Ohne Gruppen können dem Kunden keine Einstellungen angezeigt werden.'; 78 | 79 | $_lang['clientconfig.export_settings'] = 'Einstellungen exportieren'; 80 | $_lang['clientconfig.export_settings.confirm'] = 'Wenn Sie unten auf "Ja" klicken, wird eine XML-Datei generiert und heruntergeladen, die alle ClientConfig-Einstellungen enthält. Sind Sie sicher, dass Sie fortfahren möchten?'; 81 | $_lang['clientconfig.import_settings'] = 'Einstellungen importieren'; 82 | $_lang['clientconfig.import_settings.desc'] = 'Wenn Sie eine XML-Datei hochladen und den richtigen Importmodus wählen, können Sie zuvor oder aus einer anderen Installation exportierte Einstellungen importieren. <b>Hinweis:</b> Einstellungen enthalten Verweise auf Gruppen über ihre ID; wenn Sie Einstellungen importieren, müssen Sie vermutlich auch die zugehörigen Gruppen importieren.'; 83 | 84 | $_lang['clientconfig.export_groups'] = 'Gruppen exportieren'; 85 | $_lang['clientconfig.export_groups.confirm'] = 'Wenn Sie unten auf "Ja" klicken, wird eine XML-Datei generiert und heruntergeladen, die alle ClientConfig-Gruppen enthält. Sind Sie sicher, dass Sie fortfahren möchten?'; 86 | $_lang['clientconfig.import_groups'] = 'Gruppen importieren'; 87 | $_lang['clientconfig.import_groups.desc'] = 'Wenn Sie eine XML-Datei hochladen und den richtigen Importmodus wählen, können Sie zuvor oder aus einer anderen Installation exportierte Gruppen importieren.'; 88 | 89 | $_lang['clientconfig.import_file'] = 'Zu importierende Datei'; 90 | $_lang['clientconfig.import_mode'] = 'Import-Modus'; 91 | $_lang['clientconfig.import_mode.insert'] = 'Einfügen: bestehende [[+what]] beibehalten und neue Daten hinzufügen'; 92 | $_lang['clientconfig.import_mode.overwrite'] = 'Überschreiben: bestehende [[+what]] beibehalten, aber überschreiben, wenn sie dieselbe ID haben'; 93 | $_lang['clientconfig.import_mode.replace'] = 'Ersetzen: zunächst alle bestehenden [[+what]] löschen, dann die neuen Daten importieren'; 94 | $_lang['clientconfig.start_import'] = 'Import starten'; 95 | $_lang['clientconfig.error.xml_not_loaded'] = 'Es wurde keine gültige XML-Datei hochgeladen.'; 96 | $_lang['clientconfig.error.not_an_export'] = 'Die hochgeladene Datei ist keine gültige Export-Datei für ClientConfig.'; 97 | $_lang['clientconfig.error.importing_row'] = 'Etwas ging schief beim Speichern einer Zeile der Export-Datei: '; 98 | 99 | // New 2017-01-31 100 | $_lang['clientconfig.xtype.password'] = 'Passwort'; 101 | $_lang['clientconfig.xtype.file'] = 'Datei'; 102 | $_lang['clientconfig.source'] = 'Medienquelle'; 103 | $_lang['clientconfig.source.desc'] = 'Die Medienquelle, die für den Datei-Browser verwendet werden soll.'; 104 | 105 | // New 2017-09-13 106 | $_lang['clientconfig.choose_context'] = 'Kontext wählen'; 107 | $_lang['clientconfig.global_values'] = 'Global'; 108 | $_lang['clientconfig.config_for_context'] = 'Konfiguration für [[+context]]'; 109 | $_lang['clientconfig.categories'] = 'Kategorien'; 110 | $_lang['clientconfig.process_options'] = 'MODX-Syntax in Optionen auswerten'; 111 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/en/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | */ 22 | 23 | $_lang['clientconfig'] = 'Configuration'; 24 | $_lang['clientconfig.desc'] = 'Set and update site configuration.'; 25 | $_lang['clientconfig.add_setting'] = 'Add Setting'; 26 | $_lang['clientconfig.update_setting'] = 'Update Setting'; 27 | $_lang['clientconfig.duplicate_setting'] = 'Duplicate Setting'; 28 | $_lang['clientconfig.remove_setting'] = 'Remove Setting'; 29 | $_lang['clientconfig.remove_setting.confirm'] = 'Are you sure you want to remove this setting?'; 30 | $_lang['clientconfig.add_group'] = 'Add Group'; 31 | $_lang['clientconfig.update_group'] = 'Update Group'; 32 | $_lang['clientconfig.remove_group'] = 'Remove Group'; 33 | $_lang['clientconfig.remove_group.confirm'] = 'Are you sure you want to remove this group? All settings in this group will not be visible for the client until you add them to a different group.'; 34 | $_lang['clientconfig.admin'] = 'Admin'; 35 | $_lang['clientconfig.adminpanel'] = 'Configuration Admin Panel'; 36 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'The key for the setting is required.'; 37 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Another setting already exists with that key.'; 38 | $_lang['clientconfig.description'] = 'Description'; 39 | $_lang['clientconfig.default'] = 'Default value'; 40 | $_lang['clientconfig.error.noresults'] = 'No items found.'; 41 | $_lang['clientconfig.filter_on_group'] = 'Filter on Group'; 42 | $_lang['clientconfig.id'] = 'ID'; 43 | $_lang['clientconfig.is_required'] = 'Req\'d?'; 44 | $_lang['clientconfig.is_required.long'] = 'Setting is required'; 45 | $_lang['clientconfig.group'] = 'Group'; 46 | $_lang['clientconfig.groups'] = 'Groups'; 47 | $_lang['clientconfig.key'] = 'Key'; 48 | $_lang['clientconfig.label'] = 'Label'; 49 | $_lang['clientconfig.no_configuration_yet'] = 'No Configuration Available'; 50 | $_lang['clientconfig.no_configuration_yet.desc'] = 'It seems there is no configuration set up yet. If you are the administrator of the site, please <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">follow the official documentation</a> to set up configuration for your client.'; 51 | $_lang['clientconfig.options'] = 'Field Options'; 52 | $_lang['clientconfig.options.desc'] = 'For certain field types like select boxes, you can define options. Separate different options with two colons (||) and if you want a different value than what the client sees, use "label==value". '; 53 | $_lang['clientconfig.save_config'] = 'Save Configuration'; 54 | $_lang['clientconfig.sortorder'] = 'Sort Order'; 55 | $_lang['clientconfig.settings'] = 'Settings'; 56 | $_lang['clientconfig.settings_count'] = '# of Settings'; 57 | $_lang['clientconfig.value'] = 'Value'; 58 | $_lang['clientconfig.xtype'] = 'Field type'; 59 | $_lang['clientconfig.xtype.textfield'] = 'Text'; 60 | $_lang['clientconfig.xtype.textarea'] = 'Textarea'; 61 | $_lang['clientconfig.xtype.richtext'] = 'Rich Text'; 62 | $_lang['clientconfig.xtype.numberfield'] = 'Number'; 63 | $_lang['clientconfig.xtype.colorpalette'] = 'Colorpicker'; 64 | $_lang['clientconfig.xtype.xcheckbox'] = 'Checkbox'; 65 | $_lang['clientconfig.xtype.datefield'] = 'Date'; 66 | $_lang['clientconfig.xtype.timefield'] = 'Time'; 67 | $_lang['clientconfig.xtype.combobox'] = 'Selectbox'; 68 | $_lang['clientconfig.xtype.image'] = 'Image'; 69 | $_lang['clientconfig.xtype.googlefonts'] = 'Google Font List'; 70 | $_lang['clientconfig.to_client_view'] = 'To Client View'; 71 | $_lang['clientconfig.saved'] = 'Saved'; 72 | $_lang['clientconfig.saved.text'] = 'The settings have been saved.'; 73 | $_lang['clientconfig.field_is_required'] = 'This option cannot be left empty.'; 74 | 75 | // New 2014/07/20 76 | $_lang['clientconfig.create_groups_first'] = 'Create a Group first'; 77 | $_lang['clientconfig.create_groups_first.desc'] = 'Sorry, but before you can add a setting you\'ll need to have at least one group. Without groups, settings cannot be displayed to the Client.'; 78 | 79 | $_lang['clientconfig.export_settings'] = 'Export Settings'; 80 | $_lang['clientconfig.export_settings.confirm'] = 'When you click Yes below, an XML file will be generated and downloaded holding all ClientConfig settings. Are you sure you want to continue?'; 81 | $_lang['clientconfig.import_settings'] = 'Import Settings'; 82 | $_lang['clientconfig.import_settings.desc'] = 'By uploading an XML file and choosing the right import mode, you can import Settings you exported before or from a different site. <b>Note:</b> Settings contain references to Groups by their ID; if you are importing Settings, you will probably need to import Groups as well.'; 83 | 84 | $_lang['clientconfig.export_groups'] = 'Export Groups'; 85 | $_lang['clientconfig.export_groups.confirm'] = 'When you click Yes below, an XML file will be generated and downloaded holding all ClientConfig groups. Are you sure you want to continue?'; 86 | $_lang['clientconfig.import_groups'] = 'Import Groups'; 87 | $_lang['clientconfig.import_groups.desc'] = 'By uploading an XML file and choosing the right import mode, you can import Groups you exported before or from a different site. '; 88 | 89 | $_lang['clientconfig.import_file'] = 'File to Import'; 90 | $_lang['clientconfig.import_mode'] = 'Import Mode'; 91 | $_lang['clientconfig.import_mode.insert'] = "Insert: leave existing [[+what]] and add the imported data"; 92 | $_lang['clientconfig.import_mode.overwrite'] = "Overwrite: leave existing [[+what]], but overwrite them if they have the same ID"; 93 | $_lang['clientconfig.import_mode.replace'] = "Replace: first remove all current [[+what]], and then import the new rows"; 94 | $_lang['clientconfig.start_import'] = 'Start Import'; 95 | $_lang['clientconfig.error.xml_not_loaded'] = 'No valid XML file uploaded.'; 96 | $_lang['clientconfig.error.not_an_export'] = 'The uploaded file is not a valid export file for ClientConfig.'; 97 | $_lang['clientconfig.error.importing_row'] = 'Something went wrong saving a row of the export: '; 98 | 99 | // New 2017-01-31 100 | $_lang['clientconfig.xtype.password'] = 'Password'; 101 | $_lang['clientconfig.xtype.file'] = 'File'; 102 | $_lang['clientconfig.source'] = 'Media Source'; 103 | $_lang['clientconfig.source.desc'] = 'The media source to use for the file browser.'; 104 | 105 | // New 2017-09-13 106 | $_lang['clientconfig.choose_context'] = 'Choose Context'; 107 | $_lang['clientconfig.global_values'] = 'Global'; 108 | $_lang['clientconfig.config_for_context'] = 'Configuration for [[+context]]'; 109 | $_lang['clientconfig.categories'] = 'Categories'; 110 | $_lang['clientconfig.process_options'] = 'Process tags in options'; 111 | 112 | // New 2019-10-24 113 | $_lang['clientconfig.xtype.line'] = 'Line (divider)'; 114 | $_lang['clientconfig.xtype.code'] = 'Code (requires Ace editor installed)'; 115 | $_lang['clientconfig.xtype.email'] = 'Email'; 116 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/fi/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * Finnish translation Vesa Särkelä 23.1.2019 20 | * 21 | * @package clientconfig 22 | */ 23 | 24 | $_lang['clientconfig'] = 'Sivuston elementit'; 25 | $_lang['clientconfig.desc'] = 'Muokkaa koko sivustoa koskevia elementtejä.'; 26 | $_lang['clientconfig.add_setting'] = 'Lisää asetus'; 27 | $_lang['clientconfig.update_setting'] = 'Päivitä asetus'; 28 | $_lang['clientconfig.duplicate_setting'] = 'Tee kopio asetusesta'; 29 | $_lang['clientconfig.remove_setting'] = 'Poista asetus'; 30 | $_lang['clientconfig.remove_setting.confirm'] = 'Haluatko varmasti poistaa asetuksen?'; 31 | $_lang['clientconfig.add_group'] = 'Lisää ryhmä'; 32 | $_lang['clientconfig.update_group'] = 'Muokkaa ryhmää'; 33 | $_lang['clientconfig.remove_group'] = 'Poista ryhmä'; 34 | $_lang['clientconfig.remove_group.confirm'] = 'Haluatko varmasti poistaa ryhmän? Kaikki asetukset ryhmässä lakkaavat näkymästä asiakkaalle ennenkuin lisäät asetukset johonkin toiseen ryhmään.'; 35 | $_lang['clientconfig.admin'] = 'Hallitse'; 36 | $_lang['clientconfig.adminpanel'] = 'Asetusten hallintapaneeli'; 37 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'Asetuksen avain on pakollinen.'; 38 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Jokin toinen asetus käyttää samaa avainta.'; 39 | $_lang['clientconfig.description'] = 'Kuvaus'; 40 | $_lang['clientconfig.default'] = 'Oletusasetukset'; 41 | $_lang['clientconfig.error.noresults'] = 'Kohteita ei löytynyt.'; 42 | $_lang['clientconfig.filter_on_group'] = 'Suodata ryhmiä'; 43 | $_lang['clientconfig.id'] = 'ID'; 44 | $_lang['clientconfig.is_required'] = 'Pakollinen'; 45 | $_lang['clientconfig.is_required.long'] = 'Asetus on pakollinen'; 46 | $_lang['clientconfig.group'] = 'Ryhmä'; 47 | $_lang['clientconfig.groups'] = 'Ryhmät'; 48 | $_lang['clientconfig.key'] = 'Avain'; 49 | $_lang['clientconfig.label'] = 'Nimi'; 50 | $_lang['clientconfig.no_configuration_yet'] = 'Ei konfiguraatiota saatavilla'; 51 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Et ole asettanut konfiguraatiota vielä. Jos olet järjestelmän valvoja katso ohjeet asiakkaan lisäämiseksi konfiguraatioihin täältä: <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">follow the official documentation</a>'; 52 | $_lang['clientconfig.options'] = 'Kentän vaihtoehdot'; 53 | $_lang['clientconfig.options.desc'] = 'Joillekkin kentille (kuten valintalaatikko) voit määritellä useita asetuksia. Erota asetukset kahdella palkilla (||) ja jos haluat erillaisen arvon kuin asiakas, käytä "label==value". '; 54 | $_lang['clientconfig.save_config'] = 'Tallenna konfiguraatio'; 55 | $_lang['clientconfig.sortorder'] = 'Lajittelujärjestys'; 56 | $_lang['clientconfig.settings'] = 'Asetukset'; 57 | $_lang['clientconfig.settings_count'] = '# kpl asetuksia'; 58 | $_lang['clientconfig.value'] = 'Arvo'; 59 | $_lang['clientconfig.xtype'] = 'Kenttä'; 60 | $_lang['clientconfig.xtype.textfield'] = 'Tekstikenttä'; 61 | $_lang['clientconfig.xtype.textarea'] = 'Teksatialue -kenttä'; 62 | $_lang['clientconfig.xtype.richtext'] = 'Muotoiltava teksti'; 63 | $_lang['clientconfig.xtype.numberfield'] = 'Luku'; 64 | $_lang['clientconfig.xtype.colorpalette'] = 'Väripipetti'; 65 | $_lang['clientconfig.xtype.xcheckbox'] = 'valintaruutu'; 66 | $_lang['clientconfig.xtype.datefield'] = 'Päiväys'; 67 | $_lang['clientconfig.xtype.timefield'] = 'Aika'; 68 | $_lang['clientconfig.xtype.combobox'] = 'Valintalaatikko'; 69 | $_lang['clientconfig.xtype.image'] = 'Kuva'; 70 | $_lang['clientconfig.xtype.googlefonts'] = 'Googlen kirjasinlista'; 71 | $_lang['clientconfig.to_client_view'] = 'Asiakkaan näkymään'; 72 | $_lang['clientconfig.saved'] = 'Tallennettu'; 73 | $_lang['clientconfig.saved.text'] = 'Asetus on tallennettu.'; 74 | $_lang['clientconfig.field_is_required'] = 'Tätä ei voi jättää tyhjäksi.'; 75 | 76 | // New 2014/07/20 77 | $_lang['clientconfig.create_groups_first'] = 'Luo ryhmä ensiksi'; 78 | $_lang['clientconfig.create_groups_first.desc'] = 'Lisätäksesi asetuksen sinun on lisättävä vähintään yksi ryhmä. Asetuksia ei voi näyttää asikkaalle ilman ryhmiä.'; 79 | 80 | $_lang['clientconfig.export_settings'] = 'Vie asetukset'; 81 | $_lang['clientconfig.export_settings.confirm'] = 'Kun klikkaat kyllä, XML -tiedosto, joka sisältää kaikki asetukset, luodaan ja ladataan. Haluatko jatkaa?'; 82 | $_lang['clientconfig.import_settings'] = 'Tuo asetukset'; 83 | $_lang['clientconfig.import_settings.desc'] = 'Lataamalla XML -tiedoston ja valitsemalla oikean oikean tuontitilan voit tuoda asetuksia muusta järjestelmästä <b>Huomaa:</b> Asetukset sisältävät viittauksia ryhmiin ID:n mukaan. Jos olet tuomassa asetuksia tuo mahdolliset ryhmät myös.'; 84 | 85 | $_lang['clientconfig.export_groups'] = 'Vie ryhmät'; 86 | $_lang['clientconfig.export_groups.confirm'] = 'Kun klikkaat kyllä, XML -tiedosto, joka sisältää kaikki ryhmät, luodaan ja ladataan. Haluatko jatkaa?'; 87 | $_lang['clientconfig.import_groups'] = 'Tuo ryhmät'; 88 | $_lang['clientconfig.import_groups.desc'] = 'Lataamalla XML -tiedoston voit tuoda ryhmiä muusta järjestelmästä.'; 89 | 90 | $_lang['clientconfig.import_file'] = 'Tiedosto tuotavaksi'; 91 | $_lang['clientconfig.import_mode'] = 'Tuontitila'; 92 | $_lang['clientconfig.import_mode.insert'] = "Lisää: Säilytä entiset [[+what]] ja lisää tuotava data"; 93 | $_lang['clientconfig.import_mode.overwrite'] = "Ylikirjoita: Säilytä entiset [[+what]], mutta ylikirjoita ne jos niillä on sama ID"; 94 | $_lang['clientconfig.import_mode.replace'] = "Korvaa: Poista kaikki entiset [[+what]], ja tuo uudet rivit."; 95 | $_lang['clientconfig.start_import'] = 'Aloita tuonti'; 96 | $_lang['clientconfig.error.xml_not_loaded'] = 'XML tiedosto ei ole oikeanlainen, tiedostoa ei ladattu.'; 97 | $_lang['clientconfig.error.not_an_export'] = 'Ladattu tiedosto ei ole oikeanlainen tiedosto Konfigurointiin.'; 98 | $_lang['clientconfig.error.importing_row'] = 'Jotain meni pieleen tallennettaessa viennin riviä: '; 99 | 100 | // New 2017-01-31 101 | $_lang['clientconfig.xtype.password'] = 'Salasana'; 102 | $_lang['clientconfig.xtype.file'] = 'Tiedosto'; 103 | $_lang['clientconfig.source'] = 'Media lähde'; 104 | $_lang['clientconfig.source.desc'] = 'Tiedostoselaimessa käytettävä medialähde.'; 105 | 106 | // New 2017-09-13 107 | $_lang['clientconfig.choose_context'] = 'Valitse Konteksti'; 108 | $_lang['clientconfig.global_values'] = 'Globaali'; 109 | $_lang['clientconfig.config_for_context'] = 'Asetus [[+context]]:lle'; 110 | $_lang['clientconfig.categories'] = 'Kategoriat'; 111 | $_lang['clientconfig.process_options'] = 'Käsittele tagit optioissa'; 112 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/fr/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * French translation by Romain Fallet (@RomainFallet) 7 | * 8 | * ClientConfig is free software; you can redistribute it and/or modify it under the 9 | * terms of the GNU General Public License as published by the Free Software 10 | * Foundation; either version 2 of the License, or (at your option) any later 11 | * version. 12 | * 13 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along with 18 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 19 | * Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | * @package clientconfig 22 | */ 23 | 24 | $_lang['clientconfig'] = 'Configuration'; 25 | $_lang['clientconfig.desc'] = 'Gérer et modifier les paramètres de configuration du site.'; 26 | $_lang['clientconfig.add_setting'] = 'Créer un paramètre'; 27 | $_lang['clientconfig.update_setting'] = 'Mettre à jour'; 28 | $_lang['clientconfig.duplicate_setting'] = 'Dupliquer'; 29 | $_lang['clientconfig.remove_setting'] = 'Supprimer'; 30 | $_lang['clientconfig.remove_setting.confirm'] = 'Êtes-vous sûr de vouloir supprimer ce paramètre de configuration ?'; 31 | $_lang['clientconfig.add_group'] = 'Créer un groupe'; 32 | $_lang['clientconfig.update_group'] = 'Mettre à jour'; 33 | $_lang['clientconfig.remove_group'] = 'Supprimer'; 34 | $_lang['clientconfig.remove_group.confirm'] = 'Êtes-vous sûr de vouloir supprimer ce groupe ? Tous les paramètres de configuration de ce groupe ne seront pas visibles pour l\'utilisateur jusqu\'à ce que vous les ajoutiez à un autre groupe.'; 35 | $_lang['clientconfig.admin'] = 'Administration'; 36 | $_lang['clientconfig.adminpanel'] = 'Panneau de configuration'; 37 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'La clé du paramètre de configuration est requise.'; 38 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Un paramètre de configuration utilisant cette clé existe déjà.'; 39 | $_lang['clientconfig.description'] = 'Description'; 40 | $_lang['clientconfig.default'] = 'Valeur par défaut'; 41 | $_lang['clientconfig.error.noresults'] = 'Aucun élément trouvé.'; 42 | $_lang['clientconfig.filter_on_group'] = 'Filtrer par groupe'; 43 | $_lang['clientconfig.id'] = 'ID'; 44 | $_lang['clientconfig.is_required'] = 'Requis ?'; 45 | $_lang['clientconfig.is_required.long'] = 'Paramètre de configuration requis'; 46 | $_lang['clientconfig.group'] = 'Groupe'; 47 | $_lang['clientconfig.groups'] = 'Groupes'; 48 | $_lang['clientconfig.key'] = 'Clé'; 49 | $_lang['clientconfig.label'] = 'Nom'; 50 | $_lang['clientconfig.no_configuration_yet'] = 'Il n\'y a pas de configuration enregistrée.'; 51 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Il n\'y a pas de configuration enregistrée. Si vous êtes l\'administrateur du site, veuillez <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">consulter la documentation officielle</a> pour créer des paramètres de configuration à vos utilisateurs.'; 52 | $_lang['clientconfig.options'] = 'Options du champ'; 53 | $_lang['clientconfig.options.desc'] = 'Pour certains types de champ, comme les listes déroulantes, vous pouvez définir des options. Séparez les différentes options avec deux barres verticales (||) et si vous souhaitez voir des valeurs différentes de celles de vos utilisateurs, écrivez "nom==valeur".'; 54 | $_lang['clientconfig.save_config'] = 'Sauvegarder les paramètres'; 55 | $_lang['clientconfig.sortorder'] = 'Trier'; 56 | $_lang['clientconfig.settings'] = 'Paramètres de configuration'; 57 | $_lang['clientconfig.settings_count'] = '# des paramètres de configuration'; 58 | $_lang['clientconfig.value'] = 'Valeur'; 59 | $_lang['clientconfig.xtype'] = 'Type de champ'; 60 | $_lang['clientconfig.xtype.textfield'] = 'Texte'; 61 | $_lang['clientconfig.xtype.textarea'] = 'Bloc de texte'; 62 | $_lang['clientconfig.xtype.richtext'] = 'Texte enrichi'; 63 | $_lang['clientconfig.xtype.numberfield'] = 'Nombre'; 64 | $_lang['clientconfig.xtype.colorpalette'] = 'Sélecteur de couleur'; 65 | $_lang['clientconfig.xtype.xcheckbox'] = 'Case à cocher'; 66 | $_lang['clientconfig.xtype.datefield'] = 'Date'; 67 | $_lang['clientconfig.xtype.timefield'] = 'Heure'; 68 | $_lang['clientconfig.xtype.combobox'] = 'Liste déroulante'; 69 | $_lang['clientconfig.xtype.image'] = 'Image'; 70 | $_lang['clientconfig.xtype.googlefonts'] = 'Liste de polices Google'; 71 | $_lang['clientconfig.to_client_view'] = 'Voir l\'interface de l\'utilisateur'; 72 | $_lang['clientconfig.saved'] = 'Sauvegardé'; 73 | $_lang['clientconfig.saved.text'] = 'Les paramètres de configuration ont été sauvegardés.'; 74 | $_lang['clientconfig.field_is_required'] = 'Cette option ne peut être laissée vide.'; 75 | 76 | // New 2014/07/20 77 | $_lang['clientconfig.create_groups_first'] = 'Vous devez d\'abord créer un groupe'; 78 | $_lang['clientconfig.create_groups_first.desc'] = 'Avant de créer un paramètre de configuration, vous devez avoir créé au moins un groupe. Sans groupes, les paramètres de configuration ne peuvent pas être affichés à l\'utilisateur.'; 79 | 80 | $_lang['clientconfig.export_settings'] = 'Exporter'; 81 | $_lang['clientconfig.export_settings.confirm'] = 'Si vous cliquez sur « Oui » ci-dessous, un fichier XML contenant les paramètres de configuration va être généré et téléchargé. Êtes-vous sûr de vouloir continuer ?'; 82 | $_lang['clientconfig.import_settings'] = 'Importer'; 83 | $_lang['clientconfig.import_settings.desc'] = 'En téléchargeant vers le serveur le fichier XML et en choisissant le bon mode d\'import, vous pouvez importer des paramètres de configuration exportés précédemment. <b>Note :</b> les paramètres de configuration contiennent des références à leurs groupes grâce à leur ID. Si vous importez des paramètres de configuration, vous devrez probablement importer les groupes également.'; 84 | 85 | $_lang['clientconfig.export_groups'] = 'Exporter'; 86 | $_lang['clientconfig.export_groups.confirm'] = 'Si vous cliquez sur « Oui » ci-dessous, un fichier XML contenant les groupes des paramètres de configuration va être généré et téléchargé. Êtes-vous sûr de vouloir continuer ?'; 87 | $_lang['clientconfig.import_groups'] = 'Importer'; 88 | $_lang['clientconfig.import_groups.desc'] = 'En téléchargeant vers le serveur le fichier XML et en choisissant le bon mode d\'import, vous pouvez importer les groupes des paramètres de configuration exportés précédemment.'; 89 | 90 | $_lang['clientconfig.import_file'] = 'Fichier à importer'; 91 | $_lang['clientconfig.import_mode'] = 'Mode d\'import'; 92 | $_lang['clientconfig.import_mode.insert'] = "Insérer : conserve les paramètres de configuration existants et ajoute les données importées."; 93 | $_lang['clientconfig.import_mode.overwrite'] = "Écraser : conserve les paramètres de configuration existants mais écrase ceux qui ont le même ID que les données importées."; 94 | $_lang['clientconfig.import_mode.replace'] = "Remplacer : supprime d'abord tous les paramètres de configuration existants puis ajoute les données importées."; 95 | $_lang['clientconfig.start_import'] = 'Démarrer l\'import'; 96 | $_lang['clientconfig.error.xml_not_loaded'] = 'Le fichier téléchargé n\'est pas un fichier XML valide.'; 97 | $_lang['clientconfig.error.not_an_export'] = 'Le fichier téléchargé n\'est pas un fichier d\'export valide.'; 98 | $_lang['clientconfig.error.importing_row'] = 'Un incident lors de la sauvegarde d\'une donnée importée est apparu : '; 99 | 100 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/nl/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | */ 22 | 23 | /** 24 | * Dutch Translation by Mark Hamstra <hello@markhamstra.com> 25 | * Last updated 2017-01-04 26 | */ 27 | 28 | $_lang['clientconfig'] = 'Configuratie'; 29 | $_lang['clientconfig.desc'] = 'Beheer en update de website-instellingen.'; 30 | $_lang['clientconfig.add_setting'] = 'Nieuwe instelling'; 31 | $_lang['clientconfig.update_setting'] = 'Bewerk instelling'; 32 | $_lang['clientconfig.duplicate_setting'] = 'Dupliceer instelling'; 33 | $_lang['clientconfig.remove_setting'] = 'Verwijder instelling'; 34 | $_lang['clientconfig.remove_setting.confirm'] = 'Weet je zeker dat je deze instelling wilt verwijderen?'; 35 | $_lang['clientconfig.add_group'] = 'Nieuwe groep'; 36 | $_lang['clientconfig.update_group'] = 'Bewerk groep'; 37 | $_lang['clientconfig.remove_group'] = 'Verwijder groep'; 38 | $_lang['clientconfig.remove_group.confirm'] = 'Weet je zeker dat je deze groep wilt verwijderen? Alle instellingen in deze groep zullen, totdat je ze aan een nieuwe groep toevoegt, niet zichtbaar zijn voor de eindgebruiker.'; 39 | $_lang['clientconfig.admin'] = 'Beheer'; 40 | $_lang['clientconfig.adminpanel'] = 'Configuratiebeheer'; 41 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'De key voor de instelling is verplicht.'; 42 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Er bestaat al een instelling met deze key.'; 43 | $_lang['clientconfig.description'] = 'Omschrijving'; 44 | $_lang['clientconfig.default'] = 'Standaardwaarde'; 45 | $_lang['clientconfig.error.noresults'] = 'Geen items gevonden.'; 46 | $_lang['clientconfig.filter_on_group'] = 'Filter op groep'; 47 | $_lang['clientconfig.id'] = 'ID'; 48 | $_lang['clientconfig.is_required'] = 'Verplicht?'; 49 | $_lang['clientconfig.is_required.long'] = 'Instelling is verplicht'; 50 | $_lang['clientconfig.group'] = 'Groep'; 51 | $_lang['clientconfig.groups'] = 'Groepen'; 52 | $_lang['clientconfig.key'] = 'Key'; 53 | $_lang['clientconfig.label'] = 'Label'; 54 | $_lang['clientconfig.no_configuration_yet'] = 'Nog geen configuratie beschikbaar'; 55 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Het lijkt erop dat er nog geen configuratie beschikbaar is. Als je de administrator van deze website bent, volg dan de <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">documentatie</a> om de websiteconfiguratie in te stellen.'; 56 | $_lang['clientconfig.options'] = 'Veldopties'; 57 | $_lang['clientconfig.options.desc'] = 'Voor velden als select boxes kun je opties ingeven. Scheid deze met twee verticale streepjes (||) en als de waarde anders moet zijn dan de label, gebruik "label==value". '; 58 | $_lang['clientconfig.save_config'] = 'Configuratie opslaan'; 59 | $_lang['clientconfig.sortorder'] = 'Sorteervolgorde'; 60 | $_lang['clientconfig.settings'] = 'Instellingen'; 61 | $_lang['clientconfig.settings_count'] = 'Aantal instellingen'; 62 | $_lang['clientconfig.value'] = 'Waarde'; 63 | $_lang['clientconfig.xtype'] = 'Veldtype'; 64 | $_lang['clientconfig.xtype.textfield'] = 'Tekst'; 65 | $_lang['clientconfig.xtype.textarea'] = 'Tekstveld'; 66 | $_lang['clientconfig.xtype.numberfield'] = 'Nummer'; 67 | $_lang['clientconfig.xtype.colorpalette'] = 'Kleurkiezer'; 68 | $_lang['clientconfig.xtype.xcheckbox'] = 'Checkbox'; 69 | $_lang['clientconfig.xtype.datefield'] = 'Datum'; 70 | $_lang['clientconfig.xtype.timefield'] = 'Tijd'; 71 | $_lang['clientconfig.xtype.combobox'] = 'Selectbox'; 72 | $_lang['clientconfig.to_client_view'] = 'Terug naar configuratie'; 73 | $_lang['clientconfig.saved'] = 'Opgeslagen'; 74 | $_lang['clientconfig.saved.text'] = 'De instellingen zijn opgeslagen.'; 75 | $_lang['clientconfig.field_is_required'] = 'Dit veld is verplicht en kan niet leeg blijven.'; 76 | 77 | // New 2014/07/20 78 | $_lang['clientconfig.create_groups_first'] = 'Maak eerst een groep aan'; 79 | $_lang['clientconfig.create_groups_first.desc'] = 'Sorry, maar voordat je een instelling aan kunt maken is het nodig om een groep te maken. Zonder een groep kunnen instellingen niet aan de eindgebruiker worden getoond.'; 80 | 81 | $_lang['clientconfig.export_settings'] = 'Exporteer instellingen'; 82 | $_lang['clientconfig.export_settings.confirm'] = 'Zodra je hieronder op Ja klikt zal een XML-bestand aangemaakt en gedownload worden met alle ClientConfig instellingen. Weet je zeker dat je door wilt gaan?'; 83 | $_lang['clientconfig.import_settings'] = 'Importeer instellingen'; 84 | $_lang['clientconfig.import_settings.desc'] = 'Door een XML-bestand te uploaden en de juiste importmodus te kiezen kun je instellingen importeren die eerder zijn geëxporteerd of uit een andere site komen. <b>Let op:</b> instellingen bevatten een referentie naar een groep op basis van een ID; waarschijnlijk zul je de groepen ook moeten importeren.'; 85 | 86 | $_lang['clientconfig.export_groups'] = 'Exporteer groepen'; 87 | $_lang['clientconfig.export_groups.confirm'] = 'Zodra je hieronder op Ja klikt zal een XML-bestand aangemaakt en gedownload worden met alle ClientConfig groepen. Weet je zeker dat je door wilt gaan?'; 88 | $_lang['clientconfig.import_groups'] = 'Importeer groepen'; 89 | $_lang['clientconfig.import_groups.desc'] = 'Door een XML-bestand te uploaden en de juiste importmodus te kiezen kun je instellingen importeren die eerder zijn geëxporteerd of uit een andere site komen. '; 90 | 91 | $_lang['clientconfig.import_file'] = 'Bestand'; 92 | $_lang['clientconfig.import_mode'] = 'Importmodus'; 93 | $_lang['clientconfig.import_mode.insert'] = "Invoegen: bestaande [[+what]] laten staan en voeg geïmporteerde data toe"; 94 | $_lang['clientconfig.import_mode.overwrite'] = "Overschrijven: bestaande [[+what]] laten staan, maar overschrijf ze dezelfde ID hebben"; 95 | $_lang['clientconfig.import_mode.replace'] = "Vervangen: eerst worden alle [[+what]] verwijderd, en daarna worden nieuwe rijen geïmporteerd."; 96 | $_lang['clientconfig.start_import'] = 'Start importeren'; 97 | $_lang['clientconfig.error.xml_not_loaded'] = 'Geen geschikt XML bestand geüpload.'; 98 | $_lang['clientconfig.error.not_an_export'] = 'Het geüploade bestand is geen geschikte ClientConfig export.'; 99 | $_lang['clientconfig.error.importing_row'] = 'Er ging iets mis met het importeren van de rij: '; 100 | 101 | // New 2017-01-31 102 | $_lang['clientconfig.xtype.password'] = 'Wachtwoord'; 103 | $_lang['clientconfig.xtype.file'] = 'Bestand'; 104 | $_lang['clientconfig.source'] = 'Media bron'; 105 | $_lang['clientconfig.source.desc'] = 'De media bron om te gebruiken voor het selecteren van bestanden.'; 106 | 107 | // New 2017-09-13 108 | $_lang['clientconfig.choose_context'] = 'Kies Context'; 109 | $_lang['clientconfig.global_values'] = 'Globaal'; 110 | $_lang['clientconfig.config_for_context'] = 'Configuratie voor [[+context]]'; 111 | $_lang['clientconfig.categories'] = 'Categoriën'; 112 | $_lang['clientconfig.process_options'] = 'Verwerk tags in de opties'; -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/pt-br/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * @subpackage lexicon 22 | * @language pt (Translated by João Nogueira - JANogueira) 23 | * 24 | */ 25 | 26 | $_lang['clientconfig'] = 'Configuração'; 27 | $_lang['clientconfig.desc'] = 'Definir e atualizar a configuração do site.'; 28 | $_lang['clientconfig.add_setting'] = 'Adicionar Configuraçãoo'; 29 | $_lang['clientconfig.update_setting'] = 'Atualizar Configuração'; 30 | $_lang['clientconfig.duplicate_setting'] = 'Duplicar Configuração'; 31 | $_lang['clientconfig.remove_setting'] = 'Remover Configuração'; 32 | $_lang['clientconfig.remove_setting.confirm'] = 'Tem a certeza que deseja remover esta Configuração?'; 33 | $_lang['clientconfig.add_group'] = 'Adicionar Grupo'; 34 | $_lang['clientconfig.update_group'] = 'Atualizar Grupo'; 35 | $_lang['clientconfig.remove_group'] = 'Remover Grupo'; 36 | $_lang['clientconfig.remove_group.confirm'] = 'Tem certeza que deseja remover este grupo? Todas as configurações deste grupo não estarão visíveis para o cliente até que sejam adicionadas a um grupo diferente.'; 37 | $_lang['clientconfig.admin'] = 'Admin'; 38 | $_lang['clientconfig.adminpanel'] = 'Painel de Administração da Configuração'; 39 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'A chave da configuração é necessária.'; 40 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Outra configuração já existe com esta chave.'; 41 | $_lang['clientconfig.description'] = 'Descrição'; 42 | $_lang['clientconfig.default'] = 'Valor Pré-definido'; 43 | $_lang['clientconfig.error.noresults'] = 'Nenhum item encontrado.'; 44 | $_lang['clientconfig.filter_on_group'] = 'Filtrar no Grupo'; 45 | $_lang['clientconfig.id'] = 'ID'; 46 | $_lang['clientconfig.is_required'] = 'Obrigatório?'; 47 | $_lang['clientconfig.is_required.long'] = 'A configuração é obrigatória'; 48 | $_lang['clientconfig.group'] = 'Grupo'; 49 | $_lang['clientconfig.groups'] = 'Grupos'; 50 | $_lang['clientconfig.key'] = 'Chave'; 51 | $_lang['clientconfig.label'] = 'Etiqueta'; 52 | $_lang['clientconfig.no_configuration_yet'] = 'Nenhuma Configuração Disponível'; 53 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Parece que ainda não existe uma configuração definida. Se é o administrador do site, por favor <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">siga a documentação oficial</a> para definir a configuração para o seu cliente.'; 54 | $_lang['clientconfig.options'] = 'Opções dos Campos'; 55 | $_lang['clientconfig.options.desc'] = 'Para determinados campos como "select boxes", pode definir opções. Separe as diferentes opções com duas barras retas (||) e se pretender um valor diferente do que o seu cliente poderá ver, utilize "label==value". '; 56 | $_lang['clientconfig.save_config'] = 'Guardar configuração'; 57 | $_lang['clientconfig.sortorder'] = 'Disposição da ordem'; 58 | $_lang['clientconfig.settings'] = 'Definições'; 59 | $_lang['clientconfig.settings_count'] = '# de Definições'; 60 | $_lang['clientconfig.value'] = 'Valor'; 61 | $_lang['clientconfig.xtype'] = 'Tipo de campo'; 62 | $_lang['clientconfig.xtype.textfield'] = 'Texto'; 63 | $_lang['clientconfig.xtype.textarea'] = 'Área de texto (textarea)'; 64 | $_lang['clientconfig.xtype.richtext'] = 'Texto Rico (RTE)'; 65 | $_lang['clientconfig.xtype.numberfield'] = 'Número'; 66 | $_lang['clientconfig.xtype.colorpalette'] = 'Colorpicker'; 67 | $_lang['clientconfig.xtype.xcheckbox'] = 'Caixa de seleção (Checkbox)'; 68 | $_lang['clientconfig.xtype.datefield'] = 'Data'; 69 | $_lang['clientconfig.xtype.timefield'] = 'Hora'; 70 | $_lang['clientconfig.xtype.combobox'] = 'Quadro de seleção (Selectbox)'; 71 | $_lang['clientconfig.xtype.image'] = 'Imagem'; 72 | $_lang['clientconfig.xtype.googlefonts'] = 'Lista de Google Fonts'; 73 | $_lang['clientconfig.to_client_view'] = 'Voltar à vista de Cliente'; 74 | $_lang['clientconfig.saved'] = 'Guardado'; 75 | $_lang['clientconfig.saved.text'] = 'As configurações foram guardadas.'; 76 | $_lang['clientconfig.field_is_required'] = 'Esta opção não pode ser deixada vazia.'; 77 | 78 | // New 2014/07/20 79 | $_lang['clientconfig.create_groups_first'] = 'Crie um grupo primeiro'; 80 | $_lang['clientconfig.create_groups_first.desc'] = 'Antes de adicionar uma configuração, deverá ter, pelo menos, um grupo. Sem grupos, as configurações não podem ser apresentadas ao cliente.'; 81 | 82 | $_lang['clientconfig.export_settings'] = 'Exportar configurações'; 83 | $_lang['clientconfig.export_settings.confirm'] = 'Quando clicar "Sim", em baixo, um arquivo de XML será criado e descarregado, mantendo todas as configurações do ClientConfig. Tem certeza que deseja continuar?'; 84 | $_lang['clientconfig.import_settings'] = 'Importar Configurações'; 85 | $_lang['clientconfig.import_settings.desc'] = 'Ao fazer upload de um arquivo XML e ao escolher o modo de importação correto, poderá importar as configurações que exportou anteriormente ou de um site diferente. <b>Nota:</b> As configurações contêm referências a Grupos através dos seus IDs; Se pretender importar Configurações, provavelmente precisará de importar também os Grupos.'; 86 | 87 | $_lang['clientconfig.export_groups'] = 'Exportar Grupos'; 88 | $_lang['clientconfig.export_groups.confirm'] = 'Quando clicar "Sim", em baixo, um arquivo XML será criado e descarregado, mantendo todos os grupos do ClientConfig. Tem a certeza que deseja continuar?'; 89 | $_lang['clientconfig.import_groups'] = 'Importar Grupos'; 90 | $_lang['clientconfig.import_groups.desc'] = 'Ao fazer upload de um arquivo XML e ao escolher o modo de importação correto, poderá importar os Grupos que exportou anteriormente ou de um site diferente. '; 91 | 92 | $_lang['clientconfig.import_file'] = 'Ficheiro a Importat'; 93 | $_lang['clientconfig.import_mode'] = 'Modo de Importação'; 94 | $_lang['clientconfig.import_mode.insert'] = "Inserção: preservar [[+what]] já existente e adicionar os dados importados"; 95 | $_lang['clientconfig.import_mode.overwrite'] = "Overwrite: preservar [[+what]] já existente, mas sobrescrevê-los se tiverem o mesmo ID"; 96 | $_lang['clientconfig.import_mode.replace'] = "Substituir: Remover primeiro todos os dados atuais ([[+what]]), para depois importar novos dados."; 97 | $_lang['clientconfig.start_import'] = 'Iniciar Importação'; 98 | $_lang['clientconfig.error.xml_not_loaded'] = 'Nenhum ficheiro XML válido enviado.'; 99 | $_lang['clientconfig.error.not_an_export'] = 'O ficheiro enviado não é um ficheiro de exportação válido do ClientConfig.'; 100 | $_lang['clientconfig.error.importing_row'] = 'Algo correu mal ao guardar uma linha da exportação: '; 101 | 102 | // New 2017-01-31 103 | $_lang['clientconfig.xtype.password'] = 'Palavra-passe'; 104 | $_lang['clientconfig.xtype.file'] = 'Ficheiro'; 105 | $_lang['clientconfig.source'] = 'Fonte Multimédia'; 106 | $_lang['clientconfig.source.desc'] = 'A Fonte Multimédia a ser utilizada no navegador de ficheiros.'; 107 | 108 | // New 2017-09-13 109 | $_lang['clientconfig.choose_context'] = 'Escolha o Contexto'; 110 | $_lang['clientconfig.global_values'] = 'Global'; 111 | $_lang['clientconfig.config_for_context'] = 'Configuração para o contexto: [[+context]]'; 112 | $_lang['clientconfig.categories'] = 'Categorias'; 113 | $_lang['clientconfig.process_options'] = 'Processar Tags nas opções'; 114 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/pt/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * @subpackage lexicon 22 | * @language pt (Translated by João Nogueira - JANogueira) 23 | * 24 | */ 25 | 26 | $_lang['clientconfig'] = 'Configuração'; 27 | $_lang['clientconfig.desc'] = 'Definir e atualizar a configuração do site.'; 28 | $_lang['clientconfig.add_setting'] = 'Adicionar Configuraçãoo'; 29 | $_lang['clientconfig.update_setting'] = 'Atualizar Configuração'; 30 | $_lang['clientconfig.duplicate_setting'] = 'Duplicar Configuração'; 31 | $_lang['clientconfig.remove_setting'] = 'Remover Configuração'; 32 | $_lang['clientconfig.remove_setting.confirm'] = 'Tem a certeza que deseja remover esta Configuração?'; 33 | $_lang['clientconfig.add_group'] = 'Adicionar Grupo'; 34 | $_lang['clientconfig.update_group'] = 'Atualizar Grupo'; 35 | $_lang['clientconfig.remove_group'] = 'Remover Grupo'; 36 | $_lang['clientconfig.remove_group.confirm'] = 'Tem certeza que deseja remover este grupo? Todas as configurações deste grupo não estarão visíveis para o cliente até que sejam adicionadas a um grupo diferente.'; 37 | $_lang['clientconfig.admin'] = 'Admin'; 38 | $_lang['clientconfig.adminpanel'] = 'Painel de Administração da Configuração'; 39 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'A chave da configuração é necessária.'; 40 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Outra configuração já existe com esta chave.'; 41 | $_lang['clientconfig.description'] = 'Descrição'; 42 | $_lang['clientconfig.default'] = 'Valor Pré-definido'; 43 | $_lang['clientconfig.error.noresults'] = 'Nenhum item encontrado.'; 44 | $_lang['clientconfig.filter_on_group'] = 'Filtrar no Grupo'; 45 | $_lang['clientconfig.id'] = 'ID'; 46 | $_lang['clientconfig.is_required'] = 'Obrigatório?'; 47 | $_lang['clientconfig.is_required.long'] = 'A configuração é obrigatória'; 48 | $_lang['clientconfig.group'] = 'Grupo'; 49 | $_lang['clientconfig.groups'] = 'Grupos'; 50 | $_lang['clientconfig.key'] = 'Chave'; 51 | $_lang['clientconfig.label'] = 'Etiqueta'; 52 | $_lang['clientconfig.no_configuration_yet'] = 'Nenhuma Configuração Disponível'; 53 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Parece que ainda não existe uma configuração definida. Se é o administrador do site, por favor <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">siga a documentação oficial</a> para definir a configuração para o seu cliente.'; 54 | $_lang['clientconfig.options'] = 'Opções dos Campos'; 55 | $_lang['clientconfig.options.desc'] = 'Para determinados campos como "select boxes", pode definir opções. Separe as diferentes opções com duas barras retas (||) e se pretender um valor diferente do que o seu cliente poderá ver, utilize "label==value". '; 56 | $_lang['clientconfig.save_config'] = 'Guardar configuração'; 57 | $_lang['clientconfig.sortorder'] = 'Disposição da ordem'; 58 | $_lang['clientconfig.settings'] = 'Definições'; 59 | $_lang['clientconfig.settings_count'] = '# de Definições'; 60 | $_lang['clientconfig.value'] = 'Valor'; 61 | $_lang['clientconfig.xtype'] = 'Tipo de campo'; 62 | $_lang['clientconfig.xtype.textfield'] = 'Texto'; 63 | $_lang['clientconfig.xtype.textarea'] = 'Área de texto (textarea)'; 64 | $_lang['clientconfig.xtype.richtext'] = 'Texto Rico (RTE)'; 65 | $_lang['clientconfig.xtype.numberfield'] = 'Número'; 66 | $_lang['clientconfig.xtype.colorpalette'] = 'Colorpicker'; 67 | $_lang['clientconfig.xtype.xcheckbox'] = 'Caixa de seleção (Checkbox)'; 68 | $_lang['clientconfig.xtype.datefield'] = 'Data'; 69 | $_lang['clientconfig.xtype.timefield'] = 'Hora'; 70 | $_lang['clientconfig.xtype.combobox'] = 'Quadro de seleção (Selectbox)'; 71 | $_lang['clientconfig.xtype.image'] = 'Imagem'; 72 | $_lang['clientconfig.xtype.googlefonts'] = 'Lista de Google Fonts'; 73 | $_lang['clientconfig.to_client_view'] = 'Voltar à vista de Cliente'; 74 | $_lang['clientconfig.saved'] = 'Guardado'; 75 | $_lang['clientconfig.saved.text'] = 'As configurações foram guardadas.'; 76 | $_lang['clientconfig.field_is_required'] = 'Esta opção não pode ser deixada vazia.'; 77 | 78 | // New 2014/07/20 79 | $_lang['clientconfig.create_groups_first'] = 'Crie um grupo primeiro'; 80 | $_lang['clientconfig.create_groups_first.desc'] = 'Antes de adicionar uma configuração, deverá ter, pelo menos, um grupo. Sem grupos, as configurações não podem ser apresentadas ao cliente.'; 81 | 82 | $_lang['clientconfig.export_settings'] = 'Exportar configurações'; 83 | $_lang['clientconfig.export_settings.confirm'] = 'Quando clicar "Sim", em baixo, um arquivo de XML será criado e descarregado, mantendo todas as configurações do ClientConfig. Tem certeza que deseja continuar?'; 84 | $_lang['clientconfig.import_settings'] = 'Importar Configurações'; 85 | $_lang['clientconfig.import_settings.desc'] = 'Ao fazer upload de um arquivo XML e ao escolher o modo de importação correto, poderá importar as configurações que exportou anteriormente ou de um site diferente. <b>Nota:</b> As configurações contêm referências a Grupos através dos seus IDs; Se pretender importar Configurações, provavelmente precisará de importar também os Grupos.'; 86 | 87 | $_lang['clientconfig.export_groups'] = 'Exportar Grupos'; 88 | $_lang['clientconfig.export_groups.confirm'] = 'Quando clicar "Sim", em baixo, um arquivo XML será criado e descarregado, mantendo todos os grupos do ClientConfig. Tem a certeza que deseja continuar?'; 89 | $_lang['clientconfig.import_groups'] = 'Importar Grupos'; 90 | $_lang['clientconfig.import_groups.desc'] = 'Ao fazer upload de um arquivo XML e ao escolher o modo de importação correto, poderá importar os Grupos que exportou anteriormente ou de um site diferente. '; 91 | 92 | $_lang['clientconfig.import_file'] = 'Ficheiro a Importat'; 93 | $_lang['clientconfig.import_mode'] = 'Modo de Importação'; 94 | $_lang['clientconfig.import_mode.insert'] = "Inserção: preservar [[+what]] já existente e adicionar os dados importados"; 95 | $_lang['clientconfig.import_mode.overwrite'] = "Overwrite: preservar [[+what]] já existente, mas sobrescrevê-los se tiverem o mesmo ID"; 96 | $_lang['clientconfig.import_mode.replace'] = "Substituir: Remover primeiro todos os dados atuais ([[+what]]), para depois importar novos dados."; 97 | $_lang['clientconfig.start_import'] = 'Iniciar Importação'; 98 | $_lang['clientconfig.error.xml_not_loaded'] = 'Nenhum ficheiro XML válido enviado.'; 99 | $_lang['clientconfig.error.not_an_export'] = 'O ficheiro enviado não é um ficheiro de exportação válido do ClientConfig.'; 100 | $_lang['clientconfig.error.importing_row'] = 'Algo correu mal ao guardar uma linha da exportação: '; 101 | 102 | // New 2017-01-31 103 | $_lang['clientconfig.xtype.password'] = 'Palavra-passe'; 104 | $_lang['clientconfig.xtype.file'] = 'Ficheiro'; 105 | $_lang['clientconfig.source'] = 'Fonte Multimédia'; 106 | $_lang['clientconfig.source.desc'] = 'A Fonte Multimédia a ser utilizada no navegador de ficheiros.'; 107 | 108 | // New 2017-09-13 109 | $_lang['clientconfig.choose_context'] = 'Escolha o Contexto'; 110 | $_lang['clientconfig.global_values'] = 'Global'; 111 | $_lang['clientconfig.config_for_context'] = 'Configuração para o contexto: [[+context]]'; 112 | $_lang['clientconfig.categories'] = 'Categorias'; 113 | $_lang['clientconfig.process_options'] = 'Processar Tags nas opções'; 114 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/ru/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * @subpackage lexicon-ru 22 | * @language ru 23 | * @author Ivan Klimchuk (Alroniks, ivan@klimchuk.com), Ruslan Aleev (info@cat-art.ru) 24 | * @date 2013-01-08 25 | */ 26 | 27 | $_lang['clientconfig'] = 'Конфигурация'; 28 | $_lang['clientconfig.desc'] = 'Установка и обновление конфигурации сайта.'; 29 | $_lang['clientconfig.add_setting'] = 'Добавить настройку'; 30 | $_lang['clientconfig.update_setting'] = 'Обновить настройку'; 31 | $_lang['clientconfig.duplicate_setting'] = 'Копировать настройку'; 32 | $_lang['clientconfig.remove_setting'] = 'Удалить настройку'; 33 | $_lang['clientconfig.remove_setting.confirm'] = 'Вы уверены, что хотите удалить эту настройку?'; 34 | $_lang['clientconfig.add_group'] = 'Добавить группу'; 35 | $_lang['clientconfig.update_group'] = 'Обновить группу'; 36 | $_lang['clientconfig.remove_group'] = 'Удалить группу'; 37 | $_lang['clientconfig.remove_group.confirm'] = 'Вы уверены, что хотите удалить эту группу? Все параметры из этой группы не будут видны для клиента, пока вы не добавите их в другую группу.'; 38 | $_lang['clientconfig.admin'] = 'Администрирование'; 39 | $_lang['clientconfig.adminpanel'] = 'Панель администрирования конфигурации'; 40 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'Обязателен ключ для настройки.'; 41 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'Такой ключ уже существует.'; 42 | $_lang['clientconfig.description'] = 'Описание'; 43 | $_lang['clientconfig.default'] = 'Значение по умолчанию'; 44 | $_lang['clientconfig.error.noresults'] = 'Элементы не найдены.'; 45 | $_lang['clientconfig.filter_on_group'] = 'Фильтр по группе'; 46 | $_lang['clientconfig.id'] = 'ID'; 47 | $_lang['clientconfig.is_required'] = 'Обязателен?'; 48 | $_lang['clientconfig.is_required.long'] = 'Настройка обязательна'; 49 | $_lang['clientconfig.group'] = 'Группа'; 50 | $_lang['clientconfig.groups'] = 'Группы'; 51 | $_lang['clientconfig.key'] = 'Ключ'; 52 | $_lang['clientconfig.label'] = 'Название'; 53 | $_lang['clientconfig.no_configuration_yet'] = 'Нет доступных конфигураций'; 54 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Кажется, еще не созданы какие-либо конфигурации. Если вы являетесь администратором сайта, пожалуйста изучите <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">официальную документацию</a> по настройке конфигурации для вашего клиента.'; 55 | $_lang['clientconfig.options'] = 'Параметры поля'; 56 | $_lang['clientconfig.options.desc'] = 'Для некоторых типов полей, таких как выпадающие списки, вы можете задать параметры. Разделите разные параметры двумя вертикальными чертами (||) и если вы хотите другое значение, чем то, что видит клиент, используйте "название==значение".'; 57 | $_lang['clientconfig.save_config'] = 'Сохранить конфигурацию'; 58 | $_lang['clientconfig.sortorder'] = 'Порядок сортировки'; 59 | $_lang['clientconfig.settings'] = 'Настройки'; 60 | $_lang['clientconfig.settings_count'] = 'Кол-во настроек'; 61 | $_lang['clientconfig.value'] = 'Значение'; 62 | $_lang['clientconfig.xtype'] = 'Тип поля'; 63 | $_lang['clientconfig.xtype.textfield'] = 'Текст'; 64 | $_lang['clientconfig.xtype.textarea'] = 'Текстовая область'; 65 | $_lang['clientconfig.xtype.richtext'] = 'Текстовый редактор'; 66 | $_lang['clientconfig.xtype.numberfield'] = 'Число'; 67 | $_lang['clientconfig.xtype.colorpalette'] = 'Выбор цвета'; 68 | $_lang['clientconfig.xtype.xcheckbox'] = 'Чекбокс'; 69 | $_lang['clientconfig.xtype.datefield'] = 'Дата'; 70 | $_lang['clientconfig.xtype.timefield'] = 'Время'; 71 | $_lang['clientconfig.xtype.combobox'] = 'Выпадающий список'; 72 | $_lang['clientconfig.xtype.image'] = 'Изображение'; 73 | $_lang['clientconfig.xtype.googlefonts'] = 'Список шрифтов Google'; 74 | $_lang['clientconfig.to_client_view'] = 'Показать клиенту'; 75 | $_lang['clientconfig.saved'] = 'Сохранено'; 76 | $_lang['clientconfig.saved.text'] = 'Настройки были сохранены.'; 77 | $_lang['clientconfig.field_is_required'] = 'Этот параметр не может быть пустым.'; 78 | 79 | // New 2014/07/20 80 | $_lang['clientconfig.create_groups_first'] = 'Сначала создайте группу'; 81 | $_lang['clientconfig.create_groups_first.desc'] = 'Извините, но прежде чем вы сможете добавить настройку, вам необходима хотя бы одна группа. Без группы настройки не могут быть отображены клиенту.'; 82 | 83 | $_lang['clientconfig.export_settings'] = 'Экспортировать настройки'; 84 | $_lang['clientconfig.export_settings.confirm'] = 'Когда вы нажмете «Да», будет сгенерирован и скачан XML-файл, который содержит все настройки ClientConfig. Вы уверены что хотите продолжить?'; 85 | $_lang['clientconfig.import_settings'] = 'Импортировать настройки'; 86 | $_lang['clientconfig.import_settings.desc'] = 'Загрузив XML-файл и выбрав правильный режим импорта, вы можете импортировать настройки, экспортированные ранее или с другого сайта. <b>Примечание:</b> настройки содержат ссылки на группы по их ID; если вы импортируете настройки, вам потребуется также импортировать и группы.'; 87 | 88 | $_lang['clientconfig.export_groups'] = 'Экспортировать группы'; 89 | $_lang['clientconfig.export_groups.confirm'] = 'Когда вы нажмете «Да», будет сгенерирован и скачан XML-файл, который содержит все группы ClientConfig. Вы уверены что хотите продолжить?'; 90 | $_lang['clientconfig.import_groups'] = 'Импортировать группы'; 91 | $_lang['clientconfig.import_groups.desc'] = 'Загрузив XML-файл и выбрав правильный режим импорта, вы можете импортировать группы, экспортированные ранее или с другого сайта.'; 92 | 93 | $_lang['clientconfig.import_file'] = 'Файл для импорта'; 94 | $_lang['clientconfig.import_mode'] = 'Режим импорта'; 95 | $_lang['clientconfig.import_mode.insert'] = "Вставить: оставить существующие [[+what]] и добавить импортированные данные"; 96 | $_lang['clientconfig.import_mode.overwrite'] = "Перезаписать: оставить существующие [[+what]], но перезаписать их, если они имеют одинаковый ID"; 97 | $_lang['clientconfig.import_mode.replace'] = "Заменить: сначала удалить все текущие [[+what]], а затем импортировать новые данные"; 98 | $_lang['clientconfig.start_import'] = 'Начать импорт'; 99 | $_lang['clientconfig.error.xml_not_loaded'] = 'Не загружен корректный XML-файл.'; 100 | $_lang['clientconfig.error.not_an_export'] = 'Загруженный файл не является корректным файлом экспорта для ClientConfig.'; 101 | $_lang['clientconfig.error.importing_row'] = 'Что-то пошло не так в процессе сохранения экспорта: '; 102 | 103 | // New 2017-01-31 104 | $_lang['clientconfig.xtype.password'] = 'Пароль'; 105 | $_lang['clientconfig.xtype.file'] = 'Файл'; 106 | $_lang['clientconfig.source'] = 'Источник файлов'; 107 | $_lang['clientconfig.source.desc'] = 'Источник файлов для диспетчера файлов.'; 108 | 109 | // New 2017-09-13 110 | $_lang['clientconfig.choose_context'] = 'Выберите контекст'; 111 | $_lang['clientconfig.global_values'] = 'Глобальные'; 112 | $_lang['clientconfig.config_for_context'] = 'Конфигурация для [[+context]]'; 113 | $_lang['clientconfig.categories'] = 'Категории'; 114 | $_lang['clientconfig.process_options'] = 'Обрабатывать теги в параметрах'; 115 | -------------------------------------------------------------------------------- /core/components/clientconfig/lexicon/sv/default.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | * @subpackage lexicon-sv 22 | * @author Joakim Nyman <hello@fractalwolfe.com> 23 | */ 24 | 25 | $_lang['clientconfig'] = 'Konfiguration'; 26 | $_lang['clientconfig.desc'] = 'Sätt och uppdatera webbsidans konfiguration.'; 27 | $_lang['clientconfig.add_setting'] = 'Lägg till inställning'; 28 | $_lang['clientconfig.update_setting'] = 'Uppdatera inställning'; 29 | $_lang['clientconfig.remove_setting'] = 'Radera inställning'; 30 | $_lang['clientconfig.remove_setting.confirm'] = 'Är du säker att du vill radera denna inställning?'; 31 | $_lang['clientconfig.add_group'] = 'Lägg till grupp'; 32 | $_lang['clientconfig.update_group'] = 'Uppdatera grupp'; 33 | $_lang['clientconfig.remove_group'] = 'Radera grupp'; 34 | $_lang['clientconfig.remove_group.confirm'] = 'Är du säker att du vill radera denna grupp? Alla inställningar i denna grupp kommer ej längre att vara synliga för klienten tills du lägger till dem i en annan grupp.'; 35 | $_lang['clientconfig.admin'] = 'Administratörsvy'; 36 | $_lang['clientconfig.adminpanel'] = 'Konfigurationens administratörspanel'; 37 | $_lang['clientconfig.cgsetting_err_ns_key'] = 'Nyckeln för inställningen är obligatorisk.'; 38 | $_lang['clientconfig.cgsetting_err_ae_key'] = 'En annan inställning finns redan med den här nyckeln.'; 39 | $_lang['clientconfig.description'] = 'Beskrivning'; 40 | $_lang['clientconfig.default'] = 'Standardvärde'; 41 | $_lang['clientconfig.error.noresults'] = 'Inga poster hittades.'; 42 | $_lang['clientconfig.filter_on_group'] = 'Filtrera enligt grupp'; 43 | $_lang['clientconfig.id'] = 'ID'; 44 | $_lang['clientconfig.is_required'] = 'Oblig.?'; 45 | $_lang['clientconfig.is_required.long'] = 'Inställningen är obligatorisk'; 46 | $_lang['clientconfig.group'] = 'Grupp'; 47 | $_lang['clientconfig.groups'] = 'Grupper'; 48 | $_lang['clientconfig.key'] = 'Nyckel'; 49 | $_lang['clientconfig.label'] = 'Etikett'; 50 | $_lang['clientconfig.no_configuration_yet'] = 'Ingen konfiguration tillgänglig'; 51 | $_lang['clientconfig.no_configuration_yet.desc'] = 'Det verkar som att det inte finns någon konfiguration uppsatt ännu. Om du är administratören för denna webbsida, vänligen <a href="http://rtfm.modx.com/display/ADDON/ClientConfig">följ den officiella dokumentationen</a> för att sätta upp en konfiguration för Er klient.'; 52 | $_lang['clientconfig.options'] = 'Fältalternativ'; 53 | $_lang['clientconfig.options.desc'] = 'För vissa fälttyper så som rullgardinslistor kan du ange alternativ. Separera olika alternativ med två lodstreck (||) och om du vill ha ett annat värde än det klienten ser kan du använda "etikett==värde". '; 54 | $_lang['clientconfig.save_config'] = 'Spara konfiguration'; 55 | $_lang['clientconfig.sortorder'] = 'Sorteringsordning'; 56 | $_lang['clientconfig.settings'] = 'Inställningar'; 57 | $_lang['clientconfig.settings_count'] = 'Antal inställningar'; 58 | $_lang['clientconfig.value'] = 'Värde'; 59 | $_lang['clientconfig.xtype'] = 'Fälttyp'; 60 | $_lang['clientconfig.xtype.textfield'] = 'Textfält'; 61 | $_lang['clientconfig.xtype.textarea'] = 'Textområde'; 62 | $_lang['clientconfig.xtype.numberfield'] = 'Nummer'; 63 | $_lang['clientconfig.xtype.colorpalette'] = 'Färgväljare'; 64 | $_lang['clientconfig.xtype.xcheckbox'] = 'Kryssruta'; 65 | $_lang['clientconfig.xtype.datefield'] = 'Datum'; 66 | $_lang['clientconfig.xtype.timefield'] = 'Tid'; 67 | $_lang['clientconfig.xtype.combobox'] = 'Rullgardinslista'; 68 | $_lang['clientconfig.to_client_view'] = 'Till klientvyn'; 69 | $_lang['clientconfig.saved'] = 'Sparad'; 70 | $_lang['clientconfig.saved.text'] = 'Inställningarna har blivit sparade.'; 71 | $_lang['clientconfig.field_is_required'] = 'Detta alternativ kan inte lämnas tomt.'; 72 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/cgcontextvalue.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | class cgContextValue extends xPDOSimpleObject {} -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/cggroup.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | class cgGroup extends xPDOSimpleObject {} -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/cgsetting.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * @package ClientConfig 4 | */ 5 | class cgSetting extends xPDOSimpleObject { 6 | public function prefixSourceUrl($value) 7 | { 8 | if ($value !== '') { 9 | $sourceId = $this->get('source'); 10 | $this->xpdo->loadClass('sources.modMediaSource'); 11 | $source = modMediaSource::getDefaultSource($this->xpdo, $sourceId); 12 | if (!$source) { 13 | return $value; 14 | } 15 | $source->getWorkingContext(); 16 | $source->initialize(); 17 | 18 | return $source->getObjectUrl($value); 19 | } 20 | return $value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/clientconfig.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * ClientConfig 4 | * 5 | * Copyright 2011-2014 by Mark Hamstra <hello@markhamstra.com> 6 | * 7 | * ClientConfig is free software; you can redistribute it and/or modify it under 8 | * the terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * ClientConfig is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * ClientConfig; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 18 | * Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package clientconfig 21 | */ 22 | 23 | class ClientConfig { 24 | /** 25 | * @var modX|null $modx 26 | */ 27 | public $modx = null; 28 | /** 29 | * @var array 30 | */ 31 | public $config = array(); 32 | /** 33 | * @var bool 34 | */ 35 | public $debug = false; 36 | 37 | 38 | /** 39 | * @param \modX $modx 40 | * @param array $config 41 | */ 42 | public function __construct(modX &$modx,array $config = array()) { 43 | $this->modx =& $modx; 44 | 45 | $corePath = $this->modx->getOption('clientconfig.core_path',$config,$this->modx->getOption('core_path').'components/clientconfig/'); 46 | $assetsUrl = $this->modx->getOption('clientconfig.assets_url',$config,$this->modx->getOption('assets_url').'components/clientconfig/'); 47 | $assetsPath = $this->modx->getOption('clientconfig.assets_path',$config,$this->modx->getOption('assets_path').'components/clientconfig/'); 48 | $this->config = array_merge(array( 49 | 'basePath' => $corePath, 50 | 'corePath' => $corePath, 51 | 'modelPath' => $corePath.'model/', 52 | 'processorsPath' => $corePath.'processors/', 53 | 'elementsPath' => $corePath.'elements/', 54 | 'templatesPath' => $corePath.'templates/', 55 | 'assetsPath' => $assetsPath, 56 | 'jsUrl' => $assetsUrl.'js/', 57 | 'cssUrl' => $assetsUrl.'css/', 58 | 'assetsUrl' => $assetsUrl, 59 | 'connectorUrl' => $assetsUrl.'connector.php', 60 | 61 | 'verticalTabs' => (bool)$this->modx->getOption('clientconfig.vertical_tabs', null, false), 62 | ),$config); 63 | 64 | $modelPath = $this->config['modelPath']; 65 | $this->modx->addPackage('clientconfig',$modelPath); 66 | $this->modx->lexicon->load('clientconfig:default'); 67 | 68 | $this->debug = (bool)$this->modx->getOption('clientconfig.debug',null,false); 69 | } 70 | 71 | /** 72 | * Grab settings (from cache if possible) as key => value pairs. 73 | * @param string $context 74 | * @return array|mixed 75 | */ 76 | public function getSettings($context = '') { 77 | /* Attempt to get from cache */ 78 | $cacheOptions = array(xPDO::OPT_CACHE_KEY => 'system_settings'); 79 | $settings = $this->modx->getCacheManager()->get('clientconfig', $cacheOptions); 80 | 81 | if (!is_array($settings) || !array_key_exists('global', $settings)) { 82 | $settings = array( 83 | 'global' => array(), 84 | 'contexts' => array(), 85 | ); 86 | 87 | $collection = $this->modx->getCollection('cgSetting'); 88 | /* @var cgSetting[] $collection */ 89 | foreach ($collection as $setting) { 90 | $isMedia = in_array($setting->get('xtype'), ['modx-panel-tv-image', 'modx-panel-tv-file'], true); 91 | 92 | $value = $setting->get('value'); 93 | if ($isMedia) { 94 | $value = $setting->prefixSourceUrl($value); 95 | } 96 | 97 | $settings['global'][$setting->get('key')] = $value; 98 | 99 | /** @var cgContextValue[] $contextValues */ 100 | $contextValues = $setting->getMany('ContextValues'); 101 | if (is_array($contextValues)) { 102 | foreach ($contextValues as $cVal) { 103 | $cKey = $cVal->get('context'); 104 | if (!array_key_exists($cKey, $settings['contexts'])) { 105 | $settings['contexts'][$cKey] = array(); 106 | } 107 | 108 | $value = $cVal->get('value'); 109 | if ($isMedia) { 110 | $value = $setting->prefixSourceUrl($value); 111 | } 112 | if (!empty($value)) { 113 | $settings['contexts'][$cKey][$setting->get('key')] = $value; 114 | } 115 | } 116 | } 117 | } 118 | if($settings) { 119 | /* Write to cache again */ 120 | $this->modx->cacheManager->set('clientconfig', $settings, 0, $cacheOptions); 121 | } 122 | } 123 | 124 | if (!is_array($settings)) { 125 | return array(); 126 | } 127 | 128 | $return = array_key_exists('global', $settings) ? $settings['global'] : array(); 129 | 130 | if ($context !== '' 131 | && array_key_exists('contexts', $settings) 132 | && array_key_exists($context, $settings['contexts']) 133 | && $this->modx->getOption('clientconfig.context_aware') 134 | ) { 135 | $return = array_merge($return, $settings['contexts'][$context]); 136 | } 137 | 138 | return $return; 139 | } 140 | 141 | /** 142 | * Indicates if the logged in user has admin permissions. 143 | * @return bool 144 | */ 145 | public function hasAdminPermission() { 146 | if (!$this->modx->user || ($this->modx->user->get('id') < 1)) { 147 | return false; 148 | } 149 | 150 | $usergroups = $this->modx->getOption('clientconfig.admin_groups', null, 'Administrator'); 151 | $usergroups = explode(',', $usergroups); 152 | 153 | $isMember = $this->modx->user->isMember($usergroups, false); 154 | 155 | /* If we're not a member of the usergroup(s), check for sudo */ 156 | if (!$isMember) { 157 | $v = $this->modx->getVersionData(); 158 | if (version_compare($v['full_version'], '2.2.1-pl') == 1) { 159 | $isMember = (bool)$this->modx->user->get('sudo'); 160 | } 161 | } 162 | return $isMember; 163 | } 164 | } 165 | 166 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/metadata.mysql.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | $xpdo_meta_map = array ( 4 | 'xPDOSimpleObject' => 5 | array ( 6 | 0 => 'cgSetting', 7 | 1 => 'cgGroup', 8 | 2 => 'cgContextValue', 9 | ), 10 | ); -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cgcontextvalue.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once (dirname(dirname(__FILE__)) . '/cgcontextvalue.class.php'); 3 | class cgContextValue_mysql extends cgContextValue {} -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cgcontextvalue.map.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | $xpdo_meta_map['cgContextValue']= array ( 3 | 'package' => 'clientconfig', 4 | 'version' => '1.1', 5 | 'table' => 'clientconfig_context_value', 6 | 'extends' => 'xPDOSimpleObject', 7 | 'fields' => 8 | array ( 9 | 'setting' => 0, 10 | 'context' => 'web', 11 | 'value' => '', 12 | ), 13 | 'fieldMeta' => 14 | array ( 15 | 'setting' => 16 | array ( 17 | 'dbtype' => 'int', 18 | 'precision' => '10', 19 | 'phptype' => 'integer', 20 | 'null' => false, 21 | 'default' => 0, 22 | ), 23 | 'context' => 24 | array ( 25 | 'dbtype' => 'varchar', 26 | 'precision' => '75', 27 | 'phptype' => 'string', 28 | 'null' => false, 29 | 'default' => 'web', 30 | ), 31 | 'value' => 32 | array ( 33 | 'dbtype' => 'mediumtext', 34 | 'phptype' => 'string', 35 | 'null' => false, 36 | 'default' => '', 37 | ), 38 | ), 39 | 'aggregates' => 40 | array ( 41 | 'Setting' => 42 | array ( 43 | 'local' => 'setting', 44 | 'class' => 'cgSetting', 45 | 'foreign' => 'id', 46 | 'owner' => 'setting', 47 | 'cardinality' => 'one', 48 | ), 49 | ), 50 | ); 51 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cggroup.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once (dirname(dirname(__FILE__)) . '/cggroup.class.php'); 3 | class cgGroup_mysql extends cgGroup {} -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cggroup.map.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | $xpdo_meta_map['cgGroup']= array ( 3 | 'package' => 'clientconfig', 4 | 'version' => '1.1', 5 | 'table' => 'clientconfig_group', 6 | 'extends' => 'xPDOSimpleObject', 7 | 'fields' => 8 | array ( 9 | 'label' => '', 10 | 'description' => '0', 11 | 'sortorder' => 0, 12 | ), 13 | 'fieldMeta' => 14 | array ( 15 | 'label' => 16 | array ( 17 | 'dbtype' => 'varchar', 18 | 'precision' => '75', 19 | 'phptype' => 'string', 20 | 'null' => false, 21 | 'default' => '', 22 | ), 23 | 'description' => 24 | array ( 25 | 'dbtype' => 'text', 26 | 'phptype' => 'string', 27 | 'null' => false, 28 | 'default' => '0', 29 | ), 30 | 'sortorder' => 31 | array ( 32 | 'dbtype' => 'int', 33 | 'precision' => '10', 34 | 'phptype' => 'integer', 35 | 'null' => false, 36 | 'default' => 0, 37 | ), 38 | ), 39 | 'aggregates' => 40 | array ( 41 | 'Settings' => 42 | array ( 43 | 'class' => 'cgSetting', 44 | 'cardinality' => 'many', 45 | 'local' => 'id', 46 | 'foreign' => 'group', 47 | 'owner' => 'local', 48 | ), 49 | ), 50 | ); 51 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cgsetting.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once (dirname(dirname(__FILE__)) . '/cgsetting.class.php'); 3 | class cgSetting_mysql extends cgSetting {} -------------------------------------------------------------------------------- /core/components/clientconfig/model/clientconfig/mysql/cgsetting.map.inc.php: -------------------------------------------------------------------------------- 1 | <?php 2 | $xpdo_meta_map['cgSetting']= array ( 3 | 'package' => 'clientconfig', 4 | 'version' => '1.1', 5 | 'table' => 'clientconfig_setting', 6 | 'extends' => 'xPDOSimpleObject', 7 | 'fields' => 8 | array ( 9 | 'key' => '', 10 | 'label' => '', 11 | 'xtype' => '', 12 | 'description' => '0', 13 | 'is_required' => 0, 14 | 'sortorder' => 0, 15 | 'value' => '', 16 | 'default' => '', 17 | 'group' => 0, 18 | 'options' => '', 19 | 'process_options' => 0, 20 | 'source' => 0, 21 | ), 22 | 'fieldMeta' => 23 | array ( 24 | 'key' => 25 | array ( 26 | 'dbtype' => 'varchar', 27 | 'precision' => '75', 28 | 'phptype' => 'string', 29 | 'null' => false, 30 | 'default' => '', 31 | ), 32 | 'label' => 33 | array ( 34 | 'dbtype' => 'varchar', 35 | 'precision' => '75', 36 | 'phptype' => 'string', 37 | 'null' => false, 38 | 'default' => '', 39 | ), 40 | 'xtype' => 41 | array ( 42 | 'dbtype' => 'varchar', 43 | 'precision' => '75', 44 | 'phptype' => 'string', 45 | 'null' => false, 46 | 'default' => '', 47 | ), 48 | 'description' => 49 | array ( 50 | 'dbtype' => 'text', 51 | 'phptype' => 'string', 52 | 'null' => false, 53 | 'default' => '0', 54 | ), 55 | 'is_required' => 56 | array ( 57 | 'dbtype' => 'tinyint', 58 | 'precision' => '1', 59 | 'phptype' => 'boolean', 60 | 'null' => false, 61 | 'default' => 0, 62 | ), 63 | 'sortorder' => 64 | array ( 65 | 'dbtype' => 'int', 66 | 'precision' => '10', 67 | 'phptype' => 'integer', 68 | 'null' => false, 69 | 'default' => 0, 70 | ), 71 | 'value' => 72 | array ( 73 | 'dbtype' => 'mediumtext', 74 | 'phptype' => 'string', 75 | 'null' => false, 76 | 'default' => '', 77 | ), 78 | 'default' => 79 | array ( 80 | 'dbtype' => 'mediumtext', 81 | 'phptype' => 'string', 82 | 'null' => false, 83 | 'default' => '', 84 | ), 85 | 'group' => 86 | array ( 87 | 'dbtype' => 'int', 88 | 'precision' => '11', 89 | 'phptype' => 'int', 90 | 'null' => true, 91 | 'default' => 0, 92 | ), 93 | 'options' => 94 | array ( 95 | 'dbtype' => 'mediumtext', 96 | 'phptype' => 'string', 97 | 'null' => true, 98 | 'default' => '', 99 | ), 100 | 'process_options' => 101 | array ( 102 | 'dbtype' => 'tinyint', 103 | 'precision' => '1', 104 | 'phptype' => 'boolean', 105 | 'null' => false, 106 | 'default' => 0, 107 | ), 108 | 'source' => 109 | array ( 110 | 'dbtype' => 'int', 111 | 'precision' => '11', 112 | 'phptype' => 'int', 113 | 'null' => true, 114 | 'default' => 0, 115 | ), 116 | ), 117 | 'composites' => 118 | array ( 119 | 'ContextValues' => 120 | array ( 121 | 'class' => 'cgContextValue', 122 | 'cardinality' => 'many', 123 | 'local' => 'id', 124 | 'foreign' => 'setting', 125 | 'owner' => 'local', 126 | ), 127 | ), 128 | 'aggregates' => 129 | array ( 130 | 'Group' => 131 | array ( 132 | 'class' => 'cgGroup', 133 | 'cardinality' => 'one', 134 | 'local' => 'group', 135 | 'foreign' => 'id', 136 | 'owner' => 'foreign', 137 | ), 138 | ), 139 | ); 140 | -------------------------------------------------------------------------------- /core/components/clientconfig/model/schema/clientconfig.mysql.schema.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <model package="clientconfig" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1"> 3 | <object class="cgSetting" table="clientconfig_setting" extends="xPDOSimpleObject"> 4 | <field key="key" dbtype="varchar" precision="75" phptype="string" null="false" default="" /> 5 | <field key="label" dbtype="varchar" precision="75" phptype="string" null="false" default="" /> 6 | <field key="xtype" dbtype="varchar" precision="75" phptype="string" null="false" default="" /> 7 | <field key="description" dbtype="text" phptype="string" null="false" default="0" /> 8 | <field key="is_required" dbtype="tinyint" precision="1" phptype="boolean" null="false" default="0" /> 9 | <field key="sortorder" dbtype="int" precision="10" phptype="integer" null="false" default="0" /> 10 | <field key="value" dbtype="mediumtext" phptype="string" null="false" default="" /> 11 | <field key="default" dbtype="mediumtext" phptype="string" null="false" default="" /> 12 | <field key="group" dbtype="int" precision="11" phptype="int" null="true" default="0" /> 13 | <field key="options" dbtype="mediumtext" phptype="string" null="true" default="" /> 14 | <field key="process_options" dbtype="tinyint" precision="1" phptype="boolean" null="false" default="0" /> 15 | <field key="source" dbtype="int" precision="11" phptype="int" null="true" default="0" /> 16 | 17 | <aggregate alias="Group" class="cgGroup" cardinality="one" local="group" foreign="id" owner="foreign" /> 18 | <composite alias="ContextValues" class="cgContextValue" cardinality="many" local="id" foreign="setting" owner="local" /> 19 | </object> 20 | 21 | <object class="cgGroup" table="clientconfig_group" extends="xPDOSimpleObject"> 22 | <field key="label" dbtype="varchar" precision="75" phptype="string" null="false" default="" /> 23 | <field key="description" dbtype="text" phptype="string" null="false" default="0" /> 24 | <field key="sortorder" dbtype="int" precision="10" phptype="integer" null="false" default="0" /> 25 | 26 | <aggregate alias="Settings" class="cgSetting" cardinality="many" local="id" foreign="group" owner="local" /> 27 | </object> 28 | 29 | <object class="cgContextValue" table="clientconfig_context_value" extends="xPDOSimpleObject"> 30 | <field key="setting" dbtype="int" precision="10" phptype="integer" null="false" default="0" /> 31 | <field key="context" dbtype="varchar" precision="75" phptype="string" null="false" default="web" /> 32 | <field key="value" dbtype="mediumtext" phptype="string" null="false" default="" /> 33 | 34 | <aggregate alias="Setting" local="setting" class="cgSetting" foreign="id" owner="setting" cardinality="one" /> 35 | </object> 36 | </model> 37 | 38 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/contexts/getlist.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use MODX\Revolution\Processors\Context\GetList; 4 | 5 | // Use old 2.x version if not on MODX 3+ 6 | if (!class_exists(GetList::class)) { 7 | require_once MODX_CORE_PATH . 'model/modx/processors/context/getlist.class.php'; 8 | 9 | class cgContextsGetlistProcessor extends modContextGetListProcessor 10 | { 11 | use GetContexts; 12 | } 13 | return 'cgContextsGetlistProcessor'; 14 | } 15 | 16 | // 3.x version 17 | class cgContextsGetlistProcessor extends GetList 18 | { 19 | use GetContexts; 20 | } 21 | return 'cgContextsGetlistProcessor'; 22 | 23 | // Common trait for both versions of processor 24 | trait GetContexts { 25 | public function beforeIteration(array $list) 26 | { 27 | $list[] = [ 28 | 'key' => '', 29 | 'name' => $this->modx->lexicon('clientconfig.global_values'), 30 | ]; 31 | return $list; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/export.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | /** 4 | * Class ClientConfigExportProcessor 5 | */ 6 | abstract class ClientConfigExportProcessor extends modProcessor 7 | { 8 | public $classKey; 9 | public $sortKey = 'sortorder'; 10 | 11 | /** 12 | * Fetches the data, generates XML and tells the browser to download it. 13 | * 14 | * @return mixed 15 | */ 16 | public function process() 17 | { 18 | $c = $this->modx->newQuery($this->classKey); 19 | $c->sortby($this->sortKey, 'ASC'); 20 | 21 | $collection = $this->modx->getCollection($this->classKey, $c); 22 | $xml = $this->generateXml($collection); 23 | $name = $this->classKey . '_' . strtolower(str_replace(' ', '-', $this->modx->getOption('site_name'))) . '_' . date('Y-m-d@H:i:s') . '.xml'; 24 | 25 | header('Content-Disposition: attachment; filename="'.$name); 26 | header('Content-Type: text/xml'); 27 | return $xml; 28 | } 29 | 30 | /** 31 | * Takes a collection of xPDOObject's and writes it to nice XML. 32 | * 33 | * @param array $collection 34 | * @return string 35 | */ 36 | public function generateXml(array $collection = array()) 37 | { 38 | $total = 0; 39 | $itemsXml = array(); 40 | foreach ($collection as $object) { 41 | /** @var xPDOObject $object */ 42 | $objectArray = $object->toArray(); 43 | $type = $object->_class; 44 | 45 | $objectXml = array(); 46 | foreach ($objectArray as $key => $value) { 47 | if (!is_numeric($value) && !is_bool($value) && !is_null($value)) { 48 | // Escape any "]]>" occurences inside the value per http://en.wikipedia.org/wiki/CDATA#Nesting 49 | $value = str_replace(']]>', ']]]]><![CDATA[>', $value); 50 | $objectXml[] = "<{$key}><![CDATA[{$value}]]></{$key}>"; 51 | } else { 52 | $objectXml[] = "<{$key}>{$value}</{$key}>"; 53 | } 54 | } 55 | $objectXml = implode("\n\t", $objectXml); 56 | $itemsXml[] = "<{$type}>\n\t{$objectXml}\n</{$type}>"; 57 | $total++; 58 | } 59 | $itemsXml = implode("\n", $itemsXml); 60 | 61 | $time = date('Y-m-d@H:i:s'); 62 | $xml = <<<XML 63 | <?xml version="1.0" encoding="UTF-8"?> 64 | <data package="clientconfig" exported="$time" total="$total"> 65 | $itemsXml 66 | </data> 67 | XML; 68 | return $xml; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/fonts/google/getlist.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Gets a list of cgGroup objects. 4 | */ 5 | class cgGoogleFontListGetListProcessor extends modObjectGetListProcessor { 6 | public $languageTopics = array('clientconfig:default'); 7 | 8 | /** 9 | * {@inheritDoc} 10 | * @return mixed 11 | */ 12 | public function process() { 13 | $apiKey = $this->modx->getOption('clientconfig.google_fonts_api_key', null, ''); 14 | if (empty($apiKey)) { 15 | return $this->outputArray(array(), 0); 16 | } 17 | $apiEndpoint = "https://www.googleapis.com/webfonts/v1/webfonts?key={$apiKey}&sort=alpha"; 18 | $json = $this->modx->fromJson($this->curlGet($apiEndpoint)); 19 | $fonts = $json['items']; 20 | $total = count($fonts); 21 | $list = array(); 22 | 23 | foreach ($fonts as $font) { 24 | $item = array(); 25 | $item['family'] = str_replace(' ','+',$font['family']); 26 | $item['name'] = $font['family']; 27 | $list[] = $item; 28 | } 29 | 30 | return $this->outputArray($list,$total); 31 | } 32 | 33 | /** 34 | * Gets data from a remote url using cURL 35 | * 36 | * @param $url 37 | * @return mixed 38 | */ 39 | protected function curlGet($url) { 40 | $curl = curl_init($url); 41 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 42 | $results = curl_exec($curl); 43 | curl_close($curl); 44 | 45 | return $results; 46 | } 47 | } 48 | return 'cgGoogleFontListGetListProcessor'; 49 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/create.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Creates a cgGroup object. 4 | */ 5 | class cgGroupCreateProcessor extends modObjectCreateProcessor { 6 | public $classKey = 'cgGroup'; 7 | public $languageTopics = array('clientconfig:default'); 8 | 9 | /** 10 | * Before saving, we check if the name is filled and/or already exists. 11 | * @return bool 12 | */ 13 | public function beforeSave() { 14 | $name = $this->getProperty('label'); 15 | 16 | if (empty($name)) { 17 | $this->addFieldError('label',$this->modx->lexicon('clientconfig.clientconfigmenu_err_ns_label')); 18 | } else { 19 | if ($this->doesAlreadyExist(array('label' => $name))) { 20 | $this->addFieldError('label',$this->modx->lexicon('clientconfig.clientconfigmenu_err_ae')); 21 | } 22 | } 23 | 24 | return parent::beforeSave(); 25 | } 26 | } 27 | return 'cgGroupCreateProcessor'; 28 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/export.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once dirname(dirname(__FILE__)) . '/export.class.php'; 3 | /** 4 | * Class cgGroupExportProcessor 5 | */ 6 | class cgGroupExportProcessor extends ClientConfigExportProcessor 7 | { 8 | public $classKey = 'cgGroup'; 9 | } 10 | 11 | return 'cgGroupExportProcessor'; 12 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/getlist.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Gets a list of cgGroup objects. 4 | */ 5 | class cgGroupGetListProcessor extends modObjectGetListProcessor { 6 | public $classKey = 'cgGroup'; 7 | public $languageTopics = array('clientconfig:default'); 8 | public $defaultSortField = 'label'; 9 | public $defaultSortDirection = 'ASC'; 10 | 11 | 12 | /** 13 | * Transform the xPDOObject derivative to an array; 14 | * @param xPDOObject $object 15 | * @return array 16 | */ 17 | public function prepareRow(xPDOObject $object) { 18 | $row = $object->toArray('', false, true); 19 | $row['settings_count'] = $this->modx->getCount('cgSetting', array('group' => $row['id'])); 20 | return $row; 21 | } 22 | } 23 | return 'cgGroupGetListProcessor'; 24 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/import.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once dirname(dirname(__FILE__)) . '/import.class.php'; 3 | /** 4 | * Class cgGroupImportProcessor 5 | */ 6 | class cgGroupImportProcessor extends ClientConfigImportProcessor 7 | { 8 | public $classKey = 'cgGroup'; 9 | } 10 | 11 | return 'cgGroupImportProcessor'; 12 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/remove.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | class cgGroupRemoveProcessor extends modObjectRemoveProcessor { 3 | public $classKey = 'cgGroup'; 4 | public $objectType = 'cgGroup'; 5 | 6 | public function beforeRemove() { 7 | $settings = $this->modx->getCollection('cgSetting',array('group' => $this->object->get('id'))); 8 | foreach ($settings as $setting) { 9 | /* @var cgSetting $setting */ 10 | $setting->set('group',0); 11 | $setting->save(); 12 | } 13 | return parent::beforeRemove(); 14 | } 15 | } 16 | return 'cgGroupRemoveProcessor'; 17 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/update.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Updates a cgGroup object 4 | */ 5 | class cgGroupUpdateProcessor extends modObjectUpdateProcessor { 6 | public $classKey = 'cgGroup'; 7 | public $languageTopics = array('clientconfig:default'); 8 | public $objectType = 'clientconfig.clientconfigmenu'; 9 | 10 | /** 11 | * Validate stuff before save. 12 | * @return bool 13 | */ 14 | public function beforeSave() { 15 | return parent::beforeSave(); 16 | } 17 | } 18 | return 'cgGroupUpdateProcessor'; 19 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/groups/updatefromgrid.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Updates a cgGroup object from the grid 4 | */ 5 | require_once (dirname(__FILE__).'/update.class.php'); 6 | 7 | class cgGroupUpdateFromGridProcessor extends cgGroupUpdateProcessor { 8 | public function initialize() { 9 | $data = $this->getProperty('data'); 10 | if (empty($data)) return $this->modx->lexicon('invalid_data'); 11 | $data = $this->modx->fromJSON($data); 12 | if (empty($data)) return $this->modx->lexicon('invalid_data'); 13 | $this->setProperties($data); 14 | $this->unsetProperty('data'); 15 | return parent::initialize(); 16 | } 17 | } 18 | 19 | return 'cgGroupUpdateFromGridProcessor'; 20 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/import.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | /** 4 | * Class ClientConfigImportProcessor 5 | */ 6 | abstract class ClientConfigImportProcessor extends modProcessor 7 | { 8 | public $classKey; 9 | public $mode = 'insert'; 10 | 11 | public function initialize() { 12 | $mode = $this->getProperty('mode'); 13 | if (in_array($mode, array('insert', 'overwrite', 'replace'))) { 14 | $this->mode = $mode; 15 | } 16 | return parent::initialize(); 17 | } 18 | 19 | /** 20 | * Fetches the data, generates XML and tells the browser to download it. 21 | * 22 | * @return mixed 23 | */ 24 | public function process() 25 | { 26 | $file = $_FILES['file']; 27 | $xml = false; 28 | if (!empty($file['tmp_name']) && file_exists($file['tmp_name'])) { 29 | $xml = simplexml_load_file($file['tmp_name'], 'SimpleXMLElement', LIBXML_NOCDATA); 30 | } 31 | 32 | if (!$xml) { 33 | return $this->failure($this->modx->lexicon('clientconfig.error.xml_not_loaded')); 34 | } 35 | 36 | // Make sure this is a clientconfig export 37 | $package = (string) $xml->attributes()->{'package'}; 38 | if ($package != 'clientconfig') { 39 | return $this->failure($this->modx->lexicon('clientconfig.error.not_an_export')); 40 | } 41 | 42 | $data = array(); 43 | foreach ($xml->{$this->classKey} as $object) { 44 | // Turn $object into an array 45 | $a = array(); 46 | foreach ($object as $key => $value) { 47 | $a[(string)$key] = (string)$value; 48 | } 49 | $data[] = $a; 50 | } 51 | 52 | if ($this->mode == 'replace') { 53 | $this->modx->removeCollection($this->classKey, array()); 54 | } 55 | 56 | foreach ($data as $row) { 57 | /** @var xPDOObject $importedObject */ 58 | $importedObject = false; 59 | switch ($this->mode) { 60 | case 'overwrite': 61 | $importedObject = $this->modx->getObject($this->classKey, $row['id']); 62 | break; 63 | 64 | case 'insert': 65 | unset($row['id']); 66 | break; 67 | } 68 | 69 | if (!$importedObject) { 70 | $importedObject = $this->modx->newObject($this->classKey); 71 | } 72 | 73 | $importedObject->fromArray($row, '', true); 74 | if (!$importedObject->save()) { 75 | return $this->failure($this->modx->lexicon('clientconfig.error.importing_row') . print_r($row, true)); 76 | } 77 | } 78 | 79 | 80 | return $this->success(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/create.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Creates a cgSetting object. 4 | */ 5 | class cgSettingCreateProcessor extends modObjectCreateProcessor { 6 | public $classKey = 'cgSetting'; 7 | public $languageTopics = array('clientconfig:default'); 8 | 9 | /** 10 | * Before setting, we check if the name is filled and/or already exists. Also checkboxes. 11 | * @return bool 12 | */ 13 | public function beforeSet() { 14 | $key = $this->getProperty('key'); 15 | if (empty($key)) { 16 | $this->addFieldError('key',$this->modx->lexicon('clientconfig.cgsetting_err_ns_key')); 17 | } else { 18 | if ($this->doesAlreadyExist(array('key' => $key))) { 19 | $this->addFieldError('key',$this->modx->lexicon('clientconfig.cgsetting_err_ae_key')); 20 | } 21 | } 22 | $order = (int)$this->getProperty('sortorder', 0); 23 | if ($order < 1) { 24 | $order = $this->modx->getCount('cgSetting', array('group', (int)$this->getProperty('group', 0))); 25 | $this->setProperty('sortorder', $order); 26 | } 27 | 28 | /* Set is_required checkbox */ 29 | $this->setCheckbox('is_required', true); 30 | $this->setCheckbox('process_options', true); 31 | return parent::beforeSet(); 32 | } 33 | 34 | public function afterSave() 35 | { 36 | // Invoke events and clear the cache 37 | $this->modx->invokeEvent('ClientConfig_ConfigChange'); 38 | $this->modx->getCacheManager()->delete('clientconfig',array(xPDO::OPT_CACHE_KEY => 'system_settings')); 39 | if ($this->modx->getOption('clientconfig.clear_cache', null, true)) { 40 | $this->modx->getCacheManager()->delete('',array(xPDO::OPT_CACHE_KEY => 'resource')); 41 | } 42 | 43 | return parent::afterSave(); 44 | } 45 | } 46 | return 'cgSettingCreateProcessor'; 47 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/export.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once dirname(dirname(__FILE__)) . '/export.class.php'; 3 | /** 4 | * Class cgSettingExportProcessor 5 | */ 6 | class cgSettingExportProcessor extends ClientConfigExportProcessor 7 | { 8 | public $classKey = 'cgSetting'; 9 | } 10 | 11 | return 'cgSettingExportProcessor'; 12 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/getcontextaware.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | class cgSettingsGetContextAwareProcessor extends modProcessor { 4 | /** @var modContext */ 5 | protected $context; 6 | 7 | public function initialize() 8 | { 9 | $ctxKey = $this->getProperty('context'); 10 | $ctx = $this->modx->getObject('modContext', ['key' => $ctxKey]); 11 | if ($ctx instanceof modContext) { 12 | $this->context = $ctx; 13 | return true; 14 | } 15 | return 'context_err_nf'; 16 | } 17 | 18 | public function process() 19 | { 20 | $c = $this->modx->newQuery('cgContextValue'); 21 | $c->rightJoin('cgSetting', 'Setting'); 22 | $c->select($this->modx->getSelectColumns('cgContextValue', 'cgContextValue')); 23 | $c->select($this->modx->getSelectColumns('cgSetting', 'Setting', 'setting_', ['id', 'key', 'value', 'default', 'xtype'])); 24 | $c->where([ 25 | 'context' => $this->context->get('key') 26 | ]); 27 | 28 | $values = [ 29 | 'context' => $this->context->get('key'), 30 | 'context_name' => $this->context->get('name'), 31 | ]; 32 | foreach ($this->modx->getIterator('cgContextValue', $c) as $cv) { 33 | /** @var cgContextValue $cg */ 34 | $key = $cv->get('setting_key'); 35 | $value = $cv->get('value'); 36 | // Set is media to false 37 | $isMedia = false; 38 | switch ($cv->get('setting_xtype')) { 39 | case 'checkbox': 40 | case 'xcheckbox': 41 | $value = (bool)$value; 42 | break; 43 | // If this looks like a media type, set isMedia to true 44 | case 'modx-panel-tv-image': 45 | case 'modx-panel-tv-file': 46 | $isMedia = true; 47 | break; 48 | } 49 | 50 | if ($value === '') { 51 | $value = $cv->get('setting_default'); 52 | } 53 | 54 | $values[$key] = $value; 55 | 56 | /* If this is a media type, set additional named placeholders so 57 | .setValues() populates the values on context change */ 58 | if ($isMedia) { 59 | $values['tv'.$key] = $value; 60 | $values['tvbrowser'.$key] = $value; 61 | } 62 | } 63 | 64 | return $this->success('', $values); 65 | } 66 | } 67 | 68 | return 'cgSettingsGetContextAwareProcessor'; 69 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/getglobal.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | class cgSettingsGetGlobalProcessor extends modProcessor { 4 | public function process() 5 | { 6 | $c = $this->modx->newQuery('cgSetting'); 7 | $values = [ 8 | 'context' => '', 9 | 'context_name' => '', 10 | ]; 11 | foreach ($this->modx->getIterator('cgSetting', $c) as $setting) { 12 | /** @var cgSetting $cg */ 13 | $key = $setting->get('key'); 14 | $value = $setting->get('value'); 15 | switch ($setting->get('xtype')) { 16 | case 'checkbox': 17 | case 'xcheckbox': 18 | $value = (bool)$value; 19 | break; 20 | } 21 | 22 | if ($value === '') { 23 | $value = $setting->get('default'); 24 | } 25 | 26 | $values[$key] = $value; 27 | } 28 | 29 | return $this->success('', $values); 30 | } 31 | } 32 | 33 | return 'cgSettingsGetGlobalProcessor'; -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/getlist.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Gets a list of cgSetting objects. 4 | */ 5 | class cgSettingGetListProcessor extends modObjectGetListProcessor { 6 | public $classKey = 'cgSetting'; 7 | public $languageTopics = array('clientconfig:default'); 8 | public $defaultSortField = 'label'; 9 | public $defaultSortDirection = 'ASC'; 10 | 11 | /** 12 | * @param xPDOQuery $c 13 | * @return xPDOQuery 14 | */ 15 | public function prepareQueryBeforeCount(xPDOQuery $c) { 16 | $c->leftJoin('cgGroup','Group'); 17 | $c->select($this->modx->getSelectColumns('cgSetting', 'cgSetting')); 18 | $c->select($this->modx->getSelectColumns('cgGroup', 'Group', 'group_', array('label'))); 19 | 20 | /* Filter on Group */ 21 | $group = $this->getProperty('group'); 22 | if (!empty($group) && is_numeric($group)) { 23 | $c->where(array( 24 | 'group' => $group 25 | )); 26 | } 27 | return $c; 28 | } 29 | 30 | /** 31 | * Transform the xPDOObject derivative to an array; 32 | * @param xPDOObject $object 33 | * @return array 34 | */ 35 | public function prepareRow(xPDOObject $object) { 36 | $row = $object->toArray('', false, true); 37 | return $row; 38 | } 39 | } 40 | return 'cgSettingGetListProcessor'; 41 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/import.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | require_once dirname(dirname(__FILE__)) . '/import.class.php'; 3 | /** 4 | * Class cgSettingImportProcessor 5 | */ 6 | class cgSettingImportProcessor extends ClientConfigImportProcessor 7 | { 8 | public $classKey = 'cgSetting'; 9 | 10 | public function success($msg = '',$object = null) 11 | { 12 | // Invoke events and clear the cache 13 | $this->modx->invokeEvent('ClientConfig_ConfigChange'); 14 | $this->modx->getCacheManager()->delete('clientconfig',array(xPDO::OPT_CACHE_KEY => 'system_settings')); 15 | if ($this->modx->getOption('clientconfig.clear_cache', null, true)) { 16 | $this->modx->getCacheManager()->delete('',array(xPDO::OPT_CACHE_KEY => 'resource')); 17 | } 18 | 19 | return parent::success($msg, $object); 20 | } 21 | } 22 | 23 | return 'cgSettingImportProcessor'; 24 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/remove.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * @package ClientConfig 4 | */ 5 | class cgSettingRemoveProcessor extends modObjectRemoveProcessor { 6 | public $classKey = 'cgSetting'; 7 | public $objectType = 'cgSetting'; 8 | } 9 | return 'cgSettingRemoveProcessor'; 10 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/save.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * @package ClientConfig 4 | * Used to save setting values from the client view. 5 | */ 6 | class cgSettingSaveProcessor extends modProcessor { 7 | 8 | /** 9 | * {@inheritdoc} 10 | * @return array|string 11 | */ 12 | public function process() { 13 | $values = (!empty($_POST['values'])) ? $_POST['values'] : '[]'; 14 | $values = json_decode($values, true); 15 | if (!is_array($values)) { 16 | return $this->failure('Invalid JSON provided'); 17 | } 18 | 19 | $context = false; 20 | $contextKey = array_key_exists('context', $values) ? $values['context'] : ''; 21 | if ($contextKey !== '') { 22 | $context = $this->modx->getObject('modContext', ['key' => $contextKey]); 23 | if (!$context) { 24 | return $this->failure($this->modx->lexicon('context_err_nf')); 25 | } 26 | } 27 | 28 | // Loop over each of the provided values, to update them in the database. 29 | foreach ($values as $key => $value) { 30 | $setting = $this->modx->getObject('cgSetting',array('key' => $key)); 31 | if (!($setting instanceof cgSetting)) { 32 | continue; 33 | } 34 | 35 | if (trim($value) === '' && $setting->get('is_required') && 36 | !in_array($setting->get('xtype'), array('checkbox', 'xcheckbox'), true)) { 37 | $this->addFieldError($key, $setting->get('label') . ': ' . $this->modx->lexicon('clientconfig.field_is_required')); 38 | continue; 39 | } 40 | 41 | // Some field type specific value handling 42 | switch ($setting->get('xtype')) { 43 | case 'checkbox': 44 | case 'xcheckbox': 45 | $value = !empty($value) ? true : false; 46 | break; 47 | default: 48 | break; 49 | } 50 | 51 | // If we have a context key, update the context value 52 | if ($context) { 53 | $contextValue = $this->modx->getObject('cgContextValue', ['setting' => $setting->get('id'), 'context' => $contextKey]); 54 | if (!($contextValue instanceof cgContextValue)) { 55 | $contextValue = $this->modx->newObject('cgContextValue'); 56 | $contextValue->set('setting', $setting->get('id')); 57 | $contextValue->set('context', $contextKey); 58 | } 59 | 60 | $contextValue->set('value', $value); 61 | $contextValue->save(); 62 | } 63 | // Update the global setting instead 64 | else { 65 | $setting->set('value', $value); 66 | $setting->save(); 67 | } 68 | } 69 | 70 | // Invoke events and clear the cache 71 | $this->modx->getCacheManager()->delete('clientconfig',array(xPDO::OPT_CACHE_KEY => 'system_settings')); 72 | if ($this->modx->getOption('clientconfig.clear_cache', null, true)) { 73 | $this->modx->getCacheManager()->delete('',array(xPDO::OPT_CACHE_KEY => 'resource')); 74 | } 75 | $this->modx->invokeEvent('ClientConfig_ConfigChange'); 76 | 77 | // Return a response 78 | if ($this->hasErrors()) { 79 | $errors = $this->modx->error->getFields(); 80 | return $this->failure(implode('<br>', $errors)); 81 | } else { 82 | return $this->success(); 83 | } 84 | } 85 | 86 | } 87 | return 'cgSettingSaveProcessor'; 88 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/update.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Updates a cgSetting object 4 | */ 5 | class cgSettingUpdateProcessor extends modObjectUpdateProcessor { 6 | public $classKey = 'cgSetting'; 7 | public $languageTopics = array('clientconfig:default'); 8 | 9 | /** 10 | * Before setting, we check if the name is filled and/or already exists. Also checkboxes. 11 | * @return bool 12 | */ 13 | public function beforeSet() { 14 | $key = $this->getProperty('key'); 15 | if (empty($key)) { 16 | $this->addFieldError('key',$this->modx->lexicon('clientconfig.cgsetting_err_ns_key')); 17 | } else { 18 | if ($this->modx->getCount($this->classKey, array('key' => $key, 'AND:id:!=' => $this->object->get('id'))) > 0) { 19 | $this->addFieldError('key',$this->modx->lexicon('clientconfig.cgsetting_err_ae_key')); 20 | } 21 | } 22 | 23 | $this->setCheckbox('is_required', true); 24 | $this->setCheckbox('process_options', true); 25 | return parent::beforeSet(); 26 | } 27 | 28 | public function afterSave() 29 | { 30 | // Invoke events and clear the cache 31 | $this->modx->invokeEvent('ClientConfig_ConfigChange'); 32 | $this->modx->getCacheManager()->delete('clientconfig',array(xPDO::OPT_CACHE_KEY => 'system_settings')); 33 | if ($this->modx->getOption('clientconfig.clear_cache', null, true)) { 34 | $this->modx->getCacheManager()->delete('',array(xPDO::OPT_CACHE_KEY => 'resource')); 35 | } 36 | 37 | return parent::afterSave(); 38 | } 39 | } 40 | return 'cgSettingUpdateProcessor'; 41 | -------------------------------------------------------------------------------- /core/components/clientconfig/processors/mgr/settings/updatefromgrid.class.php: -------------------------------------------------------------------------------- 1 | <?php 2 | /** 3 | * Updates a cgSetting object from the grid 4 | */ 5 | require_once (dirname(__FILE__).'/update.class.php'); 6 | 7 | class cgSettingUpdateFromGridProcessor extends cgSettingUpdateProcessor { 8 | public function initialize() { 9 | $data = $this->getProperty('data'); 10 | if (empty($data)) return $this->modx->lexicon('invalid_data'); 11 | $data = $this->modx->fromJSON($data); 12 | if (empty($data)) return $this->modx->lexicon('invalid_data'); 13 | $this->setProperties($data); 14 | $this->unsetProperty('data'); 15 | return parent::initialize(); 16 | } 17 | } 18 | 19 | return 'cgSettingUpdateFromGridProcessor'; 20 | -------------------------------------------------------------------------------- /core/components/clientconfig/templates/home.tpl: -------------------------------------------------------------------------------- 1 | <div id="clientconfig-wrapper-div"></div> 2 | {$onRichTextEditorInit} 3 | --------------------------------------------------------------------------------