Julio Montoya %!s(int64=14) %!d(string=hai) anos
pai
achega
cdbb604beb
Modificáronse 34 ficheiros con 2196 adicións e 195 borrados
  1. 17 13
      main/document/document.inc.php
  2. 27 11
      main/document/document.php
  3. 3 2
      main/forum/forumfunction.inc.php
  4. 6 5
      main/forum/viewthread_flat.inc.php
  5. 1 1
      main/group/group.php
  6. BIN=BIN
      main/img/group_category.gif
  7. BIN=BIN
      main/img/user_folders.gif
  8. 2 2
      main/inc/banner.inc.php
  9. 1 1
      main/inc/lib/add_course.lib.inc.php
  10. BIN=BIN
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/images/big_icon/bigfolderShared.png
  11. BIN=BIN
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/images/small_icon/folderShared.png
  12. 1402 0
      main/inc/lib/fckeditor/editor/plugins/asciisvg/ASCIIsvgPI.js
  13. 8 0
      main/inc/lib/fckeditor/editor/plugins/asciisvg/d.svg
  14. 84 2
      main/inc/lib/fckeditor/editor/plugins/asciisvg/fck_asciisvg.html
  15. 433 4
      main/inc/lib/fckeditor/editor/plugins/asciisvg/fck_asciisvg.js
  16. 1 1
      main/inc/lib/fckeditor/editor/plugins/asciisvg/fckplugin.js
  17. 1 1
      main/inc/lib/fckeditor/editor/plugins/asciisvg/fckplugin_compressed.js
  18. 33 24
      main/inc/lib/fckeditor/toolbars/extended/announcements.php
  19. 33 24
      main/inc/lib/fckeditor/toolbars/extended/announcements_student.php
  20. 1 1
      main/inc/lib/fckeditor/toolbars/extended/documents.php
  21. 2 1
      main/inc/lib/fckeditor/toolbars/extended/documents_student.php
  22. 33 24
      main/inc/lib/fckeditor/toolbars/extended/introduction.php
  23. 33 24
      main/inc/lib/fckeditor/toolbars/extended/notebook.php
  24. 33 25
      main/inc/lib/fckeditor/toolbars/extended/notebook_student.php
  25. 33 24
      main/inc/lib/fckeditor/toolbars/extended/training_description.php
  26. 1 1
      main/inc/lib/fckeditor/toolbars/extended/wiki.php
  27. 1 1
      main/inc/lib/fckeditor/toolbars/extended/wiki_student.php
  28. 1 1
      main/inc/lib/fckeditor/toolbars/extended/wiki_task.php
  29. 1 1
      main/lang/bulgarian/exercice.inc.php
  30. 1 0
      main/lang/english/document.inc.php
  31. 1 1
      main/lang/english/install.inc.php
  32. 1 0
      main/lang/english/trad4all.inc.php
  33. 1 0
      main/lang/spanish/document.inc.php
  34. 1 0
      main/lang/spanish/trad4all.inc.php

+ 17 - 13
main/document/document.inc.php

@@ -147,12 +147,12 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
 
 	$tooltip_title_alt = $tooltip_title;
 	if ($tooltip_title == 'shared_folder') {
-		$tooltip_title_alt = get_lang('SharedFolder');
+		$tooltip_title_alt = get_lang('UserFolders');
 	}elseif(strstr($tooltip_title, 'shared_folder_session_')) {
-		$tooltip_title_alt = get_lang('SharedFolder').' ('.api_get_session_name($current_session_id).')';
+		$tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
 	}elseif(strstr($tooltip_title, 'sf_user_')) {
 		$userinfo = Database::get_user_info_from_id(substr($tooltip_title, 8));
-		$tooltip_title_alt = get_lang('SharedFolder').' ('.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).')';
+		$tooltip_title_alt = get_lang('UserFolder').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']);
 	}
 
 	$current_session_id=api_get_session_id();
