|
From: Jon O. <jon...@us...> - 2008-03-01 21:21:15
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30176 Modified Files: mx_functions_admincp.php mx_functions_phpbb.php Log Message: I'm making the Page adminCP more clear. Dynamic and Split blocks are not really blocks, but blocks controlling page layout. This has been emphasized in the adminCP. Additionally, i've added a virtual block, to at last reactivate old bundled blog methods. Index: mx_functions_admincp.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_admincp.php,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** mx_functions_admincp.php 17 Feb 2008 20:14:26 -0000 1.51 --- mx_functions_admincp.php 1 Mar 2008 21:21:10 -0000 1.52 *************** *** 288,292 **** '" . $function_id . "', '" . $mx_request_vars->post('auth_view', MX_TYPE_INT, '0') . "' , ! '" . $mx_request_vars->post('auth_edit', MX_TYPE_INT, '0') . "' , '" . $mx_request_vars->post('show_block', MX_TYPE_INT, '1') . "' , '" . $mx_request_vars->post('show_title', MX_TYPE_INT, '1') . "' , --- 288,292 ---- '" . $function_id . "', '" . $mx_request_vars->post('auth_view', MX_TYPE_INT, '0') . "' , ! '" . $mx_request_vars->post('auth_edit', MX_TYPE_INT, '5') . "' , '" . $mx_request_vars->post('show_block', MX_TYPE_INT, '1') . "' , '" . $mx_request_vars->post('show_title', MX_TYPE_INT, '1') . "' , *************** *** 478,481 **** --- 478,514 ---- if ( !MX_ADMIN_DEBUG ) { + // + // First create split, dynamic or virtual blocks - if needed + // + if ($mx_request_vars->is_request('action_type')) + { + switch ($mx_request_vars->request('action_type')) + { + case 'split': + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_multiple_blocks.php'); + $_POST['block_title'] = 'Split Column'; + $_POST['block_desc'] = 'Page: ' . $mx_request_vars->post('page_id', MX_TYPE_INT, 0); + $message = $this->do_it(MX_BLOCK_TYPE, MX_DO_INSERT, $temp_row['function_id']); + $_POST['block_id'] = $message['new_id']; + break; + + case 'dynamic': + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_dynamic.php'); + $_POST['block_title'] = 'Dynamic (Sub)'; + $_POST['block_desc'] = 'Page: ' . $mx_request_vars->post('page_id', MX_TYPE_INT, 0); + $message = $this->do_it(MX_BLOCK_TYPE, MX_DO_INSERT, $temp_row['function_id']); + $_POST['block_id'] = $message['new_id']; + break; + + case 'virtual': + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_virtual.php'); + $_POST['block_title'] = 'Virtual (Blog)'; + $_POST['block_desc'] = 'Page: ' . $mx_request_vars->post('page_id', MX_TYPE_INT, 0); + $message = $this->do_it(MX_BLOCK_TYPE, MX_DO_INSERT, $temp_row['function_id']); + $_POST['block_id'] = $message['new_id']; + break; + } + } + if ($mx_request_vars->is_empty_post('block_id')) { *************** *** 1105,1108 **** --- 1138,1142 ---- { global $template, $lang, $db, $board_config, $theme, $phpEx, $mx_request_vars, $mx_cache, $mx_root_path, $mx_table_prefix, $table_prefix, $userdata; + global $controller_block; switch ( $type ) *************** *** 1311,1315 **** // $message_child .= $this->do_it( MX_BLOCK_PARAMETER_TYPE, MX_DO_DELETE, $block_id, false, false); ! $message_child .= $this->do_it( MX_PAGE_BLOCK_TYPE, MX_DO_DELETE, $block_id, false, false); // --- 1345,1352 ---- // $message_child .= $this->do_it( MX_BLOCK_PARAMETER_TYPE, MX_DO_DELETE, $block_id, false, false); ! if ($controller_block != 'yes') ! { ! $message_child .= $this->do_it( MX_PAGE_BLOCK_TYPE, MX_DO_DELETE, $block_id, false, false); ! } // *************** *** 1511,1514 **** --- 1548,1563 ---- case MX_PAGE_BLOCK_TYPE: + // + // Get function Ids for split, dynamic and virtual blocks + // + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_multiple_blocks.php'); + $tempFunctionId_split = $temp_row['function_id']; + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_dynamic.php'); + $tempFunctionId_dynamic = $temp_row['function_id']; + $temp_row = mx_get_info(FUNCTION_TABLE, 'function_file', 'mx_virtual.php'); + $tempFunctionId_virtual = $temp_row['function_id']; + + $blocksToDelete = array(); + if( $parent ) { *************** *** 1516,1519 **** --- 1565,1584 ---- $sql = "DELETE FROM " . COLUMN_BLOCK_TABLE . " WHERE column_id = " . $column_id; + + // + // Look for split, dynamic or virtual blocks + // + $temp_row = mx_get_info(COLUMN_BLOCK_TABLE, 'column_id', $column_id); + foreach ($temp_row as $key => $data) + { + $temp_sql = "SELECT COUNT(*) AS total FROM " . BLOCK_TABLE . " WHERE (function_id = '$tempFunctionId_split' OR function_id = '$tempFunctionId_dynamic' OR function_id = '$tempFunctionId_virtual') AND block_id = '".$data['block_id']."'"; + $result = $db->sql_query($temp_sql); + $temp_count = $db->sql_fetchrow($result); + + if ($temp_count['total']>0) + { + $blocksToDelete[] = $data['block_id']; + } + } } else *************** *** 1529,1536 **** --- 1594,1630 ---- $sql = "DELETE FROM " . COLUMN_BLOCK_TABLE . " WHERE block_id = $block_id" . $sql_xtra_options; + + // + // Look for split, dynamic or virtual blocks + // + $temp_sql = "SELECT COUNT(*) AS total FROM " . BLOCK_TABLE . " WHERE (function_id = '$tempFunctionId_split' OR function_id = '$tempFunctionId_dynamic' OR function_id = '$tempFunctionId_virtual') AND block_id = '".$block_id."'"; + $result = $db->sql_query($temp_sql); + $temp_count = $db->sql_fetchrow($result); + + if ($temp_count['total']>0) + { + $blocksToDelete[] = $block_id; + } } if ( !MX_ADMIN_DEBUG ) { + // + // First delete split, dynamic or virtual blocks - if needed + // + if (count($blocksToDelete) > 0) + { + foreach ($blocksToDelete as $key => $delete_id) + { + //$message_child .= 'delete:' . $delete_id; + $controller_block = 'yes'; + $message_child .= $this->do_it(MX_BLOCK_TYPE, MX_DO_DELETE, $delete_id); + } + } + $controller_block = ''; + + // + // Now remove page blocks + // if( !($result = $db->sql_query($sql)) ) { *************** *** 3476,3479 **** --- 3570,3578 ---- for( $j = 0; $j < $total_functions; $j++ ) { + if ($row[$j]['function_file'] == 'mx_multiple_blocks.php' || $row[$j]['function_file'] == 'mx_dynamic.php' || $row[$j]['function_file'] == 'mx_virtual.php') + { + //continue; + } + if( $row[$j]['module_id'] != $row[$j-1]['module_id'] ) { *************** *** 3533,3537 **** // Generate dynamic block select // ! $sql = "SELECT blk.*, function_admin, fnc.function_name, fnc.function_id, fnc.function_desc, fnc.module_id, mdl.module_name, mdl.module_id, mdl.module_desc FROM " . BLOCK_TABLE . " blk, " . FUNCTION_TABLE . " fnc, --- 3632,3636 ---- // Generate dynamic block select // ! $sql = "SELECT blk.*, function_admin, fnc.function_name, fnc.function_id, fnc.function_desc, fnc.function_file, fnc.module_id, mdl.module_name, mdl.module_id, mdl.module_desc FROM " . BLOCK_TABLE . " blk, " . FUNCTION_TABLE . " fnc, *************** *** 3571,3574 **** --- 3670,3677 ---- if( $row[$j]['function_id'] != $row[$j-1]['function_id'] ) { + if ($row[$j]['function_file'] == 'mx_multiple_blocks.php' || $row[$j]['function_file'] == 'mx_dynamic.php' || $row[$j]['function_file'] == 'mx_virtual.php') + { + continue; + } $function_desc_tmp = str_replace("\n", '', $row[$j]['function_desc']); $function_desc_tmp = str_replace("\r", '', $function_desc_tmp); Index: mx_functions_phpbb.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_phpbb.php,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** mx_functions_phpbb.php 29 Feb 2008 00:54:10 -0000 1.51 --- mx_functions_phpbb.php 1 Mar 2008 21:21:10 -0000 1.52 *************** *** 777,780 **** --- 777,785 ---- } + if (!$page_id) + { + $page_id = 1; + } + // // Start user session |