Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: How bypass php zip import to add resources ?

How bypass php zip import to add resources ? 3 years 7 months ago #89864

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
My problem i very simple : I really need to add a date-time question to a survey like described [url=http://http://docs.limesurvey.org/tiki-index.php?page=Workarounds%3A+Manipulating+a+survey+at+runtime+using+Javascript&structure=English+Instructions+for+LimeSurvey#Time_question_Date_question-like_]here[/url] but i'm facing some difficulties :
1. My server is not up to date for running a version 2 of limesurvey. Instead, i'm using 1.92 one.
2. My server does not permit php zip import and I can not enable it to import necessary resources.

So, is there any other way to add resources ?

Any advice welcome !
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89865

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
Hello,
The 'time picker' addon requieres only one javascript file and few lines of css...
You can try to copy & paste all the jquery-ui-timepicker-addon.js content into the template.js file of your template using LS template editor... Same same for the css rules...

(I suppose you can't transfer any files via ftp using a software like Filezilla...?)
Ben/
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.
The following user(s) said Thank You: mfaber

How bypass php zip import to add resources ? 3 years 7 months ago #89866

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
Hello,

Thanks for your answer. I can transfer files with ftp (i already use filezilla).

I tried to upload the file many times in different places (directly in upload folder, created a folder with the survey id - survey number or to the root of my website) and changed path into the script given in workarounds page... But didn't managed to make it worked.

What you said make me think that maybe there's another problem.

I'll try tomorrow to edit template.js
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89884

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
Sometimes, I wonder if i'm not stupid...

At first time I did not edit css to strictly follow the workaround. After your answer I try to edit it and I continue to work with the js file without editing template.js

If i try to preview the question, I get a simply short text question but no time picker. I put an extract of source code of the html page below. The path to the addon is the good one.

I don't know how to call for a time picker question mask after editing template.js
<div id="question34" class="text-short mandatory">
<table class="question-wrapper">
	<tr>
		<td class="questiontext">
		<span class="asterisk">* </span><span class="qnumcode"> 
</span>Heure de départ
<script src="/upload/surveys/33913/jquery-ui-timepicker-addon.js"></script><script>
$(document).ready(function(){
 
$('#answer33913X4X34').timepicker({
	timeText: 'Time', //here translation
	hourText: 'hour', //here translation
	minuteText: 'minute', //here translation
	closeText: 'Done' //here translation
});
 
$('#answer33913X4X34').attr('readonly', 'readonly');
 
$( "<style>"
+".ui-widget-header, .ui-datepicker-current { display:none; }"
+".ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }"
+".ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }"
+" }"
+"</style>").appendTo( "head" );
 
});
Last Edit: 3 years 7 months ago by hug. Reason: mise en page
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89963

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
Ok I think that the problem is due to an updated jquery-ui-timepicker-addon.js file...

The good news is that I've saved the old one (attached and here) because idid the test when the 1st post about this topic was published
/!\ Warn: I'm using a numerical question type not short-text question
=> There is no SGA code to adapt with this syntax (...thanks to Tony !)

your code:
Heure de départ:
<script src="/upload/surveys/33913/jquery-ui-timepicker-addon.js"></script>
<script>
$(document).ready(function(){
 
$(".numeric:eq(0) input.text").timepicker({
	timeText: 'Time',
	hourText: 'hour',
	minuteText: 'minute',
	closeText: 'Done'
});
 
$(".numeric:eq(0) input.text").attr('readonly', 'readonly');
 
$( "<style>"
+".ui-widget-header, .ui-datepicker-current { display:none; }"
+".ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }"
+".ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }"
+" }"
+"</style>").appendTo( "head" );
 
});
</script>


File Attachment:

File Name: jquery-ui-...n.js.zip
File Size:13 KB
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
Last Edit: 3 years 7 months ago by Ben_V.
The administrator has disabled public write access.
The following user(s) said Thank You: hug

How bypass php zip import to add resources ? 3 years 7 months ago #89969

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
One more time, thanks very much for your answer.

Now, my code is very similar as the one you sent and the js timepicker is the older version. I may miss something, but it is still the same thing : I can enter any numerical input but no timepicker appears.

Of course I made un echo test to see if I really could execute js script and it worked.

I don't understand what I am doing wrong, but I think I'll give up.
<div id="question34" class="numeric mandatory">
	<table class="question-wrapper">
		<tr>
		<td class="questiontext">
		<span class="asterisk">* </span>
<span class="qnumcode">  </span>
 
Heure de départ :
<script src="/upload/surveys/33913/jquery-ui-timepicker-addon.js"></script><script>
$(document).ready(function(){
 
$(".numeric:eq(0) input.text").timepicker({
	timeText: 'Time',
	hourText: 'hour',
	minuteText: 'minute',
	closeText: 'Done'
});
 
$(".numeric:eq(0) input.text").attr('readonly', 'readonly');
 
$( "<style>"
+".ui-widget-header, .ui-datepicker-current { display:none; }"
+".ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }"
+".ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }"
+" }"
+"</style>").appendTo( "head" );
 
});
</script>
Last Edit: 3 years 7 months ago by hug.
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89970

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
Screenshot few time ago:

I attach the export of the time picker question working in my installation (1.92)
(the only thing you've to adapt is the path to plugin .js file)

File Attachment:

File Name: limesurvey...1434.lsq
File Size:4 KB
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89974

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6134
  • Thank you received: 1363
  • Karma: 535
hug, as Ben says, his code is for a numerical question type. If you are using a short text question, change this:
$(".numeric:eq(0) input.text").timepicker({

To this:
$(".text-short:eq(0) input.text").timepicker({

(assuming you are applying it to the first short text on the page)
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89998

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
Yes I took care to change question type from text to numeric.

I tried to create a new test survey with the question file given by Ben and I added an alert to test activation of javascript.

I didn't change the original question source but moved my js file to /scripts/jquery

The error at the bottom of the page is returned by the alert test question

If you want to take a look to hte result :
cdlvg.free.fr/index.php?sid=28183&lang=en
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #89999

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6134
  • Thank you received: 1363
  • Karma: 535
That link works for me:

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #90002

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
Yes it's works... I've seen the end of your tunnel !
(Faut jamais abandonner pour un bout de code... ;) )
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #90011

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
???? Are you telling me that I'm trying to make working something that does work already ????

I wonder if i am not becoming mad...

... But in a certain way, it makes sense to me : I tested a survey which were non active and the css depend on which template is used, but I made a copy of the original one to change it for timepicker and don't understand why this css is not used for testing. Below is a print screen of what i got from testing.

Now, I'm feeling quite ridiculous...

Thank you very much and sorry for disturbing

The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #90012

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
Check your inbox &/or LS results...
I've submitted your working nicely survey... :)
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #90015

  • hug
  • hug's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 16
  • Thank you received: 1
  • Karma: 0
Yes, I'll see what I can do... But removing the read only attribute does not seems to work very well (like for the test survey is still the same).

Anyway this thing is driving me mad !!!

Here is the TRUE survey... and just the first time question work !

cdlvg.free.fr/index.php?sid=33913&lang=fr
The administrator has disabled public write access.

How bypass php zip import to add resources ? 3 years 7 months ago #90017

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1798
  • Thank you received: 440
  • Karma: 110
It's normal that only the first question is working...

It's due to the syntax*:
$(".numeric:eq(0) input.text").timepicker({

You should in this case use the old one with SGA code (at least for 2nd time question)
$('#answer33913X4X34').timepicker({


*Cf. TPartner's note
(assuming you are applying it to the first short text on the page)
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
Last Edit: 3 years 7 months ago by Ben_V.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.276 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form