|
From: Jon O. <jon...@us...> - 2006-08-13 18:51:43
|
Update of /cvsroot/mxbb/mx_kb/admin In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27663/modules/mx_kb/admin Modified Files: mx_module_defs.php Log Message: More module blocks - Mini block - Latest Item block Index: mx_module_defs.php =================================================================== RCS file: /cvsroot/mxbb/mx_kb/admin/mx_module_defs.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mx_module_defs.php 28 Jun 2006 20:52:30 -0000 1.11 --- mx_module_defs.php 13 Aug 2006 18:51:37 -0000 1.12 *************** *** 44,47 **** --- 44,48 ---- $type_row['kb_type_select'] = !empty($lang['ParType_kb_type_select']) ? $lang['ParType_kb_type_select'] : "KB phpBB Source Forums"; + $type_row['kb_quick_cat'] = !empty($lang['ParType_kb_quick_cat']) ? $lang['ParType_kb_quick_cat'] : "KB default category"; return $type_row; *************** *** 81,87 **** --- 82,130 ---- $this->display_edit_KB_type_select( $block_id, $parameter_data['parameter_id'], $parameter_data ); break; + + case 'kb_quick_cat': + $this->display_edit_kb_quick_cat( $block_id, $parameter_data['parameter_id'], $parameter_data ); + break; } } + function display_edit_kb_quick_cat( $block_id, $parameter_id, $parameter_data ) + { + global $template, $board_config, $db, $theme, $lang, $images, $mx_blockcp, $mx_root_path, $phpEx, $mx_table_prefix, $table_prefix; + + // + // Includes + // + $module_root_path = $mx_root_path . $mx_blockcp->module_root_path; + include_once( $module_root_path . 'kb/includes/kb_constants.' . $phpEx ); + + // + // Get varaibles + // + $data = ( !empty( $parameter_data['parameter_value'] ) ) ? $parameter_data['parameter_value'] : ''; + $parameter_datas = $this->generate_jumpbox( 0, 0, array( $data => 1 ), false ); + + // + // Start page proper + // + $template->set_filenames(array( + 'parameter' => 'admin/mx_module_parameters.tpl') + ); + + $template->assign_block_vars( 'select', array( + 'PARAMETER_TITLE' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], + 'PARAMETER_TITLE_EXPLAIN' => ( !empty($lang[$parameter_data['parameter_name']. "_explain"]) ) ? '<br />' . $lang[$parameter_data['parameter_name']. "_explain"] : '', + 'L_NONE' => $lang['None'], + + 'SELECT_LIST' => $parameter_datas, + + 'FIELD_NAME' => ( !empty($lang[$parameter_data['parameter_name']]) ) ? $lang[$parameter_data['parameter_name']] : $parameter_data['parameter_name'], + 'FIELD_ID' => $parameter_data['parameter_id'], + 'FIELD_DESCRIPTION' => ( !empty($lang["ParType_".$parameter_data['parameter_type']]) ) ? $lang["ParType_".$parameter_data['parameter_type']] : '' + )); + + $template->pparse('parameter'); + } + function display_edit_KB_type_select( $block_id, $parameter_id, $parameter_data ) { *************** *** 163,166 **** --- 206,283 ---- $template->pparse('parameter'); } + + // =================================================== + // Jump menu function + // $cat_id : to handle parent cat_id + // $depth : related to function to generate tree + // $default : the cat you wanted to be selected + // $for_file: TRUE high category ids will be -1 + // $check_upload: if true permission for upload will be checked + // =================================================== + function generate_jumpbox( $cat_id = 0, $depth = 0, $default = '', $for_file = false, $check_upload = false ) + { + global $db; + + static $cat_rowset = false; + + $sql = 'SELECT * + FROM ' . KB_CATEGORIES_TABLE . ' + ORDER BY cat_order ASC'; + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt Query categories info', '', __LINE__, __FILE__, $sql ); + } + $cat_rowset_temp = $db->sql_fetchrowset( $result ); + + $db->sql_freeresult( $result ); + + $cat_rowset = array(); + foreach( $cat_rowset_temp as $row ) + { + $cat_rowset[$row['category_id']] = $row; + } + + // + // Generate list + // + + $cat_list .= ''; + + $pre = str_repeat( ' ', $depth ); + + $temp_cat_rowset = $cat_rowset; + + if ( !empty( $temp_cat_rowset ) ) + { + foreach ( $temp_cat_rowset as $temp_cat_id => $cat ) + { + if ( $cat['parent'] == $cat_id ) + { + if ( is_array( $default ) ) + { + if ( isset( $default[$cat['category_id']] ) ) + { + $sel = ' selected="selected"'; + } + else + { + $sel = ''; + } + } + $cat_pre = ( !$cat['cat_allow_file'] ) ? '+ ' : '- '; + $sub_cat_id = ( $for_file ) ? ( ( !$cat['cat_allow_file'] ) ? -1 : $cat['category_id'] ) : $cat['category_id']; + $cat_class = ( !$cat['cat_allow_file'] ) ? 'class="greyed"' : ''; + $cat_list .= '<option value="' . $sub_cat_id . '"' . $sel . ' ' . $cat_class . ' />' . $pre . $cat_pre . $cat['category_name'] . '</option>'; + $cat_list .= $this->generate_jumpbox( $cat['category_id'], $depth + 1, $default, $for_file, $check_upload ); + } + } + return $cat_list; + } + else + { + return; + } + } } ?> \ No newline at end of file |