+
diff --git a/src/administrator/components/com_weblinks/views/weblink/view.html.php b/src/administrator/components/com_weblinks/views/weblink/view.html.php
index ec21d41..e670e92 100644
--- a/src/administrator/components/com_weblinks/views/weblink/view.html.php
+++ b/src/administrator/components/com_weblinks/views/weblink/view.html.php
@@ -42,6 +42,20 @@ class WeblinksViewWeblink extends JViewLegacy
return false;
}
+
+ // If we are forcing a language in modal (used for associations).
+ if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd'))
+ {
+ // Set the language field to the forcedLanguage and disable changing it.
+ $this->form->setValue('language', null, $forcedLanguage);
+ $this->form->setFieldAttribute('language', 'readonly', 'true');
+
+ // Only allow to select categories with All language or with the forced language.
+ $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage);
+
+ // Only allow to select tags with All language or with the forced language.
+ $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
+ }
$this->addToolbar();
diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php
index 27682cb..75fee92 100644
--- a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php
+++ b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php
@@ -21,6 +21,7 @@ $listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
$saveOrder = $listOrder == 'a.ordering';
+$assoc = JLanguageAssociations::isEnabled();
if ($saveOrder)
{
@@ -65,6 +66,11 @@ if ($saveOrder)
+
+
+
+
+
@@ -98,7 +104,7 @@ if ($saveOrder)
-
+
@@ -141,7 +147,14 @@ if ($saveOrder)
hits; ?>
-
+
+
+ association) : ?>
+ id); ?>
+
+
+
+
diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php
new file mode 100644
index 0000000..34893af
--- /dev/null
+++ b/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php
@@ -0,0 +1,141 @@
+isClient('site'))
+{
+ JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
+}
+JLoader::register('WeblinksHelperRoute', JPATH_ROOT . '/components/com_weblinks/helpers/route.php');
+
+// Include the component HTML helpers.
+
+JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
+JHtml::_('behavior.core');
+JHtml::_('behavior.polyfill', array('event'), 'lt IE 9');
+JHtml::_('script', 'com_weblinks/admin-weblinks-modal.js', array('version' => 'auto', 'relative' => true));
+JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
+JHtml::_('formbehavior.chosen', 'select');
+
+// Special case for the search field tooltip.
+$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter');
+JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom'));
+$function = $app->input->getCmd('function', 'jSelectWeblink');
+$editor = $app->input->getCmd('editor', '');
+$listOrder = $this->escape($this->state->get('list.ordering'));
+$listDirn = $this->escape($this->state->get('list.direction'));
+$onclick = $this->escape($function);
+if (!empty($editor))
+{
+ // This view is used also in com_menus. Load the xtd script only if the editor is set!
+ JFactory::getDocument()->addScriptOptions('xtd-weblinks', array('editor' => $editor));
+ $onclick = "jSelectWeblink";
+}
+$iconStates = array(
+ -2 => 'icon-trash',
+ 0 => 'icon-unpublish',
+ 1 => 'icon-publish',
+ 2 => 'icon-archive',
+);
+?>
+
+
+
+
diff --git a/src/administrator/components/com_weblinks/views/weblinks/view.html.php b/src/administrator/components/com_weblinks/views/weblinks/view.html.php
index a722a91..cc37c83 100644
--- a/src/administrator/components/com_weblinks/views/weblinks/view.html.php
+++ b/src/administrator/components/com_weblinks/views/weblinks/view.html.php
@@ -37,7 +37,11 @@ class WeblinksViewWeblinks extends JViewLegacy
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
- WeblinksHelper::addSubmenu('weblinks');
+ // Modal layout doesn't need the submenu.
+ if ($this->getLayout() !== 'modal')
+ {
+ WeblinksHelper::addSubmenu('weblinks');
+ }
// Check for errors.
if (count($errors = $this->get('Errors')))
@@ -46,8 +50,30 @@ class WeblinksViewWeblinks extends JViewLegacy
return false;
}
- $this->addToolbar();
- $this->sidebar = JHtmlSidebar::render();
+ // We don't need toolbar in the modal layout.
+ if ($this->getLayout() !== 'modal')
+ {
+ $this->addToolbar();
+ $this->sidebar = JHtmlSidebar::render();
+ }
+ else
+ {
+ // In article associations modal we need to remove language filter if forcing a language.
+ // We also need to change the category filter to show show categories with All or the forced language.
+ if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD'))
+ {
+ // If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
+ $languageXml = new SimpleXMLElement('');
+ $this->filterForm->setField($languageXml, 'filter', true);
+
+ // Also, unset the active language filter so the search tools is not open by default with this filter.
+ unset($this->activeFilters['language']);
+
+ // One last changes needed is to change the category filter to just show categories with All language or with the forced language.
+ $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter');
+ }
+ }
+
parent::display($tpl);
}
diff --git a/src/administrator/language/en-GB/en-GB.com_weblinks.ini b/src/administrator/language/en-GB/en-GB.com_weblinks.ini
index 1ceff68..63195ff 100644
--- a/src/administrator/language/en-GB/en-GB.com_weblinks.ini
+++ b/src/administrator/language/en-GB/en-GB.com_weblinks.ini
@@ -9,6 +9,7 @@ COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links"
COM_WEBLINKS_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved links. Otherwise, all actions are applied to the selected links."
COM_WEBLINKS_CATEGORIES_DESC="These settings apply for Web Links Categories Options unless they are changed for a specific menu item."
COM_WEBLINKS_CATEGORY_DESC="These settings apply for Web Links Category Options unless they are changed for a specific menu item."
+COM_WEBLINKS_CHANGE_WEBLINK="Select or Change Web link"
COM_WEBLINKS_COMPONENT_DESC="These settings apply for Web Links unless they are changed for a specific menu item or web link."
COM_WEBLINKS_COMPONENT_LABEL="Web Link"
COM_WEBLINKS_CONFIG_INTEGRATION_SETTINGS_DESC="These settings determine how the Web Links Component will integrate with other extensions."
@@ -86,6 +87,7 @@ COM_WEBLINKS_FILTER_SEARCH_LABEL="Search Web Links"
COM_WEBLINKS_FILTER_STATE="Filter State"
COM_WEBLINKS_FLOAT_DESC="Controls placement of the image."
COM_WEBLINKS_FLOAT_LABEL="Image Float"
+COM_WEBLINKS_HEADING_ASSOCIATION="Association"
COM_WEBLINKS_HITS_DESC="Number of hits for this web link."
COM_WEBLINKS_LEFT="Left"
COM_WEBLINKS_LIST_LAYOUT_DESC="These settings apply for Web Links List Layout Options unless they are changed for a specific menu item."
@@ -116,9 +118,11 @@ COM_WEBLINKS_ORDER_HEADING="Order"
COM_WEBLINKS_RIGHT="Right"
COM_WEBLINKS_SAVE_SUCCESS="Web link successfully saved"
COM_WEBLINKS_SEARCH_IN_TITLE="Search in title"
+COM_WEBLINKS_SELECT_A_WEBLINK="Select Weblink"
COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC="If Show, empty categories will display. A category is only empty - if it has no Web links or subcategories."
COM_WEBLINKS_SUBMENU_CATEGORIES="Categories"
COM_WEBLINKS_SUBMENU_WEBLINKS="Web Links"
+COM_WEBLINKS_WEBLINKS="Web Links"
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management"
JGLOBAL_NO_ITEM_SELECTED="No web links selected"
JGLOBAL_NEWITEMSLAST_DESC="New Web links default to the last position. Ordering can be changed after this Web link is saved."
diff --git a/src/administrator/language/en-GB/en-GB.com_weblinks.sys.ini b/src/administrator/language/en-GB/en-GB.com_weblinks.sys.ini
index bbc0da1..7375e2e 100644
--- a/src/administrator/language/en-GB/en-GB.com_weblinks.sys.ini
+++ b/src/administrator/language/en-GB/en-GB.com_weblinks.sys.ini
@@ -15,11 +15,15 @@ COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_OPTION="Default"
COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE="List Web Links in a Category"
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
+COM_WEBLINKS_FIELD_SELECT_WEBLINK_DESC="Select the desired Web link from the list."
+COM_WEBLINKS_FIELD_SELECT_WEBLINK_LABEL="Select Weblink"
COM_WEBLINKS_FORM_VIEW_DEFAULT_DESC="Display a form to submit a web link in the Frontend."
COM_WEBLINKS_FORM_VIEW_DEFAULT_OPTION="Default"
COM_WEBLINKS_FORM_VIEW_DEFAULT_TITLE="Submit a Web Link"
COM_WEBLINKS_LINKS="Links"
COM_WEBLINKS_TAGS_WEBLINK="Web Link"
COM_WEBLINKS_TAGS_CATEGORY="Web Link Category"
+COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_DESC="Display a single Web link"
+COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_TITLE="Single Weblink"
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management."
diff --git a/src/components/com_weblinks/controller.php b/src/components/com_weblinks/controller.php
index 860ab38..7516e40 100644
--- a/src/components/com_weblinks/controller.php
+++ b/src/components/com_weblinks/controller.php
@@ -1,7 +1,7 @@
get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
+ if ($view === 'weblink')
+ {
+ if ($id)
+ {
+ $associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $id);
+
+ $return = array();
+
+ foreach ($associations as $tag => $item)
+ {
+ $return[$tag] = WeblinksHelperRoute::getWeblinkRoute($item->id, (int) $item->catid, $item->language);
+ }
+
+ return $return;
+ }
+ }
+
if ($view == 'category' || $view == 'categories')
{
return self::getCategoryAssociations($id, 'com_weblinks');
diff --git a/src/components/com_weblinks/helpers/category.php b/src/components/com_weblinks/helpers/category.php
index 3928ea4..e2a27e4 100644
--- a/src/components/com_weblinks/helpers/category.php
+++ b/src/components/com_weblinks/helpers/category.php
@@ -1,7 +1,7 @@
item->url);
+
+?>
+