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()) {
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");
// 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) {
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();

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

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

Loading…
Cancel
Save