Minor - fixes in the UI

skala
Julio Montoya 14 years ago
parent 04f8bdc902
commit b0347e5c4a
  1. 4
      main/blog/blog_admin.php
  2. 131
      main/inc/lib/blog.lib.php
  3. 22
      main/inc/lib/template.lib.php

@ -27,7 +27,7 @@ if((!$is_allowed_in_course || !$is_courseMember) && !api_is_allowed_to_edit()) {
} }
if (api_is_allowed_to_edit()) { if (api_is_allowed_to_edit()) {
require_once(api_get_path(LIBRARY_PATH) . "blog.lib.php"); require_once api_get_path(LIBRARY_PATH) . "blog.lib.php";
$nameTools = get_lang("blog_management"); $nameTools = get_lang("blog_management");
// showing the header if we are not in the learning path, if we are in // showing the header if we are not in the learning path, if we are in
@ -114,7 +114,7 @@ if (api_is_allowed_to_edit()) {
if ($_POST) { if ($_POST) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
} }
Blog::display_edit_blog_form(Database::escape_string((int)$_GET['blog_id'])); Blog::display_edit_blog_form(Database::escape_string((int)$_GET['blog_id']));
} }
} }
Blog::display_blog_list(); Blog::display_blog_list();

@ -1214,46 +1214,42 @@ class Blog {
} }
$oFCKeditor->Value = isset($_POST['post_full_text'])?stripslashes($_POST['post_full_text']):''; $oFCKeditor->Value = isset($_POST['post_full_text'])?stripslashes($_POST['post_full_text']):'';
echo '<div class="formw">'; echo '<div class="control-group">';
$oFCKeditor->Create(); $oFCKeditor->Create();
echo '</div>'; echo '</div>';
// attachment // attachment
echo '<div class="row"> echo '<div class="control-group">
<div class="label"> <label class="control-label">
' . get_lang('AddAnAttachment') . ' ' . get_lang('AddAnAttachment') . '
</div> </div>
<div class="formw"> <div class="controls">
<input type="file" name="user_upload"/> <input type="file" name="user_upload"/>
</div> </div>
</div>'; </div>';
// comment // comment
echo '<div class="row"> echo '<div class="control-group">
<div class="label"> <label class="control-label">
' . get_lang('FileComment') . ' ' . get_lang('FileComment') . '
</div> </label>
<div class="formw"> <div class="controls">
<textarea name="post_file_comment" cols="34" /></textarea> <textarea name="post_file_comment" cols="34" /></textarea>
</div> </div>
</div>'; </div>';
// submit // submit
echo '<div class="row"> echo '<div class="control-group">
<div class="label"> <label class="control-label">
</div> </label>
<div class="formw"> <div class="controls">
<input type="hidden" name="action" value="" /> <input type="hidden" name="action" value="" />
<input type="hidden" name="new_post_submit" value="true" /> <input type="hidden" name="new_post_submit" value="true" />
<button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button> <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
</div> </div>
</div>'; </div>';
echo '</form>'; echo '</form>';
} } else {
else
{
api_not_allowed(); api_not_allowed();
} }
} }
@ -2585,40 +2581,20 @@ class Blog {
* *
*/ */
public static function display_new_blog_form () { public static function display_new_blog_form () {
echo '<form name="add_blog" method="post" action="blog_admin.php?action=add">
<legend> $form = new FormValidator('add_blog', 'post','blog_admin.php?action=add');
' . get_lang('AddBlog') . ' $form->addElement('header', get_lang('AddBlog'));
</legend> $form->addElement('text', 'blog_name', get_lang('Title'));
<div class="row"> $form->addElement('textarea', 'blog_subtitle', get_lang('Subtitle'));
<div class="label">
<span class="form_required">*</span>' . get_lang('Title') . ' $form->addElement('hidden', 'new_blog_submit', 'true');
</div> $form->addElement('style_submit_button', null, get_lang('SaveProject'));
<div class="formw">
<input name="blog_name" type="text" size="50" value="'.Security::remove_XSS($_POST['blog_name']).'" /> $defaults = array();
</div> $defaults['blog_name'] = Security::remove_XSS($_POST['blog_name']);
</div> $defaults['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
$form->setDefaults($defaults);
<div class="row"> $form->display();
<div class="label">
' . get_lang('Subtitle') . '
</div>
<div class="formw">
<textarea name="blog_subtitle" cols="45">'.Security::remove_XSS($_POST['blog_subtitle']).'</textarea>
</div>
</div>
<div class="row">
<div class="label">
</div>
<div class="formw">
<input type="hidden" name="action" value="" />
<input type="hidden" name="new_blog_submit" value="true" />
<button class="save" type="submit" name="Submit">' . get_lang('SaveProject') . '</button>
</div>
</div>
</form>
<div style="clear: both; margin-bottom:10px;"></div>';
} }
/** /**
@ -2634,46 +2610,25 @@ class Blog {
$blog = Database::fetch_array($result); $blog = Database::fetch_array($result);
// the form contained errors but we do not want to lose the changes the user already did // the form contained errors but we do not want to lose the changes the user already did
if ($_POST) if ($_POST) {
{
$blog['blog_name'] = Security::remove_XSS($_POST['blog_name']); $blog['blog_name'] = Security::remove_XSS($_POST['blog_name']);
$blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
} }
echo '<form name="edit_blog" method="post" action="blog_admin.php?action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']).'">
<legend> $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']));
' . get_lang('EditBlog') . ' $form->addElement('header', get_lang('EditBlog'));
</legend> $form->addElement('text', 'blog_name', get_lang('Title'));
<div class="row"> $form->addElement('textarea', 'blog_subtitle', get_lang('Subtitle'));
<div class="label">
<span class="form_required">*</span>' . get_lang('Title') . ' $form->addElement('hidden', 'edit_blog_submit', 'true');
</div> $form->addElement('hidden', 'blog_id', $blog['blog_id']);
<div class="formw"> $form->addElement('style_submit_button', null, get_lang('Save'));
<input name="blog_name" type="text" size="50" value="' . $blog['blog_name'] . '" />
</div> $defaults = array();
</div> $defaults['blog_name'] = $blog['blog_name'];
$defaults['blog_subtitle'] = $blog['blog_subtitle'];
<div class="row"> $form->setDefaults($defaults);
<div class="label"> $form->display();
' . get_lang('Subtitle') . '
</div>
<div class="formw">
<textarea name="blog_subtitle" type="text" cols="45">' . $blog['blog_subtitle'] . '</textarea>
</div>
</div>
<div class="row">
<div class="label">
</div>
<div class="formw">
<input type="hidden" name="action" value="" />
<input type="hidden" name="edit_blog_submit" value="true" />
<input type="hidden" name="blog_id" value="' . $blog['blog_id'] . '" />
<button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
</div>
</div>
</form>
<div style="clear: both; margin-bottom:10px;"></div>
';
} }
/** /**

@ -23,14 +23,16 @@ class Template extends Smarty {
var $show_footer; var $show_footer;
var $help; var $help;
var $menu_navigation = array(); var $menu_navigation = array();
var $show_learnpath = false; var $show_learnpath = false; // This is a learnpath section or not?
var $plugin = null; var $plugin = null;
var $course_id = null; var $course_id = null;
var $user_is_logged_in = false;
function __construct($title = '', $show_header = true, $show_footer = true, $show_learnpath = false) { function __construct($title = '', $show_header = true, $show_footer = true, $show_learnpath = false) {
parent::__construct(); parent::__construct();
$this->title = $title;
//$this->assign('header', $title); //Page title
$this->title = $title;
$this->show_learnpath = $show_learnpath; $this->show_learnpath = $show_learnpath;
//Smarty 3 configuration //Smarty 3 configuration
@ -169,8 +171,7 @@ class Template extends Smarty {
$this->show_header = $status; $this->show_header = $status;
$this->assign('show_header', $status); $this->assign('show_header', $status);
//Tool bar //Toolbar
$show_admin_toolbar = api_get_setting('show_admin_toolbar'); $show_admin_toolbar = api_get_setting('show_admin_toolbar');
$show_toolbar = 0; $show_toolbar = 0;
@ -193,8 +194,8 @@ class Template extends Smarty {
} }
$this->assign('show_toolbar', $show_toolbar); $this->assign('show_toolbar', $show_toolbar);
//Only if course is available //Only if course is available
if (!empty($this->course_id)) { if (!empty($this->course_id) && $this->user_is_logged_in) {
if (api_get_setting('show_toolshortcuts') != 'false') { if (api_get_setting('show_toolshortcuts') != 'false') {
//Course toolbar //Course toolbar
@ -227,9 +228,11 @@ class Template extends Smarty {
} }
$user_info['messages_count'] = MessageManager::get_new_messages(); $user_info['messages_count'] = MessageManager::get_new_messages();
$this->user_is_logged_in = true;
} }
//Setting the $_u array that could be use in any template //Setting the $_u array that could be use in any template
$this->assign('_u', $user_info); $this->assign('_u', $user_info);
$this->user_is_logged_in = false;
} }
private function set_system_parameters() { private function set_system_parameters() {
@ -240,8 +243,7 @@ class Template extends Smarty {
'web_course' => api_get_path(WEB_COURSE_PATH), 'web_course' => api_get_path(WEB_COURSE_PATH),
'web_main' => api_get_path(WEB_CODE_PATH), 'web_main' => api_get_path(WEB_CODE_PATH),
'web_ajax' => api_get_path(WEB_AJAX_PATH), 'web_ajax' => api_get_path(WEB_AJAX_PATH),
'web_img' => api_get_path(WEB_IMG_PATH), 'web_img' => api_get_path(WEB_IMG_PATH)
); );
$this->assign('_p', $_p); $this->assign('_p', $_p);
@ -250,7 +252,7 @@ class Template extends Smarty {
'software_name' => $_configuration['software_name'], 'software_name' => $_configuration['software_name'],
'system_version' => $_configuration['system_version'], 'system_version' => $_configuration['system_version'],
'site_name' => api_get_setting('siteName'), 'site_name' => api_get_setting('siteName'),
'institution' => api_get_setting('Institution'), 'institution' => api_get_setting('Institution')
); );
$this->assign('_s', $_s); $this->assign('_s', $_s);
} }

Loading…
Cancel
Save