From ce92cd82e6d9f16ddb4eb4b808bdd5a7fed7589e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 28 Apr 2011 13:57:29 +0200 Subject: [PATCH] More cleaning in the main page adding home icon --- index.php | 12 +- main/auth/inscription.php | 15 +-- main/auth/lostPassword.php | 27 ++-- main/css/base.css | 27 +++- main/css/home.png | Bin 0 -> 1517 bytes main/inc/banner.inc.php | 147 ++++++++++++--------- main/inc/header.inc.php | 2 +- main/inc/lib/display.lib.php | 7 +- main/inc/lib/login.lib.php | 7 +- plugin/search/client/www/indexer_login.php | 2 +- whoisonline.php | 18 ++- 11 files changed, 142 insertions(+), 122 deletions(-) create mode 100644 main/css/home.png mode change 100644 => 100755 main/inc/lib/login.lib.php diff --git a/index.php b/index.php index 258a31db14..c00b60eec3 100755 --- a/index.php +++ b/index.php @@ -11,7 +11,7 @@ // Only this script should have this constant defined. This is used to activate the javascript that // gives the login name automatic focus in header.inc.html. /** @todo Couldn't this be done using the $HtmlHeadXtra array? */ -define('DOKEOS_HOMEPAGE', true); +define('CHAMILO_HOMEPAGE', true); $language_file = array('courses', 'index'); @@ -125,12 +125,12 @@ else { } // The header. -$header_title = get_lang('Homepage'); -$sitename = api_get_setting('siteName'); -if (!empty($sitename)) { +/*$header_title = get_lang('Homepage'); +//$sitename = api_get_setting('siteName'); +if (!api_get_user_id()) { $header_title = null; -} -Display::display_header($header_title); +}*/ +Display::display_header(" "); /* MAIN CODE */ diff --git a/main/auth/inscription.php b/main/auth/inscription.php index 21653cab37..28475c87fa 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -11,7 +11,6 @@ if (!empty($_POST['language'])) { //quick hack to adapt the registration form re $_GET['language'] = $_POST['language']; } require_once '../inc/global.inc.php'; - require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; require_once api_get_path(CONFIGURATION_PATH).'profile.conf.php'; @@ -51,9 +50,7 @@ if (api_get_setting('allow_terms_conditions') == 'true') { $tool_name = get_lang('Registration',null,(!empty($_POST['language'])?api_get_valid_language($_POST['language']):$_user['language'])); Display :: display_header($tool_name); -echo '
'; -echo $tool_name; -echo '
'; +echo Display::tag('h1', $tool_name); $home = api_get_path(SYS_PATH).'home/'; if ($_configuration['multiple_access_urls']) { @@ -601,11 +598,13 @@ if ($form->validate()) {
-
+/* +
+*/ +?> + '; -echo $tool_name; -echo '
'; +echo Display::tag('h1', $tool_name); if (isset ($_GET['reset']) && isset ($_GET['id'])) { $msg = Login::reset_password($_GET["reset"], $_GET["id"], true); - $msg1= ''.get_lang('Back').''; + $msg1= ''.get_lang('Back').''; echo '

'.$msg1.'
'; - } else { - $form = new FormValidator('lost_password'); $form->addElement('text', 'user', get_lang('LoginOrEmailAddress'), array('size'=>'40')); - //$form->addElement('text', 'email', get_lang('Email'), array('size'=>'40')); //$form->applyFilter('email','strtolower'); $form->addElement('style_submit_button', 'submit', get_lang('Send'),'class="save"'); // setting the rules - $form->addRule('user', '
'.get_lang('ThisFieldIsRequired'), 'required'); + $form->addRule('user', '
'.get_lang('ThisFieldIsRequired').'
', 'required'); if ($form->validate()) { $values = $form->exportValues(); @@ -84,7 +78,6 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { if ($result && $num_rows > 0) { $by_username = true; -// $user = Database::fetch_array($result); $users = Database::store_result($result); foreach( $users as $user ) { if ($userPasswordCrypted != 'none') { @@ -94,17 +87,15 @@ if (isset ($_GET['reset']) && isset ($_GET['id'])) { } } } else { - Display::display_error_message(get_lang('NoUserAccountWithThisEmailAddress')); + Display::display_error_message(get_lang('NoUserAccountWithThisEmailAddress')); } + //$msg .= ''.get_lang('Back').''; + //echo '

