Added Extra Tab into admin portal DT#5376

skala
Arthur Portugal 15 years ago
parent 846349a7e5
commit c2e8f4f44b
  1. 50
      main/admin/configure_homepage.php
  2. 75
      main/inc/banner.inc.php

@ -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').' &quot;'.trim(strip_tags($enreg)).'&quot;</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').' &quot;'.trim(strip_tags($enreg)).'&quot;</option>');
}
}
$form->addElement('html', '</select></td></tr>');
}

@ -251,6 +251,81 @@ foreach($navigation as $section => $navigation_info) {
}
echo '<li'.$current.'><a href="'.$navigation_info['url'].'" target="_top"><span>'.$navigation_info['title'].'</span></a></li>'."\n";
}
/*********************/
$lang = ''; //el for "Edit Language"
if(!empty($_SESSION['user_language_choice'])) {
$lang=$_SESSION['user_language_choice'];
} elseif(!empty($_SESSION['_user']['language'])) {
$lang=$_SESSION['_user']['language'];
} else {
$lang=get_setting('platformLanguage');
}
if ($_configuration['multiple_access_urls']==true) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$url_info = api_get_access_url($access_url_id);
$url = substr($url_info['url'],7,strlen($url_info['url'])-8);
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/','-',$clean_url);
$clean_url = $clean_url.'/';
$homep = '../../home/'; //homep for Home Path
$homep_new = '../../home/'.$clean_url; //homep for Home Path added the url
$new_url_dir = api_get_path(SYS_PATH).'home/'.$clean_url;
//we create the new dir for the new sites
if (!is_dir($new_url_dir)){
umask(0);
$perm = api_get_setting('permissions_for_new_directories');
$perm = octdec(!empty($perm)?$perm:'0755');
mkdir($new_url_dir, $perm);
}
}
} else {
$homep_new ='';
$vv = explode('/', api_get_self());
if(count($vv) > 2) $homep = '../../home/';
else $homep = 'home/';
}
$ext = '.html';
$menutabs = 'home_tabs';
if(is_file($homep.$menutabs.'_'.$lang.$ext) && is_readable($homep.$menutabs.'_'.$lang.$ext)) {
$home_top=file_get_contents($homep.$menutabs.'_'.$lang.$ext);
} elseif(is_file($homep.$menutabs.$lang.$ext) && is_readable($homep.$menutabs.$lang.$ext)) {
$home_top=file_get_contents($homep.$menutabs.$lang.$ext);
} else {
$errorMsg=get_lang('HomePageFilesNotReadable');
}
if(api_get_self() != '/main/admin/configure_homepage.php') {
if(file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_top_temp=file_get_contents($homep.$menutabs.'_'.$lang.$ext);
} else {
$home_top_temp=file_get_contents($homep.$menutabs.$ext);
}
$open=str_replace('{rel_path}',api_get_path(REL_PATH),$home_top_temp);
echo $open;
} else {
$home_menu = '';
if(file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = file($homep.$menutabs.'_'.$lang.$ext);
} else {
$home_menu = file ($homep.$menutabs.$ext);
}
foreach($home_menu as $key=>$enreg) {
$enreg=trim($enreg);
if(!empty($enreg)) {
$edit_link='<a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$key.'" style="padding-right:0px; padding-left:0px;">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$delete_link='<a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$key.'" style="padding-right:0px;" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=','</li>'),array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=',' '.$edit_link.' '.$delete_link.'</li>'),$enreg);
}
}
echo '<li id="insert-link"> <a href="'.api_get_self().'?action=insert_tabs" style="padding-right:0px;">'. Display::return_icon('insert_row.png', get_lang('InsertLink')).'</a> <a href="'.api_get_self().'?action=insert_tabs">'.get_lang('InsertLink').'</a></li>';
}
/*********************/
//Header about the tabs
if ($_self == 'admin_intro_edition_page')
?>
</ul>
<div style="clear: both;" class="clear"> </div>

Loading…
Cancel
Save