--- mambo/branches/4.6/administrator/components/com_mambots/admin.mambots.php 2006/01/19 14:24:56 151 +++ mambo/branches/4.6/administrator/components/com_mambots/admin.mambots.php 2006/02/16 21:43:38 297 @@ -1,12 +1,14 @@ acl_check( 'administration', 'edit', 'users', $my->usertype, 'mambots', 'all' ) | $acl->acl_check( 'administration', 'install', 'users', $my->usertype, 'mambots', 'all' ))) { - mosRedirect( 'index2.php', _NOT_AUTH ); + mosRedirect( 'index2.php', T_('You are not authorized to view this resource.') ); } require_once( $mainframe->getPath( 'admin_html' ) ); @@ -134,7 +136,7 @@ . "\n GROUP BY folder" . "\n ORDER BY folder" ; - $types[] = mosHTML::makeOption( '0', _SEL_TYPE ); + $types[] = mosHTML::makeOption( '0', T_('- All Types -') ); $database->setQuery( $query ); $types = array_merge( $types, $database->loadObjectList() ); $lists['type'] = mosHTML::selectList( $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_type ); @@ -181,12 +183,12 @@ switch ( $task ) { case 'apply': - $msg = 'Successfully Saved changes to Mambot: '. $row->name; + $msg = sprintf(T_('Successfully Saved changes to Mambot: %s'), $row->name); mosRedirect( 'index2.php?option='. $option .'&client='. $client .'&task=editA&hidemainmenu=1&id='. $row->id, $msg ); case 'save': default: - $msg = 'Successfully Saved Mambot: '. $row->name; + $msg = sprintf(T_('Successfully Saved Mambot: %s'), $row->name); mosRedirect( 'index2.php?option='. $option .'&client='. $client, $msg ); break; } @@ -209,7 +211,7 @@ // fail if checked out not by 'me' if ($row->checked_out && $row->checked_out <> $my->id) { - echo "\n"; + echo "\n"; exit(0); } @@ -221,7 +223,7 @@ // get list of groups if ($row->access == 99 || $row->client_id == 1) { - $lists['access'] = 'Administrator'; + $lists['access'] = T_('Administrator').''; } else { // build the html select list for the group access $lists['access'] = mosAdminMenus::Access( $row ); @@ -244,7 +246,7 @@ $order = mosGetOrderingList( $query ); $lists['ordering'] = mosHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) ); } else { - $lists['ordering'] = 'This mambot cannot be reordered'; + $lists['ordering'] = ''.T_('This mambot cannot be reordered'); } $lists['folder'] = ''. $row->folder; @@ -266,7 +268,7 @@ } } $lists['folder'] = mosHTML::selectList( $folders2, 'folder', 'class="inputbox" size="1"', 'value', 'text', null ); - $lists['ordering'] = 'New items default to the last place. Ordering can be changed after this item is saved.'; + $lists['ordering'] = ''.T_('New items default to the last place. Ordering can be changed after this item is saved.').''; } $lists['published'] = mosHTML::yesnoRadioList( 'published', 'class="inputbox"', $row->published ); @@ -287,7 +289,7 @@ global $database, $my; if (count( $cid ) < 1) { - echo "\n"; + echo "\n"; exit; } @@ -303,8 +305,8 @@ global $database, $my; if (count( $cid ) < 1) { - $action = $publish ? 'publish' : 'unpublish'; - echo "\n"; + $action = $publish ? T_('publish') : T_('unpublish'); + echo "\n"; exit; } @@ -399,40 +401,30 @@ function saveOrder( &$cid ) { global $database; - - $total = count( $cid ); $order = mosGetParam( $_POST, 'order', array(0) ); - $row = new mosMambot( $database ); - $conditions = array(); - + $row = new mosMenu( $database ); + $folders = 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 = "folder='$row->folder' AND ordering > -10000 AND ordering < 10000 AND client_id='$row->client_id'"; - $found = false; - foreach ( $conditions as $cond ) - if ($cond[1]==$condition) { - $found = true; - break; - } // if - if (!$found) $conditions[] = array($row->id, $condition); - } // if - } // for - + $folders[$row->folder][$row->client_id] = $row->id; + } + } // execute updateOrder for each group - foreach ( $conditions as $cond ) { - $row->load( $cond[0] ); - $row->updateOrder( $cond[1] ); + foreach ($folders as $folder=>$clients) { + foreach ($clients as $client=>$rowid) { + $row->updateOrder("folder = '$folder' AND ordering > -10000 AND ordering < 10000 AND client_id = '$client'"); + } } // foreach - $msg = 'New ordering saved'; + $msg = T_('New ordering saved'); mosRedirect( 'index2.php?option=com_mambots', $msg ); } // saveOrder