Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.7.0: Using the new modal_menu field in various core places #11694

Merged
merged 4 commits into from
Aug 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 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,24 @@ protected function getInput()
{
$scriptClear = true;

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

$clearField = htmlspecialchars($clearField, ENT_QUOTES, '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 +130,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 +162,18 @@ 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);
}
elseif ((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 +224,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