mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Don't display 'delete' icon for user classes that can't be deleted. Tidy up a bit.
This commit is contained in:
@@ -48,10 +48,11 @@ $mes = e107::getMessage();
|
|||||||
$message = '';
|
$message = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo user_class::isEditableClass() thinks public (0) is editable?!
|
* See whether a user class is fully editable.
|
||||||
|
*
|
||||||
* @param integer $class_id
|
* @param integer $class_id
|
||||||
* @param boolean $redirect
|
* @param boolean $redirect - if TRUE, will redirect to site home page if class not fully editable.
|
||||||
* @return boolean
|
* @return boolean - TRUE if class fully editable, FALSE if not.
|
||||||
*/
|
*/
|
||||||
function check_allowed($class_id, $redirect = true)
|
function check_allowed($class_id, $redirect = true)
|
||||||
{
|
{
|
||||||
@@ -63,8 +64,8 @@ function check_allowed($class_id, $redirect = true)
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix public (0) case here for now
|
|
||||||
if(!$class_id || !$uc->isEditableClass($class_id))
|
if(!$uc->isEditableClass($class_id))
|
||||||
{
|
{
|
||||||
if(!$redirect) return false;
|
if(!$redirect) return false;
|
||||||
e107::getMessage()->addSession('You can\'t edit system user classes!', E_MESSAGE_ERROR);
|
e107::getMessage()->addSession('You can\'t edit system user classes!', E_MESSAGE_ERROR);
|
||||||
@@ -82,7 +83,7 @@ if (e_QUERY)
|
|||||||
{
|
{
|
||||||
$uc_qs = array($_GET['action'], $_GET['id']);
|
$uc_qs = array($_GET['action'], $_GET['id']);
|
||||||
}
|
}
|
||||||
else $uc_qs = explode(".", e_QUERY);
|
else $uc_qs = explode('.', e_QUERY);
|
||||||
}
|
}
|
||||||
$action = varset($uc_qs[0]);
|
$action = varset($uc_qs[0]);
|
||||||
$params = varset($uc_qs[1],'');
|
$params = varset($uc_qs[1],'');
|
||||||
@@ -259,15 +260,13 @@ if (isset($_POST['createclass'])) // Add or edit
|
|||||||
|
|
||||||
$tempID = intval(varset($_POST['userclass_id'], -1));
|
$tempID = intval(varset($_POST['userclass_id'], -1));
|
||||||
if (($tempID < 0) && $e_userclass->ucGetClassIDFromName($class_record['userclass_name']))
|
if (($tempID < 0) && $e_userclass->ucGetClassIDFromName($class_record['userclass_name']))
|
||||||
{ // Duplicate name
|
{
|
||||||
//$message = UCSLAN_63;
|
$emessage->add(UCSLAN_63, E_MESSAGE_WARNING); // Duplicate name
|
||||||
$emessage->add(UCSLAN_63, E_MESSAGE_WARNING);
|
|
||||||
$forwardVals = TRUE;
|
$forwardVals = TRUE;
|
||||||
}
|
}
|
||||||
elseif ($e_userclass->checkAdminInfo($class_record, $tempID) === FALSE)
|
elseif ($e_userclass->checkAdminInfo($class_record, $tempID) === FALSE)
|
||||||
{
|
{
|
||||||
//$message = UCSLAN_86;
|
$emessage->add(UCSLAN_86); // Some fixed values changed
|
||||||
$emessage->add(UCSLAN_86);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$forwardVals)
|
if (!$forwardVals)
|
||||||
@@ -909,7 +908,7 @@ class uclass_manager
|
|||||||
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
|
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
|
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'method', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
|
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'method', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'center')
|
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'center', 'readParms' => array('deleteClass' => e_UC_NOBODY))
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -949,7 +948,8 @@ class uclass_manager
|
|||||||
|
|
||||||
foreach($classes as $row)
|
foreach($classes as $row)
|
||||||
{
|
{
|
||||||
$text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'userclass_id');
|
$this->fields['options']['readParms']['deleteClass'] = $e_userclass->isEditableClass($row['userclass_id']) ? '' : e_UC_NOBODY;
|
||||||
|
$text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'userclass_id'); // @TODO: Suppress delete icon on fixed classes.
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</tbody></table></fieldset></form>";
|
$text .= "</tbody></table></fieldset></form>";
|
||||||
|
@@ -928,7 +928,7 @@ class user_class
|
|||||||
public function isEditableClass($classID)
|
public function isEditableClass($classID)
|
||||||
{
|
{
|
||||||
if (($classID >= e_UC_SPECIAL_BASE) && ($classID <= e_UC_SPECIAL_END)) return FALSE; // Don't allow deletion of fixed classes
|
if (($classID >= e_UC_SPECIAL_BASE) && ($classID <= e_UC_SPECIAL_END)) return FALSE; // Don't allow deletion of fixed classes
|
||||||
if (isset($this->fixed_classes[vartrue($class_id)])) return FALSE; // This picks up classes such as e_UC_PUBLIC outside the main range which can't be deleted
|
if (isset($this->fixed_classes[$classID])) return FALSE; // This picks up classes such as e_UC_PUBLIC outside the main range which can't be deleted
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user