diff options
-rw-r--r-- | mod/contacts.php | 20 | ||||
-rw-r--r-- | view/contact_edit.tpl | 1 | ||||
-rw-r--r-- | view/contact_slider.tpl | 4 | ||||
-rw-r--r-- | view/main_slider.tpl | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index fb4595739..a4a1b9d36 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -105,14 +105,19 @@ function contacts_post(&$a) { if($priority > 5 || $priority < 0) $priority = 0; + $closeness = intval($_POST['closeness']); + if($closeness < 0) + $closeness = 99; + $info = fix_mce_lf(escape_tags(trim($_POST['info']))); $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s', - `hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", + `hidden` = %d, closeness = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), intval($priority), dbesc($info), intval($hidden), + intval($closeness), intval($contact_id), intval(local_user()) ); @@ -337,6 +342,18 @@ function contacts_content(&$a) { $lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : ''); + $slider_tpl = get_markup_template('contact_slider.tpl'); + $o .= replace_macros($slider_tpl,array( + '$me' => t('Me'), + '$val' => $contact['closeness'], + '$intimate' => t('Best Friends'), + '$friends' => t('Friends'), + '$coworkers' => t('Co-workers'), + '$oldfriends' => t('Former Friends'), + '$acquaintances' => t('Acquaintances'), + '$world' => t('Everybody') + )); + $o .= replace_macros($tpl,array( '$header' => t('Contact Editor'), '$tab_str' => $tab_str, @@ -345,6 +362,7 @@ function contacts_content(&$a) { '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['name']), '$lbl_info1' => t('Contact Information / Notes'), '$infedit' => t('Edit contact notes'), + '$close' => $contact['closeness'], '$common_text' => $common_text, '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'], '$all_friends' => $all_friends, diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl index c68ca7f1d..4f99b4aca 100644 --- a/view/contact_edit.tpl +++ b/view/contact_edit.tpl @@ -56,6 +56,7 @@ <form action="contacts/$contact_id" method="post" > <input type="hidden" name="contact_id" value="$contact_id"> +<input id="contact-closeness-mirror" type="hidden" name="closeness" value="$close" /> {{ if $poll_enabled }} <div id="contact-edit-poll-wrapper"> diff --git a/view/contact_slider.tpl b/view/contact_slider.tpl new file mode 100644 index 000000000..9b8a52320 --- /dev/null +++ b/view/contact_slider.tpl @@ -0,0 +1,4 @@ +<div id="slider" style="height: 32px; position: relative; left: 5%; width: 90%;"><input id="contact-range" type="text" name="fake-closeness" value="$val" /></div> +<script> + $("#contact-range").slider({ from: 0, to: 99, step: 1, scale: ['$me', '$intimate', '|', '$friends', '|', '$coworkers', '|', '$oldfriends', '|', '$acquaintances', '|', '$world' ], onstatechange: function(v) { $("#contact-closeness-mirror").val(v); } }); +</script> diff --git a/view/main_slider.tpl b/view/main_slider.tpl index 7d03beeb1..a559eae22 100644 --- a/view/main_slider.tpl +++ b/view/main_slider.tpl @@ -1,4 +1,4 @@ -<div id="slider" style="height: 32px; position: relative; left: 5%; width: 90%;"><input id="main-range" type="slider" name="closeness" value="0;99" /></div> +<div id="slider" style="height: 32px; position: relative; left: 5%; width: 90%;"><input id="main-range" type="text" name="cminmax" value="0;99" /></div> <script> $("#main-range").slider({ from: 0, to: 99, step: 1, scale: ['$me', '$intimate', '|', '$friends', '|', '$coworkers', '|', '$oldfriends', '|', '$acquaintances', '|', '$world' ] }); </script> |