mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
Private Messaging Admin work. Not fully functional yet.
This commit is contained in:
@@ -575,6 +575,42 @@ class admin_shortcodes
|
||||
function sc_admin_pm($parm)
|
||||
{
|
||||
if(!e107::isInstalled('pm')) return;
|
||||
|
||||
$sql = e107::getDb();
|
||||
$count = $sql->count('private_msg','(*)','WHERE pm_read = 0');
|
||||
|
||||
if ($count >0)
|
||||
{
|
||||
$countDisp = ' <span class="label label-info">'.$count.'</span> ' ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$countDisp = '';
|
||||
}
|
||||
|
||||
$text = '<ul class="nav nav-pills">
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" title="Messages" role="button" data-toggle="dropdown" href="#" >
|
||||
<i class="icon-envelope icon-white active"></i>'.$countDisp.'<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu" >
|
||||
<li class="nav-header">Private Messages</li>
|
||||
<li><a class="e-dialog" href="'.e_PLUGIN.'pm/admin_config.php?searchquery=&iframe=1&filter_options=bool__pm_to__'.USERID.'" >Inbox</a></li>
|
||||
<li><a class="e-dialog" href="'.e_PLUGIN.'pm/admin_config.php?searchquery=&iframe=1&filter_options=bool__pm_from__'.USERID.'">Outbox</a></li>
|
||||
<li><a class="e-dialog" href="'.e_PLUGIN.'pm/admin_config.php?mode=main&action=create&iframe=1">Compose</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
';
|
||||
|
||||
return $text;
|
||||
|
||||
// e107_plugins/pm/pm.php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$text = '
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" title="Messages" role="button" data-toggle="dropdown" href="#" >
|
||||
@@ -1291,7 +1327,9 @@ class admin_shortcodes
|
||||
$menu_vars = $this->getOtherNav($parm);
|
||||
return e107::getNav()->admin('', '', $menu_vars, $$tmpl, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// MAIN LINK
|
||||
if($parm != 'no-main')
|
||||
{
|
||||
@@ -1641,7 +1679,7 @@ class admin_shortcodes
|
||||
$c = 0;
|
||||
foreach($languages as $lng)
|
||||
{
|
||||
$checked = ($lng == e_LANGUAGE) ? "<i class='icon-ok icon-black'></i> " : " ";
|
||||
$checked = ($lng == e_LANGUAGE) ? "<i class='icon-ok icon-white'></i> " : "<i > </i> ";
|
||||
|
||||
$tmp[$c]['text'] = $lng;
|
||||
$tmp[$c]['description'] = '';
|
||||
|
223
e107_plugins/pm/admin_config.php
Normal file
223
e107_plugins/pm/admin_config.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
// Generated e107 Plugin Admin Area
|
||||
|
||||
require_once('../../class2.php');
|
||||
if (!getperms('P'))
|
||||
{
|
||||
header('location:'.e_BASE.'index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class pm_admin extends e_admin_dispatcher
|
||||
{
|
||||
|
||||
protected $modes = array(
|
||||
|
||||
'main' => array(
|
||||
'controller' => 'private_msg_ui',
|
||||
'path' => null,
|
||||
'ui' => 'private_msg_form_ui',
|
||||
'uipath' => null
|
||||
),
|
||||
/*
|
||||
'block' => array(
|
||||
'controller' => 'private_msg_block_ui',
|
||||
'path' => null,
|
||||
'ui' => 'private_msg_block_form_ui',
|
||||
'uipath' => null
|
||||
),
|
||||
*/
|
||||
);
|
||||
|
||||
|
||||
protected $adminMenu = array(
|
||||
|
||||
'main/list' => array('caption'=> "Inbox", 'perm' => 'P'),
|
||||
'main/create' => array('caption'=> "Compose", 'perm' => 'P'),
|
||||
|
||||
// 'block/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
|
||||
// 'block/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
|
||||
|
||||
/*
|
||||
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
|
||||
'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
protected $adminMenuAliases = array(
|
||||
'main/edit' => 'main/list'
|
||||
);
|
||||
|
||||
protected $menuTitle = 'pm';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class private_msg_ui extends e_admin_ui
|
||||
{
|
||||
|
||||
protected $pluginTitle = 'Private Messaging';
|
||||
protected $pluginName = 'pm';
|
||||
protected $table = 'private_msg';
|
||||
protected $pid = 'pm_id';
|
||||
protected $perPage = 10;
|
||||
protected $listQry = '';
|
||||
protected $listOrder = "pm_sent DESC";
|
||||
|
||||
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
||||
'pm_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_from' => array ( 'title' => 'From', 'type' => 'number', 'noedit'=>true, 'data' => 'int', 'filter'=>true, 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_to' => array ( 'title' => 'To', 'type' => 'user', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_sent' => array ( 'title' => LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => 'auto=1&readonly=1', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_subject' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width' => '15%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_text' => array ( 'title' => 'Message', 'type' => 'bbarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => 'expand=1&truncate=50', 'writeParms' => 'size=medium', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_read' => array ( 'title' => 'Read', 'type' => 'boolean', 'noedit'=>1, 'data' => 'int', 'batch'=>true, 'filter'=>true, 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
|
||||
'pm_sent_del' => array ( 'title' => 'Del', 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_read_del' => array ( 'title' => 'Del', 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_attachments' => array ( 'title' => 'Attachments', 'type' => 'text', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_option' => array ( 'title' => 'Option', 'type' => 'text', 'noedit'=>true, 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_size' => array ( 'title' => 'Size', 'type' => 'boolean', 'noedit'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'options' => array ( 'title' => 'Options', 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
|
||||
);
|
||||
|
||||
protected $fieldpref = array('pm_id', 'pm_from', 'pm_to', 'pm_sent', 'pm_read', 'pm_subject', 'pm_text');
|
||||
|
||||
// optional
|
||||
public function init()
|
||||
{
|
||||
// $this->listQry = "SELECT p.*,u.user_name FROM #private_msg AS p LEFT JOIN #user AS u ON p.pm_from = u.user_id ";
|
||||
|
||||
if(vartrue($_GET['iframe']))
|
||||
{
|
||||
define('e_IFRAME', true);
|
||||
}
|
||||
|
||||
// Prevent snooping of other people's messages. ;-) //XXX Not working Yet. FIXME!
|
||||
if(varset($_GET['filter_options']))
|
||||
{
|
||||
list($tmp,$field,$id) = explode("__",$_GET['filter_options']);
|
||||
|
||||
|
||||
// echo "FIELD = ".$field;
|
||||
// $this->getDispatcher()->setRequest('filter_options')
|
||||
|
||||
if($field == 'pm_to' && $id != USERID)
|
||||
{
|
||||
$_GET['filter_options'] = 'batch__pm_to__'.USERID;
|
||||
}
|
||||
|
||||
if($field == 'pm_from' && $id != USERID)
|
||||
{
|
||||
$_GET['filter_options'] = 'batch__pm_from__'.USERID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
protected = array(
|
||||
'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
||||
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
|
||||
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function customPage()
|
||||
{
|
||||
$ns = e107::getRender();
|
||||
$text = 'Hello World!';
|
||||
$ns->tablerender('Hello',$text);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class private_msg_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
class private_msg_block_ui extends e_admin_ui
|
||||
{
|
||||
|
||||
protected $pluginTitle = 'Private Messaging';
|
||||
protected $pluginName = 'pm';
|
||||
protected $table = 'private_msg_block';
|
||||
protected $pid = 'pm_block_id';
|
||||
protected $perPage = 10;
|
||||
|
||||
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
||||
'pm_block_id' => array ( 'title' => 'LAN_ID', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_block_from' => array ( 'title' => 'From', 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_block_to' => array ( 'title' => 'To', 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'pm_block_datestamp' => array ( 'title' => 'LAN_DATESTAMP', 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
|
||||
'pm_block_count' => array ( 'title' => 'Count', 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
|
||||
'options' => array ( 'title' => 'Options', 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
|
||||
);
|
||||
|
||||
protected $fieldpref = array('pm_block_datestamp');
|
||||
|
||||
|
||||
|
||||
|
||||
// protected = array(
|
||||
// 'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
||||
// 'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
|
||||
// 'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
|
||||
// );
|
||||
|
||||
|
||||
// optional
|
||||
public function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function customPage()
|
||||
{
|
||||
$ns = e107::getRender();
|
||||
$text = 'Hello World!';
|
||||
$ns->tablerender('Hello',$text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class private_msg_block_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
new pm_admin();
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
e107::getAdminUI()->runPage();
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
exit;
|
||||
|
||||
?>
|
@@ -66,8 +66,11 @@ if (varset($e107_popup) != 1)
|
||||
//
|
||||
// B.2 Send footer template, stop timing, send simple page stats
|
||||
//
|
||||
parseheader((varset($ph) ? $cust_footer : $FOOTER));
|
||||
|
||||
if(!deftrue('e_IFRAME'))
|
||||
{
|
||||
parseheader((varset($ph) ? $cust_footer : $FOOTER));
|
||||
}
|
||||
|
||||
$eTimingStop = microtime();
|
||||
global $eTimingStart;
|
||||
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
|
||||
@@ -158,7 +161,7 @@ if (varset($e107_popup) != 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
echo($rinfo ? "\n<div class='e-footer-info smalltext'>{$rinfo}</div>\n" : "");
|
||||
echo($rinfo ? "\n<div class='e-footer-info smalltext'><small>{$rinfo}</small></div>\n" : "");
|
||||
}
|
||||
|
||||
} // End of regular-page footer (the above NOT done for popups)
|
||||
|
@@ -533,8 +533,48 @@ e107Event.trigger('loaded', null, document);
|
||||
|
||||
e107::getJs()->renderJs('header_inline', 5);
|
||||
|
||||
echo "</head>
|
||||
<body".$body_onload.">\n";
|
||||
echo "</head>\n";
|
||||
|
||||
|
||||
// ---------- New in 2.0 -------------------------------------------------------
|
||||
|
||||
$def = THEME_LAYOUT; // The active layout based on custompage matches.
|
||||
|
||||
// echo "DEF = ".$def."<br />";
|
||||
|
||||
if($def == 'legacyCustom' || $def=='legacyDefault' ) // 0.6 themes.
|
||||
{
|
||||
// echo "MODE 0.6";
|
||||
if($def == 'legacyCustom')
|
||||
{
|
||||
$HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER;
|
||||
$FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER;
|
||||
}
|
||||
}
|
||||
elseif($def && $def != "legacyCustom" && (isset($CUSTOMHEADER[$def]) || isset($CUSTOMFOOTER[$def]))) // 0.7 themes
|
||||
{
|
||||
// echo " MODE 0.7";
|
||||
$HEADER = ($CUSTOMHEADER[$def]) ? $CUSTOMHEADER[$def] : $HEADER;
|
||||
$FOOTER = ($CUSTOMFOOTER[$def]) ? $CUSTOMFOOTER[$def] : $FOOTER;
|
||||
}
|
||||
elseif($def && isset($HEADER[$def]) && isset($FOOTER[$def])) // 0.8 themes - we use only $HEADER and $FOOTER arrays.
|
||||
{
|
||||
// echo " MODE 0.8";
|
||||
$HEADER = $HEADER[$def];
|
||||
$FOOTER = $FOOTER[$def];
|
||||
}
|
||||
|
||||
if(deftrue('e_IFRAME'))
|
||||
{
|
||||
$HEADER = "";
|
||||
$FOOTER = "";
|
||||
$body_onload = " style='padding:15px;margin:0px'"; //TODO e-iframe css class.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo "<body".$body_onload.">\n";
|
||||
|
||||
// Header included notification, from this point header includes are not possible
|
||||
define('HEADER_INIT', TRUE);
|
||||
@@ -559,35 +599,6 @@ if ($e107_popup != 1) {
|
||||
//
|
||||
// M: Send top of body for custom pages and for news
|
||||
//
|
||||
|
||||
// ---------- New in 0.8 -------------------------------------------------------
|
||||
|
||||
$def = THEME_LAYOUT; // The active layout based on custompage matches.
|
||||
|
||||
// echo "DEF = ".$def."<br />";
|
||||
|
||||
if($def == 'legacyCustom' || $def=='legacyDefault' ) // 0.6 themes.
|
||||
{
|
||||
// echo "MODE 0.6";
|
||||
if($def == 'legacyCustom')
|
||||
{
|
||||
$HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER;
|
||||
$FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER;
|
||||
}
|
||||
}
|
||||
elseif($def && $def != "legacyCustom" && (isset($CUSTOMHEADER[$def]) || isset($CUSTOMFOOTER[$def]))) // 0.7 themes
|
||||
{
|
||||
// echo " MODE 0.7";
|
||||
$HEADER = ($CUSTOMHEADER[$def]) ? $CUSTOMHEADER[$def] : $HEADER;
|
||||
$FOOTER = ($CUSTOMFOOTER[$def]) ? $CUSTOMFOOTER[$def] : $FOOTER;
|
||||
}
|
||||
elseif($def && isset($HEADER[$def]) && isset($FOOTER[$def])) // 0.8 themes - we use only $HEADER and $FOOTER arrays.
|
||||
{
|
||||
// echo " MODE 0.8";
|
||||
$HEADER = $HEADER[$def];
|
||||
$FOOTER = $FOOTER[$def];
|
||||
}
|
||||
|
||||
//XXX - remove all page detections
|
||||
if (e_PAGE == 'news.php' && isset($NEWSHEADER))
|
||||
{
|
||||
|
Reference in New Issue
Block a user