aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorzottel <github@zottel.net>2012-05-07 09:11:45 +0200
committerzottel <github@zottel.net>2012-05-07 09:11:45 +0200
commita2ea560bf397902ce5608daabf101d0bcf813f13 (patch)
tree0f4020d6b86c65cc317739b8e562ea50801ec277 /mod
parent3cd428152d8727b838565c462f91accd35204ce1 (diff)
parentc7f3e626d0bb141be86a8af6ffbe40768bc23069 (diff)
downloadvolse-hubzilla-a2ea560bf397902ce5608daabf101d0bcf813f13.tar.gz
volse-hubzilla-a2ea560bf397902ce5608daabf101d0bcf813f13.tar.bz2
volse-hubzilla-a2ea560bf397902ce5608daabf101d0bcf813f13.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php25
-rw-r--r--mod/message.php41
2 files changed, 51 insertions, 15 deletions
diff --git a/mod/acl.php b/mod/acl.php
index 88f150d7a..402d37376 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -13,6 +13,14 @@ function acl_init(&$a){
$type = (x($_REQUEST,'type')?$_REQUEST['type']:"");
+ // For use with jquery.autocomplete for private mail completion
+
+ if(x($_REQUEST,'query') && strlen($_REQUEST['query'])) {
+ $type = 'm';
+ $search = $_REQUEST['query'];
+ }
+
+
if ($search!=""){
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
$sql_extra2 = "AND (`attag` LIKE '%%".dbesc($search)."%%' OR `name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
@@ -115,6 +123,23 @@ function acl_init(&$a){
else
$r = array();
+
+ if($type == 'm') {
+ $x = array();
+ $x['query'] = $search;
+ $x['suggestions'] = array();
+ $x['data'] = array();
+ if(count($r)) {
+ foreach($r as $g) {
+ $x['suggestions'][] = sprintf( t('%s [%s]'),$g['name'],$g['url']);
+ // '<img src="' . $g['micro'] . ' height="16" width="16" alt="' . t('Image/photo') . '" />' .
+ $x['data'][] = intval($g['id']);
+ }
+ }
+ echo json_encode($x);
+ killme();
+ }
+
if(count($r)) {
foreach($r as $g){
$contacts[] = array(
diff --git a/mod/message.php b/mod/message.php
index dbca45930..867f199c4 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -4,20 +4,7 @@ require_once('include/acl_selectors.php');
require_once('include/message.php');
function message_init(&$a) {
- $tabs = array(
- /*
- array(
- 'label' => t('All'),
- 'url'=> $a->get_baseurl(true) . '/message',
- 'sel'=> ($a->argc == 1),
- ),
- array(
- 'label' => t('Sent'),
- 'url' => $a->get_baseurl(true) . '/message/sent',
- 'sel'=> ($a->argv[1] == 'sent'),
- ),
- */
- );
+ $tabs = array();
$new = array(
'label' => t('New Message'),
'url' => $a->get_baseurl(true) . '/message/new',
@@ -29,6 +16,21 @@ function message_init(&$a) {
'$tabs'=>$tabs,
'$new'=>$new,
));
+ $base = $a->get_baseurl();
+
+ $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/jquery.autocomplete-min.js" ></script>';
+ $a->page['htmlhead'] .= <<< EOT
+
+<script>$(document).ready(function() {
+ var a;
+ a = $("#recip").autocomplete({
+ serviceUrl: '$base/acl',
+ width: 350
+ });
+});
+
+</script>
+EOT;
}
@@ -172,6 +174,15 @@ function message_content(&$a) {
$preselect = (isset($a->argv[2])?array($a->argv[2]):false);
$select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
+
+// here's sort of where we want to do contact autocomplete
+// comment out the contact selector line just above and use the following one instead,
+// then figure out how to make it do the right thing
+// pictures would be nice, but that didn't seem to work when I tried it
+// (the json backend is found in mod/acl.php)
+
+// $select = '<input type="text" id="recip" name="messageto" value="' . $preselect .'" />';
+
$tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),
@@ -198,7 +209,7 @@ function message_content(&$a) {
$o .= $header;
$r = q("SELECT count(*) AS `total` FROM `mail`
- WHERE `mail`.`uid` = %d AND `from-url` $eq '%s' GROUP BY `parent-uri` ORDER BY `created` DESC",
+ WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
intval(local_user()),
dbesc($myprofile)
);