| 12 |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); |
| 13 |
|
|
| 14 |
require_once( $mainframe->getPath( 'admin_html' ) ); |
require_once( $mainframe->getPath( 'admin_html' ) ); |
| 15 |
|
require_once($mosConfig_absolute_path.'/components/com_content/content.class.php'); |
| 16 |
|
|
| 17 |
// get parameters from the URL or submitted form |
// get parameters from the URL or submitted form |
| 18 |
$section = mosGetParam( $_REQUEST, 'section', 'content' ); |
$section = mosGetParam( $_REQUEST, 'section', 'content' ); |
| 137 |
$type = 'other'; |
$type = 'other'; |
| 138 |
// special handling for contact component |
// special handling for contact component |
| 139 |
if ( $section == 'com_contact_details' ) { |
if ( $section == 'com_contact_details' ) { |
| 140 |
$section_name = 'Contact'; |
$section_name = T_('Contact'); |
| 141 |
} |
} |
| 142 |
$section_name = 'Component: '. $section_name; |
$section_name = T_('Component: '). $section_name; |
| 143 |
} else { |
} else { |
| 144 |
$table = $section; |
$table = $section; |
| 145 |
$where = "\n WHERE c.section='$section'"; |
$where = "\n WHERE c.section='$section'"; |
| 248 |
|
|
| 249 |
// fail if checked out not by 'me' |
// fail if checked out not by 'me' |
| 250 |
if ($row->checked_out && $row->checked_out <> $my->id) { |
if ($row->checked_out && $row->checked_out <> $my->id) { |
| 251 |
mosRedirect( 'index2.php?option=categories§ion='. $row->section, 'The category '. $row->title .' is currently being edited by another administrator' ); |
mosRedirect( 'index2.php?option=categories§ion='. $row->section, sprintf(T_('The category %s is currently being edited by another administrator'), $row->title) ); |
| 252 |
} |
} |
| 253 |
|
|
| 254 |
if ($uid) { |
if ($uid) { |
| 267 |
for( $i = 0; $i < $count; $i++ ) { |
for( $i = 0; $i < $count; $i++ ) { |
| 268 |
switch ( $menus[$i]->type ) { |
switch ( $menus[$i]->type ) { |
| 269 |
case 'content_category': |
case 'content_category': |
| 270 |
$menus[$i]->type = 'Category Table'; |
$menus[$i]->type = T_('Category Table'); |
| 271 |
break; |
break; |
| 272 |
|
|
| 273 |
case 'content_blog_category': |
case 'content_blog_category': |
| 274 |
$menus[$i]->type = 'Category Blog'; |
$menus[$i]->type = T_('Category Blog'); |
| 275 |
break; |
break; |
| 276 |
|
|
| 277 |
case 'content_archive_category': |
case 'content_archive_category': |
| 278 |
$menus[$i]->type = 'Category Blog Archive'; |
$menus[$i]->type = T_('Category Blog Archive'); |
| 279 |
break; |
break; |
| 280 |
} |
} |
| 281 |
} |
} |
| 319 |
} |
} |
| 320 |
|
|
| 321 |
// build the html select list for category types |
// build the html select list for category types |
| 322 |
$types[] = mosHTML::makeOption( '', 'Select Type' ); |
$types[] = mosHTML::makeOption( '', T_('Select Type') ); |
| 323 |
if ($row->section == 'com_contact_details') { |
if ($row->section == 'com_contact_details') { |
| 324 |
$types[] = mosHTML::makeOption( 'contact_category_table', 'Contact Category Table' ); |
$types[] = mosHTML::makeOption( 'contact_category_table', T_('Contact Category Table') ); |
| 325 |
} else |
} else |
| 326 |
if ($row->section == 'com_newsfeeds') { |
if ($row->section == 'com_newsfeeds') { |
| 327 |
$types[] = mosHTML::makeOption( 'newsfeed_category_table', 'Newsfeed Category Table' ); |
$types[] = mosHTML::makeOption( 'newsfeed_category_table', T_('Newsfeed Category Table') ); |
| 328 |
} else |
} else |
| 329 |
if ($row->section == 'com_weblinks') { |
if ($row->section == 'com_weblinks') { |
| 330 |
$types[] = mosHTML::makeOption( 'weblink_category_table', 'Weblink Category Table' ); |
$types[] = mosHTML::makeOption( 'weblink_category_table', T_('Weblink Category Table') ); |
| 331 |
} else { |
} else { |
| 332 |
$types[] = mosHTML::makeOption( 'content_category', 'Content Category Table' ); |
$types[] = mosHTML::makeOption( 'content_category', T_('Content Category Table') ); |
| 333 |
$types[] = mosHTML::makeOption( 'content_blog_category', 'Content Category Blog' ); |
$types[] = mosHTML::makeOption( 'content_blog_category', T_('Content Category Blog') ); |
| 334 |
$types[] = mosHTML::makeOption( 'content_archive_category', 'Content Category Archive Blog' ); |
$types[] = mosHTML::makeOption( 'content_archive_category', T_('Content Category Archive Blog') ); |
| 335 |
} // if |
} // if |
| 336 |
$lists['link_type'] = mosHTML::selectList( $types, 'link_type', 'class="inputbox" size="1"', 'value', 'text' );; |
$lists['link_type'] = mosHTML::selectList( $types, 'link_type', 'class="inputbox" size="1"', 'value', 'text' );; |
| 337 |
|
|
| 444 |
global $database; |
global $database; |
| 445 |
|
|
| 446 |
if (count( $cid ) < 1) { |
if (count( $cid ) < 1) { |
| 447 |
echo "<script> alert('Select a category to delete'); window.history.go(-1);</script>\n"; |
echo "<script> alert('".T_('Select a category to delete')."'); window.history.go(-1);</script>\n"; |
| 448 |
exit; |
exit; |
| 449 |
} |
} |
| 450 |
|
|
| 520 |
} |
} |
| 521 |
|
|
| 522 |
if (count( $cid ) < 1) { |
if (count( $cid ) < 1) { |
| 523 |
$action = $publish ? 'publish' : 'unpublish'; |
$action = $publish ? T_('publish') : T_('unpublish'); |
| 524 |
echo "<script> alert('Select a category to $action'); window.history.go(-1);</script>\n"; |
echo "<script> alert('".sprintf(T_('Select a category to %s'), $action)."'); window.history.go(-1);</script>\n"; |
| 525 |
exit; |
exit; |
| 526 |
} |
} |
| 527 |
|
|
| 582 |
$redirect = mosGetParam( $_POST, 'section', 'content' );; |
$redirect = mosGetParam( $_POST, 'section', 'content' );; |
| 583 |
|
|
| 584 |
if (!is_array( $cid ) || count( $cid ) < 1) { |
if (!is_array( $cid ) || count( $cid ) < 1) { |
| 585 |
echo "<script> alert('Select an item to move'); window.history.go(-1);</script>\n"; |
echo "<script> alert('".T_('Select an item to move')."'); window.history.go(-1);</script>\n"; |
| 586 |
exit; |
exit; |
| 587 |
} |
} |
| 588 |
|
|
| 652 |
$redirect = mosGetParam( $_POST, 'section', 'content' );; |
$redirect = mosGetParam( $_POST, 'section', 'content' );; |
| 653 |
|
|
| 654 |
if (!is_array( $cid ) || count( $cid ) < 1) { |
if (!is_array( $cid ) || count( $cid ) < 1) { |
| 655 |
echo "<script> alert('Select an item to move'); window.history.go(-1);</script>\n"; |
echo "<script> alert('".T_('Select an item to move')."'); window.history.go(-1);</script>\n"; |
| 656 |
exit; |
exit; |
| 657 |
} |
} |
| 658 |
|
|
| 738 |
$sectionNew = new mosSection ( $database ); |
$sectionNew = new mosSection ( $database ); |
| 739 |
$sectionNew->load( $sectionMove ); |
$sectionNew->load( $sectionMove ); |
| 740 |
|
|
| 741 |
$msg = $total .' Categories copied to '. $sectionNew->name; |
$msg = sprintf(Tn_('%d Category copied to %s', '%d Categories copied to %s', $total), $total, $sectionNew->name); |
| 742 |
mosRedirect( 'index2.php?option=com_categories§ion='. $sectionOld .'&mosmsg='. $msg ); |
mosRedirect( 'index2.php?option=com_categories§ion='. $sectionOld .'&mosmsg='. $msg ); |
| 743 |
} |
} |
| 744 |
|
|
| 779 |
switch ( $type ) { |
switch ( $type ) { |
| 780 |
case 'content_category': |
case 'content_category': |
| 781 |
$link = 'index.php?option=com_content&task=category§ionid='. $sectionid .'&id='. $id; |
$link = 'index.php?option=com_content&task=category§ionid='. $sectionid .'&id='. $id; |
| 782 |
$menutype = 'Content Category Table'; |
$menutype = T_('Content Category Table'); |
| 783 |
break; |
break; |
| 784 |
|
|
| 785 |
case 'content_blog_category': |
case 'content_blog_category': |
| 786 |
$link = 'index.php?option=com_content&task=blogcategory&id='. $id; |
$link = 'index.php?option=com_content&task=blogcategory&id='. $id; |
| 787 |
$menutype = 'Content Category Blog'; |
$menutype = T_('Content Category Blog'); |
| 788 |
break; |
break; |
| 789 |
|
|
| 790 |
case 'content_archive_category': |
case 'content_archive_category': |
| 791 |
$link = 'index.php?option=com_content&task=archivecategory&id='. $id; |
$link = 'index.php?option=com_content&task=archivecategory&id='. $id; |
| 792 |
$menutype = 'Content Category Blog Archive'; |
$menutype = T_('Content Category Blog Archive'); |
| 793 |
break; |
break; |
| 794 |
|
|
| 795 |
case 'contact_category_table': |
case 'contact_category_table': |
| 796 |
$link = 'index.php?option=com_contact&catid='. $id; |
$link = 'index.php?option=com_contact&catid='. $id; |
| 797 |
$menutype = 'Contact Category Table'; |
$menutype = T_('Contact Category Table'); |
| 798 |
break; |
break; |
| 799 |
|
|
| 800 |
case 'newsfeed_category_table': |
case 'newsfeed_category_table': |
| 801 |
$link = 'index.php?option=com_newsfeeds&catid='. $id; |
$link = 'index.php?option=com_newsfeeds&catid='. $id; |
| 802 |
$menutype = 'Newsfeed Category Table'; |
$menutype = T_('Newsfeed Category Table'); |
| 803 |
break; |
break; |
| 804 |
|
|
| 805 |
case 'weblink_category_table': |
case 'weblink_category_table': |
| 806 |
$link = 'index.php?option=com_weblinks&catid='. $id; |
$link = 'index.php?option=com_weblinks&catid='. $id; |
| 807 |
$menutype = 'Weblink Category Table'; |
$menutype = T_('Weblink Category Table'); |
| 808 |
break; |
break; |
| 809 |
|
|
| 810 |
default:; |
default:; |
| 830 |
$row->checkin(); |
$row->checkin(); |
| 831 |
$row->updateOrder( "menutype='". $menu ."'" ); |
$row->updateOrder( "menutype='". $menu ."'" ); |
| 832 |
|
|
| 833 |
$msg = $name .' ( '. $menutype .' ) in menu: '. $menu .' successfully created'; |
$msg = sprintf(T_('%s ( %s ) in menu: %s successfully created'),$name, $menutype,$menu); |
| 834 |
mosRedirect( 'index2.php?option=com_categories§ion='. $redirect .'&task=editA&hidemainmenu=1&id='. $id, $msg ); |
mosRedirect( 'index2.php?option=com_categories§ion='. $redirect .'&task=editA&hidemainmenu=1&id='. $id, $msg ); |
| 835 |
} |
} |
| 836 |
|
|
| 837 |
function saveOrder( &$cid, $section ) { |
function saveOrder( &$cid, $section ) { |
| 838 |
global $database; |
global $database; |
|
|
|
|
$total = count( $cid ); |
|
| 839 |
$order = mosGetParam( $_POST, 'order', array(0) ); |
$order = mosGetParam( $_POST, 'order', array(0) ); |
| 840 |
$row = new mosCategory( $database ); |
$row = new mosCategory( $database ); |
| 841 |
$conditions = array(); |
$sections = array(); |
|
|
|
| 842 |
// update ordering values |
// update ordering values |
| 843 |
for( $i=0; $i < $total; $i++ ) { |
foreach ($cid as $i=>$ciditem) { |
| 844 |
$row->load( $cid[$i] ); |
$row->load( $ciditem ); |
| 845 |
if ($row->ordering != $order[$i]) { |
if ($row->ordering != $order[$i]) { |
| 846 |
$row->ordering = $order[$i]; |
$row->ordering = $order[$i]; |
| 847 |
if (!$row->store()) { |
if (!$row->store()) { |
| 848 |
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; |
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; |
| 849 |
exit(); |
exit(); |
| 850 |
} // if |
} |
| 851 |
// remember to updateOrder this group |
// remember to updateOrder this group |
| 852 |
$condition = "section='$row->section'"; |
$sections[$row->section] = $row->id; |
| 853 |
$found = false; |
} |
| 854 |
foreach ( $conditions as $cond ) |
} |
|
if ($cond[1]==$condition) { |
|
|
$found = true; |
|
|
break; |
|
|
} // if |
|
|
if (!$found) $conditions[] = array($row->id, $condition); |
|
|
} // if |
|
|
} // for |
|
|
|
|
| 855 |
// execute updateOrder for each group |
// execute updateOrder for each group |
| 856 |
foreach ( $conditions as $cond ) { |
foreach ($sections as $section=>$rowid) { |
| 857 |
$row->load( $cond[0] ); |
$row->updateOrder("section='$section'"); |
|
$row->updateOrder( $cond[1] ); |
|
| 858 |
} // foreach |
} // foreach |
| 859 |
|
$msg = T_('New ordering saved'); |
|
$msg = 'New ordering saved'; |
|
| 860 |
mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); |
mosRedirect( 'index2.php?option=com_categories§ion='. $section, $msg ); |
| 861 |
} // saveOrder |
} // saveOrder |
| 862 |
|
|