29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-29 16:43:42 +00:00

Merge branch 'master' of github.com:joomla/joomla-cms into cms11.3b

This commit is contained in:
chdemko 2011-11-26 19:17:07 +01:00
commit 12b96518e8
8 changed files with 52 additions and 26 deletions

View File

@ -43,7 +43,10 @@ class JFormFieldMenuOrdering extends JFormFieldList
// Get the parent
$parent_id = $this->form->getValue('parent_id', 0);
if ( empty($parent_id))
{
return false;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
@ -70,12 +73,18 @@ class JFormFieldMenuOrdering extends JFormFieldList
if ($db->getErrorNum()) {
JError::raiseWarning(500, $db->getErrorMsg());
}
$options = array_merge(
array(array ('value' =>'-1', 'text'=>JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST'))),
$options,
array(array( 'value' =>'-2', 'text'=>JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_LAST')))
);
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
/**
* Method to get the field input markup
*

View File

@ -108,11 +108,9 @@
type="menuordering"
label="COM_MENUS_ITEM_FIELD_ORDERING_LABEL"
description="COM_MENUS_ITEM_FIELD_ORDERING_DESC"
default="-1"
filter="int"
class="inputbox"
size="1">
<option value="-1">COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST</option>
</field>
<field

View File

@ -8,7 +8,7 @@
// No direct access
defined('_JEXEC') or die;
// Include dependancies.
// Include dependencies.
jimport('joomla.application.component.modeladmin');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
@ -1044,29 +1044,43 @@ class MenusModelItem extends JModelAdmin
$table->load($pk);
$isNew = false;
}
if (!$isNew && $table->menutype == $data['menutype']) {
if ($table->parent_id == $data['parent_id'] ) {
// This is a new menu
if ($data['id'] == 0) {
// If first is chosen make the item the first child of the selected parent.
if ($data['menuordering'] == -1) {
$table->setLocation($data['parent_id'], 'first-child');
}
// If last is chosen make it the last child of the selected parent.
elseif ($data['menuordering'] == -2) {
$table->setLocation($data['parent_id'], 'last-child');
}
// Don't try to put an item after itself. All other ones put after the selected item.
elseif ($data['menuordering'] && ($table->id != $data['menuordering']))
{
$table->setLocation($data['menuordering'], 'after');
}
// Just leave it where it is if no change is made.
elseif ( $data['menuordering'] && ($table->id == $data['menuordering']))
{
unset( $data['menuordering']);
}
}
// Set the new parent id if parent id not matched and put in last position
else {
$table->setLocation($data['parent_id'],'last-child');
}
}
// We have a new item, so it is not a change.
elseif ($isNew) {
$table->setLocation($data['parent_id'], 'last-child');
}
// The menu type has changed, set the parent to be the root menu item
elseif ($table->menutype != $data['menutype']) {
// The menu type has changed so we need to just put this at the bottom
// of the root level.
else {
$table->setLocation(1, 'last-child');
}
// Set the new parent id if parent id not matched
elseif ($table->parent_id != $data['parent_id']) {
$table->setLocation($data['parent_id'], 'last-child');
}
// If menuordering is -1 put the item at the beginning
elseif ($data['menuordering'] == -1)
{
$table->setLocation($data['parent_id'], 'first-child');
}
// Don't try to put an item after itself, just leave it where it is.
elseif ($table->id != $data['menuordering'])
{
$table->setLocation($data['menuordering'], 'after');
}
// Bind the data.
if (!$table->bind($data)) {

View File

@ -63,6 +63,7 @@ COM_MENUS_ITEM_FIELD_ORDERING_DESC="The menu item will be placed in the menu aft
COM_MENUS_ITEM_FIELD_ORDERING_LABEL="Ordering"
COM_MENUS_ITEM_FIELD_ORDERING_TEXT="Ordering will be available after saving"
COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST="- First -"
COM_MENUS_ITEM_FIELD_ORDERING_VALUE_LAST="- Last -"
COM_MENUS_ITEM_FIELD_PAGE_CLASS_DESC="Optional CSS class to add to elements in this page. This allows CSS styling specific to this page."
COM_MENUS_ITEM_FIELD_PAGE_CLASS_LABEL="Page Class"
COM_MENUS_ITEM_FIELD_PAGE_HEADING_DESC="Optional alternative text for the Page heading."

View File

@ -27,6 +27,10 @@ $ -> Language fix or change
- -> Removed
! -> Note
26-Nov-2011 Jean-Marie Simonet
# [#27241] *Some search plugins do not query for the created date
# [#27131] Adding 'Last' in menu item ordering. Thanks Elin
23-Nov-2011 Christophe Demko
- [#27228] Remove the prefix check in the installation since it's buggy
$ [#27233] Language String Changes for Consistency

View File

@ -106,7 +106,7 @@ class plgSearchCategories extends JPlugin
$return = array();
if (!empty($state)) {
$query->select('a.title, a.description AS text, "" AS created, "2" AS browsernav, a.id AS catid, '
$query->select('a.title, a.description AS text, a.created_time AS created, "2" AS browsernav, a.id AS catid, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug');
$query->from('#__categories AS a');
$query->where('(a.title LIKE '. $text .' OR a.description LIKE '. $text .') AND a.published IN ('.implode(',',$state).') AND a.extension = \'com_content\''

View File

@ -105,7 +105,7 @@ class plgSearchContacts extends JPlugin
$rows = array();
if (!empty($state)) {
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, a.con_position, a.misc, '
$query->select('a.name AS title, a.created AS created, a.con_position, a.misc, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug, '
.'CONCAT_WS(" / ", '.$db->Quote($section).', c.title) AS section, "2" AS browsernav');

View File

@ -131,7 +131,7 @@ class plgSearchNewsfeeds extends JPlugin
$rows = array();
if (!empty($state)) {
$query = $db->getQuery(true);
$query->select('a.name AS title, "" AS created, a.link AS text, '
$query->select('a.name AS title, a.created AS created, a.link AS text, '
.'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, '
.'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, '
.'CONCAT_WS(" / ", '. $db->Quote($searchNewsfeeds) .', c.title) AS section,'