group_side - unify look with forumlist

This commit is contained in:
rabuzarus 2015-11-28 20:09:28 +01:00
parent 5fe8ae514b
commit a3059d02d4
8 changed files with 74 additions and 52 deletions

View file

@ -213,9 +213,20 @@ function mini_group_select($uid,$gid = 0) {
} }
/**
* @brief Create group sidebar widget
function group_side($every="contacts",$each="group",$edit = false, $group_id = 0, $cid = 0) { *
* @param string $every
* @param string $each
* @param string $editmode
* 'standard' => include link 'Edit groups'
* 'extended' => include link 'Create new group'
* 'full' => include link 'Create new group' and provide for each group a link to edit this group
* @param int $group_id
* @param int $cid
* @return string
*/
function group_side($every="contacts",$each="group",$editmode = "standard", $group_id = 0, $cid = 0) {
$o = ''; $o = '';
@ -245,7 +256,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
foreach($r as $rr) { foreach($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : ''); $selected = (($group_id == $rr['id']) ? ' group-selected' : '');
if ($edit) { if ($editmode == "full") {
$groupedit = array( $groupedit = array(
'href' => "group/".$rr['id'], 'href' => "group/".$rr['id'],
'title' => t('edit'), 'title' => t('edit'),
@ -269,14 +280,17 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
$tpl = get_markup_template("group_side.tpl"); $tpl = get_markup_template("group_side.tpl");
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$title' => t('Groups'), '$title' => t('Groups'),
'newgroup' => (($editmode == "extended") || ($editmode == "full") ? 1 : ''),
'$editgroupstext' => t('Edit groups'),
'grouppage' => "group/",
'$edittext' => t('Edit group'), '$edittext' => t('Edit group'),
'$createtext' => t('Create a new group'), '$createtext' => t('Create a new group'),
'$creategroup' => t('Group Name: '), '$creategroup' => t('Group Name: '),
'$form_security_token' => get_form_security_token("group_edit"), '$form_security_token' => get_form_security_token("group_edit"),
'$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''), '$ungrouped' => (($every === 'contacts') ? t('Contacts not in any group') : ''),
'$groups' => $groups, '$groups' => $groups,
'$add' => t('add'), '$add' => t('add'),
)); ));

View file

@ -55,7 +55,7 @@ function contacts_init(&$a) {
$findpeople_widget .= findpeople_widget(); $findpeople_widget .= findpeople_widget();
} }
$groups_widget .= group_side('contacts','group',false,0,$contact_id); $groups_widget .= group_side('contacts','group','full',0,$contact_id);
$a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array( $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
'$vcard_widget' => $vcard_widget, '$vcard_widget' => $vcard_widget,

View file

@ -7,7 +7,7 @@ function validate_members(&$item) {
function group_init(&$a) { function group_init(&$a) {
if(local_user()) { if(local_user()) {
require_once('include/group.php'); require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group',false,(($a->argc > 1) ? intval($a->argv[1]) : 0)); $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
} }
} }

View file

@ -145,7 +145,7 @@ function network_init(&$a) {
)); ));
} }
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network',true,$group_id) : ''); $a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
$a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : ''); $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : '');
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));

View file

@ -15,7 +15,7 @@ function nogroup_init(&$a) {
if(! x($a->page,'aside')) if(! x($a->page,'aside'))
$a->page['aside'] = ''; $a->page['aside'] = '';
$a->page['aside'] .= group_side('contacts','group',false,0,$contact_id); $a->page['aside'] .= group_side('contacts','group','extended',0,$contact_id);
} }

View file

