diff --git a/CHANGELOG b/CHANGELOG index 936b04bd..23b68f92 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,11 +4,11 @@ New Feature: Replace queXS caseid as token with a random token to allow for safe New Feature: Allow for responents to self complete the questionnaire via email invitation New Feature: Allow restricting appointment to just yourself New Feature: Added ability to edit operators -New Featuer: Can delete a queXS questionnaire - +New Feature: Can delete a queXS questionnaire +New Feature: List and enable/disable sample files +New Feature: Deidentify (delete fields) from sample files Fixed Bug: Replaced php short tags with long tags - Database updates: ALTER TABLE `case` ADD `token` VARCHAR( 36 ) NOT NULL ; @@ -36,6 +36,10 @@ ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self ADD `lime_template` VARCHAR( 128 ) NULL COMMENT 'Limesurvey template for respondent self completion' AFTER `lime_mode` , ADD `lime_endurl` VARCHAR( 256 ) NULL COMMENT 'Forwarding end URL for respondent self completion' AFTER `lime_template` ; +Allow for enabling/disabling sample files: + +ALTER TABLE `sample_import` ADD `enabled` TINYINT( 1 ) NOT NULL DEFAULT '1'; + queXS 1.6.1 - Changes since 1.6.0 New Feature: Include paradata/metadata in data output (number call attempts, number of answering machine messages and all sample variables) diff --git a/admin/assignsample.php b/admin/assignsample.php index 895962dd..5967a8e7 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -124,7 +124,8 @@ if ($questionnaire_id != false) $sql = "SELECT si.sample_import_id,si.description FROM sample_import as si LEFT JOIN questionnaire_sample as q ON (q.questionnaire_id = '$questionnaire_id' AND q.sample_import_id = si.sample_import_id) - WHERE q.questionnaire_id is NULL"; + WHERE q.questionnaire_id is NULL + AND si.enabled = 1"; $qs = $db->GetAll($sql); diff --git a/admin/index.php b/admin/index.php index 7d900207..d7de5d1d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -55,6 +55,7 @@ print "
  • " . T_("Administer print "
  • " . T_("Sample/List management") . "

  • "; diff --git a/admin/samplelist.php b/admin/samplelist.php new file mode 100644 index 00000000..890fb0bf --- /dev/null +++ b/admin/samplelist.php @@ -0,0 +1,153 @@ + + * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013 + * @package queXS + * @subpackage admin + * @link http://www.acspri.org.au/software queXS was writen for ACSPRI + * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 + * + */ + +/** + * Configuration file + */ +include_once(dirname(__FILE__).'/../config.inc.php'); + +/** + * Database + */ +include_once(dirname(__FILE__).'/../db.inc.php'); + +/** + * XHTML functions + */ +include_once(dirname(__FILE__).'/../functions/functions.xhtml.php'); + +if (isset($_POST['submit'])) +{ + $sample_import_id = intval($_POST['sample_import_id']); + + unset($_POST['submit']); + unset($_POST['sample_import_id']); + + foreach($_POST as $p) + { + $sql = "DELETE FROM sample_var + WHERE var LIKE " . $db->qstr($p) . " + AND sample_id IN + (SELECT sample_id + FROM sample + WHERE import_id = $sample_import_id)"; + + $db->Execute($sql); + + } + + $_GET['edit'] = $sample_import_id; +} + + +if (isset($_GET['edit'])) +{ + xhtml_head(T_("Deidentify"),true,array("../css/table.css")); + + $sample_import_id = intval($_GET['edit']); + + $sql = "SELECT si.description, sv.val, sv.var, + CONCAT('') as box + FROM sample_import as si, sample_var as sv, sample as s + WHERE si.sample_import_id = $sample_import_id + AND sv.sample_id = s.sample_id + AND s.import_id = si.sample_import_id + GROUP BY sv.var"; + + $rs = $db->GetAll($sql); + + print "

    " . T_("Deidentify") . ": " . $rs[0]['description'] . "

    "; + echo "

    " . T_("Go back") . "

    "; + + print "

    " . T_("Select which fields from this sample to deidentify. Deidentified fields will be permanently deleted from the sample.") . "

    "; + + ?> +
    + +
    +
    "/>
    +
    + Execute($sql); +} + +if (isset($_GET['sampleenable'])) +{ + $id = intval($_GET['sampleenable']); + + $sql = "UPDATE sample_import + SET enabled = 1 + WHERE sample_import_id = '$id'"; + + $db->Execute($sql); +} + + +$sql = "SELECT + CASE WHEN enabled = 0 THEN + CONCAT('" . T_("Enable") . "') + ELSE + CONCAT('" . T_("Disable") . "') + END + as enabledisable, + CONCAT('" . T_("Deidentify") . "') as did, + description + FROM sample_import"; + +$rs = $db->GetAll($sql); + +xhtml_head(T_("Sample list"),true,array("../css/table.css")); + +$columns = array("description","enabledisable","did"); +$titles = array(T_("Sample"),T_("Enable/Disable"),T_("Deidentify")); + +xhtml_table($rs,$columns,$titles); + +xhtml_foot(); +?> diff --git a/database/quexs.sql b/database/quexs.sql index c3049256..86820fc3 100644 --- a/database/quexs.sql +++ b/database/quexs.sql @@ -1600,6 +1600,7 @@ CREATE TABLE `sample_import` ( `description` varchar(255) collate utf8_unicode_ci NOT NULL, `call_restrict` tinyint(1) NOT NULL default '1', `refusal_conversion` tinyint(1) NOT NULL default '1', + `enabled` tinyint(1) NOT NULL default '1', PRIMARY KEY (`sample_import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;