Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GSconfig UI [v0.3]
#1
A while ago, @shawn_a dropped a hint about building a UI for the gsconfig.php through my plugin GS Custom Settings.
In a day or two, this will have become a reality and I just couldn't hold my excitement to post a preview here.

What is this? 
GSconfig UI is a UI shim of gsconfig.php. That means you can tweak the config settings straight from your admin backend, and what's more, without needing to reload the page, log on and off when you change salts, or flush the cache when you change the backend styles! 
Important: this plugin does not read into your existing config, so make sure to synchronize changes to the default config in the UI before hitting 'Save updates'.

What features?
  • Instant config update from within your GS backend
  • Nicely ordered settings per topic with additional help and links
  • Tweak all GSconfig settings with just 1 or 2 clicks.
  • Generate SALT's for your passwords right from the UI, without having to relog.
  • Generate a custom CKeditor toolbar right from the UI.
  • Reset all settings to their defaults.
  • Check GSconfig settings easily by using the hook add_action('gsconfig-load', $function), which gives you access to $gsconfig. To get a config setting simply do $gsconfig['CONSTANT']. If null is returned, the setting is commented out or === default value.
  • All default GS Custom Settings features (search, export/ import)
Installation
  1. If you haven't already, install GS Custom Settings 0.4+
  2. Download the plugin, extract to plugins folder, activate in plugins tab and navigate to the GS Custom Settings 'Site' tab. In the sidebar you will see an item 'GSconfig UI'
  3. Synchronize changes in the UI vs. the GS default config.
  4. Tweak all the settings you like Smile
Notes
  • This plugin requires GS Custom Settings 0.4+
  • If you had config changes before installing, make sure to synchronize them in the UI before hitting 'Save updates' the first time
  • This plugin directly edits gsconfig.php. It is important that you do not have the same constant (even when commented out) twice or more in the file.
  • The settings for GSEDITOROPTIONS need some polishing.
And here's an awesome preview that says it all

[Image: czkUu5o.png]

Changelog
Code:
27/05/2015 - V. 0.2.1


Bugfixes:
    - Fixed potential problems with SALT's & admin dir getting mixed up
    - Fixed absence of redirect when changing admin dir name
    - Fixed Reset to defaults button not appearing

25/05/2015 - V. 0.2

New:
 - Added GS constants to descriptions, removed default code copy field
 - Added language fr_FR
 - Added license, readme, changelog
Changes:
 - Moved Custom toolbar & salt generators inline
Bugfixes:
 - Fixed I18n merging (now multilang capable)
 - Fixed errors with custom toolbar generator toggle icon
 - Fixed custom toolbar generator styling with GSSTYLEWIDE
 - Fixed potential issues with missing file_exists checks
 - Fixed broken link in plugin description

20/05/2015  - V. 0.1 (Alpha)

Initial launch
Reply
#2
Wow, your plugin will be extremely useful for me and, I hope, to all users.
Reply
#3
GSconfig UI 0.1 out!  Smile
Reply
#4
looking good, looks like we will have to clean up our config as basic and advanced.
Some of these will wind up being basic configs that need to be in settings, and most are advanced.
3.4 moves everything to global definitions, so there will be 10 times as many settings.

hmmm..

I also need to create a mapping file with id, desc, token, and datatype,version so we can support i18n for our definitions, and auto generate settings inputs from datatypes. I have this basic sorted out in 3.4 but just as basic sections and php comments for now.

Here is an example of new ones in 3.4
https://github.com/GetSimpleCMS/GetSimpleCMS/issues/982
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
(2015-05-22, 23:17:14)shawn_a Wrote: looking good, looks like we will have to clean up our config as basic and advanced.
Some of these will wind up being basic configs that need to be in settings, and most are advanced.
3.4 moves everything to global definitions, so there will be 10 times as many settings.

hmmm..

I also need to create a mapping file with id, desc, token, and datatype,version so we can support i18n for our definitions, and auto generate settings inputs from datatypes. I have this basic sorted out in 3.4 but just as basic sections and php comments for now.

Here is an example of new ones in 3.4
https://github.com/GetSimpleCMS/GetSimpleCMS/issues/982