@@ -214,19 +214,19 @@ function build_document_icon_tag($type, $path) {
 		$icon = choose_image($basename);
 	} else {
 		if ($basename == 'shared_folder') {
-			$icon = 'shared_folder.gif';
+			$icon = 'user_folders.gif';
 			if ($is_allowed_to_edit) {
 				$basename = get_lang('HelpSharedFolder');
 			} else {
-				$basename = get_lang('SharedFolder');
+				$basename = get_lang('UserFolders');
 			}
 		}elseif(strstr($basename, 'shared_folder_session_')) {
 			if ($is_allowed_to_edit) {
 				$basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpSharedFolder');
 			} else {
-				$basename = get_lang('SharedFolder').' ('.api_get_session_name($current_session_id).')';
+				$basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
 			}
-			$icon = 'shared_folder.gif';
+			$icon = 'user_folders.gif';
 		}elseif(strstr($basename, 'sf_user_')) {
 			$userinfo = Database::get_user_info_from_id(substr($basename, 8));
 			$image_path = UserManager::get_user_picture_path_by_id(substr($basename, 8), 'web', false, true);
@@ -237,7 +237,7 @@ function build_document_icon_tag($type, $path) {
 				$icon = '../upload/users/'.substr($basename, 8).'/'.$image_path['file'];
 			}
 
-			$basename = get_lang('SharedFolder').' ('.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).')';
+			$basename = get_lang('UserFolder').' ('.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).')';
 
 		} else {
 			if (($basename =='audio' || $basename =='flash' || $basename =='images' || $basename =='video') && api_is_allowed_to_edit()) {
@@ -386,6 +386,7 @@ function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir =
 		if ($curdirpath != '/') {
 			$form .= '<option value="/">'.get_lang('Documents').'</option>';
 		}
+		
 		if (is_array($folders)) {
 			foreach ($folders as & $folder) {
 				// You cannot move a file to:
@@ -550,15 +551,18 @@ function is_any_user_shared_folder($path, $current_session_id) {
 }
 
 /**
- * Checks whether the user is into his shared folder
- * @return return bool Return true when user is in his user shared folder
+ * Checks whether the user is into his shared folder or into a subfolder
+ * @return return bool Return true when user is in his user shared folder or into a subforder
  */
 function is_my_shared_folder($user_id, $path, $current_session_id) {
-	$clean_path = Security::remove_XSS($path);
-	if($clean_path == '/shared_folder/sf_user_'.$user_id){
+	$clean_path = Security::remove_XSS($path).'/';	
+	$main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//';//for security does not remove the last slash
+	$main_user_shared_folder_session='/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//';//for security does not remove the last slash
+	
+	if(preg_match($main_user_shared_folder, $clean_path)){
 		return true;
 	}
-	elseif($clean_path == '/shared_folder_session_'.$current_session_id.'/sf_user_'.$user_id){
+	elseif(preg_match($main_user_shared_folder_session, $clean_path)){
 		return true;
 	}
 	else{

+ 27 - 11
main/document/document.php

@@ -441,8 +441,8 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett
 //START ACTION MENU
 
 	/*	MOVE FILE OR DIRECTORY */
-	//Only teacher and all users into their group
-	if($is_allowed_to_edit || $group_member_with_upload_rights){	
+	//Only teacher and all users into their group and each user into his/her shared folder
+	if($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id) || is_my_shared_folder($_user['user_id'], Security::remove_XSS($_POST['move_to']), $current_session_id)){	
 		$my_get_move = Security::remove_XSS($_GET['move']);
 		if (isset($_GET['move']) && $_GET['move'] != '') {
 			
@@ -459,13 +459,29 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett
 			}
 	
 			if (DocumentManager::get_document_id($_course, $my_get_move)) {
-				$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights);				
+				$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights);
 				
-				echo '<div class="row"><div class="form_header">'.get_lang('Move').'</div></div>';
-				echo build_move_to_selector($folders, Security::remove_XSS($_GET['curdirpath']), $my_get_move, $group_properties['directory']);
+				//filter if is my shared folder. TODO: move this code to build_move_to_selector function
+				if(is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id) && !$is_allowed_to_edit){								
+					$main_user_shared_folder_main = '/shared_folder/sf_user_'.api_get_user_id();//only main user shared folder
+					$main_user_shared_folder_sub  = '/shared_folder\/sf_user_'.api_get_user_id().'\//';//all subfolders
+					$user_shared_folders=array();
+					
+					foreach($folders as $fold){
+						if($main_user_shared_folder_main==$fold || preg_match($main_user_shared_folder_sub, $fold)){
+							$user_shared_folders[]=$fold;
+						}
+					}						
+					echo '<div class="row"><div class="form_header">'.get_lang('Move').'</div></div>';
+					echo build_move_to_selector($user_shared_folders, Security::remove_XSS($_GET['curdirpath']), $my_get_move, $group_properties['directory']);
+				}
+				else{
+					echo '<div class="row"><div class="form_header">'.get_lang('Move').'</div></div>';
+					echo build_move_to_selector($folders, Security::remove_XSS($_GET['curdirpath']), $my_get_move, $group_properties['directory']);			
+				}
 			}
 		}
-	
+		
 		if (isset($_POST['move_to']) && isset($_POST['move_file'])) {
 			if (!$is_allowed_to_edit) {
 				if (DocumentManager::check_readonly($_course, $_user['user_id'], $my_get_move)) {
@@ -484,7 +500,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett
 			// This is needed for the update_db_info function
 			//$dbTable = $_course['dbNameGlu'].'document';
 			$dbTable = Database::get_course_table(TABLE_DOCUMENT);
-	
 			// Security fix: make sure they can't move files that are not in the document table
 			if (DocumentManager::get_document_id($_course, $_POST['move_file'])) {
 				if (move($base_work_dir.$_POST['move_file'], $base_work_dir.$_POST['move_to'])) {
@@ -501,9 +516,10 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett
 			}
 		}
 	}
+	
 	/*	DELETE FILE OR DIRECTORY */
 	//Only teacher and all users into their group
-	if($is_allowed_to_edit || $group_member_with_upload_rights){
+	if($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id)){
 		if (isset($_GET['delete'])) {
 			
 			if (api_is_coach()) {
@@ -634,7 +650,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett
 	
 	/*	TEMPLATE ACTION */
 	//Only teacher and all users into their group
-	if($is_allowed_to_edit || $group_member_with_upload_rights){
+	if($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id)){
 		if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) {
 	
 			$document_id_for_template = intval($_GET['add_as_template']);
@@ -928,8 +944,8 @@ if (!is_null($docs_and_folders)) {
 	global $total_size;
 	if (!$is_certificate_mode && $total_size != 0 && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) {
 		
-		//don't show icon into shared folder, and don´t show into main path (root)
-		if (!is_shared_folder($curdirpath, $current_session_id) && $curdirpath!='/' || api_is_allowed_to_edit() || api_is_platform_admin())
+		//for student does not show icon into other shared folder, and does not show into main path (root)
+		if (is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id) && $curdirpath!='/' || api_is_allowed_to_edit() || api_is_platform_admin())
 		{
 	    	echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&path='.$curdirpathurl.'">'.Display::display_icon('zip_save.gif', get_lang('Save').' (ZIP)'). get_lang('Save').' (ZIP)</a>&nbsp';
 		}

+ 3 - 2
main/forum/forumfunction.inc.php

@@ -3262,8 +3262,9 @@ function prepare4display($input='') {
 				$counter++;
 			}
 		}
-		//return api_html_entity_decode(stripslashes($input));
-		return Security::remove_XSS($input, STUDENT);
+        //return api_html_entity_decode(stripslashes($input));
+        //change this to COURSEMANAGERLOWSECURITY or COURSEMANAGER to lower filtering and allow more styles (see comments of Security::remove_XSS() method to learn about other levels)
+        return Security::remove_XSS($input, STUDENT);
 	} else {
 		$returnarray=array_walk($input, 'api_html_entity_decode');
 		$returnarray=array_walk($input, 'stripslashes');

+ 6 - 5
main/forum/viewthread_flat.inc.php

@@ -111,7 +111,7 @@ if (isset($current_thread['thread_id'])){
 			}
 		}
 		echo "</td>";
-		// show the
+		// prepare the notification icon
 		if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) {
 			$post_image=icon('../img/forumpostnew.gif');
 		} else {
@@ -124,10 +124,11 @@ if (isset($current_thread['thread_id'])){
 		
 		echo "</tr>";
 		
-		// The post message
-		echo "<tr>";
-		echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
-		echo "</tr>";
+        // The post message
+        echo "<tr>";
+        // see comments inside forumfunction.inc.php to lower filtering and allow more visual changes
+        echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
+        echo "</tr>";
 	
 		// The check if there is an attachment
 		 

+ 1 - 1
main/group/group.php

@@ -189,7 +189,7 @@ foreach ($group_cats as $index => $category) {
 	$in_category = false;
 	if (api_get_setting('allow_group_categories') == 'true') {
 		if (isset ($_GET['show_all']) || (isset ($_GET['category']) && $_GET['category'] == $category['id'])) {
-			echo '<img src="../img/shared_folder.gif" alt=""/>';
+			echo '<img src="../img/group_category.gif" alt=""/>';
 			echo '<a href="group.php?'.api_get_cidreq().'&origin='.Security::remove_XSS($_GET['origin']).'">'.$category['title'].'</a>';
 			$in_category = true;
 		} else {

BIN=BIN
main/img/group_category.gif


BIN=BIN
main/img/user_folders.gif


+ 2 - 2
main/inc/banner.inc.php

@@ -416,11 +416,11 @@ if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
 		$navigation_item['title'] = $breadcrumb_step['name'];
 		// titles for shared folders
 		if ($breadcrumb_step['name'] == 'shared_folder') {
-			$navigation_item['title'] = get_lang('SharedFolder');
+			$navigation_item['title'] = get_lang('UserFolders');
 		}			
 		elseif(strstr($breadcrumb_step['name'], 'shared_folder_session_')) {
 		
-			$navigation_item['title'] = get_lang('SharedFolder');
+			$navigation_item['title'] = get_lang('UserFolders');
 		}
 		elseif(strstr($breadcrumb_step['name'], 'sf_user_')) {			
 			$userinfo = Database::get_user_info_from_id(substr($breadcrumb_step['name'], 8));

+ 1 - 1
main/inc/lib/add_course.lib.inc.php

@@ -2231,7 +2231,7 @@ function fill_Db_course($course_db_name, $course_repository, $language, $default
     $example_doc_id = Database :: insert_id();
     Database::query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$example_doc_id,'DocumentAdded',1,0,NULL,0)");
 
-    Database::query("INSERT INTO `".$TABLETOOLDOCUMENT . "`(path,title,filetype,size) VALUES ('/shared_folder','".get_lang('SharedDocumentsDirectory')."','folder','0')");
+    Database::query("INSERT INTO `".$TABLETOOLDOCUMENT . "`(path,title,filetype,size) VALUES ('/shared_folder','".get_lang('UserFolders')."','folder','0')");
     $example_doc_id = Database :: insert_id();
     Database::query("INSERT INTO `".$TABLEITEMPROPERTY . "` (tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility) VALUES ('document',1,NOW(),NOW(),$example_doc_id,'DocumentAdded',1,0,NULL,0)");
 

BIN=BIN
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/images/big_icon/bigfolderShared.png


BIN=BIN
main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/theme/default/images/small_icon/folderShared.png


+ 1402 - 0
main/inc/lib/fckeditor/editor/plugins/asciisvg/ASCIIsvgPI.js

@@ -0,0 +1,1402 @@
+/* ASCIIsvgPI.js
+==============
+This version contains modifications needed for ASCIIsvg to work with
+tinyMCE editor plugins.  Modifications made by David Lippman, (c) 2008
+Revised 8/14/09
+
+JavaScript routines to dynamically generate Scalable Vector Graphics
+using a mathematical xy-coordinate system (y increases upwards) and
+very intuitive JavaScript commands (no programming experience required).
+ASCIIsvg.js is good for learning math and illustrating online math texts.
+Works with Internet Explorer+Adobe SVGviewer and SVG enabled Mozilla/Firefox.
+
+Ver 1.2.7 Oct 13, 2005 (c) Peter Jipsen http://www.chapman.edu/~jipsen
+Latest version at http://www.chapman.edu/~jipsen/svg/ASCIIsvg.js
+If you use it on a webpage, please send the URL to jipsen@chapman.edu
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, 
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License (at http://www.gnu.org/copyleft/gpl.html) 
+for more details.*/
+
+//var AScgiloc = 'http://www.imathas.com/imathas/filter/graph/svgimg.php';
+var ASnoSVG = false;
+var checkIfSVGavailable = true;
+var notifyIfNoSVG = false;
+var alertIfNoSVG = false;
+var xunitlength = 20;  // pixels
+var yunitlength = 20;  // pixels
+var origin = [0,0];   // in pixels (default is bottom left corner)
+var defaultwidth = 300; defaultheight = 200; defaultborder = [0,0,0,0];
+var border = defaultborder;
+var strokewidth, strokedasharray, stroke, fill;
+var fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill, fontbackground;
+var markerstrokewidth = "1";
+var markerstroke = "black";
+var markerfill = "yellow";
+var marker = "none";
+var arrowfill = stroke;
+var dotradius = 4;
+var ticklength = 4;
+var axesstroke = "black";
+var gridstroke = "grey";
+var pointerpos = null;
+var coordinates = null;
+var above = "above";
+var below = "below";
+var left = "left";
+var right = "right";
+var aboveleft = "aboveleft";
+var aboveright = "aboveright";
+var belowleft = "belowleft";
+var belowright = "belowright";
+var cpi = "\u03C0", ctheta = "\u03B8";
+var pi = Math.PI, ln = Math.log, e = Math.E;
+var arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan;
+var sec = function(x) { return 1/Math.cos(x) };
+var csc = function(x) { return 1/Math.sin(x) };
+var cot = function(x) { return 1/Math.tan(x) };
+var xmin, xmax, ymin, ymax, xscl, yscl, 
+    xgrid, ygrid, xtick, ytick, initialized;
+var isIE = document.createElementNS==null;
+var picture, svgpicture, doc, width, height, a, b, c, d, i, n, p, t, x, y;
+var arcsec = function(x) { return arccos(1/x) };
+var arccsc = function(x) { return arcsin(1/x) };
+var arccot = function(x) { return arctan(1/x) };
+var sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };
+var cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };
+var tanh = 
+  function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };
+var sech = function(x) { return 1/cosh(x) };
+var csch = function(x) { return 1/sinh(x) };
+var coth = function(x) { return 1/tanh(x) };
+var arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };
+var arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };
+var arctanh = function(x) { return ln((1+x)/(1-x))/2 };
+var sech = function(x) { return 1/cosh(x) };
+var csch = function(x) { return 1/sinh(x) };
+var coth = function(x) { return 1/tanh(x) };
+var arcsech = function(x) { return arccosh(1/x) };
+var arccsch = function(x) { return arcsinh(1/x) };
+var arccoth = function(x) { return arctanh(1/x) };
+var sign = function(x) { return (x==0?0:(x<0?-1:1)) };
+var logten = function(x) { return (Math.LOG10E*Math.log(x)) };
+
+
+function factorial(x,n) {
+  if (n==null) n=1;
+  for (var i=x-n; i>0; i-=n) x*=i;
+  return (x<0?NaN:(x==0?1:x));
+}
+
+
+function C(x,k) {
+  var res=1;
+  for (var i=0; i<k; i++) res*=(x-i)/(k-i);
+  return res;
+}
+
+
+function chop(x,n) {
+  if (n==null) n=0;
+  return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);
+}
+
+
+function ran(a,b,n) {
+  if (n==null) n=0;
+  return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);
+}
+
+
+function myCreateElementXHTML(t) {
+  if (isIE) return document.createElement(t);
+  else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
+}
+
+
+function isSVGavailable() {
+//Safari 3 can do SVG, but still has issues.  
+  if ((ver = navigator.userAgent.toLowerCase().match(/safari\/(\d+)/))!=null) {
+		//if (ver[1]>524) {
+		//	return null;
+		//}
+		return 1;
+ } 
+//Opera can do SVG, but not very pretty, so might want to skip it 
+ if ((ver = navigator.userAgent.toLowerCase().match(/opera\/([\d\.]+)/))!=null) {
+		if (ver[1]>9.1) {
+			return null;
+		}
+ }
+ //Mozillas. 
+  if (navigator.product && navigator.product=='Gecko') {
+	   var rv = navigator.userAgent.toLowerCase().match(/rv:\s*([\d\.]+)/);
+	   if (rv!=null) {
+		rv = rv[1].split('.');
+		if (rv.length<3) { rv[2] = 0;}
+		if (rv.length<2) { rv[1] = 0;}
+	   }
+	   if (rv!=null && 10000*rv[0]+100*rv[1]+1*rv[2]>=10800) return null;
+	   else return 1;
+  }
+  //IE + AdobeSVGviewer
+  if (navigator.appName.slice(0,9)=="Microsoft")
+    try	{
+      var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");
+        return null;
+    } catch (e) {
+        return 1;
+    }
+  else return 1;
+}
+
+function less(x,y) { return x < y }  // used for scripts in XML files
+                                     // since IE does not handle CDATA well
+function setText(st,id) { 
+  var node = document.getElementById(id);
+  if (node!=null)
+    if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st;
+    else node.appendChild(document.createTextNode(st));
+}
+
+
+function myCreateElementSVG(t) {
+  if (isIE) return doc.createElement(t);
+  else return doc.createElementNS("http://www.w3.org/2000/svg",t);
+}
+
+
+function getX() {
+  return (doc.getElementById("pointerpos").getAttribute("cx")-origin[0])/xunitlength;
+}
+
+
+function getY() {
+  return (height-origin[1]-doc.getElementById("pointerpos").getAttribute("cy"))/yunitlength;
+}
+
+
+function mousemove_listener(evt) {
+  if (svgpicture.getAttribute("xbase")!=null)
+    pointerpos.cx.baseVal.value = evt.clientX-svgpicture.getAttribute("xbase");
+  if (svgpicture.getAttribute("ybase")!=null)
+    pointerpos.cy.baseVal.value = evt.clientY-svgpicture.getAttribute("ybase");
+}
+
+
+function top_listener(evt) {
+  svgpicture.setAttribute("ybase",evt.clientY);
+}
+
+
+function bottom_listener(evt) { 
+  svgpicture.setAttribute("ybase",evt.clientY-height+1);
+}
+
+
+function left_listener(evt) {
+  svgpicture.setAttribute("xbase",evt.clientX);
+}
+
+
+function right_listener(evt) {
+  svgpicture.setAttribute("xbase",evt.clientX-width+1);
+}
+
+
+function switchTo(id) {
+//alert(id);
+  picture = document.getElementById(id);
+  width = picture.getAttribute("width")-0;
+  height = picture.getAttribute("height")-0;
+  strokewidth = "1" // pixel
+  stroke = "black"; // default line color
+  fill = "none";    // default fill color
+  marker = "none";
+  if ((picture.nodeName == "EMBED" || picture.nodeName == "embed") && isIE) {
+    svgpicture = picture.getSVGDocument().getElementById("root");
+    doc = picture.getSVGDocument();
+  } else {
+    picture.setAttribute("onmousemove","updateCoords"+(id.slice(id.length-1)-1)+"()");
+//alert(picture.getAttribute("onmousemove")+"***");
+    svgpicture = picture;
+    doc = document;
+  }
+  xunitlength = svgpicture.getAttribute("xunitlength")-0;
+  yunitlength = svgpicture.getAttribute("yunitlength")-0;
+  xmin = svgpicture.getAttribute("xmin")-0;
+  xmax = svgpicture.getAttribute("xmax")-0;
+  ymin = svgpicture.getAttribute("ymin")-0;
+  ymax = svgpicture.getAttribute("ymax")-0;
+  origin = [svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];
+}
+
+
+function updatePicture(obj) {
+//alert(typeof obj)
+  var src = document.getElementById((typeof obj=="string"?
+              obj:"picture"+(obj+1)+"input")).value;
+  xmin = null; xmax = null; ymin = null; ymax = null;
+  xscl = null; xgrid = null; yscl = null; ygrid = null;
+  initialized = false;
+  switchTo((typeof obj=="string"?obj.slice(0,8):"picture"+(obj+1)));
+  src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+?)\,/g,"plot\(\"$1\",");
+  src = src.replace(/plot\(\x20*([^\"f\[][^\n\r]+)\)/g,"plot(\"$1\")");
+  src = src.replace(/([0-9])([a-zA-Z])/g,"$1*$2");
+  src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
+//alert(src);
+  try {
+    with (Math) eval(src);
+  } catch(err) {alert(err+"\n"+src)}
+}
+
+
+function showHideCode(obj) {
+  var node = obj.nextSibling;
+  while (node != null && node.nodeName != "BUTTON" && 
+
+    node.nodeName != "button") node = node.nextSibling;
+  if (node.style.display == "none") node.style.display = "";
+  else node.style.display = "none";
+  while (node != null && node.nodeName != "TEXTAREA" && 
+    node.nodeName != "textarea") node = node.previousSibling;
+  if (node.style.display == "none") node.style.display = "";
+  else node.style.display = "none";
+//  updatePicture(node.getAttribute("id"));
+}
+
+
+function hideCode() { //do nothing
+}
+
+
+function showcode() { //do nothing
+}
+
+
+function nobutton() { //do nothing
+}
+
+
+function setBorder(l,b,r,t) { 
+	if (t==null) {
+		border = new Array(l,l,l,l);
+	} else {
+		border = new Array(l,b,r,t);
+	}
+}
+
+
+function initPicture(x_min,x_max,y_min,y_max) {
+ if (!initialized) {
+  strokewidth = "1"; // pixel
+  strokedasharray = null;
+  stroke = "black"; // default line color
+  fill = "none";    // default fill color
+  fontstyle = "italic"; // default shape for text labels
+  fontfamily = "times"; // default font
+  fontsize = "16";      // default size
+  fontweight = "normal";
+  fontstroke = "black";  // default font outline color
+  fontfill = "black";    // default font color
+  fontbackground = "none";
+  marker = "none";
+  initialized = true;
+  if (x_min!=null) xmin = x_min;
+  if (x_max!=null) xmax = x_max;
+  if (y_min!=null) ymin = y_min;
+  if (y_max!=null) ymax = y_max;
+  if (xmin==null) xmin = -5;
+  if (xmax==null) xmax = 5;
+ if (typeof xmin != "number" || typeof xmax != "number" || xmin >= xmax) 
+   alert("Picture requires at least two numbers: xmin < xmax");
+ else if (y_max != null && (typeof y_min != "number" || 
+          typeof y_max != "number" || y_min >= y_max))
+   alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");
+ else {
+  //if (width==null) 
+  width = picture.getAttribute("width");
+  //else picture.setAttribute("width",width);
+  if (width==null || width=="") width=defaultwidth;
+  //if (height==null) 
+  height = picture.getAttribute("height");
+  //else picture.setAttribute("height",height);
+  if (height==null || height=="") height=defaultheight;
+  xunitlength = (width-border[0]-border[2])/(xmax-xmin);
+  yunitlength = xunitlength;
+//alert(xmin+" "+xmax+" "+ymin+" "+ymax)
+  if (ymin==null) {
+    origin = [-xmin*xunitlength+border[0],height/2];
+    ymin = -(height-border[1]-border[3])/(2*yunitlength);
+    ymax = -ymin;
+  } else {
+    if (ymax!=null) yunitlength = (height-border[1]-border[3])/(ymax-ymin);
+    else ymax = (height-border[1]-border[3])/yunitlength + ymin;
+    origin = [-xmin*xunitlength+border[0],-ymin*yunitlength+border[1]];
+  }
+  winxmin = Math.max(border[0]-5,0);
+  winxmax = Math.min(width-border[2]+5,width);
+  winymin = Math.max(border[3]-5,0);
+  winymax = Math.min(height-border[1]+5,height);
+//  if (true ||picture.nodeName == "EMBED" || picture.nodeName == "embed") {
+    if (isIE) {
+      svgpicture = picture.getSVGDocument().getElementById("root");
+      while (svgpicture.childNodes.length()>5) 
+        svgpicture.removeChild(svgpicture.lastChild); 
+      svgpicture.setAttribute("width",width);
+      svgpicture.setAttribute("height",height);
+      doc = picture.getSVGDocument();
+    } else {
+      var qnode = document.createElementNS("http://www.w3.org/2000/svg","svg");
+      qnode.setAttribute("id",picture.getAttribute("id"));
+      qnode.setAttribute("style","display:inline; "+picture.getAttribute("style"));
+      qnode.setAttribute("width",picture.getAttribute("width"));
+      qnode.setAttribute("height",picture.getAttribute("height"));
+      if (picture.parentNode!=null)
+        picture.parentNode.replaceChild(qnode,picture);
+      else
+        svgpicture.parentNode.replaceChild(qnode,svgpicture);
+      svgpicture = qnode;
+      doc = document;
+      pointerpos = doc.getElementById("pointerpos");
+      if (pointerpos==null) {
+        pointerpos = myCreateElementSVG("circle");
+        pointerpos.setAttribute("id","pointerpos");
+        pointerpos.setAttribute("cx",0);
+        pointerpos.setAttribute("cy",0);
+        pointerpos.setAttribute("r",0.5);
+        pointerpos.setAttribute("fill","red");
+        svgpicture.appendChild(pointerpos);
+      }
+    }
+//  } else {
+//    svgpicture = picture;
+//    doc = document;
+//  }
+  svgpicture.setAttribute("xunitlength",xunitlength);
+  svgpicture.setAttribute("yunitlength",yunitlength);
+  svgpicture.setAttribute("xmin",xmin);
+  svgpicture.setAttribute("xmax",xmax);
+  svgpicture.setAttribute("ymin",ymin);
+  svgpicture.setAttribute("ymax",ymax);
+  svgpicture.setAttribute("ox",origin[0]);
+  svgpicture.setAttribute("oy",origin[1]);
+  var node = myCreateElementSVG("rect");
+  node.setAttribute("x","0");
+  node.setAttribute("y","0");
+  node.setAttribute("width",width);
+  node.setAttribute("height",height);
+  node.setAttribute("style","stroke-width:1;fill:white");
+  svgpicture.appendChild(node);
+  if (!isIE && picture.getAttribute("onmousemove")!=null) {
+    svgpicture.addEventListener("mousemove", mousemove_listener, true);
+    var st = picture.getAttribute("onmousemove");
+    svgpicture.addEventListener("mousemove", eval(st.slice(0,st.indexOf("("))), true);
+    node = myCreateElementSVG("polyline");
+    node.setAttribute("points","0,0 "+width+",0");
+    node.setAttribute("style","stroke:white; stroke-width:3");
+    node.addEventListener("mousemove", top_listener, true);
+    svgpicture.appendChild(node);
+    node = myCreateElementSVG("polyline");
+    node.setAttribute("points","0,"+height+" "+width+","+height);
+    node.setAttribute("style","stroke:white; stroke-width:3");
+    node.addEventListener("mousemove", bottom_listener, true);
+    svgpicture.appendChild(node);
+    node = myCreateElementSVG("polyline");
+    node.setAttribute("points","0,0 0,"+height);
+    node.setAttribute("style","stroke:white; stroke-width:3");
+    node.addEventListener("mousemove", left_listener, true);
+    svgpicture.appendChild(node);
+    node = myCreateElementSVG("polyline");
+    node.setAttribute("points",(width-1)+",0 "+(width-1)+","+height);
+    node.setAttribute("style","stroke:white; stroke-width:3");
+    node.addEventListener("mousemove", right_listener, true);
+    svgpicture.appendChild(node);
+  }
+  border = defaultborder;
+ }
+ }
+}
+
+
+function line(p,q,id) { // segment connecting points p,q (coordinates in units)
+  var node;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("path");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+  node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+
+    (height-p[1]*yunitlength-origin[1])+" "+
+    (q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));
+  node.setAttribute("stroke-width", strokewidth);
+  if (strokedasharray!=null) 
+    node.setAttribute("stroke-dasharray", strokedasharray);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+  if (marker=="dot" || marker=="arrowdot") {
+    ASdot(p,4,markerstroke,markerfill);
+    if (marker=="arrowdot") arrowhead(p,q);
+    ASdot(q,4,markerstroke,markerfill);
+  } else if (marker=="arrow") arrowhead(p,q);
+}
+
+
+function path(plist,id,c) {
+  if (c==null) c="";
+  var node, st, i;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("path");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+  if (typeof plist == "string") st = plist;
+  else {
+    st = "M";
+    st += (plist[0][0]*xunitlength+origin[0])+","+
+          (height-plist[0][1]*yunitlength-origin[1])+" "+c;
+    for (i=1; i<plist.length; i++)
+      st += (plist[i][0]*xunitlength+origin[0])+","+
+            (height-plist[i][1]*yunitlength-origin[1])+" ";
+  }
+  node.setAttribute("d", st);
+  node.setAttribute("stroke-width", strokewidth);
+  if (strokedasharray!=null) 
+    node.setAttribute("stroke-dasharray", strokedasharray);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+  if (marker=="dot" || marker=="arrowdot")
+    for (i=0; i<plist.length; i++)
+      if (c!="C" && c!="T" || i!=1 && i!=2)
+        ASdot(plist[i],4,markerstroke,markerfill);
+}
+
+
+function curve(plist,id) {
+  path(plist,id,"T");
+}
+
+
+function circle(center,radius,id) { // coordinates in units
+  var node;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("circle");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+
+  node.setAttribute("cx",center[0]*xunitlength+origin[0]);
+  node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
+  node.setAttribute("r",radius*xunitlength);
+  node.setAttribute("stroke-width", strokewidth);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+}
+
+
+function loop(p,d,id) { 
+// d is a direction vector e.g. [1,0] means loop starts in that direction
+  if (d==null) d=[1,0];
+  path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");
+  if (marker=="arrow" || marker=="arrowdot") 
+    arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],
+               p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);
+}
+
+
+function arc(start,end,radius,id) { // coordinates in units
+  var node, v;
+//alert([fill, stroke, origin, xunitlength, yunitlength, height])
+  if (id!=null) node = doc.getElementById(id);
+  if (radius==null) {
+    v=[end[0]-start[0],end[1]-start[1]];
+    radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);
+  }
+  if (node==null) {
+    node = myCreateElementSVG("path");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+  node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+
+    (height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+
+     radius*yunitlength+" 0 0,0 "+(end[0]*xunitlength+origin[0])+","+
+    (height-end[1]*yunitlength-origin[1]));
+  node.setAttribute("stroke-width", strokewidth);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+  if (marker=="arrow" || marker=="arrowdot") {
+    u = [(end[1]-start[1])/4,(start[0]-end[0])/4];
+    v = [(end[0]-start[0])/2,(end[1]-start[1])/2];
+//alert([u,v])
+    v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];
+  } else v=[start[0],start[1]];
+  if (marker=="dot" || marker=="arrowdot") {
+    ASdot(start,4,markerstroke,markerfill);
+    if (marker=="arrowdot") arrowhead(v,end);
+    ASdot(end,4,markerstroke,markerfill);
+  } else if (marker=="arrow") arrowhead(v,end);
+}
+
+
+function ellipse(center,rx,ry,id) { // coordinates in units
+
+  var node;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("ellipse");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+  node.setAttribute("cx",center[0]*xunitlength+origin[0]);
+  node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
+  node.setAttribute("rx",rx*xunitlength);
+  node.setAttribute("ry",ry*yunitlength);
+  node.setAttribute("stroke-width", strokewidth);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+}
+
+
+function rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii
+  var node;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("rect");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+  }
+  node.setAttribute("x",p[0]*xunitlength+origin[0]);
+  node.setAttribute("y",height-q[1]*yunitlength-origin[1]);
+  node.setAttribute("width",(q[0]-p[0])*xunitlength);
+  node.setAttribute("height",(q[1]-p[1])*yunitlength);
+  if (rx!=null) node.setAttribute("rx",rx*xunitlength);
+  if (ry!=null) node.setAttribute("ry",ry*yunitlength);
+  node.setAttribute("stroke-width", strokewidth);
+  node.setAttribute("stroke", stroke);
+  node.setAttribute("fill", fill);
+}
+
+function text(p,st,pos,angle) {
+	p[0] = p[0]*xunitlength+origin[0];
+	p[1] = p[1]*yunitlength+origin[1];
+	textabs(p,st,pos,angle);
+}
+
+function textabs(p,st,pos,angle,id,fontsty) {
+  if (angle==null) {
+	  angle = 0;
+  } else {
+	  angle = (360 - angle)%360;
+  }
+  var textanchor = "middle";
+  var dx=0; var dy=0;
+  if (angle==270) {
+	  var dy = 0; var dx = fontsize/3;
+	  if (pos!=null) {
+	    if (pos.match(/left/)) {dx = -fontsize/2;}
+	    if (pos.match(/right/)) {dx = fontsize-0;}
+	    if (pos.match(/above/)) {
+	      textanchor = "start";
+	      dy = -fontsize/2;
+	    }
+	    if (pos.match(/below/)) {
+	      textanchor = "end";
+	      dy = fontsize/2;
+	    }
+	  }
+  } 
+  if (angle==90) {
+	  var dy = 0; var dx = -fontsize/3;
+	  if (pos!=null) {
+	    if (pos.match(/left/)) dx = -fontsize-0;
+	    if (pos.match(/right/)) dx = fontsize/2;
+	    if (pos.match(/above/)) {
+	      textanchor = "end";
+	      dy = -fontsize/2;
+	    }
+	    if (pos.match(/below/)) {
+	      textanchor = "start";
+	      dy = fontsize/2;
+	    }
+	  }
+  }
+  if (angle==0) {
+	  var dx = 0; var dy = fontsize/3;
+	  if (pos!=null) {
+	    if (pos.match(/above/)) { dy = -fontsize/3; }
+	    if (pos.match(/below/)) { dy = fontsize-0; }
+	    if (pos.match(/right/)) {
+	      textanchor = "start";
+	      dx = fontsize/3;
+	    }
+	    if (pos.match(/left/)) {
+	      textanchor = "end";
+	      dx = -fontsize/3;
+	    }
+	  }
+  }
+ 
+  var node;
+  if (id!=null) node = doc.getElementById(id);
+  if (node==null) {
+    node = myCreateElementSVG("text");
+    node.setAttribute("id", id);
+    svgpicture.appendChild(node);
+    node.appendChild(doc.createTextNode(st));
+  }
+  node.lastChild.nodeValue = st;
+  node.setAttribute("x",p[0]+dx);
+  node.setAttribute("y",height-p[1]+dy);
+  if (angle != 0) {
+	  node.setAttribute("transform","rotate("+angle+" "+(p[0]+dx)+" "+(height-p[1]+dy)+")");
+  }
+  node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));
+  node.setAttribute("font-family",fontfamily);
+  node.setAttribute("font-size",fontsize);
+  node.setAttribute("font-weight",fontweight);
+  node.setAttribute("text-anchor",textanchor);
+  if (fontstroke!="none") node.setAttribute("stroke",fontstroke);
+  if (fontfill!="none") node.setAttribute("fill",fontfill);
+  node.setAttribute("stroke-width","0px");
+  if (fontbackground!="none") {
+	  var bgnode = myCreateElementSVG("rect");
+	  var bb = node.getBBox();
+	  bgnode.setAttribute("fill",fontbackground);
+	  bgnode.setAttribute("stroke-width","0px");
+	  bgnode.setAttribute("x",bb.x-2);
+	  bgnode.setAttribute("y",bb.y-2);
+	  bgnode.setAttribute("width",bb.width+4);
+	  bgnode.setAttribute("height",bb.height+4);
+	  if (angle != 0) {
+		   bgnode.setAttribute("transform","rotate("+angle+" "+(p[0]+dx)+" "+(height-p[1]+dy)+")");
+	  }
+	  svgpicture.insertBefore(bgnode,node);
+		  
+  }
+  return p;
+}
+
+
+function ASdot(center,radius,s,f) { // coordinates in units, radius in pixel
+  if (s==null) s = stroke; if (f==null) f = fill;
+  var node = myCreateElementSVG("circle");
+  node.setAttribute("cx",center[0]*xunitlength+origin[0]);
+  node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);
+  node.setAttribute("r",radius);
+  node.setAttribute("stroke-width", strokewidth);
+  node.setAttribute("stroke", s);
+  node.setAttribute("fill", f);
+  svgpicture.appendChild(node);
+}
+
+
+function dot(center, typ, label, pos, id) {
+  var node;
+  var cx = center[0]*xunitlength+origin[0];
+  var cy = height-center[1]*yunitlength-origin[1];
+  if (id!=null) node = doc.getElementById(id);
+  if (typ=="+" || typ=="-" || typ=="|") {
+    if (node==null) {
+      node = myCreateElementSVG("path");
+      node.setAttribute("id", id);
+      svgpicture.appendChild(node);
+    }
+    if (typ=="+") {
+      node.setAttribute("d",
+        " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+
+        " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));
+      node.setAttribute("stroke-width", .5);
+      node.setAttribute("stroke", axesstroke);
+    } else {
+      if (typ=="-") node.setAttribute("d",
+        " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);
+      else node.setAttribute("d",
+        " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));
+      node.setAttribute("stroke-width", strokewidth);
+      node.setAttribute("stroke", stroke);
+    }
+  } else {
+    if (node==null) {
+      node = myCreateElementSVG("circle");
+      node.setAttribute("id", id);
+      svgpicture.appendChild(node);
+    }
+    node.setAttribute("cx",cx);
+    node.setAttribute("cy",cy);
+    node.setAttribute("r",dotradius);
+    node.setAttribute("stroke-width", strokewidth);
+    node.setAttribute("stroke", stroke);
+    node.setAttribute("fill", (typ=="open"?"white":stroke));
+  }
+  if (label!=null) 
+    text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))
+}
+
+
+function arrowhead(p,q) { // draw arrowhead at q (in units)
+  var up;
+  var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];
+  var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];
+  var u = [w[0]-v[0],w[1]-v[1]];
+  var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);
+  if (d > 0.00000001) {
+    u = [u[0]/d, u[1]/d];
+    up = [-u[1],u[0]];
+    var node = myCreateElementSVG("path");
+    node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+
+      (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+
+      (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");
+    node.setAttribute("stroke-width", markerstrokewidth);
+    node.setAttribute("stroke", stroke); /*was markerstroke*/
+    node.setAttribute("fill", stroke); /*was arrowfill*/
+    svgpicture.appendChild(node);    
+  }
+}
+
+
+function chopZ(st) {
+  var k = st.indexOf(".");
+  if (k==-1) return st;
+  for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--);
+  if (i==k) i--;
+  return st.slice(0,i+1);
+}
+
+
+function grid(dx,dy) { // for backward compatibility
+  axes(dx,dy,null,dx,dy)
+}
+
+
+function noaxes() {
+  if (!initialized) initPicture();
+}
+
+
+function axes(dx,dy,labels,gdx,gdy,dox,doy) {
+//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;
+  var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;
+  if (!initialized) initPicture();
+  if (typeof dx=="string") { labels = dx; dx = null; }
+  if (typeof dy=="string") { gdx = dy; dy = null; }
+  if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx}
+  if (yscl!=null) {dy = yscl; gdy = yscl}
+  if (xtick!=null) {dx = xtick}
+  if (ytick!=null) {dy = ytick}
+  if (dox==null) {dox = true;}
+  if (doy==null) {doy = true;}
+  if (dox=="off" || dox==0) { dox = false;} else {dox = true;}
+  if (doy=="off" || doy==0) { doy = false;} else {doy = true;}
+//alert(null)
+  dx = (dx==null?xunitlength:dx*xunitlength);
+  dy = (dy==null?dx:dy*yunitlength);
+  fontsize = Math.floor(Math.min(dx/1.5,dy/1.5,16));//alert(fontsize)
+  ticklength = fontsize/4;
+  if (xgrid!=null) gdx = xgrid;
+  if (ygrid!=null) gdy = ygrid;
+  if (gdx!=null) {
+    gdx = (typeof gdx=="string"?dx:gdx*xunitlength);
+    gdy = (gdy==null?dy:gdy*yunitlength);
+    pnode = myCreateElementSVG("path");
+    st="";
+    if (dox && gdx>0) {
+	    for (x = origin[0]; x<=winxmax; x = x+gdx)
+	      if (x>=winxmin) st += " M"+x+","+winymin+" "+x+","+winymax;
+	    for (x = origin[0]-gdx; x>=winxmin; x = x-gdx)
+	      if (x<=winxmax) st += " M"+x+","+winymin+" "+x+","+winymax;
+    }
+    if (doy && gdy>0) {
+	    for (y = height-origin[1]; y<=winymax; y = y+gdy)
+	      if (y>=winymin) st += " M"+winxmin+","+y+" "+winxmax+","+y;
+	    for (y = height-origin[1]-gdy; y>=winymin; y = y-gdy)
+	      if (y<=winymax) st += " M"+winxmin+","+y+" "+winxmax+","+y;
+    }
+    pnode.setAttribute("d",st);
+    pnode.setAttribute("stroke-width", .5);
+    pnode.setAttribute("stroke", gridstroke);
+    pnode.setAttribute("fill", fill);
+    svgpicture.appendChild(pnode);
+  }
+  pnode = myCreateElementSVG("path");
+  if (dox) {
+	  st="M"+winxmin+","+(height-origin[1])+" "+winxmax+","+
+    (height-origin[1]);
+  }
+  if (doy) {
+	  st += " M"+origin[0]+","+winymin+" "+origin[0]+","+winymax;
+  }
+  if (dox) {
+	  for (x = origin[0]; x<winxmax; x = x+dx)
+	    if (x>=winymin) st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
+		   (height-origin[1]-ticklength);
+	  for (x = origin[0]-dx; x>winxmin; x = x-dx)
+	   if (x<=winxmax) st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+
+		   (height-origin[1]-ticklength);
+  }
+  if (doy) {
+	  for (y = height-origin[1]; y<winymax; y = y+dy)
+	    if (y>=winymin) st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;
+	  for (y = height-origin[1]-dy; y>winymin; y = y-dy)
+	    if (y<=winymax) st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;
+  }
+  if (labels!=null) with (Math) {
+    ldx = dx/xunitlength;
+    ldy = dy/yunitlength;
+    lx = (xmin>0 || xmax<0?xmin:0);
+    ly = (ymin>0 || ymax<0?ymin:0);
+    lxp = (ly==0?"below":"above");
+    lyp = (lx==0?"left":"right");
+    var ddx = floor(1.1-log(ldx)/log(10))+1;
+    var ddy = floor(1.1-log(ldy)/log(10))+1;
+    if (ddy<0) { ddy = 0;}
+    if (ddx<0) { ddx = 0;}
+    if (dox) {
+	    for (x = (doy?ldx:0); x<=xmax; x = x+ldx)
+	      if (x>=xmin) text([x,ly],chopZ(x.toFixed(ddx)),lxp);
+	    for (x = -ldx; xmin<=x; x = x-ldx)
+	      if (x<=xmax) text([x,ly],chopZ(x.toFixed(ddx)),lxp);
+    }
+    if (doy) {
+	    for (y = (dox?ldy:0); y<=ymax; y = y+ldy)
+	      if (y>=ymin) text([lx,y],chopZ(y.toFixed(ddy)),lyp);
+	    for (y = -ldy; ymin<=y; y = y-ldy)
+	      if (y<=ymax) text([lx,y],chopZ(y.toFixed(ddy)),lyp);
+    }
+  }
+  pnode.setAttribute("d",st);
+  pnode.setAttribute("stroke-width", .5);
+  pnode.setAttribute("stroke", axesstroke);
+  pnode.setAttribute("fill", fill);
+  svgpicture.appendChild(pnode);
+}
+
+function safepow(base,power) {
+	if (base<0 && Math.floor(power)!=power) {
+		for (var j=3; j<50; j+=2) {
+			if (Math.abs(Math.round(j*power)-(j*power))<.000001) {
+				if (Math.round(j*power)%2==0) {
+					return Math.pow(Math.abs(base),power);
+				} else {
+					return -1*Math.pow(Math.abs(base),power);
+				}
+			}
+		}
+		return sqrt(-1);
+	} else {
+		return Math.pow(base,power);
+	}
+}
+
+function nthroot(n,base) {
+	return safepow(base,1/n);
+}
+function nthlogten(n,v) {
+	return ((Math.log(v))/(Math.log(n)));
+}
+function matchtolower(match) {
+	return match.toLowerCase();
+}
+
+function mathjs(st,varlist) {
+  //translate a math formula to js function notation
+  // a^b --> pow(a,b)
+  // na --> n*a
+  // (...)d --> (...)*d
+  // n! --> factorial(n)
+  // sin^-1 --> arcsin etc.
+  //while ^ in string, find term on left and right
+  //slice and concat new formula string
+  //parenthesizes the function variables
+  st = st.replace("[","(");
+  st = st.replace("]",")");
+  st = st.replace(/arc(sin|cos|tan)/g,"a#r#c $1");
+  if (varlist != null) {
+	  var reg = new RegExp("(sqrt|ln|log|sin|cos|tan|sec|csc|cot|abs)[\(]","g");
+	  st = st.replace(reg,"$1#(");
+	  var reg = new RegExp("("+varlist+")("+varlist+")$","g");
+	  st = st.replace(reg,"($1)($2)");
+	  var reg = new RegExp("("+varlist+")(a#|sqrt|ln|log|sin|cos|tan|sec|csc|cot|abs)","g");
+	  st = st.replace(reg,"($1)$2");
+	  var reg = new RegExp("("+varlist+")("+varlist+")([^a-df-zA-Z\(#])","g"); // 6/1/09 readded \( for f(350/x)
+	  st = st.replace(reg,"($1)($2)$3"); //get xy3
+	  //var reg = new RegExp("("+varlist+")("+varlist+")(\w*[^\(#])","g");
+	  //st = st.replace(reg,"($1)($2)$3"); //get xysin
+	  var reg = new RegExp("([^a-df-zA-Z#])("+varlist+")([^a-df-zA-Z#])","g");
+	  st = st.replace(reg,"$1($2)$3");	  
+	  var reg = new RegExp("^("+varlist+")([^a-df-zA-Z])","g");
+	  st = st.replace(reg,"($1)$2");
+	  var reg = new RegExp("([^a-df-zA-Z])("+varlist+")$","g");
+	  st = st.replace(reg,"$1($2)");
+  }
+  st = st.replace(/#/g,"");
+  st = st.replace(/a#r#c\s+(sin|cos|tan)/g,"arc$1");
+  st = st.replace(/\s/g,"");
+  st = st.replace(/(Sin|Cos|Tan|Sec|Csc|Cot|Arc|Abs|Log|Ln)/g, matchtolower);
+  st = st.replace(/log_(\d+)\(/,"nthlog($1,");
+  st = st.replace(/log/g,"logten");
+  
+  if (st.indexOf("^-1")!=-1) {
+    st = st.replace(/sin\^-1/g,"arcsin");
+    st = st.replace(/cos\^-1/g,"arccos");
+    st = st.replace(/tan\^-1/g,"arctan");
+    st = st.replace(/sec\^-1/g,"arcsec");
+    st = st.replace(/csc\^-1/g,"arccsc");
+    st = st.replace(/cot\^-1/g,"arccot");
+    st = st.replace(/sinh\^-1/g,"arcsinh");
+    st = st.replace(/cosh\^-1/g,"arccosh");
+    st = st.replace(/tanh\^-1/g,"arctanh");
+    st = st.replace(/sech\^-1/g,"arcsech");
+    st = st.replace(/csch\^-1/g,"arccsch");
+    st = st.replace(/coth\^-1/g,"arccoth");
+  }
+  
+  st = st.replace(/root\((\d+)\)\(/,"nthroot($1,");
+  //st = st.replace(/E/g,"(EE)");
+  st = st.replace(/([0-9])E([\-0-9])/g,"$1(EE)$2");
+  
+  st = st.replace(/^e$/g,"(E)");
+  st = st.replace(/pi/g,"(pi)");
+  st = st.replace(/^e([^a-zA-Z])/g,"(E)$1");
+  st = st.replace(/([^a-zA-Z])e$/g,"$1(E)");
+  
+  st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(E)$2");
+  st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");
+  st = st.replace(/(!)([0-9\(])/g,"$1*$2");
+  //want to keep scientific notation
+  st= st.replace(/([0-9])\*\(EE\)([\-0-9])/,"$1e$2");
+
+  
+  st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");
+  
+  var i,j,k, ch, nested;
+  while ((i=st.indexOf("^"))!=-1) {
+
+    //find left argument
+    if (i==0) return "Error: missing argument";
+    j = i-1;
+    ch = st.charAt(j);
+    if (ch>="0" && ch<="9") {// look for (decimal) number
+      j--;
+      while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
+      if (ch==".") {
+        j--;
+        while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
+      }
+    } else if (ch==")") {// look for matching opening bracket and function name
+      nested = 1;
+      j--;
+      while (j>=0 && nested>0) {
+        ch = st.charAt(j);
+        if (ch=="(") nested--;
+        else if (ch==")") nested++;
+        j--;
+      }
+      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
+        j--;
+    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
+      j--;
+      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
+        j--;
+    } else { 
+      return "Error: incorrect syntax in "+st+" at position "+j;
+    }
+    //find right argument
+    if (i==st.length-1) return "Error: missing argument";
+    k = i+1;
+    ch = st.charAt(k);
+    nch = st.charAt(k+1);
+    if (ch>="0" && ch<="9" || (ch=="-" && nch!="(") || ch==".") {// look for signed (decimal) number
+      k++;
+      while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
+      if (ch==".") {
+        k++;
+        while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;
+      }
+    } else if (ch=="(" || (ch=="-" && nch=="(")) {// look for matching closing bracket and function name
+      if (ch=="-") { k++;}
+      nested = 1;
+      k++;
+      while (k<st.length && nested>0) {
+        ch = st.charAt(k);
+        if (ch=="(") nested++;
+        else if (ch==")") nested--;
+        k++;
+      }
+    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
+      k++;
+      while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" ||
+               ch>="A" && ch<="Z") k++;
+      if (ch=='(' && st.slice(i+1,k).match(/^(sin|cos|tan|sec|csc|cot|logten|log|ln|exp|arcsin|arccos|arctan|arcsec|arccsc|arccot|sinh|cosh|tanh|sech|csch|coth|arcsinh|arccosh|arctanh|arcsech|arccsch|arccoth|sqrt|abs|nthroot)$/)) {
+	      nested = 1;
+	      k++;
+	      while (k<st.length && nested>0) {
+		ch = st.charAt(k);
+		if (ch=="(") nested++;
+		else if (ch==")") nested--;
+		k++;
+	      }
+      }
+    } else { 
+      return "Error: incorrect syntax in "+st+" at position "+k;
+    }
+    st = st.slice(0,j+1)+"safepow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+
+           st.slice(k);
+  }
+  while ((i=st.indexOf("!"))!=-1) {
+    //find left argument
+    if (i==0) return "Error: missing argument";
+    j = i-1;
+    ch = st.charAt(j);
+    if (ch>="0" && ch<="9") {// look for (decimal) number
+      j--;
+      while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
+      if (ch==".") {
+        j--;
+        while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;
+      }
+    } else if (ch==")") {// look for matching opening bracket and function name
+      nested = 1;
+      j--;
+      while (j>=0 && nested>0) {
+        ch = st.charAt(j);
+        if (ch=="(") nested--;
+        else if (ch==")") nested++;
+        j--;
+      }
+      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
+        j--;
+    } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable
+      j--;
+      while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")
+        j--;
+    } else { 
+      return "Error: incorrect syntax in "+st+" at position "+j;
+    }
+    st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);
+  }
+  return st;
+}
+
+
+function slopefield(fun,dx,dy) {
+  var g = fun;
+  if (typeof fun=="string") 
+    eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");
+  var gxy,x,y,u,v,dz;
+  if (dx==null) dx=1;
+  if (dy==null) dy=1;
+  dz = Math.sqrt(dx*dx+dy*dy)/6;
+  var x_min = Math.ceil(xmin/dx);
+  var y_min = Math.ceil(ymin/dy);
+  for (x = x_min; x <= xmax; x += dx)
+    for (y = y_min; y <= ymax; y += dy) {
+      gxy = g(x,y);
+      if (!isNaN(gxy)) {
+        if (Math.abs(gxy)=="Infinity") {u = 0; v = dz;}
+        else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;}
+        line([x-u,y-v],[x+u,y+v]);
+      }
+    }
+}
+
+
+//ASCIIsvgAddon.js dumped here
+function drawPictures() {
+	drawPics()
+}
+
+//ShortScript format:
+//xmin,xmax,ymin,ymax,xscl,yscl,labels,xgscl,ygscl,width,height plotcommands(see blow)
+//plotcommands: type,eq1,eq2,startmaker,endmarker,xmin,xmax,color,strokewidth,strokedash
+function parseShortScript(sscript,gw,gh) {
+	if (sscript == null) {
+		initialized = false;
+		sscript = picture.sscr;
+	}
+	
+	var sa= sscript.split(",");
+	
+	if (gw && gh) {
+		sa[9] = gw;
+		sa[10] = gh;
+		sscript = sa.join(",");
+		picture.setAttribute("sscr", sscript);
+	}
+	picture.setAttribute("width", sa[9]);
+	picture.setAttribute("height", sa[10]);
+	picture.style.width = sa[9] + "px";
+	picture.style.height = sa[10] + "px";
+	
+	if (sa.length > 10) {
+		commands = 'setBorder(5);';
+		commands += 'width=' +sa[9] + '; height=' +sa[10] + ';';
+		commands += 'initPicture(' + sa[0] +','+ sa[1] +','+ sa[2] +','+ sa[3] + ');';
+		commands += 'axes(' + sa[4] +','+ sa[5] +','+ sa[6] +','+ sa[7] +','+ sa[8]+ ');';
+				
+		var inx = 11;
+		var eqnlist = 'Graphs: ';
+		
+		while (sa.length > inx+9) {
+		   commands += 'stroke="' + sa[inx+7] + '";';
+		   commands += 'strokewidth="' + sa[inx+8] + '";'
+		   //commands += 'strokedasharray="' + sa[inx+9] + '";'	
+		   if (sa[inx+9] != "") {
+			   commands += 'strokedasharray="' + sa[inx+9].replace(/\s+/g,',') + '";';
+		   }
+		   if (sa[inx]=="slope") {
+			   eqnlist += "dy/dx="+sa[inx+1] + "; ";
+			commands += 'slopefield("' + sa[inx+1] + '",' + sa[inx+2] + ',' + sa[inx+2] + ');'; 
+		   } else {
+			if (sa[inx]=="func") {
+				eqnlist += "y="+sa[inx+1] + "; ";
+				eqn = '"' + sa[inx+1] + '"';
+			} else if (sa[inx] == "polar") {
+				eqnlist += "r="+sa[inx+1] + "; ";
+				eqn = '["cos(t)*(' + sa[inx+1] + ')","sin(t)*(' + sa[inx+1] + ')"]';
+			} else if (sa[inx] == "param") {
+				eqnlist += "[x,y]=["+sa[inx+1] + "," + sa[inx+2] + "]; ";
+				eqn = '["' + sa[inx+1] + '","'+ sa[inx+2] + '"]';
+			}
+			
+			
+			if (typeof eval(sa[inx+5]) == "number") {
+		//	if ((sa[inx+5]!='null')&&(sa[inx+5].length>0)) {
+				//commands += 'myplot(' + eqn +',"' + sa[inx+3] +  '","' + sa[inx+4]+'",' + sa[inx+5] + ',' + sa[inx+6]  +');';
+				commands += 'plot(' + eqn +',' + sa[inx+5] + ',' + sa[inx+6] +',null,null,' + sa[inx+3] +  ',' + sa[inx+4] +');';
+			
+			} else {
+				commands += 'plot(' + eqn +',null,null,null,null,' + sa[inx+3] +  ',' + sa[inx+4]+');';
+			}
+		   }
+		   inx += 10;
+		}
+		
+		try {
+			eval(commands);
+		} catch (e) {
+			setTimeout(function() {parseShortScript(sscript,gw,gh)},100);
+			//alert("Graph not ready");
+		}
+		
+		picture.setAttribute("alt",eqnlist);
+		//picture.setAttribute("width", sa[9]);
+		//picture.setAttribute("height", sa[9]);
+		
+		return commands;
+	}
+}
+
+
+
+
+function drawPics() {
+  var index, nd;
+  pictures = document.getElementsByTagName("embed");
+ // might be needed if setTimeout on parseShortScript isn't working
+  if (!ASnoSVG) {
+	   try {
+		  for (var i = 0; i < pictures.length; i++) {
+			  if (pictures[i].getAttribute("sscr")!='' || pictures[i].getAttribute("script")!='') {
+				  if (pictures[i].getSVGDocument().getElementById("root") == null) {
+					setTimeout(drawPics,100);
+					return;
+				  }
+			  }
+		  }
+	  } catch (e) {
+		  setTimeout(drawPics,100);
+		  return;
+	  }
+ }
+  var len = pictures.length;
+  
+  
+  for (index = 0; index < len; index++) {
+	  picture = ((!ASnoSVG && isIE) ? pictures[index] : pictures[0]);
+   // for (index = len-1; index >=0; index--) {
+	//  picture = pictures[index];
+	  
+	  if (!ASnoSVG) {
+		  initialized = false;
+		  var sscr = picture.getAttribute("sscr");
+		  if ((sscr != null) && (sscr != "")) { //sscr from editor
+			  try {
+				  parseShortScript(sscr);
+			  } catch (e) {}
+		  } else {
+			  src = picture.getAttribute("script"); //script from showplot
+			  if ((src!=null) && (src != "")) {
+				  try {
+					  with (Math) eval(src);
+				  } catch(err) {alert(err+"\n"+src)}
+			  }
+		  }
+	  } else {
+		  if (picture.getAttribute("sscr")!='') {
+			  n = document.createElement('img');
+			  n.setAttribute("style",picture.getAttribute("style"));
+			  n.setAttribute("src",AScgiloc+'?sscr='+encodeURIComponent(picture.getAttribute("sscr")));
+			  pn = picture.parentNode;
+			  pn.replaceChild(n,picture);
+		  }
+		  
+	  }
+	  
+  }
+}
+
+//modified by David Lippman from original in AsciiSVG.js by Peter Jipsen
+//added min/max type:  0:nothing, 1:arrow, 2:open dot, 3:closed dot
+function plot(fun,x_min,x_max,points,id,min_type,max_type) {
+  var pth = [];
+  var f = function(x) { return x }, g = fun;
+  var name = null;
+  if (typeof fun=="string") 
+    eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");
+  else if (typeof fun=="object") {
+    eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");
+    eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");
+  }
+  if (typeof x_min=="string") { name = x_min; x_min = xmin }
+  else name = id;
+  var min = (x_min==null?xmin:x_min);
+  var max = (x_max==null?xmax:x_max);
+  if (max <= min) { return null;}
+  //else {
+  var inc = max-min-0.000001*(max-min);
+  inc = (points==null?inc/200:inc/points);
+  var gt;
+//alert(typeof g(min))
+  for (var t = min; t <= max; t += inc) {
+    gt = g(t);
+    if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt];
+  }
+  path(pth,name);
+  if (min_type == 1) {
+	arrowhead(pth[1],pth[0]);
+  } else if (min_type == 2) {
+	dot(pth[0], "open");
+  } else if (min_type == 3) {
+	dot(pth[0], "closed");
+  }
+  if (max_type == 1) {
+	arrowhead(pth[pth.length-2],pth[pth.length-1]);
+  } else if (max_type == 2) {
+	dot(pth[pth.length-1], "open");
+  } else if (max_type == 3) {
+	dot(pth[pth.length-1], "closed");
+  }
+
+  return p;
+  //}
+}
+
+//end ASCIIsvgAddon.js dump
+
+function updateCoords(ind) {
+  switchTo("picture"+(ind+1));
+  var gx=getX(), gy=getY();
+  if ((xmax-gx)*xunitlength > 6*fontsize || (gy-ymin)*yunitlength > 2*fontsize)
+    text([xmax,ymin],"("+gx.toFixed(2)+", "+gy.toFixed(2)+")",
+         "aboveleft","AScoord"+ind,"");
+  else text([xmax,ymin]," ","aboveleft","AScoord"+ind,"");
+}
+
+
+function updateCoords0() {updateCoords(0)}
+function updateCoords1() {updateCoords(1)}
+function updateCoords2() {updateCoords(2)}
+function updateCoords3() {updateCoords(3)}
+function updateCoords4() {updateCoords(4)}
+function updateCoords5() {updateCoords(5)}
+function updateCoords6() {updateCoords(6)}
+function updateCoords7() {updateCoords(7)}
+function updateCoords8() {updateCoords(8)}
+function updateCoords9() {updateCoords(9)}
+ASfn = [function() {updatePicture(0)},
+  function() {updatePicture(1)},
+  function() {updatePicture(2)},
+  function() {updatePicture(3)},
+  function() {updatePicture(4)},
+  function() {updatePicture(5)},
+  function() {updatePicture(6)},
+  function() {updatePicture(7)},
+
+  function() {updatePicture(8)},
+  function() {updatePicture(9)}];
+ASupdateCoords = [function() {updateCoords(0)},
+  function() {updateCoords(1)},
+  function() {updateCoords(2)},
+  function() {updateCoords(3)},
+  function() {updateCoords(4)},
+  function() {updateCoords(5)},
+  function() {updateCoords(6)},
+  function() {updateCoords(7)},
+  function() {updateCoords(8)},
+  function() {updateCoords(9)}];
+
+
+// GO1.1 Generic onload by Brothercake 
+// http://www.brothercake.com/
+//onload function
+function generic()
+{
+  drawPictures();
+};
+//setup onload function
+if(typeof window.addEventListener != 'undefined')
+{
+  //.. gecko, safari, konqueror and standard
+  window.addEventListener('load', generic, false);
+}
+else if(typeof document.addEventListener != 'undefined')
+{
+  //.. opera 7
+  document.addEventListener('load', generic, false);
+}
+else if(typeof window.attachEvent != 'undefined')
+{
+  //.. win/ie
+  window.attachEvent('onload', generic);
+}
+//** remove this condition to degrade older browsers
+else
+{
+  //.. mac/ie5 and anything else that gets this far
+  //if there's an existing onload function
+  if(typeof window.onload == 'function')
+  {
+    //store it
+    var existing = onload;
+    //add new onload handler
+    window.onload = function()
+    {
+      //call existing onload function
+      existing();
+      //call generic onload function
+      generic();
+    };
+  }
+  else
+  {
+    //setup onload function
+    window.onload = generic;
+  }
+}
+
+
+if (checkIfSVGavailable) {
+  checkifSVGavailable = false;
+  nd = isSVGavailable();
+  ASnoSVG = nd!=null;
+}

