diff options
| author | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 04:56:31 +0000 |
|---|---|---|
| committer | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 04:56:31 +0000 |
| commit | db60c85506a212d5eae4ffc6eecf43ece2a9b7f9 (patch) | |
| tree | 441c9f624e4d6dd5beb28ce677c4955f5811022b | |
| download | messages-db60c85506a212d5eae4ffc6eecf43ece2a9b7f9.tar.gz messages-db60c85506a212d5eae4ffc6eecf43ece2a9b7f9.tar.bz2 messages-db60c85506a212d5eae4ffc6eecf43ece2a9b7f9.zip | |
IMPORT TikiPro CLYDE FINAL
| -rw-r--r-- | admin/schema_inc.php | 55 | ||||
| -rw-r--r-- | admin/upgrade_inc.php | 53 | ||||
| -rw-r--r-- | bit_setup_inc.php | 10 | ||||
| -rw-r--r-- | broadcast.php | 137 | ||||
| -rw-r--r-- | compose.php | 110 | ||||
| -rw-r--r-- | contact.php | 62 | ||||
| -rw-r--r-- | icons/flagged.png | bin | 0 -> 549 bytes | |||
| -rw-r--r-- | icons/mail.png | bin | 0 -> 308 bytes | |||
| -rw-r--r-- | icons/pkg_messu.png | bin | 0 -> 1859 bytes | |||
| -rw-r--r-- | icons/recieve_mail.png | bin | 0 -> 448 bytes | |||
| -rw-r--r-- | icons/send_mail.png | bin | 0 -> 433 bytes | |||
| -rw-r--r-- | index.php | 6 | ||||
| -rw-r--r-- | message_box.php | 107 | ||||
| -rw-r--r-- | messu_lib.php | 206 | ||||
| -rw-r--r-- | modules/mod_unread_messages.tpl | 8 | ||||
| -rw-r--r-- | read.php | 67 | ||||
| -rw-r--r-- | templates/contact.tpl | 35 | ||||
| -rw-r--r-- | templates/index.php | 6 | ||||
| -rw-r--r-- | templates/messu_broadcast.tpl | 55 | ||||
| -rw-r--r-- | templates/messu_compose.tpl | 84 | ||||
| -rw-r--r-- | templates/messu_mailbox.tpl | 105 | ||||
| -rw-r--r-- | templates/messu_message_notification.tpl | 8 | ||||
| -rw-r--r-- | templates/messu_nav.tpl | 9 | ||||
| -rw-r--r-- | templates/messu_read.tpl | 157 |
24 files changed, 1280 insertions, 0 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php new file mode 100644 index 0000000..905d995 --- /dev/null +++ b/admin/schema_inc.php @@ -0,0 +1,55 @@ +<?php + +$tables = array( + +'messu_messages' => " + msg_id I4 AUTO PRIMARY, + to_user_id I4 NOTNULL, + from_user_id I4 NOTNULL, + msg_to X, + msg_cc X, + msg_bcc X, + subject C(255), + body X, + hash C(32), + date I8, + is_read C(1), + is_replied C(1), + is_flagged C(1), + priority I4 +" +// CONSTRAINT ', CONSTRAINT tiki_messu_to_user_ref FOREIGN KEY (to_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id) +// , CONSTRAINT tiki_messu_from_user_ref FOREIGN KEY (from_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id)' + +); + +global $gBitInstaller; + +foreach( array_keys( $tables ) AS $tableName ) { + $gBitInstaller->registerSchemaTable( MESSU_PKG_NAME, $tableName, $tables[$tableName] ); +} + +$gBitInstaller->registerPackageInfo( MESSU_PKG_NAME, array( + 'description' => "An intra-site messaging system for users.", + 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>', + 'version' => '0.1', + 'state' => 'beta', + 'dependencies' => '', +) ); + + +// ### Default User Permissions +$gBitInstaller->registerUserPermissions( FISHEYE_PKG_NAME, array( + array('bit_p_messages', 'Can use the messaging system', 'registered', 'messu'), +) ); + +// ### Indexes +$indices = array ( + 'tiki_messu_to_user_id_idx' => array( 'table' => 'messu_messages', 'cols' => 'to_user_id', 'opts' => NULL ), + 'tiki_messu_from_user_id_idx' => array( 'table' => 'messu_messages', 'cols' => 'from_user_id', 'opts' => NULL ) +); +// TODO - SPIDERR - following seems to cause time _decrease_ cause bigint on postgres. need more investigation +// 'tiki_blog_posts_created_idx' => array( 'table' => 'tiki_blog_posts', 'cols' => 'created', 'opts' => NULL ), +$gBitInstaller->registerSchemaIndexes( MESSU_PKG_NAME, $indices ); + +?> diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php new file mode 100644 index 0000000..0010cd4 --- /dev/null +++ b/admin/upgrade_inc.php @@ -0,0 +1,53 @@ +<?php +global $gBitSystem, $gUpgradeFrom, $gUpgradeTo; + +$upgrades = array( + +'BONNIE' => array( + 'CLYDE' => array( +// STEP 1 +array( 'DATADICT' => array( +array( 'RENAMECOLUMN' => array( + 'messu_messages' => array( + '`msgId`' => '`msg_id` I4 AUTO', + '`isRead`' => '`is_read` VARCHAR(1)', + '`isReplied`' => '`is_replied` VARCHAR(1)', + '`isFlagged`' => '`is_flagged` VARCHAR(1)', + '`user_to`' => '`msg_to` X', + '`user_cc`' => '`msg_cc` X', + '`user_bcc`' => '`msg_bcc` X', + ), +)), +array( 'ALTER' => array( + 'messu_messages' => array( + 'to_user_id' => array( '`to_user_id`', 'I4' ), // , 'NOTNULL' ), + 'from_user_id' => array( '`from_user_id`', 'I4' ), // , 'NOTNULL' ), + ), +)) +)), + +// STEP 3 +array( 'QUERY' => + array( 'SQL92' => array( + "UPDATE `".BIT_DB_PREFIX."messu_messages` SET `to_user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."messu_messages`.`user`)", + "UPDATE `".BIT_DB_PREFIX."messu_messages` SET `from_user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."messu_messages`.`user_from`)", + ), +)), + +// STEP 4 +array( 'DATADICT' => array( + array( 'DROPCOLUMN' => array( + 'messu_messages' => array( '`user`', '`user_from`' ), + )), +)), + + ) +) +); + +if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) { + $gBitSystem->registerUpgrade( MESSU_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] ); +} + + +?> diff --git a/bit_setup_inc.php b/bit_setup_inc.php new file mode 100644 index 0000000..cb108fc --- /dev/null +++ b/bit_setup_inc.php @@ -0,0 +1,10 @@ +<?php +global $gBitSystem; +$gBitSystem->registerPackage( 'messu', dirname( __FILE__).'/' ); + +if( $gBitSystem->isPackageActive( 'messu' ) && $gBitUser->hasPermission( 'bit_p_messages' ) ) { + require_once( MESSU_PKG_PATH.'messu_lib.php' ); + $unreadMsgs = $messulib->user_unread_messages( $gBitUser->mUserId ); + $smarty->assign_by_ref( 'unreadMsgs', $unreadMsgs ); +} +?> diff --git a/broadcast.php b/broadcast.php new file mode 100644 index 0000000..27d711d --- /dev/null +++ b/broadcast.php @@ -0,0 +1,137 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_messages/broadcast.php,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. +require_once( '../bit_setup_inc.php' ); + +include_once( MESSU_PKG_PATH.'messu_lib.php' ); + +if (!$user) { + $smarty->assign('msg', tra("You are not logged in")); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +if ($feature_messages != 'y') { + $smarty->assign('msg', tra("This feature is disabled").": feature_messages"); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +if ($bit_p_broadcast != 'y') { + $smarty->assign('msg', tra("Permission denied")); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +if (!isset($_REQUEST['to'])) + $_REQUEST['to'] = ''; + +if (!isset($_REQUEST['cc'])) + $_REQUEST['cc'] = ''; + +if (!isset($_REQUEST['bcc'])) + $_REQUEST['bcc'] = ''; + +if (!isset($_REQUEST['subject'])) + $_REQUEST['subject'] = ''; + +if (!isset($_REQUEST['body'])) + $_REQUEST['body'] = ''; + +if (!isset($_REQUEST['priority'])) + $_REQUEST['priority'] = 3; + +$smarty->assign('to', $_REQUEST['to']); +$smarty->assign('cc', $_REQUEST['cc']); +$smarty->assign('bcc', $_REQUEST['bcc']); +$smarty->assign('subject', $_REQUEST['subject']); +$smarty->assign('body', $_REQUEST['body']); +$smarty->assign('priority', $_REQUEST['priority']); + +$gBitSystem->display( 'bitpackage:messu/messu_broadcast.tpl'); + +$smarty->assign('sent', 0); + +if (isset($_REQUEST['reply']) || isset($_REQUEST['replyall'])) { + $messulib->flag_message($user, $_REQUEST['msg_id'], 'is_replied', 'y'); +} + +if (isset($_REQUEST['group'])) { + if ($_REQUEST['group'] == 'all') { + $a_all_users = $userlib->get_users(0, -1, 'login_desc', ''); + + $all_users = array(); + + foreach ($a_all_users['data'] as $a_user) { + $all_users[] = $a_user['user']; + } + } else { + $all_users = $userlib->get_group_users($_REQUEST['group']); + } +} + +if (isset($_REQUEST['send'])) { + + $smarty->assign('sent', 1); + + $message = ''; + + // Validation: + // must have a subject or body non-empty (or both) + if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) { + $smarty->assign('message', tra('ERROR: Either the subject or body must be non-empty')); + + die; + } + + // Remove invalid users from the to, cc and bcc fields + $users = array(); + + foreach ($all_users as $a_user) { + if (!empty($a_user)) { + if ($messulib->user_exists($a_user)) { + if ($messulib->get_user_preference($a_user, 'allowMsgs', 'y')) { + $users[] = $a_user; + } else { + // TODO: needs translation as soon as there is a solution for strings with embedded variables + $message .= "User $a_user can not receive messages<br/>"; + } + } else { + $message .= tra("Invalid user"). "$a_user<br/>"; + } + } + } + + $users = array_unique($users); + + // Validation: either to, cc or bcc must have a valid user + if (count($users) > 0) { + $message .= tra("Message will be sent to: <ul><li>"). implode('<li> ', $users). "</ul><br/>"; + } else { + $message = tra('ERROR: No valid users to send the message'); + + $smarty->assign('message', $message); + die; + } + + // Insert the message in the inboxes of each user + foreach ($users as $a_user) { + $messulib->post_message($a_user, $user, $a_user, '', $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority']); + } + + $smarty->assign('message', $message); +} + + +$groups = $userlib->get_groups(0, -1, 'group_name_asc', ''); +$smarty->assign_by_ref('groups', $groups["data"]); + +$section = 'user_messages'; +?> diff --git a/compose.php b/compose.php new file mode 100644 index 0000000..b10dfbb --- /dev/null +++ b/compose.php @@ -0,0 +1,110 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_messages/compose.php,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. +require_once( '../bit_setup_inc.php' ); +require_once( MESSU_PKG_PATH.'messu_lib.php' ); +require_once( USERS_PKG_PATH.'BitUser.php' ); + +if( !$gBitUser->isRegistered() ) { + $smarty->assign('msg', tra("You are not logged in")); + $gBitSystem->display( 'error.tpl' ); + die; +} + +$gBitSystem->isPackageActive( 'messu', TRUE ); +$gBitSystem->verifyPermission( 'bit_p_messages' ); + +// Configure quicktags list +if ($gBitSystem->getPreference('package_quicktags','n') == 'y') { + include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' ); +} + +if (!isset($_REQUEST['to'])) + $_REQUEST['to'] = ''; + +if (!isset($_REQUEST['cc'])) + $_REQUEST['cc'] = ''; + +if (!isset($_REQUEST['bcc'])) + $_REQUEST['bcc'] = ''; + +if (!isset($_REQUEST['subject'])) + $_REQUEST['subject'] = ''; + +if (!isset($_REQUEST['body'])) + $_REQUEST['body'] = ''; + +if (!isset($_REQUEST['priority'])) + $_REQUEST['priority'] = 3; + +if( !empty( $_REQUEST['action']['reply'] ) || !empty( $_REQUEST['action']['replyall'] ) ) { + $replyToUser = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST['replyto'] ) ); + $_REQUEST['to'] = $replyToUser['login']; + if( !empty( $_REQUEST['action']['replyall'] ) ) { + $_REQUEST['cc'] = preg_replace( "/".$replyToUser['login'].",/", "", $_REQUEST['replyallto'] ); + $_REQUEST['cc'] = preg_replace( "/".$gBitUser->mUsername.",/", "", $_REQUEST['cc'] ); + } +} + +// Strip Re:Re:Re: from subject +if(isset($_REQUEST['action']['reply']) || isset($_REQUEST['action']['replyall'])) { + $_REQUEST['subject'] = tra("Re: ").preg_replace("/^(".tra("Re: ").")+/i", "", $_REQUEST['subject']); +} + +$smarty->assign('to', $_REQUEST['to']); +$smarty->assign('cc', $_REQUEST['cc']); +$smarty->assign('bcc', $_REQUEST['bcc']); +$smarty->assign('subject', $_REQUEST['subject']); +$smarty->assign('body', $_REQUEST['body']); +$smarty->assign('priority', $_REQUEST['priority']); + +$smarty->assign('sent', 0); +$feedback = array(); +$smarty->assign_by_ref( 'feedback', $feedback ); + +if (isset($_REQUEST['replyto']) || isset($_REQUEST['replyallto'])) { + $messulib->flag_message( $gBitUser->mUserId, $_REQUEST['msg_id'], 'is_replied', 'y' ); +} + +if (isset($_REQUEST['send'])) { + $message = ''; + // Validation: + // must have a subject or body non-empty (or both) + if ( !empty($_REQUEST['subject']) && !empty($_REQUEST['body'])) { + // Parse the to, cc and bcc fields into an array + $arrTo = explode( ',', preg_replace( '/ /', '', $_REQUEST['to'] ) ); + $arrCc = explode( ',', preg_replace( '/ /', '', $_REQUEST['cc'] ) ); + $arrBcc = explode( ',', preg_replace( '/ /', '', $_REQUEST['bcc'] ) ); + + $toUsers = array_unique( array_merge( $arrTo, $arrCc, $arrBcc ) ); + // Validation: either to, cc or bcc must have a valid user + if( count($toUsers) ) { + // Insert the message in the inboxes of each user + foreach ($toUsers as $toUser) { + if( !empty( $toUser ) ) { + if( $messulib->post_message( $toUser, $_REQUEST['to'], $_REQUEST['cc'], $_REQUEST['bcc'], $_REQUEST['subject'], $_REQUEST['body'],$_REQUEST['priority'] ) ) { + $feedback['success'][] = tra( "Message will be sent to: " ).' '.$toUser; + } else { + $feedback['error'][] = $messulib->mErrors['compose']; + } + } + } + $smarty->assign('sent', 1); + } else { + $feedback['error'][] = tra('ERROR: No valid users to send the message.'); + } + } else { + $feedback['error'][] = tra( 'ERROR: Either the subject or body must contain text.' ); + } +} + +$section = 'user_messages'; + + + +$gBitSystem->display( 'bitpackage:messu/messu_compose.tpl', 'Compose Message' ); +?> diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..7db2dfb --- /dev/null +++ b/contact.php @@ -0,0 +1,62 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_messages/contact.php,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. + +// Initialization +require_once( '../bit_setup_inc.php' ); + +include_once( MESSU_PKG_PATH.'messu_lib.php' ); + +if (!$user) { + $smarty->assign('msg', tra("You are not logged in")); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +if ($feature_contact != 'y') { + $smarty->assign('msg', tra("This feature is disabled").": feature_contact"); + + $gBitSystem->display( 'error.tpl' ); + die; +} + +$gBitSystem->display( 'bitpackage:messu/contact.tpl'); + +$email = $userlib->get_user_email($contact_user); +$smarty->assign('email', $email); + +if ($user and $feature_messages == 'y' and $bit_p_messages == 'y') { + $smarty->assign('sent', 0); + + if (isset($_REQUEST['send'])) { + + $smarty->assign('sent', 1); + + $message = ''; + + // Validation: + // must have a subject or body non-empty (or both) + if (empty($_REQUEST['subject']) && empty($_REQUEST['body'])) { + $smarty->assign('message', tra('ERROR: Either the subject or body must be non-empty')); + + die; + } + + $message = tra('Message sent to'). ':' . $contact_user . '<br/>'; + $messulib->post_message($contact_user, $user, $_REQUEST['to'], + '', $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority']); + + $smarty->assign('message', $message); + } +} + +$smarty->assign('priority', 3); + + + +?> diff --git a/icons/flagged.png b/icons/flagged.png Binary files differnew file mode 100644 index 0000000..b0173cc --- /dev/null +++ b/icons/flagged.png diff --git a/icons/mail.png b/icons/mail.png Binary files differnew file mode 100644 index 0000000..bb6bf86 --- /dev/null +++ b/icons/mail.png diff --git a/icons/pkg_messu.png b/icons/pkg_messu.png Binary files differnew file mode 100644 index 0000000..280fc92 --- /dev/null +++ b/icons/pkg_messu.png diff --git a/icons/recieve_mail.png b/icons/recieve_mail.png Binary files differnew file mode 100644 index 0000000..4df46bb --- /dev/null +++ b/icons/recieve_mail.png diff --git a/icons/send_mail.png b/icons/send_mail.png Binary files differnew file mode 100644 index 0000000..47a60f8 --- /dev/null +++ b/icons/send_mail.png diff --git a/index.php b/index.php new file mode 100644 index 0000000..3e305fe --- /dev/null +++ b/index.php @@ -0,0 +1,6 @@ +<?php + + // This is not a package. + header ("location: ../index.php"); + +?>
\ No newline at end of file diff --git a/message_box.php b/message_box.php new file mode 100644 index 0000000..faf79bb --- /dev/null +++ b/message_box.php @@ -0,0 +1,107 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_messages/message_box.php,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. +require_once( '../bit_setup_inc.php' ); +require_once( MESSU_PKG_PATH.'messu_lib.php' ); + +if( !$gBitUser->isRegistered() ) { + $smarty->assign('msg', tra("You are not logged in")); + $gBitSystem->display( 'error.tpl' ); + die; +} + +$gBitSystem->isPackageActive( 'messu', TRUE ); +$gBitSystem->verifyPermission( 'bit_p_messages' ); + +$maxRecords = $gBitSystem->getPreference( 'maxRecords', 20 ); + +// Mark messages if the mark button was pressed +if (isset($_REQUEST["mark"]) && isset($_REQUEST["msg"])) { + foreach (array_keys($_REQUEST["msg"])as $msg) { + $parts = explode('_', $_REQUEST['action']); + $messulib->flag_message($gBitUser->mUserId, $msg, $parts[0].'_'.$parts[1], $parts[2]); + } +} + +// Delete messages if the delete button was pressed +if (isset($_REQUEST["delete"]) && isset($_REQUEST["msg"])) { + + foreach (array_keys($_REQUEST["msg"])as $msg) { + $messulib->delete_message( $gBitUser->mUserId, $msg ); + } +} + +if (isset($_REQUEST['filter'])) { + if ($_REQUEST['flags'] != '') { + $parts = explode('_', $_REQUEST['flags']); + + $_REQUEST['flag'] = $parts[0]; + $_REQUEST['flagval'] = $parts[1]; + } +} + +if (!isset($_REQUEST["priority"])) + $_REQUEST["priority"] = ''; + +if (!isset($_REQUEST["flag"])) + $_REQUEST["flag"] = ''; + +if (!isset($_REQUEST["flagval"])) + $_REQUEST["flagval"] = ''; + +if ( empty( $_REQUEST["sort_mode"] ) ) { + $sort_mode = 'date_desc'; +} else { + $sort_mode = $_REQUEST["sort_mode"]; +} + +if (!isset($_REQUEST["offset"])) { + $offset = 0; +} else { + $offset = $_REQUEST["offset"]; +} + +if (isset($_REQUEST["find"])) { + $find = $_REQUEST["find"]; +} else { + $find = ''; +} + +$smarty->assign_by_ref('flag', $_REQUEST['flag']); +$smarty->assign_by_ref('priority', $_REQUEST['priority']); +$smarty->assign_by_ref('flagval', $_REQUEST['flagval']); +$smarty->assign_by_ref('offset', $offset); +$smarty->assign_by_ref('sort_mode', $sort_mode); +$smarty->assign('find', $find); +// What are we paginating: items +$items = $messulib->list_messages( $gBitUser->mUserId, $offset, $maxRecords, $sort_mode, + $find, $_REQUEST["flag"], $_REQUEST["flagval"], $_REQUEST['priority']); + +$cant_pages = ceil($items["cant"] / $maxRecords); +$smarty->assign_by_ref('cant_pages', $cant_pages); +$smarty->assign('actual_page', 1 + ($offset / $maxRecords)); + +if ($items["cant"] > ($offset + $maxRecords)) { + $smarty->assign('next_offset', $offset + $maxRecords); +} else { + $smarty->assign('next_offset', -1); +} + +if ($offset > 0) { + $smarty->assign('prev_offset', $offset - $maxRecords); +} else { + $smarty->assign('prev_offset', -1); +} + +$smarty->assign_by_ref('items', $items["data"]); + +$section = 'user_messages'; + + + +$gBitSystem->display( 'bitpackage:messu/messu_mailbox.tpl', 'Message box' ); +?> diff --git a/messu_lib.php b/messu_lib.php new file mode 100644 index 0000000..0e0d30e --- /dev/null +++ b/messu_lib.php @@ -0,0 +1,206 @@ +<?php + +class Messu extends BitBase { + + function Messu() { + BitBase::BitBase(); + } + + function post_message( $pToLogin, $to, $cc, $bcc, $subject, $body, $priority) { + global $smarty, $gBitUser, $gBitSystem; + + $userInfo = $gBitUser->getUserInfo( array('login' => $pToLogin) ); + if( $userInfo ) { + if ($gBitUser->getPreference('allowMsgs', 'y', $userInfo['user_id'] )) { + $subject = strip_tags($subject); + $body = strip_tags($body, '<a><b><img><i>'); + // Prevent duplicates + $hash = md5($subject . $body); + + if ($this->getOne("select count(*) from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? and `from_user_id`=? and `hash`=?", array( $userInfo['user_id'], $gBitUser->mUserId, $hash ) ) ) { + $this->mErrors['compose'] = $pToLogin.' '.tra( 'has already received this message' ); + } else { + + $now = date('U'); + $query = "INSERT INTO `".BIT_DB_PREFIX."messu_messages` + (`to_user_id`, `from_user_id`, `msg_to`, `msg_cc`, `msg_bcc`, `subject`, `body`, `date`, `is_read`, `is_replied`, `is_flagged`, `priority`, `hash` ) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $this->query( $query, array( $userInfo['user_id'], $gBitUser->mUserId, $to, $cc, $bcc, $subject, $body,(int) $now,'n','n','n',(int) $priority,$hash ) ); + + // Now check if the user should be notified by email + $foo = parse_url($_SERVER["REQUEST_URI"]); + $machine = httpPrefix(). $foo["path"]; + + if ($gBitUser->getPreference( 'minPrio', 3 ) <= $priority) { + $mailSite = $gBitSystem->getPreference( 'feature_server_name', $_SERVER["SERVER_NAME"] ); + $smarty->assign( 'mail_site', $mailSite ); + $smarty->assign( 'mail_machine', $machine); + $smarty->assign( 'mail_date', date("U")); + $smarty->assign( 'mail_user', stripslashes( $userInfo['login'] ) ); + $smarty->assign( 'mail_from', stripslashes( $gBitUser->getDisplayName() ) ); + $smarty->assign( 'mail_subject', stripslashes($subject)); + $smarty->assign( 'mail_body', stripslashes($body)); + $mail_data = $smarty->fetch('bitpackage:messu/messu_message_notification.tpl'); + + if( !empty( $userInfo['email'] ) ) { + @mail($userInfo['email'], tra('New message arrived from '). $mailSite, $mail_data, + "From: ".$gBitSystem->getPreference( 'sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n"); + } + } + } + } else { + // TODO: needs translation as soon as there is a solution for strings with embedded variables + $this->mErrors['compose'] = $pToLogin.' '.tra( 'can not receive messages' ); + } + } else { + $this->mErrors['compose'] .= tra( 'Unknown user' ).": $pToLogin"; + } + + return( count( $this->mErrors ) == 0 ); + } + + function list_messages( $pUserId, $offset, $maxRecords, $sort_mode, $find, $flag = '', $flagval = '', $prio = '' ) { + $bindvars = array($pUserId); + $mid=""; + if ($prio) { + $mid = " and priority=? "; + $bindvars[] = $prio; + } + + if ($flag) { + // Process the flags + $mid.= " and `$flag`=? "; + $bindvars[] = $flagval; + } + if ($find) { + $findesc = '%'.strtoupper( $find ).'%'; + $mid.= " and (UPPER(`subject`) like ? or UPPER(`body`) like ?)"; + $bindvars[] = $findesc; + $bindvars[] = $findesc; + } + + $query = "SELECT uu.`login` AS `user`, uu.`real_name`, uu.`user_id`, mm.* from `".BIT_DB_PREFIX."messu_messages` mm INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON( mm.`from_user_id`=uu.`user_id` ) + WHERE `to_user_id`=? $mid + ORDER BY ".$this->convert_sortmode($sort_mode).",".$this->convert_sortmode("msg_id_desc"); + $query_cant = "select count(*) from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? $mid"; + $result = $this->query($query,$bindvars,$maxRecords,$offset); + $cant = $this->getOne($query_cant,$bindvars); + $ret = array(); + + while ($res = $result->fetchRow()) { + $res["len"] = strlen($res["body"]); + + if (empty($res['subject'])) + $res['subject'] = tra('NONE'); + + $ret[] = $res; + } + + $retval = array(); + $retval["data"] = $ret; + $retval["cant"] = $cant; + return $retval; + } + + function flag_message( $pUserId, $msg_id, $flag, $val ) { + if (!$msg_id) + return false; + $query = "update `".BIT_DB_PREFIX."messu_messages` set `$flag`=? where `to_user_id`=? and `msg_id`=?"; + $this->query($query,array($val,$pUserId,(int)$msg_id)); + } + + function delete_message($pUserId, $msg_id) { + if (!$msg_id) + return false; + $query = "delete from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? and `msg_id`=?"; + $this->query($query,array($pUserId,(int)$msg_id)); + } + + function get_next_message($pUserId, $msg_id, $sort_mode, $find, $flag, $flagval, $prio) { + if (!$msg_id) + return 0; + + $mid = ""; + $bindvars = array($pUserId,(int)$msg_id); + if ($prio) { + $mid.= " and priority=? "; + $bindvars[] = $prio; + } + + if ($flag) { + // Process the flags + $mid.= " and `$flag`=? "; + $bindvars[] = $flagval; + } + if ($find) { + $findesc = '%'.strtoupper( $find ).'%'; + $mid.= " and (UPPER(`subject`) like ? or UPPER(`body`) like ?)"; + $bindvars[] = $findesc; + $bindvars[] = $findesc; + } + + $query = "select min(`msg_id`) as `nextmsg` from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? and `msg_id` > ? $mid "; + $result = $this->query($query,$bindvars,1,0); + $res = $result->fetchRow(); + + if (!$res) + return false; + return $res['nextmsg']; + } + + function get_prev_message($pUserId, $msg_id, $sort_mode, $find, $flag, $flagval, $prio) { + if (!$msg_id) + return 0; + + $bindvars = array( $pUserId, (int)$msg_id ); + $mid=""; + if ($prio) { + $mid.= " AND priority=? "; + $bindvars[] = $prio; + } + + if ($flag) { + // Process the flags + $mid.= " AND `$flag`=? "; + $bindvars[] = $flagval; + } + if ($find) { + $findesc = '%'.strtoupper( $find ).'%'; + $mid.= " and (UPPER(`subject`) like ? or UPPER(`body`) like ?)"; + $bindvars[] = $findesc; + $bindvars[] = $findesc; + } + $query = "select max(`msg_id`) as `prevmsg` from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? and `msg_id` < ? $mid"; + $result = $this->query( $query, $bindvars, 1, 0 ); + $res = $result->fetchRow(); + + if (!$res) + return false; + + return $res['prevmsg']; + } + + function get_message( $pUserId, $msg_id ) { + $bindvars = array( $pUserId, (int)$msg_id ); + $query = "select * from `".BIT_DB_PREFIX."messu_messages` WHERE `to_user_id`=? and `msg_id`=?"; + $result = $this->query($query,$bindvars); + $res = $result->fetchRow(); + $content = new LibertyContent(); + $res['parsed'] = $content->parseData( $res['body'], PLUGIN_GUID_TIKIWIKI ); + + if (empty($res['subject'])) + $res['subject'] = tra('NONE'); + + return $res; + } + + /*shared*/ + function user_unread_messages( $pUserId ) { + return $this->getOne( "select count( * ) from `".BIT_DB_PREFIX."messu_messages` where `to_user_id`=? and `is_read`=?",array( $pUserId,'n' ) ); + } +} + +global $messulib; +$messulib = new Messu(); + +?> diff --git a/modules/mod_unread_messages.tpl b/modules/mod_unread_messages.tpl new file mode 100644 index 0000000..06d46e7 --- /dev/null +++ b/modules/mod_unread_messages.tpl @@ -0,0 +1,8 @@ +{* $Header: /cvsroot/bitweaver/_bit_messages/modules/mod_unread_messages.tpl,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ *} +{if $gBitUser->isRegistered() and $gBitSystem->isPackageActive( 'messu') and $gBitUser->hasPermission( 'bit_p_messages' )} + {bitmodule title="$moduleTitle" name="messages_unread_messages"} + <a href="{$gBitLoc.MESSU_PKG_URL}message_box.php"> + {tr}You have <strong>{$unreadMsgs} unread</strong> {if $unreadMsgs eq '1'}message{else}messages{/if}{/tr} + </a> + {/bitmodule} +{/if} diff --git a/read.php b/read.php new file mode 100644 index 0000000..de11603 --- /dev/null +++ b/read.php @@ -0,0 +1,67 @@ +<?php + +// $Header: /cvsroot/bitweaver/_bit_messages/read.php,v 1.1 2005/06/19 04:56:31 bitweaver Exp $ + +// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. +// All Rights Reserved. See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. +require_once( '../bit_setup_inc.php' ); +require_once( MESSU_PKG_PATH.'messu_lib.php' ); + +if( !$gBitUser->isRegistered() ) { + $smarty->assign('msg', tra("You are not logged in")); + $gBitSystem->display( 'error.tpl' ); + die; +} + +$gBitSystem->isPackageActive( 'messu', TRUE ); +$gBitSystem->verifyPermission( 'bit_p_messages' ); + +if (isset($_REQUEST["msgdel"])) { + + $messulib->delete_message($gBitUser->mUserId, $_REQUEST['msgdel']); +} + +$sort_mode = !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : ''; +$find = !empty( $_REQUEST['find'] ) ? $_REQUEST['find'] : ''; +$flag = !empty( $_REQUEST['flag'] ) ? $_REQUEST['flag'] : ''; +$offset = !empty( $_REQUEST['offset'] ) ? $_REQUEST['offset'] : ''; +$flagval = !empty( $_REQUEST['flagval'] ) ? $_REQUEST['flagval'] : ''; +$priority = !empty( $_REQUEST['priority'] ) ? $_REQUEST['priority'] : ''; + +$smarty->assign('sort_mode', $sort_mode ); +$smarty->assign('find', $find ); +$smarty->assign('flag', $flag ); +$smarty->assign('offset', $offset ); +$smarty->assign('flagval', $flagval ); +$smarty->assign('priority', $priority ); +$smarty->assign('legend', ''); + +if (!isset($_REQUEST['msg_id']) || $_REQUEST['msg_id'] == 0) { + $smarty->assign('legend', tra("No more messages")); + $gBitSystem->display( 'messu-read.tpl'); + die; +} + +if (isset($_REQUEST['act'])) { + $messulib->flag_message( $gBitUser->mUserId, $_REQUEST['msg_id'], $_REQUEST['act'], $_REQUEST['actval'] ); +} + +// Using the sort_mode, flag, flagval and find get the next and prev messages +$smarty->assign('msg_id', $_REQUEST['msg_id']); +$next = $messulib->get_next_message( $gBitUser->mUserId, $_REQUEST['msg_id'], $sort_mode, $find, $flag, $flagval, $priority ); +$prev = $messulib->get_prev_message( $gBitUser->mUserId, $_REQUEST['msg_id'], $sort_mode, $find, $flag, $flagval, $priority ); +$smarty->assign('next', $next); +$smarty->assign('prev', $prev); + +// Mark the message as read +$messulib->flag_message( $gBitUser->mUserId, $_REQUEST['msg_id'], 'is_read', 'y'); + +// Get the message and assign its data to template vars +$msg = $messulib->get_message( $gBitUser->mUserId, $_REQUEST['msg_id']); +$smarty->assign('msg', $msg); + +$section = 'user_messages'; +$gBitSystem->display( 'bitpackage:messu/messu_read.tpl'); + +?> diff --git a/templates/contact.tpl b/templates/contact.tpl new file mode 100644 index 0000000..757a142 --- /dev/null +++ b/templates/contact.tpl @@ -0,0 +1,35 @@ +<a class="pagetitle" href="{$gBitLoc.MESSU_PKG_URL}contact.php">{tr}Contact us{/tr}</a><br /><br /> +{if $gBitSystemPrefs.feature_messages eq 'y' and $bit_p_messages eq 'y'} +{if $message} +{$message} +{/if} + +<h2>{tr}Send a message to us{/tr}</h2> + <form method="post" action="{$gBitLoc.MESSU_PKG_URL}contact.php"> + <input type="hidden" name="to" value="{$contact_user|escape}" /> + <table class="panel"> + <tr> + <td>{tr}Priority:{/tr}</td><td> + <select name="priority"> + <option value="1" {if $priority eq 1}selected="selected"{/if}>{tr}1 -Lowest-{/tr}</option> + <option value="2" {if $priority eq 2}selected="selected"{/if}>{tr}2 -Low-{/tr}</option> + <option value="3" {if $priority eq 3}selected="selected"{/if}>{tr}3 -Normal-{/tr}</option> + <option value="4" {if $priority eq 4}selected="selected"{/if}>{tr}4 -High-{/tr}</option> + <option value="5" {if $priority eq 5}selected="selected"{/if}>{tr}5 -Very High-{/tr}</option> + </select> + <input type="submit" name="send" value="{tr}send{/tr}" /> + </td> + </tr> + <tr> + <td>{tr}Subject{/tr}:</td><td><input type="text" name="subject" value="" size="80" maxlength="255" /></td> + </tr> + <tr><td> </td> + <td><textarea rows="20" cols="80" name="body"></textarea></td> + </tr> +</table> +</form> +{/if} +{if strlen($email)>0} +<h2>{tr}Contact us via email{/tr}</h2> +{mailto address="$email" encode="javascript" text="click here to send us an email"} +{/if} diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 0000000..3e305fe --- /dev/null +++ b/templates/index.php @@ -0,0 +1,6 @@ +<?php + + // This is not a package. + header ("location: ../index.php"); + +?>
\ No newline at end of file diff --git a/templates/messu_broadcast.tpl b/templates/messu_broadcast.tpl new file mode 100644 index 0000000..6480966 --- /dev/null +++ b/templates/messu_broadcast.tpl @@ -0,0 +1,55 @@ +<div class="floaticon">{bithelp}</div> +<div class="contain usermessages"> +<div class="header"> +<h1><a href="{$gBitLoc.MESSU_PKG_URL}broadcast.php">{tr}Broadcast message{/tr}</a></h1> +</div> + +{include file="bitpackage:users/my_bitweaver_bar.tpl"} +{include file="bitpackage:messu/messu_nav.tpl"} + +<div class="body"> + +{if $sent} + {$message} +{else} +<form action="{$gBitLoc.MESSU_PKG_URL}broadcast.php" method="post"> +<table class="panel"> + <tr> + <td><label for="broadcast-group">{tr}Group{/tr}:</label></td> + <td> + <select name="group" id="broadcast-group"> + {if $bit_p_broadcast_all eq 'y'} + <option value="all" selected="selected">{tr}All users{/tr}</option> + {/if} + {section name=ix loop=$groups} + <option value="{$groups[ix].group_name|escape}">{$groups[ix].group_name}</option> + {/section} + </select> + </td> + </tr> + <tr> + <td><label for="broadcast-priority">{tr}Priority{/tr}:</label></td><td> + <select name="priority" id="broadcast-priority"> + <option value="1" {if $priority eq 1}selected="selected"{/if}>{tr}1 -Lowest-{/tr}</option> + <option value="2" {if $priority eq 2}selected="selected"{/if}>{tr}2 -Low-{/tr}</option> + <option value="3" {if $priority eq 3}selected="selected"{/if}>{tr}3 -Normal-{/tr}</option> + <option value="4" {if $priority eq 4}selected="selected"{/if}>{tr}4 -High-{/tr}</option> + <option value="5" {if $priority eq 5}selected="selected"{/if}>{tr}5 -Very High-{/tr}</option> + </select> + </td> + </tr> + <tr> + <td><label for="broadcast-subject">{tr}Subject{/tr}:</label></td><td><input type="text" name="subject" id="broadcast-subject" value="{$subject|escape}" size="80" maxlength="255"/></td> + </tr> + <tr> + <td><label for="broadcast-body">{tr}Body{/tr}:</label></td><td align="center"><textarea rows="20" cols="80" name="body">{$body|escape}</textarea></td> + </tr> + <tr class="panelsubmitrow"> + <td colspan="2"><input type="submit" name="send" value="{tr}send message{/tr}" /></td> + </tr> +</table> +</form> +{/if} + +</div> {* end .body *} +</div> {* end .messages *} diff --git a/templates/messu_compose.tpl b/templates/messu_compose.tpl new file mode 100644 index 0000000..bd7af2f --- /dev/null +++ b/templates/messu_compose.tpl @@ -0,0 +1,84 @@ +{strip} +<div class="floaticon">{bithelp}</div> +<div class="edit usermessages"> + <div class="header"> + <h1>{tr}Compose message{/tr}</h1> + </div> + + {include file="bitpackage:users/my_bitweaver_bar.tpl"} + + <div class="body"> + {formfeedback hash=$feedback} + + {if $feedback} + {tr}Return to your {smartlink ititle="Message Box" ipackage=messu ifile="message_box.php"}{/tr} + {/if} + + {if !$feedback or $feedback.error} + {form legend="Compose Private Message"} + <div class="row"> + {formlabel label="To" for="to"} + {forminput} + <input type="text" name="to" id="to" size="30" value="{$to}" /> + {formhelp note="Multiple usernames can be added using commas."} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Carbon Copy" for="cc"} + {forminput} + <input type="text" name="cc" id="cc" size="30" value="{$cc}" /> + {/forminput} + </div> + + <div class="row"> + {formlabel label="Blind Carbon Copy" for="bcc"} + {forminput} + <input type="text" name="bcc" id="bcc" size="30" value="{$bcc}" /> + {/forminput} + </div> + + <div class="row"> + {formlabel label="Priority" for="priority"} + {forminput} + <select name="priority" id="mess-prio"> + <option value="1" {if $priority eq 1}selected="selected"{/if}>{tr}1 -Lowest-{/tr}</option> + <option value="2" {if $priority eq 2}selected="selected"{/if}>{tr}2 -Low-{/tr}</option> + <option value="3" {if $priority eq 3 or !$priority}selected="selected"{/if}>{tr}3 -Normal-{/tr}</option> + <option value="4" {if $priority eq 4}selected="selected"{/if}>{tr}4 -High-{/tr}</option> + <option value="5" {if $priority eq 5}selected="selected"{/if}>{tr}5 -Very High-{/tr}</option> + </select> + {/forminput} + </div> + + <div class="row"> + {formlabel label="Subject" for="subject"} + {forminput} + <input type="text" name="subject" id="subject" size="52" value="{$subject|escape}" /> + {/forminput} + </div> + + {* only display quicktags if tikiwiki quicktags are available *} + {if $gBitSystem->isPackageActive( 'quicktags' ) and $gLibertySystem->mPlugins.tikiwiki.is_active eq 'y'} + {include file="bitpackage:quicktags/quicktags_full.tpl" textarea_id=message_body default_format=tikiwiki} + {/if} + + {* only display quicktags if tikiwiki quicktags are available *} + {if $gBitSystem->isPackageActive( 'smileys' ) and $gLibertySystem->mPlugins.tikiwiki.is_active eq 'y'} + {include file="bitpackage:smileys/smileys_full.tpl" textarea_id=message_body default_format=tikiwiki} + {/if} + + <div class="row"> + {forminput} + <textarea rows="20" cols="80" name="body" id="message_body">{$body|escape}</textarea> + {/forminput} + </div> + + <div class="row submit"> + <input type="submit" name="send" value="{tr}Send Message{/tr}" /> + </div> + {/form} + {/if} + </div><!-- end .body --> +</div><!-- end .usermessages --> +{/strip} diff --git a/templates/messu_mailbox.tpl b/templates/messu_mailbox.tpl new file mode 100644 index 0000000..bc38f6a --- /dev/null +++ b/templates/messu_mailbox.tpl @@ -0,0 +1,105 @@ +{strip} +<div class="floaticon">{bithelp}</div> +<div class="listing usermessages"> + <div class="header"> + <h1>{tr}Messages{/tr}</h1> + </div> + + {include file="bitpackage:users/my_bitweaver_bar.tpl"} + + <div class="body"> + {form legend="Your Personal Messages"} + <input type="hidden" name="offset" value="{$offset|escape}" /> + <input type="hidden" name="find" value="{$find|escape}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" /> + <input type="hidden" name="flag" value="{$flag|escape}" /> + <input type="hidden" name="flagval" value="{$flagval|escape}" /> + <input type="hidden" name="priority" value="{$priority|escape}" /> + + <a class="floaticon" href="{$gBitLoc.MESSU_PKG_URL}compose.php">{biticon ipackage=messu iname=send_mail iexplain="{tr}Compose Message{/tr}"}</a> + + <table class="data"> + <tr> + <th style="width:1%"> </th> + <th style="width:1%">{smartlink ititle="Flagged" isort=is_flagged ibiticon="messu/flagged" find=$find flag=$flag offset=$offset priority=$priority flagval=$flagval}</th> + <th>{smartlink ititle="From" isort=username find=$find flag=$flag offset=$offset priority=$priority flagval=$flagval}</th> + <th>{smartlink ititle="Subject" isort=subject find=$find flag=$flag offset=$offset priority=$priority flagval=$flagval}</th> + <th>{smartlink ititle="Date" isort=date find=$find flag=$flag offset=$offset priority=$priority flagval=$flagval}</th> + <th>{tr}Size{/tr}</th> + </tr> + + {section name=user loop=$items} + <tr class="{cycle values="odd,even"} prio{$items[user].priority}{if $items[user].is_read eq 'n'} highlight{/if}"> + <td><input type="checkbox" name="msg[{$items[user].msg_id}]" /></td> + <td>{if $items[user].is_flagged eq 'y'}{biticon ipackage=messu iname=flagged iexplain="Flagged"}{/if}</td> + <td>{displayname hash=$items[user]}</td> + <td><a href="{$gBitLoc.MESSU_PKG_URL}read.php?offset={$offset}&flag={$flag}&priority={$priority}&flagval={$flagval}&sort_mode={$sort_mode}&find={$find}&msg_id={$items[user].msg_id}">{$items[user].subject}</a></td> + <td style="text-align:right;">{$items[user].date|bit_short_datetime}</td> + <td style="text-align:right;">{$items[user].len|kbsize}</td> + </tr> + {sectionelse} + <tr class="norecords"><td colspan="6">{tr}No messages to display{/tr}</td></tr> + {/section} + </table> + + {if $items} + {tr}Checked items:{/tr}<br /> + <input type="submit" name="delete" value="{tr}Delete{/tr}" /> + {tr}or{/tr} + <select name="action"> + <option value="is_read_n">{tr}Mark as unread{/tr}</option> + <option value="is_read_y">{tr}Mark as read{/tr}</option> + <option value="is_flagged_n">{tr}Unflag{/tr}</option> + <option value="is_flagged_y">{tr}Flag{/tr}</option> + </select> + <input type="submit" name="mark" value="{tr}Mark{/tr}" /> + {/if} + {/form} + + {form legend="Search your Personal Messages"} + <div class="row"> + {formlabel label="Messages" for="messages"} + {forminput} + <select name="flags" id="messages"> + <option value="is_read_y" {if $flag eq 'is_read' and $flagval eq 'y'}selected="selected"{/if}>{tr}Read{/tr}</option> + <option value="is_read_n" {if $flag eq 'is_read' and $flagval eq 'n'}selected="selected"{/if}>{tr}Unread{/tr}</option> + <option value="is_flagged_y" {if $flag eq 'is_flagged' and $flagval eq 'y'}selected="selected"{/if}>{tr}Flagged{/tr}</option> + <option value="is_flagged_y" {if $flag eq 'isflagged' and $flagval eq 'n'}selected="selected"{/if}>{tr}Unflagged{/tr}</option> + <option value="" {if $flag eq ''}selected="selected"{/if}>{tr}All{/tr}</option> + </select> + {formhelp note=""} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Priority" for="priority"} + {forminput} + <select name="priority" id="priority"> + <option value="" {if $priority eq ''}selected="selected"{/if}>{tr}All{/tr}</option> + <option value="1" {if $priority eq 1}selected="selected"{/if}>{tr}1{/tr}</option> + <option value="2" {if $priority eq 2}selected="selected"{/if}>{tr}2{/tr}</option> + <option value="3" {if $priority eq 3}selected="selected"{/if}>{tr}3{/tr}</option> + <option value="4" {if $priority eq 4}selected="selected"{/if}>{tr}4{/tr}</option> + <option value="5" {if $priority eq 5}selected="selected"{/if}>{tr}5{/tr}</option> + </select> + {formhelp note=""} + {/forminput} + </div> + + <div class="row"> + {formlabel label="Containing" for="find"} + {forminput} + <input type="text" name="find" size="40" id="find" value="{$find|escape}" /> + {formhelp note=""} + {/forminput} + </div> + + <div class="row submit"> + <input type="submit" name="filter" value="{tr}Filter{/tr}" /> + </div> + {/form} + + {pagination} + </div><!-- end .body --> +</div><!-- end .usermessages --> +{/strip} diff --git a/templates/messu_message_notification.tpl b/templates/messu_message_notification.tpl new file mode 100644 index 0000000..b7cf263 --- /dev/null +++ b/templates/messu_message_notification.tpl @@ -0,0 +1,8 @@ +{tr}Hi, +A new message was posted to you. To respond, please visit http://{$mail_site}{$gBitLoc.MESSU_PKG_URL}message_box.php + +From: {$mail_from} +Subject: {$mail_subject} +Date:{/tr} {$mail_date|date_format:"%a %b %Y [%H:%I]"} + +{$mail_body} diff --git a/templates/messu_nav.tpl b/templates/messu_nav.tpl new file mode 100644 index 0000000..4d2c109 --- /dev/null +++ b/templates/messu_nav.tpl @@ -0,0 +1,9 @@ +<div class="navbar"> + <ul> + <li><a href="{$gBitLoc.MESSU_PKG_URL}message_box.php">{tr}Mailbox{/tr}</a></li> + <li><a href="{$gBitLoc.MESSU_PKG_URL}compose.php">{tr}Compose{/tr}</a></li> + {if $bit_p_broadcast eq 'y'} + <li><a href="{$gBitLoc.MESSU_PKG_URL}broadcast.php">{tr}Broadcast{/tr}</a></li> + {/if} + </ul> +</div> diff --git a/templates/messu_read.tpl b/templates/messu_read.tpl new file mode 100644 index 0000000..bd6736c --- /dev/null +++ b/templates/messu_read.tpl @@ -0,0 +1,157 @@ +{strip} +<div class="display usermessages"> + <div class="header"> + <h1>{tr}Read message{/tr}</h1> + </div> + + {include file="bitpackage:users/my_bitweaver_bar.tpl"} + + {if $next} + {assign var=read_id value=$next} + {elseif $prev} + {assign var=read_id value=$prev} + {else} + {assign var=read_id value=$msg_id} + {/if} + <div class="navbar"> + <ul> + {if $msg.is_flagged eq 'y'} + <li>{biticon ipackage=messu iname=flagged iexplain=Flagged} {smartlink ititle="Unflag Message" offset=$offset act=is_flagged actval=n msg_id=$msg_id sort_mode=$sort_mode find=$find flag=$flag priority=$priority flagval=$flagval}</li> + {else} + <li>{smartlink ititle="Flag Message" offset=$offset act=is_flagged actval=y msg_id=$msg_id sort_mode=$sort_mode find=$find flag=$flag priority=$priority flagval=$flagval}</li> + {/if} + <li>{smartlink ititle="Delete" msg_id=$read_id offset=$offset msgdel=$msg_id sort_mode=$sort_mode find=$find flag=$flag priority=$priority flagval=$flagval}</li> + {if $prev}<li>{smartlink ianchor=top ititle="Previous message" ibiticon="liberty/nav_prev" sort_mode=$sort_mode msg_id=$prev find=$find flag=$flag priority=$priority flagval=$flagval}</li>{/if} + {if $next}<li>{smartlink ianchor=top ititle="Next message" ibiticon="liberty/nav_next" sort_mode=$sort_mode msg_id=$next find=$find flag=$flag priority=$priority flagval=$flagval}</li>{/if} + </ul> + </div> + + <div class="body"> + {if $legend} + {$legend} + {else} + {form legend="Message" ipackage=messu ifile='compose.php'} + <div class="row"> + {formlabel label="Date"} + {forminput} + {$msg.date|bit_long_datetime} + {/forminput} + </div> + + <div class="row"> + {formlabel label="From"} + {forminput} + {displayname user_id=$msg.from_user_id} + {/forminput} + </div> + + <div class="row"> + {formlabel label="To"} + {forminput} + {$msg.msg_to} + {/forminput} + </div> + + {if $msg.msg_cc} + <div class="row"> + {formlabel label="Carbon Copy"} + {forminput} + {$msg.msg_cc} + {/forminput} + </div> + {/if} + + <div class="row"> + {formlabel label="Subject"} + {forminput} + {$msg.subject} + {/forminput} + </div> + + <div class="row"> + {forminput} + {$msg.parsed} + {/forminput} + </div> + + <input type="hidden" name="offset" value="{$offset}" /> + <input type="hidden" name="find" value="{$find|escape}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + <input type="hidden" name="flag" value="{$flag}" /> + <input type="hidden" name="flagval" value="{$flagval}" /> + <input type="hidden" name="priority" value="{$priority}" /> + <input type="hidden" name="msgdel" value="{$msg_id}" /> + <input type="hidden" name="replyto" value="{$msg.from_user_id}" /> + <input type="hidden" name="replyallto" value="{$msg.msg_to},{$msg.msg_cc}" /> + <input type="hidden" name="subject" value="{tr}Re:{/tr} {$msg.subject}" /> + <input type="hidden" name="body" value="{$msg.body|quoted|escape}" /> + {if $next} + <input type="hidden" name="msg_id" value="{$next}" /> + {elseif $prev} + <input type="hidden" name="msg_id" value="{$prev}" /> + {else} + <input type="hidden" name="msg_id" value="{$msg_id}" /> + {/if} + + <div class="row submit"> + <input type="submit" name="action[reply]" value="{tr}Reply{/tr}" /> + <input type="submit" name="action[replyall]" value="{tr}Reply All{/tr}" /> + </div> + {/form} + + {/if} + </div><!-- end .body --> +</div><!-- end .usermessages --> +{/strip} +{* + <table class="panel"> + <tr class="panelsubmitrow"><td> + <form method="post" action="{$gBitLoc.MESSU_PKG_URL}read.php"> + <input type="hidden" name="offset" value="{$offset}" /> + <input type="hidden" name="find" value="{$find|escape}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + <input type="hidden" name="flag" value="{$flag}" /> + <input type="hidden" name="flagval" value="{$flagval}" /> + <input type="hidden" name="priority" value="{$priority}" /> + <input type="hidden" name="msgdel" value="{$msg_id}" /> + {if $next} + <input type="hidden" name="msg_id" value="{$next}" /> + {elseif $prev} + <input type="hidden" name="msg_id" value="{$prev}" /> + {else} + <input type="hidden" name="msg_id" value="" /> + {/if} + <input type="submit" name="delete" value="{tr}Delete{/tr}" /> + </form> + </td> + <td> + <form method="post" action="{$gBitLoc.MESSU_PKG_URL}compose.php"> + <input type="hidden" name="offset" value="{$offset}" /> + <input type="hidden" name="msg_id" value="{$msg_id}" /> + <input type="hidden" name="find" value="{$find|escape}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + <input type="hidden" name="flag" value="{$flag}" /> + <input type="hidden" name="priority" value="{$priority}" /> + <input type="hidden" name="flagval" value="{$flagval}" /> + <input type="hidden" name="to" value="{$msg.user_from|escape}" /> + <input type="hidden" name="subject" value="{tr}Re:{/tr} {$msg.subject}" /> + <input type="hidden" name="body" value="{$msg.body|quoted|escape}" /> + <input type="submit" name="reply" value="{tr}reply{/tr}" /> + </form> + </td> + <td> + <form method="post" action="{$gBitLoc.MESSU_PKG_URL}compose.php"> + <input type="hidden" name="offset" value="{$offset}" /> + <input type="hidden" name="find" value="{$find|escape}" /> + <input type="hidden" name="msg_id" value="{$msg_id}" /> + <input type="hidden" name="sort_mode" value="{$sort_mode}" /> + <input type="hidden" name="flag" value="{$flag}" /> + <input type="hidden" name="priority" value="{$priority}" /> + <input type="hidden" name="flagval" value="{$flagval}" /> + <input type="hidden" name="to" value="{$msg.user_from},{$msg.user_cc},{$msg.user_to}" /> + <input type="hidden" name="subject" value="{tr}Re:{/tr} {$msg.subject}" /> + <input type="hidden" name="body" value="{$msg.body|quoted|escape}" /> + <input type="submit" name="replyall" value="{tr}Reply All{/tr}" /> + </td></tr> + </table> +*} |