Those look really nice & seem to provide a ton of customization options. If I get it correctly, the constants in $GS_definitions are the ones this plugin should later integrate? As for $GS_constants, I get why all of them shouldn't be settable after runtime, but I don't get why some of them are not in $GS_definitions, eg. why would you not allow changing GSFILENAMEMAX, GSTITLEMAX, GSDATEFORMAT, GSDATEANDTIMEFORMAT, GSSHOWCODEHINTS in gsconfig.php (or would you allow that in the 'Settings' tab)?
Reply
#6
Because I figure they would not typically be changed by users. But as the GitHub issue says, those decisions are yet to be made. So feel free to give more input.

Also some of those are defaults to be used if some other method of options are not set. date/time format fallback fallback being if not set in the lang file, the rest are for environmental changes for customizing your codebase of GS, not really a user configs but fine tweaking, for example alot of 3.4 features can be disabled to give it the legacy look and feel for clients etc. Things you maintain in your own fork.

We dont want users changing GSTITLEMAX for example, because now themes can assume it is this length and design accordingly, also the max length for <title> is based on this also, which actually matters. If you change this then its at your own risk and effects core functionality, not user preference. ( this is just an example of one item )
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
http://get-simple.info/extend/plugin-lan...ig-ui/940/
ru_RU.php does not work
Reply
#8
(2015-05-23, 05:55:54)Oleg06 Wrote: http://get-simple.info/extend/plugin-lan...ig-ui/940/
ru_RU.php does not work

Thanks Oleg, I've looked into it. There are two issues: 1) ru_RU.php doesn't display & 2) when set to ru_RU the 'Save Updates' confirmation message is not sent/ settings not saved.

I fixed 1), but I have honestly no clue about 2)... There's no reason this doesn't work, and there is no JS/PHP error..
The only thing I see is that the problem has to do with the setting descriptions, and that apparently the jQuery AJAX call is always pending (no return, no success, no error). Anyone have experience with this? I'm clueless about how to solve this..
Reply
#9
How are you merging languages?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
(2015-05-23, 09:53:57)shawn_a Wrote: How are you merging languages?

Current release I wrote the plugin name, but the lang issues got solved by using the standard way (as in Innovation plugin, using basename(__FILE__, '.php')). So the UI is fine for next version. But the Cyrillic chars keep causing trouble (this is a GS Custom Settings issue).

I've been testing this for over 2 hours , and tried every possible thing in my knowledge, these are the findings:
Whether a save will succeed or not is totally random when Cyrillic chars are in the settings, impossible to isolate one variable. Sometimes it will work, sometimes it won't. Size of the request is impossible (no limit on POST requests). Encoding is UTF-8. No JS errors. JSON sent is valid. No PHP errors with GSDEBUG on & SUPPRESSERRORS off. Setting headers/ content types explicitly on AJAX requests does nothing. Upon further inspection, it seems the AJAX requests seem to be pending really, really long (like 10 minutes), after which the console outputs the error message from the failure callback.

EDIT: I found it! The problem is with a function (not mine) I used to 'pretty-print' JSON to a readable format. Turns out it wasn't suitable for Cyrillic chars. Found a working one, will post a fix very soon in the GS CustomSettings thread. Let's continue this discussion there (if any).
Reply
#11
Does this not read in the gsconfig ? My settings are not reflecting gsconfig.

