mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
Should fix #1229 - Rebuild userclass tree after adding new class.
This commit is contained in:
@@ -82,7 +82,7 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
protected $listOrder = "CASE WHEN userclass_id = 250 THEN 1 WHEN userclass_id =254 THEN 2 WHEN userclass_id = 253 THEN 3 WHEN userclass_id < 250 THEN 4 END, userclass_id DESC ";
|
protected $listOrder = "CASE WHEN userclass_id = 250 THEN 1 WHEN userclass_id =254 THEN 2 WHEN userclass_id = 253 THEN 3 WHEN userclass_id < 250 THEN 4 END, userclass_id DESC ";
|
||||||
// protected $sortField = 'somefield_order';
|
// protected $sortField = 'somefield_order';
|
||||||
// protected $orderStep = 10;
|
// protected $orderStep = 10;
|
||||||
// protected $tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable.
|
protected $tabs = null;// Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable.
|
||||||
|
|
||||||
// protected $listQry = "SELECT * FROM `#generic` WHERE gen_type='wmessage' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
|
// protected $listQry = "SELECT * FROM `#generic` WHERE gen_type='wmessage' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
|
||||||
|
|
||||||
@@ -93,13 +93,14 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
protected $fields = array(
|
protected $fields = array(
|
||||||
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
|
||||||
'userclass_id' => array('title'=> LAN_ID, 'type' =>'hidden', 'data'=>'int', 'width' => '5%', 'thclass' => 'left'),
|
'userclass_id' => array('title'=> LAN_ID, 'type' =>'hidden', 'data'=>'int', 'width' => '5%', 'thclass' => 'left'),
|
||||||
'userclass_icon' => array('title'=> UCSLAN_68, 'type' => 'icon', 'data'=>'str', 'width' => '5%', 'thclass' => 'left', 'class' => 'center'),
|
'userclass_icon' => array('title'=> UCSLAN_68, 'type' => 'icon', 'tab'=>0, 'data'=>'str', 'width' => '5%', 'thclass' => 'left', 'class' => 'center'),
|
||||||
'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
|
'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'tab'=>0,'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'data'=>'str', 'inline'=>true,'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('size'=>'xxlarge')),
|
'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'tab'=>0,'data'=>'str', 'inline'=>true,'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('size'=>'xxlarge')),
|
||||||
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'dropdown', 'data'=>'int', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
|
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'dropdown', 'tab'=>0,'data'=>'int', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
|
||||||
'userclass_editclass' => array('title'=> UCSLAN_24, 'type' => 'userclass', 'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'nobody,public,main,admin,classes,matchclass,member, no-excludes')),
|
'userclass_editclass' => array('title'=> UCSLAN_24, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'nobody,public,main,admin,classes,matchclass,member, no-excludes')),
|
||||||
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'data'=>'int', 'width' => 'auto', 'thclass' => 'left'),
|
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'main,admin,nobody,public,classes,matchclass,member, no-excludes')),
|
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'main,admin,nobody,public,classes,matchclass,member, no-excludes')),
|
||||||
|
'userclass_perms' => array('title'=> "Perms", 'type' => 'hidden', 'tab'=>0,'data'=>'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
|
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'right', 'readParms' => array('deleteClass' => e_UC_NOBODY))
|
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'right', 'readParms' => array('deleteClass' => e_UC_NOBODY))
|
||||||
);
|
);
|
||||||
@@ -113,6 +114,15 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(E107_DBG_BASIC && intval($_GET['id']) === 254) // Experimental
|
||||||
|
{
|
||||||
|
e107::getMessage()->addDebug("Experimental Feature active");
|
||||||
|
$this->tabs = array(LAN_GENERAL,"Administrator Permissions");
|
||||||
|
$this->fields['userclass_perms']['type'] = 'method';
|
||||||
|
$this->fields['userclass_perms']['tab'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Listen for submitted data.
|
// Listen for submitted data.
|
||||||
$this->initialPageSubmit();
|
$this->initialPageSubmit();
|
||||||
$this->optionsPageSubmit();
|
$this->optionsPageSubmit();
|
||||||
@@ -144,10 +154,22 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
public function afterCreate($new_data, $old_data, $id)
|
public function afterCreate($new_data, $old_data, $id)
|
||||||
{
|
{
|
||||||
e107::getUserClass()->clearCache();
|
e107::getUserClass()->clearCache();
|
||||||
|
$e_userclass = $this->getUserClassAdmin();
|
||||||
|
$e_userclass->calc_tree();
|
||||||
|
$e_userclass->save_tree();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate($new_data, $old_data, $id)
|
public function beforeUpdate($new_data, $old_data, $id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($new_data['perms']))
|
||||||
|
{
|
||||||
|
$new_data['userclass_perms'] = implode(".",$new_data['perms']);
|
||||||
|
}
|
||||||
|
|
||||||
|
e107::getMessage()->addDebug(print_a($new_data,true));
|
||||||
|
|
||||||
return $new_data;
|
return $new_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,11 +483,31 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
|||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function userclass_perms($curVal,$mode)
|
||||||
|
{
|
||||||
|
if($mode == 'read')
|
||||||
|
{
|
||||||
|
// $uid = $this->getController()->getModel()->get('user_id');
|
||||||
|
// return e107::getUserPerms()->renderPerms($curVal,$uid);
|
||||||
|
}
|
||||||
|
if($mode == 'write')
|
||||||
|
{
|
||||||
|
$prm = e107::getUserPerms();
|
||||||
|
return $prm->renderPermTable('tabs',$curVal);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new uclass_admin();
|
new uclass_admin();
|
||||||
|
|
||||||
require_once(e_ADMIN."auth.php");
|
require_once(e_ADMIN."auth.php");
|
||||||
|
@@ -2706,6 +2706,7 @@ class e_front_model extends e_model
|
|||||||
if(!$this->data_has_changed && !$force)
|
if(!$this->data_has_changed && !$force)
|
||||||
{
|
{
|
||||||
$this->addMessageInfo(LAN_NO_CHANGE);
|
$this->addMessageInfo(LAN_NO_CHANGE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
@@ -1245,7 +1245,7 @@ class e_userperms
|
|||||||
protected $full_perms = array();
|
protected $full_perms = array();
|
||||||
|
|
||||||
protected $permSectionDiz = array(
|
protected $permSectionDiz = array(
|
||||||
'core' => ADMSLAN_74,
|
'core' => LAN_GENERAL,
|
||||||
'plugin' => ADLAN_CL_7,
|
'plugin' => ADLAN_CL_7,
|
||||||
'language' => ADLAN_132,
|
'language' => ADLAN_132,
|
||||||
'main' => ADMSLAN_58
|
'main' => ADMSLAN_58
|
||||||
@@ -1447,7 +1447,9 @@ class e_userperms
|
|||||||
$icon_32 = "";
|
$icon_32 = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$par = "<tr>
|
$class = getperms($arg, $perms) ? 'active' : '';
|
||||||
|
|
||||||
|
$par = "<tr class='{$class}'>
|
||||||
<td style='text-align:center'>".$icon_16."</td>
|
<td style='text-align:center'>".$icon_16."</td>
|
||||||
<td style='text-align:center'>".$frm->checkbox('perms[]', $arg, getperms($arg, $perms))."</td>
|
<td style='text-align:center'>".$frm->checkbox('perms[]', $arg, getperms($arg, $perms))."</td>
|
||||||
<td>".$frm->label($label,'perms[]', $arg)."</td>
|
<td>".$frm->label($label,'perms[]', $arg)."</td>
|
||||||
@@ -1618,6 +1620,40 @@ class e_userperms
|
|||||||
|
|
||||||
function renderPermTable($type,$a_perms='')
|
function renderPermTable($type,$a_perms='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($type == 'tabs')
|
||||||
|
{
|
||||||
|
$groupedList = $this->getPermList('grouped');
|
||||||
|
$tab = array();
|
||||||
|
foreach($groupedList as $section=>$list)
|
||||||
|
{
|
||||||
|
$text = '';
|
||||||
|
// $text .= "\t\t<div class='field-section'><h4>".$prm->renderSectionDiz($section)."</h4>"; //XXX Lan - General
|
||||||
|
$text .= "\t\t<table class='table adminlist'>
|
||||||
|
<colgroup>
|
||||||
|
<col class='center' style='width:50px' />
|
||||||
|
<col style='width:50px' />
|
||||||
|
<col />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>";
|
||||||
|
|
||||||
|
foreach($list as $key=>$diz)
|
||||||
|
{
|
||||||
|
$text .= $this->checkb($key, $a_perms, $diz);
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</tbody></table>";
|
||||||
|
|
||||||
|
$tab[] = array('caption'=>$this->renderSectionDiz($section), 'text'=>$text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// return print_a($groupedList);
|
||||||
|
return e107::getForm()->tabs($tab);
|
||||||
|
}
|
||||||
|
|
||||||
$groupedList = $this->getPermList($type);
|
$groupedList = $this->getPermList($type);
|
||||||
|
|
||||||
if($type != 'grouped')
|
if($type != 'grouped')
|
||||||
|
@@ -414,6 +414,6 @@ define("LAN_CONTROL_PANEL", "[x]'s Control Panel");
|
|||||||
define("LAN_CUSTOM_URL", "Custom URL");
|
define("LAN_CUSTOM_URL", "Custom URL");
|
||||||
define("LAN_CUSTOM_URL_DISABLED", "Disabled or Enter Custom URL");
|
define("LAN_CUSTOM_URL_DISABLED", "Disabled or Enter Custom URL");
|
||||||
|
|
||||||
|
define("LAN_GENERAL", "General");
|
||||||
|
|
||||||
// TODO - move e_form related LANS below, add new lan_form.php file (for both front/back-end)
|
// TODO - move e_form related LANS below, add new lan_form.php file (for both front/back-end)
|
||||||
|
@@ -79,7 +79,6 @@ define("ADMSLAN_71", "Click here to display privileges");
|
|||||||
define("ADMSLAN_72", "Admin ID: --ID-- name: --NAME-- new permissions: ");
|
define("ADMSLAN_72", "Admin ID: --ID-- name: --NAME-- new permissions: ");
|
||||||
define("ADMSLAN_73", "Admin ID: --ID-- name: --NAME--");
|
define("ADMSLAN_73", "Admin ID: --ID-- name: --NAME--");
|
||||||
|
|
||||||
define("ADMSLAN_74", "General");
|
|
||||||
// define("ADMSLAN_75", "");
|
// define("ADMSLAN_75", "");
|
||||||
//define("ADMSLAN_76", "Manage language-packs");//ADLAN_132
|
//define("ADMSLAN_76", "Manage language-packs");//ADLAN_132
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user