@ -1,38 +1,42 @@
<div class="widget" id="group-sidebar"> <div class="widget" id="group-sidebar">
<h3>{{$title}}</h3> <h3>{{$title}}</h3>
<div id="sidebar-group-list"> <div id="sidebar-group-list">
<ul role="menu" id="sidebar-group-ul"> <ul role="menu" id="sidebar-group-ul">
{{foreach $groups as $group}} {{foreach $groups as $group}}
<li role="menuitem" class="sidebar-group-li group-{{$group.id}}"> <li role="menuitem" class="sidebar-group-li group-{{$group.id}}">
{{if $group.cid}} {{if ! $newgroup}}<span class="notify badge pull-right"></span>{{/if}}
<input type="checkbox" {{if $group.cid}}
class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action" <input type="checkbox"
onclick="contactgroupChangeMember('{{$group.id}}','{{$group.cid}}');return true;" class="{{if $group.selected}}ticked{{else}}unticked {{/if}} action"
{{if $group.ismember}}checked="checked"{{/if}} onclick="contactgroupChangeMember('{{$group.id}}','{{$group.cid}}');return true;"
/> {{if $group.ismember}}checked="checked"{{/if}}
{{/if}} />
{{if $group.edit}} {{/if}}
<a class="groupsideedit" href="{{$group.edit.href}}" title="{{$edittext}}"><span id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span></a> {{if $group.edit}}
{{/if}} <a class="groupsideedit" href="{{$group.edit.href}}" title="{{$edittext}}">
<a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element {{if $group.selected}}group-selected{{/if}}" href="{{$group.href}}">{{$group.text}}</a> <span id="edit-sidebar-group-element-{{$group.id}}" class="group-edit-icon iconspacer small-pencil"><span class="sr-only">{{$edittext}}</span></span>
<span class="notify"></span> </a>
</li> {{/if}}
{{/foreach}} <a id="sidebar-group-element-{{$group.id}}" class="sidebar-group-element {{if $group.selected}}group-selected{{/if}}" href="{{$group.href}}">{{$group.text}}</a>
</ul> </li>
{{/foreach}}
</ul>
</div> </div>
<div id="sidebar-new-group">
<a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a> {{if $newgroup}}
<form id="group-new-form" action="group/new" method="post" style="display:none;"> <div id="sidebar-new-group">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}"> <a onclick="javascript:$('#group-new-form').fadeIn('fast');return false;">{{$createtext}}</a>
<input name="groupname" id="id_groupname" placeholder="{{$creategroup}}"> <form id="group-new-form" action="group/new" method="post" style="display:none;">
</form> <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
</div> <input name="groupname" id="id_groupname" placeholder="{{$creategroup}}">
{{if $ungrouped}} </form>
<div id="sidebar-ungrouped"> </div>
<a href="nogroup">{{$ungrouped}}</a> {{else}}
</div> <div id="sidebar-edit-groups"><a href="{{$grouppage}}">{{$editgroupstext}}</a></div>
{{/if}} {{/if}}
{{if $ungrouped}}<div id="sidebar-ungrouped"><a href="nogroup">{{$ungrouped}}</a></div>{{/if}}
</div> </div>

View file

@ -854,7 +854,8 @@ li.widget-list {
padding: 3px 24px; padding: 3px 24px;
} }
#sidebar-new-group { #sidebar-new-group,
#sidebar-edit-groups {
padding: 7px; padding: 7px;
width: 165px; width: 165px;
margin: auto; margin: auto;

View file

@ -347,7 +347,7 @@ code {
display: inline-block; display: inline-block;
min-width: 10px; min-width: 10px;
padding: 3px 7px; padding: 3px 7px;
font-size: 12px; font-size: 10px;
font-weight: 700; font-weight: 700;
line-height: 1; line-height: 1;
color: #fff; color: #fff;
@ -382,7 +382,7 @@ code {
#sidebar-group-list .tool:hover { #sidebar-group-list .tool:hover {
background: #EEE; background: #EEE;
} }
#sidebar-group-list .notify { /*#sidebar-group-list .notify {
min-width: 10px; min-width: 10px;
text-align: center; text-align: center;
color: #FFF; color: #FFF;
@ -391,6 +391,9 @@ code {
padding: 3px; padding: 3px;
border-radius: 10px; border-radius: 10px;
display: none; display: none;
}*/
#sidebar-group-list .notify {
display: none;
} }
#sidebar-group-list .notify.show { display: inline-block; } #sidebar-group-list .notify.show { display: inline-block; }
.tool .label { .tool .label {
@ -416,7 +419,7 @@ code {
opacity: 1; opacity: 1;
} }
.sidebar-group-li:hover, #sidebar-new-group:hover, #forum-widget-collapse:hover, .sidebar-group-li:hover, #sidebar-new-group:hover, #sidebar-edit-groups:hover, #forum-widget-collapse:hover,
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover, #sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forumlist-sidebar li:hover, #forumlist-sidebar-right li:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover { .nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover {
/* background-color: #ddd; */ /* background-color: #ddd; */
@ -436,7 +439,7 @@ code {
font-weight: bold; font-weight: bold;
} }
#forum-widget-showmore, #sidebar-new-group, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped, #forum-widget-showmore, #sidebar-new-group, #sidebar-edit-groups, #forum-widget-collapse, #forumlist-rsidebar-right, #sidebar-ungrouped,
.side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new { .side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new {
padding-left: 10px; padding-left: 10px;
padding-top: 3px; padding-top: 3px;
@ -464,7 +467,7 @@ code {
display: inline-block; display: inline-block;
} }
a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a { a.nets-link, .side-link a, #sidebar-new-group a, #sidebar-edit-groups a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a {
display: block; display: block;
color: #737373; color: #737373;
} }