diff --git a/src/administrator/components/com_weblinks/models/fields/modal/weblink.php b/src/administrator/components/com_weblinks/models/fields/modal/weblink.php
deleted file mode 100644
index 708ae98..0000000
--- a/src/administrator/components/com_weblinks/models/fields/modal/weblink.php
+++ /dev/null
@@ -1,272 +0,0 @@
-element['new'] == 'true');
- $allowEdit = ((string) $this->element['edit'] == 'true');
- $allowClear = ((string) $this->element['clear'] != 'false');
- $allowSelect = ((string) $this->element['select'] != 'false');
-
- // Load language
- JFactory::getLanguage()->load('com_weblinks', JPATH_ADMINISTRATOR);
-
- // The active weblink id field.
- $value = (int) $this->value > 0 ? (int) $this->value : '';
-
- // Create the modal id.
- $modalId = 'Weblink_' . $this->id;
-
- // Add the modal field script to the document head.
- JHtml::_('jquery.framework');
- JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));
-
- // Script to proxy the select modal function to the modal-fields.js file.
- if ($allowSelect)
- {
- static $scriptSelect = null;
-
- if (is_null($scriptSelect))
- {
- $scriptSelect = array();
- }
-
- if (!isset($scriptSelect[$this->id]))
- {
- JFactory::getDocument()->addScriptDeclaration("
- function jSelectWeblink_" . $this->id . "(id, title, catid, object, url, language) {
- window.processModalSelect('Weblink', '" . $this->id . "', id, title, catid, object, url, language);
- }
- ");
-
- $scriptSelect[$this->id] = true;
- }
- }
-
- // Setup variables for display.
- $linkWeblinks = 'index.php?option=com_weblinks&view=weblinks&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
- $linkWeblink = 'index.php?option=com_weblinks&view=weblink&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
-
- if (isset($this->element['language']))
- {
- $linkWeblinks .= '&forcedLanguage=' . $this->element['language'];
- $linkWeblink .= '&forcedLanguage=' . $this->element['language'];
- $modalTitle = JText::_('COM_WEBLINKS_CHANGE_WEBLINK') . ' — ' . $this->element['label'];
- }
- else
- {
- $modalTitle = JText::_('COM_WEBLINKS_CHANGE_WEBLINK');
- }
-
- $urlSelect = $linkWeblinks . '&function=jSelectWeblink_' . $this->id;
- $urlEdit = $linkWeblink . '&task=weblink.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \'';
- $urlNew = $linkWeblink . '&task=weblink.add';
-
- if ($value)
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->quoteName('title'))
- ->from($db->quoteName('#__weblinks'))
- ->where($db->quoteName('id') . ' = ' . (int) $value);
- $db->setQuery($query);
-
- try
- {
- $title = $db->loadResult();
- }
- catch (RuntimeException $e)
- {
- JError::raiseWarning(500, $e->getMessage());
- }
- }
-
- $title = empty($title) ? JText::_('COM_WEBLINKS_SELECT_AN_WEBLINK') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
-
- // The current weblink display field.
- $html = '';
- $html .= '';
-
- // Select weblink button
- if ($allowSelect)
- {
- $html .= ''
- . ' ' . JText::_('JSELECT')
- . '';
- }
-
- // New weblink button
- if ($allowNew)
- {
- $html .= ''
- . ' ' . JText::_('JACTION_CREATE')
- . '';
- }
-
- // Edit weblink button
- if ($allowEdit)
- {
- $html .= ''
- . ' ' . JText::_('JACTION_EDIT')
- . '';
- }
-
- // Clear weblink button
- if ($allowClear)
- {
- $html .= ''
- . '' . JText::_('JCLEAR')
- . '';
- }
-
- $html .= '';
-
- // Select weblink modal
- if ($allowSelect)
- {
- $html .= JHtml::_(
- 'bootstrap.renderModal',
- 'ModalSelect' . $modalId,
- array(
- 'title' => $modalTitle,
- 'url' => $urlSelect,
- 'height' => '400px',
- 'width' => '800px',
- 'bodyHeight' => '70',
- 'modalWidth' => '80',
- 'footer' => '' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '',
- )
- );
- }
-
- // New weblink modal
- if ($allowNew)
- {
- $html .= JHtml::_(
- 'bootstrap.renderModal',
- 'ModalNew' . $modalId,
- array(
- 'title' => JText::_('COM_WEBLINKS_NEW_WEBLINK'),
- 'backdrop' => 'static',
- 'keyboard' => false,
- 'closeButton' => false,
- 'url' => $urlNew,
- 'height' => '400px',
- 'width' => '800px',
- 'bodyHeight' => '70',
- 'modalWidth' => '80',
- 'footer' => ''
- . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . ''
- . ''
- . JText::_('JSAVE') . ''
- . ''
- . JText::_('JAPPLY') . '',
- )
- );
- }
-
- // Edit weblink modal
- if ($allowEdit)
- {
- $html .= JHtml::_(
- 'bootstrap.renderModal',
- 'ModalEdit' . $modalId,
- array(
- 'title' => JText::_('COM_WEBLINKS_EDIT_WEBLINK'),
- 'backdrop' => 'static',
- 'keyboard' => false,
- 'closeButton' => false,
- 'url' => $urlEdit,
- 'height' => '400px',
- 'width' => '800px',
- 'bodyHeight' => '70',
- 'modalWidth' => '80',
- 'footer' => ''
- . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . ''
- . ''
- . JText::_('JSAVE') . ''
- . ''
- . JText::_('JAPPLY') . '',
- )
- );
- }
-
- // Note: class='required' for client side validation.
- $class = $this->required ? ' class="required modal-value"' : '';
-
- $html .= '';
-
- return $html;
- }
-
- /**
- * Method to get the field label markup.
- *
- * @return string The field label markup.
- *
- * @since __DEPLOY_VERSION__
- */
- protected function getLabel()
- {
- return str_replace($this->id, $this->id . '_id', parent::getLabel());
- }
-}
diff --git a/src/administrator/components/com_weblinks/views/weblink/tmpl/modal.php b/src/administrator/components/com_weblinks/views/weblink/tmpl/modal.php
deleted file mode 100644
index 0542a95..0000000
--- a/src/administrator/components/com_weblinks/views/weblink/tmpl/modal.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'bottom'));
-
-// @deprecated 4.0 the function parameter, the inline js and the buttons are not needed since 3.7.0.
-$function = JFactory::getApplication()->input->getCmd('function', 'jEditWeblink_' . (int) $this->item->id);
-
-// Function to update input title when changed
-JFactory::getDocument()->addScriptDeclaration('
- function jEditWeblinkModal() {
- if (window.parent && document.formvalidator.isValid(document.getElementById("item-form"))) {
- return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value);
- }
- }
-');
-?>
-
-
-
-
-
diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php
deleted file mode 100644
index 87b71e7..0000000
--- a/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php
+++ /dev/null
@@ -1,163 +0,0 @@
-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";
-}
-?>
-
diff --git a/src/administrator/components/com_weblinks/weblinks.xml b/src/administrator/components/com_weblinks/weblinks.xml
index af18a97..524d131 100644
--- a/src/administrator/components/com_weblinks/weblinks.xml
+++ b/src/administrator/components/com_weblinks/weblinks.xml
@@ -33,9 +33,6 @@
-
- js
-
##FRONTEND_COMPONENT_FILES##
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 10b1fce..bbc0da1 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
@@ -22,10 +22,4 @@ COM_WEBLINKS_LINKS="Links"
COM_WEBLINKS_TAGS_WEBLINK="Web Link"
COM_WEBLINKS_TAGS_CATEGORY="Web Link Category"
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management."
-; menu item
-COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_DESC="Display a single weblink"
-COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_TITLE="Single Weblink"
-COM_WEBLINKS_FIELD_SELECT_WEBLINK_DESC="Select the desired weblink from the list."
-COM_WEBLINKS_FIELD_SELECT_WEBLINK_LABEL="Select Weblink"
-COM_WEBLINKS_CHANGE_WEBLINK="Select or Change weblink"
-COM_WEBLINKS_SELECT_AN_WEBLINK="Select Weblink"
+
diff --git a/src/components/com_weblinks/views/weblink/tmpl/default.php b/src/components/com_weblinks/views/weblink/tmpl/default.php
deleted file mode 100644
index 0fafd5f..0000000
--- a/src/components/com_weblinks/views/weblink/tmpl/default.php
+++ /dev/null
@@ -1,38 +0,0 @@
-item->params;
-
-?>
-
-
-
-
-
- item->event->afterDisplayTitle; ?>
-
-
- item->event->beforeDisplayContent; ?>
-
-
-
-
- item->event->afterDisplayContent; ?>
-
diff --git a/src/components/com_weblinks/views/weblink/tmpl/default.xml b/src/components/com_weblinks/views/weblink/tmpl/default.xml
deleted file mode 100644
index cbb8586..0000000
--- a/src/components/com_weblinks/views/weblink/tmpl/default.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/com_weblinks/views/weblink/view.html.php b/src/components/com_weblinks/views/weblink/view.html.php
index c43fb0e..ea1d1fd 100644
--- a/src/components/com_weblinks/views/weblink/view.html.php
+++ b/src/components/com_weblinks/views/weblink/view.html.php
@@ -1,7 +1,7 @@
get('Item');
- $this->item = $this->get('Item');
- $this->state = $this->get('State');
- $this->params = $this->state->get('params');
+ if ($this->getLayout() == 'edit')
+ {
+ $this->_displayEdit($tpl);
- // Create a shortcut for $item.
- $item = $this->item;
+ return;
+ }
- $offset = $this->state->get('list.offset');
-
- $dispatcher->trigger('onWeblinksPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset));
-
- $item->event = new stdClass;
-
- $results = $dispatcher->trigger('onWeblinksAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
- $item->event->afterDisplayTitle = trim(implode("\n", $results));
-
- $results = $dispatcher->trigger('onWeblinksBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
- $item->event->beforeDisplayContent = trim(implode("\n", $results));
-
- $results = $dispatcher->trigger('onWeblinksAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
- $item->event->afterDisplayContent = trim(implode("\n", $results));
-
- parent::display($tpl);
+ if ($item->url)
+ {
+ // Redirects to url if matching id found
+ JFactory::getApplication()->redirect($item->url);
+ }
+ else
+ {
+ // @TODO create proper error handling
+ JFactory::getApplication()->redirect(JRoute::_('index.php'), JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 'notice');
+ }
}
}
diff --git a/src/media/js/admin-weblinks-modal.js b/src/media/js/admin-weblinks-modal.js
deleted file mode 100644
index 76ce4ca..0000000
--- a/src/media/js/admin-weblinks-modal.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-(function() {
- "use strict";
- /**
- * Javascript to insert the link
- * View element calls jSelectWeblink when an weblink is clicked
- * jSelectWeblink creates the link tag, sends it to the editor,
- * and closes the select frame.
- **/
- window.jSelectWeblink = function (id, title, catid, object, link, lang) {
- var hreflang = '', editor, tag;
-
- if (!Joomla.getOptions('xtd-weblinks')) {
- // Something went wrong!
- window.parent.jModalClose();
- return false;
- }
-
- editor = Joomla.getOptions('xtd-weblinks').editor;
-
- if (lang !== '')
- {
- hreflang = ' hreflang="' + lang + '"';
- }
-
- tag = '' + title + '';
-
- /** Use the API, if editor supports it **/
- if (window.Joomla && window.Joomla.editors && Joomla.editors.instances && Joomla.editors.instances.hasOwnProperty(editor)) {
- Joomla.editors.instances[editor].replaceSelection(tag)
- } else {
- window.parent.jInsertEditorText(tag, editor);
- }
-
- window.parent.jModalClose();
- };
-
- document.addEventListener('DOMContentLoaded', function(){
- // Get the elements
- var elements = document.querySelectorAll('.select-link');
-
- for(var i = 0, l = elements.length; l>i; i++) {
- // Listen for click event
- elements[i].addEventListener('click', function (event) {
- event.preventDefault();
- var functionName = event.target.getAttribute('data-function');
-
- if (functionName === 'jSelectWeblink') {
- // Used in xtd_contacts
- window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language'));
- } else {
- // Used in com_menus
- window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language'));
- }
- })
- }
- });
-})();