Browse Source

temporal disabled upload files, rename some files, adding index.html files

Juan Carlos Raña 14 years ago
parent
commit
03667eaa37

+ 85 - 0
main/document/create_drawing.php

@@ -0,0 +1,85 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+/**
+ *	This file allows creating new svg and png documents with an online editor.
+ *
+ *	@package chamilo.document
+ *
+ * @author Juan Carlos Raña Trabado
+ * @since 25/september/2010
+*/
+
+/*	INIT SECTION */
+
+// Name of the language file that needs to be included
+$language_file = array('document');
+
+require_once '../inc/global.inc.php';
+
+$_SESSION['whereami'] = 'document/draw';
+$this_section = SECTION_COURSES;
+require_once api_get_path(LIBRARY_PATH).'document.lib.php';
+require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
+require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+$nameTools = get_lang('Draw');
+
+api_protect_course_script();
+api_block_anonymous_users();
+
+
+/*	Constants and variables */
+
+$dir = isset($_GET['dir']) ? Security::remove_XSS($_GET['dir']) : Security::remove_XSS($_POST['dir']);
+
+/*	MAIN CODE */
+
+if (api_is_in_group()) {
+	$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
+}
+
+// Please, do not modify this dirname formatting
+
+if (strstr($dir, '..')) {
+	$dir = '/';
+}
+
+if ($dir[0] == '.') {
+	$dir = substr($dir, 1);
+}
+
+if ($dir[0] != '/') {
+	$dir = '/'.$dir;
+}
+
+if ($dir[strlen($dir) - 1] != '/') {
+	$dir .= '/';
+}
+
+
+if (isset ($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
+		$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
+		$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".$_SESSION['_gid'], "name" => get_lang('GroupSpace'));
+		$noPHP_SELF = true;
+		$to_group_id = $_SESSION['_gid'];
+		$group = GroupManager :: get_group_properties($to_group_id);
+		$path = explode('/', $dir);
+		if ('/'.$path[1] != $group['directory']) {
+			api_not_allowed(true);
+		}
+	}
+	$interbreadcrumb[] = array ("url" => "./document.php?curdirpath=".urlencode($_GET['dir']).$req_gid, "name" => get_lang('Documents'));
+
+
+////////////////////////
+Display :: display_header($nameTools, 'Doc');
+echo '<div class="actions">';
+		echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['dir']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview')).get_lang('BackTo').' '.get_lang('DocumentsOverview').'</a>';
+echo '</div>';
+
+echo '<iframe style=\'height: 500px; width: 100%;\' scrolling=\'no\' frameborder=\'0\' src=\''.api_get_path(WEB_LIBRARY_PATH).'svg-edit/svg-editor.php \'>';
+echo '</iframe>';
+
+Display :: display_footer();
+?>

+ 2 - 2
main/document/document.php

@@ -825,8 +825,8 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold
 	// Create new draw
 		if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id)) {
 	?>
-		<a href="create_draw.php?<?php echo api_get_cidreq(); ?>&dir=<?php echo $curdirpathurl.$req_gid; ?>">
-			<?php Display::display_icon('svg-edit.png', get_lang('CreateDraw')); echo get_lang('CreateDraw'); ?></a>&nbsp;
+		<a href="create_drawing.php?<?php echo api_get_cidreq(); ?>&dir=<?php echo $curdirpathurl.$req_gid; ?>">
+			<?php Display::display_icon('draw.png', get_lang('Draw')); echo get_lang('Draw'); ?></a>&nbsp;
 	<?php
 		}
 

BIN
main/img/draw.png


+ 6 - 0
main/inc/lib/svg-edit/canvg/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 17 - 4
main/inc/lib/svg-edit/extensions/fileopen.php

@@ -8,7 +8,19 @@
  *
  * Copyright(c) 2010 Alexis Deveria
  *
- */
+ * Integrate svg-edit with Chamilo
+ * @author Juan Carlos Raña Trabado
+ * @since 25/september/2010
+*/
+
+require_once '../../../../inc/global.inc.php';//hack for chamilo
+require_once api_get_path(LIBRARY_PATH).'course.lib.php';
+require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'security.lib.php';
+require_once api_get_path(LIBRARY_PATH).'document.lib.php';
+
+api_protect_course_script();
+api_block_anonymous_users();
 	// Very minimal PHP file, all we do is Base64 encode the uploaded file and
 	// return it to the editor
 	
