Jump to content

Adminbar


apeisa

Recommended Posts

If your login template is HTTPS, then how is the session even possible without SSL? Ah, it is. Our setup is actually little more complicated: we have https://*.pwire.fi ssl sert that we use for all our clients. So their domain is different with SSL.

But basically if you always use relative urls, then it will not ever change for logged in user (if your login page is ssl of course). Though to be sure you can check in autoload module (or _init.php template) something like if user is logged in and http, redir to http

.

Edited by apeisa
Link to comment
Share on other sites

Ah, you're right! All of my links are root-relative, and most of time I stay in https, EXCEPT when I go back to the home page (which is also root-relative, i.e. href="/"). For some reason that takes me out of https. Any idea why this would be??

Edit: This may be an issue with an Apache directive on our end... Looking into it.

Edit 2: Yep, that was it. The only issue now would be if the client opens another window to view the site front end and doesn't go to https. But I'm not too concerned about that. Thanks for helping me get to the bottom of this, apeisa.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

@apeisa: using IE9, I'm seeing a whole bunch of JS errors when loading edit views with Adminbar. Not every time, but couple of clicks on the edit button and there they are. Any idea what could cause this?

SCRIPT5009: 'Array' is undefined 
JqueryCore.js?v=183, line 2 character 9220
SCRIPT5009: 'jQuery' is undefined 
JqueryUI.js?v=192, line 6 character 2
SCRIPT5009: '$' is undefined 
ProcessPageEdit.js?v=102, line 1 character 1
SCRIPT5009: 'jQuery' is undefined 
JqueryWireTabs.js?v=103, line 8 character 2
SCRIPT5009: 'eval' is undefined 
JqueryFancybox.js?v=126, line 16 character 2
SCRIPT5009: '$' is undefined 
ProcessPageList.js?v=102, line 16 character 1
SCRIPT5009: '$' is undefined 
MarkupAdminDataTable.js?v=101, line 1 character 1
SCRIPT5009: 'jQuery' is undefined 
JqueryTableSorter.js?v=203, line 2 character 2
...

CKEditor could be part of the answer, as this is one of our first big sites with it enabled. These errors don't show up when loading same modal edit view in it's own tab/window, so I'm guessing the iframe embed might have something to do with this too.

Also: in IE9 this seems to stay at the level of ton of errors, but a client has reported that on IE8 whole view simply freezes and nothing works. Again, not every time, but often enough to make it an issue.

Edit: actually this also seems to disable most features (links, lists etc.) in CKEditor (IE9.)

Edited by teppo
Link to comment
Share on other sites

Hi all,

I´ve posted something about using CKEditor for front-page inline editing. Teppo has told me about this thread, so I just wanted to connect. I see the possible use of various editors for inline editing has been discussed here before.

@apeisa: Your Adminbar module looks great. I´ve only become aware of it now.   => I´v just installed Adminbar for a test and it really works well, but if editing could be done "right on the page" (inline) that would be even more intuitive for the end user.

Link to comment
Share on other sites

  • 2 weeks later...

Finally had time to take a closer look at that issue I mentioned earlier.

So far it seems very similar to this one affecting Drupal Colorbox plugin, which in turn points to page at MSDN. This could also explain why using IE9 I'm "just" seeing a bunch of "undefined" errors regarding various objects in console, while earlier versions of IE seem to freeze entirely. This behavior was, after all, apparently altered in IE9 to address memory leak issues.

@apeisa, have you heard of this issue earlier and if so, any chance you'd know how to fix it.. or if it even is what I think it is? :)

Edit: solution mentioned in this Stack Overflow thread (clearing iframe src attribute before removing it) seems to do the trick, at least in IE9. Still needs more testing, but at the moment I'm not seeing errors mentioned earlier.

This is what I've changed so far:

--- AdminBar.js (revision xxx)
+++ AdminBar.js (working copy)
@@ -78,7 +78,7 @@
        function slideUp(clean) {
                if (clean) {
                        $adminbar.data('active', 'browse');
-                       $modal.find('iframe').remove();
+                       $modal.find('iframe').attr('src', '').remove();
                        setActive($browse);
                }
                $adminbar.data('active', 'browse');
Edited by teppo
Link to comment
Share on other sites

  • 7 months later...

Hi antti,

Not really sure if you are planning on maintaining this module anymore, since Fredi, but I just updated an old site that has this running to the latest PW dev version and there is an issue with the adminbar no longer being visible once you click on Edit. So if you decide not to edit the only way out of it is to hit the browser back button, or click save anyway, even though you have no changes.

Link to comment
Share on other sites

  • 1 month later...

Antti,

AdminBar seems to hide the template dropdown when adding a new page on ProcessWire 2.5.2 sites.

I'm not sure why this particular line was originally added, but removing it fixes the bug:
https://github.com/apeisa/AdminBar/blob/master/AdminBar.module#L142

Do you have some idea if this change will cause problems with earlier versions of ProcessWire?

  • Like 1
Link to comment
Share on other sites

The reason that template change is disabled (or rather just hidden) is that when changing template, adminbar doesn't know how to show the confirm page (on template change), because it redirects before that.

When creating new page, then I think it's ok to have template select. Not sure which is better/simpler fix: showing it always and handling template confirmation on change situation - or just like now but making sure template select is available when creating new page.

Reason this is little bit "non issue" for me personally is that I have 99% time only one template allowed.

  • Like 1
Link to comment
Share on other sites

I understand that “non issue” point of view but I’d like to clarify this a bit more, maybe some other users are also wondering about this. =)

