From 7f712973831212694de824a2e63961b98ef53959 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Jul 2015 12:46:40 +0200 Subject: cleanup connedit --- mod/connedit.php | 118 ++++++++++++++++++------------------------------------- 1 file changed, 38 insertions(+), 80 deletions(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index 71166b2cc..39a69364d 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -144,7 +144,6 @@ function connedit_post(&$a) { dbesc($orig_record[0]['abook_xchan']) ); - if($z) { $record = $z[0]['xlink_id']; $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s' @@ -493,59 +492,58 @@ function connedit_content(&$a) { $contact_id = $a->poi['abook_id']; $contact = $a->poi; + $buttons = array( - $tabs = array( - - array( + 'view' => array( 'label' => t('View Profile'), 'url' => chanlink_cid($contact['abook_id']), 'sel' => '', 'title' => sprintf( t('View %s\'s profile'), $contact['xchan_name']), ), - array( + 'refresh' => array( 'label' => t('Refresh Permissions'), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh', 'sel' => '', 'title' => t('Fetch updated permissions'), ), - array( + 'recent' => array( 'label' => t('Recent Activity'), 'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'], 'sel' => '', 'title' => t('View recent posts and comments'), - ) - ); + ), - $buttons = array( - array( + 'block' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('Unblock') : t('Block')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? 'active' : ''), 'title' => t('Block (or Unblock) all communications with this connection'), ), - array( + 'ignore' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('Unignore') : t('Ignore')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? 'active' : ''), 'title' => t('Ignore (or Unignore) all inbound communications from this connection'), ), - array( + + 'archive' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('Unarchive') : t('Archive')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'active' : ''), 'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'), ), - array( + + 'hide' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('Unhide') : t('Hide')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? 'active' : ''), 'title' => t('Hide or Unhide this connection from your other connections'), ), - array( + 'delete' => array( 'label' => t('Delete'), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop', 'sel' => '', @@ -556,18 +554,9 @@ function connedit_content(&$a) { $self = false; - if(! ($contact['abook_flags'] & ABOOK_FLAG_SELF)) { - $tab_tpl = get_markup_template('common_tabs.tpl'); - $t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); - } - else + if(($contact['abook_flags'] & ABOOK_FLAG_SELF)) $self = true; - $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( - '$baseurl' => $a->get_baseurl(true), - '$editselect' => $editselect - )); - require_once('include/contact_selectors.php'); $tpl = get_markup_template("abook_edit.tpl"); @@ -616,7 +605,6 @@ function connedit_content(&$a) { $rating_text = $xl[0]['xlink_rating_text']; } - $poco_rating = get_config('system','poco_rating_enable'); // if unset default to enabled @@ -640,8 +628,19 @@ function connedit_content(&$a) { $global_perms = get_perms(); $existing = get_all_perms(local_channel(),$contact['abook_xchan']); - $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication')); - + $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'), array(t('No'),('Yes'))); + + $multiprofs = ((feature_enabled(local_channel(),'multi_profiles')) ? true : false); + + if($slide && !$multiprofs) + $affinity = t('Set Affinity'); + + if(!$slide && $multiprofs) + $affinity = t('Set Profile'); + + if($slide && $multiprofs) + $affinity = t('Set Affinity & Profile'); + foreach($global_perms as $k => $v) { $thisperm = (($contact['abook_my_perms'] & $v[1]) ? "1" : ''); @@ -656,85 +655,44 @@ function connedit_content(&$a) { $o .= replace_macros($tpl,array( - '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])), - '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), ''), + '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), + '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), '', array(t('No'),('Yes'))), '$addr' => $contact['xchan_addr'], + '$addr_text' => t('This connection\'s address is'), '$notself' => (($self) ? '' : '1'), '$self' => (($self) ? '1' : ''), '$autolbl' => t('Apply the permissions indicated on this page to all new connections.'), '$buttons' => (($self) ? '' : $buttons), - '$viewprof' => t('View Profile'), - '$clickme' => t('Click to open/close'), '$lbl_slider' => t('Slide to adjust your degree of friendship'), - '$lbl_rating' => t('Rating (this information is public)'), - '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'), + '$lbl_rating' => t('Rating'), + '$lbl_rating_label' => t('Slide to adjust your rating'), + '$lbl_rating_txt' => t('Optionally explain your rating'), '$connfilter' => feature_enabled(local_channel(),'connfilter'), '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), - '$rating_text' => array('rating_text', t('Optionally explain your rating (this information is public)'),$rating_text,''), + '$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''), + '$rating_info' => t('This information is public!'), '$rating' => $rating, '$rating_val' => $rating_val, '$slide' => $slide, - '$tabs' => $t, - '$tab_str' => $tab_str, - '$perms_step1' => t('Default permissions for your channel type have (just) been applied. They have not yet been submitted. Please review the permissions on this page and make any desired changes at this time. This new connection may not be able to communicate with you until you submit this page, which will install and apply the selected permissions.'), + '$affinity' => $affinity, '$is_pending' => (($contact['abook_flags'] & ABOOK_FLAG_PENDING) ? 1 : ''), '$unapproved' => $unapproved, '$inherited' => t('inherited'), - '$approve' => t('Approve this connection'), - '$noperms' => (($contact['abook_my_perms']) ? false : true), - '$no_perms' => (((! $self) && (! $contact['abook_my_perms'])) ? t('Connection has no individual permissions!') : ''), - '$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your privacy settings, though you may wish to review the "Advanced Permissions".') : ''), '$submit' => t('Submit'), - '$lbl_vis1' => t('Profile Visibility'), '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']), - '$lbl_info1' => t('Contact Information / Notes'), - '$infedit' => t('Edit contact notes'), '$close' => $contact['abook_closeness'], '$them' => t('Their Settings'), '$me' => t('My Settings'), '$perms' => $perms, - '$perms_new' => t('Default permissions for this channel type have (just) been applied. They have not been saved and there are currently no stored default permissions. Please review/edit the applied settings and click [Submit] to finalize.'), - '$clear' => t('Clear/Disable Automatic Permissions'), - '$forum' => t('Forum Members'), - '$soapbox' => t('Soapbox'), - '$full' => t('Full Sharing (typical social network permissions)'), - '$cautious' => t('Cautious Sharing '), - '$follow' => t('Follow Only'), '$permlbl' => t('Individual Permissions'), - '$permnote' => t('Some permissions may be inherited from your channel privacy settings, which have higher priority than individual settings. Changing those inherited settings on this page will have no effect.'), - '$advanced' => t('Advanced Permissions'), - '$quick' => t('Simple Permissions (select one and submit)'), - '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_channel() . '/' . $contact['id'], - '$all_friends' => $all_friends, - '$relation_text' => $relation_text, - '$visit' => sprintf( t('Visit %s\'s profile - %s'),$contact['xchan_name'],$contact['xchan_url']), - '$blockunblock' => t('Block/Unblock contact'), - '$ignorecont' => t('Ignore contact'), - '$lblcrepair' => t("Repair URL settings"), - '$lblrecent' => t('View conversations'), - '$lblsuggest' => $lblsuggest, - '$delete' => t('Delete contact'), - - '$poll_interval' => contact_poll_interval($contact['priority'],(! $poll_enabled)), - '$poll_enabled' => $poll_enabled, + '$permnote' => t('Some permissions may be inherited from your channel\'s privacy settings, which have higher priority than individual settings. You can not change those settings here.'), '$lastupdtext' => t('Last update:'), - '$lost_contact' => $lost_contact, - '$updpub' => t('Update public posts'), '$last_update' => relative_date($contact['abook_connected']), - '$udnow' => t('Update now'), '$profile_select' => contact_profile_assign($contact['abook_profile']), - '$multiprofs' => feature_enabled(local_channel(),'multi_profiles'), + '$multiprofs' => $multiprofs, '$contact_id' => $contact['abook_id'], - '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), - '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), - '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), - '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), - '$archived' => (($contact['archive']) ? t('Currently archived') : ''), - '$pending' => (($contact['archive']) ? t('Currently pending') : ''), - '$name' => $contact['name'], - '$alt_text' => $alt_text, - '$url' => $url + '$name' => $contact['xchan_name'], )); -- cgit v1.2.3 From 711dd1468db2116a2003494d4fe6d8a7c5ed7c7b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Jul 2015 13:16:08 +0200 Subject: provide inherited perms for connection default permissions --- mod/connedit.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index 39a69364d..a72714a1d 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -650,9 +650,11 @@ function connedit_content(&$a) { if((! $self) && ($existing[$k])) $thisperm = "1"; - $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]); + $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4]); } + //print_r($perms); killme(); + $o .= replace_macros($tpl,array( '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), -- cgit v1.2.3 From d8edb66287d7f5423c7a4ca8f87ae949465f3b68 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Jul 2015 13:21:39 +0200 Subject: remove dbg --- mod/connedit.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index a72714a1d..a769ed686 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -653,8 +653,6 @@ function connedit_content(&$a) { $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4]); } - //print_r($perms); killme(); - $o .= replace_macros($tpl,array( '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), -- cgit v1.2.3 From dd57864867da2a1ddaf7b96094f924de9a3262a4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Jul 2015 13:46:22 +0200 Subject: revert provide inherited perms for connection default permissions --- mod/connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index a769ed686..39a69364d 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -650,7 +650,7 @@ function connedit_content(&$a) { if((! $self) && ($existing[$k])) $thisperm = "1"; - $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4]); + $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]); } $o .= replace_macros($tpl,array( -- cgit v1.2.3 From 104cbcab722477340961d45a93a441bb9fbc7e7a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 14 Jul 2015 21:32:18 +0200 Subject: make strings translateable --- mod/connedit.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mod/connedit.php') diff --git a/mod/connedit.php b/mod/connedit.php index 39a69364d..f628fb9d3 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -668,6 +668,7 @@ function connedit_content(&$a) { '$lbl_rating_label' => t('Slide to adjust your rating'), '$lbl_rating_txt' => t('Optionally explain your rating'), '$connfilter' => feature_enabled(local_channel(),'connfilter'), + '$connfilter_label' => t('Custom Filter'), '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), '$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''), @@ -676,6 +677,11 @@ function connedit_content(&$a) { '$rating_val' => $rating_val, '$slide' => $slide, '$affinity' => $affinity, + '$pending_label' => t('Connection Pending Approval'), + '$pending_modal_title' => t('Connection Request'), + '$pending_modal_body' => sprintf(t('(%s) would like to connect with you. Please approve this connection to allow communication.'), $contact['xchan_addr']), + '$pending_modal_approve' => t('Approve'), + '$pending_modal_dismiss' => t('Approve Later'), '$is_pending' => (($contact['abook_flags'] & ABOOK_FLAG_PENDING) ? 1 : ''), '$unapproved' => $unapproved, '$inherited' => t('inherited'), -- cgit v1.2.3