backport features categories and add some new ones like the affinity slider

This commit is contained in:
friendica 2012-11-28 19:23:39 -08:00
parent 05e08cb5d2
commit e138052584
5 changed files with 85 additions and 49 deletions

View File

@ -14,22 +14,45 @@ function feature_enabled($uid,$feature) {
function get_features() { function get_features() {
$arr = array( $arr = array(
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')), // General
array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')), 'general' => array(
array('commtag', t('Community Tagging'), t('Tag existing posts and share the links')), t('General Features'),
array('categories', t('Post Categories'), t('Add categories to your channel postings')), array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
array('filing', t('Saved Folders'), t('Ability to file posts under easily remembered names')), array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
array('archives', t('Search by Date'), t('Select posts by date ranges')), ),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')), // Post composition
array('preview', t('Post Preview'), t('Preview posts and comments before publishing them')), 'composition' => array(
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')), t('Post Composition Features'),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')), array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
array('richtext', t('Richtext Editor'), t('Use richtext/visual editor where applicable')), array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
array('multi_profiles', t('Multiple Profiles'), t('Show different profiles to different connections/collections')), ),
);
// Network Tools
'net_module' => array(
t('Network and Stream Filtering'),
array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
array('groups', t('Collections Filter'), t('Enable widget to display Network posts only from selected collections')),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity')),
array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships')),
),
// Item tools
'tools' => array(
t('Post/Comment Tools'),
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
array('commtag', t('Tagging'), t('Ability to tag existing posts')),
array('categories', t('Post Categories'), t('Add categories to your posts')),
array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
),
);
call_hooks('get_features',$arr); call_hooks('get_features',$arr);
return $arr; return $arr;

View File

@ -359,16 +359,19 @@ EOT;
$tpl = get_markup_template("abook_edit.tpl"); $tpl = get_markup_template("abook_edit.tpl");
$slider_tpl = get_markup_template('contact_slider.tpl'); if(feature_enabled(local_user(),'affinity')) {
$slide = replace_macros($slider_tpl,array(
'$me' => t('Me'), $slider_tpl = get_markup_template('contact_slider.tpl');
'$val' => $contact['abook_closeness'], $slide = replace_macros($slider_tpl,array(
'$intimate' => t('Best Friends'), '$me' => t('Me'),
'$friends' => t('Friends'), '$val' => $contact['abook_closeness'],
'$oldfriends' => t('Former Friends'), '$intimate' => t('Best Friends'),
'$acquaintances' => t('Acquaintances'), '$friends' => t('Friends'),
'$world' => t('Unknown') '$oldfriends' => t('Former Friends'),
)); '$acquaintances' => t('Acquaintances'),
'$world' => t('Unknown')
));
}
$perms = array(); $perms = array();
$channel = $a->get_channel(); $channel = $a->get_channel();

View File

@ -368,26 +368,27 @@ function network_content(&$a, $update = 0, $load = false) {
if(! $update) { if(! $update) {
if(feature_enabled(local_user(),'affinity')) {
$tpl = get_markup_template('main_slider.tpl'); $tpl = get_markup_template('main_slider.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$val' => intval($cmin) . ';' . intval($cmax), '$val' => intval($cmin) . ';' . intval($cmax),
'$refresh' => t('Refresh'), '$refresh' => t('Refresh'),
'$me' => t('Me'), '$me' => t('Me'),
'$intimate' => t('Best Friends'), '$intimate' => t('Best Friends'),
'$friends' => t('Friends'), '$friends' => t('Friends'),
'$coworkers' => t('Co-workers'), '$coworkers' => t('Co-workers'),
'$oldfriends' => t('Former Friends'), '$oldfriends' => t('Former Friends'),
'$acquaintances' => t('Acquaintances'), '$acquaintances' => t('Acquaintances'),
'$world' => t('Everybody') '$world' => t('Everybody')
)); ));
}
$arr = array('tabs' => $tabs); $arr = array('tabs' => $tabs);
call_hooks('network_tabs', $arr); call_hooks('network_tabs', $arr);
$o .= replace_macros(get_markup_template('common_tabs.tpl'), array('$tabs'=> $arr['tabs'])); $o .= replace_macros(get_markup_template('common_tabs.tpl'), array('$tabs'=> $arr['tabs']));
// --- end item filter tabs // --- end item filter tabs
// search terms header // search terms header
@ -666,7 +667,7 @@ function network_content(&$a, $update = 0, $load = false) {
); );
} }
else { else {
dbg(1);
$r = q("SELECT item.id AS item_id FROM item $r = q("SELECT item.id AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan left join abook on item.author_xchan = abook.abook_xchan
WHERE item.uid = %d AND item.item_restrict = 0 WHERE item.uid = %d AND item.item_restrict = 0
@ -677,7 +678,7 @@ dbg(1);
intval(local_user()), intval(local_user()),
intval(ABOOK_FLAG_BLOCKED) intval(ABOOK_FLAG_BLOCKED)
); );
dbg(0);
} }
// Then fetch all the children of the parents that are on this page // Then fetch all the children of the parents that are on this page

View File

@ -654,17 +654,22 @@ function settings_content(&$a) {
$arr = array(); $arr = array();
$features = get_features(); $features = get_features();
foreach($features as $f) {
$arr[] = array('feature_' .$f[0],$f[1],((intval(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On'))); foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
$arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
}
} }
$tpl = get_markup_template("settings_features.tpl"); $tpl = get_markup_template("settings_features.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_features"), '$form_security_token' => get_form_security_token("settings_features"),
'$title' => t('Additional Features'), '$title' => t('Additional Features'),
'$features' => $arr, '$features' => $arr,
'$submit' => t('Submit') '$submit' => t('Submit'),
'$field_yesno' => 'field_yesno.tpl',
)); ));
return $o; return $o;
} }

View File

@ -5,7 +5,11 @@
<input type='hidden' name='form_security_token' value='$form_security_token'> <input type='hidden' name='form_security_token' value='$form_security_token'>
{{ for $features as $f }} {{ for $features as $f }}
{{ inc field_yesno.tpl with $field=$f }}{{endinc}} <h3 class="settings-heading">$f.0</h3>
{{ for $f.1 as $fcat }}
{{ inc $field_yesno with $field=$fcat }}{{endinc}}
{{ endfor }}
{{ endfor }} {{ endfor }}
<div class="settings-submit-wrapper" > <div class="settings-submit-wrapper" >