--- mambo/branches/4.6/administrator/components/com_categories/admin.categories.php 2006/01/19 13:29:35 149 +++ mambo/branches/4.7/administrator/components/com_categories/admin.categories.php 2007/09/19 07:30:21 1292 @@ -1,12 +1,11 @@ section == 'com_newsfeeds') { - $types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('Newsfeed Category Table') ); + $types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('News Feed Category Table') ); } else if ($row->section == 'com_weblinks') { - $types[] = mosHTML::makeOption( 'weblink_category_table', T_('Weblink Category Table') ); + $types[] = mosHTML::makeOption( 'weblink_category_table', T_('Web Link Category Table') ); } else { $types[] = mosHTML::makeOption( 'content_category', T_('Content Category Table') ); $types[] = mosHTML::makeOption( 'content_blog_category', T_('Content Category Blog') ); @@ -354,7 +351,11 @@ $lists['published'] = mosHTML::yesnoRadioList( 'published', 'class="inputbox"', $row->published ); // build the html select list for menu selection $lists['menuselect'] = mosAdminMenus::MenuSelect( ); - + // build and html select list of content items - including static + if ( $redirect == 'com_contact_details' ) { + $contactCatParams =& new mosParameters($row->params); + $lists['contentselect'] = contentHandler::ContentSelect( 'contentselect', NULL, $contactCatParams->get('redirect_page', -1), TRUE ); + } categories_html::edit( $row, $lists, $redirect, $menus ); } @@ -369,12 +370,21 @@ $menuid = mosGetParam( $_POST, 'menuid', 0 ); $redirect = mosGetParam( $_POST, 'redirect', '' ); $oldtitle = mosGetParam( $_POST, 'oldtitle', null ); + $redirect_page = mosGetParam( $_POST, 'contentselect', '' ); $row = new mosCategory( $database ); if (!$row->bind( $_POST )) { echo "\n"; exit(); } + + // handle the contact form redirect param + if ( $redirect == 'com_contact_details' ) { + //for contact categories, no need to loop for parms - since there is only one param + if (is_numeric($redirect_page)) + $row->params = "redirect_page=".$redirect_page; + } + if (!$row->check()) { echo "\n"; exit(); @@ -444,7 +454,7 @@ global $database; if (count( $cid ) < 1) { - echo "\n"; + echo "\n"; exit; } @@ -556,6 +566,8 @@ $row = new mosCategory( $database ); $row->bind( $_POST ); + // sanitize + $row->id = intval($row->id); $row->checkin(); mosRedirect( 'index2.php?option=com_categories§ion='. $redirect ); } @@ -582,7 +594,7 @@ $redirect = mosGetParam( $_POST, 'section', 'content' );; if (!is_array( $cid ) || count( $cid ) < 1) { - echo "\n"; + echo "\n"; exit; } @@ -652,7 +664,7 @@ $redirect = mosGetParam( $_POST, 'section', 'content' );; if (!is_array( $cid ) || count( $cid ) < 1) { - echo "\n"; + echo "\n"; exit; } @@ -738,7 +750,7 @@ $sectionNew = new mosSection ( $database ); $sectionNew->load( $sectionMove ); - $msg = sprintf(T_('%d Categories copied to %s'), $total, $sectionNew->name); + $msg = sprintf(Tn_('%d Category copied to %s', '%d Categories copied to %s', $total), $total, $sectionNew->name); mosRedirect( 'index2.php?option=com_categories§ion='. $sectionOld .'&mosmsg='. $msg ); } @@ -799,12 +811,12 @@ case 'newsfeed_category_table': $link = 'index.php?option=com_newsfeeds&catid='. $id; - $menutype = T_('Newsfeed Category Table'); + $menutype = T_('News Feed Category Table'); break; case 'weblink_category_table': $link = 'index.php?option=com_weblinks&catid='. $id; - $menutype = T_('Weblink Category Table'); + $menutype = T_('Web Link Category Table'); break; default:; @@ -836,39 +848,26 @@ function saveOrder( &$cid, $section ) { global $database; - - $total = count( $cid ); $order = mosGetParam( $_POST, 'order', array(0) ); $row = new mosCategory( $database ); - $conditions = array(); - + $sections = array(); // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( $cid[$i] ); + foreach ($cid as $i=>$ciditem) { + $row->load( $ciditem ); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; if (!$row->store()) { echo "\n"; exit(); - } // if + } // remember to updateOrder this group - $condition = "section='$row->section'"; - $found = false; - foreach ( $conditions as $cond ) - if ($cond[1]==$condition) { - $found = true; - break; - } // if - if (!$found) $conditions[] = array($row->id, $condition); - } // if - } // for - + $sections[$row->section] = $row->id; + } + } // execute updateOrder for each group - foreach ( $conditions as $cond ) { - $row->load( $cond[0] ); - $row->updateOrder( $cond[1] ); + foreach ($sections as $section=>$rowid) { + $row->updateOrder("section='$section'"); } // foreach - $msg = T_('New ordering saved'); mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); } // saveOrder