View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
11808Feature requestsTheme editorpublic2018-10-15 07:52
ReporterDenisChenu Assigned To 
PrioritynoneSeverityfeature 
Status closedResolutionreopened 
Summary11808: Fix template when update and when import
Description

In https://bugs.limesurvey.org/view.php?id=11797 : 2 pstpl file was included.
We can easily copy it from default when update (DB update) or import template.

Tagsanswers_html
Bug heat4
Story point estimate
Users affected %

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2016-10-18 23:47

developer   ~41454

Alternative : fix it only when edit BUT : protect file access

DenisChenu

DenisChenu

2016-10-19 09:56

developer   ~41457

Idea :

  1. create a views/survey/pstpl/ directory with this 2 news pstpl file.
  2. add a function to pstplContents(file.pstpl) : git it from template, and if not found : in the view directory

After we can fix/update this funtion, move to a lib or an helper more easily (for parent-template system).

DenisChenu

DenisChenu

2016-10-19 09:57

developer   ~41458

Just a feedback on the last idea, because it's a lot related to the next evolution (parent template / child template) where we need a function to call the final pstpl file

DenisChenu

DenisChenu

2016-10-19 10:07

developer   ~41459

Last edited: 2016-10-19 10:09

Quick summary:

  1. Fix when update or import : seems OK, update the DB number, get it from default (or a cleanest one with less part)
  2. Add a 'API version" number to the template configuration : Add a function to get the good file when use file_get_content
  3. Test (each time we call the new function) if pstpl file exist, use a default one if not found

1: fixed for update / import
2: Fixed for update / import AND FTP
3: Fixed for update / import AND FTP

