Merge pull request #404 from git-marijus/master

bootstrapify aclselector
This commit is contained in:
RedMatrix 2014-04-12 07:20:24 +10:00
commit aa1f5ce753
13 changed files with 127 additions and 164 deletions

View File

@ -230,15 +230,21 @@ function populate_acl($defaults = null,$unused = false) {
array_walk($deny_gid,'fixacl'); array_walk($deny_gid,'fixacl');
} }
$jotnets = '';
call_hooks('jot_networks', $jotnets);
$tpl = get_markup_template("acl_selector.tpl"); $tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$showall'=> t("Visible to everybody"), '$showall'=> t("Visible to everybody"),
'$show' => t("show"), '$show' => t("Show"),
'$hide' => t("don't show"), '$hide' => t("Don't show"),
'$allowcid' => json_encode($allow_cid), '$allowcid' => json_encode($allow_cid),
'$allowgid' => json_encode($allow_gid), '$allowgid' => json_encode($allow_gid),
'$denycid' => json_encode($deny_cid), '$denycid' => json_encode($deny_cid),
'$denygid' => json_encode($deny_gid), '$denygid' => json_encode($deny_gid),
'$jotnets' => $jotnets,
'$aclModalTitle' => t('Permissions'),
'$aclModalDismiss' => t('Close')
)); ));

View File

@ -1153,7 +1153,7 @@ function status_editor($a,$x,$popup=false) {
'$encrypt' => t('Encrypt text'), '$encrypt' => t('Encrypt text'),
'$cipher' => $cipher, '$cipher' => $cipher,
'$expiryModalOK' => t('OK'), '$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'), '$expiryModalCANCEL' => t('Cancel')
)); ));

View File

