]> git.mxchange.org Git - friendica.git/commitdiff
email autocomplete
authorfriendica <info@friendica.com>
Thu, 10 May 2012 08:45:51 +0000 (01:45 -0700)
committerfriendica <info@friendica.com>
Thu, 10 May 2012 08:45:51 +0000 (01:45 -0700)
mod/message.php
view/theme/duepuntozero/prv_message.tpl [new file with mode: 0644]
view/theme/duepuntozero/style.css

index b8695fdd93b17fe7cb7f5d36f38aa4e558354997..8cfa0256cd092b89601edde2245036c49b7e9355 100644 (file)
@@ -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'])) : ''),
diff --git a/view/theme/duepuntozero/prv_message.tpl b/view/theme/duepuntozero/prv_message.tpl
new file mode 100644 (file)
index 0000000..5d884fe
--- /dev/null
@@ -0,0 +1,35 @@
+
+<h3>$header</h3>
+
+<div id="prvmail-wrapper" >
+<form id="prvmail-form" action="message" method="post" >
+
+$parent
+
+<div id="prvmail-to-label">$to</div>
+
+<input type="text" id="recip" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" />
+<input type="hidden" id="recip-complete" name="messageto" value="$preid">
+
+<div id="prvmail-subject-label">$subject</div>
+<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="$subjtxt" $readonly tabindex="11" />
+
+<div id="prvmail-message-label">$yourmessage</div>
+<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="12">$text</textarea>
+
+
+<div id="prvmail-submit-wrapper" >
+       <input type="submit" id="prvmail-submit" name="submit" value="Submit" tabindex="13" />
+       <div id="prvmail-upload-wrapper" >
+               <div id="prvmail-upload" class="icon border camera" title="$upload" ></div>
+       </div> 
+       <div id="prvmail-link-wrapper" >
+               <div id="prvmail-link" class="icon border link" title="$insert" onclick="jotGetLink();" ></div>
+       </div> 
+       <div id="prvmail-rotator-wrapper" >
+               <img id="prvmail-rotator" src="images/rotator.gif" alt="$wait" title="$wait" style="display: none;" />
+       </div> 
+</div>
+<div id="prvmail-end"></div>
+</form>
+</div>
index 7cbcdc4d2c40307a2dc39430943c5aa19baa283e..19d7d652eb62cb7d331bb2ecb15037d78db495f0 100644 (file)
@@ -3166,4 +3166,13 @@ ul.menu-popup {
 }
 #id_term {
        width:100px;
-}
\ No newline at end of file
+}
+
+#recip {
+       
+}
+.autocomplete-w1 { background:url(img/shadow.png) no-repeat bottom right; position:absolute; top:0px; left:0px; margin:6px 0 0 6px; /* IE6 fix: */ _background:none; _margin:1px 0 0 0; }
+.autocomplete { border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px;  _margin:0; _overflow-x:hidden; }
+.autocomplete .selected { background:#F0F0F0; }
+.autocomplete div { padding:2px 5px; white-space:nowrap; overflow:hidden; }
+.autocomplete strong { font-weight:normal; color:#3399FF; }