+ 8 - 0
main/inc/lib/fckeditor/editor/plugins/asciisvg/d.svg

@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg id="root" xml:space="preserve" width="100%" height="100%"
+  preserveAspectRatio="xMidYMid meet"
+  xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http:///www.w3.org/1999/xlink">
+</svg>

+ 84 - 2
main/inc/lib/fckeditor/editor/plugins/asciisvg/fck_asciisvg.html

@@ -2,7 +2,7 @@
 <!--
  *  Chamilo LMS
  *
- *  Copyright (c) 2010 Ivan Tcholakov <ivantcholakov@gmail.com>
+ *  Copyright (c) 2011 Ivan Tcholakov <ivantcholakov@gmail.com>
  *
  *  License:
  *  GNU Lesser General Public License, Version 3, 29 June 2007
@@ -15,7 +15,8 @@
         <meta name="robots" content="noindex, nofollow" />
 
         <script type="text/javascript">
-document.write( '<scr' + 'ipt type="text/javascript" src="' + window.parent.frameElement._DialogArguments.Editor.FCKConfig.ScriptASCIIMathML + '"><\/scr' + 'ipt>' ) ;
+//document.write( '<scr' + 'ipt type="text/javascript" src="' + window.parent.frameElement._DialogArguments.Editor.FCKConfig.ScriptASCIIMathML + '"><\/scr' + 'ipt>' ) ;
+document.write( '<scr' + 'ipt type="text/javascript" src="ASCIIsvgPI.js"><\/scr' + 'ipt>' ) ;
         </script>
 
         <script src="../../dialog/common/fck_dialog_common.js" type="text/javascript"></script>
