diff --git a/application/controllers/admin/participants.php b/application/controllers/admin/participants.php
index 4b67fe1b4b8..0424b5f2ffa 100644
--- a/application/controllers/admin/participants.php
+++ b/application/controllers/admin/participants.php
@@ -197,6 +197,26 @@ function editShareInfo()
'shared_uid' => $this->input->post('shared_uid'));
$this->participant_shares_model->updateShare($data);
}
+function delParticipant()
+{
+
+ $this->load->model('participants_model');
+ $selectoption = $this->input->post('selectedoption');
+ $participant_id = $this->input->post('participant_id');
+ if($selectoption=="po")
+ {
+ $this->participants_model->deleteParticipant($participant_id);
+ }
+ elseif($selectoption=="ptt")
+ {
+ $this->participants_model->deleteParticipantToken($participant_id);
+ }
+ else
+ {
+ $this->participants_model->deleteParticipantTokenAnswer($participant_id);
+ }
+
+}
/*
* This function is resposible for editing data on the jqGrid
*/
@@ -224,7 +244,6 @@ function editParticipant()
}
if($operation == 'edit')
{
-
$data = array(
'participant_id' => $_POST['id'],
'firstname' => $_POST['firstname'],
@@ -235,10 +254,6 @@ function editParticipant()
'owner_uid' => $oid);
$this->participants_model->updateRow($data);
}
- elseif($operation == 'del')
- {
- $this->participants_model->deleteRow($_POST);
- }
elseif($operation == 'add')
{
$uuid = $this->gen_uuid();
@@ -954,8 +969,7 @@ function attributeMapCSV()
$errorinupload = array('error' => $this->upload->display_errors());
$this->session->unset_userdata('summary');
$data = array( 'errorinupload' => $errorinupload);
-
- $this->session->set_userdata('summary',$data);
+ $this->session->set_userdata('summary',$data);
self::_getAdminHeader();
$clang = $this->limesurvey_lang;
$data = array('clang'=> $clang);
@@ -1459,6 +1473,61 @@ function attributeMapToken()
$this->load->view('admin/Participants/attributeMapToken_view',$data);
self::_getAdminFooter("http://docs.limesurvey.org", $this->limesurvey_lang->gT("LimeSurvey online manual"));
}
-
+function isValidGuid($guid)
+{
+ return (!empty($guid) && preg_match('/^\{?[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}\}?$/', $guid));
+}
+function blacklistParticipant()
+ {
+ $this->load->model('participants_model');
+ $participant_id = $this->uri->segment(4);
+ $survey_id = $this->uri->segment(5);
+ $clang = $this->limesurvey_lang;
+ if(!is_numeric($survey_id))
+ {
+ $blacklist = $this->uri->segment(5);
+ if($blacklist=='Y' || $blacklist =='N')
+ {
+ $data = array('blacklisted' => $blacklist,'participant_id' => $participant_id );
+ $result = $this->participants_model->blacklistparticipantglobal($data);
+ $result['global'] = 1;
+ $result['clang'] = $clang;
+ $result['blacklist'] = $blacklist;
+ $this->load->view('admin/Participants/blacklist_view',$result);
+ }
+ else
+ {
+ $result['is_participant']=0;
+ $result['is_updated']=0;
+ $result['clang'] = $clang;
+ $this->load->view('admin/Participants/blacklist_view',$result);
+ }
+ }
+ else
+ {
+ $blacklist = $this->uri->segment(6);
+ if( $blacklist=='Y' || $blacklist =='N')
+ {
+ $data = array('blacklisted' => $blacklist);
+ $result = $this->participants_model->blacklistparticipantlocal($data,$survey_id,$participant_id);$result['global'] = 1;
+ $result['clang'] = $clang;
+ $result['local'] = 1;
+ $result['blacklist'] = $blacklist;
+ $this->load->view('admin/Participants/blacklist_view',$result);
+
+ }
+ else
+ {
+ $result['is_participant']=0;
+ $result['is_updated']=0;
+ $result['clang'] = $clang;
+ $this->load->view('admin/Participants/blacklist_view',$result);
+
+ }
+
+ }
+
+
+ }
}
?>
diff --git a/application/controllers/admin/tokens.php b/application/controllers/admin/tokens.php
index ad084b93e62..a4b3989a60f 100644
--- a/application/controllers/admin/tokens.php
+++ b/application/controllers/admin/tokens.php
@@ -748,6 +748,7 @@ function email($surveyid,$tokenids=null)
$attributes=GetTokenFieldsAndNames($surveyid);
$tokenoutput="";
+
if ($emcount > 0)
{
foreach ($emresult->result_array() as $emrow)
@@ -789,6 +790,7 @@ function email($surveyid,$tokenids=null)
}
else
{
+ echo "dfsA";
$fieldsarray["{OPTOUTURL}"]="".htmlspecialchars("$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}")." ";
if ( $modrewrite )
{
diff --git a/application/controllers/admin/user.php b/application/controllers/admin/user.php
index b2d4884382b..f5dff698c79 100644
--- a/application/controllers/admin/user.php
+++ b/application/controllers/admin/user.php
@@ -60,7 +60,7 @@ function editusers()
//$uresult = db_execute_assoc($uquery); //Checked
$uresult = $this->users_model->getSomeRecords(array("users_name"),array("uid"=>$usrhimself['parent_id']));
$srow = $uresult->row_array();
- //$usersummary .= "
+
+
+
+
+
+
+gT("You have successfully blacklisted from any survey on this server");
+ }
+ else if($blacklist == 'N')
+ {
+ echo $clang->gT("You have successfully un-blacklisted from any survey on this server");
+ }
+ }
+ else if($is_participant)
+ {
+ if($blacklist == 'Y')
+ {
+ echo $clang->gT("You have already been blacklisted from any survey on this server");
+ }
+ else if($blacklist == 'N')
+ {
+ echo $clang->gT("You have already been un-blacklisted from any survey on this server");
+ }
+
+ }
+ else if(!$is_survey)
+ {
+ echo $clang->gT("Survey is no longer active");
+ }
+ else
+ {
+ echo $clang->gT("The URL you are trying to use is either modified, or you have been removed from this server");
+ }
+
+}
+else if($local == 1)
+{
+ if($is_participant && $is_updated)
+ {
+ if($blacklist == 'Y')
+ {
+ echo $clang->gT("You have successfully blacklisted from this survey");
+ }
+ else if($blacklist == 'N')
+ {
+ echo $clang->gT("You have successfully un-blacklisted from this survey");
+ }
+ }
+ else if($is_participant)
+ {
+ if($blacklist == 'Y')
+ {
+ echo $clang->gT("You have already been blacklisted from this survey");
+ }
+ else if($blacklist == 'N')
+ {
+ echo $clang->gT("You have already been un-blacklisted from this survey");
+ }
+
+ }
+ else
+ {
+ echo $clang->gT("The URL you are trying to use is either modified, or you have been removed from this server");
+
+ }
+
+}
+else
+{
+ echo $clang->gT("You have successfully blacklisted from this survey");
+}
+?>
+
+
+
+
diff --git a/application/views/admin/Participants/displayParticipants_view.php b/application/views/admin/Participants/displayParticipants_view.php
index f4549c3fb39..cb1c7475d7a 100644
--- a/application/views/admin/Participants/displayParticipants_view.php
+++ b/application/views/admin/Participants/displayParticipants_view.php
@@ -1,7 +1,6 @@
" />
- " />
" />
" />
" />
@@ -16,6 +15,7 @@
+
gT("Next") ?>";
var error = "gT("Error") ?>";
var exportcsv = "gT("Export CSV") ?>";
+var nooptionselected = "gT("Please choose either of the options") ?>";
var removecondition = "gT("Remove Condition") ?>";
var selectSurvey = "gT("Please select a survey to add participants to"); ?>";
var cancelBtn = "gT("Cancel") ?>";
var exportBtn = "gT("Export") ?>";
var okBtn = "gT("OK") ?>";
+var deleteMsg = "Delete Participant from central table only Delete Participant from central table and token table Delete Participant from central table, token table and from results as well ";
var searchBtn = "gT("Search") ?>";
var shareMsg = "gT("You can see and edit settings for shared participant in share panel.") ?>"; //PLEASE REVIEW
var jsonUrl = "";
@@ -91,6 +93,7 @@
var editUrl = "";
var minusbutton = "";
var addbutton = "";
+var delparticipantUrl = "";
var surveylinkUrl = "";
var getAttribute_json = "";
var exporttocsv = "";
@@ -257,6 +260,5 @@
?>
-
diff --git a/application/views/admin/Super/adminmenu.php b/application/views/admin/Super/adminmenu.php
index 8bc6a96f150..61e56f2756b 100644
--- a/application/views/admin/Super/adminmenu.php
+++ b/application/views/admin/Super/adminmenu.php
@@ -1,3 +1,4 @@
+
diff --git a/installer/sql/create-mssql.sql b/installer/sql/create-mssql.sql
index 76f1f286e2e..54e60f8f71b 100644
--- a/installer/sql/create-mssql.sql
+++ b/installer/sql/create-mssql.sql
@@ -382,6 +382,7 @@ CREATE TABLE [prefix_users] (
[email] VARCHAR(320) NOT NULL UNIQUE,
[create_survey] TINYINT NOT NULL default '0',
[create_user] TINYINT NOT NULL default '0',
+ [participant_panel] TINYINT NOT NULL default '0',
[delete_user] TINYINT NOT NULL default '0',
[superadmin] TINYINT NOT NULL default '0',
[configurator] TINYINT NOT NULL default '0',
@@ -404,8 +405,74 @@ CREATE TABLE [prefix_templates_rights] (
[use] int NOT NULL,
PRIMARY KEY ([uid],[folder])
);
-
-
+--
+-- Table structure for table participants
+--
+CREATE TABLE [prefix_participants] (
+ [participant_id] varchar(50) NOT NULL,
+ [firstname] varchar(40) NOT NULL,
+ [lastname] varchar(40) NOT NULL,
+ [email] varchar(80) NOT NULL,
+ [language] varchar(2) NOT NULL,
+ [blacklisted] varchar(1) NOT NULL,
+ [owner_uid] int(20) NOT NULL,
+ PRIMARY KEY ([participant_id])
+);
+--
+-- Table structure for table participant attribute
+--
+CREATE TABLE [prefix_participant_attribute] (
+ [participant_id] varchar(50) NOT NULL,
+ [attribute_id] int(11) NOT NULL,
+ [value] varchar(50) NOT NULL,
+ PRIMARY KEY ([participant_id],[attribute_id])
+);
+--
+-- Table structure for table participant attribute names
+--
+CREATE TABLE [prefix_participant_attribute_names] (
+ [attribute_id] int(11) NOT NULL AUTO_INCREMENT,
+ [attribute_type] varchar(4) NOT NULL,
+ [visible] char(5) NOT NULL,
+ PRIMARY KEY ([attribute_id],[attribute_type])
+);
+--
+-- Table structure for table participant attribute names lang
+--
+CREATE TABLE [prefix_participant_attribute_names_lang] (
+ [id] int(11) NOT NULL AUTO_INCREMENT,
+ [attribute_id] int(11) NOT NULL,
+ [attribute_name] varchar(30) NOT NULL,
+ [lang] varchar(4) NOT NULL,
+ PRIMARY KEY ([attribute_id],[attribute_type])
+);
+--
+-- Table structure for table participant attribute values
+--
+CREATE TABLE [prefix_participant_attribute_values] (
+ [attribute_id] int(11) NOT NULL,
+ [value_id] int(11) NOT NULL AUTO_INCREMENT,
+ [value] varchar(20) NOT NULL,
+ PRIMARY KEY ([attribute_id],[value_id])
+);
+--
+-- Table structure for table participant shares
+--
+CREATE TABLE [prefix_participant_shares] (
+ [participant_id] varchar(50) NOT NULL,
+ [share_uid] int(11) NOT NULL,
+ [date_added] datetime,
+ [can_edit] text NOT NULL
+);
+--
+-- Table structure for table survey links
+--
+CREATE TABLE [prefix_survey_links] (
+ [participant_id] varchar(50) NOT NULL,
+ [token_id] int(11) NOT NULL,
+ [survey_id] int(11) NOT NULL,
+ [date_created] datetime
+);
--
-- Table structure for table templates
--
@@ -447,11 +514,11 @@ create index [parent_qid_idx] on [prefix_questions] ([parent_qid]);
--
-- Version Info
--
-INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '147');
+INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '148');
INSERT INTO [prefix_settings_global] VALUES ('SessionName', '$sessionname');
--
-- Create admin user
--
-INSERT INTO [prefix_users] ([users_name], [password], [full_name], [parent_id], [lang] ,[email], [create_survey], [create_user] ,[delete_user] ,[superadmin] ,[configurator] ,[manage_template] , [manage_label]) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1);
+INSERT INTO [prefix_users] ([users_name], [password], [full_name], [parent_id], [lang] ,[email], [participant_panel], [create_survey], [create_user] ,[delete_user] ,[superadmin] ,[configurator] ,[manage_template] , [manage_label]) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1,1);
diff --git a/installer/sql/create-mssqlnative.sql b/installer/sql/create-mssqlnative.sql
index cc1b6c083d4..6a0f56857d2 100644
--- a/installer/sql/create-mssqlnative.sql
+++ b/installer/sql/create-mssqlnative.sql
@@ -392,6 +392,7 @@ CREATE TABLE [prefix_users] (
[email] VARCHAR(320) NOT NULL UNIQUE,
[create_survey] TINYINT NOT NULL default '0',
[create_user] TINYINT NOT NULL default '0',
+ [participant_panel] TINYINT NOT NULL default '0',
[delete_user] TINYINT NOT NULL default '0',
[superadmin] TINYINT NOT NULL default '0',
[configurator] TINYINT NOT NULL default '0',
@@ -415,6 +416,75 @@ CREATE TABLE [prefix_templates_rights] (
PRIMARY KEY ([uid],[folder])
);
+--
+-- Table structure for table participants
+--
+CREATE TABLE [prefix_participants] (
+ [participant_id] varchar(50) NOT NULL,
+ [firstname] varchar(40) NOT NULL,
+ [lastname] varchar(40) NOT NULL,
+ [email] varchar(80) NOT NULL,
+ [language] varchar(2) NOT NULL,
+ [blacklisted] varchar(80) NOT NULL,
+ [owner_uid] int(20) NOT NULL,
+ PRIMARY KEY ([participant_id])
+ );
+--
+-- Table structure for table participant attribute
+--
+CREATE TABLE [prefix_participant_attribute] (
+ [participant_id] varchar(50) NOT NULL,
+ [attribute_id] int(11) NOT NULL,
+ [value] varchar(50) NOT NULL,
+ PRIMARY KEY ([participant_id],[attribute_id])
+ );
+--
+-- Table structure for table participant attribute names
+--
+CREATE TABLE [prefix_participant_attribute_names] (
+ [attribute_id] int(11) NOT NULL AUTO_INCREMENT,
+ [attribute_type] varchar(30) NOT NULL,
+ [visible] char(5) NOT NULL,
+ PRIMARY KEY ([attribute_id],[attribute_type])
+ );
+--
+-- Table structure for table participant attribute names lang
+--
+CREATE TABLE [prefix_participant_attribute_names_lang] (
+ [id] int(11) NOT NULL AUTO_INCREMENT,
+ [attribute_id] int(11) NOT NULL,
+ [attribute_name] varchar(30) NOT NULL,
+ [lang] varchar(4) NOT NULL,
+ PRIMARY KEY ([attribute_id],[lang])
+ );
+--
+-- Table structure for table participant attribute values
+--
+CREATE TABLE [prefix_participant_attribute_values] (
+ [attribute_id] int(11) NOT NULL,
+ [value_id] int(11) NOT NULL AUTO_INCREMENT,
+ [value] varchar(20) NOT NULL,
+ PRIMARY KEY ([attribute_id],[value_id])
+ );
+--
+-- Table structure for table participant shares
+--
+CREATE TABLE [prefix_participant_shares] (
+ [participant_id] varchar(50) NOT NULL,
+ [shared_uid] int(11) NOT NULL,
+ [date_added] datetime,
+ [can_edit] varchar(5) NOT NULL
+ );
+--
+-- Table structure for table survey links
+--
+CREATE TABLE [prefix_survey_links] (
+ [participant_id] varchar(50) NOT NULL,
+ [token_id] int(11) NOT NULL,
+ [survey_id] int(11) NOT NULL,
+ [date_created] datetime
+ );
+
--
-- Table structure for table templates
@@ -459,11 +529,11 @@ create index [parent_qid_idx] on [prefix_questions] ([parent_qid]);
--
-- Version Info
--
-INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '147');
+INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '148');
INSERT INTO [prefix_settings_global] VALUES ('SessionName', '$sessionname');
--
-- Create admin user
--
-INSERT INTO [prefix_users] ([users_name], [password], [full_name], [parent_id], [lang] ,[email], [create_survey], [create_user] ,[delete_user] ,[superadmin] ,[configurator] ,[manage_template] , [manage_label]) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1);
+INSERT INTO [prefix_users] ([users_name], [password], [full_name], [parent_id], [lang] ,[email], [create_survey], [participant_panel], [create_user] ,[delete_user] ,[superadmin] ,[configurator] ,[manage_template] , [manage_label]) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1,1);
diff --git a/installer/sql/create-mysql.sql b/installer/sql/create-mysql.sql
index f279c13a6a1..96a99d16cbf 100644
--- a/installer/sql/create-mysql.sql
+++ b/installer/sql/create-mysql.sql
@@ -368,6 +368,7 @@ CREATE TABLE `prefix_users` (
`email` varchar(320),
`create_survey` tinyint(1) NOT NULL default '0',
`create_user` tinyint(1) NOT NULL default '0',
+ `participant_panel` tinyint(1) NOT NULL default '0',
`delete_user` tinyint(1) NOT NULL default '0',
`superadmin` tinyint(1) NOT NULL default '0',
`configurator` tinyint(1) NOT NULL default '0',
@@ -390,8 +391,75 @@ CREATE TABLE `prefix_templates_rights` (
`use` int(1) NOT NULL,
PRIMARY KEY (`uid`,`folder`)
) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-
-
+--
+-- Table structure for table participants
+--
+CREATE TABLE `prefix_participants` (
+ `participant_id` varchar(50) NOT NULL,
+ `firstname` varchar(40) NOT NULL,
+ `lastname` varchar(40) NOT NULL,
+ `email` varchar(80) NOT NULL,
+ `language` varchar(2) NOT NULL,
+ `blacklisted` varchar(1) NOT NULL,
+ `owner_uid` int(20) NOT NULL,
+ PRIMARY KEY (`participant_id`)
+) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table participant_attribute
+--
+CREATE TABLE `prefix_participant_attribute` (
+ `participant_id` varchar(50) NOT NULL,
+ `attribute_id` int(11) NOT NULL,
+ `value` varchar(50) NOT NULL,
+ PRIMARY KEY (`participant_id`,`attribute_id`)
+) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table participant_attribute_names_lang
+--
+CREATE TABLE `prefix_participant_attribute_names_lang` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `attribute_id` int(11) NOT NULL,
+ `attribute_name` varchar(30) NOT NULL,
+ `lang` varchar(4) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table participant_attribute_names
+--
+CREATE TABLE `prefix_participant_attribute_names` (
+ `attribute_id` int(11) NOT NULL AUTO_INCREMENT,
+ `attribute_type` varchar(4) NOT NULL,
+ `visible` char(5) NOT NULL,
+ PRIMARY KEY (`attribute_id`)
+) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table participant_attribute_names_values
+--
+CREATE TABLE `prefix_participant_attribute_values` (
+ `attribute_id` int(11) NOT NULL,
+ `value_id` int(11) NOT NULL AUTO_INCREMENT,
+ `value` varchar(20) NOT NULL,
+ PRIMARY KEY (`value_id`,`attribute_id`)
+) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table participant_shares
+--
+CREATE TABLE `prefix_participant_shares` (
+ `participant_id` varchar(50) NOT NULL,
+ `share_uid` int(11) NOT NULL,
+ `date_added` datetime NOT NULL,
+ `can_edit` varchar(5) NOT NULL
+ ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+--
+-- Table structure for table survey_links
+--
+CREATE TABLE `prefix_survey_links` (
+ `participant_id` varchar(50) NOT NULL,
+ `token_id` int(11) NOT NULL,
+ `survey_id` int(11) NOT NULL,
+ `datecreated` datetime NOT NULL,
+ PRIMARY KEY (`participant_id`,`token_id`,`survey_id`)
+ ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;
--
-- Table structure for table templates
--
@@ -434,12 +502,12 @@ create index `parent_qid_idx` on `prefix_questions` (`parent_qid`);
--
-- Version Info
--
-INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '147');
+INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '148');
INSERT INTO `prefix_settings_global` VALUES ('SessionName', '$sessionname');
--
-- Create admin user
--
-INSERT INTO `prefix_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang` ,`email`, `create_survey`,`create_user` ,`delete_user` ,`superadmin` ,`configurator` ,`manage_template` , `manage_label`) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1);
+INSERT INTO `prefix_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang` ,`email`, `create_survey`, `participant_panel`,`create_user` ,`delete_user` ,`superadmin` ,`configurator` ,`manage_template` , `manage_label`) VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail', 1,1,1,1,1,1,1,1);
diff --git a/installer/sql/create-postgres.sql b/installer/sql/create-postgres.sql
index 81f69efdedb..73259a3f528 100644
--- a/installer/sql/create-postgres.sql
+++ b/installer/sql/create-postgres.sql
@@ -394,6 +394,7 @@ CREATE TABLE prefix_users (
email character varying(320) NOT NULL,
create_survey integer DEFAULT 0 NOT NULL,
create_user integer DEFAULT 0 NOT NULL,
+ participant_panel integer DEFAULT 0 NOT NULL,
delete_user integer DEFAULT 0 NOT NULL,
superadmin integer DEFAULT 0 NOT NULL,
configurator integer DEFAULT 0 NOT NULL,
@@ -416,6 +417,76 @@ CREATE TABLE prefix_templates_rights (
"use" integer NOT NULL
);
+--
+-- Table structure for table participants
+--
+CREATE TABLE prefix_participants (
+ "participant_id" VARCHAR( 50 ) NOT NULL,
+ "firstname" VARCHAR( 40 ) NOT NULL,
+ "lastname" VARCHAR( 40 ) NOT NULL,
+ "email" VARCHAR( 80 ) NOT NULL,
+ "language" VARCHAR( 2 ) NOT NULL,
+ "blacklisted" VARCHAR( 1 ) NOT NULL,
+ "owner_uid" integer NOT NULL,
+ PRIMARY KEY (participant_id)
+);
+--
+-- Table structure for table participant_attribute
+--
+CREATE TABLE prefix_participant_attribute (
+ "participant_id" VARCHAR( 50 ) NOT NULL,
+ "attribute_id" integer NOT NULL,
+ "value" integer NOT NULL,
+ PRIMARY KEY (participant_id,attribute_id)
+);
+--
+-- Table structure for table participant_attribute_names
+--
+CREATE TABLE prefix_participant_attribute_names (
+ "attribute_id" integer NOT NULL AUTO_INCREMENT,
+ "attribute_type" VARCHAR( 30 ) NOT NULL,
+ "visible" CHAR( 5 ) NOT NULL,
+ PRIMARY KEY (attribute_type,attribute_id)
+);
+--
+-- Table structure for table participant_attribute_lang
+--
+CREATE TABLE prefix_participant_attribute_names_lang (
+ "id" integer NOT NULL AUTO_INCREMENT,
+ "attribute_id" integer NOT NULL,
+ "attribute_name" VARCHAR( 30 ) NOT NULL,
+ "lang" CHAR( 5 ) NOT NULL,
+ PRIMARY KEY (lang,attribute_id)
+);
+--
+-- Table structure for table participant_attribute_values
+--
+CREATE TABLE prefix_participant_attribute_values (
+ "attribute_id" integer NOT NULL,
+ "value_id" integer NOT NULL AUTO_INCREMENT,
+ "value" VARCHAR( 20 ) NOT NULL,
+ PRIMARY KEY (attribute_id,value_id)
+);
+--
+-- Table structure for table participant_shares
+--
+CREATE TABLE prefix_participant_shares (
+ "participant_id" VARCHAR( 50 ) NOT NULL,
+ "shared_uid" integer NOT NULL,
+ "date_added" date NOT NULL,
+ "can_edit" VARCHAR( 5 ) NOT NULL
+);
+--
+-- Table structure for table participant_attribute_values
+--
+CREATE TABLE prefix_survey_links (
+ "participant_id" VARCHAR( 50 ) NOT NULL,
+ "token_id" integer NOT NULL,
+ "survey_id" integer NOT NULL,
+ "date_created" date NOT NULL,
+ PRIMARY KEY (participant_id,token_id,survey_id)
+);
+
ALTER TABLE ONLY prefix_templates_rights ADD CONSTRAINT prefix_templates_rights_pkey PRIMARY KEY ("uid","folder");
@@ -459,7 +530,7 @@ create index parent_qid_idx on prefix_questions (parent_qid);
--
-- Version Info
--
-INSERT INTO prefix_settings_global VALUES ('DBVersion', '147');
+INSERT INTO prefix_settings_global VALUES ('DBVersion', '148');
INSERT INTO prefix_settings_global VALUES ('SessionName', '$sessionname');
@@ -469,6 +540,6 @@ INSERT INTO prefix_settings_global VALUES ('SessionName', '$sessionname');
INSERT INTO prefix_users(
users_name, "password", full_name, parent_id, lang, email,
- create_survey, create_user, delete_user, superadmin, configurator,
+ create_survey, create_user, participant_panel, delete_user, superadmin, configurator,
manage_template, manage_label,htmleditormode)
- VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail',1,1,1,1,1,1,1,'default');
+ VALUES ('$defaultuser', '$defaultpass', '$siteadminname', 0, '$defaultlang', '$siteadminemail',1,1,1,1,1,1,1,1,'default');
diff --git a/scripts/admin/displayParticipant.js b/scripts/admin/displayParticipant.js
index 73bd2d80093..8bbf2c34815 100644
--- a/scripts/admin/displayParticipant.js
+++ b/scripts/admin/displayParticipant.js
@@ -1,451 +1,464 @@
-var idexternal=parseInt(3);
-function addcondition()
-{id=2;
- html = "
\n\
- AND OR ";
- html2 = "
First Name Last Name \n\
- E-Main Blacklisted Language Owner ID\n\
- Owner Name "+optionstring+"\n\
- Equals Contains \n\
- Not Equal Not Contains Greater Than \n\
- Less Than \n\ \n\
- \n\
- ";
- //$('#searchtable > tbody > tr').eq(id).after(html);
- $('#searchtable > tbody > tr').eq(idexternal).after(html);
- idexternal++;
- $('#searchtable > tbody > tr').eq(idexternal).after(html2);
- idexternal++;
-}
-$(document).ready(function() {
-// Code for AJAX download
-jQuery.download = function(url, data, method){
- //url and data options required
- if( url && data ){
- //data can be string of parameters or array/object
- data = typeof data == 'string' ? data : jQuery.param(data);
- //split params into form inputs
- var inputs = '';
- jQuery.each(data.split('&'), function(){
- var pair = this.split('=');
- inputs+='
';
- });
- //send request
- jQuery('
')
- .appendTo('body').submit().remove();
- };
-};
-// Code for AJAX download
-var id=1;
-$("#addbutton").click(function(){
-id=2;
-html = "
AND OR \n\
-First Name \n\
-Last Name \n\
-E-Main \n\
-Blacklisted \n\
-Language \n\
-Owner ID \n\
-Owner Name "+optionstring+"\n\ \n\ \n\\n\\n\
-Equals \n\
-Contains \n\
-Not Equal \n\
-Not Contains \n\
-Greater Than \n\
-Less Than \n\
- \n\ \n\
- \n\
-";
-$('#searchtable tr:last').after(html);
-});
-var searchconditions = {};
-var field;
-$('#searchbutton').click(function(){
-
-});
-var lastSel,lastSel2;
-jQuery("#displayparticipants").jqGrid({
-align:"center",
-url: jsonUrl,
-editurl: editUrl,
-datatype: "json",
-mtype: "post",
-colNames : jQuery.parseJSON(colNames),
-colModel: jQuery.parseJSON(colModels),
-height: "100%",
-width: "100%",
-rowNum: 50,
-editable:true,
-scrollOffset:0,
-autowidth: true,
-sortable : true,
-sortname: 'firstname',
-sortorder: 'acs',
-viewrecords : true,
-rowList: [25,50,100,250,500,1000,5000,10000],
-multiselect: true,
-loadonce:true,
-ondblClickRow: function(id)
- {
- var can_edit = $('#displayparticipants').getCell(id, 'can_edit');
- if(can_edit == 'false')
- {
- var dialog_buttons={};
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );
- };
- /* End of building array for button functions */
- $('#notauthorised').dialog({
- modal: true,
- title: "Access Denied",
- buttons: dialog_buttons
- });
- }
- else
- {
- {
- if(id && id!==lastSel)
- {
- jQuery('#displayparticipants').saveRow(lastSel);
- lastSel=id;
- }
- }
- jQuery('#displayparticipants').editRow(id,true);
- }
- },
- pager: "#pager",
- caption: "Participants",
- subGrid: true,
- subGridRowExpanded: function(subgrid_id,row_id) {
- subgrid_table_id = subgrid_id+"_t";
- pager_id = "p_"+subgrid_table_id;
- second_subgrid_table_id = subgrid_id+"_tt"; //new name for table selector –> tt
- second_pager_id = "p_"+second_subgrid_table_id;
- $("#"+subgrid_id).html("
");
- $("#"+subgrid_id).append("
");
- jQuery("#"+second_subgrid_table_id).jqGrid({
- datatype: "json",
- url: surveylinkUrl+'/'+row_id,
- height: "100%",
- width: "100%",
- colNames:['Survey Name','Survey ID','Token ID','Date Added'],
- colModel:[{name:'surveyname',index:'surveyname', width:100,align:'center'},
- {name:'surveyid',index:'surveyid', width:90,align:'center'},
- {name:'tokenid',index:'tokenid', width:100,align:'center'},
- {name:'dateadded',index:'added', width:120,align:'center'}],
- caption: "Participant's Survey Information",
- gridComplete: function () {
-
- var recs = $("#"+second_subgrid_table_id).jqGrid('getGridParam','reccount');
- if (recs == 0 || recs == null) {
- //$("#"+second_subgrid_table_id).setGridHeight(40);
- $("#hide_"+second_subgrid_table_id).hide();
- //$("#NoRecordContact").show();
- }
- }
- });
- jQuery("#"+subgrid_table_id).jqGrid({
- url: getAttribute_json+'/'+row_id,
- editurl:editAttributevalue,
- datatype: "json",
- mtype: "post",
- pgbuttons:false,
- recordtext:'',
- pgtext:'',
- caption: "Participant's Attribute Information",
- editable:true,
- colNames: ['Actions','Participant ID','Attribute Type','Attribute Name','Attribute Value', 'Attribute Active for participant','Attribute Possible Values'],
- colModel: [ {name:'act',index:'act',width:55,align:'center',sortable:false,formatter:'actions',formatoptions : {keys:true,onEdit:function(id){ }}},
- {name:'participant_id',index:'participant_id', width:150, sorttype:"string",align:"center",editable:true,hidden:true},
- {name:'atttype',index:'atttype', width:150, sorttype:"string",align:"center",editable:true,hidden:true},
- {name:'attname',index:'attname', width:150, sorttype:"string",align:"center",editable:false},
- {name:'attvalue',index:'attvalue', width:150, sorttype:"string",align:"center",editable:true},
- {name:'attap',index:'attap', width:150, sorttype:"string",align:"center",hidden:true,editable:true},//attribute active for participan
- {name:'attpvalues',index:'attpvalues', width:150, sorttype:"string",align:"center",editable:true,hidden:true}],
-
- rowNum:20,
- pager: pager_id,
- gridComplete: function () {
- $('div.ui-inline-del').html('');
- $('div.ui-inline-edit').html('');
- },
-
- ondblClickRow: function(id,subgrid_id){
- var parid = id.split('_');
- var participant_id = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'participant_id');
- var can_edit = $('#displayparticipants').getCell(participant_id,'can_edit');
- if(can_edit == 'false')
- {
- var dialog_buttons={};
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );
- };
- /* End of building array for button functions */
- $('#notauthorised').dialog({
- modal: true,
- title: "Access Denied",
- buttons: dialog_buttons
- });
- }
- else
- {
-
- var att_type = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'atttype');
- if(att_type=="DP")
- {
- $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{editoptions:{dataInit:function (elem) {$(elem).datepicker();}}});
- }
- if(att_type=="DD")
- {
- var att_p_values = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'attpvalues');
- $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{edittype:'select',editoptions:{value:":Select One;"+att_p_values}});
- }
- if(att_type=="TB")
- {
- $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{edittype:'text'});
- $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{editoptions:''});
- }
- var attap = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'attap');
-
- if(id && id!==lastSel2)
- {
- jQuery("#displayparticipants_"+parid[0]+"_t").saveRow(lastSel2);
- lastSel2=id;
- }
- $.fn.fmatter.rowactions(id,'displayparticipants_'+parid[0]+'_t','edit',0);
- jQuery("#displayparticipants_"+parid[0]+"_t").jqGrid('editRow',id,true);
- jQuery("#displayparticipants_"+parid[0]+"_t").editRow(id,true);
- }
- },
- height: '100%'});
- }
-
-});
-
-jQuery("#displayparticipants").jqGrid('navGrid','#pager',{add:true,del:true,edit:false,refresh: true,search: true},{},{width : 400},{},{multipleSearch:true, multipleGroup:true});
-$("#displayparticipants").navButtonAdd('#pager',{caption:"",title:"Export to CSV", buttonicon:'exporticon', onClickButton:function(){
- $.post(exporttocsvcount, { searchcondition: jQuery('#displayparticipants').jqGrid('getGridParam', 'url')},
- function(data) {
- titlemsg = data;
-
- var dialog_buttons={};
- dialog_buttons[cancelBtn]=function(){
- $(this).dialog("close");
- };
- dialog_buttons[exportBtn]=function(){
- //$.load(exporttocsv+"/"+$('#attributes').val(),{ } );
- var url = jQuery('#displayparticipants').jqGrid('getGridParam', 'url');
- $.download(exporttocsv+"/"+$('#attributes').val(),'searchcondition='+url );
- $(this).dialog("close");
- };
-
- /* End of building array for button functions */
- $('#exportcsv').dialog({
- modal: true,
- title: titlemsg,
- buttons: dialog_buttons,
- width : 400,
- height : 400,
- open: function(event, ui) {
- $('#attributes').multiselect({noneSelectedText: 'Select Attributes',autoOpen:true}).multiselectfilter();
- }
- });
- });
-}});
-
-$("#displayparticipants").navButtonAdd('#pager',{caption:"",title:"Full Search", buttonicon:'searchicon', onClickButton:function(){
-
- var dialog_buttons={};
- dialog_buttons[searchBtn]=function(){
- searchconditions="";
- var dialog_buttons={};
- if($('#field_1').val() == '')
- {
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );};
- /* End of building array for button functions */
- $('#fieldnotselected').dialog({
- modal: true,
- title: error,
- buttons: dialog_buttons
- });
- }
- else if($('#condition_1').val()=="")
- {
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );};
- /* End of building array for button functions */
- $('#conditionnotselected').dialog({
- modal: true,
- title: error,
- buttons: dialog_buttons
- });
- }
- else
- {
-
- if(id == 1)
- {
- searchconditions = searchconditions + $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
- jQuery("#displayparticipants").jqGrid('setGridParam',{url:jsonSearchUrl+'/'+searchconditions}).trigger("reloadGrid");
- }
- else
- {
- searchconditions = $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
- for( i=2 ; i<=idexternal; i++)
- {
-
- if($('#field_'+i).val())
- {
- searchconditions = searchconditions + "||"+ $('#join_'+(i)).val()+"||"+$('#field_'+i).val()+"||"+$('#condition_'+i).val()+"||"+$('#conditiontext_'+i).val();
- }
- }
- jQuery("#displayparticipants").jqGrid('setGridParam',{url:jsonSearchUrl+'/'+searchconditions}).trigger("reloadGrid");
- }
- $(this).dialog("close");
- }
- };
- dialog_buttons[cancelBtn]=function(){
- $(this).dialog("close");
- };
- /* End of building array for button functions */
- $("#search").dialog({
- height: 300,
- width: 750,
- modal: true,
- title : 'Full Search',
- buttons: dialog_buttons
- });
-
-}});
-
-$.extend(jQuery.jgrid.edit,{closeAfterAdd: true,reloadAfterSubmit: true,closeOnEspace:true});
- //script for sharing of participants
- $("#sharingparticipants").dialog({
- title: spTitle,
- modal: true,
- autoOpen: false,
- height: 200,
- width: 400,
- show: 'blind',
- hide: 'blind'
- });
- function shareParticipants(participant_id) {
- var myGrid = $("#displayparticipants").jqGrid();
- var pid = myGrid .getGridParam('selarrrow');
- $("#shareform").load(shareUrl, {
- participantid:pid,
- shareuser:$("#shareuser").val(),
- can_edit:$('#can_edit').attr('checked')
- }, function(msg){
- $(this).dialog("close");
- alert(msg+"."+shareMsg);
- $(location).attr('href',redUrl);
- });
- }
- //End of Script for sharing
- function addtoSurvey(participant_id,survey_id,redirect) {
- $("#addsurvey").load(postUrl,{
- participantid:participant_id},function(){
- $(location).attr('href',attMapUrl+'/'+survey_id+'/'+redirect);
- });}
-
- $('#share').click(function(){
- var myGrid = $("#displayparticipants").jqGrid();
- var row = myGrid .getGridParam('selarrrow');
- if(row=="") {
- /* build an array containing the various button functions */
- /* Needed because it's the only way to label a button with a variable */
- var dialog_buttons={};
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );
- };
- /* End of building array for button functions */
- $('#norowselected').dialog({
- modal: true,
- buttons: dialog_buttons
- });
- }
- else
- {
- /* build an array containing the various button functions */
- /* Needed because it's the only way to label a button with a variable */
- var dialog_buttons={};
- dialog_buttons[spAddBtn]=function(){
- var row = myGrid .getGridParam('selarrrow');
- shareParticipants(row);};
- dialog_buttons[cancelBtn]=function(){
- $(this).dialog("close");
- };
- /* End of building array for button functions */
- $("#shareform").dialog({
- height: 300,
- width: 350,
- modal: true,
- buttons: dialog_buttons
- });
- }
- if (!($("#shareuser").length > 0)) {
- $('#shareform').html(sfNoUser);
- }
- });
-
- $('#addtosurvey').click(function() {
- var myGrid = $("#displayparticipants").jqGrid();
- var rows = myGrid.getGridParam('selarrrow');
- if(rows=="") {
- /* build an array containing the various button functions */
- /* Needed because it's the only way to label a button with a variable */
- var dialog_buttons={};
- dialog_buttons[okBtn]=function(){
- $( this ).dialog( "close" );
- };
- /* End of building array for button functions */
- $('#norowselected').dialog({
- modal: true,
- buttons: dialog_buttons
- });
- }
-
- else
- {
- var dialog_buttons={};
- dialog_buttons[mapButton]=function(){
- var survey_id=$('#survey_id').val();
- var redirect ="";
-
- if(survey_id=="")
- {
-
- alert(selectSurvey);
- }
- else
- {
- if(jQuery('#redirect').is(":checked"))
- {
- redirect = "redirect";
- }
- else
- {
- redirect = "";
- }
- addtoSurvey(rows,survey_id,redirect);
- }
- };
- dialog_buttons[cancelBtn]=function(){
- $(this).dialog("close");
- };
- /* End of building array containing button functions */
- $("#addsurvey").dialog({
- height: 300,
- width: 400,
- title : addpartTitle,
- modal: true,
- buttons: dialog_buttons});
- }
- if (!($("#survey_id").length > 0)) {
- $('#addsurvey').html(addpartErrorMsg);
-}
-});
+var idexternal=parseInt(3);
+function addcondition()
+{id=2;
+ html = "
\n\
+ AND OR ";
+ html2 = "
First Name Last Name \n\
+ E-Main Blacklisted Language Owner ID\n\
+ Owner Name "+optionstring+"\n\
+ Equals Contains \n\
+ Not Equal Not Contains Greater Than \n\
+ Less Than \n\ \n\
+ \n\
+ ";
+ //$('#searchtable > tbody > tr').eq(id).after(html);
+ $('#searchtable > tbody > tr').eq(idexternal).after(html);
+ idexternal++;
+ $('#searchtable > tbody > tr').eq(idexternal).after(html2);
+ idexternal++;
+}
+$(document).ready(function() {
+// Code for AJAX download
+jQuery.download = function(url, data, method){
+ //url and data options required
+ if( url && data ){
+ //data can be string of parameters or array/object
+ data = typeof data == 'string' ? data : jQuery.param(data);
+ //split params into form inputs
+ var inputs = '';
+ jQuery.each(data.split('&'), function(){
+ var pair = this.split('=');
+ inputs+='
';
+ });
+ //send request
+ jQuery('
')
+ .appendTo('body').submit().remove();
+ };
+};
+// Code for AJAX download
+var id=1;
+$("#addbutton").click(function(){
+id=2;
+html = "
AND OR \n\
+First Name \n\
+Last Name \n\
+E-Main \n\
+Blacklisted \n\
+Language \n\
+Owner ID \n\
+Owner Name "+optionstring+"\n\ \n\ \n\\n\\n\
+Equals \n\
+Contains \n\
+Not Equal \n\
+Not Contains \n\
+Greater Than \n\
+Less Than \n\
+ \n\ \n\
+ \n\
+";
+$('#searchtable tr:last').after(html);
+});
+var searchconditions = {};
+var field;
+$('#searchbutton').click(function(){
+
+});
+var lastSel,lastSel2;
+jQuery("#displayparticipants").jqGrid({
+align:"center",
+url: jsonUrl,
+editurl: editUrl,
+datatype: "json",
+mtype: "post",
+colNames : jQuery.parseJSON(colNames),
+colModel: jQuery.parseJSON(colModels),
+height: "100%",
+width: "100%",
+rowNum: 50,
+editable:true,
+scrollOffset:0,
+autowidth: true,
+sortable : true,
+sortname: 'firstname',
+sortorder: 'acs',
+viewrecords : true,
+rowList: [25,50,100,250,500,1000,5000,10000],
+multiselect: true,
+loadonce:true,
+ondblClickRow: function(id)
+ {
+ var can_edit = $('#displayparticipants').getCell(id, 'can_edit');
+ if(can_edit == 'false')
+ {
+ var dialog_buttons={};
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );
+ };
+ /* End of building array for button functions */
+ $('#notauthorised').dialog({
+ modal: true,
+ title: "Access Denied",
+ buttons: dialog_buttons
+ });
+ }
+ else
+ {
+ {
+ if(id && id!==lastSel)
+ {
+ jQuery('#displayparticipants').saveRow(lastSel);
+ lastSel=id;
+ }
+ }
+ jQuery('#displayparticipants').editRow(id,true);
+ }
+ },
+ pager: "#pager",
+ caption: "Participants",
+ subGrid: true,
+ subGridRowExpanded: function(subgrid_id,row_id) {
+ subgrid_table_id = subgrid_id+"_t";
+ pager_id = "p_"+subgrid_table_id;
+ second_subgrid_table_id = subgrid_id+"_tt"; //new name for table selector –> tt
+ second_pager_id = "p_"+second_subgrid_table_id;
+ $("#"+subgrid_id).html("
");
+ $("#"+subgrid_id).append("
");
+ jQuery("#"+second_subgrid_table_id).jqGrid({
+ datatype: "json",
+ url: surveylinkUrl+'/'+row_id,
+ height: "100%",
+ width: "100%",
+ colNames:['Survey Name','Survey ID','Token ID','Date Added'],
+ colModel:[{name:'surveyname',index:'surveyname', width:100,align:'center'},
+ {name:'surveyid',index:'surveyid', width:90,align:'center'},
+ {name:'tokenid',index:'tokenid', width:100,align:'center'},
+ {name:'dateadded',index:'added', width:120,align:'center'}],
+ caption: "Participant's Survey Information",
+ gridComplete: function () {
+
+ var recs = $("#"+second_subgrid_table_id).jqGrid('getGridParam','reccount');
+ if (recs == 0 || recs == null) {
+ //$("#"+second_subgrid_table_id).setGridHeight(40);
+ $("#hide_"+second_subgrid_table_id).hide();
+ //$("#NoRecordContact").show();
+ }
+ }
+ });
+ jQuery("#"+subgrid_table_id).jqGrid({
+ url: getAttribute_json+'/'+row_id,
+ editurl:editAttributevalue,
+ datatype: "json",
+ mtype: "post",
+ pgbuttons:false,
+ recordtext:'',
+ pgtext:'',
+ caption: "Participant's Attribute Information",
+ editable:true,
+ colNames: ['Actions','Participant ID','Attribute Type','Attribute Name','Attribute Value', 'Attribute Active for participant','Attribute Possible Values'],
+ colModel: [ {name:'act',index:'act',width:55,align:'center',sortable:false,formatter:'actions',formatoptions : {keys:true,onEdit:function(id){ }}},
+ {name:'participant_id',index:'participant_id', width:150, sorttype:"string",align:"center",editable:true,hidden:true},
+ {name:'atttype',index:'atttype', width:150, sorttype:"string",align:"center",editable:true,hidden:true},
+ {name:'attname',index:'attname', width:150, sorttype:"string",align:"center",editable:false},
+ {name:'attvalue',index:'attvalue', width:150, sorttype:"string",align:"center",editable:true},
+ {name:'attap',index:'attap', width:150, sorttype:"string",align:"center",hidden:true,editable:true},//attribute active for participan
+ {name:'attpvalues',index:'attpvalues', width:150, sorttype:"string",align:"center",editable:true,hidden:true}],
+
+ rowNum:20,
+ pager: pager_id,
+ gridComplete: function () {
+ $('div.ui-inline-del').html('');
+ $('div.ui-inline-edit').html('');
+ },
+
+ ondblClickRow: function(id,subgrid_id){
+ var parid = id.split('_');
+ var participant_id = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'participant_id');
+ var can_edit = $('#displayparticipants').getCell(participant_id,'can_edit');
+ if(can_edit == 'false')
+ {
+ var dialog_buttons={};
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );
+ };
+ /* End of building array for button functions */
+ $('#notauthorised').dialog({
+ modal: true,
+ title: "Access Denied",
+ buttons: dialog_buttons
+ });
+ }
+ else
+ {
+
+ var att_type = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'atttype');
+ if(att_type=="DP")
+ {
+ $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{editoptions:{dataInit:function (elem) {$(elem).datepicker();}}});
+ }
+ if(att_type=="DD")
+ {
+ var att_p_values = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'attpvalues');
+ $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{edittype:'select',editoptions:{value:":Select One;"+att_p_values}});
+ }
+ if(att_type=="TB")
+ {
+ $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{edittype:'text'});
+ $("#displayparticipants_"+parid[0]+"_t").setColProp('attvalue',{editoptions:''});
+ }
+ var attap = $("#displayparticipants_"+parid[0]+"_t").getCell(id,'attap');
+
+ if(id && id!==lastSel2)
+ {
+ jQuery("#displayparticipants_"+parid[0]+"_t").saveRow(lastSel2);
+ lastSel2=id;
+ }
+ $.fn.fmatter.rowactions(id,'displayparticipants_'+parid[0]+'_t','edit',0);
+ jQuery("#displayparticipants_"+parid[0]+"_t").jqGrid('editRow',id,true);
+ jQuery("#displayparticipants_"+parid[0]+"_t").editRow(id,true);
+ }
+ },
+ height: '100%'});
+ }
+
+});
+jQuery("#displayparticipants").jqGrid('navGrid','#pager',{add:true,del:true,edit:false,refresh: true,search: true},{},{ width : 400},{msg:deleteMsg, width : 700, beforeSubmit : function(postdata, formid) {
+ if(!$('#selectable .ui-selected').attr('id'))
+ {
+ alert(nooptionselected);
+ message = "dummy";
+ }
+ else
+ {
+ $.post(delparticipantUrl, { participant_id : postdata ,selectedoption : $('#selectable .ui-selected').attr('id')}, function(data) {});
+ success = "dummy";
+ message = "dummy";
+ return[success,message];
+ }
+
+} ,beforeShowForm:function(form) {$('#selectable').bind("mousedown", function (e) {e.metaKey = false;}).selectable({tolerance: 'fit'})}},{multipleSearch:true, multipleGroup:true});
+$("#displayparticipants").navButtonAdd('#pager',{caption:"",title:"Export to CSV", buttonicon:'exporticon', onClickButton:function(){
+ $.post(exporttocsvcount, {searchcondition: jQuery('#displayparticipants').jqGrid('getGridParam', 'url')},
+ function(data) {
+ titlemsg = data;
+
+ var dialog_buttons={};
+ dialog_buttons[cancelBtn]=function(){
+ $(this).dialog("close");
+ };
+ dialog_buttons[exportBtn]=function(){
+ //$.load(exporttocsv+"/"+$('#attributes').val(),{ } );
+ var url = jQuery('#displayparticipants').jqGrid('getGridParam', 'url');
+ $.download(exporttocsv+"/"+$('#attributes').val(),'searchcondition='+url );
+ $(this).dialog("close");
+ };
+
+ /* End of building array for button functions */
+ $('#exportcsv').dialog({
+ modal: true,
+ title: titlemsg,
+ buttons: dialog_buttons,
+ width : 400,
+ height : 400,
+ open: function(event, ui) {
+ $('#attributes').multiselect({noneSelectedText: 'Select Attributes',autoOpen:true}).multiselectfilter();
+ }
+ });
+ });
+}});
+
+$("#displayparticipants").navButtonAdd('#pager',{caption:"",title:"Full Search", buttonicon:'searchicon', onClickButton:function(){
+
+ var dialog_buttons={};
+ dialog_buttons[searchBtn]=function(){
+ searchconditions="";
+ var dialog_buttons={};
+ if($('#field_1').val() == '')
+ {
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );};
+ /* End of building array for button functions */
+ $('#fieldnotselected').dialog({
+ modal: true,
+ title: error,
+ buttons: dialog_buttons
+ });
+ }
+ else if($('#condition_1').val()=="")
+ {
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );};
+ /* End of building array for button functions */
+ $('#conditionnotselected').dialog({
+ modal: true,
+ title: error,
+ buttons: dialog_buttons
+ });
+ }
+ else
+ {
+
+ if(id == 1)
+ {
+ searchconditions = searchconditions + $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
+ jQuery("#displayparticipants").jqGrid('setGridParam',{url:jsonSearchUrl+'/'+searchconditions}).trigger("reloadGrid");
+ }
+ else
+ {
+ searchconditions = $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
+ for( i=2 ; i<=idexternal; i++)
+ {
+
+ if($('#field_'+i).val())
+ {
+ searchconditions = searchconditions + "||"+ $('#join_'+(i)).val()+"||"+$('#field_'+i).val()+"||"+$('#condition_'+i).val()+"||"+$('#conditiontext_'+i).val();
+ }
+ }
+ jQuery("#displayparticipants").jqGrid('setGridParam',{url:jsonSearchUrl+'/'+searchconditions}).trigger("reloadGrid");
+ }
+ $(this).dialog("close");
+ }
+ };
+ dialog_buttons[cancelBtn]=function(){
+ $(this).dialog("close");
+ };
+ /* End of building array for button functions */
+ $("#search").dialog({
+ height: 300,
+ width: 750,
+ modal: true,
+ title : 'Full Search',
+ buttons: dialog_buttons
+ });
+
+}});
+
+$.extend(jQuery.jgrid.edit,{closeAfterAdd: true,reloadAfterSubmit: true,closeOnEspace:true});
+ //script for sharing of participants
+ $("#sharingparticipants").dialog({
+ title: spTitle,
+ modal: true,
+ autoOpen: false,
+ height: 200,
+ width: 400,
+ show: 'blind',
+ hide: 'blind'
+ });
+ function shareParticipants(participant_id) {
+ var myGrid = $("#displayparticipants").jqGrid();
+ var pid = myGrid .getGridParam('selarrrow');
+ $("#shareform").load(shareUrl, {
+ participantid:pid,
+ shareuser:$("#shareuser").val(),
+ can_edit:$('#can_edit').attr('checked')
+ }, function(msg){
+ $(this).dialog("close");
+ alert(msg+"."+shareMsg);
+ $(location).attr('href',redUrl);
+ });
+ }
+ //End of Script for sharing
+ function addtoSurvey(participant_id,survey_id,redirect) {
+ $("#addsurvey").load(postUrl,{
+ participantid:participant_id},function(){
+ $(location).attr('href',attMapUrl+'/'+survey_id+'/'+redirect);
+ });}
+
+ $('#share').click(function(){
+ var myGrid = $("#displayparticipants").jqGrid();
+ var row = myGrid .getGridParam('selarrrow');
+ if(row=="") {
+ /* build an array containing the various button functions */
+ /* Needed because it's the only way to label a button with a variable */
+ var dialog_buttons={};
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );
+ };
+ /* End of building array for button functions */
+ $('#norowselected').dialog({
+ modal: true,
+ buttons: dialog_buttons
+ });
+ }
+ else
+ {
+ /* build an array containing the various button functions */
+ /* Needed because it's the only way to label a button with a variable */
+ var dialog_buttons={};
+ dialog_buttons[spAddBtn]=function(){
+ var row = myGrid .getGridParam('selarrrow');
+ shareParticipants(row);};
+ dialog_buttons[cancelBtn]=function(){
+ $(this).dialog("close");
+ };
+ /* End of building array for button functions */
+ $("#shareform").dialog({
+ height: 300,
+ width: 350,
+ modal: true,
+ buttons: dialog_buttons
+ });
+ }
+ if (!($("#shareuser").length > 0)) {
+ $('#shareform').html(sfNoUser);
+ }
+ });
+
+ $('#addtosurvey').click(function() {
+ var myGrid = $("#displayparticipants").jqGrid();
+ var rows = myGrid.getGridParam('selarrrow');
+ if(rows=="") {
+ /* build an array containing the various button functions */
+ /* Needed because it's the only way to label a button with a variable */
+ var dialog_buttons={};
+ dialog_buttons[okBtn]=function(){
+ $( this ).dialog( "close" );
+ };
+ /* End of building array for button functions */
+ $('#norowselected').dialog({
+ modal: true,
+ buttons: dialog_buttons
+ });
+ }
+
+ else
+ {
+ var dialog_buttons={};
+ dialog_buttons[mapButton]=function(){
+ var survey_id=$('#survey_id').val();
+ var redirect ="";
+
+ if(survey_id=="")
+ {
+
+ alert(selectSurvey);
+ }
+ else
+ {
+ if(jQuery('#redirect').is(":checked"))
+ {
+ redirect = "redirect";
+ }
+ else
+ {
+ redirect = "";
+ }
+ addtoSurvey(rows,survey_id,redirect);
+ }
+ };
+ dialog_buttons[cancelBtn]=function(){
+ $(this).dialog("close");
+ };
+ /* End of building array containing button functions */
+ $("#addsurvey").dialog({
+ height: 300,
+ width: 400,
+ title : addpartTitle,
+ modal: true,
+ buttons: dialog_buttons});
+ }
+ if (!($("#survey_id").length > 0)) {
+ $('#addsurvey').html(addpartErrorMsg);
+}
+});
});
\ No newline at end of file
diff --git a/scripts/jquery/jquery.ui.selectable.min.js b/scripts/jquery/jquery.ui.selectable.min.js
new file mode 100644
index 00000000000..6e64a9d440f
--- /dev/null
+++ b/scripts/jquery/jquery.ui.selectable.min.js
@@ -0,0 +1,22 @@
+/*
+ * jQuery UI Selectable 1.8.15
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectables
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.mouse.js
+ * jquery.ui.widget.js
+ */
+(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
+selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
+c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
+c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
+this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right
i||a.bottomb&&a.rightg&&a.bottom