diff --git a/main/document/edit_odf.php b/main/document/edit_odf.php new file mode 100644 index 0000000000..4f3d69ed64 --- /dev/null +++ b/main/document/edit_odf.php @@ -0,0 +1,67 @@ + + function init() { + var odfelement = document.getElementById("odf"), + odfcanvas = new odf.OdfCanvas(odfelement); + odfcanvas.load("'.$file_url_web.'"); + } + $(document).ready(function() { + window.setTimeout(init, 0); + }); + '; +} + +$interbreadcrumb[]=array("url"=>"./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents')); + +// Interbreadcrumb for the current directory root path +if (empty($document_data['parents'])) { + $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); +} else { + foreach($document_data['parents'] as $document_sub_data) { + if ($document_data['title'] == $document_sub_data['title']) { + continue; + } + $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); + } +} +Display::display_header(''); +echo '
'; +Display::display_footer(); \ No newline at end of file diff --git a/main/document/showinframes.php b/main/document/showinframes.php index 382c1b9c09..722411e1bd 100644 --- a/main/document/showinframes.php +++ b/main/document/showinframes.php @@ -198,15 +198,24 @@ $htmlHeadXtra[] = ' --> '; +$pathinfo = pathinfo($header_file); -//Display::display_header($tool_name, 'User'); +$web_odf_supported_files = DocumentManager::get_web_odf_extension_list(); +if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) { + $show_web_odf = true; +} Display::display_header(''); + echo "
"; $file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq(); -echo ''.get_lang('_cut_paste_link').'
'; +echo ''.get_lang('_cut_paste_link').''; + +if ($show_web_odf) { + //echo Display::url(get_lang('Show'), api_get_path(WEB_CODE_PATH).'document/edit_odf.php?id='.$document_data['id'], array('class' => 'btn')); +} +echo ""; -$pathinfo =pathinfo($header_file); if ($pathinfo['extension']=='wav' && api_get_setting('enable_nanogong') == 'true'){ echo '
'; echo '
'; diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 6e30fb7b8c..e16c5851ef 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -28,7 +28,7 @@ define('DEFAULT_DOCUMENT_QUOTA', $default_quota); * @package chamilo.library */ class DocumentManager { - + private function __construct() { } @@ -2964,5 +2964,9 @@ class DocumentManager { } return true; } + + public function get_web_odf_extension_list(){ + return array('ods', 'odt'); + } } //end class DocumentManager \ No newline at end of file