Trouble with jquery ui datepicker

Permalink
I am having an issue with the datepicker only working when I am logged in to concrete5. As soon as I sign out of con5, my datepicker functionality vanishes. I'm assuming this is caused by the controller.php calling in the jquery elements to the header, but don't know where to call this in order for it to work correctly. Any help would be much appreciated

 
snax replied on at Permalink Reply
Okay, just talking to myself here. I figured out what was going on. I was calling the jquery ui elements(css, js, etc.) from within concrete directory, which was the reason for the datepicker only functioning while logged in. I took the relative paths(ie: "/concrete/js/jquery.ui.js" and linked them in my header, and voila! it now works without fail... Hope this helps someone else.
mrnoisy replied on at Permalink Reply
mrnoisy
Thanks for the tip - I'd been trying to figure this out for ages.

Solution: added the following to my header.php element include.

<link rel="stylesheet" type="text/css" href="/concrete/css/jquery.ui.css?v=a0de349d30956e16eee012031a397d89" />
<link rel="stylesheet" type="text/css" href="/concrete/css/ccm.calendar.css?v=a0de349d30956e16eee012031a397d89" />
Mnkras replied on at Permalink Reply
Mnkras
guys, just so you know, loading it twice can cause problems, if you want the correct way, have the block include it, or copy
/concrete/elements/header_required.php to /elements and make the minor changes there (its pretty obvious when you look at the file)
rockface replied on at Permalink Reply
rockface
I know this is an old thread but I have a solution to this problem.

The issue appears the c5 designers have chosen which script libraries to skip when no one is logged in. If i had to guess why...

1. Complex data entry is reserved for when a user is logged in
2. or maybe its just to reduce on load time.

Either why the solution is pretty simple...

public function on_page_view() {
   $html = Loader::helper('html');
   //Required for DatePicker (when not logged in)
   $this->addHeaderItem($html->css("jquery.ui.css"));
   $this->addHeaderItem($html->javascript("jquery.ui.js"));
   //Required for $('#x').dialog.open() (when not logged in)
   $this->addHeaderItem($html->css("ccm.app.css"));
   $this->addFooterItem($html->javascript("ccm.app.js"));
}


The official C5 documentation is silent on this dependency:
http://www.concrete5.org/documentation/developers/helpers/date-and-...


Hope this helps!
CommotionCreative replied on at Permalink Reply
CommotionCreative
Hello Where would you put this for a single page, the pages controller?

Kind Regards
cjramki replied on at Permalink Reply
cjramki
You can use it in your controller of which single page you used date-picker.

But it is not working...