1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Remove obsolete language handling in userclass dropdowns; possibly fix Ajax interface on userclass admin

This commit is contained in:
e107steved
2009-11-01 17:19:27 +00:00
parent 05ac518c65
commit fc9419038b
4 changed files with 69 additions and 96 deletions

View File

@@ -9,9 +9,9 @@
* Administration Area - User classes * Administration Area - User classes
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $
* $Revision: 1.29 $ * $Revision: 1.30 $
* $Date: 2009-10-21 07:31:05 $ * $Date: 2009-11-01 17:19:26 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
@@ -81,37 +81,48 @@ if(e_AJAX_REQUEST)
//by the JS AJAX handler //by the JS AJAX handler
e_jshelper::sendAjaxError('403', 'Access denied. Form update failed!'); e_jshelper::sendAjaxError('403', 'Access denied. Form update failed!');
} }
$sql->db_Select('userclass_classes', '*', "userclass_id='".$class_num."' "); elseif($sql->db_Select('userclass_classes', '*', "userclass_id='".$class_num."' "))
$row = $sql->db_Fetch(MYSQL_ASSOC);
//Response action - reset all group checkboxes
$jshelper->addResponseAction('reset-checked', array('group_classes_select' => '0'));
//it's grouped userclass
if ($row['userclass_type'] == UC_TYPE_GROUP)
{ {
//Response action - show group, hide standard $row = $sql->db_Fetch(MYSQL_ASSOC);
$jshelper->addResponseAction('element-invoke-by-id', array('show' => 'userclass_type_groups', 'hide' => 'userclass_type_standard'));
//fill in the classes array //Response action - reset all group checkboxes
$tmp = explode(',',$row['userclass_accum']); $jshelper->addResponseAction('reset-checked', array('group_classes_select' => '0'));
foreach ($tmp as $uid) {
$row['group_classes_select_'.$uid] = $uid; //it's grouped userclass
if ($row['userclass_type'] == UC_TYPE_GROUP)
{
//Response action - show group, hide standard
$jshelper->addResponseAction('element-invoke-by-id', array('show' => 'userclass_type_groups', 'hide' => 'userclass_type_standard'));
//fill in the classes array
$tmp = explode(',',$row['userclass_accum']);
foreach ($tmp as $uid)
{
$row['group_classes_select_'.$uid] = $uid;
}
}
else
{
//hide group, show standard rows
$jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard'));
} }
} else { unset($row['userclass_accum']);
//hide group, show standard rows $row['createclass'] = UCSLAN_14; //update the submit button value
$jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard')); $row['existing'] = $class_num; //required when user tree is clicked
} //icon
unset($row['userclass_accum']); $row['iconview'] = $row['userclass_icon'] ? e_IMAGE_ABS.'userclasses/'.$row['userclass_icon'] : e_IMAGE_ABS."generic/blank.gif";
$row['createclass'] = UCSLAN_14; //update the submit button value $row['uc_icon_select'] = $row['userclass_icon']; //icons select box
$row['existing'] = $class_num; //required when user tree is clicked
//icon //Send the prefered response type
$row['iconview'] = $row['userclass_icon'] ? e_IMAGE_ABS.'userclasses/'.$row['userclass_icon'] : e_IMAGE_ABS."generic/blank.gif"; //$jshelper->sendJSONResponse('fill-form', $row);
$row['uc_icon_select'] = $row['userclass_icon']; //icons select box $jshelper->addResponseAction('fill-form', $row);
$jshelper->sendResponse('XML');
}
else
{
e_jshelper::sendAjaxError('500', 'Database read error!');
}
//Send the prefered response type
//$jshelper->sendJSONResponse('fill-form', $row);
$jshelper->sendResponse('fill-form', $row);
exit; exit;
} }
} }
@@ -364,25 +375,6 @@ switch ($action)
</colgroup>"; </colgroup>";
/* $text .= "
<tr>
<td class='fcaption' style='text-align:center' colspan='3'>";
if ($class_total == "0")
{
$text .= UCSLAN_7;
}
else
{
$text .= "<span class='defaulttext'>".UCSLAN_8.":</span>";
$text .= "<select name='existing' class='tbox'>".$e_userclass->vetted_tree('existing',array($e_userclass,'select'), $userclass_id,"main,admin,new,classes,matchclass").'</select>';
$text .= "
<input class='button' type='submit' id='edit' name='edit' value='".LAN_EDIT."' />
<input class='button' type='submit' name='delete' value='".LAN_DELETE."' />
<input type='checkbox' name='confirm' id='confirm' value='1' /><label for='confirm' class='smalltext'> ".UCSLAN_11."</label>
</td>
</tr>";
}*/
$text .= " $text .= "
<tr> <tr>
@@ -435,7 +427,7 @@ switch ($action)
<td>".UCSLAN_83."</td> <td>".UCSLAN_83."</td>
<td>"; <td>";
$text .= $e_userclass->vetted_tree('group_classes_select',array($e_userclass,'checkbox'), $userclass_groupclass,"classes,matchclass"); $text .= $e_userclass->vetted_tree('group_classes_select',array($e_userclass,'checkbox'), $userclass_groupclass,"classes,matchclass");
$text .= "<div class='field-help'>".UCSLAN_32."</div></td> $text .= "<div class='field-help'>".UCSLAN_89."</div></td>
</tr> </tr>
"; ";

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $
| $Revision: 1.42 $ | $Revision: 1.43 $
| $Date: 2009-09-17 00:13:40 $ | $Date: 2009-11-01 17:19:27 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -42,7 +42,8 @@ define("e_UC_NOBODY", 255);
define('e_UC_ADMINMOD',249); define('e_UC_ADMINMOD',249);
define('e_UC_MODS',248); define('e_UC_MODS',248);
define('e_UC_NEWUSER',247); // Users in 'probationary' period define('e_UC_NEWUSER',247); // Users in 'probationary' period
define('e_UC_SPECIAL_BASE',245); // Assign class IDs 245 and above for fixed/special purposes define('e_UC_BOTS',246); // Reserved to identify search bots
define('e_UC_SPECIAL_BASE',243); // Assign class IDs 243 and above for fixed/special purposes
define('e_UC_SPECIAL_END',255); // Highest 'special' class define('e_UC_SPECIAL_END',255); // Highest 'special' class
// define('UC_CLASS_ICON_DIR','userclasses/'); // Directory for userclass icons - deprecated - the icon will be saved with the full path. {e_IMAGE} or {e_PLUGIN} / images/ etc. // define('UC_CLASS_ICON_DIR','userclasses/'); // Directory for userclass icons - deprecated - the icon will be saved with the full path. {e_IMAGE} or {e_PLUGIN} / images/ etc.
@@ -79,11 +80,13 @@ class user_class
e_UC_ADMIN => UC_LAN_5, e_UC_ADMIN => UC_LAN_5,
e_UC_MAINADMIN => UC_LAN_6, e_UC_MAINADMIN => UC_LAN_6,
e_UC_READONLY => UC_LAN_4, e_UC_READONLY => UC_LAN_4,
e_UC_NEWUSER => UC_LAN_9 e_UC_NEWUSER => UC_LAN_9,
e_UC_BOTS => UC_LAN_10
); );
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER, $this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'readonly' => e_UC_READONLY, 'new' => e_UC_NEWUSER); 'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'new' => e_UC_NEWUSER,
'bots' => e_UC_BOTS, 'readonly' => e_UC_READONLY);
$this->readTree(TRUE); // Initialise the classes on entry $this->readTree(TRUE); // Initialise the classes on entry
} }
@@ -158,13 +161,6 @@ class user_class
$this->class_parents[e_UC_NOBODY] = e_UC_NOBODY; $this->class_parents[e_UC_NOBODY] = e_UC_NOBODY;
foreach ($this->class_tree as $uc) foreach ($this->class_tree as $uc)
{ {
/*
if ($uc['userclass_parent'] == e_UC_PUBLIC)
{ // Note parent (top level) classes
$this->class_parents[$uc['userclass_id']] = $uc['userclass_id'];
}
else
*/
if (($uc['userclass_id'] != e_UC_PUBLIC) && ($uc['userclass_id'] != e_UC_NOBODY)) if (($uc['userclass_id'] != e_UC_PUBLIC) && ($uc['userclass_id'] != e_UC_NOBODY))
{ {
// if (!array_key_exists($uc['userclass_parent'],$this->class_tree)) // if (!array_key_exists($uc['userclass_parent'],$this->class_tree))
@@ -202,7 +198,7 @@ class user_class
public function get_editable_classes($class_list = USERCLASS_LIST, $asArray = FALSE) public function get_editable_classes($class_list = USERCLASS_LIST, $asArray = FALSE)
{ {
$ret = array(); $ret = array();
$blockers = array(e_UC_PUBLIC => 1, e_UC_READONLY => 1, e_UC_MEMBER => 1, e_UC_NOBODY => 1, e_UC_GUEST => 1, e_UC_NEWUSER => 1); $blockers = array(e_UC_PUBLIC => 1, e_UC_READONLY => 1, e_UC_MEMBER => 1, e_UC_NOBODY => 1, e_UC_GUEST => 1, e_UC_NEWUSER => 1, e_UC_BOTS => 1);
$possibles = array_flip(explode(',',$class_list)); $possibles = array_flip(explode(',',$class_list));
unset($possibles[e_UC_READONLY]); unset($possibles[e_UC_READONLY]);
foreach ($this->class_tree as $uc => $uv) foreach ($this->class_tree as $uc => $uv)
@@ -305,9 +301,9 @@ class user_class
admin admin
main - main admin main - main admin
new - new users new - new users
bots - search bot class
classes - shows all classes classes - shows all classes
matchclass - if 'classes' is set, this option will only show the classes that the user is a member of matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
language - list of languages.
blank - puts an empty option at the top of select dropdowns blank - puts an empty option at the top of select dropdowns
filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field - added for 0.8 filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field - added for 0.8
@@ -352,17 +348,6 @@ class user_class
$text .= "</optgroup>\n"; $text .= "</optgroup>\n";
} }
if (strpos($optlist, "language") !== FALSE && $pref['multilanguage'])
{
$text .= "<optgroup label=' ------ ' />\n";
$tmpl = explode(",",e_LANLIST);
foreach($tmpl as $lang)
{
$s = ($curval == $lang) ? " selected='selected'" : "";
$text .= "<option value='$lang' ".$s.">".$lang."</option>\n";
}
}
// Only return the select box if we've ended up with some options // Only return the select box if we've ended up with some options
if ($text) $text = "\n<select class='tbox select' name='{$fieldname}' {$extra_js}>\n".$text."</select>\n"; if ($text) $text = "\n<select class='tbox select' name='{$fieldname}' {$extra_js}>\n".$text."</select>\n";
return $text.$curVal; return $text.$curVal;
@@ -439,7 +424,7 @@ class user_class
} }
} }
/* Above loop slightly changes the display order of earlier code versions. /* Above loop slightly changes the display order of earlier code versions.
If readonly must be last (after language), delete it from the $text_class_link array, and uncomment the following code If readonly must be last, delete it from the $text_class_link array, and uncomment the following code
if (isset($opt_arr['readonly'])) if (isset($opt_arr['readonly']))
{ {
@@ -476,16 +461,6 @@ class user_class
} }
} }
if (strpos($optlist, "language") !== FALSE && $pref['multilanguage'])
{
$ret .= "<div class='separator'><!-- --></div>\n";
$tmpl = explode(",",e_LANLIST);
foreach($tmpl as $lang)
{
$c = (in_array($lang, $curArray)) ? " checked='checked' " : "";
$ret .= "<div class='field-spacer'><input type='checkbox' class='checkbox' name='{$fieldname}[{$lang}]' id='{$fieldname}-{$lang}' value='1'{$c} /><label for='{$fieldname}-{$lang}'>{$lang}</label></div>";
}
}
return $ret; return $ret;
} }
@@ -778,7 +753,6 @@ admin
main - main admin main - main admin
classes - shows all classes classes - shows all classes
matchclass - if 'classes' is set, this option will only show the classes that the user is a member of matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
language - list of languages.
filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field filter - only show those classes where member is in a class permitted to view them - i.e. as the new 'visible to' field
force - show all classes (subject to the other options, including matchclass) force - show all classes (subject to the other options, including matchclass)
@@ -1398,6 +1372,12 @@ class user_class_admin extends user_class
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_MEMBER, 'userclass_parent' => e_UC_MEMBER,
'userclass_visibility' => e_UC_ADMIN 'userclass_visibility' => e_UC_ADMIN
),
array('userclass_id' => e_UC_BOT, 'userclass_name' => UC_LAN_10,
'userclass_description' => UCSLAN_88,
'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_PUBLIC,
'userclass_visibility' => e_UC_ADMIN
) )
); );

View File

@@ -4,9 +4,9 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_userclass2.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_userclass2.php,v $
| $Revision: 1.9 $ | $Revision: 1.10 $
| $Date: 2009-08-04 14:36:56 $ | $Date: 2009-11-01 17:19:27 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("UCSLAN_1", "Cleared all users from class."); define("UCSLAN_1", "Cleared all users from class.");
@@ -96,8 +96,8 @@ define('UCSLAN_84', ' (Group)');
define('UCSLAN_85', 'You have assigned all available classes; please reassign one which is not in use'); define('UCSLAN_85', 'You have assigned all available classes; please reassign one which is not in use');
define('UCSLAN_86', 'Some settings not allowed for admin classes - they have been set to defaults. '); define('UCSLAN_86', 'Some settings not allowed for admin classes - they have been set to defaults. ');
define('UCSLAN_87', 'Recently joined users'); define('UCSLAN_87', 'Recently joined users');
define('UCSLAN_88', ''); define('UCSLAN_88', 'Identified search bots');
define('UCSLAN_89', ''); define('UCSLAN_89', 'Checked classes are members of the group');
define('UCSLAN_90', ''); define('UCSLAN_90', '');
define('UCSLAN_91', ''); define('UCSLAN_91', '');

View File

@@ -4,9 +4,9 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_userclass.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_userclass.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2009-08-04 14:36:56 $ | $Date: 2009-11-01 17:19:27 $
| $Author: e107coders $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("UC_LAN_0", "Everyone (public)"); define("UC_LAN_0", "Everyone (public)");
@@ -19,6 +19,7 @@ define("UC_LAN_6", "Main Admin");
define('UC_LAN_7', 'Forum Moderators'); define('UC_LAN_7', 'Forum Moderators');
define('UC_LAN_8','Admins and Mods'); define('UC_LAN_8','Admins and Mods');
define('UC_LAN_9','New Users'); define('UC_LAN_9','New Users');
define('UC_LAN_10', 'Search Bots');
define('UC_LAN_INVERT', "Not --CLASS--"); define('UC_LAN_INVERT', "Not --CLASS--");
define('UC_LAN_INVERTLABEL', "Everyone but.."); define('UC_LAN_INVERTLABEL', "Everyone but..");