Commit bd2219abd3971f6ebc8d25f8e77979644a10c3de

Authored by donaldjackson
2 parents d0bf5746 711a0eca

Merge branch 'master' of git@github.com:ktgit/knowledgetree

lib/email/Email.inc
@@ -8,31 +8,31 @@ @@ -8,31 +8,31 @@
8 * Document Management Made Simple 8 * Document Management Made Simple
9 * Copyright (C) 2008, 2009 KnowledgeTree Inc. 9 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
10 * Portions copyright The Jam Warehouse Software (Pty) Limited 10 * Portions copyright The Jam Warehouse Software (Pty) Limited
11 - * 11 + *
12 * This program is free software; you can redistribute it and/or modify it under 12 * This program is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License version 3 as published by the 13 * the terms of the GNU General Public License version 3 as published by the
14 * Free Software Foundation. 14 * Free Software Foundation.
15 - * 15 + *
16 * This program is distributed in the hope that it will be useful, but WITHOUT 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * details. 19 * details.
20 - * 20 + *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 - *  
24 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 23 + *
  24 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
25 * California 94120-7775, or email info@knowledgetree.com. 25 * California 94120-7775, or email info@knowledgetree.com.
26 - * 26 + *
27 * The interactive user interfaces in modified source and object code versions 27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under 28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU General Public License version 3. 29 * Section 5 of the GNU General Public License version 3.
30 - * 30 + *
31 * In accordance with Section 7(b) of the GNU General Public License version 3, 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by 32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
35 - * must display the words "Powered by KnowledgeTree" and retain the original 35 + * must display the words "Powered by KnowledgeTree" and retain the original
36 * copyright notice. 36 * copyright notice.
37 * Contributor( s): ______________________________________ 37 * Contributor( s): ______________________________________
38 */ 38 */
@@ -49,7 +49,7 @@ class Email { @@ -49,7 +49,7 @@ class Email {
49 * with default system information 49 * with default system information
50 * 50 *
51 * @param string the sender's email address (optional) 51 * @param string the sender's email address (optional)
52 - * @param string the sender's name (optional) 52 + * @param string the sender's name (optional)
53 */ 53 */
54 function Email($sFromEmail = "", $sFromName = "") { 54 function Email($sFromEmail = "", $sFromName = "") {
55 global $default; 55 global $default;
@@ -66,8 +66,8 @@ class Email { @@ -66,8 +66,8 @@ class Email {
66 $this->oMailer->IsHTML(true); 66 $this->oMailer->IsHTML(true);
67 $this->oMailer->SetLanguage('en', KT_DIR . '/thirdparty/phpmailer/language/'); 67 $this->oMailer->SetLanguage('en', KT_DIR . '/thirdparty/phpmailer/language/');
68 $this->bEmailDisabled = false; 68 $this->bEmailDisabled = false;
69 -  
70 - $oConfig =& KTConfig::getSingleton(); 69 +
  70 + $oConfig =& KTConfig::getSingleton();
71 $sEmailServer = $oConfig->get('email/emailServer'); 71 $sEmailServer = $oConfig->get('email/emailServer');
72 if ($sEmailServer == 'none') { 72 if ($sEmailServer == 'none') {
73 $this->bEmailDisabled = true; 73 $this->bEmailDisabled = true;
@@ -90,7 +90,7 @@ class Email { @@ -90,7 +90,7 @@ class Email {
90 $this->oMailer->Password = $sEmailPass; 90 $this->oMailer->Password = $sEmailPass;
91 } 91 }
92 } 92 }
93 - 93 +
94 /** 94 /**
95 * Sends an email to a specified recipient. 95 * Sends an email to a specified recipient.
96 * 96 *
@@ -98,7 +98,7 @@ class Email { @@ -98,7 +98,7 @@ class Email {
98 * @param string the subject of the email 98 * @param string the subject of the email
99 * @param string the body of the email 99 * @param string the body of the email
100 * @param string the sender's email address (optional) 100 * @param string the sender's email address (optional)
101 - * @param string the sender's name (optional) 101 + * @param string the sender's name (optional)
102 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"] 102 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
103 */ 103 */
104 function send($mToEmail, $sSubject, $sBody) { 104 function send($mToEmail, $sSubject, $sBody) {
@@ -106,9 +106,9 @@ class Email { @@ -106,9 +106,9 @@ class Email {
106 return PEAR::raiseError(_kt("Email is not configured.")); 106 return PEAR::raiseError(_kt("Email is not configured."));
107 } 107 }
108 global $default; 108 global $default;
109 -  
110 - if ( (is_string($mToEmail) && (strlen($mToEmail) > 0)) ||  
111 - (is_array($mToEmail) && (count($mToEmail) > 0)) ) { 109 +
  110 + if ( (is_string($mToEmail) && (strlen($mToEmail) > 0)) ||
  111 + (is_array($mToEmail) && (count($mToEmail) > 0)) ) {
112 112
113 $aEmailAddresses = array(); 113 $aEmailAddresses = array();
114 // just one email address, add it 114 // just one email address, add it
@@ -118,7 +118,7 @@ class Email { @@ -118,7 +118,7 @@ class Email {
118 // if we're passed an array, then use it 118 // if we're passed an array, then use it
119 if (is_array($mToEmail)) { 119 if (is_array($mToEmail)) {
120 $aEmailAddresses = $mToEmail; 120 $aEmailAddresses = $mToEmail;
121 - // if there are multiple addresses (; separated), explode it 121 + // if there are multiple addresses (; separated), explode it
122 } elseif (strpos($mToEmail, ";") > 0) { 122 } elseif (strpos($mToEmail, ";") > 0) {
123 $aEmailAddresses = explode(";", $mToEmail); 123 $aEmailAddresses = explode(";", $mToEmail);
124 } 124 }
@@ -128,9 +128,11 @@ class Email { @@ -128,9 +128,11 @@ class Email {
128 } 128 }
129 } 129 }
130 130
  131 + $body = $this->makeEmailTemplate(stripslashes($sBody));
131 $this->oMailer->Subject = stripslashes($sSubject); 132 $this->oMailer->Subject = stripslashes($sSubject);
132 - $this->oMailer->Body = stripslashes($sBody);  
133 - 133 +// $this->oMailer->Body = stripslashes($sBody);
  134 + $this->oMailer->Body = $body;
  135 +
134 //send the email 136 //send the email
135 if(!$this->oMailer->Send()) { 137 if(!$this->oMailer->Send()) {
136 $default->log->error("Error sending mail to $mToEmail; mailer error code=" . $this->oMailer->ErrorInfo); 138 $default->log->error("Error sending mail to $mToEmail; mailer error code=" . $this->oMailer->ErrorInfo);
@@ -160,9 +162,9 @@ class Email { @@ -160,9 +162,9 @@ class Email {
160 return PEAR::raiseError(_kt("Email is not configured.")); 162 return PEAR::raiseError(_kt("Email is not configured."));
161 } 163 }
162 global $default; 164 global $default;
163 -  
164 - if ( (is_string($mToEmail) && (strlen($mToEmail) > 0)) ||  
165 - (is_array($mToEmail) && (count($mToEmail) > 0)) ) { 165 +
  166 + if ( (is_string($mToEmail) && (strlen($mToEmail) > 0)) ||
  167 + (is_array($mToEmail) && (count($mToEmail) > 0)) ) {
166 168
167 // just one email address, add it 169 // just one email address, add it
168 if (is_string($mToEmail) && (strpos($mToEmail, ";") === false)) { 170 if (is_string($mToEmail) && (strpos($mToEmail, ";") === false)) {
@@ -172,7 +174,7 @@ class Email { @@ -172,7 +174,7 @@ class Email {
172 // if we're passed an array, then use it 174 // if we're passed an array, then use it
173 if (is_array($mToEmail)) { 175 if (is_array($mToEmail)) {
174 $aEmailAddresses = $mToEmail; 176 $aEmailAddresses = $mToEmail;
175 - // if there are multiple addresses (; separated), explode it 177 + // if there are multiple addresses (; separated), explode it
176 } elseif (strpos($mToEmail, ";") > 0) { 178 } elseif (strpos($mToEmail, ";") > 0) {
177 $aEmailAddresses = explode(";", $mToEmail); 179 $aEmailAddresses = explode(";", $mToEmail);
178 } 180 }
@@ -182,10 +184,12 @@ class Email { @@ -182,10 +184,12 @@ class Email {
182 } 184 }
183 } 185 }
184 186
  187 + $body = $this->makeEmailTemplate(stripslashes($sBody));
185 $this->oMailer->Subject = stripslashes($sSubject); 188 $this->oMailer->Subject = stripslashes($sSubject);
186 - $this->oMailer->Body = stripslashes($sBody); 189 +// $this->oMailer->Body = stripslashes($sBody);
  190 + $this->oMailer->Body = $body;
187 $this->oMailer->AddAttachment($sDocumentPath, $sDocumentName); 191 $this->oMailer->AddAttachment($sDocumentPath, $sDocumentName);
188 - 192 +
189 //send the email 193 //send the email
190 if(!$this->oMailer->Send()) { 194 if(!$this->oMailer->Send()) {
191 $default->log->error("Error sending mail to $mToEmail; mailer error code=" . $this->oMailer->ErrorInfo); 195 $default->log->error("Error sending mail to $mToEmail; mailer error code=" . $this->oMailer->ErrorInfo);
@@ -211,7 +215,7 @@ class Email { @@ -211,7 +215,7 @@ class Email {
211 * @param The hyperlink that should be sent 215 * @param The hyperlink that should be sent
212 * 216 *
213 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"] 217 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
214 - * 218 + *
215 * @todo check for special characters (including encoding the link correctly???) 219 * @todo check for special characters (including encoding the link correctly???)
216 * @todo need to test this on multiple mail clients, not just Outlook 220 * @todo need to test this on multiple mail clients, not just Outlook
217 */ 221 */
@@ -221,12 +225,15 @@ class Email { @@ -221,12 +225,15 @@ class Email {
221 } 225 }
222 global $default; 226 global $default;
223 227
  228 + $body = $this->makeEmailTemplate(stripslashes($EmailBody).'<br /><br />'.$hyperlink);
  229 +
224 //get info from relevant fields. 230 //get info from relevant fields.
225 $this->oMailer->From = $FromEmail; 231 $this->oMailer->From = $FromEmail;
226 $this->oMailer->FromName = $FromName; 232 $this->oMailer->FromName = $FromName;
227 $this->oMailer->AddAddress($ToEmail); 233 $this->oMailer->AddAddress($ToEmail);
228 $this->oMailer->Subject = stripslashes($Subj); 234 $this->oMailer->Subject = stripslashes($Subj);
229 - $this->oMailer->Body = stripslashes($EmailBody) . ' ' . $hyperlink; 235 +// $this->oMailer->Body = stripslashes($EmailBody) . ' ' . $hyperlink;
  236 + $this->oMailer->Body = $body;
230 237
231 //send the email 238 //send the email
232 if(!$this->oMailer->Send()) { 239 if(!$this->oMailer->Send()) {
@@ -236,7 +243,7 @@ class Email { @@ -236,7 +243,7 @@ class Email {
236 return true; 243 return true;
237 } 244 }
238 /** 245 /**
239 - * Sends an email ment for administration, 246 + * Sends an email ment for administration,
240 * 247 *
241 * @param The sender's email address 248 * @param The sender's email address
242 * @param The sender's Name 249 * @param The sender's Name
@@ -246,7 +253,7 @@ class Email { @@ -246,7 +253,7 @@ class Email {
246 * @param The hyperlink that should be sent 253 * @param The hyperlink that should be sent
247 * 254 *
248 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"] 255 * @return boolean true on email successfully sent, false otherwise and set $_SESSION["errorMessage"]
249 - * 256 + *
250 * @todo check for special characters (including encoding the link correctly???) 257 * @todo check for special characters (including encoding the link correctly???)
251 * @todo need to test this on multiple mail clients, not just Outlook 258 * @todo need to test this on multiple mail clients, not just Outlook
252 */ 259 */
@@ -256,12 +263,15 @@ class Email { @@ -256,12 +263,15 @@ class Email {
256 } 263 }
257 global $default; 264 global $default;
258 265
  266 + $body = $this->makeEmailTemplate(stripslashes($EmailBody) . " <br />" . _kt("This bug can be found on this page") . ": " . "<a href = ". $hyperlink .">". $hyperlink ."</a>");
  267 +
259 //get info from relevant fields. 268 //get info from relevant fields.
260 $this->oMailer->From = $FromEmail; 269 $this->oMailer->From = $FromEmail;
261 $this->oMailer->FromName = $FromName; 270 $this->oMailer->FromName = $FromName;
262 $this->oMailer->AddAddress($ToEmail); 271 $this->oMailer->AddAddress($ToEmail);
263 $this->oMailer->Subject = stripslashes($Subj) . ' ' . $hyperlink; //only difference from above 272 $this->oMailer->Subject = stripslashes($Subj) . ' ' . $hyperlink; //only difference from above
264 - $this->oMailer->Body = stripslashes($EmailBody) . " <br>" . _kt("This bug can be found on this page") . ": " . "<a href = ". $hyperlink .">". $hyperlink ."</a>"; 273 +// $this->oMailer->Body = stripslashes($EmailBody) . " <br>" . _kt("This bug can be found on this page") . ": " . "<a href = ". $hyperlink .">". $hyperlink ."</a>";
  274 + $this->oMailer->Body = $body;
265 275
266 //send the email 276 //send the email
267 if(!$this->oMailer->Send()) { 277 if(!$this->oMailer->Send()) {
@@ -277,12 +287,14 @@ class Email { @@ -277,12 +287,14 @@ class Email {
277 } 287 }
278 global $default; 288 global $default;
279 289
  290 + $body = $this->makeEmailTemplate(stripslashes($EmailBody));
  291 +
280 //get info from relevant fields. 292 //get info from relevant fields.
281 $this->oMailer->From = $FromEmail; 293 $this->oMailer->From = $FromEmail;
282 $this->oMailer->FromName = $FromName; 294 $this->oMailer->FromName = $FromName;
283 $this->oMailer->AddAddress($ToEmail); 295 $this->oMailer->AddAddress($ToEmail);
284 $this->oMailer->Subject = stripslashes($Subj); 296 $this->oMailer->Subject = stripslashes($Subj);
285 - $this->oMailer->Body = stripslashes($EmailBody); 297 + $this->oMailer->Body = $body;
286 298
287 //send the email 299 //send the email
288 if(!$this->oMailer->Send()) { 300 if(!$this->oMailer->Send()) {
@@ -291,6 +303,48 @@ class Email { @@ -291,6 +303,48 @@ class Email {
291 } 303 }
292 return true; 304 return true;
293 } 305 }
294 -}  
295 306
296 -?> 307 + /*
  308 + * This method builds the email template
  309 + *
  310 + * @author KnowledgeTree Team
  311 + * @access public
  312 + * @param string $email The email to be sent
  313 + * @return string $str The html string that will be sent via email
  314 + */
  315 + public function makeEmailTemplate($email)
  316 + {
  317 + $rootUrl = KTUtil::kt_url();
  318 +
  319 + $oKTConfig =& KTConfig::getSingleton();
  320 + $mainLogo = $oKTConfig->get('mainLogo');
  321 + $appName = $oKTConfig->get('appName');
  322 + $companyLogoTitle = $oKTConfig->get('companyLogoTitle');
  323 + $mainLogoTitle = $oKTConfig->get('mainLogoTitle');
  324 +
  325 + if($mainLogo != ''){
  326 + $logo = '<img src="'.$mainLogo.'" class="primary" alt="'.$companyLogoTitle.'" title="'.$mainLogoTitle.'"/>';
  327 + }else{
  328 + $logo = '<img src="'.$rootUrl.'/resources/graphics/ktlogo-topbar-right-transparent.png" class="primary" title="'.$appName.'" height="44" width="252"/>';
  329 + }
  330 +
  331 + $str = '<html>
  332 + <body>
  333 + <table border="1" cellpadding="5" width="100%" height="100">
  334 + <tr style="background-color:LightGrey">
  335 + <td>
  336 + '.$logo.'
  337 + </td>
  338 + </tr>
  339 + <tr>
  340 + <td>
  341 + '.$email.'
  342 + </td>
  343 + </tr>
  344 + </table>
  345 + </body>
  346 + </html>';
  347 + return $str;
  348 + }
  349 +}
  350 +?>
297 \ No newline at end of file 351 \ No newline at end of file
lib/subscriptions/subscriptions.inc.php
@@ -431,10 +431,171 @@ class SubscriptionContent { @@ -431,10 +431,171 @@ class SubscriptionContent {
431 ); 431 );
432 } 432 }
433 433
  434 + /**
  435 + * This function generates the email that will be sent for subscription notifications
  436 + *
  437 + * @author KnowledgeTree Team
  438 + * @access public
  439 + * @param object $oKTNotification: The notification object
  440 + * @return string $str: The html string that will be sent via email
  441 + */
434 function getEmailAlertContent($oKTNotification) { 442 function getEmailAlertContent($oKTNotification) {
435 - // we can re-use the normal template. 443 + // set up logo and title
  444 + $rootUrl = KTUtil::kt_url();
  445 +
  446 + $info = $this->_getSubscriptionData($oKTNotification);
  447 +
  448 + // set up email text
  449 + $addFolderText = _kt('The folder "').$info['object_name']._kt('" was added');
  450 + $removeSubscribedFolderText = _kt('The folder "').$info['object_name']._kt('" to which you were subscribed, has been removed');
  451 + $removeChildFolderText = _kt('The folder "').$info['object_name']._kt('" has been removed');
  452 + $addDocumentText = _kt('The document "').$info['object_name']._kt('" was added');
  453 + $removeSubscribedDocumentText = _kt('The document "').$info['object_name']._kt('" to which you were subscribed, has been removed');
  454 + $removeChildDocumentText = _kt('The document "').$info['object_name']._kt('" has been removed');
  455 + $modifyDocumentText = _kt('The document "').$info['object_name']._kt('" has been changed');
  456 + $checkInDocumentText = _kt('The document "').$info['object_name']._kt('" has been checked in');
  457 + $checkOutDocumentText = _kt('The document "').$info['object_name']._kt('" has been checked out');
  458 + $moveDocumentText = _kt('The document "').$info['object_name']._kt('" has been moved');
  459 + $copiedDocumentText = _kt('The document "').$info['object_name']._kt('" has been copied');
  460 + $archivedDocumentText = _kt('The document "').$info['object_name']._kt('"');
  461 + $restoreArchivedDocumentText = _kt('The document "').$info['object_name']._kt('" has been restored by an administrator');
  462 + $downloadDocumentText = _kt('The document "').$info['object_name']._kt('"');
  463 + $documentAlertText = _kt('An alert on the document "').$info['object_name']._kt('" has been added or modified');
  464 +
  465 + if($info['location_name'] !== NULL){
  466 + $addFolderText .= _kt(' to "').$info['location_name']._kt('"');
  467 + $removeChildFolderText .= _kt(' from the folder "').$info['location_name']._kt('"');
  468 + $addDocumentText .= _kt(' to "').$info['location_name']._kt('"');
  469 + $removeChildDocumentText .= _kt(' from the folder "').$info['location_name']._kt('" to which you are subscribed');
  470 + $modifyDocumentText .= _kt(' in the folder "').$info['location_name']._kt('"');
  471 + $checkInDocumentText .= _kt(', in the folder "').$info['location_name']._kt('"');
  472 + $checkOutDocumentText .= _kt(', from the folder "').$info['location_name']._kt('"');
  473 + $moveDocumentText .= _kt(' to the folder "').$info['location_name']._kt('"');
  474 + $copiedDocumentText .= _kt(' to the folder "').$info['location_name']._kt('"');
  475 + $archivedDocumentText .= _kt(' in the folder "').$info['location_name']._kt('" has been archived');
  476 + $downloadDocumentText .= _kt(' in the folder "').$info['location_name']._kt('" has been downloaded');
  477 + $documentAlertText .= _kt(' in the folder "').$info['location_name']._kt('"');
  478 + }
  479 +
  480 + // set up links
  481 + switch($info['event_type']){
  482 + case 'AddFolder':
  483 + $text = $addFolderText;
  484 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  485 + $links = '<a href="'.$url.'">'._kt('View New Folder').'</a>';
  486 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  487 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  488 + break;
  489 + case 'RemoveSubscribedFolder':
  490 + $text = $removeSubscribedFolderText;
  491 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  492 + $links = '<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  493 + break;
  494 + case 'RemoveChildFolder':
  495 + $text = $removeChildFolderText;
  496 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  497 + $links = '<a href="'.$url.'">'._kt('View Folder').'</a>';
  498 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  499 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  500 + break;
  501 + case 'AddDocument':
  502 + $text = $addDocumentText;
  503 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  504 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  505 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  506 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  507 + break;
  508 + case 'RemoveSubscribedDocument':
  509 + $text = $removeSubscribedDocumentText;
  510 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  511 + $links = '<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  512 + break;
  513 + case 'RemoveChildDocument':
  514 + $text = $removeChildDocumentText;
  515 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  516 + $links = '<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  517 + break;
  518 + case 'ModifyDocument':
  519 + $text = $modifyDocumentText;
  520 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  521 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  522 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  523 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  524 + break;
  525 + case 'CheckInDocument':
  526 + $text = $checkInDocumentText;
  527 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  528 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  529 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  530 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  531 + break;
  532 + case 'CheckOutDocument':
  533 + $text = $checkOutDocumentText;
  534 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  535 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  536 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  537 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  538 + break;
  539 + case 'MovedDocument':
  540 + $text = $modifyDocumentText;
  541 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  542 + $links = '<a href="'.$url.'">'._kt('View New Location').'</a>';
  543 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  544 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  545 + break;
  546 + case 'CopiedDocument':
  547 + $text = $copiedDocumentText;
  548 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  549 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  550 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  551 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  552 + break;
  553 + case 'ArchivedDocument':
  554 + $text = $archivedDocumentText;
  555 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  556 + $links = '<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  557 + break;
  558 + case 'RestoreArchivedDocument':
  559 + $text = $restoreArchivedDocumentText;
  560 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  561 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  562 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  563 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  564 + break;
  565 + case 'DownloadDocument':
  566 + $text = $downloadDocumentText;
  567 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  568 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  569 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  570 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  571 + break;
  572 + case 'ModifyDocumentAlert':
  573 + $text = $documentAlertText;
  574 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'];
  575 + $links = '<a href="'.$url.'">'._kt('View Document').'</a>';
  576 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=clear';
  577 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('Clear Alert').'</a>';
  578 + $url = $rootUrl.'/notify.php?id='.$info['notify_id'].'&notify_action=viewall';
  579 + $links .= '&#160;|&#160;<a href="'.$url.'">'._kt('View all alerts on this document').'</a>';
  580 + }
  581 +
  582 + if($info['actor_name'] !== NULL && $info['event_type'] != 'RestoredArchivedDocument'){
  583 + $text .= _kt(', by ').$info['actor_name'];
  584 + }
  585 +
  586 + // we can re-use the normal template.
436 // however, we need to wrap it - no need for a second template here. 587 // however, we need to wrap it - no need for a second template here.
437 - $str = '<html><body>' . $this->getNotificationAlertContent($oKTNotification) . '</body></html>'; 588 + //$str = '<html><body>' . $this->getNotificationAlertContent($oKTNotification) . '</body></html>';
  589 + $str = '<br />
  590 + &#160;&#160;&#160;&#160;<b>'._kt('Subscription notification').': '.$this->_eventTypeNames[$info['event_type']].'</b>
  591 + <br />
  592 + <br />
  593 + &#160;&#160;&#160;&#160;'.$text.'
  594 + <br />
  595 + <br />
  596 + &#160;&#160;&#160;&#160;'.$links.'
  597 + <br />
  598 + <br />';
438 return $str; 599 return $str;
439 } 600 }
440 601
@@ -450,7 +611,7 @@ class SubscriptionContent { @@ -450,7 +611,7 @@ class SubscriptionContent {
450 $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions." . $info['event_type']); 611 $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions." . $info['event_type']);
451 // if, for some reason, this doesn't actually work, use the "generic" title. 612 // if, for some reason, this doesn't actually work, use the "generic" title.
452 if (PEAR::isError($oTemplate)) { 613 if (PEAR::isError($oTemplate)) {
453 - $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic"); 614 + $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic");
454 } 615 }
455 // FIXME we need to specify the i18n by user. 616 // FIXME we need to specify the i18n by user.
456 617
@@ -487,7 +648,9 @@ class SubscriptionContent { @@ -487,7 +648,9 @@ class SubscriptionContent {
487 648
488 649
489 function _getSubscriptionData($oKTNotification) { 650 function _getSubscriptionData($oKTNotification) {
490 - $info = array( 651 + $appName = APP_NAME;
  652 +
  653 + $info = array(
491 'object_name' => $oKTNotification->getLabel(), 654 'object_name' => $oKTNotification->getLabel(),
492 'event_type' => $oKTNotification->getStrData1(), 655 'event_type' => $oKTNotification->getStrData1(),
493 'location_name' => $oKTNotification->getStrData2(), 656 'location_name' => $oKTNotification->getStrData2(),
@@ -497,7 +660,9 @@ class SubscriptionContent { @@ -497,7 +660,9 @@ class SubscriptionContent {
497 'notify_id' => $oKTNotification->getId(), 660 'notify_id' => $oKTNotification->getId(),
498 ); 661 );
499 662
500 - $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name']; 663 +// $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name'];
  664 + $info['title'] = $appName.': '._kt('Subscription notification for').' "'.$info['object_name'].'" - '.$this->_eventTypeNames[$info['event_type']];
  665 +
501 666
502 if ($info['actor_id'] !== null) { 667 if ($info['actor_id'] !== null) {
503 $oTempUser = User::get($info['actor_id']); 668 $oTempUser = User::get($info['actor_id']);
plugins/ktstandard/KTEmail.php
@@ -140,6 +140,7 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo @@ -140,6 +140,7 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo
140 $oSendingUser = User::get($_SESSION['userID']); 140 $oSendingUser = User::get($_SESSION['userID']);
141 141
142 // Create email content 142 // Create email content
  143 +/*
143 $sMessage = '<font face="arial" size="2">'; 144 $sMessage = '<font face="arial" size="2">';
144 $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); 145 $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the document entitled '%s'."), $oSendingUser->getName(), $sDocumentName);
145 $sMessage .= " \n"; 146 $sMessage .= " \n";
@@ -148,6 +149,25 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo @@ -148,6 +149,25 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo
148 $sMsgEnd .= '</font>'; 149 $sMsgEnd .= '</font>';
149 150
150 $sTitle = sprintf(_kt("Link (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); 151 $sTitle = sprintf(_kt("Link (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName());
  152 +*/
  153 + $sTitle = sprintf(_kt("%s wants to share a document using KnowledgeTree"), $oSendingUser->getName());
  154 +
  155 + $sMessage = '<br>
  156 + &#160;&#160;&#160;&#160;'._kt('Hello').',
  157 + <br />
  158 + <br />
  159 + &#160;&#160;&#160;&#160;'.sprintf(_kt('A KnowledgeTree user, %s, wants to share a document with you entitled "%s".'), $oSendingUser->getName(), $sDocumentName).'
  160 + <br />
  161 + <br />
  162 + &#160;&#160;&#160;&#160;<b>'._kt('Message').':</b>
  163 + <br />
  164 + <br />
  165 + &#160;&#160;&#160;&#160;'.$sComment.'
  166 + <br />
  167 + <br />
  168 + &#160;&#160;&#160;&#160;'._kt('<b>KnowledgeTree is easy to use open source document management software</b><br />&#160;&#160;&#160;&#160;that helps businesses collaborate, securely store all critical documents, address<br />&#160;&#160;&#160;&#160;compliance challenges, and improve business processes.').'
  169 + <br />
  170 + <br />';
151 171
152 $sEmail = null; 172 $sEmail = null;
153 $sEmailFrom = null; 173 $sEmailFrom = null;
@@ -172,9 +192,13 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo @@ -172,9 +192,13 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo
172 $oDownloadManager->set_session($session); 192 $oDownloadManager->set_session($session);
173 $link = $oDownloadManager->allow_download($iDocumentID); 193 $link = $oDownloadManager->allow_download($iDocumentID);
174 194
175 - $link = "<a href=\"{$link}\">{$link}</a>"; 195 +// $link = "<a href=\"{$link}\">{$link}</a>";
  196 + $links = '&#160;&#160;&#160;&#160;<a href="http://www.knowledgetree.com/products">'._kt('Learn More').'</a>';
  197 + $links.= "&#160;|&#160;<a href=\"{$link}\">"._kt('View Document')."</a>";
  198 + $links .= '&#160;|&#160;<a href="http://www.knowledgetree.com/node/39">'._kt('Download Free Trial').'</a><br /><br />';
176 199
177 - $sMsg = $sMessage.$link.$sMsgEnd; 200 +// $sMsg = $sMessage.$link.$sMsgEnd;
  201 + $sMsg = $sMessage.$links;
178 $res = $oEmail->send(array($sAddress), $sTitle, $sMsg); 202 $res = $oEmail->send(array($sAddress), $sTitle, $sMsg);
179 203
180 if (PEAR::isError($res)) { 204 if (PEAR::isError($res)) {
resources/css/kt-framing.css
@@ -52,8 +52,8 @@ body @@ -52,8 +52,8 @@ body
52 min-height: 800px; 52 min-height: 800px;
53 min-width: 600px; 53 min-width: 600px;
54 height: auto; 54 height: auto;
55 - background-image: url(../../resources/graphics/page_bg.png);  
56 - background-repeat: repeat-x; 55 +/* background-image: url(../../resources/graphics/page_bg.png);*/
  56 +/* background-repeat: repeat-x;*/
57 z-index: 1; 57 z-index: 1;
58 } 58 }
59 59
resources/graphics/ktlogo-topbar-right-transparent.png 0 → 100644

9.47 KB

templates/kt3/notifications/subscriptions.DownloadDocument.smarty 0 → 100644
  1 +<dt class="actionitem subscription">{$info.title|sanitize}</dt>
  2 +<dd class="actionmessage">
  3 +
  4 +<!-- could break this up. -->
  5 + {i18n arg_object_name=$info.object_name|sanitize}The document "#object_name#" {/i18n}{if ($info.location_name !== null)} {i18n arg_location_name=$info.location_name}in the folder "#location_name#" has been downloaded {/i18n}{/if}{if ($info.has_actor)} {i18n arg_actor_name=$info.actor_name}by #actor_name#{/i18n}{/if}.
  6 + <div class="actionoptions">
  7 + <div style="float:left; position: relative;">
  8 + {if !$is_broken}
  9 + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`"}">{i18n}View Document{/i18n}</a>
  10 + {else}
  11 + <span class="descriptiveText">{i18n}Document is no longer available{/i18n}</span>
  12 + {/if}
  13 +
  14 + &nbsp;|&nbsp;
  15 +
  16 + </div>
  17 + <div>
  18 +
  19 + <a href="{ktLink base="notify.php" query="id=`$info.notify_id`&notify_action=clear"}"
  20 + kt:deleteMessage="{i18n}Are you sure you wish to clear the notification?{/i18n}">
  21 + <span class="ktAction ktInline ktDelete"></span>{i18n}Clear Alert{/i18n}
  22 +
  23 + </a>
  24 +
  25 + </div>
  26 + </div>
  27 +</dd>