diff --git a/main/document/document.inc.php b/main/document/document.inc.php index a2fc441de7..50b9b2d18d 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -122,8 +122,9 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility // Check the extension $ext = explode('.', $path); $ext = strtolower($ext[sizeof($ext) - 1]); + // "htmlfiles" are shown in a frameset - if ($ext == 'htm' || $ext == 'html' || $ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf' || $ext == 'swf' || $ext == 'mp3') { + if ($ext == 'htm' || $ext == 'html' || $ext == 'gif' || $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf' || $ext == 'swf' || $ext == 'mp3' || ($ext == 'svg' && support_svg())) { $url = 'showinframes.php?'.api_get_cidreq().'&file='.$url_path.$req_gid; } else { // url-encode for problematic characters (we may not call them dangerous characters...) @@ -298,7 +299,7 @@ function build_edit_icons($curdirpath, $type, $path, $visibility, $id, $is_templ if ($is_certificate_mode) { $modify_icons = ''; }else { - if($extension=='svg') { + if($extension=='svg' && support_svg()){ $modify_icons = ''; }else{ $modify_icons = ''; @@ -571,4 +572,19 @@ function search_keyword($document_name, $keyword) { return false; } } + +/** + * Check brosers support for svg files + * @return return bool Return true + */ +function support_svg() { + $browser_info = get_browser($_SERVER["HTTP_USER_AGENT"], true); + //print_r($browser_info); + if (($browser_info[browser]=='IE' && $browser_info[majorver]>8) || ($browser_info[browser]=='Firefox' && $browser_info[majorver]>2)||($browser_info[browser]=='Safari' && $browser_info[majorver]>4) || $browser_info[browser]=='Chrome' || ($browser_info[browser]=='Opera' && $browser_info[majorver]>9)){ + return true; + }else{ + return false; + } +} + ?> \ No newline at end of file diff --git a/main/document/document.php b/main/document/document.php index 2c78a0b303..223b4955da 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -823,11 +823,13 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold } // Create new draw + if (support_svg()){ ?>   diff --git a/main/img/draw.png b/main/img/draw.png index fe5ca3b6ef..fc4e2e6d92 100644 Binary files a/main/img/draw.png and b/main/img/draw.png differ diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 843218eacc..f3fd0c18f0 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -195,6 +195,7 @@ class DocumentManager { 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svf' => 'application/vnd.svf', + 'svg' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', 'sxc' => 'application/vnd.sun.xml.calc', 'sxi' => 'application/vnd.sun.xml.impress', diff --git a/main/inc/lib/fileDisplay.lib.php b/main/inc/lib/fileDisplay.lib.php index f42cadbbd1..bd07f4075d 100755 --- a/main/inc/lib/fileDisplay.lib.php +++ b/main/inc/lib/fileDisplay.lib.php @@ -53,6 +53,7 @@ function choose_image($file_name) $type['word' ] = array('doc', 'dot', 'rtf', 'mcw', 'wps', 'psw', 'docm', 'docx', 'dotm', 'dotx'); $type['web' ] = array('htm', 'html', 'htx', 'xml', 'xsl', 'php', 'xhtml'); $type['image' ] = array('gif', 'jpg', 'png', 'bmp', 'jpeg'); + $type['image_vect'] = array('svg'); $type['audio' ] = array('wav', 'mid', 'mp2', 'mp3', 'midi', 'sib', 'amr', 'kar'); $type['video' ] = array('mp4', 'mov', 'rm', 'pls', 'mpg', 'mpeg', 'au', 'flv', 'avi', 'wmv', 'asf', '3gp'); $type['excel' ] = array('xls', 'xlt', 'xls', 'xlt', 'pxl', 'xlsx', 'xlsm', 'xlam', 'xlsb', 'xltm', 'xltx'); @@ -66,10 +67,12 @@ function choose_image($file_name) $type['oo_calc' ] = array('ods', 'ots', 'sxc', 'stc'); $type['oo_impress'] = array('odp', 'otp', 'sxi', 'sti'); $type['oo_draw' ] = array('odg', 'otg', 'sxd', 'std'); + $image['word' ] = 'word.gif'; $image['web' ] = 'file_html.gif'; $image['image' ] = 'file_image.gif'; + $image['image_vect'] = 'file_svg.png'; $image['audio' ] = 'file_sound.gif'; $image['video' ] = 'film.gif'; $image['excel' ] = 'excel.gif'; diff --git a/main/inc/lib/svg-edit/extensions/imagelib/index.php b/main/inc/lib/svg-edit/extensions/imagelib/index.php index 9daa982515..b148a5ab0d 100644 --- a/main/inc/lib/svg-edit/extensions/imagelib/index.php +++ b/main/inc/lib/svg-edit/extensions/imagelib/index.php @@ -57,8 +57,14 @@ $web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/images/gal echo ''; ?>