View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
05835Bug reportsStatisticspublic2012-03-15 01:32
ReporterResearchOnBlogs Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.91+ 
Fixed in Version1.92+ 
Summary05835: offer possibility to use JS in statistics_user.php
Description

It would be useful to use jQuery in the template file statistics_user.php.

I order to that, I wrote some lines in offer this possibility. Hope you could put this into core.

TagsNo tags attached.
Attached Files
js_insert_to_user_statistics.php (1,693 bytes)   
//Create header (fixes bug #3097)
$templatedir = sGetTemplatePath($surveyinfo["template"]); // do we need this to get the path? 
$surveylanguage = $language;
sendcacheheaders();
if ( !$embedded )
{
    $header=  "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
    . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"".$surveylanguage."\" lang=\"".$surveylanguage."\"";
    if (getLanguageRTL($surveylanguage))
    {
        $header.=" dir=\"rtl\" ";
    }
    $header.= ">\n\t<head>\n";
    $header.= "<title>$sitename</title>\n";
    $header.= "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n";
    $header.= "<link href=\"".$thisSurveyCssPath."/template.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
    
    // NEW part - 
    
    if(file_exists($templatedir ."/statistics_user_template.js")){
      $header.= statistic_user_js_insert($surveyinfo, $thisSurveyCssPath);
    }
    
    $header.= "</head>\n<body>\n";

    echo $header;
}
else
{
    if ( function_exists( $embedded_headerfunc ) )
        echo $embedded_headerfunc();
}

/*
 * If you need to modify the public statistic via js, 
 * insert a "statistics_user_template.js" - file in your template folder
 * by KRAV
 * 
 * creates js insert for page header
 */
function statistic_user_js_insert($surveyinfo, $thisSurveyCssPath){
  global $rooturl;
       
  $js_insert =  '<script type="text/javascript" src=\"".$rooturl."/scripts/jquery/jquery.js\"></script>';
  
  $js_insert .= '<script type="text/javascript" src="'. $thisSurveyCssPath .'/statistics_user_template.js"></script>';
 
  return $js_insert;
}
Bug heat8
Complete LimeSurvey version number (& build)12416
I will donate to the project if issue is resolvedNo
Browser
Database type & version?
Server OS (if known)?
Webserver software & version (if known)?
PHP Version?

Users monitoring this issue

Mazi

Activities

Mazi

Mazi

2012-02-22 14:32

updater   ~17540

Can you please explain to us what you intend to achieve by putting JS into this file? What can this be used for?
Please also explain what your code does in detail.
Thanks!

ResearchOnBlogs

ResearchOnBlogs

2012-02-22 14:42

developer   ~17543

With this feature you have the possibility to work with JS on the public statistics page and do everything you would do with jQuery. I used it, for theming and replacing strings (insertans..).

The code checks, if there is a "statistics_user_template.js" in your template folder and if it's there, the file and jquery will be included

Mazi

Mazi

2012-02-22 15:58

updater   ~17560

Carsten, what do you think?

c_schmitz

c_schmitz

2012-03-12 17:40

administrator   ~17894

I think the the standard template.js should be included and jQuery along with it.

Related Changesets

LimeSurvey: master 1a83827b

2012-03-12 09:42:47

c_schmitz

Details Diff
Fixed issue 05835: Standard survey header is not used in public statistics Affected Issues
05835
mod - common_functions.php Diff File
mod - group.php Diff File
mod - statistics_user.php Diff File

Issue History

Date Modified Username Field Change
2012-02-20 15:51 ResearchOnBlogs New Issue
2012-02-20 15:51 ResearchOnBlogs File Added: js_insert_to_user_statistics.php
2012-02-22 14:32 Mazi Note Added: 17540
2012-02-22 14:32 Mazi Assigned To => tpartner
2012-02-22 14:32 Mazi Status new => feedback
2012-02-22 14:42 ResearchOnBlogs Note Added: 17543
2012-02-22 14:42 ResearchOnBlogs Status feedback => assigned
2012-02-22 15:57 Mazi Issue Monitored: Mazi
2012-02-22 15:57 Mazi Assigned To tpartner => c_schmitz
2012-02-22 15:58 Mazi Note Added: 17560
2012-03-12 17:40 c_schmitz Note Added: 17894
2012-03-12 17:44 c_schmitz Status assigned => resolved
2012-03-12 17:44 c_schmitz Fixed in Version => 1.92+
2012-03-12 17:44 c_schmitz Resolution open => fixed
2012-03-14 18:14 c_schmitz Changeset attached => Import 2012-03-09 13:30:34 master 1a83827b
2012-03-15 01:32 c_schmitz Status resolved => closed
2021-08-03 11:48 guest Bug heat 6 => 8