Skip to content

Commit

Permalink
Merge branch '3.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
xcompass committed Nov 24, 2014
2 parents 00da6e4 + db6b942 commit d3d0f41
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
/**
* iPeer database version
*/
Configure::write('DATABASE_VERSION', 7);
Configure::write('DATABASE_VERSION', 8);


$CWL['LoginURL'] = 'https://www.auth.cwl.ubc.ca/auth/login';
Expand All @@ -342,7 +342,7 @@
$CWL['applicationID'] = '';
$CWL['applicationPassword'] = '';

define('IPEER_VERSION', '3.1.4');
define('IPEER_VERSION', '3.1.5');


/**
Expand Down
6 changes: 6 additions & 0 deletions app/config/sql/delta_8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
INSERT INTO `email_templates` (`name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES
('Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL);

UPDATE `email_schedules` SET `content` = (SELECT id FROM `email_templates` WHERE `subject`="iPeer Evaluation Reminder" AND `content`="Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You") WHERE `subject` like '%iPeer Evaluation Reminder%' and `sent`=0;

UPDATE `sys_parameters` SET `parameter_value` = '8' WHERE `parameter_code` = 'database.version';
7 changes: 4 additions & 3 deletions app/config/sql/ipeer.sql
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ CREATE TABLE IF NOT EXISTS `email_templates` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES
(1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL);
(1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL),
(2, 'Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL);

-- --------------------------------------------------------

Expand Down Expand Up @@ -1497,8 +1498,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty
('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()),
('system.version', '3.1.3', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()),
('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()),
('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),
Expand Down
7 changes: 4 additions & 3 deletions app/config/sql/ipeer_samples_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,8 @@ INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content`
(1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL),
(2, 'Email template example', 'This is an email template example', 'Email Template', 'Hello, {{{USERNAME}}}',1, 1, NOW(), NULL, NULL),
(3, 'Email template example2', 'email template ex2', 'Email Template2', 'Hello, {{{FIRSTNAME}}}',1, 2, NOW(), NULL, NULL),
(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL);
(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL),
(5, 'Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL);


-- --------------------------------------------------------
Expand Down Expand Up @@ -2027,8 +2028,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty
('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()),
('system.version', '3.1.4', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()),
('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()),
('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),
Expand Down
2 changes: 1 addition & 1 deletion app/libs/upgrade_scripts/upgrade_314.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require_once('upgrade_base.php');
/**
* Upgrade310
* Upgrade314
*
* @uses UpgradeBase
* @package CTLT.iPeer
Expand Down
58 changes: 58 additions & 0 deletions app/libs/upgrade_scripts/upgrade_315.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
require_once('upgrade_base.php');
/**
* Upgrade315
*
* @uses UpgradeBase
* @package CTLT.iPeer
* @author Michael Tang <[email protected]>
* @copyright 2012 All rights reserved.
* @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
* @version Release: 3.1
*/
class Upgrade315 extends UpgradeBase
{
/**
* __construct
*
* @access public
* @return void
*/
public function __construct()
{
$this->fromVersions = array(null, '3.1.4');
$this->toVersion = '3.1.5';
$this->dbVersion = Configure::read('DATABASE_VERSION');
}

/**
*
* @access public
* @return void
*/
public function isUpgradable()
{
return parent::isUpgradable();
}

/**
* up
*
* @access public
* @return boolean
*/
public function up()
{
$sysparameter = ClassRegistry::init('SysParameter');
$dbv = $sysparameter->get('database.version');

$ret = $this->patchDb($dbv, $this->dbVersion);
if ($ret) {
$this->errors[] = sprintf(__('Database patching failed: %s', true), $ret);
return false;
}
$sysparameter->reload();

return true;
}
}
13 changes: 8 additions & 5 deletions app/tests/cases/models/email_template.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,26 @@ function testGetPermittedEmailTemplate()
{
//Test on valid input w/ find all
$templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'all');
$this->assertEqual(count($templates), 4);
$this->assertEqual(count($templates), 5);
$this->assertEqual($templates[0]['EmailTemplate']['id'], 2);
$this->assertEqual($templates[1]['EmailTemplate']['id'], 3);
$this->assertEqual($templates[2]['EmailTemplate']['id'], 4);
$this->assertEqual($templates[3]['EmailTemplate']['id'], 1);
$this->assertEqual($templates[3]['EmailTemplate']['id'], 5);
$this->assertEqual($templates[4]['EmailTemplate']['id'], 1);
$this->assertEqual($templates[0]['EmailTemplate']['name'], 'Email template example');
$this->assertEqual($templates[1]['EmailTemplate']['name'], 'Email template example2');
$this->assertEqual($templates[2]['EmailTemplate']['name'], 'Email template example3');
$this->assertEqual($templates[3]['EmailTemplate']['name'], 'Submission Confirmation');
$this->assertEqual($templates[3]['EmailTemplate']['name'], 'Evaluation Reminder Template');
$this->assertEqual($templates[4]['EmailTemplate']['name'], 'Submission Confirmation');

//Test on valid input w/ find list
$templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'list');
$this->assertEqual($templates, array(
'1' => 'Submission Confirmation',
'2' => 'Email template example',
'3' => 'Email template example2',
'4' => 'Email template example3')
'4' => 'Email template example3',
'5' => 'Evaluation Reminder Template',
'1' => 'Submission Confirmation')
);

//Test on null input
Expand Down
9 changes: 6 additions & 3 deletions app/vendors/shells/send_emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ function main()
$tables[$table['table_name']][$table['field_name']] = '/'.$match[0].'/';
}
}
// email content after merging common data
$content = preg_replace($patterns, $replacements, $e['content']);
// email content after merging common data, common data is non-user
// specific data such as course name and such. User specific data
// is merged in each individual email in the following loop using
// doMerge.
$contentWithCommonData = preg_replace($patterns, $replacements, $e['content']);

$emailList = $this->User->getEmails(explode(';', $filter_email_list));
foreach ($emailList as $to_id => $to) {
Expand All @@ -121,7 +124,7 @@ function main()
$subject = $e['subject'];
if (!empty($tables)) {
// merge data not in common data
$content = $this->doMerge($content, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id);
$content = $this->doMerge($contentWithCommonData, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id);
}
if ($this->sendEmail($content, $subject, $from, $to)) {
$successCount++;
Expand Down
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ Runing the tests:
cake/console/cake -app app testsuite app group system

It is better not to touch the mouse or keyboard during the tests.
iPeer 3.1.5
---------------------------
This is a maintenance release.
* Fixed emails templates filling in wrong names.
* Fixed bug where empty ipeer evaluation reminder emails were sent
* Added system.version parameter to delta7
* Updated vagrant and puppet modules
* Fixed missing formLoaded parameter in event editing
* Fixed the failed test and update version in sample data
* Moved delta 5 into delta 4 and remove sql mode in 6
* Fixed some bugs && temporarily removed show student events
* Fixed releasing comments for student view of evaluation results
* Added commands to refresh the cache directory into the upgrade script
* Implemented some validations to event edit
* Fixed super admins unable to view all instructors and faculty admins
* Created upgrade script to version 3.1.4
* Fixed events add/edit event forms

iPeer 3.1.4
---------------------------
This is a maintenance release.
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.1.5

0 comments on commit d3d0f41

Please sign in to comment.