pimp up mod new_channel

This commit is contained in:
Mario Vavti 2016-02-19 22:28:21 +01:00
parent 5a7b994e59
commit 02e82e496e
8 changed files with 64 additions and 235 deletions

View file

@ -1847,4 +1847,4 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
return $o;
}
}

View file

@ -864,10 +864,10 @@ function get_role_perms($role) {
*/
function get_roles() {
$roles = array(
t('Social Networking') => array('social' => t('Mostly Public'), 'social_restricted' => t('Restricted'), 'social_private' => t('Private')),
t('Community Forum') => array('forum' => t('Mostly Public'), 'forum_restricted' => t('Restricted'), 'forum_private' => t('Private')),
t('Feed Republish') => array('feed' => t('Mostly Public'), 'feed_restricted' => t('Restricted')),
t('Special Purpose') => array('soapbox' => t('Celebrity/Soapbox'), 'repository' => t('Group Repository')),
t('Social Networking') => array('social' => t('Social - Mostly Public'), 'social_restricted' => t('Social - Restricted'), 'social_private' => t('Social - Private')),
t('Community Forum') => array('forum' => t('Forum - Mostly Public'), 'forum_restricted' => t('Forum - Restricted'), 'forum_private' => t('Forum - Private')),
t('Feed Republish') => array('feed' => t('Feed - Mostly Public'), 'feed_restricted' => t('Feed - Restricted')),
t('Special Purpose') => array('soapbox' => t('Special - Celebrity/Soapbox'), 'repository' => t('Special - Group Repository')),
t('Other') => array('custom' => t('Custom/Expert Mode'))
);

View file

@ -102,7 +102,6 @@ function new_channel_post(&$a) {
function new_channel_content(&$a) {
$acc = $a->get_account();
if((! $acc) || $acc['account_id'] != get_account_id()) {
@ -119,29 +118,33 @@ function new_channel_content(&$a) {
if($r && (! intval($r[0]['total']))) {
$default_role = get_config('system','default_permissions_role');
}
$limit = account_service_class_fetch(get_account_id(),'total_identities');
if($r && ($limit !== false)) {
$channel_usage_message = sprintf( t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit);
}
else {
$channel_usage_message = '';
}
}
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" );
$nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" );
$name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'));
$nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
$nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub));
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
$role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>',get_roles());
$o = replace_macros(get_markup_template('new_channel.tpl'), array(
'$title' => t('Add a Channel'),
'$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'),
'$label_name' => t('Name'),
'$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '),
'$label_nick' => t('Choose a short nickname'),
'$nick_hub' => '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')),
'$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'),
'$title' => t('Create a Channel'),
'$desc' => t('A channel is your identity on the grid. It can represent a person, a blog, or a forum to name a few. Channels can make connections with other channels to share information with highly detailed permissions.'),
'$label_import' => t('Or <a href="import">import an existing channel</a> from another location'),
'$name' => $name,
'$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'),
'$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()),
'$role' => $role,
'$default_role' => $default_role,
'$nickname' => $nickname,
'$submit' => t('Create')
'$submit' => t('Create'),
'$channel_usage_message' => $channel_usage_message
));
return $o;

View file

@ -1,172 +1,3 @@
h2 {
margin-left: 15%;
margin-top: 5%;
.descriptive-paragraph {
margin-top: 10px;
}
#newchannel-form {
font-size: 1.4em;
margin-left: 15%;
margin-top: 20px;
width: 50%;
}
#newchannel-form .descriptive-paragraph {
color: #888;
margin-left: 20px;
margin-bottom: 25px;
}
.newchannel-label {
float: left;
width: 275px;
}
.newchannel-role-morehelp {
float: left;
width: 32px;
}
.newchannel-input {
float: left;
width: 275px;
padding: 5px;
}
.newchannel-feedback {
float: left;
margin-left: 5px;
}
.newchannel-field-end {
clear: both;
margin-bottom: 20px;
}
/**
* Stylish Select 0.4.9 - $ plugin to replace a select drop down box with a stylable unordered list
* http://github.com/scottdarby/Stylish-Select/
*
* Copyright (c) 2009 Scott Darby
*
* Requires: jQuery 1.3 or newer
*
* Dual licensed under the MIT and GPL licenses.
*/
/**
* Hide lists on page load
---------------------------------------------------------*/
.stylish-select .SSContainerDivWrapper {
left:-9999px;
}
/*
* Red example
---------------------------------------------------------*/
.stylish-select .SSContainerDivWrapper {
margin:0;
padding:0;
width:290px;
position:absolute;
top:22px;
left:0;
z-index:9999;
font-size: 60%;
line-height: 1.1;
}
.stylish-select a {
font-weight: normal !important;
}
.stylish-select ul.newList {
margin:0;
padding:0;
list-style:none;
color:#000;
background:#fff;
border:1px solid #ccc;
overflow:auto;
}
.stylish-select ul.newList * {
margin:0;
padding:0;
}
.stylish-select ul.newList a {
color: #000;
text-decoration:none;
display:block;
padding:3px 8px;
}
.stylish-select .newListSelected {
width:285px;
color:#000;
height:19px;
padding:3px 0 0 6px;
float:left;
background:url(select-bg.png) no-repeat;
}
.stylish-select ul.newList li a:focus {
-moz-outline-style: none;
}
.stylish-select .selectedTxt {
width:258px;
overflow:hidden;
height:18px;
font-size: 90%;
padding:0 23px 0 0;
}
.stylish-select .hiLite {
background:#650101!important;
color:#fff!important;
}
.stylish-select .newListHover {
background:#ccc!important;
color:#000!important;
cursor:default;
}
.stylish-select .newListDisabled {
opacity: 0.6;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
}
.stylish-select .newListItemDisabled {
opacity: 0.6;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
}
.stylish-select .newListOptionDisabled {
opacity: 0.6;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
filter: alpha(opacity=60);
}
.stylish-select .newListSelHover,
.stylish-select .newListSelFocus {
background-position:0 -22px;
cursor:default;
}
.stylish-select .newListOptionTitle {
font-weight:bold;
}
.stylish-select .newListOptionTitle ul {
margin:3px 0 0;
}
.stylish-select .newListOptionTitle li {
font-weight:normal;
}

