Explorar o código

[svn r18974] fix admin default templates to run with fckeditor

Juan Carlos Raña %!s(int64=16) %!d(string=hai) anos
pai
achega
19399499db

+ 13 - 7
main/admin/settings.php

@@ -1,4 +1,4 @@
-<?php // $Id: settings.php 18955 2009-03-11 10:45:48Z pcool $
+<?php // $Id: settings.php 18974 2009-03-11 20:54:14Z herodoto $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -53,6 +53,7 @@ require_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
+$_SESSION['this_section'] = $this_section;
 
 // Access restrictions
 api_protect_admin_script();
@@ -74,6 +75,11 @@ $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAd
 // setting the name of the tool
 $tool_name = get_lang('DokeosConfigSettings');
 
+// setting for templates
+$fck_attribute['ToolbarSet'] = "AdminTemplates";
+$fck_attribute['Width'] = '100%';
+$fck_attribute['Height'] = '400';
+
 // Build the form
 if (!empty($_GET['category']) and !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search')))
 {
@@ -953,8 +959,8 @@ function get_template_data($from, $number_of_items, $column, $direction)
  */
 function actions_filter($id)
 {
-	$return .= '<a href="settings.php?category=Templates&amp;action=edit&amp;id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.gif').'</a>';
-	$return .= '<a href="settings.php?category=Templates&amp;action=delete&amp;id='.Security::remove_XSS($id).'" onclick="javascript:if(!confirm('."'".get_lang("ConfirmYourChoice")."'".')) return false;">'.Display::return_icon('delete.gif').'</a>';
+	$return .= '<a href="settings.php?category=Templates&amp;action=edit&amp;id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
+	$return .= '<a href="settings.php?category=Templates&amp;action=delete&amp;id='.Security::remove_XSS($id).'" onclick="javascript:if(!confirm('."'".get_lang("ConfirmYourChoice")."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
 	return $return;
 }
 
@@ -970,7 +976,7 @@ function actions_filter($id)
  */
 function image_filter($image)
 {
-	return '<img src="'.api_get_path(WEB_PATH).'home/'.$image.'" alt="'.$image.'"/>';
+	return '<img src="'.api_get_path(WEB_PATH).'home/default_platform_document/'.$image.'" alt="'.$image.'"/>';
 }
 
 /**
@@ -1025,7 +1031,7 @@ function add_edit_template()
 		$form->addElement('hidden','template_id');
 		
 		// adding an extrra field: a preview of the image that is currently used
-		$form->addElement('static','template_image_preview', '', '<img src="'.api_get_path(WEB_PATH).'home/'.$row['image'].'" alt="'.$row['image'].'"/>');
+		$form->addElement('static','template_image_preview', '', '<img src="'.api_get_path(WEB_PATH).'home/default_platform_document/'.$row['image'].'" alt="'.$row['image'].'"/>');
 		
 		// setting the information of the template that we are editing 
 		$form->setDefaults($defaults);
@@ -1055,7 +1061,7 @@ function add_edit_template()
 				$new_file_name = add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']);	
 				
 				// upload dir
-				$upload_dir = api_get_path(SYS_PATH).'home/';
+				$upload_dir = api_get_path(SYS_PATH).'home/default_platform_document/';
 				
 				// move the uploaded file to the home folder
 				$result= @move_uploaded_file($_FILES['template_image']['tmp_name'], $upload_dir.$new_file_name);
@@ -1113,7 +1119,7 @@ function delete_template($id)
 	$row = Database::fetch_array($result);	
 	if (!empty($row['image']))
 	{
-		unlink(api_get_path(SYS_PATH).'home/'.$row['image']);
+		unlink(api_get_path(SYS_PATH).'home/default_platform_document/'.$row['image']);
 	}
 	
 	// now we remove it from the database

+ 1 - 1
main/inc/lib/fckeditor/fcktemplates.xml.php

@@ -95,7 +95,7 @@ function load_platform_templates()
 	$result = api_sql_query($sql, __FILE__, __LINE__);
 	while ($row = Database::fetch_array($result))
 	{
-		echo '	<Template title="'.$row['title'].'" image="'.api_get_path(WEB_PATH).'home/'.$row['image'].'">
+		echo '	<Template title="'.$row['title'].'" image="'.api_get_path(WEB_PATH).'home/default_platform_document/'.$row['image'].'">
 					<Description>'.$row['Description'].'</Description>
 					<Html>
 						<![CDATA[

+ 12 - 0
main/inc/lib/fckeditor/myconfig.js

@@ -88,6 +88,18 @@ FCKConfig.ToolbarSets["GlobalAgenda"] = [
 	['Source']
 ] ;
 
+//Admin Templates
+FCKConfig.ToolbarSets["AdminTemplates"] = [
+	['NewPage','Templates','Save','Print','PageBreak','Preview','FitWindow','-','PasteText','PasteWord','-','Undo','Redo','-','SelectAll','RemoveFormat','-','Find'],
+	['Link','Unlink','Anchor'],
+	['Image','imgmapPopup','flvPlayer','Flash','EmbedMovies','YouTube','MP3'],
+	['Table','CreateDiv','Rule','Smiley','SpecialChar','googlemaps'],
+	['FontFormat','FontName','FontSize'],
+	['Bold','Italic','Underline','StrikeThrough'],
+	['Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'],
+	['Source']
+] ;
+
 //FAQ
 FCKConfig.ToolbarSets["FAQ"] = [
 	['FitWindow','Link','Image','Flash','Rule','FontSize','Bold','Italic','OrderedList','UnorderedList','TextColor','Source']