Skip to content

Commit

Permalink
Merge branch '2.05' of https://github.com/LimeSurvey/LimeSurvey.git i…
Browse files Browse the repository at this point in the history
…nto 2.05
  • Loading branch information
mennodekker committed Aug 23, 2013
2 parents 56a0285 + 6f73ed7 commit 1dd270b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
11 changes: 10 additions & 1 deletion application/config/third_party.php
Expand Up @@ -48,7 +48,7 @@
//'css/smoothness/jquery-ui-1.10.0.custom.min.css'
),
'depends' => array(
'jquery'
'jquery',
)
),
'jquery-cookie' => array(
Expand Down Expand Up @@ -170,4 +170,13 @@
'jquery'
)
),
'jquery-touch-punch' => array(
'baseUrl' => 'third_party/jquery-touch-punch/',
'js' => array(
'jquery.ui.touch-punch.min.js'
),
'depends' => array(
'jqueryui'
)
)
);
18 changes: 18 additions & 0 deletions application/controllers/admin/export.php
Expand Up @@ -1274,6 +1274,16 @@ private function _surveyexport($action, $iSurveyID)
echo surveyGetXMLData($iSurveyID);
exit;
}
elseif ($action == "exportstructurejson")
{
$fn = "limesurvey_survey_{$iSurveyID}.json";
$this->_addHeaders($fn, "application/json", "Mon, 26 Jul 1997 05:00:00 GMT");
$surveyInXmlFormat = surveyGetXMLData($iSurveyID);
// now convert this xml into json format and then return
echo _xmlToJson($surveyInXmlFormat);
exit;
}

elseif ( $action == "exportstructurequexml" )
{
if ( isset($surveyprintlang) && ! empty($surveyprintlang) )
Expand Down Expand Up @@ -1341,6 +1351,14 @@ private function _addHeaders($filename, $content_type, $expires, $pragma = "publ
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: {$pragma}"); // HTTP/1.0
}

private function _xmlToJson($fileContents) {
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
$fileContents = trim(str_replace('"', "'", $fileContents));
$simpleXml = simplexml_load_string($fileContents,'SimpleXMLElement', LIBXML_NOCDATA);
$json = json_encode($simpleXml);
return $json;
}

/**
* Renders template(s) wrapped in header and footer
Expand Down
9 changes: 3 additions & 6 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -3250,14 +3250,12 @@ protected function getQuartile($quartile, $fieldname, $surveyid, $sql, $excludez
$sid = $surveyid;
$recordCount = 0;
$field = null; // Reset cache

//we just put the total number of records at the beginning of this array
$recordCount = Yii::app()->db->createCommand("SELECT COUNT(".Yii::app()->db->quoteColumnName($fieldname).")" .$query)->queryScalar();
}

if ($fieldname !== $field) {
$field = $fieldname;
$allRows = Yii::app()->db->createCommand("SELECT ".Yii::app()->db->quoteColumnName($fieldname) . $query . ' ORDER BY ' . Yii::app()->db->quoteColumnName($fieldname))->queryAll();
$recordCount = Yii::app()->db->createCommand("SELECT COUNT(".Yii::app()->db->quoteColumnName($fieldname).")" .$query)->queryScalar(); // Record count for THIS $fieldname
}

// Qx = (x/4) * (n+1) if not integer, interpolate
Expand Down Expand Up @@ -3288,10 +3286,9 @@ protected function getQuartile($quartile, $fieldname, $surveyid, $sql, $excludez
} else {
$diff = ($q1 - (int) $q1);
return $allRows[$row][$fieldname] + $diff * ($allRows[$row+1][$fieldname]-$allRows[$row][$fieldname]);
}
}
}



/**
* Returns a simple list of values in a particular column, that meet the requirements of the SQL
*/
Expand Down
1 change: 1 addition & 0 deletions application/helpers/replacements_helper.php
Expand Up @@ -157,6 +157,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
{

App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."survey_runtime.js");
App()->getClientScript()->registerScriptFile($templateurl . 'template.js',CClientScript::POS_END);
useFirebug();
Expand Down
5 changes: 2 additions & 3 deletions docs/release_notes.txt
Expand Up @@ -15,11 +15,10 @@ HOW TO INSTALL
This release does have the following requirements:

*MySQL 4.1.0 or later OR Microsoft SQL Server 2005 or later OR Postgres 8.1 or later
*PHP 5.1.6 or later with the following modules/libraries enabled:
*PHP 5.3.0 or later with the following modules/libraries enabled:
*mbstring (Multibyte String Functions) extension library (see also Installation FAQ(external link))
*PDO database driver for MySQL (pdo_mysql or pdo_mysqli) or Postgres (pdo_pgsql) or MSSQL (pdo_sqlsrv)
*For PHP versions <5.2 you will need to have the PECL JSON library( see http://pecl.php.net/package/json(external link)) installed


If you are doing a complete new installation please refer to the manual at
http://docs.limesurvey.org/Installation

Expand Down
11 changes: 11 additions & 0 deletions third_party/jquery-touch-punch/jquery.ui.touch-punch.min.js
@@ -0,0 +1,11 @@
/*
* jQuery UI Touch Punch 0.2.2
*
* Copyright 2011, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);

0 comments on commit 1dd270b

Please sign in to comment.