Don't add css/frame.css in every new page

1.10.x
Julio Montoya 11 years ago
parent e1845c7d3b
commit 5d0c3dc8ef
  1. 70
      main/document/create_document.php
  2. 45
      main/document/edit_document.php
  3. 4
      main/newscorm/learnpath.class.php

@ -153,12 +153,12 @@ if ($relative_url== '') {
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$html_editor_config = array(
'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' :'DocumentsStudent'),
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
'InDocument' => true,
$editorConfig = array(
'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' : 'DocumentsStudent'),
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
'InDocument' => true,
'CreateDocumentDir' => $relative_url,
'CreateDocumentWebDir' => (empty($group_properties['directory']))
? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
@ -167,9 +167,9 @@ $html_editor_config = array(
);
if ($is_certificate_mode) {
$html_editor_config['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$html_editor_config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$html_editor_config['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
}
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
@ -250,7 +250,8 @@ $form->addElement('hidden', 'title_edited', 'false', 'id="title_edited"');
/**
* Check if a document width the chosen filename already exists
*/
function document_exists($filename) {
function document_exists($filename)
{
global $dir;
$cleanName = api_replace_dangerous_char($filename);
@ -280,7 +281,7 @@ $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists');
$current_session_id = api_get_session_id();
$form->addHtmlEditor('content','', false, false, $html_editor_config);
$form->addHtmlEditor('content','', true, true, $editorConfig);
// Comment-field
$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
@ -323,7 +324,10 @@ if (!$is_certificate_mode &&
$folder_sql = implode("','", $escaped_folders);
$sql = "SELECT * FROM $doc_table
WHERE c_id = $course_id AND filetype='folder' AND path IN ('".$folder_sql."')";
WHERE
c_id = $course_id AND
filetype='folder' AND
path IN ('".$folder_sql."')";
$res = Database::query($sql);
$folder_titles = array();
while ($obj = Database::fetch_object($res)) {
@ -336,19 +340,32 @@ if (!$is_certificate_mode &&
if (is_array($folders)) {
foreach ($folders as & $folder) {
//Hide some folders
if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css'){
continue;
if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
continue;
}
//Admin setting for Hide/Show the folders of all users
if (api_get_setting('show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))){
if (api_get_setting('show_users_folders') == 'false' &&
(strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
){
continue;
}
//Admin setting for Hide/Show Default folders to all users
if (api_get_setting('show_default_folders') == 'false' && ($folder=='/images' || $folder=='/flash' || $folder=='/audio' || $folder=='/video' || strstr($folder, '/images/gallery') || $folder=='/video/flv')){
if (api_get_setting('show_default_folders') == 'false' &&
(
$folder == '/images' ||
$folder == '/flash' ||
$folder == '/audio' ||
$folder == '/video' ||
strstr($folder, '/images/gallery') ||
$folder == '/video/flv'
)
){
continue;
}
//Admin setting for Hide/Show chat history folder
if (api_get_setting('show_chat_folder') == 'false' && $folder=='/chat_files'){
if (api_get_setting('show_chat_folder') == 'false' &&
$folder=='/chat_files'
){
continue;
}
@ -424,9 +441,9 @@ if ($form->validate()) {
$content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
if (strpos($content, '/css/frames.css') == false) {
/*if (strpos($content, '/css/frames.css') == false) {
$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
}
}*/
// Don't create file with the same name.
@ -440,17 +457,11 @@ if ($form->validate()) {
if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
// change the path of mp3 to absolute
// first regexp deals with ../../../ urls
// Disabled by Ivan Tcholakov.
//$content = preg_replace("|(flashvars=\"file=)(\.+/)+|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/',$content);
//second regexp deals with audio/ urls
// Disabled by Ivan Tcholakov.
//$content = preg_replace("|(flashvars=\"file=)([^/]+)/|","$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/',$content);
fputs($fp, $content);
fclose($fp);
chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
/*
if (!is_dir($filepath.'css')) {
mkdir($filepath.'css', api_get_permissions_for_new_directories());
$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
@ -464,7 +475,7 @@ if ($form->validate()) {
$doc_id = add_document($_course, $dir.'css/frames.css', 'file', filesize($filepath.'css/frames.css'), 'frames.css');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $userId, null, null, null, null, $current_session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
}
}*/
$file_size = filesize($filepath.$filename.'.'.$extension);
$save_file_path = $dir.$filename.'.'.$extension;
@ -533,12 +544,11 @@ if ($form->validate()) {
Display :: display_footer();
}
} else {
// Interbreadcrumb for the current directory root path
// Copied from document.php
$dir_array = explode('/', $dir);
$array_len = count($dir_array);
// Interbreadcrumb for the current directory root path
// Breadcrumb for the current directory root path
if (!empty($document_data)) {
if (empty($document_data['parents'])) {
$interbreadcrumb[] = array(
@ -587,7 +597,7 @@ if ($form->validate()) {
<div id="hide_bar_template"></div>
</div>
<div id="doc_form" class="col-md-9">
'.$form->return_form().'
'.$form->returnForm().'
</div>
</div>';
Display :: display_footer();

@ -33,8 +33,8 @@ $htmlHeadXtra[] = '
<script>
var hide_bar = function() {
$("#template_col").hide();
$("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11");
$("#doc_form").removeClass("col-md-9");
$("#doc_form").addClass("col-md-11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
}
@ -111,7 +111,7 @@ for ($i = 0; $i < ($count_dir); $i++) {
$relative_url .= '../';
}
$html_editor_config = array(
$editorConfig = array(
'ToolbarSet' => (api_is_allowed_to_edit(null, true) ? 'Documents' :'DocumentsStudent'),
'Width' => '100%',
'Height' => '600',
@ -125,9 +125,9 @@ $html_editor_config = array(
);
if ($is_certificate_mode) {
$html_editor_config['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$html_editor_config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$html_editor_config['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']||
@ -210,9 +210,9 @@ if ($is_allowed_to_edit) {
$content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null;
$content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
if (!strstr($content, '/css/frames.css')) {
/*if (!strstr($content, '/css/frames.css')) {
$content = str_replace('</title></head>', '</title><link rel="stylesheet" href="../css/frames.css" type="text/css" /></head>', $content);
}
}*/
if ($dir == '/') {
$dir = '';
@ -237,7 +237,7 @@ if ($is_allowed_to_edit) {
fclose($fp);
$filepath = $document_data['absolute_parent_path'];
/*
if (!is_dir($filepath.'css')) {
mkdir($filepath.'css', api_get_permissions_for_new_directories());
$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
@ -265,9 +265,9 @@ if ($is_allowed_to_edit) {
null,
$sessionId
);
}
}*/
if (!is_file($filepath.'css/frames.css')) {
/*if (!is_file($filepath.'css/frames.css')) {
$platform_theme = api_get_setting('stylesheets');
if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) {
copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css');
@ -303,7 +303,7 @@ if ($is_allowed_to_edit) {
$sessionId
);
}
}
}*/
// "WHAT'S NEW" notification: update table item_property
$document_id = DocumentManager::get_document_id($_course, $file);
@ -445,7 +445,6 @@ if ($owner_id == api_get_user_id() ||
// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
$defaults['content'] = str_replace('<!--[', '<!-- [', $content);
//if ($extension == 'htm' || $extension == 'html')
// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
$showSystemFolders = api_get_course_setting('show_system_folders');
@ -456,7 +455,7 @@ if ($owner_id == api_get_user_id() ||
if (($extension == 'htm' || $extension == 'html') && $condition) {
if (empty($readonly) && $readonly == 0) {
$form->addHtmlEditor('content', '', false, false, $html_editor_config);
$form->addHtmlEditor('content', '', true, true, $editorConfig);
}
}
@ -496,13 +495,19 @@ if ($owner_id == api_get_user_id() ||
show_return($parent_id, $dir_original, $call_from_tool, $slide_id, $is_certificate_mode);
if ($is_certificate_mode) {
$all_information_by_create_certificate=DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
$str_info='';
$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
api_get_user_id(),
api_get_course_id()
);
$str_info = '';
foreach ($all_information_by_create_certificate[0] as $info_value) {
$str_info.=$info_value.'<br/>';
$str_info .= $info_value.'<br/>';
}
$create_certificate=get_lang('CreateCertificateWithTags');
Display::display_normal_message($create_certificate.': <br /><br />'.$str_info,false);
Display::display_normal_message(
$create_certificate.': <br /><br />'.$str_info,
false
);
}
if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
@ -515,8 +520,8 @@ if ($owner_id == api_get_user_id() ||
<div class="col-md-1">
<div id="hide_bar_template"></div>
</div>
<div id="doc_form" class="col-md-9">
'.$form->return_form().'
<div id="doc_form" class="col-md-8">
'.$form->returnForm().'
</div>
</div>';
}

@ -6097,7 +6097,7 @@ class learnpath
$course_id = api_get_course_int_id();
global $_configuration;
// Please, do not modify this dirname formatting.
$dir = isset ($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
$dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
if (strstr($dir, '..'))
$dir = '/';
@ -9518,8 +9518,6 @@ class learnpath
// TODO: Add a readme file here, with a short description and a link to the Reload player
// then add the file to the zip, then destroy the file (this is done automatically).
// http://www.reload.ac.uk/scormplayer.html - once done, don't forget to close FS#138
global $_configuration;
$append = $_configuration['url_append'];
foreach ($zip_files as $file_path) {
if (empty($file_path)) {

Loading…
Cancel
Save