contact edit slider
This commit is contained in:
parent
92d4e6ebb3
commit
945ac38a73
@ -105,14 +105,19 @@ function contacts_post(&$a) {
|
|||||||
if($priority > 5 || $priority < 0)
|
if($priority > 5 || $priority < 0)
|
||||||
$priority = 0;
|
$priority = 0;
|
||||||
|
|
||||||
|
$closeness = intval($_POST['closeness']);
|
||||||
|
if($closeness < 0)
|
||||||
|
$closeness = 99;
|
||||||
|
|
||||||
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
|
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
|
$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($profile_id),
|
||||||
intval($priority),
|
intval($priority),
|
||||||
dbesc($info),
|
dbesc($info),
|
||||||
intval($hidden),
|
intval($hidden),
|
||||||
|
intval($closeness),
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval(local_user())
|
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!') : '');
|
$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(
|
$o .= replace_macros($tpl,array(
|
||||||
'$header' => t('Contact Editor'),
|
'$header' => t('Contact Editor'),
|
||||||
'$tab_str' => $tab_str,
|
'$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_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'),
|
'$lbl_info1' => t('Contact Information / Notes'),
|
||||||
'$infedit' => t('Edit contact notes'),
|
'$infedit' => t('Edit contact notes'),
|
||||||
|
'$close' => $contact['closeness'],
|
||||||
'$common_text' => $common_text,
|
'$common_text' => $common_text,
|
||||||
'$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
|
'$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
|
||||||
'$all_friends' => $all_friends,
|
'$all_friends' => $all_friends,
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
<form action="contacts/$contact_id" method="post" >
|
<form action="contacts/$contact_id" method="post" >
|
||||||
<input type="hidden" name="contact_id" value="$contact_id">
|
<input type="hidden" name="contact_id" value="$contact_id">
|
||||||
|
<input id="contact-closeness-mirror" type="hidden" name="closeness" value="$close" />
|
||||||
|
|
||||||
{{ if $poll_enabled }}
|
{{ if $poll_enabled }}
|
||||||
<div id="contact-edit-poll-wrapper">
|
<div id="contact-edit-poll-wrapper">
|
||||||
|
4
view/contact_slider.tpl
Normal file
4
view/contact_slider.tpl
Normal file
@ -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>
|
@ -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>
|
<script>
|
||||||
$("#main-range").slider({ from: 0, to: 99, step: 1, scale: ['$me', '$intimate', '|', '$friends', '|', '$coworkers', '|', '$oldfriends', '|', '$acquaintances', '|', '$world' ] });
|
$("#main-range").slider({ from: 0, to: 99, step: 1, scale: ['$me', '$intimate', '|', '$friends', '|', '$coworkers', '|', '$oldfriends', '|', '$acquaintances', '|', '$world' ] });
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user