@@ -36,5 +37,86 @@ form p { margin-top: 5px; margin-bottom: 5px; }
     </head>
 <body scroll="no" style="overflow: hidden;">
 
+Equation type: <select id="eqntype" onchange="javascript: AsciisvgDialog.changetype();">
+<option value="func">y=f(x)</option>
+<option value="polar">r=f(t)</option>
+<option value="param">x=f(t),y=g(t)</option>
+<option value="slope">dy/dx = f(x,y)</option>
+</select>
+&nbsp;&nbsp;&nbsp;
+<span id="eq1lbl">f(x)=</span> <input type="text" id="equation" size="15" value="sin(x)"/> <span id="eq2lbl"><i></i></span><span id="eq2"><i></i></span>
+&nbsp;from <input type="text" id="xstart" size="4" value=""/> to <input type="text" id="xend" size="4" value=""/>
+<hr/>
+
+Color: <Select id="gcolor">
+    <option value="black">Black</option>
+    <option value="red">Red</option>
+    <option value="orange">Orange</option>
+    <option value="yellow">Yellow</option>
+    <option value="green">Green</option>
+    <option value="blue">Blue</option>
+    <option value="purple">Purple</option>
+</select>
+Width: <Select id="strokewidth">
+    <option value="1">1</option>
+    <option value="2">2</option>
+    <option value="3">3</option>
+    <option value="4">4</option>
+</select>
+Line: <Select id="strokedash">
+    <option value="none">Solid</option>
+    <option value="2">Dotted</option>
+    <option value="5">Dashed</option>
+    <option value="5 2">Tight Dash</option>
+    <option value="7 3 2 3">Dash-Dot</option>
+</select>
+
+Start with: <Select id="gstart">
+    <option value="none">Nothing</option>
+    <option value="arrow">Arrow</option>
+    <option value="opendot">Open Dot</option>
+    <option value="dot">Dot</option>
+</select>
+End with: <Select id="gend">
+    <option value="none">Nothing</option>
+    <option value="arrow">Arrow</option>
+    <option value="opendot">Open Dot</option>
+    <option value="dot">Dot</option>
+</select>
+
+<hr/>
+
+xmin: <input type="text" id="xmin" size="4" value="-7.5" onChange='javascript: UpdatePreview();'/>
+xmax: <input type="text" id="xmax" size="4" value="7.5" onChange='javascript: UpdatePreview();'/>
+xscl: <input type="text" id="xscl" size="3" value="1" onChange='javascript: UpdatePreview();'/>
+&nbsp;&nbsp;
+ymin: <input type="text" id="ymin" size="4" value="-5" onChange='javascript: UpdatePreview();'/>
+ymax: <input type="text" id="ymax" size="4" value="5" onChange='javascript: UpdatePreview();'/>
+yscl: <input type="text" id="yscl" size="3" value="1" onChange='javascript: UpdatePreview();'/>
+<hr/>
+
+Show axis labels: <input type="checkbox" id="labels" value="Show Labels" onClick='javascript: UpdatePreview();' checked="checked"/>
+Show XY grid: <input type="checkbox" id="grid" value="Show Grid" onClick='javascript: UpdatePreview();' checked="checked"/>
+&nbsp;&nbsp;
+Resize to: <input type="text" id="gwidth" size="5" value="300"/> by <input type="text" id="gheight" size="5" value="200"/>
+<input type="button" value="Update" onclick="javascript: UpdatePreview();"/>
+<hr/>
+
+<input type="button" value="Add Graph" onclick="javascript: AsciisvgDialog.addgraph();"/>
+Graphs: <select id="graphs" onchange="javascript: AsciisvgDialog.loadeqn();"></select>
+<input type="button" value="Replace Selected Graph" onclick="javascript: AsciisvgDialog.replacegraph();"/>
+<input type="button" value="Remove" onclick="javascript: AsciisvgDialog.removegraph();"/>
+<select id="alignment" onchange="javascript: UpdatePreview();">
+<option value="text-top">Top</option>
+<option value="middle">Middle</option>
+<option value="text-bottom">Bottom</option>
+<option value="left">Float left</option>
+<option value="right">Float right</option>
+</select>
+
+<hr/>
+
+<div id="preview"><embed id="previewsvg" type="image/svg+xml" src="d.svg" style="width: 300px; height: 200px; vertical-align: middle; float: none;" sscr="-7.5,7.5,-5,5,1,1,1,1,1,300,200" /></div>
+
 </body>
 </html>

