aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-13 02:57:15 -0800
committerfriendica <info@friendica.com>2012-11-13 02:57:15 -0800
commit67a7d440d9c8b37acfe2aa7c062f453680c45384 (patch)
tree593c9b9b9d9142010f86af285b27987586f2b229
parent9bfff0bca1c827330b05ea973b785bcabb9dbb4e (diff)
downloadvolse-hubzilla-67a7d440d9c8b37acfe2aa7c062f453680c45384.tar.gz
volse-hubzilla-67a7d440d9c8b37acfe2aa7c062f453680c45384.tar.bz2
volse-hubzilla-67a7d440d9c8b37acfe2aa7c062f453680c45384.zip
usability improvements
-rw-r--r--library/jquery_ac/friendica.complete.js6
-rw-r--r--mod/acl.php34
-rw-r--r--mod/connections.php12
-rw-r--r--view/js/mod_connections.js11
-rw-r--r--view/tpl/contact_template.tpl10
5 files changed, 37 insertions, 36 deletions
diff --git a/library/jquery_ac/friendica.complete.js b/library/jquery_ac/friendica.complete.js
index 81eba564e..ff2c37437 100644
--- a/library/jquery_ac/friendica.complete.js
+++ b/library/jquery_ac/friendica.complete.js
@@ -167,8 +167,10 @@
default:
return;
}
- e.stopImmediatePropagation();
- e.preventDefault();
+ if(e.keyCode != 13) {
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ }
},
onKeyUp: function(e) {
diff --git a/mod/acl.php b/mod/acl.php
index 33b7b22c8..630f1e209 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -139,10 +139,10 @@ function acl_init(&$a){
);
}
elseif($type == 'a') {
- $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
- WHERE `uid` = %d AND `pending` = 0
- $sql_extra2
- ORDER BY `name` ASC ",
+ $r = q("SELECT abook_id as id, xchan_name as name, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag FROM abook left join xchan on abook_xchan = xchan_hash
+ WHERE abook_channel = %d
+ $sql_extra3
+ ORDER BY xchan_name ASC ",
intval(local_user())
);
}
@@ -160,17 +160,17 @@ function acl_init(&$a){
if($type == 'm' || $type == 'a' || $type == 'x') {
$x = array();
- $x['query'] = $search;
- $x['photos'] = array();
- $x['links'] = array();
+ $x['query'] = $search;
+ $x['photos'] = array();
+ $x['links'] = array();
$x['suggestions'] = array();
- $x['data'] = array();
+ $x['data'] = array();
if(count($r)) {
foreach($r as $g) {
- $x['photos'][] = $g['micro'];
- $x['links'][] = $g['url'];
+ $x['photos'][] = $g['micro'];
+ $x['links'][] = $g['url'];
$x['suggestions'][] = (($type === 'x') ? '@' : '') . $g['name'];
- $x['data'][] = intval($g['id']);
+ $x['data'][] = intval($g['id']);
}
}
echo json_encode($x);
@@ -180,13 +180,13 @@ function acl_init(&$a){
if(count($r)) {
foreach($r as $g){
$contacts[] = array(
- "type" => "c",
- "photo" => $g['micro'],
- "name" => $g['name'],
- "id" => intval($g['id']),
+ "type" => "c",
+ "photo" => $g['micro'],
+ "name" => $g['name'],
+ "id" => intval($g['id']),
"network" => $g['network'],
- "link" => $g['url'],
- "nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
+ "link" => $g['url'],
+ "nick" => $g['nick'],
);
}
}
diff --git a/mod/connections.php b/mod/connections.php
index 8286fabec..d5b4a650c 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -544,7 +544,7 @@ EOT;
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
$searching = true;
}
- $sql_extra .= (($searching) ? " AND xchan_name '$search_txt' " : "");
+ $sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
if($nets)
$sql_extra .= sprintf(" AND xchan_network = '%s' ", dbesc($nets));
@@ -573,12 +573,8 @@ EOT;
foreach($r as $rr) {
- $url = "magic/{$rr['abook_id']}";
- $sparkle = ' class="sparkle" ';
-
-
$contacts[] = array(
- 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['xchan_name'],$rr['xchan_url']),
+ 'img_hover' => sprintf( t('%1$s [%2$s]'),$rr['xchan_name'],$rr['xchan_url']),
'edit_hover' => t('Edit contact'),
'photo_menu' => contact_photo_menu($rr),
'id' => $rr['abook_id'],
@@ -588,8 +584,8 @@ EOT;
'name' => $rr['xchan_name'],
'username' => $rr['xchan_name'],
'sparkle' => $sparkle,
- 'itemurl' => $rr['xchan_url'],
- 'url' => $url,
+ 'edit' => z_root() . '/connections/' . $rr['abook_id'],
+ 'url' => $rr['xchan_url'],
'network' => network_to_name($rr['network']),
);
}
diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js
index 1880222bc..410786cf5 100644
--- a/view/js/mod_connections.js
+++ b/view/js/mod_connections.js
@@ -8,3 +8,14 @@ $(document).ready(function() {
a.setOptions({ params: { type: 'a' }});
});
+
+$("#contacts-search").keyup(function(event){
+ if(event.keyCode == 13){
+ $("#contacts-search-submit").click();
+ }
+});
+$(".autocomplete-w1 .selected").keyup(function(event){
+ if(event.keyCode == 13){
+ $("#contacts-search-submit").click();
+ }
+});
diff --git a/view/tpl/contact_template.tpl b/view/tpl/contact_template.tpl
index 48930b48a..77e4802e5 100644
--- a/view/tpl/contact_template.tpl
+++ b/view/tpl/contact_template.tpl
@@ -5,16 +5,8 @@
onmouseover="if (typeof t$contact.id != 'undefined') clearTimeout(t$contact.id); openMenu('contact-photo-menu-button-$contact.id')"
onmouseout="t$contact.id=setTimeout('closeMenu(\'contact-photo-menu-button-$contact.id\'); closeMenu(\'contact-photo-menu-$contact.id\');',200)" >
- <a href="$contact.url" title="$contact.img_hover" /><img src="$contact.thumb" $contact.sparkle alt="$contact.name" /></a>
+ <a href="$contact.edit" title="$contact.img_hover" /><img src="$contact.thumb" $contact.sparkle alt="$contact.name" /></a>
- {{ if $contact.photo_menu }}
- <span onclick="openClose('contact-photo-menu-$contact.id');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-$contact.id">menu</span>
- <div class="contact-photo-menu" id="contact-photo-menu-$contact.id">
- <ul>
- $contact.photo_menu
- </ul>
- </div>
- {{ endif }}
</div>
</div>