@@ -26,6 +38,7 @@
 		$prefix = 'data:' . $info['mime'] . ';base64,';
 	}
 ?>
-<script>
-window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo $type ?>");
-</script>  
+<!--disable upload files (IMPORT SVG FILES) for now. Chamilo -->
+<!--<script>
+window.top.window.svgEditor.processFile("<?php // echo $prefix . base64_encode($output); ?>", "<?php // echo $type ?>");
+</script>   -->

+ 5 - 1
main/inc/lib/svg-edit/extensions/filesave.php

@@ -7,7 +7,11 @@
  *
  * Copyright(c) 2010 Alexis Deveria
  *
- */
+ * Integrate svg-edit with Chamilo
+ * @author Juan Carlos Raña Trabado
+ * @since 25/september/2010
+*/
+
 require_once '../../../../inc/global.inc.php';//hack for chamilo
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';

+ 6 - 0
main/inc/lib/svg-edit/extensions/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/images/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/jgraduate/css/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/jgraduate/images/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/jgraduate/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/jquery-ui/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/jquerybbq/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/js-hotkeys/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/locale/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 6 - 0
main/inc/lib/svg-edit/spinbtn/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

+ 4 - 1
main/inc/lib/svg-edit/svg-editor.js

@@ -8,7 +8,9 @@
  * Copyright(c) 2010 Jeff Schiller
  * Copyright(c) 2010 Narendra Sisodiya
  *
- * Hacks for Chamilo 2010 Juan Carlos Raña Trabado
+ * Integrate  with Chamilo
+ * Author Juan Carlos Raña Trabado
+ * Since 25/september/2010
  */
 
 (function() { 
@@ -3441,6 +3443,7 @@
 			};
 			
 			Editor.openPrep = function(func) {
+				//return false;// temporal hack for Chamilo, add this line to disable open svg file
 				$('#main_menu').hide();
 				if(undoMgr.getUndoStackSize() === 0) {
 					func(true);

+ 10 - 3
main/inc/lib/svg-edit/svg-editor.php

@@ -1,8 +1,15 @@
 <?php
+/**
+* Integrate svg-edit with Chamilo
+* @author Juan Carlos Raña Trabado
+* @since 25/september/2010
+*/
+
 require_once '../../../inc/global.inc.php';//hack for Chamilo
 api_protect_course_script();
 api_block_anonymous_users();
 ?>
+
 <!DOCTYPE html>
 <html>
 <!-- removed for now, causes problems in Firefox: manifest="svg-editor.manifest" -->
@@ -23,7 +30,7 @@ api_block_anonymous_users();
 <script type="text/javascript" src="jquerybbq/jquery.bbq.min.js"></script>
 <script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script>
 <script type="text/javascript" src="svgcanvas.min.js"></script>
-<!--<script type="text/javascript" src="svg-editor.min.js"></script> -->
+<!--<script type="text/javascript" src="svg-editor.min.js"></script> --><!-- Replaced by bottom line. While integration into Chamilo, change compress svg-editor.min.js by svg-editor.js file -->
 <script type="text/javascript" src="svg-editor.js"></script>
 <script type="text/javascript" src="locale/locale.min.js"></script>
 
@@ -105,12 +112,12 @@ api_block_anonymous_users();
 				New Image [N]
 			</li>
 			
-			<li id="tool_open" style="display:none;">
+			<!--<li id="tool_open" style="display:none;">
 				<div id="fileinputs">
 					<div></div>
 				</div>
 				Open Image [O]
-			</li>
+			</li> --><!-- Disabled by now for Chamilo -->
 			
 			<li id="tool_import" style="display:none;">
 				<div id="fileinputs_import">

+ 6 - 0
main/inc/lib/svg-edit/svgicons/index.html

@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>

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

@@ -223,4 +223,5 @@ $CopyAlreadyDone = "There are a file with the same name in your private user fil
 $CopyFailed = "Copy failed";
 $CopyMade = "Copy made";
 $OverwritenFile = "File replaced";
+$Draw = "Draw";
 ?>

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

@@ -223,4 +223,5 @@ $CopyAlreadyDone = "Hay un archivo con el mismo nombre en su área personal de a
 $CopyFailed = "Copia fallida";
 $CopyMade = "Copia realizada";
 $OverwritenFile = "Archivo reemplazado";
+$Draw = "Dibujar";
 ?>