'.$msg.'
'; - $msg .= ''.get_lang('Back').''; - echo '

'.$msg.'
'; - - } else { - echo '

'; + } else { echo get_lang('EnterEmailUserAndWellSendYouPassword'); - echo '

'; + echo '

'; $form->display(); } } -Display :: display_footer(); \ No newline at end of file +Display::display_footer(); \ No newline at end of file diff --git a/main/css/base.css b/main/css/base.css index 105d2c25bf..99d0063c31 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -411,25 +411,30 @@ table.lp_build td.tree { /* Breadcrumb */ - .bread { //border: 1px solid #DEDEDE; height: 25px; margin: 0px; - padding:0px 0px 0px 12px; + padding:0px; } .bread li { color: #777777; float: left; line-height: 25px; - padding-left: 0.75em; + } +.bread span { + display: block; + font-size:11px; + padding: 0 15px 0 9px; +} + + .bread a { display: block; - font-size:11px; - padding: 0 15px 0 10px; + font-size:11px; } .bread a:hover { @@ -437,13 +442,23 @@ table.lp_build td.tree { } .bread li { + display: block; + +} + +.bread li a { background: url("crumbs.gif") no-repeat scroll right center transparent; display: block; - padding: 0 15px 0 0; + background-repeat:no-repeat; background-position:right; } + +.bread .home { + padding:5px 15px 4px 8px; +} + #logo { height:85px; overflow:hidden; diff --git a/main/css/home.png b/main/css/home.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0beab68ff0c6b4161a5c3b7e560b5d2acede6c GIT binary patch literal 1517 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`Jj+tIX_n~5oC^DMQ#CujeSKy zVsdtBi9%9pdS;%jl7fPQl0s&Rtx~wDuYqrYb81GWM^#a3aFt(3a#eP+Wr~u$9hXgo z6;N|-YDuC(MQ%=Bu~mhw64*>DAR8pCucQE0Qj%?}1aWkPZ-9bxeo?A|iJqZuvVpOQ zf{B@)k-3qjxtWeaaAJvqS7M%mk-37AfdP;(vNANZGBE@?1`L$!xPY`xQA(Oskc%7C zP9V=#DWjyMz)D}gyu4hm+*mKaC|%#s($Z4jz)0W7NEfI=x41H|B(Xv_uUHvk2+SOp z)Z*l#%mQ$5fy_-z$}cUkRZ;?31P4&hB^JOf$}5Hj9xxd7D-sLz4fPE4;U)t$+5iQu zz!8yO6q28xV}~WqY(P3u6d`Oy=udS?EJ?KkhKGf&fswAEd5D3Lm9d$XiD?v)euyG8 z?Y{XbnQ4_s+KqLMOhODTtqcsTOpKt~krY9-+vtM=0x4j?p$_sBnz#ai082@RhgU&q zQ4Tm-Qj+ykb5e6t^Gb?=VP=RLW+};5Y57IDi6wTKxryni`UQFEHu?xbyzYaz8kj7A z$xcF^M!N+xx?J=FFv;vyLb#UEQ|U#w;YzrPJeC!_1}YUZ1>^xBYO@ zP8Nn7v)L*W?lKyChlYN*=U){Xx+6w!=H;9Io32SIva|>YSze2J?V}>wICH7aX-*5C z!`JmTue^BpAwzPH7t`&xVO@((yt(_noZ&!?-Fbs--5x`&WgE6%+sAyMYOi0n(}#$) z_kwEe<`>$?CGTXHGZeb$zNcBhN$E>%f1#J4@}enD-}v@?&wMk7`NQ9WV-Yzs58P-h zez&r@p0gx&deD!_2VR!Ux^n%su5$1HrmC;j^-Mdy?fB4gr296o$YtbP0l+XkK DY^cAg literal 0 HcmV?d00001 diff --git a/main/inc/banner.inc.php b/main/inc/banner.inc.php index 6a6d3f3eab..2dec6c0bc1 100755 --- a/main/inc/banner.inc.php +++ b/main/inc/banner.inc.php @@ -4,6 +4,7 @@ /** * This script contains the actual html code to display the "header" * or "banner" on top of every Chamilo page. + * @todo this should be remove we should only use header.inc.php * * @package chamilo.include */ @@ -93,14 +94,14 @@ function show_header_1($language_file, $nameTools) { } elseif (isset($nameTools) && $language_file != 'course_home') { //Put the name of the user-tools in the header if (!isset($_user['user_id'])) { - echo '
'; + //echo '
'; } elseif (!$noPHP_SELF) { echo ''; } else { echo '
'.$nameTools.'
'; } } else { - echo '
'; + //echo '
'; } echo '
'; @@ -123,28 +124,29 @@ function show_header_2($help) { echo '
    '; if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id) OR (api_get_setting('showonline', 'course') == 'true' AND $user_id AND $course_id)) { - $number = who_is_online_count(api_get_setting('time_limit_whosonline')); + $number = who_is_online_count(api_get_setting('time_limit_whosonline')); $number_online_in_course = 0; if(!empty($_course['id'])) { $number_online_in_course = who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']); } echo '
  • '; + // Display the who's online of the platform - if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id)) { - //echo ' '.get_lang('OnLine').' '.$number.''; - echo '
  • '.$number.'
  • '; + if ($number) { + if ((api_get_setting('showonline', 'world') == 'true' AND !$user_id) OR (api_get_setting('showonline', 'users') == 'true' AND $user_id)) { + echo '
  • '.$number.'
  • '; + } } // Display the who's online for the course - if (is_array($_course) AND api_get_setting('showonline', 'course') == 'true' AND isset($_course['sysCode'])) { - //echo '('.$number_online_in_course.' '.get_lang('InThisCourse').')'; - echo '
  • | '.Display::return_icon('course.gif', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array('width'=>'13px')).' '.$number_online_in_course.'
  • '; + if ($number_online_in_course) { + if (is_array($_course) AND api_get_setting('showonline', 'course') == 'true' AND isset($_course['sysCode'])) { + echo '
  • | '.Display::return_icon('course.gif', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array('width'=>'13px')).' '.$number_online_in_course.'
  • '; + } } // Display the who's online for the session - //if (api_get_setting('use_session_mode') == 'true' && isset($user_id) && api_is_coach()) { - if (api_get_setting('use_session_mode') == 'true' && isset($user_id) && api_get_session_id() != 0) { //echo '
  • '.get_lang('UsersConnectedToMySessions').'
  • '; echo '
  • | '.Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array('width'=>'13px')).'
  • '; @@ -170,6 +172,7 @@ function show_header_2($help) { echo ""; } } + if (api_get_setting('accessibility_font_resize') == 'true') { echo '
  • '; echo 'A A A'; @@ -182,31 +185,10 @@ function show_header_2($help) { function show_header_3() { - echo '
    '; - - // Logout - if (api_get_user_id()) { - $login = ''; - if (api_is_anonymous()) { - $login = get_lang('Anonymous'); - } else { - $uinfo = api_get_user_info(api_get_user_id()); - $login = $uinfo['username']; - } - - //start user section line with name, my course, my profile, scorm info, etc - echo ''; - } - - echo '
      '; $navigation = $menu_navigation = array(); $possible_tabs = get_tabs(); - + // Campus Homepage if (api_get_setting('show_tabs', 'campus_homepage') == 'true') { $navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS]; @@ -287,15 +269,8 @@ function show_header_3() { } } } + // Displaying the tabs - foreach ($navigation as $section => $navigation_info) { - if (isset($GLOBALS['this_section'])) { - $current = $section == $GLOBALS['this_section'] ? ' id="current"' : ''; - } else { - $current = ''; - } - echo ''.$navigation_info['title'].''."\n"; - } $lang = ''; //el for "Edit Language" if (!empty($_SESSION['user_language_choice'])) { @@ -316,7 +291,7 @@ function show_header_3() { $clean_url = replace_dangerous_char($url); $clean_url = str_replace('/', '-', $clean_url); $clean_url .= '/'; - $homep = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path + $homep = api_get_path(SYS_PATH).'home/'.$clean_url; //homep for Home Path //we create the new dir for the new sites if (!is_dir($homep)) { mkdir($homep, api_get_permissions_for_new_directories()); @@ -336,14 +311,17 @@ function show_header_3() { } else { $errorMsg = get_lang('HomePageFilesNotReadable'); } - + $home_top = api_to_system_encoding($home_top, api_detect_encoding(strip_tags($home_top))); - if (api_get_self() != '/main/admin/configure_homepage.php') { + if (api_get_self() != '/main/admin/configure_homepage.php') { $open = str_replace('{rel_path}',api_get_path(REL_PATH), $home_top); $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); - echo $open; - } else { + if (!empty($open)) { + $lis .= Display::tag('li', $open); + $show_bar = true; + } + } else { $home_menu = ''; if (file_exists($homep.$menutabs.'_'.$lang.$ext)) { $home_menu = @file($homep.$menutabs.'_'.$lang.$ext); @@ -359,28 +337,70 @@ function show_header_3() { $home_menu = explode("\n", $home_menu); } $tab_counter = 0; + if (!empty($home_menu)) { + $show_bar = true; + } foreach ($home_menu as $enreg) { $enreg = trim($enreg); if (!empty($enreg)) { $edit_link = ''.Display::return_icon('edit.gif', get_lang('Edit')).''; $delete_link = ''.Display::return_icon('delete.gif', get_lang('Delete')).''; - $tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', ''), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.''), $enreg); - echo $tab_string; + $tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', ''), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.''), $enreg); + $lis .= $tab_string; $tab_counter++; } } - echo ''; + $lis .= ''; + } + + if (count($navigation) > 1 || !empty($lis)) { + $pre_lis = ''; + foreach ($navigation as $section => $navigation_info) { + if (isset($GLOBALS['this_section'])) { + $current = $section == $GLOBALS['this_section'] ? ' id="current"' : ''; + } else { + $current = ''; + } + $pre_lis .= ''.$navigation_info['title'].''; + } + $lis = $pre_lis.$lis; + $show_bar = true; + } + + + // Logout + if ($show_bar) { + echo '
      '; + + if (api_get_user_id()) { + $login = ''; + if (api_is_anonymous()) { + $login = get_lang('Anonymous'); + } else { + $uinfo = api_get_user_info(api_get_user_id()); + $login = $uinfo['username']; + } + + //start user section line with name, my course, my profile, scorm info, etc + echo ''; + } + + echo '
        '; + echo $lis; + echo '
      '; + echo '
      '; } - echo '
    '; - echo '
    '; } //Header 4 function show_header_4($interbreadcrumb, $language_file, $nameTools) { $session_id = api_get_session_id(); $session_name = api_get_session_name($session_id); - $_course = api_get_course_info(); - + $_course = api_get_course_info(); /* Plugins for banner section */ $web_course_path = api_get_path(WEB_COURSE_PATH); @@ -457,7 +477,11 @@ function show_header_4($interbreadcrumb, $language_file, $nameTools) { $counter = 0; foreach ($navigation as $index => $navigation_info) { if (!empty($navigation_info['title'])) { - $final_navigation[$index] = ''.$navigation_info['title'].''; + if ($navigation_info['url'] == '#') { + $final_navigation[$index] = ''.$navigation_info['title'].''; + } else { + $final_navigation[$index] = ''.$navigation_info['title'].''; + } $counter++; } } @@ -500,23 +524,22 @@ function show_header_4($interbreadcrumb, $language_file, $nameTools) { //background:none; } #header4 { - height:2.3em; + height:26px; padding:0px; background:none; width: 92%; - } - + } #main { border : 1px solid #ddd; } }'; - echo $style; - + echo $style; if (!empty($final_navigation)) { echo '
    '; $lis = ''; - $i = 0; - foreach($final_navigation as $bread) { + $i = 0; + $lis.= Display::tag('li', Display::url(Display::img(api_get_path(WEB_CSS_PATH).'home.png', get_lang('Homepage'), array('align'=>'middle')), api_get_path(WEB_PATH), array('class'=>'home'))); + foreach ($final_navigation as $bread) { $lis.= Display::tag('li', $bread); $i++; } @@ -553,9 +576,11 @@ function show_header_4($interbreadcrumb, $language_file, $nameTools) { } } + show_header_1($language_file, $nameTools); show_header_2($help); show_header_3(); + show_header_4($interbreadcrumb, $language_file, $nameTools); if (isset($database_connection)) { diff --git a/main/inc/header.inc.php b/main/inc/header.inc.php index b98104873f..2cfe5be7dd 100755 --- a/main/inc/header.inc.php +++ b/main/inc/header.inc.php @@ -181,7 +181,7 @@ echo $favico; ?> >