New Adminmenu: Problems and Solutions

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: 14051
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

New Adminmenu: Problems and Solutions

Post by cmb » Tue Dec 27, 2011 8:32 pm

Hello Developers,

this is about the new adminmenu of CMSimple_XH 1.5. IMO it's really amazing to have the menu fixed to the top of the browser window to allow a real view mode of the pages (thanks to Martin and Gert, who had the idea and did the implementation). But it is mandatory to shift the rest of the page, so the menu doesn't cover the top of it. Basically there are 2 possibilities: set margin-top to the height of the adminmenu for <body> or for <html>. Both have their drawbacks: changing margin-top for <body> results in shifting of CSS background-images, changing margin-top for <html> results in inaccurate JS mouse coordinates. :( So there's a new configuration option: editmenu_scroll. If it's set to "true" the adminmenu is put on top of the page and will scroll with it (basically setting margin-top for <body>), otherwise the adminmenu is fixed to the top of the browser window (setting margin-top for <html>).

So if editmenu_scroll is set to "true", CSS background-images will be shifted, and AFAIK there's nothing that can be done to adjust this. Otherwise the reported JS mouse coordinates are shifted, but this can be catered for by changing the JS where necessary. E.g. for CodeMirror 2.15 it was enough to change a single line from

Code: Select all

      try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
to

Code: Select all

      try { x = e.clientX; y = e.clientY-document.getElementById('editmenu').parentNode.offsetHeight; } catch (e) { return null; }
Note that

Code: Select all

document.getElementsByTagName('html')[0].style.marginTop
didn't work in my tests (IIRC the style property was undefined!). But the above might serve as a workaround. With jQuery you can use

Code: Select all

$('html').css('margin-top')
So please have a look at your JS based plugins, templates and other extensions, and check if they need adjustment for the back-end in CMSimple_XH 1.5.

If anybody has an idea on how the problem of shifted mouse coordinates could be solved all together, I'm looking forward to hear about it.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

frase
Posts: 4893
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: New Adminmenu: Problems and Solutions

Post by frase » Sat Sep 10, 2022 8:10 am

cmb wrote:
Tue Dec 27, 2011 8:32 pm
If anybody has an idea on how the problem of shifted mouse coordinates could be solved all together, I'm looking forward to hear about it.
The solution for the admin menu problem has been available for some time. Olaf has demonstrated the whole thing in his Github repo:
https://github.com/olape-git/cmsimple-x ... admin-menu

Meanwhile, I think this change is so important that we should all pay attention to this point. It will soon be October again - one year has passed since the last XH version.
In my opinion, it is hardly possible to design a modern template as long as the admin menu is infiltrated into the page content.
We need to change this urgently.
And - I would even like it if we raise the XH version number to 2.0 with the introduction of a separate admin menu.

Dear Christoph,
you are currently the only one who could actually take this step.
What could I do to convince you?
It always looks as if only a few active people want to push through such innovations. But I think that this step would really be in the interest of all users. Ultimately, the use of CMSimple_XH would be much easier even for inexperienced users. (Just think of standard elements like lists).

olape
Posts: 2268
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: New Adminmenu: Problems and Solutions

Post by olape » Mon Sep 12, 2022 12:59 pm

So I'm still in favor of it. It would be beneficial for everyone.
However, I almost believe that this design, which we HAVE CREATED TOGETHER WITH FRASE AND LCK, will no longer fit 1:1 so on the 1.7.5. But I'm not sure about that.

Tata
Posts: 3497
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: New Adminmenu: Problems and Solutions

Post by Tata » Mon Sep 12, 2022 1:29 pm

Would this not be the simpliest way? Simply in admin modus to shift the whole BODY down as necessary.

Code: Select all

<body class="<?php if (XH_ADM) { echo 'admin_body';} else {echo 'body';}?>" onload();?>
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

olape
Posts: 2268
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: New Adminmenu: Problems and Solutions

Post by olape » Mon Sep 12, 2022 5:13 pm

Tata wrote:
Mon Sep 12, 2022 1:29 pm
Would this not be the simpliest way? Simply in admin modus to shift the whole BODY down as necessary.

Code: Select all

<body class="<?php if (XH_ADM) { echo 'admin_body';} else {echo 'body';}?>" onload();?>
Unfortunately, it is not so simple

Post Reply