+ 433 - 4
main/inc/lib/fckeditor/editor/plugins/asciisvg/fck_asciisvg.js

@@ -32,18 +32,28 @@ var alertIfNoMathML = false ;
 var notifyIfNoSVG = false ;
 var alertIfNoSVG = false ;
 // Formula translation will be called explicitly in this dialog after it loads.
-var translateOnLoad = false ;
+//var translateOnLoad = false ;
+var translateOnLoad = true ;
+//
 // Formula tooltips are hard-coded in this dialog, there is no need they to be generated.
 var showasciiformulaonhover = false ;
 // Font size of the formulas in this dialog.
 var mathfontsize = "1.1em" ;
 
+var noSVG = ASnoSVG ; // Temporarily added.
+var width = 300 ;
+var height = 200 ;
+var alignm = 'middle' ;
+//var sscr = '' ;
+var sscr = '-7.5,7.5,-5,5,1,1,1,1,1,300,200' ;
+//var isnew = null ;
+var isnew = true ;
 
 function LoadSelection()
 {
     // ...
 
-    Preview() ;
+    UpdatePreview() ;
 }
 
 function Ok()
@@ -59,15 +69,434 @@ window.onload = function()
     oEditor.FCKLanguageManager.TranslatePage( document ) ;
 
     // Initialization of the script ASCIIMathML.js.