Also some of the code snippets are cutoff at the end for some reason, probably input size.
(% setting: gsconfig_ui/gs_editor_height <--
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#12
also the UI needs a little work, hard to use on wide pages, does not use any of the GS wrappers for inputs and sections.
Uses alot of its own csss, and sidebar is not compatible with admin.xml colors.

dividers and syntax are distacting, maybe show only on hover, or hide first and last dividers, and lighten color.
Move syntax highlight to bottom not next to name, or make less obtrusive, light, italic etc.

(these might be custom settings issues, oops )
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#13
* There's a small bug with the fold-in fold-out button (Custom toolbar builder):

If you click on it, it will fold-out and + icon changes to - icon. When you fold it in again it stays - icon.

* The (% code %) isn't needed for this plugin. You could use that place to revere to the actual code used in gsconfig.php.

So instead of (% setting: gsconfig_ui/gs_from_email %) show:

Code:
#define('GSFROMEMAIL','');

But than shown just in normal text.

* Why is the toolbar configurator placed here?:
http://rawgit.com/webketje/8c949d57beffe...index.html
Reply
#14
Yeah it would be neat to have a tools section at the bottom to put the two tools at top
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#15
Meh that's a lot of questions, and indeed 90% of them are related to GS Custom Settings, not GSconfig UI.
Let me handle them 1 by 1.

(2015-05-24, 06:21:05)shawn_a Wrote: Yeah it would be neat to have a tools section at the bottom to put the two tools at top
Yes, agreed, I will take that into account for next version, and simply link to them in the relevant settings.

shawn_a Wrote:Also some of the code snippets are cutoff at the end for some reason, probably input size.
(% setting: gsconfig_ui/gs_editor_height <--
That's correct, input size. When you copy paste it, you'll have the full code.

datiswous Wrote:* There's a small bug with the fold-in fold-out button (Custom toolbar builder):
If you click on it, it will fold-out and + icon changes to - icon. When you fold it in again it stays - icon.
Really? I've tested, it works as expected for me on GS 3.3.3. Do you know of any special steps to reproduce?

shawn_a Wrote:Move syntax highlight to bottom not next to name, or make less obtrusive, light, italic etc.
datiswous Wrote:The (% code %) isn't needed for this plugin. You could use that place to revere to the actual code used in gsconfig.php.
True, in GS Custom Settings 0.5 I will introduce an option to hide this codefield, which I will use in GSconfig UI. The highlights will also be moved to a separate line.
However, the code displayed there cannot be changed to the GS constants. But I can write a <code> tag in the description.

datiswous Wrote:* Why is the toolbar configurator placed here?: http://rawgit.com/webketje/8c949d57beffe...index.html
Eh, that's kind of complicated to explain. Because both the custom toolbar builder & GS Custom Settings use KnockoutJS MVVM, and you can only bind your models once to your view without 'hacking' into it. So getting it in an iframe keeps the code framed from the main app (it's possible to include it, but more work).

shawn_a Wrote:Does this not read in the gsconfig ? My settings are not reflecting gsconfig.
If you get a message 'Your settings have been saved', your settings have been saved Smile . Is this not the case?
When GSDEBUG is (manually) turned on, do you get any PHP errors? Are settings saved when you simply build a custom tab in GS custom Settings? (to know where I should look for a potential bug)

shawn_a Wrote:maybe show only on hover, hide first and last dividers, and lighten color?
What do you mean by dividers? The gray borders between settings? If so, yes making it slightly lighter is a good idea, andd i'll have a go at making them visible only on hover.

shawn_a Wrote:also the UI needs a little work, hard to use on wide pages, does not use any of the GS wrappers for inputs and sections.
Uses alot of its own csss, and sidebar is not compatible with admin.xml colors.
I'm aware of the not fully compatible sidebar, however I've been taking steps to improve this & hope it will soon fully be. But you lost me on the 'wide pages', I don't see how it is hard to use even though it uses custom CSS?
IMO it is laid out nicely?
Reply
#16
I mean does it read in your gsconfig ? I am not seeing the same settings I already have set manually for example.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#17
(2015-05-24, 08:52:20)Tyblitz Wrote:
datiswous Wrote:* There's a small bug with the fold-in fold-out button (Custom toolbar builder):
If you click on it, it will fold-out and + icon changes to - icon. When you fold it in again it stays - icon.
Really? I've tested, it works as expected for me on GS 3.3.3. Do you know of any special steps to reproduce?

First you see the button with a + icon. You click on it, it folds out: - icon. You click again, stays - icon. From then on, it's always wrong -> - = closed. + = open.

Tyblitz Wrote:
shawn_a Wrote:Does this not read in the gsconfig ? My settings are not reflecting gsconfig.
If you get a message 'Your settings have been saved', your settings have been saved Smile . Is this not the case?
When GSDEBUG is (manually) turned on, do you get any PHP errors? Are settings saved when you simply build a custom tab in GS custom Settings? (to know where I should look for a potential bug)
I think he means that when he starts using the plugin and has already done changes to gsconfig.php before manually, he doesn't see those activated in GS Config UI.
Reply
#18
Ah thanks, I get what you mean now. 

From the notes in the first post:
Tyblitz Wrote:If you had config changes [vs. the default GSCONFIG settings] before installing, make sure to synchronize them in the UI before hitting 'Save updates' the first time
So no, it doesn't read into your settings [yet], you need to set them in the UI first. I'll add to the description that people using the plugin should make a backup of their gsconfig.php file just in case. It certainly is a logical next step though. Probably for v0.3, as 0.2 is bugfix for languages & some other stuff like missing file_exists checks etc.

@datiswous, yes I notice now; there's also a bug when you click the link in the custom toolbar setting to open it (icon doesn't change). I'll fix this for next version.
Reply
#19
(2015-05-24, 12:23:34)Tyblitz Wrote: @datiswous, yes I notice now; there's also a bug when you click the link in the custom toolbar setting to open it (icon doesn't change). I'll fix this for next version.

