Added basic version of main menu that will allow to edit, add and remove
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<form id="acp_portal_links" method="post" action="{U_ACTION}">
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_ACP_PORTAL_LINKS}</legend>
|
||||
<legend>{L_ACP_PORTAL_MENU_LINK}</legend>
|
||||
<dl>
|
||||
<dt><label for="link_title">{L_LINK_TITLE}:</label></dt>
|
||||
<dd><input name="link_title" type="text" id="link_title" value="{LINK_TITLE}" maxlength="255" /></dd>
|
||||
@@ -30,7 +30,7 @@
|
||||
<!-- IF S_LINK_IS_CAT --><div id="url" style="display: none;"><!-- ELSE --><div id="url"><!-- ENDIF -->
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="link_tpye">{L_ACP_PORTAL_MENU_TYPE}:</label><br />
|
||||
<label for="link_type">{L_ACP_PORTAL_MENU_TYPE}:</label><br />
|
||||
<span>{L_ACP_PORTAL_MENU_TYPE_EXP}</span>
|
||||
</dt>
|
||||
<dd>
|
||||
@@ -39,11 +39,36 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="link_url">{L_LINK_URL}:</label></dt>
|
||||
<dt>
|
||||
<label for="link_url">{L_ACP_PORTAL_MENU_URL}:</label><br />
|
||||
<span>{L_ACP_PORTAL_MENU_URL_EXP}</span>
|
||||
</dt>
|
||||
<dd><input name="link_url" type="text" id="link_url" value="{LINK_URL}" maxlength="255" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{L_ACP_PORTAL_MENU_INT_OPTIONS}</legend>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="link_query1">{L_ACP_PORTAL_MENU_QUERY1}:</label><br />
|
||||
<span>{L_ACP_PORTAL_MENU_QUERY1_EXP}</span>
|
||||
</dt>
|
||||
<dd><input name="link_query1" type="text" id="link_query1" value="{LINK_QUERY1}" maxlength="255" /></dd><br />
|
||||
<dt>
|
||||
<label for="link_query2">{L_ACP_PORTAL_MENU_QUERY2}:</label><br />
|
||||
<span>{L_ACP_PORTAL_MENU_QUERY2_EXP}</span>
|
||||
</dt>
|
||||
<dd><input name="link_query2" type="text" id="link_query2" value="{LINK_QUERY2}" maxlength="255" /></dd><br />
|
||||
<dt>
|
||||
<label for="link_query3">{L_ACP_PORTAL_MENU_QUERY3}:</label><br />
|
||||
<span>{L_ACP_PORTAL_MENU_QUERY3_EXP}</span>
|
||||
</dt>
|
||||
<dd><input name="link_query3" type="text" id="link_query3" value="{LINK_QUERY3}" maxlength="255" /></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{L_ACP_SUBMIT_CHANGES}</legend>
|
||||
<p class="submit-buttons">
|
||||
<input type="hidden" name="action" value="save" />
|
||||
|
||||
|
||||
@@ -49,10 +49,19 @@ $lang = array_merge($lang, array(
|
||||
'ACP_PORTAL_MENU_INT' => 'Internal link',
|
||||
'ACP_PORTAL_MENU_EXT' => 'External link',
|
||||
'ACP_PORTAL_MENU_TITLE' => 'Title',
|
||||
'ACP_PORTAL_MENU_URL' => 'URL',
|
||||
'ACP_PORTAL_MENU_URL' => 'Link URL',
|
||||
'ACP_PORTAL_MENU_TYPE' => 'Link type',
|
||||
'ACP_PORTAL_MENU_TYPE_EXP' => 'If you have a link to a page of your board, choose "Internal link" in order to prevent unwanted logouts.',
|
||||
'ACP_PORTAL_MENU_CREATE_CAT' => 'You need to create a category first.',
|
||||
'ACP_PORTAL_MENU_URL_EXP' => 'External links:<br />All links should be entered with a http://<br /><br />Internal links:<br />Only enter the php file as link url, i.e. index.php.<br />If you would like to add a query string, then define the values below.<br />If your link is index.php?style=4, then enter index.php as link url and style=4 in the textfield for the first post variable.',
|
||||
'ACP_PORTAL_MENU_QUERY1' => 'First post variable',
|
||||
'ACP_PORTAL_MENU_QUERY1_EXP' => 'Enter the first post variable. Example: style=4',
|
||||
'ACP_PORTAL_MENU_QUERY2' => 'Second post variable',
|
||||
'ACP_PORTAL_MENU_QUERY2_EXP' => 'Enter the second post variable. Example: style=4',
|
||||
'ACP_PORTAL_MENU_QUERY3' => 'Third post variable',
|
||||
'ACP_PORTAL_MENU_QUERY3_EXP' => 'Enter the third post variable. Example: style=4',
|
||||
'ACP_PORTAL_MENU_LINK' => 'Link settings',
|
||||
'ACP_PORTAL_MENU_INT_OPTIONS' => 'Internal links options',
|
||||
));
|
||||
|
||||
?>
|
||||
@@ -79,7 +79,8 @@ class portal_main_menu_module
|
||||
{
|
||||
if($links_options[$i] == B3_LINKS_INT)
|
||||
{
|
||||
$cur_url = append_sid($phpbb_root_path . $links_urls[$i]);
|
||||
$links_urls[$i] = str_replace('&', '&', $links_urls[$i]); // we need to do this in order to prevent XHTML validation errors
|
||||
$cur_url = append_sid($phpbb_root_path . $links_urls[$i]); // the user should know what kind of file it is
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,6 +180,41 @@ class portal_main_menu_module
|
||||
$link_type = (!$link_is_cat) ? request_var('link_type', 0) : B3_LINKS_CAT;
|
||||
$link_url = ($link_is_cat) ? ' ' : request_var('link_url', ' ');
|
||||
|
||||
if($link_type == B3_LINKS_INT)
|
||||
{
|
||||
$link_query1 = utf8_normalize_nfc(request_var('link_query1', ''));
|
||||
$link_query2 = utf8_normalize_nfc(request_var('link_query2', ''));
|
||||
$link_query3 = utf8_normalize_nfc(request_var('link_query3', ''));
|
||||
$link_query_string = '';
|
||||
|
||||
if($link_query1 != '')
|
||||
{
|
||||
$link_query_string .= '?' . $link_query1;
|
||||
if($link_query2 != '')
|
||||
{
|
||||
$link_query_string .= '&' . $link_query2;
|
||||
}
|
||||
if($link_query3)
|
||||
{
|
||||
$link_query_string .= '&' . $link_query3;
|
||||
}
|
||||
}
|
||||
elseif($link_query2 != '')
|
||||
{
|
||||
$link_query_string .= '?' . $link_query2;
|
||||
if($link_query3)
|
||||
{
|
||||
$link_query_string .= '&' . $link_query3;
|
||||
}
|
||||
}
|
||||
elseif($link_query3)
|
||||
{
|
||||
$link_query_string .= '&' . $link_query3;
|
||||
}
|
||||
|
||||
$link_url .= $link_query_string;
|
||||
}
|
||||
|
||||
if (!$link_title)
|
||||
{
|
||||
trigger_error($user->lang['NO_LINK_TITLE'] . adm_back_link($u_action), E_USER_WARNING);
|
||||
@@ -189,6 +225,7 @@ class portal_main_menu_module
|
||||
trigger_error($user->lang['NO_LINK_URL'] . adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
// overwrite already existing links and make sure we don't try to save a link outside of the normal array size of $links_urls
|
||||
if (isset($link_id) && $link_id < sizeof($links_urls))
|
||||
{
|
||||
$message = $user->lang['LINK_UPDATED'];
|
||||
|
||||
Reference in New Issue
Block a user