Jump to content

Recommended Posts

Hi apeisa,

We are just using the URLs tab on the relevant templates to redirect to https. How would you set it up so that logged in users are always https? That seems like it would be a good solution.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

I think there might be some kind of quick fix for this, but “I’ll be back” with the details later this week.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Antti, I'm not sure which one you read more often, so posting here too: could you take a look at issue #11? This is a potential fix for "modal admin issues", but I'd love to hear your views on it.. does it make sense, etc. :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

Maybe tagging current commit with pw 2.3 tag and update master with 2.4 and up compatible. No idea how world takes it (modules directory, current sites etc).

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By bernhard
      --- Please use RockFinder3 ---
    • By MoritzLost
      Cacheable Placeholders
      This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there.  Consider this simple example, where you want to output a custom greeting to the current user:
      <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale.
      This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this:
      <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook:
      // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github!
      Features
      A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links
      Github Repository & documentation Module directory (pending approval) If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!
    • By Craig
      I've been using Fathom Analytics for a while now and on a growing number of sites, so thought it was about time there was a PW module for it.
      WayFathomAnalytics
      WayFathomAnalytics is a group of modules which will allow you to view your Fathom Analytics dashboard in the PW admin panel and (optionally) automatically add and configure the tracking code on front-end pages.
      Links
      GitHub Readme & documentation Download Zip Modules directory Module settings screenshot What is Fathom Analytics?
      Fathom Analytics is a simple, privacy-focused website analytics tool for bloggers and businesses.

      Stop scrolling through pages of reports and collecting gobs of personal data about your visitors, both of which you probably don't need. Fathom is a simple and private website analytics platform that lets you focus on what's important: your business.
      Privacy focused Fast-loading dashboards, all data is on a single screen Easy to get what you need, no training required Unlimited email reports Private or public dashboard sharing Cookie notices not required (it doesn't use cookies or collect personal data) Displays: top content, top referrers, top goals and more
    • By daniels
      This is a lightweight alternative to other newsletter & newsletter-subscription modules.
      You can find the Module in the Modules directory and on Github
      It can subscribe, update, unsubscribe & delete a user in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin.
      This module fits your needs if you...
      ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe, update, unsubscribe or delete users to/from different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns *I have only tested it with PHP 7.x so far, so use on owners risk
      EDIT:
      Since 0.0.4, instructions and changelog can be found in the README only. You can find it here  🙂
      If you have questions or like to contribute, just post a reply or create an issue or pr on github, thanks!
    • By MoritzLost
      Sorry for the convoluted title. I have a problem with Process modules that define a custom page using the page key through getModuleInfo (as demonstrated in this excellent tutorial by @bernhard). Those pages are created automatically when the module is installed. The problem is that the title of the page only gets set in the current language. That's not a problem if the current language (language of the superuser who is installing the module) is the default language; if it isn't, the Process page is missing a title in the default language. This has the very awkward effect that a user using the backend in the default language (or any other language) will see an empty entry in the setup menu:

      This screenshot comes from my Cache Control module which includes a Process page. Now I realize the description sounds obscure, but for us it's a common setup: We a multiple bilingual sites where the default language is German and the second language is English. While the clients use the CMS in German, as a developer I prefer the English interface, so whenever I install a Process module I get this problem.
      As a module author, is there a way to handle this situation? I guess it would be possible to use post-installation hooks or create the pages manually, but I very much prefer the declarative approach. The page title is already translatable (through the __ function), but of course at the time of installation there is no translation, and as far as I'm aware it's not possible to ship translations with a module so they are used automatically. Could this situation be handled better in the core? I would prefer if the module installation process would always set the title of the Process page in the default language, instead of the language of the current user.
×
×
  • Create New...