From 74d61ed00b9ff6fe768d4a0f4a27da246020c270 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 24 Aug 2011 22:40:26 -0700 Subject: [PATCH] contact menu beginnings --- include/Contact.php | 52 +++++++++++++++++++++++++++++++ mod/contacts.php | 1 + view/contact_template.tpl | 12 ++++++- view/theme/duepuntozero/style.css | 31 ++++++++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) diff --git a/include/Contact.php b/include/Contact.php index 4ca77d06..6eda0b6c 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -85,3 +85,55 @@ function unmark_for_death($contact) { ); }} +if(! function_exists('contact_photo_menu')){ +function contact_photo_menu($contact) { + + $a = get_app(); + + $contact_url=""; + $pm_url=""; + $status_link=""; + $photos_link=""; + $posts_link=""; + + $sparkle = false; + if($contact['network'] === NETWORK_DFRN) { + $sparkle = true; + $profile_link = $a->get_baseurl() . '/redir/' . $contact['id']; + } + else + $profile_link = $contact['url']; + + if($profile_link === 'mailbox') + $profile_link = ''; + + if($sparkle) { + $status_link = $profile_link . "?url=status"; + $photos_link = $profile_link . "?url=photos"; + $profile_link = $profile_link . "?url=profile"; + $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id']; + } + + $contact_url = $a->get_baseurl() . '/contacts/' . $cid; + $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid; + + $menu = Array( + t("View status") => $status_link, + t("View profile") => $profile_link, + t("View photos") => $photos_link, + t("View recent") => $posts_link, + t("Edit contact") => $contact_url, + t("Send PM") => $pm_url, + ); + + + $args = array('contact' => $contact, 'menu' => $menu); + + call_hooks('contact_photo_menu', $args); + + $o = ""; + foreach($menu as $k=>$v){ + if ($v!="") $o .= "
  • $k
  • \n"; + } + return $o; +}} diff --git a/mod/contacts.php b/mod/contacts.php index 4d938502..6863bd73 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -422,6 +422,7 @@ function contacts_content(&$a) { $o .= replace_macros($tpl, array( '$img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), '$edit_hover' => t('Edit contact'), + '$contact_photo_menu' => contact_photo_menu($rr), '$id' => $rr['id'], '$alt_text' => $alt_text, '$dir_icon' => $dir_icon, diff --git a/view/contact_template.tpl b/view/contact_template.tpl index e9f61676..a74cebab 100644 --- a/view/contact_template.tpl +++ b/view/contact_template.tpl @@ -12,8 +12,18 @@
    -
    +
    + $name + + menu +
    +
      + $contact_photo_menu +
    +
    +
    diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 5943e506..66e9f857 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -744,6 +744,7 @@ input#dfrn-url { .contact-entry-wrapper { float: left; width: 180px; + height: 120px; } .contact-entry-direction-icon { @@ -1458,6 +1459,36 @@ input#dfrn-url { /*margin-left: 50px;*/ } + +.contact-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: 60px; left:10px; + overflow: hidden; + text-indent: 40px; + display: none; + +} +.contact-photo-menu { + width: auto; + border: 2px solid #444444; + background: #FFFFFF; +/* position: absolute; */ + left: 10px; top: 90px; + display: none; + z-index: 10000; +} +.contact-photo-menu ul { margin:0px; padding: 0px; list-style: none } +.contact-photo-menu li a { display: block; padding: 2px; } +.contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; } + + #block-message, #ignore-message { margin-top: 20px; color: #FF0000;