View file

@ -1,19 +1,20 @@
$(document).ready(function() {
// $("#id_permissions_role").sSelect();
$("#newchannel-name").blur(function() {
$("#id_name").blur(function() {
$("#name-spinner").spin('small');
var zreg_name = $("#newchannel-name").val();
var zreg_name = $("#id_name").val();
$.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
$("#newchannel-nickname").val(data);
$("#id_nickname").val(data);
zFormError("#newchannel-name-feedback",data.error);
$("#name-spinner").spin(false);
});
});
$("#newchannel-nickname").blur(function() {
$("#id_nickname").blur(function() {
$("#nick-spinner").spin('small');
var zreg_nick = $("#newchannel-nickname").val();
var zreg_nick = $("#id_nickname").val();
$.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
$("#newchannel-nickname").val(data);
$("#id_nickname").val(data);
zFormError("#newchannel-nickname-feedback",data.error);
$("#nick-spinner").spin(false);
});

View file

@ -1 +0,0 @@
[template]full[/template]

View file

@ -1544,6 +1544,7 @@ nav .dropdown-menu {
.section-content-tools-wrapper .section-content-danger-wrapper,
.section-content-wrapper .section-content-danger-wrapper {
margin-bottom: 10px;
border-bottom: none;
border-radius: $radiuspx;
}

View file

@ -1,42 +1,36 @@
<div class="generic-content-wrapper-styled">
<h2>{{$title}}</h2>
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<h2>{{$title}}</h2>
</div>
<div class="section-content-wrapper">
<div class="section-content-info-wrapper">
{{$desc}}
</div>
{{if $channel_usage_message}}
<div class="section-content-warning-wrapper">
{{$channel_usage_message}}
</div>
{{/if}}
<form action="new_channel" method="post" id="newchannel-form">
{{if $default_role}}
<input type="hidden" name="permissions_role" value="{{$default_role}}" />
{{else}}
{{include file="field_select_grouped.tpl" field=$role}}
{{/if}}
<form action="new_channel" method="post" id="newchannel-form" class="stylish-select">
{{include file="field_input.tpl" field=$name}}
<div id="newchannel-name-feedback" class="newchannel-feedback"></div>
<div id="name-spinner"></div>
<div id="newchannel-desc" class="descriptive-paragraph">{{$desc}}</div>
{{include file="field_input.tpl" field=$nickname}}
<div id="newchannel-nickname-feedback" class="newchannel-feedback"></div>
<div id="nick-spinner"></div>
{{if $default_role}}
<input type="hidden" name="permissions_role" value="{{$default_role}}" />
{{else}}
<div id="newchannel-role-help" class="descriptive-paragraph">{{$help_role}}</div>
{{include file="field_select_grouped.tpl" field=$role}}
<div id="newchannel-role-end" class="newchannel-field-end"></div>
{{/if}}
<input type="submit" name="submit" id="newchannel-submit-button" value="{{$submit}}" />
<div id="newchannel-submit-end" class="clear"></div>
<label for="newchannel-name" id="label-newchannel-name" class="newchannel-label" >{{$label_name}}</label>
<input type="text" name="name" id="newchannel-name" class="newchannel-input" value="{{$name}}" />
<div id="name-spinner"></div>
<div id="newchannel-name-feedback" class="newchannel-feedback"></div>
<div id="newchannel-name-end" class="newchannel-field-end"></div>
<div id="newchannel-name-help" class="descriptive-paragraph">{{$help_name}}</div>
<label for="newchannel-nickname" id="label-newchannel-nickname" class="newchannel-label" >{{$label_nick}}</label>
<input type="text" name="nickname" id="newchannel-nickname" class="newchannel-input" value="{{$nickname}}" />
<div id="nick-spinner"></div>
<div id="newchannel-nick-desc" class="descriptive-paragraph">{{$nick_hub}}</div>
<div id="newchannel-nickname-feedback" class="newchannel-feedback"></div>
<div id="newchannel-nickname-end" class="newchannel-field-end"></div>
<div id="newchannel-nick-desc" class="descriptive-paragraph">{{$nick_desc}}</div>
<div id="newchannel-import-link" class="descriptive-paragraph" >{{$label_import}}</div>
<div id="newchannel-import-end" class="newchannel-field-end"></div>
<input type="submit" name="submit" id="newchannel-submit-button" value="{{$submit}}" />
<div id="newchannel-submit-end" class="newchannel-field-end"></div>
</form>
<div id="newchannel-import-link" class="descriptive-paragraph" >{{$label_import}}</div>
<div id="newchannel-import-end" class="clear"></div>
</form>
</div>
</div>