But 2 and 3 are really linked with future feature, and take a littlme PHP script time (better with 2, 2rd take a lot more time (test file exist)
Another idea ?

LouisGac

LouisGac

2016-10-19 10:28

developer   ~41465

This is only for retro-compatibility with 2.5 right?
I'm not sure it's necessary: if you upload a 2.5 template, the HTML being different, they will be probably broken for many reasons, not only the missing pstpl files.

DenisChenu

DenisChenu

2016-10-19 10:33

developer   ~41469

Yes : but seeing a 'broken css' is different to seeing a white page.

Maybe : when load template configuration : if the template is not valid : return it to default ?

I do something in 2.06 to move to default if template don't exist (when you rename a template via FTP) : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/Template.php#L67

Think we can use same system and fix it here ?

DenisChenu

DenisChenu

2016-10-19 10:34

developer   ~41470

Last edited: 2016-10-19 10:35

Just here in fact : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/Template.php#L77

And : we can log it as error for admin user.

LouisGac

LouisGac

2016-10-19 10:38

developer   ~41472

"but seeing a 'broken css' is different to seeing a white page."
Yep: that's true.

I'd say that the template configuration model is the right place to do it. Example for the XML file:
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/TemplateConfiguration.php#L98-L114

DenisChenu

DenisChenu

2016-10-19 10:43

developer   ~41473

Yes : add a condition here : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/TemplateConfiguration.php#L85

DenisChenu

DenisChenu

2016-10-19 10:44

developer   ~41474

In fact : replace condition

LouisGac

LouisGac

2016-10-19 10:48

developer   ~41475

https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/TemplateConfiguration.php#L95-L96

It would be easy to do:

$this->hasNewPstpl = (string) is_file($this->path.DIRECTORY_SEPARATOR.'form.pstpl');

if (!$this->hasNewPstpl){....}

DenisChenu

DenisChenu

2016-10-19 10:54

developer   ~41476

Yes , but here : you want fix template when loading config

Then maybe : a function

if (!$this->hasPstpl(filename)){
// Add default filename.pstpl
}

DenisChenu

DenisChenu

2016-11-10 20:13

developer   ~41838

Fix committed to develop branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=21329

DenisChenu

DenisChenu

2016-11-10 20:15

developer   ~41839

Done and tested with old 2.50 default template

DenisChenu

DenisChenu

2017-07-19 11:25

developer   ~44107

Must be tested now, and surely refix it (or not).

DenisChenu

DenisChenu

2018-10-15 07:52

developer   ~49321

Won't fix …

Related Changesets

LimeSurvey: develop 1888b37c

2016-11-10 20:10:26

DenisChenu

Details Diff
New feature 11808: add template apiVersion and fix old template
Dev: Start with api version 3 : follow LS version.
Dev: fix template according to API : for old : add needed pstpl file
Dev: add survey +fontawesome to template package (and add it if api < 3)
Dev: Todo : add an alert / log for admin user
Affected Issues
11808
mod - application/helpers/common_helper.php Diff File
mod - application/models/TemplateConfiguration.php Diff File
mod - application/views/layouts/public.php Diff File
mod - templates/default/config.xml Diff File
mod - templates/minimal-config.xml Diff File

LimeSurvey: develop 3de1ed7f

2016-11-11 13:08:52

DenisChenu

Details Diff
Dev: 11808 : show warning for survey manager when using a 'old' template
Dev: API is an integer (3 actually)
Dev: move apiVersion to private : don't think a plugin must be allowed to update it ?
Affected Issues
11808
mod - application/config/version.php Diff File
mod - application/controllers/admin/surveyadmin.php Diff File
mod - application/controllers/admin/templates.php Diff File
mod - application/models/TemplateConfiguration.php Diff File
mod - application/views/admin/survey/surveySummary_view.php Diff File
mod - application/views/admin/templates/templateeditorbar_view.php Diff File

Issue History

Date Modified Username Field Change
2016-10-18 01:48 DenisChenu New Issue
2016-10-18 01:48 DenisChenu Status new => assigned
2016-10-18 01:48 DenisChenu Assigned To => DenisChenu
2016-10-18 01:48 DenisChenu Product Version => 3.0
2016-10-18 02:04 DenisChenu Tag Attached: answers_html
2016-10-18 23:47 DenisChenu Note Added: 41454
2016-10-19 09:56 DenisChenu Note Added: 41457
2016-10-19 09:57 DenisChenu Assigned To DenisChenu => LouisGac
2016-10-19 09:57 DenisChenu Status assigned => feedback
2016-10-19 09:57 DenisChenu Note Added: 41458
2016-10-19 09:57 DenisChenu Assigned To LouisGac => DenisChenu
2016-10-19 10:07 DenisChenu Note Added: 41459
2016-10-19 10:09 DenisChenu Note Edited: 41459
2016-10-19 10:28 LouisGac Note Added: 41465
2016-10-19 10:33 DenisChenu Note Added: 41469
2016-10-19 10:34 DenisChenu Note Added: 41470
2016-10-19 10:35 DenisChenu Note Edited: 41470
2016-10-19 10:38 LouisGac Note Added: 41472
2016-10-19 10:43 DenisChenu Note Added: 41473
2016-10-19 10:44 DenisChenu Note Added: 41474
2016-10-19 10:44 DenisChenu Status feedback => assigned
2016-10-19 10:48 LouisGac Note Added: 41475
2016-10-19 10:54 DenisChenu Note Added: 41476
2016-11-10 20:13 DenisChenu Changeset attached => LimeSurvey develop 1888b37c
2016-11-10 20:13 DenisChenu Note Added: 41838
2016-11-10 20:13 DenisChenu Resolution open => fixed
2016-11-10 20:15 DenisChenu Status assigned => resolved
2016-11-10 20:15 DenisChenu Fixed in Version => 3.0
2016-11-10 20:15 DenisChenu Note Added: 41839
2016-11-11 13:11 DenisChenu Changeset attached => LimeSurvey develop 3de1ed7f
2017-07-19 11:25 DenisChenu Assigned To DenisChenu =>
2017-07-19 11:25 DenisChenu Status resolved => feedback
2017-07-19 11:25 DenisChenu Resolution fixed => reopened
2017-07-19 11:25 DenisChenu Note Added: 44107
2017-07-19 11:26 DenisChenu Assigned To => DenisChenu
2017-07-19 11:26 DenisChenu Status feedback => new
2017-07-19 11:26 DenisChenu Assigned To DenisChenu =>
2018-10-15 07:52 DenisChenu Status new => closed
2018-10-15 07:52 DenisChenu Note Added: 49321