-    init() ;
+    //init() ;
+
+    // Initialization of the dialog's script.
+    AsciisvgDialog.init() ;
 
     // Load the selected element information (if any).
-    //LoadSelection() ;
+    LoadSelection() ;
 
     dialog.SetAutoSize( true ) ;
 
     // Activate the "OK" button.
     dialog.SetOkButton( true ) ;
+}
 
+function LoadSelection()
+{
+    UpdatePreview() ;
+}
+
+function UpdatePreview()
+{
+    AsciisvgDialog.graphit() ;
 }
 
+
+
+//tinyMCEPopup.requireLangPack();
+
+var AsciisvgDialog =
+{
+    width: 300 ,
+    height: 200 ,
+    alignm: 'middle' ,
+    //sscr: '' ,
+    sscr: '-7.5,7.5,-5,5,1,1,1,1,1,300,200' ,
+    //isnew: null ,
+    isnew: true ,
+
+    init : function()
+    {
+        //var f = document.forms[ 0 ] ;
+
+        // Get the selected contents as text and place it in the input.
+        /*
+        this.width = tinyMCEPopup.getWindowArg( 'width' ) ;
+        this.height = tinyMCEPopup.getWindowArg( 'height' ) ;
+        this.isnew = tinyMCEPopup.getWindowArg( 'isnew' ) ;
+        this.sscr = tinyMCEPopup.getWindowArg( 'sscr' ) ;
+        this.AScgiloc = tinyMCEPopup.getWindowArg( 'AScgiloc' ) ;
+        this.alignm = tinyMCEPopup.getWindowArg( 'alignm' ) ;
+        */
+
+        if ( noSVG )
+        {
+            GetE( 'preview' ).innerHTML = '<img id="previewimg" style="width:' + this.width + 'px; height: ' + this.height + 'px; vertical-align: middle; float: none;" src="' + AScgiloc + '?sscr=' + encodeURIComponent( this.sscr ) + '" script=" " />' ;
+        }
+        else
+        {
+            //GetE( 'preview' ).innerHTML = '<embed id="previewsvg" type="image/svg+xml" src="' + FCKConfig.DrawingASCIISVG + '" style="width: 300px; height: 200px; vertical-align: middle; float: none;" sscr="-7.5,7.5,-5,5,1,1,1,1,1,300,200" />' ;
+            GetE( 'previewsvg' ).setAttribute( 'sscr' , this.sscr );
+        }
+        this.getsscr( this.sscr ) ;
+    } ,
+
+    insert : function()
+    {
+        ed = tinyMCEPopup.editor ;
+        // Insert the contents from the input into the document.
+        if ( this.isnew )
+        {
+            if ( this.alignm == 'left' || this.alignm == 'right' )
+            {
+                aligntxt = 'vertical-align: middle; float: ' + this.alignm + ';' ;
+            }
+            else
+            {
+                aligntxt = 'vertical-align: ' + this.alignm + '; float: none;' ;
+            }
+            tinyMCEPopup.editor.execCommand( 'mceInsertContent', false, '<img style="width: 300px; height: 200px; ' + aligntxt + '" src="' + AScgiloc + '?sscr=' + encodeURIComponent( this.sscr ) + '" sscr="' + this.sscr + '" script=" " />') ;
+        }
+        else
+        {
+            el = tinyMCEPopup.editor.selection.getNode() ;
+            ed.dom.setAttrib( el , 'sscr' , this.sscr ) ;
+            ed.dom.setAttrib( el , 'src' , AScgiloc + '?sscr=' + encodeURIComponent( this.sscr ) ) ;
+            ed.dom.setAttrib( el , 'width' , this.width ) ;
+            ed.dom.setAttrib( el , 'height' , this.height ) ;
+            ed.dom.setStyle( el , 'width' , this.width + 'px' ) ;
+            ed.dom.setStyle( el , 'height' , this.height + 'px') ;
+            if ( this.alignm == 'left' || this.alignm == 'right' )
+            {
+                ed.dom.setStyle( el , 'float' , this.alignm ) ;
+                ed.dom.setStyle( el , 'vertical-align' , 'middle' ) ;
+            }
+            else
+            {
+                ed.dom.setStyle( el , 'float' , 'none' ) ;
+                ed.dom.setStyle( el , 'vertical-align' , this.alignm ) ;
+            }
+        }
+        tinyMCEPopup.close() ;
+    } ,
+
+    addgraph : function()
+    {
+        var graphs = GetE( 'graphs' ) ;
+        var newopt = document.createElement( 'option' ) ;
+
+        var type = GetE( 'eqntype' ).value ;
+        var eq1 = GetE( 'equation' ).value ;
+        var eq2 = null ;
+
+        if ( type == 'func' )
+        {
+            newopt.text = 'y=' + eq1 ;
+        }
+        else if ( type == 'polar' )
+        {
+            newopt.text = 'r=' + eq1 ;
+        }
+        else if ( type == 'param' )
+        {
+            eq2= GetE( 'eqn2' ).value ;
+            newopt.text = '[x,y]=[' + eq1 + ','+ eq2 + ']' ;
+        }
+        else if ( type == 'slope' )
+        {
+            newopt.text = 'dy/dx=' + eq1 ;
+            eq2= GetE( 'eqn2' ).value ;
+        }
+
+        m_gstart = GetE( 'gstart' ).selectedIndex ;
+        m_gend = GetE( 'gend' ).selectedIndex ;
+        m_color = GetE( 'gcolor' ).value ;
+        m_strokewidth = GetE( 'strokewidth' ).value ;
+        m_strokedash = GetE( 'strokedash' ).value ;
+        if ( GetE( 'xstart' ).value.length > 0 )
+        {
+            //newopt.value = 'myplot(' + eqn +',"' + m_gstart+  '","' + m_gend + '",' + GetE( 'xstart' ).value + ',' + GetE( 'xend' ).value  + ');' ;
+            newopt.value = type + ',' + eq1 + ',' + eq2 + ',' + m_gstart + ',' + m_gend + ',' + GetE( 'xstart' ).value + ',' + GetE( 'xend' ).value + ',' + m_color + ',' + m_strokewidth + ',' + m_strokedash ;
+        }
+        else
+        {
+            //newopt.value = 'myplot(' + eqn + ',"' + m_gstart + '","' + m_gend + '");' ;
+            newopt.value = type + ',' + eq1 + ',' + eq2 + ',' + m_gstart + ',' + m_gend + ',,' + ',' + m_color + ',' + m_strokewidth + ',' + m_strokedash ;
+        }
+
+        graphs.options[ graphs.options.length ] = newopt ;
+        graphs.selectedIndex = graphs.options.length - 1 ;
+        UpdatePreview() ;
+        GetE( 'equation' ).focus() ;
+    } ,
+
+    replacegraph : function()
+    {
+        var graphs = GetE( 'graphs' ) ;
+        if ( graphs.selectedIndex >= 0 )
+        {
+            graphs.options[ graphs.selectedIndex ] = null ;  //standards compliant
+        }
+        this.addgraph() ;
+    } ,
+
+    removegraph : function()
+    {
+        var graphs = GetE( 'graphs' ) ;
+        if ( graphs.selectedIndex >= 0 ) {
+            graphs.options[ graphs.selectedIndex ] = null ;
+            if ( graphs.options.length > 0 ) { this.loadeqn() ; }
+        }
+        UpdatePreview() ;
+        GetE( 'equation' ).focus() ;
+    } ,
+
+    graphit : function()
+    {
+        //ed = tinyMCEPopup.editor ;
+        var commands ;
+        commands = '' ;
+
+        initialized = false ;
+
+        //commands = 'setBorder(5);' ;
+
+        m_xmin = GetE( 'xmin' ).value ;
+        m_xmax = GetE( 'xmax' ).value ;
+        m_ymin = GetE( 'ymin' ).value ;
+        m_ymax = GetE( 'ymax' ).value ;
+        if ( m_ymin == '' ) m_ymin = null ;
+        if ( m_ymax == '' ) m_ymax = null ;
+        commands += m_xmin + ',' + m_xmax + ',' + m_ymin + ',' + m_ymax + ',' ;
+
+        m_xscl = GetE( 'xscl' ).value ;
+        m_yscl = GetE( 'yscl' ).value ;
+        if ( m_xscl == '' ) m_xscl = null ;
+        if ( m_yscl == '' ) m_yscl = null ;
+        if ( GetE( 'labels' ).checked )
+        {
+            m_labels = '1' ;
+        }
+        else
+        {
+            m_labels = 'null' ;
+        }
+
+        if ( GetE( 'grid' ).checked )
+        {
+            m_grid = ',' + m_xscl + ',' + m_yscl ;
+        }
+        else
+        {
+            m_grid = ',null,null' ;
+        }
+        commands += m_xscl + ',' + m_yscl + ',' + m_labels + m_grid ;
+
+        commands += ',' + GetE( 'gwidth' ).value + ',' + GetE( 'gheight' ).value ;
+
+
+        graphs = GetE( 'graphs' ) ;
+        for ( i = 0 ; i < graphs.length ; i++ )
+        {
+            commands += ',' + graphs.options[i].value ;
+        }
+
+        this.width = GetE( 'gwidth' ).value ;
+        this.height = GetE( 'gheight' ).value ;
+        this.sscr = commands ;
+        this.alignm = GetE( 'alignment' ).value ;
+
+        //if ( noSVG )
+        //{
+        //    pvimg = GetE( 'previewimg' ) ;
+        //    pvimg.src = AScgiloc + '?sscr=' + encodeURIComponent(commands) ;
+        //    //ed.dom.setStyle( pvimg, 'width' , this.width + 'px' ) ;
+        //    //ed.dom.setStyle( pvimg, 'height' , this.height + 'px' ) ;
+        //}
+        //else
+        //{
+            pvsvg = GetE( 'previewsvg' ) ;
+            parseShortScript( commands , this.width , this.height ) ;
+        //}
+    } ,
+
+    changetype : function()
+    {
+        var type = GetE( 'eqntype' ).value ;
+
+        if ( type == 'func' )
+        {
+            this.chgtext( 'eq1lbl', 'f(x)=' ) ;
+            GetE( 'equation' ).value = 'sin(x)' ;
+            this.chgtext( 'eq2lbl' , '' ) ;
+            this.chgtext( 'eq2' , '' ) ;
+
+        }
+        else if ( type == 'polar' )
+        {
+            this.chgtext( 'eq1lbl' , 'r(t)=' ) ;
+            GetE( 'equation' ).value = 't' ;
+            this.chgtext( 'eq2lbl' , '' ) ;
+            this.chgtext( 'eq2' , '' ) ;
+
+        }
+        else if ( type == 'param' )
+        {
+            this.chgtext( 'eq1lbl' , 'f(t)=' ) ;
+            this.chgtext( 'eq2lbl' , 'g(t)= ' ) ;
+            var newinput = document.createElement( 'input' ) ;
+            newinput.type = 'text' ;
+            newinput.name = 'eqn2' ;
+            newinput.id = 'eqn2' ;
+            newinput.size = '15' ;
+            newinput.value = 'cos(t)' ;
+            var cnode = GetE( 'eq2' ) ;
+            cnode.replaceChild( newinput,cnode.lastChild ) ;
+            GetE( 'equation' ).value = 'sin(t)' ;
+
+        }
+        else if ( type == 'slope' )
+        {
+            this.chgtext( 'eq1lbl' , 'dy/dx (x,y) = ' ) ;
+            GetE( 'equation' ).value = 'x*y' ;
+            this.chgtext( 'eq2lbl' , 'every ' ) ;
+            var newinput = document.createElement( 'input' ) ;
+            newinput.type = 'text' ;
+            newinput.name = 'eqn2' ;
+            newinput.id = 'eqn2' ;
+            newinput.size = '2' ;
+            newinput.value = '1' ;
+            var cnode = GetE( 'eq2' ) ;
+            cnode.replaceChild( newinput , cnode.lastChild ) ;
+        }
+        GetE( 'gstart' ).selectedIndex = 0 ;
+        GetE( 'gend' ).selectedIndex = 0 ;
+        GetE( 'xstart' ).value = '' ;
+        GetE( 'xend' ).value = '' ;
+        GetE( 'gcolor' ).selectedIndex = 0 ;
+        GetE( 'strokewidth' ).selectedIndex = 0 ;
+        GetE( 'strokedash' ).selectedIndex = 0 ;
+    } ,
+
+    loadeqn : function()
+    {
+        graphs = GetE( 'graphs' ) ;
+
+        var sa = graphs.options[ graphs.selectedIndex ].value.split( ',' ) ;
+
+        if ( sa[0] == 'func' ) {
+            GetE( 'eqntype' ).selectedIndex = 0 ;
+        } else if ( sa[0] == 'polar' ) {
+            GetE( 'eqntype' ).selectedIndex = 1 ;
+        } else if ( sa[0] == 'param' ) {
+            GetE( 'eqntype' ).selectedIndex = 2 ;
+        } else if ( sa[0] == 'slope' ) {
+            GetE( 'eqntype' ).selectedIndex = 3 ;
+        }
+        this.changetype() ;
+        GetE( 'equation' ).value = sa[1] ;
+        if ( ( sa[0] == 'param' ) || ( sa[0] == 'slope' ) ) {
+            GetE( 'eqn2' ).value = sa[2] ;
+        }
+
+        GetE( 'gstart' ).selectedIndex = sa[ 3 ] ;
+        GetE( 'gend' ).selectedIndex = sa[ 4 ] ;
+        GetE( 'xstart' ).value = sa[ 5 ] ;
+        GetE( 'xend' ).value = sa[ 6 ] ;
+        switch ( sa[ 7 ] )
+        {
+            case 'black' : GetE( 'gcolor' ).selectedIndex = 0 ; break ;
+            case 'red' : GetE( 'gcolor' ).selectedIndex = 1 ; break ;
+            case 'orange' : GetE( 'gcolor' ).selectedIndex = 2 ; break ;
+            case 'yellow' : GetE( 'gcolor' ).selectedIndex = 3 ; break ;
+            case 'green' : GetE( 'gcolor' ).selectedIndex = 4 ; break ;
+            case 'blue' : GetE( 'gcolor' ).selectedIndex = 5 ; break ;
+            case 'purple' : GetE( 'gcolor' ).selectedIndex = 6 ; break ;
+        }
+        GetE( 'strokewidth' ).selectedIndex = sa[ 8 ] - 1 ;
+        switch ( sa[ 9 ] )
+        {
+            case '2' : GetE( 'strokedash' ).selectedIndex = 1 ; break ;
+            case '5' : GetE( 'strokedash' ).selectedIndex = 2 ; break ;
+            case '5 2' : GetE( 'strokedash' ).selectedIndex = 3 ; break ;
+            case '7 3 2 3' : GetE( 'strokedash' ).selectedIndex = 4 ; break ;
+            default : GetE( 'strokedash' ).selectedIndex = 0 ;
+        }
+    } ,
+
+    getsscr : function( text , alignment )
+    {
+        alignment = 'middle' ;
+        sa = text.split( ',' ) ;
+        GetE( 'xmin' ).value = sa[ 0 ] ;
+        GetE( 'xmax' ).value = sa[ 1 ] ;
+        GetE( 'ymin' ).value = sa[ 2 ] ;
+        GetE( 'ymax' ).value = sa[ 3 ] ;
+        GetE( 'xscl' ).value = sa[ 4 ] ;
+        GetE( 'yscl' ).value = sa[ 5 ] ;
+
+        if ( sa[ 6 ] != 'null' )
+        {
+            GetE( 'labels' ).checked = true ;
+        }
+        else
+        {
+            GetE( 'labels' ).checked = false ;
+        }
+        if ( typeof eval( sa[ 7 ] ) == 'number' )
+        {
+            GetE( 'grid' ).checked = true ;
+        }
+        else
+        {
+            GetE( 'grid' ).checked = false ;
+        }
+
+        GetE( 'gwidth' ).value = sa[ 9 ] ;
+        GetE( 'gheight' ).value = sa[ 10 ] ;
+
+        GetE( 'graphs' ).length = 0 ;
+
+        var inx = 11 ;
+        while ( sa.length > inx + 9 )
+        {
+            var newopt = document.createElement( 'option' ) ;
+
+            if ( sa[ inx ] == 'func' )
+            {
+                newopt.text = 'y=' + sa[ inx + 1 ] ;
+            }
+            else if ( sa[ inx ] == 'polar' )
+            {
+                newopt.text = 'r=' + sa[ inx + 1 ] ;
+            }
+            else if ( sa[inx] == 'param' )
+            {
+                newopt.text = '[x,y]=[' + sa[ inx + 1 ] + ',' + sa[ inx + 2 ] + ']' ;
+            }
+            else if ( sa[inx] == 'slope' )
+            {
+                newopt.text = 'dy/dx=' + sa[ inx + 1 ] ;
+            }
+            newopt.value = sa[inx] + ',' + sa[ inx + 1 ] + ',' + sa[ inx + 2 ] + ',' + sa[ inx + 3 ] + ',' + sa[ inx + 4 ] + ',' + sa[ inx + 5 ] + ',' + sa[ inx + 6 ] + ',' + sa[ inx + 7 ] + ',' + sa[ inx + 8] + ',' + sa[ inx + 9 ] ;
+            graphs = GetE( 'graphs' ) ;
+            graphs.options[ graphs.options.length ] = newopt ;
+            //GetE( 'graphs' ).add( newopt ) ;
+            inx += 10 ;
+        }
+        if ( inx > 11 ) {
+            this.loadeqn() ;
+        }
+
+        switch ( alignment.toLowerCase() )
+        {
+            case 'text-top' : GetE( 'alignment' ).selectedIndex = 0 ; break ;
+            case 'middle' : GetE( 'alignment' ).selectedIndex = 1 ; break ;
+            case 'text-bottom' : GetE( 'alignment' ).selectedIndex = 2 ; break ;
+            case 'left' : GetE( 'alignment' ).selectedIndex = 3 ; break ;
+            case 'right' : GetE( 'alignment' ).selectedIndex = 4 ; break ;
+            default: GetE( 'alignment' ).selectedIndex = 0 ; break ;
+        }
+
+        //UpdatePreview() ;
+    } ,
+
+    chgtext : function( tag , text )
+    {
+        var cnode = GetE( tag ) ;
+        cnode.replaceChild( document.createTextNode( text ) , cnode.lastChild ) ;
+    }
+
+} ;

