From 3f94721d6257b4fe31054682b258223b992c4011 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Wed, 30 Mar 2011 17:10:14 +0200 Subject: [PATCH 1/9] first work --- mod/network.php | 7 +++++- view/theme/duepuntozero/photo-menu.jpg | Bin 0 -> 459 bytes view/theme/duepuntozero/style.css | 32 +++++++++++++++++++++++++ view/wall_item.tpl | 14 +++++++++-- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 view/theme/duepuntozero/photo-menu.jpg diff --git a/mod/network.php b/mod/network.php index 39679b48a1..84efe52ba7 100644 --- a/mod/network.php +++ b/mod/network.php @@ -543,6 +543,8 @@ function network_content(&$a, $update = 0) { $indent .= ' shiny'; + $contact_url = $a->get_baseurl()."/contacts/".$item['cid']; + // Build the HTML $tmp_item = replace_macros($template,array( @@ -553,6 +555,9 @@ function network_content(&$a, $update = 0) { '$wall' => t('Wall-to-Wall'), '$vwall' => t('via Wall-To-Wall:'), '$profile_url' => $profile_link, + '$profile_tab_url' => $profile_link."?tab=profile", //don't work with secure redirects + '$contact_url' => $contact_url, + '$pm_url' => "", '$name' => $profile_name, '$thumb' => $profile_avatar, '$osparkle' => $osparkle, @@ -596,4 +601,4 @@ function network_content(&$a, $update = 0) { } return $o; -} \ No newline at end of file +} diff --git a/view/theme/duepuntozero/photo-menu.jpg b/view/theme/duepuntozero/photo-menu.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fde5eb53524ddb12ec5642f33d0d34e14e256193 GIT binary patch literal 459 zcmex=&g!NbMF!_CFb&C4ewz{@Ad$IUGuCLky*A}T7%!!Ir&CL$pu zA}RthgpnDjhlQ1sm6cP3mz!6FWbpq0gCGZk0D}NCqY?v?AS1IN>UQrQGDKoE6M2QoDc3G+f#K-Lz&!r^Qc^B##H0%WszGMCU1W znAE#pe4KOt&Ml**OEy0VoUS}?d3@zno#;NjlP3257arA~E4nCar)(9G=iXTV|0V#| C@@!oI literal 0 HcmV?d00001 diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 042cc380ff..ac6ebf8073 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -866,6 +866,37 @@ input#dfrn-url { margin-bottom: 10px; width: 100px; } +.wall-item-photo-menu-button { + display: block; + position: absolute; + background-image: url("photo-menu.jpg"); + background-position: top left; + background-repeat: no-repeat; + margin: 0px; padding: 0px; + width: 16px; + height: 16px; + top: 74px; left:10px; + overflow: hidden; + text-indent: 40px; + display: none; + +} +.wall-item-photo-menu { + width: 90px; + border: 2px solid #444444; + background: #FFFFFF; + position: absolute; + left: 10px; top: 90px; + display: none; +} +.wall-item-photo-menu ul { margin:0px; padding: 0px; list-style: none } +.wall-item-photo-menu li a { display: block; padding: 2px; } +.wall-item-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; } +.wall-item-photo-menu li a[href=""] { display: none } + + +.comment .wall-item-photo-menu-button { top: 44px;} +.comment .wall-item-photo-menu { top: 60px; } .wallwall .wwto { left: 50px; @@ -878,6 +909,7 @@ input#dfrn-url { width: 30px; height: 30px; } + .wallwall .wall-item-photo-end { clear: both; } diff --git a/view/wall_item.tpl b/view/wall_item.tpl index 4c2a3fbf42..c78fbb61f9 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -1,9 +1,19 @@
-
+
- $name + $name + + menu +
From fe67c346e5ed9f65fe25dd9337b6424c04d09c4a Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 31 Mar 2011 16:52:51 +0200 Subject: [PATCH 2/9] Moved popup logic in boot.php, added 'item_photo_menu' hook --- boot.php | 52 +++++++++++++++++++++++++++++++ mod/network.php | 9 +++--- mod/profile.php | 2 ++ mod/search.php | 1 + view/search_item.tpl | 10 +++++- view/theme/duepuntozero/style.css | 3 +- view/wall_item.tpl | 7 ++--- 7 files changed, 72 insertions(+), 12 deletions(-) diff --git a/boot.php b/boot.php index 3b5da170cb..efa9e4bdfd 100644 --- a/boot.php +++ b/boot.php @@ -2669,3 +2669,55 @@ function extract_item_authors($arr,$uid) { } return array(); }} + + +if(! function_exists('item_photo_menu')){ +function item_photo_menu($item){ + $a = get_app(); + + if (!isset($a->autors)){ + $rr = q("SELECT id, network, url FROM contact WHERE uid=%d AND self!=1", intval(local_user())); + $authors = array(); + foreach($rr as $r) $authors[$r['url']]= $r; + $a->authors = $authors; + } + + $contact_url=""; + $pm_url=""; + + $profile_link = ((strlen($item['author-link'])) ? $item['author-link']."?tab=profile" : $item['url']); + $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; + + if(strlen($item['author-link'])) { + if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { + $profile_link = $redirect_url; + $pm_url = $a->get_baseurl() . '/message/new/' . $item['cid'] ; + $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $item['cid'] ; + } + elseif(isset($a->authors[$item['author-link']])) { + $profile_link = $a->get_baseurl() . '/redir/' . $a->authors[$item['author-link']]['id']; + if ($a->authors[$item['author-link']]['network']==='dfrn'){ + $pm_url = $a->get_baseurl() . '/message/new/' . $a->authors[$item['author-link']]['id']; + } + $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $a->authors[$item['author-link']]['id'] ; + + } + } + + + $menu = Array( + t("View profile") => $profile_link, + t("Edit contact") => $contact_url, + t("Send PM") => $pm_url + ); + + $args = array($item, &$menu); + + call_hooks('item_photo_menu', $args); + + $o = ""; + foreach($menu as $k=>$v){ + if ($v!="") $o .= "
  • $k
  • \n"; + } + return $o; +}} diff --git a/mod/network.php b/mod/network.php index 84efe52ba7..13ce81abc8 100644 --- a/mod/network.php +++ b/mod/network.php @@ -209,6 +209,7 @@ function network_content(&$a, $update = 0) { intval($a->pager['start']), intval($a->pager['itemspage']) ); + } else { @@ -315,11 +316,12 @@ function network_content(&$a, $update = 0) { $drop = replace_macros($droptpl,array('$id' => $item['id'])); $lock = '
    '; - + $o .= replace_macros($tpl,array( '$id' => $item['item_id'], '$linktitle' => t('View $name\'s profile'), '$profile_url' => $profile_link, + '$item_photo_menu' => item_photo_menu($item), '$name' => $profile_name, '$sparkle' => $sparkle, '$lock' => $lock, @@ -543,7 +545,6 @@ function network_content(&$a, $update = 0) { $indent .= ' shiny'; - $contact_url = $a->get_baseurl()."/contacts/".$item['cid']; // Build the HTML @@ -555,9 +556,7 @@ function network_content(&$a, $update = 0) { '$wall' => t('Wall-to-Wall'), '$vwall' => t('via Wall-To-Wall:'), '$profile_url' => $profile_link, - '$profile_tab_url' => $profile_link."?tab=profile", //don't work with secure redirects - '$contact_url' => $contact_url, - '$pm_url' => "", + '$item_photo_menu' => item_photo_menu($item), '$name' => $profile_name, '$thumb' => $profile_avatar, '$osparkle' => $osparkle, diff --git a/mod/profile.php b/mod/profile.php index 17f6a2d451..ab1e8f7384 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -454,10 +454,12 @@ function profile_content(&$a, $update = 0) { if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) $indent .= ' shiny'; + $tmp_item = replace_macros($template,array( '$id' => $item['item_id'], '$linktitle' => t('View $name\'s profile'), '$profile_url' => $profile_link, + '$item_photo_menu' => item_photo_menu($item), '$name' => $profile_name, '$thumb' => $profile_avatar, '$sparkle' => $sparkle, diff --git a/mod/search.php b/mod/search.php index db7279fb56..64281dfcfb 100644 --- a/mod/search.php +++ b/mod/search.php @@ -115,6 +115,7 @@ function search_content(&$a) { '$id' => $item['item_id'], '$linktitle' => t('View $name\'s profile'), '$profile_url' => $profile_link, + '$item_photo_menu' => item_photo_menu($item), '$name' => $profile_name, '$sparkle' => $sparkle, '$lock' => $lock, diff --git a/view/search_item.tpl b/view/search_item.tpl index f890bdee5e..02c31fe141 100644 --- a/view/search_item.tpl +++ b/view/search_item.tpl @@ -1,9 +1,17 @@
    -
    +
    $name + menu +
    +
      + $item_photo_menu +
    +
    diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index ac6ebf8073..3543c3a4d2 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -882,7 +882,7 @@ input#dfrn-url { } .wall-item-photo-menu { - width: 90px; + width: auto; border: 2px solid #444444; background: #FFFFFF; position: absolute; @@ -892,7 +892,6 @@ input#dfrn-url { .wall-item-photo-menu ul { margin:0px; padding: 0px; list-style: none } .wall-item-photo-menu li a { display: block; padding: 2px; } .wall-item-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; } -.wall-item-photo-menu li a[href=""] { display: none } .comment .wall-item-photo-menu-button { top: 44px;} diff --git a/view/wall_item.tpl b/view/wall_item.tpl index c78fbb61f9..8934832590 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -2,16 +2,15 @@
    + onmouseover="if (typeof t$id != 'undefined') clearTimeout(t$id); openMenu('wall-item-photo-menu-button-$id')" + onmouseout="t$id=setTimeout('closeMenu(\'wall-item-photo-menu-button-$id\'); closeMenu(\'wall-item-photo-menu-$id\');',200)"> $name menu
    From 29878d9c267ef50eeb7aa5ef1b8725d2dfbb700f Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 31 Mar 2011 16:54:06 +0200 Subject: [PATCH 3/9] url \"/message/new/\" preselect contact in \"To\" select box --- mod/message.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/message.php b/mod/message.php index 9d30abd668..da35e1896b 100644 --- a/mod/message.php +++ b/mod/message.php @@ -172,7 +172,9 @@ function message_content(&$a) { '$linkurl' => t('Please enter a link URL:') )); - $select = contact_select('messageto','message-to-select', false, 4, true); + $preselect = (isset($a->argv[2])?array($a->argv[2]):false); + + $select = contact_select('messageto','message-to-select', $preselect, 4, true); $tpl = load_view_file('view/prv_message.tpl'); $o .= replace_macros($tpl,array( '$header' => t('Send Private Message'), From 8fbc60661656b52681dc763e0e93ef6052bc1c11 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 31 Mar 2011 17:02:13 +0200 Subject: [PATCH 4/9] popup styles to loozah theme --- view/theme/loozah/photo-menu.jpg | Bin 0 -> 464 bytes view/theme/loozah/style.css | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 view/theme/loozah/photo-menu.jpg diff --git a/view/theme/loozah/photo-menu.jpg b/view/theme/loozah/photo-menu.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bd39696a2404ac9062990337959ff16e2d4b472d GIT binary patch literal 464 zcmex=&g!NbMF!_CFb&C4ewz{@Ad$IUGuCLky*A}T7%!!Ir&CL$pu zA}RthgpnDjhlQ1sm6cP3mz!6FWbpq0gCGZk0D}NCqY?v?AS1INk^)i34xu5^%6xO!Lc`^j5E!kyH)IQazDm*&LbK$Q#cDYY4bSKFz L`;_tR`Tv^$L;Y}I literal 0 HcmV?d00001 diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index a618381575..a9295344b2 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -959,6 +959,7 @@ input#dfrn-url { .wall-item-content-wrapper { margin-top: 10px; border: 1px solid #CCC; + position: relative; } .wall-item-content-wrapper.comment { @@ -973,6 +974,34 @@ input#dfrn-url { width: 100px; float: left; } + +.wall-item-photo-menu-button { + display: block; + position: absolute; + background-image: url("photo-menu.jpg"); + background-position: top left; + background-repeat: no-repeat; + margin: 0px; padding: 0px; + width: 16px; + height: 16px; + top: 74px; left:10px; + overflow: hidden; + text-indent: 40px; + display: none; +} +.wall-item-photo-menu { + width: auto; + border: 2px solid #444444; + background: #FFFFFF; + position: absolute; + left: 10px; top: 90px; + display: none; +} +.wall-item-photo-menu ul { margin:0px; padding: 0px; list-style: none } +.wall-item-photo-menu li a { display: block; padding: 2px; } +.wall-item-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; } + + .wall-item-arrowphoto-wrapper { margin-top: 40px; margin-right: 20px; From b59c504b16c1326e37019c58f0e989c85411fcd5 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 1 Apr 2011 09:00:53 +0200 Subject: [PATCH 5/9] fix typo --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index efa9e4bdfd..8084fcc11c 100644 --- a/boot.php +++ b/boot.php @@ -2675,7 +2675,7 @@ if(! function_exists('item_photo_menu')){ function item_photo_menu($item){ $a = get_app(); - if (!isset($a->autors)){ + if (!isset($a->authors)){ $rr = q("SELECT id, network, url FROM contact WHERE uid=%d AND self!=1", intval(local_user())); $authors = array(); foreach($rr as $r) $authors[$r['url']]= $r; From 454c4d0b70cb6e3f9b858beb97e4b3bf25714e99 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 1 Apr 2011 09:04:55 +0200 Subject: [PATCH 6/9] \"View profile\" send to user profile page and not to tab. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 8084fcc11c..7503d69e98 100644 --- a/boot.php +++ b/boot.php @@ -2685,7 +2685,7 @@ function item_photo_menu($item){ $contact_url=""; $pm_url=""; - $profile_link = ((strlen($item['author-link'])) ? $item['author-link']."?tab=profile" : $item['url']); + $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; if(strlen($item['author-link'])) { From b48e82d12ab3d5ea07f9e8410aacb9c3ae842539 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 4 Apr 2011 09:28:19 +0200 Subject: [PATCH 7/9] put popupmenu above all --- view/theme/duepuntozero/style.css | 1 + view/theme/loozah/style.css | 1 + 2 files changed, 2 insertions(+) diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 3543c3a4d2..c29c8795f5 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -888,6 +888,7 @@ input#dfrn-url { position: absolute; left: 10px; top: 90px; display: none; + z-index: 10000; } .wall-item-photo-menu ul { margin:0px; padding: 0px; list-style: none } .wall-item-photo-menu li a { display: block; padding: 2px; } diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index a9295344b2..66cc583561 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -996,6 +996,7 @@ input#dfrn-url { position: absolute; left: 10px; top: 90px; display: none; + z-index: 10000; } .wall-item-photo-menu ul { margin:0px; padding: 0px; list-style: none } .wall-item-photo-menu li a { display: block; padding: 2px; } From afa0d8ff70465e71595165a2f4fb111bac306fd2 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 4 Apr 2011 09:50:25 +0200 Subject: [PATCH 8/9] fix profile redirect url in dfrn_poll --- mod/dfrn_poll.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 25b28c63ce..8dd4d31ede 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -445,7 +445,8 @@ function dfrn_poll_content(&$a) { 'sec' => $sec )); } - + + $profile = $r[0]['nickname']; switch($destination_url) { case 'profile': $dest = $a->get_baseurl() . '/profile/' . $profile . '?tab=profile'; @@ -487,7 +488,7 @@ function dfrn_poll_content(&$a) { dbesc($session_id) ); } - $profile = $r[0]['nickname']; + goaway($dest); } From 890753e5b545ca5777c6c9084e99cacf42a3b485 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 4 Apr 2011 09:51:20 +0200 Subject: [PATCH 9/9] add popupmenu links to status, profile and photos if contact is in dfrn --- boot.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 334f0a742f..708d909013 100644 --- a/boot.php +++ b/boot.php @@ -2682,17 +2682,27 @@ function item_photo_menu($item){ $contact_url=""; $pm_url=""; + $status_link=""; + $photo_link=""; $profile_link = ((strlen($item['author-link'])) ? $item['author-link'] : $item['url']); $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; + + if(strlen($item['author-link'])) { if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) { - $profile_link = $redirect_url; + $status_link = $redirect_url."?url=status"; + $profile_link = $redirect_url."?url=profile"; + $photos_link = $redirect_url."?url=photos"; $pm_url = $a->get_baseurl() . '/message/new/' . $item['cid'] ; $contact_url = $item['self']?"":$a->get_baseurl() . '/contacts/' . $item['cid'] ; } elseif(isset($a->authors[$item['author-link']])) { - $profile_link = $a->get_baseurl() . '/redir/' . $a->authors[$item['author-link']]['id']; + $redirect_url = $a->get_baseurl() . '/redir/' . $a->authors[$item['author-link']]['id']; + $status_link = $redirect_url."?url=status"; + $profile_link = $redirect_url."?url=profile"; + $photos_link = $redirect_url."?url=photos"; + if ($a->authors[$item['author-link']]['network']==='dfrn'){ $pm_url = $a->get_baseurl() . '/message/new/' . $a->authors[$item['author-link']]['id']; } @@ -2703,11 +2713,14 @@ function item_photo_menu($item){ $menu = Array( + t("View status") => $status_link, t("View profile") => $profile_link, + t("View photos") => $photos_link, t("Edit contact") => $contact_url, - t("Send PM") => $pm_url + t("Send PM") => $pm_url, ); + $args = array($item, &$menu); call_hooks('item_photo_menu', $args);