Page 1 of 1

New Adminmenu: Problems and Solutions

Posted: Tue Dec 27, 2011 8:32 pm
by cmb
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

Re: New Adminmenu: Problems and Solutions

Posted: Sat Sep 10, 2022 8:10 am
by frase
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).

Re: New Adminmenu: Problems and Solutions

Posted: Mon Sep 12, 2022 12:59 pm
by olape
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.

Re: New Adminmenu: Problems and Solutions

Posted: Mon Sep 12, 2022 1:29 pm
by Tata
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();?>

Re: New Adminmenu: Problems and Solutions

Posted: Mon Sep 12, 2022 5:13 pm
by olape
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