+ 1 - 1
main/inc/lib/fckeditor/editor/plugins/asciisvg/fckplugin.js

@@ -24,7 +24,7 @@ var alertIfNoSVG = false;
 var translateASCIIMath = false ;
 
 // Registering the related command.
-FCKCommands.RegisterCommand( 'asciisvg', new FCKDialogCommand( FCKLang['DlgAsciiSvg'], FCKLang['DlgAsciiSvgGraphEditor'], FCKConfig.PluginsPath + 'asciisvg/fck_asciisvg.html', 500, 500 ) ) ;
+FCKCommands.RegisterCommand( 'asciisvg', new FCKDialogCommand( FCKLang['DlgAsciiSvg'], FCKLang['DlgAsciiSvgGraphEditor'], FCKConfig.PluginsPath + 'asciisvg/fck_asciisvg.html', 700, 600 ) ) ;
 
 // Create the "asciisvg" toolbar button.
 var oAsciiSvgItem = new FCKToolbarButton( 'asciisvg', FCKLang['DlgAsciiSvg'] ) ;

+ 1 - 1
main/inc/lib/fckeditor/editor/plugins/asciisvg/fckplugin_compressed.js

@@ -24,7 +24,7 @@ var alertIfNoSVG = false;
 var translateASCIIMath = false ;
 
 // Registering the related command.
