diff options
-rw-r--r-- | mod/connedit.php | 17 | ||||
-rw-r--r-- | view/css/mod_connedit.css | 9 | ||||
-rwxr-xr-x | view/tpl/abook_edit.tpl | 8 | ||||
-rw-r--r-- | view/tpl/rating_slider.tpl | 2 |
4 files changed, 33 insertions, 3 deletions
diff --git a/mod/connedit.php b/mod/connedit.php index cf6ff6aad..87d5e9eca 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -107,6 +107,14 @@ function connedit_post(&$a) { if($closeness < 0) $closeness = 99; + $rating = intval($_POST['rating']); + if($rating < (-10)) + $rating = (-10); + if($rating > 10) + $rating = 10; + + $rating_text = escape_tags($_REQUEST['rating_text']); + $abook_my_perms = 0; foreach($_POST as $k => $v) { @@ -125,11 +133,13 @@ function connedit_post(&$a) { $new_friend = true; } - $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d + $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_rating = %d, abook_rating_text = '%s', abook_flags = %d where abook_id = %d AND abook_channel = %d", dbesc($profile_id), intval($abook_my_perms), intval($closeness), + intval($rating), + dbesc($rating_text), intval($abook_flags), intval($contact_id), intval(local_user()) @@ -561,8 +571,11 @@ function connedit_content(&$a) { '$buttons' => (($self) ? '' : $buttons), '$viewprof' => t('View Profile'), '$lbl_slider' => t('Slide to adjust your degree of friendship'), - '$lbl_rating' => t('Rating (this information is public)'), + '$lbl_rating' => t('Rating (this information may be public)'), + '$lbl_rating_txt' => t('Optionally explain your rating (this information may be public)'), + '$rating_txt' => $contact['abook_rating_text'], '$rating' => $rating, + '$rating_val' => $contact['abook_rating'], '$slide' => $slide, '$tabs' => $t, '$tab_str' => $tab_str, diff --git a/view/css/mod_connedit.css b/view/css/mod_connedit.css index 98c53602b..44a0a1abf 100644 --- a/view/css/mod_connedit.css +++ b/view/css/mod_connedit.css @@ -52,6 +52,15 @@ width: 600px !important; } +#rating-slider { + width: 600px !important; +} + +#rating-text { + width: 400px; + height: 60px; +} + .abook-edit-them, .abook-edit-me { float: left; margin-left: 10px; diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl index c38cc8ffb..3709944e9 100755 --- a/view/tpl/abook_edit.tpl +++ b/view/tpl/abook_edit.tpl @@ -49,6 +49,7 @@ {{$rating}} + {{/if}} {{/if}} @@ -65,6 +66,7 @@ <input type="hidden" name="contact_id" value="{{$contact_id}}"> <input id="contact-closeness-mirror" type="hidden" name="closeness" value="{{$close}}" /> +<input id="contact-rating-mirror" type="hidden" name="rating" value="{{$rating_val}}" /> @@ -74,6 +76,12 @@ </div> {{/if}} +{{if $notself}} +<h3 class="abook-rating-text-desc">{{$lbl_rating_txt}}</h3> +<textarea name="rating_text" id="rating-text" >{{$rating_txt}}</textarea> +{{/if}} + + {{if $multiprofs }} <div> <h3>{{$lbl_vis1}}</h3> diff --git a/view/tpl/rating_slider.tpl b/view/tpl/rating_slider.tpl index 6bdb57cd1..4702fc65b 100644 --- a/view/tpl/rating_slider.tpl +++ b/view/tpl/rating_slider.tpl @@ -1,4 +1,4 @@ <div id="rating-slider" class="slider" style="height: 32px; position: relative; left: 5%; width: 90%;"><input id="rating-range" type="text" name="fake-rating" value="{{$val}}" /></div> <script> - $("#rating-range").jRange({ from: {{$min|default:'-10'}}, to: 10, step: 1, width:'100%', showLabels: false, onstatechange: function(v) { $("#contact-rating-mirror").val(v); } }); + $("#rating-range").jRange({ from: -10, to: 10, step: 1, width:'100%', showLabels: false, showScale: true, scale : [ '-10','-8','-6','-4','-2','0','2','4','6','8','10' ], onstatechange: function(v) { $("#contact-rating-mirror").val(v); } }); </script> |