joomla module only working when logged in as a registered user - joomla

I am using a joomla sp accordian module for displaying a set of articles on a page. However, the accordian effect only shows up when I am logged in as a registered user. It does not show the accordian effect when I am logged out. I have set all of the access levels to public.
What am i doing wrong here?

I'll take a punt on this being either:
a) some sort of cache issue (Joomla not browser)
b) a javascript error
For (a) turn off all caching - global config and system pluginand retest.
For (b) check mootools is loading. Check the browser's error console for .js errors.
If the tabs module/plugin loads jquery check for noConflict mode - and also that only one instance of jQuery's .js file loads.

Related

Forcing a logoff from a Joomla admin session

In Joomla! 3.6, we're trying to force a user to the login screen from the admin section if their session has expired, but without any user input. By default, Joomla! will send people to the login screen if they attempt to load a page after their session has expired. This is something we want automated so if someone walks away and forgets to lock their system, the current page(s) can't be accessed if the session times out.
My initial attempt around this was to run a timed JS loop in administrator\index.php and have it make an AJAX call to an external PHP file that could query the session table. However, including jQuery at such a high level causes many other references to break due to it being included more than once. Due to how the default redirect action works, all this really needs to do is force a page refresh.
Is there a better way or location to do this without breaking existing code?
This required two things to fix.
1) Add
// jQuery needed by template.js
JHtml::_('jquery.framework');
2) Change $.ajax to jQuery.ajax

jQuery mobile - after browser refresh page totally messed up

I'm developping a jqm application with spring mobile in the back-end.
Whenever I hit the browser refresh button on my mobile phone the page is completely devastated afterwards. Browsers back-button works properly.
The data are still available due prg pattern (flashAttributes in Spring) after refresh. Only the view is malformed.
Any ideas how to solve this problem?
From jQuery Mobile docs :
The simplest approach when building a jQuery Mobile site is to reference the same set of stylesheets and scripts in the head of every page. If you need to load in specific scripts or styles for a particular page, we recommend binding logic to the pageinit event (details below) to run necessary code when a specific page is created (which can be determined by its id attribute, or a number of other ways). Following this approach will ensure that the code executes if the page is loaded directly or is pulled in and shown via Ajax
So what happens is - in jQuery Mobile, the scripts and styles defined in the head are loaded only once. So, in normal conditions, it works fine, as all the pages will use the scripts loaded from the first page.
But. When you refresh a page in-between, it triggers a page-reload instead of the ajax navigation model thatjqm uses. So all the scripts and styles loaded from the first page will not be included from here on out.
What you need to do is "reference the same set of stylesheets and scripts in the head of every page", so that even if you hit refresh in the middle, the scripts and styles that had been loaded from the head of the first page are loaded again.
I recommend you read the docs from the above link fully to gain a better understanding.

Is event handler code "persistent" after disabling JS?

I noticed something interesting while testing the client side validation on a website that used jquery document.ready event.
If I loaded the login page with js disabled its noscript tag redirects the user to a different page informing that the js support wasn't enabled on the browser.
If I loaded the login page with js enabled, and then proceed to disable it, the code attached on its document.ready event was still running and validated perfectly the empty inputs in its login and password fields.
Since I didn't see the page requesting to the server to perform such validation I wonder if its correct to assume that the fact that js was initially enabled was enough for the document.ready to run and attach the code permanently no matter how I toggle the js support afterwards? or Maybe I missed something?.
Thanks for the insight you all can give me.
"Disable javascript" would actually be closer to reality if called "Disable js from now on". Everything that was executed before disabling, well, was executed. Everything that would have happened after the disabling (such as timeouts, intervals, etc), is no longer executed.
Browsers still run JS on currently opened pages even after you disable JS in your settings. Any new pages loaded while JS is disabled will have their scripts disabled.
It's like the browser only checks that setting only on page load:
Load page -> is scipts on? -> yes -> run //changing it anywhere after
-> no -> do not run //does not affect it's status

Alfresco share page state history

How can I manage page state history in share (surf?) so that I remember for example which yui tab was active and on which page the pager was on?
I noticed that alfresco share does something like that after form submit. You get redirected to the exact same page url where you were before. If any "ajax state" (don't know what they are called) parameters are in url like #something=asdf you get the same url.
But when using manual navigation like moving through site pages those parameters aren't saved.
Is this even a good idea to do? To save page state in session for example?
Some pages have support for URL parameters that are passed in. In those cases the browser history is used, e.g. we editing metadata in the full page meta data view the user is send back to the page he is coming from. This is done in javascript by calling window.history.go(-1) after form submit but only works when parameters are set/retrieved by URL. The document library implements page specific javascript for setting the URL and parsing parameters from it.
I some places Alfresco uses the preference service to store user settings between different pages permanently. For example this is used in the document library for the "show folders" and "simple/thumbnail view" buttons. Here is some sample code from the document library javascript setting a preference option:
var PREFERENCES_DOCLIST = "org.alfresco.share.documentList",
PREF_SHOW_FOLDERS = PREFERENCES_DOCLIST + ".showFolders";
var preferences = new Alfresco.service.Preferences();
this.services.preferences.set(PREF_SHOW_FOLDERS, true);
The evaluation of the properties is usually done in the Share component webscripts, you can have a look in share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\include\documentlist.lib.js for an example.
In any case you have to dig into Alfresco's javascript code in the browser and the share tier to see how to implement it.
You could check parameters sended to the server side after form submiting in the firebug (firefox plugin) and then you could use the same parameters.
Also perhaps you should use yui history manager:

How can I make cucumber with capybara and selenium fire Ajax on page load

I have the following as a cucumber story:
#javascript
Scenario: Showing the page
Given I am a logged in user
And there is a member with a site
And I go to the home page
.....
When that home page is loaded, there is a drop down that is populated via AJAX on page, in the selenium run browser test the
$(document).ready(function(){})
is not run and as such a drop down select that I need to use is not present. Is there any way that I can force Selenium to fire a javascript event for page load via a step maybe
When the page is loaded information about members is retrieved via AJAX
or something like that. I need that dropdown box, but due to some Action Caching in other parts of the application that use the navigation drop downs but should only sometimes have this extra drop down I load them in after with javascript, I can't really change that.
Any Ideas?
EDIT:
It turns out I had set up some test data wrong and that was failing a condition for it, so it seems that as usual the library is fine and I made a mistake, so it seems this will be fine.

Resources