Skip to content

Commit d3d0f41

Browse files
committed
Merge branch '3.1.x'
2 parents 00da6e4 + db6b942 commit d3d0f41

File tree

10 files changed

+108
-18
lines changed

10 files changed

+108
-18
lines changed

app/config/core.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
/**
320320
* iPeer database version
321321
*/
322-
Configure::write('DATABASE_VERSION', 7);
322+
Configure::write('DATABASE_VERSION', 8);
323323

324324

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

345-
define('IPEER_VERSION', '3.1.4');
345+
define('IPEER_VERSION', '3.1.5');
346346

347347

348348
/**

app/config/sql/delta_8.sql

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSERT INTO `email_templates` (`name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES
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);
3+
4+
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;
5+
6+
UPDATE `sys_parameters` SET `parameter_value` = '8' WHERE `parameter_code` = 'database.version';

app/config/sql/ipeer.sql

+4-3
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,8 @@ CREATE TABLE IF NOT EXISTS `email_templates` (
745745
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
746746

747747
INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES
748-
(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);
748+
(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),
749+
(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);
749750

750751
-- --------------------------------------------------------
751752

@@ -1497,8 +1498,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty
14971498
('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
14981499
('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
14991500
('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()),
1500-
('system.version', '3.1.3', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
1501-
('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
1501+
('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
1502+
('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
15021503
('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()),
15031504
('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()),
15041505
('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),

app/config/sql/ipeer_samples_data.sql

+4-3
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content`
833833
(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),
834834
(2, 'Email template example', 'This is an email template example', 'Email Template', 'Hello, {{{USERNAME}}}',1, 1, NOW(), NULL, NULL),
835835
(3, 'Email template example2', 'email template ex2', 'Email Template2', 'Hello, {{{FIRSTNAME}}}',1, 2, NOW(), NULL, NULL),
836-
(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL);
836+
(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL),
837+
(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);
837838

838839

839840
-- --------------------------------------------------------
@@ -2027,8 +2028,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty
20272028
('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
20282029
('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
20292030
('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()),
2030-
('system.version', '3.1.4', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
2031-
('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
2031+
('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()),
2032+
('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()),
20322033
('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()),
20332034
('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()),
20342035
('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()),

app/libs/upgrade_scripts/upgrade_314.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require_once('upgrade_base.php');
33
/**
4-
* Upgrade310
4+
* Upgrade314
55
*
66
* @uses UpgradeBase
77
* @package CTLT.iPeer
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
require_once('upgrade_base.php');
3+
/**
4+
* Upgrade315
5+
*
6+
* @uses UpgradeBase
7+
* @package CTLT.iPeer
8+
* @author Michael Tang <[email protected]>
9+
* @copyright 2012 All rights reserved.
10+
* @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
11+
* @version Release: 3.1
12+
*/
13+
class Upgrade315 extends UpgradeBase
14+
{
15+
/**
16+
* __construct
17+
*
18+
* @access public
19+
* @return void
20+
*/
21+
public function __construct()
22+
{
23+
$this->fromVersions = array(null, '3.1.4');
24+
$this->toVersion = '3.1.5';
25+
$this->dbVersion = Configure::read('DATABASE_VERSION');
26+
}
27+
28+
/**
29+
*
30+
* @access public
31+
* @return void
32+
*/
33+
public function isUpgradable()
34+
{
35+
return parent::isUpgradable();
36+
}
37+
38+
/**
39+
* up
40+
*
41+
* @access public
42+
* @return boolean
43+
*/
44+
public function up()
45+
{
46+
$sysparameter = ClassRegistry::init('SysParameter');
47+
$dbv = $sysparameter->get('database.version');
48+
49+
$ret = $this->patchDb($dbv, $this->dbVersion);
50+
if ($ret) {
51+
$this->errors[] = sprintf(__('Database patching failed: %s', true), $ret);
52+
return false;
53+
}
54+
$sysparameter->reload();
55+
56+
return true;
57+
}
58+
}

app/tests/cases/models/email_template.test.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,26 @@ function testGetPermittedEmailTemplate()
3939
{
4040
//Test on valid input w/ find all
4141
$templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'all');
42-
$this->assertEqual(count($templates), 4);
42+
$this->assertEqual(count($templates), 5);
4343
$this->assertEqual($templates[0]['EmailTemplate']['id'], 2);
4444
$this->assertEqual($templates[1]['EmailTemplate']['id'], 3);
4545
$this->assertEqual($templates[2]['EmailTemplate']['id'], 4);
46-
$this->assertEqual($templates[3]['EmailTemplate']['id'], 1);
46+
$this->assertEqual($templates[3]['EmailTemplate']['id'], 5);
47+
$this->assertEqual($templates[4]['EmailTemplate']['id'], 1);
4748
$this->assertEqual($templates[0]['EmailTemplate']['name'], 'Email template example');
4849
$this->assertEqual($templates[1]['EmailTemplate']['name'], 'Email template example2');
4950
$this->assertEqual($templates[2]['EmailTemplate']['name'], 'Email template example3');
50-
$this->assertEqual($templates[3]['EmailTemplate']['name'], 'Submission Confirmation');
51+
$this->assertEqual($templates[3]['EmailTemplate']['name'], 'Evaluation Reminder Template');
52+
$this->assertEqual($templates[4]['EmailTemplate']['name'], 'Submission Confirmation');
5153

5254
//Test on valid input w/ find list
5355
$templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'list');
5456
$this->assertEqual($templates, array(
55-
'1' => 'Submission Confirmation',
5657
'2' => 'Email template example',
5758
'3' => 'Email template example2',
58-
'4' => 'Email template example3')
59+
'4' => 'Email template example3',
60+
'5' => 'Evaluation Reminder Template',
61+
'1' => 'Submission Confirmation')
5962
);
6063

6164
//Test on null input

app/vendors/shells/send_emails.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ function main()
108108
$tables[$table['table_name']][$table['field_name']] = '/'.$match[0].'/';
109109
}
110110
}
111-
// email content after merging common data
112-
$content = preg_replace($patterns, $replacements, $e['content']);
111+
// email content after merging common data, common data is non-user
112+
// specific data such as course name and such. User specific data
113+
// is merged in each individual email in the following loop using
114+
// doMerge.
115+
$contentWithCommonData = preg_replace($patterns, $replacements, $e['content']);
113116

114117
$emailList = $this->User->getEmails(explode(';', $filter_email_list));
115118
foreach ($emailList as $to_id => $to) {
@@ -121,7 +124,7 @@ function main()
121124
$subject = $e['subject'];
122125
if (!empty($tables)) {
123126
// merge data not in common data
124-
$content = $this->doMerge($content, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id);
127+
$content = $this->doMerge($contentWithCommonData, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id);
125128
}
126129
if ($this->sendEmail($content, $subject, $from, $to)) {
127130
$successCount++;

readme.md

+18
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ Runing the tests:
7070
cake/console/cake -app app testsuite app group system
7171

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

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.4
1+
3.1.5

0 commit comments

Comments
 (0)