@ -203,6 +203,7 @@ function chat_content(&$a) {
$o = replace_macros(get_markup_template('chatroom_new.tpl'),array( $o = replace_macros(get_markup_template('chatroom_new.tpl'),array(
'$header' => t('New Chatroom'), '$header' => t('New Chatroom'),
'$name' => array('room_name',t('Chatroom Name'),'', ''), '$name' => array('room_name',t('Chatroom Name'),'', ''),
'$permissions' => t('Permissions'),
'$acl' => populate_acl($channel_acl), '$acl' => populate_acl($channel_acl),
'$submit' => t('Submit') '$submit' => t('Submit')
)); ));

View File

@ -17,7 +17,7 @@ function ACL(backend_url, preset){
that.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html()); that.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html());
that.showall = $("#acl-showall"); that.showall = $("#acl-showall");
if (preset.length==0) that.showall.addClass("selected"); if (preset.length==0) that.showall.removeClass("btn-default").addClass("btn-warning");
/*events*/ /*events*/
@ -70,10 +70,10 @@ ACL.prototype.on_showall = function(event){
event.preventDefault() event.preventDefault()
event.stopPropagation(); event.stopPropagation();
if (that.showall.hasClass("selected")){ if (that.showall.hasClass("btn-warning")){
return false; return false;
} }
that.showall.addClass("selected"); that.showall.removeClass("btn-default").addClass("btn-warning");
that.allow_cid = []; that.allow_cid = [];
that.allow_gid = []; that.allow_gid = [];
@ -164,7 +164,7 @@ ACL.prototype.set_deny = function(itemid){
ACL.prototype.update_view = function(){ ACL.prototype.update_view = function(){
if (that.allow_gid.length==0 && that.allow_cid.length==0 && if (that.allow_gid.length==0 && that.allow_cid.length==0 &&
that.deny_gid.length==0 && that.deny_cid.length==0){ that.deny_gid.length==0 && that.deny_cid.length==0){
that.showall.addClass("selected"); that.showall.removeClass("btn-default").addClass("btn-warning");
/* jot acl */ /* jot acl */
$('#jot-perms-icon').removeClass('icon-lock').addClass('icon-unlock'); $('#jot-perms-icon').removeClass('icon-lock').addClass('icon-unlock');
$('#jot-public').show(); $('#jot-public').show();
@ -174,7 +174,7 @@ ACL.prototype.update_view = function(){
} }
} else { } else {
that.showall.removeClass("selected"); that.showall.removeClass("btn-warning").addClass("btn-default");
/* jot acl */ /* jot acl */
$('#jot-perms-icon').removeClass('icon-unlock').addClass('icon-lock'); $('#jot-perms-icon').removeClass('icon-unlock').addClass('icon-lock');
$('#jot-public').hide(); $('#jot-public').hide();
@ -190,20 +190,20 @@ ACL.prototype.update_view = function(){
type = itemid[0]; type = itemid[0];
id = itemid.substr(1); id = itemid.substr(1);
btshow = $(this).children(".acl-button-show").removeClass("selected"); btshow = $(this).children(".acl-button-show").removeClass("btn-success").addClass("btn-default");
bthide = $(this).children(".acl-button-hide").removeClass("selected"); bthide = $(this).children(".acl-button-hide").removeClass("btn-danger").addClass("btn-default");
switch(type){ switch(type){
case "g": case "g":
var uclass = ""; var uclass = "";
if (that.allow_gid.indexOf(id)>=0){ if (that.allow_gid.indexOf(id)>=0){
btshow.addClass("selected"); btshow.removeClass("btn-default").addClass("btn-success");
bthide.removeClass("selected"); bthide.removeClass("btn-danger").addClass("btn-default");
uclass="groupshow"; uclass="groupshow";
} }
if (that.deny_gid.indexOf(id)>=0){ if (that.deny_gid.indexOf(id)>=0){
btshow.removeClass("selected"); btshow.removeClass("btn-success").addClass("btn-default");
bthide.addClass("selected"); bthide.removeClass("btn-default").addClass("btn-danger");
uclass="grouphide"; uclass="grouphide";
} }
@ -223,12 +223,12 @@ ACL.prototype.update_view = function(){
break; break;
case "c": case "c":
if (that.allow_cid.indexOf(id)>=0){ if (that.allow_cid.indexOf(id)>=0){
btshow.addClass("selected"); btshow.removeClass("btn-default").addClass("btn-success");
bthide.removeClass("selected"); bthide.removeClass("btn-danger").addClass("btn-default");
} }
if (that.deny_cid.indexOf(id)>=0){ if (that.deny_cid.indexOf(id)>=0){
btshow.removeClass("selected"); btshow.removeClass("btn-success").addClass("btn-default");
bthide.addClass("selected"); bthide.removeClass("btn-default").addClass("btn-danger");
} }
} }

View File

@ -1521,7 +1521,7 @@ header {
right: 43%; right: 43%;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
z-index: 1400; z-index: 1040;
color: #fff; color: #fff;
} }
@ -1552,101 +1552,73 @@ header {
clear: both; clear: both;
} }
#acl-wrapper { #acl-search {
width: 690px; margin-top: 20px;
float:left; padding: 8px;
border: 1px solid #ccc;
width: 100%;
} }
#acl-search { #acl-search::-webkit-input-placeholder {
float:right; font-family: FontAwesome;
background: #ffffff url("../../../../images/search_18.png") no-repeat right center;
padding-right:20px;
} }
#acl-showall {
float: left; #acl-search::-moz-placeholder {
display: block; font-family: FontAwesome;
width: auto;
height: 26px;
background-color: #cccccc;
background-image: url("../../../../images/show_all_off.png");
background-position: 7px 7px;
background-repeat: no-repeat;
padding: 7px 5px 0px 30px;
-webkit-border-radius: $radiuspx;
-moz-border-radius: $radiuspx;
border-radius: $radiuspx;
color: #999999;
}
#acl-showall.selected {
color: #000000;
background-color: #ff9900;
background-image: url("../../../../images/show_all_on.png");
} }
#acl-list { #acl-list {
height: 210px;
border: 1px solid #cccccc;
clear: both;
margin-top: 30px;
overflow: auto;
}
#acl-list-content {
}
.acl-list-item {
display: block; display: block;
width: 150px;
height: 30px;
border: 1px solid #cccccc; border: 1px solid #cccccc;
margin: 5px; overflow: auto;
float: left; clear: both;
min-height: 62px;
margin-top: 20px;
padding: 10px 10px 0px 0px;
-webkit-border-radius: $radiuspx ;
-moz-border-radius: $radiuspx;
border-radius: $radiuspx;
} }
.acl-list-item {
width: calc(50% - 10px);
border: 1px solid #cccccc;
margin: 0px 0px 10px 10px;
padding: 5px;
float: left;
-webkit-border-radius: $radiuspx ;
-moz-border-radius: $radiuspx;
border-radius: $radiuspx;
}
.acl-list-item img{ .acl-list-item img{
width:22px; width: 40px;
height: 22px; height: 40px;
float: left; float: left;
margin: 4px; margin-right: 5px;
-webkit-border-radius: $radiuspx ;
-moz-border-radius: $radiuspx;
border-radius: $radiuspx;
} }
.acl-list-item.taggable { .acl-list-item.taggable {
background-color: #ddddff; background-color: #ddddff;
} }
.acl-list-item p { height: 12px; font-size: 10px; margin: 0px; overflow: hidden;} .acl-list-item p {
.acl-list-item a { font-size: $font_size;
font-size: 8px; margin: 0px;
display: block; overflow: ellipsis;
width: 40px; white-space: nowrap;
height: 10px; overflow: hidden;
float: left; text-overflow: ellipsis;
color: #999999;
background-color: #cccccc;
background-position: 3px 3px;
background-repeat: no-repeat;
margin-right: 5px;
-webkit-border-radius: 2px ;
-moz-border-radius: 2px;
border-radius: 2px;
padding-left: 15px;
} }
#acl-wrapper a:hover {
text-decoration: none;
color:#000000;
}
.acl-button-show { background-image: url("../../../../images/show_off.png"); }
.acl-button-hide { background-image: url("../../../../images/hide_off.png"); }
.acl-button-show.selected { .acl-button-show,
color: #000000; .acl-button-hide {
background-color: #9ade00; float: right;
background-image: url("../../../../images/show_on.png"); margin-left: 5px;
} }
.acl-button-hide.selected {
color: #000000;
background-color: #ff4141;
background-image: url("../../../../images/hide_on.png");
}
.acl-list-item.groupshow { border-color: #9ade00; }
.acl-list-item.grouphide { border-color: #ff4141; }
.contact-block-content { .contact-block-content {
margin-top: 8px; margin-top: 8px;
@ -2284,4 +2256,8 @@ blockquote {
width: 32px !important; width: 32px !important;
height: 32px !important; height: 32px !important;
} }
.acl-list-item {
width: calc(100% - 10px);
}
} }

View File

@ -1,18 +1,34 @@
<div id="acl-wrapper"> <div class="modal" id="aclModal">
<input id="acl-search"> <div class="modal-dialog">
<a href="#" id="acl-showall">{{$showall}}</a> <div class="modal-content">
<div id="acl-list"> <div class="modal-header">
<div id="acl-list-content"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{{$aclModalTitle}}</h4>
</div> </div>
<div class="modal-body">
<div id="acl-wrapper">
<button id="acl-showall" class="btn btn-block btn-default"><i class="icon-globe"></i> {{$showall}}</button>
<input type="text" id="acl-search" placeholder="&#xf002;">
<div id="acl-list">
<div id="acl-list-content"></div>
</div> </div>
<span id="acl-fields"></span> <span id="acl-fields"></span>
</div> </div>
<div class="acl-list-item" rel="acl-template" style="display:none"> <div class="acl-list-item" rel="acl-template" style="display:none">
<img src="{0}"><p>{1}</p> <img src="{0}"><p>{1}</p>
<a href="#" class='acl-button-show'></a> <button class="acl-button-hide btn btn-xs btn-default"><i class="icon-remove"></i> {{$hide}}</button>
<a href="#" class='acl-button-hide'></a> <button class="acl-button-show btn btn-xs btn-default"><i class="icon-ok"></i> {{$show}}</button>
</div> </div>
{{if $jotnets}}
{{$jotnets}}
{{/if}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{$aclModalDismiss}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {

View File

@ -2,10 +2,11 @@
<form action="chat" method="post" > <form action="chat" method="post" >
{{include file="field_input.tpl" field=$name}} {{include file="field_input.tpl" field=$name}}
<br /> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
<br />
{{$acl}} {{$acl}}
<div class="clear"></div> <div class="clear"></div>
<br />
<br />
<input type="submit" name="submit" value="{{$submit}}" /> <input type="submit" name="submit" value="{{$submit}}" />
</form> </form>

View File

@ -86,11 +86,7 @@ function initEditor(cb){
}); });
editor = true; editor = true;
// setup acl popup
$("a#jot-perms-icon").colorbox({
'inline' : true,
'transition' : 'elastic'
});
} else { } else {
if (typeof cb!="undefined") cb(); if (typeof cb!="undefined") cb();
} }

View File

@ -11,6 +11,7 @@
<input type="hidden" name="post_id" value="{{$post_id}}" /> <input type="hidden" name="post_id" value="{{$post_id}}" />
<input type="hidden" name="webpage" value="{{$webpage}}" /> <input type="hidden" name="webpage" value="{{$webpage}}" />
<input type="hidden" name="preview" id="jot-preview" value="0" /> <input type="hidden" name="preview" id="jot-preview" value="0" />
{{if $showacl}}{{$acl}}{{/if}}
{{$mimeselect}} {{$mimeselect}}
{{$layoutselect}} {{$layoutselect}}
{{if $id_select}} {{if $id_select}}
@ -75,7 +76,9 @@
</div> </div>
<div id="profile-jot-submit-right" class="btn-group pull-right"> <div id="profile-jot-submit-right" class="btn-group pull-right">
{{if $showacl}} {{if $showacl}}
<a href="#profile-jot-acl-wrapper" class="btn btn-default btn-sm jot-icons icon-{{$lockstate}}" id="jot-perms-icon" title="{{$permset}}"></a>{{$bang}} <button class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;">
<i id="jot-perms-icon" class="icon-{{$lockstate}} jot-icons">{{$bang}}</i>
</button>
{{/if}} {{/if}}
{{if $preview}} {{if $preview}}
<button class="btn btn-default btn-sm" onclick="preview_post();return false;" title="{{$preview}}"> <button class="btn btn-default btn-sm" onclick="preview_post();return false;" title="{{$preview}}">
@ -88,13 +91,6 @@
<div id="profile-jot-plugin-wrapper"> <div id="profile-jot-plugin-wrapper">
{{$jotplugins}} {{$jotplugins}}
</div> </div>
<div style="display: none;">
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
{{$acl}}
<hr style="clear:both"/>
{{$jotnets}}
</div>
</div>
</div> </div>
<div id="profile-jot-text-loading"></div> <div id="profile-jot-text-loading"></div>
<div id="profile-jot-end" class="clear"></div> <div id="profile-jot-end" class="clear"></div>

View File

@ -16,18 +16,9 @@
{{include file="field_checkbox.tpl" field=$newwin}} {{include file="field_checkbox.tpl" field=$newwin}}
<div id="settings-default-perms" class="settings-default-perms" > <div id="settings-default-perms" class="settings-default-perms" >
<a href="#profile-jot-acl-wrapper" id="settings-default-perms-menu" >{{$permissions}} {{$permdesc}}</a> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
<div id="settings-default-perms-menu-end"></div>
<div id="settings-default-perms-select" style="display: none; margin-bottom: 20px" >
<div style="display: none;">
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
{{$aclselect}} {{$aclselect}}
</div> <div id="settings-default-perms-menu-end"></div>
</div>
</div>
</div> </div>
<br/> <br/>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>

View File

@ -54,15 +54,9 @@
<div id="settings-default-perms" class="settings-default-perms" > <div id="settings-default-perms" class="settings-default-perms" >
<span id="jot-perms-icon" class="{{$edit.lockstate}}" ></span> <span id="jot-perms-icon" class="{{$edit.lockstate}}" ></span>
<a href="#profile-jot-acl-wrapper" id="settings-default-perms-menu" >{{$edit.permissions}}</a> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$edit.permissions}}</button>
<div id="settings-default-perms-menu-end"></div>
<div id="settings-default-perms-select" style="display: none; margin-bottom: 20px" >
<div style="display: none;">
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
{{$edit.aclselect}} {{$edit.aclselect}}
</div> <div id="settings-default-perms-menu-end"></div>
</div>
</div>
</div> </div>
<br/> <br/>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>

View File

@ -25,15 +25,10 @@
<div id="photos-upload-perms" class="photos-upload-perms" > <div id="photos-upload-perms" class="photos-upload-perms" >
<span id="jot-perms-icon" class="icon-{{$lockstate}}" ></span> <span id="jot-perms-icon" class="icon-{{$lockstate}}" ></span>
<a href="#photos-upload-permissions-wrapper" id="photos-upload-perms-menu" class="button" />{{$permissions}}</a> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
</div> </div>
<div id="photos-upload-perms-end"></div>
<div style="display: none;">
<div id="photos-upload-permissions-wrapper">
{{$aclselect}} {{$aclselect}}
</div> <div id="photos-upload-perms-end"></div>
</div>
<div id="photos-upload-spacer"></div> <div id="photos-upload-spacer"></div>

View File

@ -34,7 +34,7 @@
</ul> </ul>
<button type="button" class="btn btn-xs btn-warning" data-toggle="collapse" data-target="#settings-permissions-wrapper">{{$lbl_p2macro}}</button> <button type="button" class="btn btn-xs btn-default" data-toggle="collapse" data-target="#settings-permissions-wrapper">{{$lbl_p2macro}}</button>
@ -73,18 +73,9 @@
</div> </div>
<div id="settings-default-perms" class="settings-default-perms" > <div id="settings-default-perms" class="settings-default-perms" >
<a href="#profile-jot-acl-wrapper" id="settings-default-perms-menu" >{{$permissions}} {{$permdesc}}</a> <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
<div id="settings-default-perms-menu-end"></div>
<div id="settings-default-perms-select" style="display: none; margin-bottom: 20px" >
<div style="display: none;">
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
{{$aclselect}} {{$aclselect}}
</div> <div id="settings-default-perms-menu-end"></div>
</div>
</div>
</div> </div>
<br/> <br/>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>