[svn r14425] Enabled optional course-level CSS (see FS#576)

skala
Yannick Warnier 17 years ago
parent 5a4ea08120
commit f62df9047b
  1. 17
      main/course_info/infocours.php
  2. 30
      main/inc/header.inc.php
  3. 4
      main/inc/lib/add_course.lib.inc.php
  4. 7
      main/install/dokeos_main.sql
  5. 7
      main/install/migrate-db-1.8.4-1.8.5-pre.sql

@ -1,5 +1,5 @@
<?php
// $Id: infocours.php 14371 2008-02-25 22:28:33Z yannoo $
// $Id: infocours.php 14425 2008-02-28 22:33:09Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -143,6 +143,7 @@ while ($cat = mysql_fetch_array($res))
ksort($categories);
}
$linebreak = '<div class="row"><div class="label"></div><div class="formw" style="border-bottom:1px dashed"></div></div>';
// Build the form
@ -200,6 +201,14 @@ $form->addElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageFor
$form->addElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
$form -> addElement('html',$linebreak);
// Course theme picker
if (api_get_setting('allow_course_theme') == 'true')
{
$form->addElement('select_theme', 'course_theme', get_lang('Theme'));
$form->applyFilter('course_theme', 'trim');
$form -> addElement('html',$linebreak);
}
$form->addElement('static', null, null, get_lang("ConfTip"));
$form->add_textfield('course_registration_password', get_lang('CourseRegistrationPassword'), false, array ('size' => '60'));
@ -244,6 +253,8 @@ $values['allow_user_edit_agenda'] = api_get_course_setting('allow_user_edit_agen
$values['allow_user_edit_announcement'] = api_get_course_setting('allow_user_edit_announcement');
// get allow_user_image_forum from table
$values['allow_user_image_forum'] = api_get_course_setting('allow_user_image_forum');
// get course_theme from table
$values['course_theme'] = api_get_course_setting('course_theme');
$form->setDefaults($values);
// Validate form
@ -294,6 +305,10 @@ if ($form->validate() && is_settings_editable())
if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
api_sql_query($sql,__FILE__,__LINE__);
}
if($update_values['course_theme'] != $values['course_theme']){
$sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
api_sql_query($sql,__FILE__,__LINE__);
}
$cidReset = true;

@ -68,21 +68,39 @@ if(!empty($_course['official_code']))
}
echo get_setting('siteName');
?>
</title>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
<?php
$my_style = api_get_setting('stylesheets');
if(api_get_setting('user_selected_theme') == 'true')
{
$style = api_get_setting('stylesheets'); // plataform's css
if(api_get_setting('user_selected_theme') == 'true')
{
$useri = api_get_user_info();
$theme = $useri['theme'];
if(!empty($theme) && $theme != $my_style)
{
$my_style = $theme;
$my_style = $theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true')
{
$mycoursetheme=api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
$my_style = $mycoursetheme; // course's css
}
}
}
}
$my_code_path = api_get_path(WEB_CODE_PATH);
if(empty($my_style)){$my_style = 'default';}
echo '@import "'.$my_code_path.'css/'.$my_style.'/default.css";'."\n";
@ -140,6 +158,6 @@ include(api_get_path(LIBRARY_PATH).'/javascript/email_links.lib.js.php');
<div id="outerframe">
<?php
// Banner
include(api_get_path(INCLUDE_PATH)."banner.inc.php");
?>
include(api_get_path(INCLUDE_PATH)."banner.inc.php");

@ -905,7 +905,8 @@ function update_Db_course($courseDbName)
"content_license text not null default ''," . //content license
"prevent_reinit tinyint unsigned not null default 1," . //stores the default behaviour regarding items re-initialisation when viewed a second time after success
"js_lib tinytext not null default ''," . //the JavaScript library to load for this lp
"debug tinyint unsigned not null default 0" . //stores the default behaviour regarding items re-initialisation when viewed a second time after success
"debug tinyint unsigned not null default 0," . //stores the default behaviour regarding items re-initialisation when viewed a second time after success
"theme varchar(255) not null default '' " . //stores the theme of the LP
")";
if(!api_sql_query($sql))
{
@ -1702,6 +1703,7 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_edit_announcement',0,'announcement')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('email_alert_manager_on_new_quiz',0,'quiz')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('allow_user_image_forum',1,'forum')");
api_sql_query("INSERT INTO `".$TABLESETTING . "`(variable,value,category) VALUES ('course_theme','','theme')");
/*
-----------------------------------------------------------
Course homepage tools for platform admin only

@ -529,7 +529,8 @@ VALUES
('gradebook_score_display_colorsplit',NULL,'textfield','Gradebook','50','GradebookScoreDisplayColorSplit','GradebookScoreDisplayColorSplitComment',NULL,NULL),
('gradebook_score_display_upperlimit','my_display_upperlimit','checkbox','Gradebook','false','GradebookScoreDisplayUpperLimit','GradebookScoreDisplayUpperLimitComment',NULL,'TabsGradebookEnableUpperLimit'),
('user_selected_theme',NULL,'radio','Platform','false','UserThemeSelection','UserThemeSelectionComment',NULL,NULL),
('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme');
('profile','theme','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'UserTheme'),
('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -656,8 +657,8 @@ VALUES
('gradebook_enable','false','No'),
('user_selected_theme','true','Yes'),
('user_selected_theme','false','No'),
('user_selected_theme','true','Yes'),
('user_selected_theme','false','No');
('allow_course_theme','true','Yes'),
('allow_course_theme','false','No');

@ -54,7 +54,6 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('user_selected_theme', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('user_selected_theme', 'false', 'No');
ALTER TABLE user ADD theme varchar(255) DEFAULT NULL;
UPDATE settings_current SET variable='service_visio', subkey='active' , title='VisioEnable' WHERE variable='service_visio' AND subkey='active';
UPDATE settings_current SET variable='service_visio', subkey='visio_host', title='VisioHost' WHERE variable='service_visio' AND subkey='visio_rtmp_host_local';
UPDATE settings_current SET variable='service_visio', subkey='visio_port', title='VisioPort' WHERE variable='service_visio' AND subkey='visio_rtmp_port';
@ -63,6 +62,9 @@ DELETE FROM settings_options WHERE variable = 'visio_rtmp_host_local';
DELETE FROM settings_current WHERE variable='service_visio' AND subkey='visioconference_url';
DELETE FROM settings_current WHERE variable='service_visio' AND subkey='visioclassroom_url';
DELETE FROM settings_current WHERE variable='service_visio' AND subkey='visio_is_web_rtmp';
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext) VALUES ('allow_course_theme',NULL,'radio','Course','true','AllowCourseThemeTitle','AllowCourseThemeComment',NULL,NULL);
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_course_theme', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_course_theme', 'false', 'No');
-- xxSTATSxx
ALTER TABLE track_e_downloads ADD INDEX (down_user_id);
@ -88,4 +90,5 @@ ALTER TABLE dropbox_post ADD INDEX ( session_id ) ;
ALTER TABLE dropbox_file ADD session_id SMALLINT UNSIGNED NOT NULL ;
ALTER TABLE dropbox_file ADD INDEX ( session_id ) ;
ALTER TABLE item_property ADD INDEX (tool,ref);
INSERT INTO course_setting(variable,value,category) VALUES ('allow_user_image_forum',1,'forum');
INSERT INTO course_setting(variable,value,category) VALUES ('allow_user_image_forum',1,'forum');
INSERT INTO course_setting(variable,value,category) VALUES ('course_theme','','theme');

Loading…
Cancel
Save