aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-10 01:45:51 -0700
committerfriendica <info@friendica.com>2012-05-10 01:45:51 -0700
commit774c51cc19c2e1fd135a7f692dd53bfb3a4d0ed3 (patch)
treec31c082c33afb34ccfa954585823a063c8abaa21 /mod
parent4a42414135538fedad53ba6a2bc46ae18d652609 (diff)
downloadvolse-hubzilla-774c51cc19c2e1fd135a7f692dd53bfb3a4d0ed3.tar.gz
volse-hubzilla-774c51cc19c2e1fd135a7f692dd53bfb3a4d0ed3.tar.bz2
volse-hubzilla-774c51cc19c2e1fd135a7f692dd53bfb3a4d0ed3.zip
email autocomplete
Diffstat (limited to 'mod')
-rw-r--r--mod/message.php41
1 files changed, 24 insertions, 17 deletions
diff --git a/mod/message.php b/mod/message.php
index b8695fdd9..8cfa0256c 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -25,8 +25,12 @@ function message_init(&$a) {
var a;
a = $("#recip").autocomplete({
serviceUrl: '$base/acl',
- width: 350
+ width: 350,
+ onSelect: function(value,data) {
+ $("#recip-complete").val(data);
+ }
});
+
});
</script>
@@ -95,10 +99,6 @@ function message_content(&$a) {
$myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname'];
-
-
-
-
$tpl = get_markup_template('mail_head.tpl');
$header = replace_macros($tpl, array(
'$messages' => t('Messages'),
@@ -173,27 +173,34 @@ function message_content(&$a) {
$preselect = (isset($a->argv[2])?array($a->argv[2]):false);
- if(defined('EMAIL_AUTOCOMP')) {
- // here's where we want to do contact autocomplete
- // just figure out how to make it do the right thing
- // pictures would be nice, but that didn't work when I tried.
- // It sort of barely works, but needs help
- // (the json backend is found in mod/acl.php)
+ $prename = $preurl = $preid = '';
- $select = '<input type="text" id="recip" name="messageto" value="' . $preselect .'" />';
- }
- else {
+ if($preselect) {
+ $r = q("select name, url, id from contact where uid = %d and id = %d limit 1",
+ intval(local_user()),
+ intval($a->argv[2])
+ );
+ if(count($r)) {
+ $prename = $r[0]['name'];
+ $preurl = $r[0]['url'];
+ $preid = $r[0]['id'];
+ }
+ }
- // the ugly select box
+ $prefill = (($preselect) ? $prename . ' [' . $preurl . ']' : '');
- $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
- }
+ // the ugly select box
+
+ $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10);
$tpl = get_markup_template('prv_message.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),
'$to' => t('To:'),
+ '$prefill' => $prefill,
+ '$autocomp' => $autocomp,
+ '$preid' => $preid,
'$subject' => t('Subject:'),
'$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''),
'$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''),