It actually also looks bad in a different way if you use the fluid (wide) width setting.
Reply
#20
GSconfig UI 0.2 released

New: 
  - Added GS constants to descriptions, removed default code copy field
  - Added languages French, Russian
  - Added license, readme, changelog
Changes:
  - Moved Custom toolbar & salt generators inline
Bugfixes: 
  - Fixed I18n merging (now multilang capable)
  - Fixed errors with custom toolbar generator toggle icon
  - Fixed custom toolbar generator styling with GSSTYLEWIDE
  - Fixed potential issues with missing file_exists checks
  - Fixed broken link in plugin description

Btw @Oleg06, if you feel like it, you can actually translate the options for GSEDITORTOOL to Russian because the plugin checks option indexes, not option contents Smile.
Reply
#21
after generation of Salt admin folder was renamed folder Sy4$BFym:XV^5afx+2m?QSiJWpc?#%D +sB46H~pPCQ0u4LT#7l#n9: and there were bugs
Code:
Warning: include(admin/inc/common.php) [function.include]: failed to open stream: No such file or directory in /home/xxxxx/public_html/gs/index.php on line 41

Warning: include() [function.include]: Failed opening 'admin/inc/common.php' for inclusion (include_path='.:/usr/local/php53') in /home/xxxxx/public_html/gs/index.php on line 41

Fatal error: Call to undefined function exec_action() in /home/xxxxx/public_html/gs/index.php on line 44
Reply
#22
(2015-05-27, 03:47:22)Oleg06 Wrote: after generation of Salt admin folder was renamed folder Sy4$BFym:XV^5afx+2m?QSiJWpc?#%D +sB46H~pPCQ0u4LT#7l#n9: and there were bugs

That's serious, were you able to rename the folder?I found a related bug which caused the page not to redirect: I mixed up PHP trim function with Javascript String.trim(). To solve, go to gsconfig_ui.php, and replace line 106-120 with the following code. (Will release quickfix soon):


Code:
gsconfigUI.adminDirChange = function(value) {
            document.getElementById('custom-settings-save-btn').onclick = function() {
                if (!(GLOBAL.ADMINDIR === 'admin' && (value === '' || value == 'admin'))) {
                    setTimeout(function() {
                        location.href = location.href.replace(GLOBAL.ADMINDIR, value.trim() ? value.trim() : 'admin');
                    }, 3000);
                }
            }
        };
        gsconfigUI.init = function() {
            if (GSCS.data.items()[GSCS.data.activeItem()].lookup() === 'gsconfig_ui') {
                gsconfigUI.appendConstants();
                gsconfigUI.adminDirChange();
            }
            GSCS.returnSetting('gsconfig_ui', 'gs_admin').value.subscribe(gsconfigUI.adminDirChange);
            GSCS.data.activeItem.subscribe(gsconfigUI.appendConstants);
        };

So you're saying somehow your SALT's got used as the admin dir name? That's impossible unless you accidentally copied the the SALT into the GSADMIN field, I tested again with 0.2 & it's impossible for those to get mixed up.. 
Reply
#23
I did not copy the field, I just generated salt and hit Save
Reply
#24
(2015-05-27, 06:28:52)Oleg06 Wrote: I did not copy the field, I just generated salt and hit Save

Ok weird. I cannot reproduce. 
- Which version of GS Custom Settings are you using? 0.4 or 0.5? 
- Do you remember which of the salt settings (login vs. cookie/uploads) you changed?
- With the fix I posted above, does the problem still arise? (if you retry, try with a word like 'admintest' & not a salt, so you'll easily be able to navigate back to your admin panel)
Reply
#25
GS Custom Settings 0.5
http://youtu.be/N7izixmAtJM?hd=1
Reply




Users browsing this thread: 5 Guest(s)