-FCKCommands.RegisterCommand( 'asciisvg', new FCKDialogCommand( FCKLang['DlgAsciiSvg'], FCKLang['DlgAsciiSvgGraphEditor'], FCKConfig.PluginsPath + 'asciisvg/fck_asciisvg.html', 500, 500 ) ) ;
+FCKCommands.RegisterCommand( 'asciisvg', new FCKDialogCommand( FCKLang['DlgAsciiSvg'], FCKLang['DlgAsciiSvgGraphEditor'], FCKConfig.PluginsPath + 'asciisvg/fck_asciisvg.html', 700, 600 ) ) ;
 
 // Create the "asciisvg" toolbar button.
 var oAsciiSvgItem = new FCKToolbarButton( 'asciisvg', FCKLang['DlgAsciiSvg'] ) ;

+ 33 - 24
main/inc/lib/fckeditor/toolbars/extended/announcements.php

@@ -7,37 +7,46 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps, ASCIIMath don't run ok here. 
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('Save','FitWindow','PasteWord','-','Undo','Redo'),
-	array('Link','Unlink','Anchor'),
-    array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-    array('Table','SpecialChar'),
-    array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'),
-    '/',
-    array('Style','FontFormat','FontName','FontSize'),
-    array('Bold','Italic','Underline'),
-    array('JustifyLeft','JustifyCenter','JustifyRight')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','-','Save','NewPage','Preview'),
-	array('Cut','Copy','Paste','PasteText','PasteWord','-','Print'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','YouTube','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks','Source')
+	array('Save','NewPage','Templates','-','Preview','Print'),
+	array('Cut','Copy','Paste','PasteText','PasteWord'),
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks','Source'),
+	array('FitWindow')
+	
 );
 
 // Sets whether the toolbar can be collapsed/expanded or not.

+ 33 - 24
main/inc/lib/fckeditor/toolbars/extended/announcements_student.php

@@ -7,38 +7,47 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps, ASCIIMath don't run ok here. 
+//NOTE: ONLY FOR TEACHERS: source, insert html
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('Save','FitWindow','PasteWord','-','Undo','Redo'),
-	array('Link','Unlink','Anchor'),
-    array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-    array('Table','SpecialChar'),
-    array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'),
-    '/',
-    array('Style','FontFormat','FontName','FontSize'),
-    array('Bold','Italic','Underline'),
-    array('JustifyLeft','JustifyCenter','JustifyRight'),
-	array('ShowBlocks')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','-','Save','NewPage','Preview'),
+	array('Save','NewPage','Templates','-','Preview','Print'),
 	array('Cut','Copy','Paste','PasteText','PasteWord'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks')
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks'),
+	array('FitWindow')
+	
 );
 
 // Sets whether the toolbar can be collapsed/expanded or not.

+ 1 - 1
main/inc/lib/fckeditor/toolbars/extended/documents.php

@@ -23,7 +23,7 @@ $config['ToolbarSets']['Normal'] = array(
 	array('Save','NewPage','Templates','-','PasteWord'),
 	array('Undo','Redo'),
 	array('Link','Image','flvPlayer','Table','mimetex','asciimath'),
-	array('UnorderedList','OrderedList','Rule'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
 	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
 	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
 	array('FitWindow')

+ 2 - 1
main/inc/lib/fckeditor/toolbars/extended/documents_student.php

@@ -9,6 +9,7 @@
 
 //NOTE: Does not include Replace because it is redundant, being in the same tab to Find
 //TODO: DocProps, fckeditor_wiris_openFormulaEditor,fckeditor_wiris_openCAS don't run ok here. 
+//NOTE: ONLY FOR TEACHERS: source, insert html
 
 // Hide/show SpellCheck buttom
 if ((api_get_setting('allow_spellcheck') == 'true')) {
@@ -23,7 +24,7 @@ $config['ToolbarSets']['Normal'] = array(
 	array('Save','NewPage','Templates','-','PasteWord'),
 	array('Undo','Redo'),
 	array('Link','Image','flvPlayer','Table','mimetex','asciimath'),
-	array('UnorderedList','OrderedList','Rule'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
 	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
 	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
 	array('FitWindow')

+ 33 - 24
main/inc/lib/fckeditor/toolbars/extended/introduction.php

@@ -7,37 +7,46 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps,  asciimath don't run ok here. Templates loses styles
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('NewPage','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll'),
-	array('Link','Unlink','Anchor'),
-	array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-	array('Table','SpecialChar'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('Bold','Italic','Underline'),
-	array('JustifyLeft','JustifyCenter','JustifyRight')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','Save','NewPage','Preview'),
-	array('Cut','Copy','Paste','PasteText','PasteWord','-','Print'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','YouTube','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks','Source')
+	array('Save','NewPage','Templates','-','Preview','Print'),
+	array('Cut','Copy','Paste','PasteText','PasteWord'),
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks','Source'),
+	array('FitWindow')
+	
 );
 
 // Sets whether the toolbar can be collapsed/expanded or not.

+ 33 - 24
main/inc/lib/fckeditor/toolbars/extended/notebook.php

@@ -7,37 +7,46 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps, ASCIIMath don't run ok here. 
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('Save','FitWindow','-','PasteWord','-','Undo','Redo'),
-	array('Link','Unlink','Anchor'),
-    array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-    array('Table','SpecialChar'),
-    array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'),
-    '/',
-    array('Style','FontFormat','FontName','FontSize'),
-    array('Bold','Italic','Underline'),
-    array('JustifyLeft','JustifyCenter','JustifyRight')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','Save','NewPage','Preview'),
-	array('Cut','Copy','Paste','PasteText','PasteWord','-','Print'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('mimetex','Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','YouTube','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks','Source')
+	array('Save','NewPage','Templates','-','Preview','Print'),
+	array('Cut','Copy','Paste','PasteText','PasteWord'),
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks','Source'),
+	array('FitWindow')
+	
 );
 
 // Sets whether the toolbar can be collapsed/expanded or not.

+ 33 - 25
main/inc/lib/fckeditor/toolbars/extended/notebook_student.php

@@ -7,40 +7,48 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps, ASCIIMath don't run ok here. 
+//NOTE: ONLY FOR TEACHERS: source, insert html
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('Save','FitWindow','-','PasteWord','-','Undo','Redo'),
-	array('Link','Unlink','Anchor'),
-    array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-    array('Table','SpecialChar'),
-    array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'),
-    '/',
-    array('Style','FontFormat','FontName','FontSize'),
-    array('Bold','Italic','Underline'),
-    array('JustifyLeft','JustifyCenter','JustifyRight'),
-	array('ShowBlocks')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','Save','NewPage','Preview'),
+	array('Save','NewPage','Templates','-','Preview','Print'),
 	array('Cut','Copy','Paste','PasteText','PasteWord'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('mimetex','Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks')
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks'),
+	array('FitWindow')
+	
 );
-
 // Sets whether the toolbar can be collapsed/expanded or not.
 // Possible values: true , false
 //$config['ToolbarCanCollapse'] = true;

+ 33 - 24
main/inc/lib/fckeditor/toolbars/extended/training_description.php

@@ -7,37 +7,46 @@
 
 // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
 
+//NOTE: Does not include Replace because it is redundant, being in the same tab to Find
+//TODO: DocProps,  asciimath, don't run ok here. Templates loses styles
+
+// Hide/show SpellCheck buttom
+if ((api_get_setting('allow_spellcheck') == 'true')) {
+	$VSpellCheck='SpellCheck';
+}
+else{
+	$VSpellCheck='';	
+}
+
 // This is the visible toolbar set when the editor has "normal" size.
 $config['ToolbarSets']['Normal'] = array(
-	array('NewPage','Save','FitWindow','PasteWord','-','Undo','Redo'),
-	array('Link','Unlink','Anchor'),
-	array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'),
-	array('Table','SpecialChar'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','Source'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('Bold','Italic','Underline'),
-	array('JustifyLeft','JustifyCenter','JustifyRight')
+	array('Save','NewPage','Templates','-','PasteWord'),
+	array('Undo','Redo'),
+	array('Link','Image','flvPlayer','Table','mimetex'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
+	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
+	array('FitWindow')
 );
 
 // This is the visible toolbar set when the editor is maximized.
 // If it has not been defined, then the toolbar set for the "normal" size is used.
 $config['ToolbarSets']['Maximized'] = array(
-	array('FitWindow','Save','NewPage','Preview'),
-	array('Cut','Copy','Paste','PasteText','PasteWord','-','Print'),
-	array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
-	array('Link','Unlink','Anchor'),
-	'/',
-	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'),
-	array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'),
-	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
-	array('Rule','SpecialChar'),
-	array('Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','YouTube','googlemaps','Smiley'),
-	'/',
-	array('Style','FontFormat','FontName','FontSize'),
-	array('TextColor','BGColor'),
-	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'),
-	array('ShowBlocks','Source')
+	array('Save','NewPage','Templates','-','Preview','Print'),
+	array('Cut','Copy','Paste','PasteText','PasteWord'),
+	array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'),
+	array('Link','Unlink','Anchor','Glossary'),
+	array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','fckeditor_wiris_openFormulaEditor','fckeditor_wiris_openCAS'),
+'/',
+	array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'),
+	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),	
+	array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'),
+	array($VSpellCheck),	
+	array('Style','FontFormat','FontName','FontSize'),	
+	array('PageBreak','ShowBlocks','Source'),
+	array('FitWindow')
+	
 );
 
 // Sets whether the toolbar can be collapsed/expanded or not.

+ 1 - 1
main/inc/lib/fckeditor/toolbars/extended/wiki.php

@@ -24,7 +24,7 @@ $config['ToolbarSets']['Normal'] = array(
 	array('Save','NewPage','Templates','-','PasteText'),
 	array('Undo','Redo'),
 	array('Wikilink','Link','Image','flvPlayer','Table','mimetex'),
-	array('UnorderedList','OrderedList','Rule'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
 	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
 	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
 	array('FitWindow')

+ 1 - 1
main/inc/lib/fckeditor/toolbars/extended/wiki_student.php

@@ -25,7 +25,7 @@ $config['ToolbarSets']['Normal'] = array(
 array('Save','NewPage','Templates','-','PasteText'),
 	array('Undo','Redo'),
 	array('Wikilink','Link','Image','flvPlayer','Table','mimetex'),
-	array('UnorderedList','OrderedList','Rule'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
 	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
 	array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'),
 	array('FitWindow')

+ 1 - 1
main/inc/lib/fckeditor/toolbars/extended/wiki_task.php

@@ -24,7 +24,7 @@ $config['ToolbarSets']['Normal'] = array(
 	array('NewPage','Templates','-','PasteText'),
 	array('Undo','Redo'),
 	array('Link','Image','flvPlayer','Table','mimetex'),
-	array('UnorderedList','OrderedList','Rule'),
+	array('UnorderedList','OrderedList','Rule','-','Outdent','Indent'),
 	array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'),
 	array('FontFormat','FontName','Bold','Italic','Underline','TextColor','BGColor'),
 	array('FitWindow')

+ 1 - 1
main/lang/bulgarian/exercice.inc.php

@@ -8,7 +8,7 @@ $langDeactivate = "Дезактивиране";
 $langNoEx = "Засега няма тестове.";
 $langNewEx = "Нов тест";
 $langQuestion = "Въпрос";
-$langQuestions = "Въпроса";
+$langQuestions = "Въпроси";
 $langAnswers = "Отговори";
 $langTrue = "Вярно";
 $langAnswer = "Отговор";

+ 1 - 0
main/lang/english/document.inc.php

@@ -227,4 +227,5 @@ $Draw = "Draw";
 $FileExistsChangeToSave = "This file name already exists, choose another to save your image.";
 $FileSavedAs = "File saved as";
 $FileExportAs = "File export as";
+$UserFolder = "User folder";
 ?>

+ 1 - 1
main/lang/english/install.inc.php

@@ -5,7 +5,7 @@ for more information: see languages.txt in the lang folder.
 $langStatDB = "Tracking DB.";
 $langEnableTracking = "Enable Tracking";
 $langInstituteShortName = "Your company short name";
-$langWarningResponsible = "Use this script only after backup. Chamilo team is not responsible if you lost or corrupted data";
+$langWarningResponsible = "Use this script only after backup. The Chamilo team is not responsible for lost or corrupted data.";
 $langAllowSelfRegProf = "Allow self-registration as a trainer";
 $langEG = "ex.";
 $langDBHost = "Database Host";

+ 1 - 0
main/lang/english/trad4all.inc.php

@@ -973,4 +973,5 @@ $FillWithExemplaryContent = "Fill with exemplary content";
 $ToolVideoconference = "Videoconference";
 $SelectSVGEditImage = "Select a picture";
 $OnlyAccessFromYourGroup = "Only accessible from your group";
+$UserFolders = "Folders of users";
 ?>

+ 1 - 0
main/lang/spanish/document.inc.php

@@ -227,4 +227,5 @@ $Draw = "Dibujar";
 $FileExistsChangeToSave = "Este nombre de archivo ya existe, escoja otro para guardar su imagen.";
 $FileSavedAs = "Archivo guardado como";
 $FileExportAs = "Archivo exportado como";
+$UserFolder = "Carpeta del usuario";
 ?>

+ 1 - 0
main/lang/spanish/trad4all.inc.php

@@ -974,4 +974,5 @@ $FillWithExemplaryContent = "Rellenar con contenido de ejemplo";
 $ToolVideoconference = "Videoconferencia";
 $SelectSVGEditImage = "Selecciones una imagen (svg, png)";
 $OnlyAccessFromYourGroup = "Sólo accesible desde su grupo";
+$UserFolders = "Carpetas de los usuarios";
 ?>