|
@@ -32,6 +32,7 @@ include('../inc/global.inc.php');
|
|
|
|
|
|
$this_section=SECTION_PLATFORM_ADMIN;
|
|
|
$_SESSION['this_section']=$this_section;
|
|
|
+$this_page = '';
|
|
|
|
|
|
api_protect_admin_script();
|
|
|
require_once(api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php');
|
|
@@ -63,6 +64,12 @@ if(!empty($action)){
|
|
|
case "edit_link":
|
|
|
$tool_name=get_lang("EditLink");
|
|
|
break;
|
|
|
+ case "insert_tabs":
|
|
|
+ $tool_name=get_lang("InsertTabs");
|
|
|
+ break;
|
|
|
+ case "edit_tabs":
|
|
|
+ $tool_name=get_lang("EditTabs");
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -288,6 +295,8 @@ if(!empty($action)) {
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+ case 'insert_tabs':
|
|
|
+ case 'edit_tabs':
|
|
|
case 'insert_link':
|
|
|
case 'edit_link':
|
|
|
$link_index=intval($_POST['link_index']);
|
|
@@ -309,7 +318,7 @@ if(!empty($action)) {
|
|
|
elseif(!empty($link_url) && !strstr($link_url,'://')) {
|
|
|
$link_url='http://'.$link_url;
|
|
|
}
|
|
|
-
|
|
|
+ $menuf = ($action == 'insert_tabs' || $action == 'edit_tabs')? $menutabs : $menuf;
|
|
|
if(!is_writable($homep.$menuf.'_'.$lang.$ext)) {
|
|
|
$errorMsg=get_lang('HomePageFilesNotWritable');
|
|
|
}
|
|
@@ -317,7 +326,7 @@ if(!empty($action)) {
|
|
|
$errorMsg=get_lang('PleaseEnterLinkName');
|
|
|
} else {
|
|
|
// New links are added as new files in the home/ directory
|
|
|
- if($action == 'insert_link' || empty($filename) || strstr($filename,'/') || !strstr($filename,'.html')) {
|
|
|
+ if($action == 'insert_link' || $action == 'insert_tabs' || empty($filename) || strstr($filename,'/') || !strstr($filename,'.html')) {
|
|
|
$filename=replace_dangerous_char($link_name,'strict').'.html';
|
|
|
}
|
|
|
// "home_" prefix for links are renamed to "user_" prefix (to avoid name clash with existing home page files)
|
|
@@ -368,7 +377,7 @@ if(!empty($action)) {
|
|
|
// If the requested action is to create a link, make some room
|
|
|
// for the new link in the home_menu array at the requested place
|
|
|
// and insert the new link there
|
|
|
- if($action == 'insert_link') {
|
|
|
+ if($action == 'insert_link' || $action == 'insert_tabs') {
|
|
|
for($i=sizeof($home_menu);$i;$i--) {
|
|
|
if($i > $insert_where) {
|
|
|
$home_menu[$i]=$home_menu[$i-1];
|
|
@@ -506,6 +515,7 @@ if(!empty($action)) {
|
|
|
case 'insert_link':
|
|
|
// This request is the preparation for the addition of an item in home_menu
|
|
|
$home_menu = '';
|
|
|
+ $menuf = ($action == 'edit_tabs')? $menutabs : $menuf;
|
|
|
if(is_file($homep.$menuf.'_'.$lang.$ext)
|
|
|
&& is_readable($homep.$menuf.'_'.$lang.$ext))
|
|
|
{
|
|
@@ -521,9 +531,29 @@ if(!empty($action)) {
|
|
|
$errorMsg=get_lang('HomePageFilesNotReadable');
|
|
|
}
|
|
|
break;
|
|
|
+ case 'insert_tabs':
|
|
|
+ // This request is the preparation for the addition of an item in home_menu
|
|
|
+ $home_menu = '';
|
|
|
+ if(is_file($homep.$menutabs.'_'.$lang.$ext)
|
|
|
+ && is_readable($homep.$menutabs.'_'.$lang.$ext))
|
|
|
+ {
|
|
|
+ $home_menu=file($homep.$menutabs.'_'.$lang.$ext);
|
|
|
+ }
|
|
|
+ elseif(is_file($homep.$menutabs.$lang.$ext)
|
|
|
+ && is_readable($homep.$menutabs.$lang.$ext))
|
|
|
+ {
|
|
|
+ $home_menu=file($homep.$menutabs.$lang.$ext);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $errorMsg=get_lang('HomePageFilesNotReadable');
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'edit_tabs':
|
|
|
case 'edit_link':
|
|
|
// This request is the preparation for the edition of the links array
|
|
|
$home_menu = '';
|
|
|
+ $menuf = ($action == 'edit_tabs')? $menutabs : $menuf;
|
|
|
if(is_file($homep.$menuf.'_'.$lang.$ext)
|
|
|
&& is_readable($homep.$menuf.'_'.$lang.$ext))
|
|
|
{
|
|
@@ -641,6 +671,8 @@ switch($action){
|
|
|
</form>
|
|
|
<?php
|
|
|
break;
|
|
|
+ case 'insert_tabs':
|
|
|
+ case 'edit_tabs':
|
|
|
case 'insert_link':
|
|
|
case 'edit_link':
|
|
|
|
|
@@ -656,8 +688,8 @@ switch($action){
|
|
|
$renderer->setRequiredNoteTemplate('');
|
|
|
$form->addElement('header', '', $tool_name);
|
|
|
$form->addElement('hidden', 'formSent', '1');
|
|
|
- $form->addElement('hidden', 'link_index', $action == 'edit_link' ? $link_index : '0');
|
|
|
- $form->addElement('hidden', 'filename', $action == 'edit_link' ? $filename : '');
|
|
|
+ $form->addElement('hidden', 'link_index', ($action == 'edit_link' || $action == 'edit_tabs') ? $link_index : '0');
|
|
|
+ $form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? $filename : '');
|
|
|
|
|
|
$form->addElement('html', '<tr><td nowrap="nowrap" style="width: 15%;">'.get_lang('LinkName').' :</td><td>');
|
|
|
$default['link_name'] = api_htmlentities($link_name, ENT_QUOTES, $charset);
|
|
@@ -669,11 +701,13 @@ switch($action){
|
|
|
$form->addElement('text', 'link_url', get_lang('LinkName'), array('size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;'));
|
|
|
$form->addElement('html', '</td></tr>');
|
|
|
|
|
|
- if($action == 'insert_link') {
|
|
|
+ if($action == 'insert_link' || $action == 'insert_tabs') {
|
|
|
$form->addElement('html', '<tr><td nowrap="nowrap">'.get_lang('InsertThisLink').' :</td>');
|
|
|
$form->addElement('html', '<td><select name="insert_where"><option value="-1">'.get_lang('FirstPlace').'</option>');
|
|
|
- foreach($home_menu as $key=>$enreg) {
|
|
|
- $form->addElement('html', '<option value="'.$key.'" '.($formSent && $insert_where == $key ? 'selected="selected"' : '').' >'.get_lang('After').' "'.trim(strip_tags($enreg)).'"</option>');
|
|
|
+ if(is_array($home_menu)){
|
|
|
+ foreach($home_menu as $key=>$enreg) {
|
|
|
+ $form->addElement('html', '<option value="'.$key.'" '.($formSent && $insert_where == $key ? 'selected="selected"' : '').' >'.get_lang('After').' "'.trim(strip_tags($enreg)).'"</option>');
|
|
|
+ }
|
|
|
}
|
|
|
$form->addElement('html', '</select></td></tr>');
|
|
|
}
|