XH 1.6.4: improve locator in administration

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

XH 1.6.4: improve locator in administration

Post by cmb » Sun Aug 24, 2014 12:10 pm

Hello Community,

the locator is not reasonably handled by the adminstration. Mostly it either shows the value of $f (e.g. for Settings -> CMS and Settings -> Page Data) or nothing (e.g. Plugins -> ...). I suggest we improve that.

Manipulating the locator can be done by either setting the global variable $f or $title. IMO the former should be avoided, as that might cause malfunctions in other plugins or the core, especially if the value would be set to some localized string. Changing the latter (i.e. $title), on the other hand, seems to be exactly what is desired, because that will also set the content of the title element appropriately.

The following patch might already be sufficient for the file editing functionality (configuration, language files, template, stylesheets):

Code: Select all

Index: cmsimple/classes/FileEdit.php
===================================================================
--- cmsimple/classes/FileEdit.php	(revision 1354)
+++ cmsimple/classes/FileEdit.php	(working copy)
@@ -177,6 +177,7 @@
      *
      * @global string The script name.
      * @global array  The localization of the core.
+     * @global string The title of the current page.
      * @global object The CSRF protection object.
      *
      * @access public
@@ -183,8 +184,9 @@
      */
     function form()
     {
-        global $sn, $tx, $_XH_csrfProtection;
+        global $sn, $tx, $title, $_XH_csrfProtection;
 
+        $title = $this->caption;
         $action = isset($this->plugin) ? $sn . '?&' . $this->plugin : $sn;
         $value = utf8_ucfirst($tx['action']['save']);
         if (isset($_GET['xh_success'])) {
@@ -582,6 +584,7 @@
      * @global array  The paths of system files and folders.
      * @global array  The localization of the core.
      * @global string JS for the onload attribute of the body element.
+     * @global string The title of the current page.
      * @global object The CSRF protection object.
      *
      * @access public
@@ -588,8 +591,9 @@
      */
     function form()
     {
-        global $sn, $pth, $tx, $onload, $_XH_csrfProtection;
+        global $sn, $pth, $tx, $onload, $title, $_XH_csrfProtection;
 
+        $title = $this->caption;
         $action = isset($this->plugin) ? $sn . '?&' . $this->plugin : $sn;
         $value = utf8_ucfirst($tx['action']['save']);
         $button = tag('input type="submit" class="submit" value="' . $value . '"');
For instance for Pagemanager's stylesheet, this will result in the following locator:
Home > Pagemanager – Stylesheet
It might be even better to change that to:
Home > Pagemanager > Stylesheet
For some other parts of the administration (e.g. Settings -> Page Data) the core would have to be modified appropriately. Yet other parts are the responsibility of individual plugins, for instance, the plugin "info" screen (e.g. Plugins -> Pagemanager) and Pages as well as Filebrowser -> ... I suggest that we recommend that plugins should explicitely set $title when appropriate (something I have mostly ignored so far for my plugins).

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.6.4: improve locator in administration

Post by cmb » Fri Jan 09, 2015 2:49 pm

Done for the core and the internal plugins (r1442).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply