acl stuff
This commit is contained in:
parent
acdfee2327
commit
baad288430
5 changed files with 90 additions and 6 deletions
|
@ -135,10 +135,14 @@ function profile_content(&$a) {
|
||||||
$tpl = file_get_contents('view/jot-header.tpl');
|
$tpl = file_get_contents('view/jot-header.tpl');
|
||||||
|
|
||||||
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
|
$a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
|
||||||
|
require_once('view/acl_selectors.php');
|
||||||
|
|
||||||
$tpl = file_get_contents("view/jot.tpl");
|
$tpl = file_get_contents("view/jot.tpl");
|
||||||
|
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$baseurl' => $a->get_baseurl(),
|
'$baseurl' => $a->get_baseurl(),
|
||||||
|
'$lockstate' => 'unlock',
|
||||||
|
'$acl' => populate_acl(),
|
||||||
'$profile_uid' => $a->profile['profile_uid']
|
'$profile_uid' => $a->profile['profile_uid']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
70
view/acl_selectors.php
Normal file
70
view/acl_selectors.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function group_select($selname,$selclass,$preselected = false) {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM `group` WHERE `uid` = %d",
|
||||||
|
$_SESSION['uid']
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($r)) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
if((is_array($preselected)) && $in_array($rr['name'], $preselected))
|
||||||
|
$selected = " selected=\"selected\" ";
|
||||||
|
else
|
||||||
|
$selected = '';
|
||||||
|
$o .= "<option value=\"{$rr['name']}\" $selected >{$rr['name']}</option>\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$o .= "</select>\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function contact_select($selname,$selclass,$preselected = false) {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$o .= "<select name=\"{$selname}[]\" class=\"$selclass\" multiple=\"multiple\" size=\"4\" />\r\n";
|
||||||
|
|
||||||
|
$r = q("SELECT `name` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 ",
|
||||||
|
$_SESSION['uid']
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($r)) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
if((is_array($preselected)) && $in_array($rr['name'], $preselected))
|
||||||
|
$selected = " selected=\"selected\" ";
|
||||||
|
else
|
||||||
|
$selected = '';
|
||||||
|
$o .= "<option value=\"{$rr['name']}\" $selected >{$rr['name']}</option>\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$o .= "</select>\r\n";
|
||||||
|
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function populate_acl() {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
|
$o .= "Allow Groups: " . group_select('group_allow','group_allow');
|
||||||
|
$o .= "Allow Contacts: " . contact_select('contact_allow','contact_allow');
|
||||||
|
$o .= "<br />\r\n";
|
||||||
|
$o .= "Except Groups: " . group_select('group_deny','group_deny');
|
||||||
|
$o .= "Except Contacts: " . contact_select('contact_deny','contact_deny');
|
||||||
|
return $o;
|
||||||
|
|
||||||
|
}
|
|
@ -12,7 +12,8 @@ What's on your mind?
|
||||||
</div>
|
</div>
|
||||||
<div id="profile-jot-submit-wrapper" >
|
<div id="profile-jot-submit-wrapper" >
|
||||||
<input type="submit" id="profile-jot-submit" name="submit" value="Submit" />
|
<input type="submit" id="profile-jot-submit" name="submit" value="Submit" />
|
||||||
|
<div id="profile-jot-perms" class="profile-jot-perms" ><img src="images/$lockstate_icon.gif" alt="Permission Settings" title="Permission Settings" onClick="openClose('profile-jot-acl-wrapper');" /><div id="profile-jot-acl-wrapper" style="display: none;" >$acl</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="profile-jot-end"></div>
|
<div id="profile-jot-end"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -451,7 +451,18 @@ input#dfrn-url {
|
||||||
#profile-jot-submit-wrapper {
|
#profile-jot-submit-wrapper {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#profile-jot-submit {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#profile-jot-perms {
|
||||||
|
float: left;
|
||||||
|
margin-left: 350px;
|
||||||
|
}
|
||||||
|
|
||||||
#profile-jot-end {
|
#profile-jot-end {
|
||||||
|
clear: both;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
#about-jot-submit-wrapper {
|
#about-jot-submit-wrapper {
|
||||||
|
@ -767,3 +778,5 @@ input#dfrn-url {
|
||||||
height: 150px;
|
height: 150px;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
4
wip/todo
4
wip/todo
|
@ -12,8 +12,6 @@ contact editor
|
||||||
|
|
||||||
profile "you name it" field
|
profile "you name it" field
|
||||||
|
|
||||||
profile display restrict/check access
|
|
||||||
|
|
||||||
|
|
||||||
groups
|
groups
|
||||||
|
|
||||||
|
@ -21,8 +19,6 @@ permissions
|
||||||
|
|
||||||
pager - items and photos
|
pager - items and photos
|
||||||
|
|
||||||
comment fetch
|
|
||||||
|
|
||||||
photos/albums/ java uploader
|
photos/albums/ java uploader
|
||||||
|
|
||||||
item delete
|
item delete
|
||||||
|
|
Loading…
Reference in a new issue