I agree that when creating a new page it’s ok to have a template select. Actually I think that it’s quite mandatory, because now in this case the template for the new page will always be the same that it’s on the parent page without any notification to the user. This could be quite confusing in some cases.

As you mentioned, removing that line would cause the template change to be visible in both views (creating and editing page). On previous versions of PW (not sure which versions exactly) the id of the element containing the template change was named differently thus causing the element only on the edit page to be hidden. Which was good. :)

Now on the new versions of PW the element containing the template change when creating a new page is renamed exactly the same for some reason and the adminbar, well, doesn’t behave the same way as usual anymore.

Creating and editing pages directly from the PW admin side of course works very well and doesn’t cause similar issues, but that’s not always the use case considering that site administrators may use both adminbar and the normal PW admin side.

Link to comment
Share on other sites

Anssi, didn't know that it used to work different (showing template select when it's allowed). Like I said, I pretty much always have only one template allowed for children.

Do you know is there some quick fix that would be backwards compatible?

Link to comment
Share on other sites

  • 2 weeks later...

Hi Apeisa,

Can't remember if I mentioned this before... Adminbar has a bug now in PW 2.5. If you're editing a page in the admin in a modal window (i.e. a PageTable field or ListerPro set to use modal), when the page is saved the user is redirected to the front end of the page they just edited rather than back to the admin screen.

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Teppo, I read both, but finding time to actually respond and react is another story. Going through exciting, but busy times both home and work.

I'll get back to you at GitHub. Looks good, only thinking about using conditional autoload. We do have that now, wouldn't it be as simple as defining template!=admin in module info?

Link to comment
Share on other sites

Antti: that'd be great, but would that mean dropping compatibility with < 2.3.1? Or is conditional autoload backwards compatible? Should we care about that? :)

As a sidenote, perhaps, this would also make Inputfield::render hook useless (it's mostly useful when template is admin), though I'm not entirely sure at what point Admin started handling the 'modal' GET param properly either. Perhaps it's no longer an issue in 2.3.1.

.. oh, and didn't mean to rush you, by the way! Just wasn't sure about the best way to point this out :)

Link to comment
Share on other sites

I'm not aware of any 100% safe way to break module backwards compatibility without risking some older sites having issues. Tagging and adding a note about it here and at the modules directory is an option, of course, and another option would be creating a new branch for 2.3+ and leaving master as-is.

Options, options..

Support for specifying where to find a version of a module suitable to specific ProcessWire version could be nice addition to the modules directory and/or native modules manager, but that won't help us much here. Sounds like a wishlist item to me :)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Howdy,

Just tried this module and it works great, but when used with some other markup manipulator module like TemplateEngineFactory which also hooks into Page::render, hook priority could be handy.

As TempalteEngineFactory, like any view engine should output first, before any other manipulator hits the ground. I looked into it and since PageRender::renderPage() runs prior 110, TemplateEngineFactory, cannot TemplateEngineFactory run lower than that, or else its overrided by original PageRender. Also if AdminBars is installed, it's natural load order becomes before TemplateEngineFactory, so it gets rendered before actual output and is never visible.

Therefore i suggest that either core priority level for PageRender::renderPage() is lowered or AdminBar::pageRender() is rised in order to get around this "problem".

Before:

$this->addHookAfter('Page::render', $this, "pageRender");

After:

$this->addHookAfter('Page::render', $this, "pageRender", array('priority'=>1000));

This is only reasonable solution i came around with.

Nice module btw, good job. 

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Hi,

Just tried this module with pw 2.5.3. I'm also using bootstrap-framework as a base for my theme and I found out that bootstrap has modal-class defined which make a pretty mess with adminbar.

I changed:

adminbar.module

line 181: $modalClass = 'modal'; --> $modalClass = 'ab-modal';

adminbar.js

line 10: var $modalLinks = $adminbar.find('a.modal'); --> var $modalLinks = $adminbar.find('a.ab-modal');

That fixed the mess. I don't know is it a good idea but maybe it would be wise to change that class to ab-modal so it won't interference with common css/js frameworks.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Hi all. Just came to processwire form modx. Think it was good choice. This is just the entrance word.))

I made simple shop for my client and wanted to add admin bar, but noticed that if template using bootstrap 3 so admin bar not working

(it's lookes like screenshot that i attached.) Please help or may be someone already met this error(bug)

Thanks a lot!

post-3359-0-47436100-1431257608_thumb.pn

Link to comment
Share on other sites

Adminbar needs to have its classes prefixed to prevent some conflicts with other libraries. I posted about it here:

https://github.com/apeisa/AdminBar/issues/12

I would also recommend using teppo's fork:

https://github.com/teppokoivula/AdminBar

It takes care of several issues with newer versions of PW, although I don't think it includes the class fixes.

Link to comment
Share on other sites

  • 3 years later...

Just in case, you love the module as much as i do ... and you think it looks a bit old fashioned.
I did a little styling update (just the css and a few fether svg icons):

screenshot.thumb.png.34ef896619a0a66ce82cd4f8d0b43eb3.png

To use it just put the attached files to site\modules\AdminBar

@Apeisa: You may apply this to the original module if you like!

 

 

 

AdminBar.zip

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...