Skip to content

Commit

Permalink
Using the new modal_menu field in various core places
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Aug 20, 2016
1 parent 1f48268 commit e7a5d56
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 14 deletions.
42 changes: 38 additions & 4 deletions administrator/components/com_menus/models/fields/modal/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,25 @@ protected function getInput()
{
$scriptClear = true;

if (isset($this->element['language']))
{
$clearField = htmlspecialchars(JText::_('COM_MENUS_SELECT_A_MENUITEM', true), ENT_COMPAT, 'UTF-8');
}
else
{
if ((string) $this->element->option['value'] == '')
{
$clearField = htmlspecialchars(JText::_($this->element->option, true), ENT_COMPAT, 'UTF-8');
}
else
{
$clearField = htmlspecialchars(JText::_('JDEFAULT', true), ENT_COMPAT, 'UTF-8');
}
}

$script[] = ' function jClearMenu(id) {';
$script[] = ' document.getElementById(id + "_id").value = "";';
$script[] = ' document.getElementById(id + "_name").value = "' .
htmlspecialchars(JText::_('COM_MENUS_SELECT_A_MENUITEM', true), ENT_COMPAT, 'UTF-8') . '";';
$script[] = ' document.getElementById(id + "_name").value = "' . $clearField . '";';
$script[] = ' jQuery("#"+id + "_clear").addClass("hidden");';
$script[] = ' if (document.getElementById(id + "_edit")) {';
$script[] = ' jQuery("#"+id + "_edit").addClass("hidden");';
Expand All @@ -116,6 +131,11 @@ protected function getInput()
{
$linkItems .= '&forcedLanguage=' . $this->element['language'];
$linkItem .= '&forcedLanguage=' . $this->element['language'];
$modalTitle = JText::_('COM_MENUS_CHANGE_MENUITEM') . ' (' . $this->element['label'] . ')';
}
else
{
$modalTitle = JText::_('COM_MENUS_CHANGE_MENUITEM');
}

$urlSelect = $linkItems . '&' . JSession::getFormToken() . '=1';
Expand Down Expand Up @@ -143,7 +163,21 @@ protected function getInput()

if (empty($title))
{
$title = JText::_('COM_MENUS_SELECT_A_MENUITEM');
if (isset($this->element['language']))
{
$title = JText::_('COM_MENUS_SELECT_A_MENUITEM', true);
}
else
{
if ((string) $this->element->option['value'] == '')
{
$title = JText::_($this->element->option, true);
}
else
{
$title = JText::_('JDEFAULT');
}
}
}

$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
Expand Down Expand Up @@ -194,7 +228,7 @@ protected function getInput()
'bootstrap.renderModal',
'menuSelect' . $this->id . 'Modal',
array(
'title' => JText::_('COM_MENUS_CHANGE_MENUITEM'),
'title' => $modalTitle,
'url' => $urlSelect,
'height' => '400px',
'width' => '800px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
<fields name="params">

<fieldset name="aliasoptions">
<field name="aliasoptions" type="menuitem"
<field name="aliasoptions" type="modal_menu"
description="COM_MENUS_ITEM_FIELD_ALIAS_MENU_DESC"
label="COM_MENUS_ITEM_FIELD_ALIAS_MENU_LABEL"
required="true" />
required="true"
edit="true"
clear="false"
/>
</fieldset>

<fieldset name="menu-options"
Expand Down
8 changes: 6 additions & 2 deletions components/com_users/views/login/tmpl/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@

<field
name="login_redirect_menuitem"
type="menuitem"
type="modal_menu"
disable="separator,alias,heading,url"
label="COM_USERS_FIELD_LOGIN_REDIRECTMENU_LABEL"
description="COM_USERS_FIELD_LOGIN_REDIRECTMENU_DESC"
showon="loginredirectchoice:1"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
Expand Down Expand Up @@ -111,11 +113,13 @@

<field
name="logout_redirect_menuitem"
type="menuitem"
type="modal_menu"
disable="separator,alias,heading,url"
label="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_LABEL"
description="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_DESC"
showon="logoutredirectchoice:1"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
Expand Down
4 changes: 3 additions & 1 deletion components/com_users/views/login/tmpl/logout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
<fieldset name="basic" label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="logout"
type="menuitem"
type="modal_menu"
disable="separator,alias,heading,url"
label="JFIELD_LOGOUT_REDIRECT_PAGE_LABEL"
description="JFIELD_LOGOUT_REDIRECT_PAGE_DESC"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
Expand Down
12 changes: 9 additions & 3 deletions modules/mod_login/mod_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_LOGIN" />
<config>
<fields name="params">
<fieldset name="basic">
<fieldset name="basic"
addfieldpath="/administrator/components/com_menus/models/fields">
>
<field
name="pretext"
type="textarea"
Expand All @@ -44,20 +46,24 @@

<field
name="login"
type="menuitem"
type="modal_menu"
label="MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_LABEL"
description="MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_DESC"
disable="separator,alias,heading,url"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>

<field
name="logout"
type="menuitem"
type="modal_menu"
label="MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_LABEL"
description="MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_DESC"
disable="separator,alias,heading,url"
edit="true"
clear="true"
>
<option value="">JDEFAULT</option>
</field>
Expand Down
8 changes: 6 additions & 2 deletions modules/mod_menu/mod_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_MENU" />
<config>
<fields name="params">
<fieldset name="basic">
<fieldset name="basic"
addfieldpath="/administrator/components/com_menus/models/fields">
>
<field
name="menutype"
type="menu"
Expand All @@ -31,9 +33,11 @@

<field
name="base"
type="menuitem"
type="modal_menu"
label="MOD_MENU_FIELD_ACTIVE_LABEL"
description="MOD_MENU_FIELD_ACTIVE_DESC"
edit="true"
clear="true"
>
<option value="">JCURRENT</option>
</field>
Expand Down

0 comments on commit e7a5d56

Please sign in to comment.