From fc9419038bcc6967cfcb69d7d92e196c97177a2d Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 1 Nov 2009 17:19:27 +0000 Subject: [PATCH] Remove obsolete language handling in userclass dropdowns; possibly fix Ajax interface on userclass admin --- e107_admin/userclass2.php | 92 +++++++++---------- e107_handlers/userclass_class.php | 56 ++++------- .../English/admin/lan_userclass2.php | 10 +- e107_languages/English/lan_userclass.php | 7 +- 4 files changed, 69 insertions(+), 96 deletions(-) diff --git a/e107_admin/userclass2.php b/e107_admin/userclass2.php index 61e711ae3..88c8b91a9 100644 --- a/e107_admin/userclass2.php +++ b/e107_admin/userclass2.php @@ -9,9 +9,9 @@ * Administration Area - User classes * * $Source: /cvs_backup/e107_0.8/e107_admin/userclass2.php,v $ - * $Revision: 1.29 $ - * $Date: 2009-10-21 07:31:05 $ - * $Author: e107coders $ + * $Revision: 1.30 $ + * $Date: 2009-11-01 17:19:26 $ + * $Author: e107steved $ * */ @@ -81,37 +81,48 @@ if(e_AJAX_REQUEST) //by the JS AJAX handler e_jshelper::sendAjaxError('403', 'Access denied. Form update failed!'); } - $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) + elseif($sql->db_Select('userclass_classes', '*', "userclass_id='".$class_num."' ")) { - //Response action - show group, hide standard - $jshelper->addResponseAction('element-invoke-by-id', array('show' => 'userclass_type_groups', 'hide' => 'userclass_type_standard')); + $row = $sql->db_Fetch(MYSQL_ASSOC); - //fill in the classes array - $tmp = explode(',',$row['userclass_accum']); - foreach ($tmp as $uid) { - $row['group_classes_select_'.$uid] = $uid; + //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 + $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 { - //hide group, show standard rows - $jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard')); - } - unset($row['userclass_accum']); - $row['createclass'] = UCSLAN_14; //update the submit button value - $row['existing'] = $class_num; //required when user tree is clicked - //icon - $row['iconview'] = $row['userclass_icon'] ? e_IMAGE_ABS.'userclasses/'.$row['userclass_icon'] : e_IMAGE_ABS."generic/blank.gif"; - $row['uc_icon_select'] = $row['userclass_icon']; //icons select box + unset($row['userclass_accum']); + $row['createclass'] = UCSLAN_14; //update the submit button value + $row['existing'] = $class_num; //required when user tree is clicked + //icon + $row['iconview'] = $row['userclass_icon'] ? e_IMAGE_ABS.'userclasses/'.$row['userclass_icon'] : e_IMAGE_ABS."generic/blank.gif"; + $row['uc_icon_select'] = $row['userclass_icon']; //icons select box + + //Send the prefered response type + //$jshelper->sendJSONResponse('fill-form', $row); + $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; } } @@ -364,25 +375,6 @@ switch ($action) "; - /* $text .= " - - "; - - if ($class_total == "0") - { - $text .= UCSLAN_7; - } - else - { - $text .= "".UCSLAN_8.":"; - $text .= "'; - $text .= " - - - - - "; - }*/ $text .= " @@ -435,7 +427,7 @@ switch ($action) ".UCSLAN_83." "; $text .= $e_userclass->vetted_tree('group_classes_select',array($e_userclass,'checkbox'), $userclass_groupclass,"classes,matchclass"); - $text .= "
".UCSLAN_32."
+ $text .= "
".UCSLAN_89."
"; diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index 5b575fdcc..2b2503bd2 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ -| $Revision: 1.42 $ -| $Date: 2009-09-17 00:13:40 $ -| $Author: e107coders $ +| $Revision: 1.43 $ +| $Date: 2009-11-01 17:19:27 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -42,7 +42,8 @@ define("e_UC_NOBODY", 255); define('e_UC_ADMINMOD',249); define('e_UC_MODS',248); 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('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_MAINADMIN => UC_LAN_6, 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, - '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 } @@ -158,13 +161,6 @@ class user_class $this->class_parents[e_UC_NOBODY] = e_UC_NOBODY; 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 (!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) { $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)); unset($possibles[e_UC_READONLY]); foreach ($this->class_tree as $uc => $uv) @@ -305,9 +301,9 @@ class user_class admin main - main admin new - new users + bots - search bot class classes - shows all classes 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 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 .= "\n"; } - if (strpos($optlist, "language") !== FALSE && $pref['multilanguage']) - { - $text .= "\n"; - $tmpl = explode(",",e_LANLIST); - foreach($tmpl as $lang) - { - $s = ($curval == $lang) ? " selected='selected'" : ""; - $text .= "\n"; - } - } - // Only return the select box if we've ended up with some options if ($text) $text = "\n\n"; return $text.$curVal; @@ -439,7 +424,7 @@ class user_class } } /* 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'])) { @@ -476,16 +461,6 @@ class user_class } } - if (strpos($optlist, "language") !== FALSE && $pref['multilanguage']) - { - $ret .= "
\n"; - $tmpl = explode(",",e_LANLIST); - foreach($tmpl as $lang) - { - $c = (in_array($lang, $curArray)) ? " checked='checked' " : ""; - $ret .= "
"; - } - } return $ret; } @@ -778,7 +753,6 @@ admin main - main admin classes - shows all classes 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 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_parent' => e_UC_MEMBER, '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 ) ); diff --git a/e107_languages/English/admin/lan_userclass2.php b/e107_languages/English/admin/lan_userclass2.php index 03e4d7e63..08c0ef69f 100644 --- a/e107_languages/English/admin/lan_userclass2.php +++ b/e107_languages/English/admin/lan_userclass2.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_userclass2.php,v $ -| $Revision: 1.9 $ -| $Date: 2009-08-04 14:36:56 $ -| $Author: e107coders $ +| $Revision: 1.10 $ +| $Date: 2009-11-01 17:19:27 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ 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_86', 'Some settings not allowed for admin classes - they have been set to defaults. '); define('UCSLAN_87', 'Recently joined users'); -define('UCSLAN_88', ''); -define('UCSLAN_89', ''); +define('UCSLAN_88', 'Identified search bots'); +define('UCSLAN_89', 'Checked classes are members of the group'); define('UCSLAN_90', ''); define('UCSLAN_91', ''); diff --git a/e107_languages/English/lan_userclass.php b/e107_languages/English/lan_userclass.php index 1b7cb47aa..d61baf10a 100644 --- a/e107_languages/English/lan_userclass.php +++ b/e107_languages/English/lan_userclass.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_userclass.php,v $ -| $Revision: 1.4 $ -| $Date: 2009-08-04 14:36:56 $ -| $Author: e107coders $ +| $Revision: 1.5 $ +| $Date: 2009-11-01 17:19:27 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ 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_8','Admins and Mods'); define('UC_LAN_9','New Users'); +define('UC_LAN_10', 'Search Bots'); define('UC_LAN_INVERT', "Not --CLASS--"); define('UC_LAN_INVERTLABEL', "Everyone but..");