From 398894851628ccb99090e9d70b92a9a909ef7015 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Feb 2015 15:48:39 -0800 Subject: first cut at rating widget. The flaw is that it is limited because it requires local_channel() (formerly local_user()). We need to extend this to take you home like rpost does if you're logged in as remote_channel() - and/or we need zot to send the rating message to the source channel and target in addition to the directories. --- include/identity.php | 6 ++++++ include/widgets.php | 27 +++++++++++++++++++++++++++ version.inc | 2 +- view/css/mod_directory.css | 21 --------------------- view/css/widgets.css | 24 ++++++++++++++++++++++++ view/pdl/mod_ratings.pdl | 1 + view/theme/redbasic/css/style.css | 23 +++++++++++++++++++++-- view/tpl/profile_vcard.tpl | 3 ++- 8 files changed, 82 insertions(+), 25 deletions(-) diff --git a/include/identity.php b/include/identity.php index 2fc183368..aef6471e5 100644 --- a/include/identity.php +++ b/include/identity.php @@ -943,6 +943,11 @@ logger('online: ' . $profile['online']); $tpl = get_markup_template('profile_vcard.tpl'); +// This isn't ideal here because it requires local_channel(). +// We need the rating widget to recognise and take you home if you're remote. +// require_once('include/widgets.php'); +// $z = widget_rating(array('target' => $profile['channel_hash'])); + $o .= replace_macros($tpl, array( '$profile' => $profile, '$connect' => $connect, @@ -954,6 +959,7 @@ logger('online: ' . $profile['online']); '$homepage' => $homepage, '$chanmenu' => $channel_menu, '$diaspora' => $diaspora, + '$rating' => $z, '$contact_block' => $contact_block, )); diff --git a/include/widgets.php b/include/widgets.php index 523318850..71407ad3d 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -903,3 +903,30 @@ function widget_random_block($arr) { return $o; } + + +function widget_rating($arr) { + $a = get_app(); + if(! local_channel()) + return; + + $channel = $a->get_channel(); + + if($arr['target']) + $hash = $arr['target']; + else + $hash = $a->poi['xchan_hash']; + + if(! $hash) + return; + + if($hash == $channel['channel_hash']) + return; + + head_add_js('ratings.js'); + + $o = '
'; + $o .= '
'; + return $o; + +} \ No newline at end of file diff --git a/version.inc b/version.inc index b7a74f141..8d8816a23 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-02-01.934 +2015-02-04.935 diff --git a/view/css/mod_directory.css b/view/css/mod_directory.css index c562764ea..7b149d744 100644 --- a/view/css/mod_directory.css +++ b/view/css/mod_directory.css @@ -6,27 +6,6 @@ float: left; width: 250px; } -.directory-rating { - float: right; - margin-right: 5px; -} - -.slider-container { - padding: 15px; -} - -.rating-text-label { - margin-top: 30px; -} - -.directory-rating-text { - width: 90%; - margin-left: 5%; -} - -.directory-rating-submit { - margin-top: 15px; -} .directory-photo { margin-left: 25px; diff --git a/view/css/widgets.css b/view/css/widgets.css index 4db87e633..43d132276 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -104,3 +104,27 @@ li:hover .group-edit-icon { .chatroomlist td { padding: 0 5px 0; } + +/* ratings */ + +.directory-rating { + float: right; + margin-right: 5px; +} + +.slider-container { + padding: 15px; +} + +.rating-text-label { + margin-top: 30px; +} + +.directory-rating-text { + width: 90%; + margin-left: 5%; +} + +.directory-rating-submit { + margin-top: 15px; +} diff --git a/view/pdl/mod_ratings.pdl b/view/pdl/mod_ratings.pdl index 3d40386cd..0b6e32283 100644 --- a/view/pdl/mod_ratings.pdl +++ b/view/pdl/mod_ratings.pdl @@ -1,5 +1,6 @@ [region=aside] [widget=vcard][/widget] +[widget=rating][/widget] [widget=suggestions][/widget] [widget=findpeople][/widget] [/region] diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index cb58b6e11..32ded75ba 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -771,6 +771,19 @@ footer { clear: both; } +div.rateme { + display: block; + color: $nav_active_icon_colour; + background-color: $nav_bg; + -webkit-border-radius: $radiuspx ; + -moz-border-radius: $radiuspx; + border-radius: $radiuspx; + border: 1px solid $nav_bd; + padding: 5px; + font-weight: bold; + clear: both; +} + #pause { position: fixed; bottom: 5px; @@ -1442,16 +1455,22 @@ div.jGrowl div.jGrowl-notification { width: 90%; } -a.rconnect { +a.rconnect, div.rateme { color: $nav_active_icon_colour; text-decoration: none; + font-weight: normal; outline: none; } -a.rconnect:hover { +a.rconnect:hover, div.rateme:hover { color: #0080FF; + text-decoration: none; } +.widget.rateme { + margin-top: 15px; + padding: 0; +} /* header */ header { diff --git a/view/tpl/profile_vcard.tpl b/view/tpl/profile_vcard.tpl index bff3148f3..bc093ebb5 100755 --- a/view/tpl/profile_vcard.tpl +++ b/view/tpl/profile_vcard.tpl @@ -50,10 +50,11 @@ {{if $connect}} {{$connect}} {{/if}} - +
+ {{$chanmenu}} {{$contact_block}} -- cgit v1.2.3