diff --git a/main/wiki/css/default.css b/main/wiki/css/default.css index e654a0ebbe..6342eb28a1 100755 --- a/main/wiki/css/default.css +++ b/main/wiki/css/default.css @@ -53,6 +53,8 @@ padding: 3px; padding-top:5px; border-top: 1px solid #ccc; + height: auto!important; + min-height:20px; } #wikititle input { border: 1px solid #333; diff --git a/main/wiki/index.php b/main/wiki/index.php index b61550ef3e..8a1ff9617d 100755 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -513,6 +513,20 @@ if (!in_array($_GET['action'], array('addnew', 'searchpages', 'allpages', 'recen /////////////////////// more options /////////////////////// Juan Carlos RaƱa Trabado +//more for export to course document area. See display_wiki_entry +if ($_POST['export2DOC']) +{ + $titleDOC=$_POST['titleDOC']; + $contentDOC=$_POST['contentDOC']; + $groupIdDOC=(int)$_SESSION['_gid']; + $export2doc = export2doc($titleDOC,$contentDOC,$groupIdDOC); + + if ($export2doc) { + Display::display_normal_message(get_lang('ThePageHasBeenExportedToDocArea')); + } + +} + if ($_GET['action']=='more') { @@ -1491,10 +1505,11 @@ if ($_GET['action']=='edit') } //form echo '
'; - echo '
'; - echo $icon_assignment.'   '.$title; - // - + + + echo '
'; + echo '
'.$icon_assignment.str_repeat(' ',3).$title.'
'; + if((api_is_allowed_to_edit(false,true) || api_is_platform_admin()) && $row['reflink']!='index') { diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index 2a0a83deb3..d8bf4a5808 100755 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -205,6 +205,8 @@ function detect_irc_link($input) **/ function make_wiki_link_clickable($input) { + global $_course; + if (isset($_SESSION['_gid'])) { $_clean['group_id']=(int)$_SESSION['_gid']; @@ -285,9 +287,7 @@ function make_wiki_link_clickable($input) * @return language string saying that the changes are stored **/ function save_wiki() { - global $charset; - global $tbl_wiki; - global $tbl_wiki_conf; + global $charset, $tbl_wiki, $_course, $tbl_wiki_conf; // NOTE: visibility, visibility_disc and ratinglock_disc changes are not made here, but through the interce buttons @@ -398,7 +398,7 @@ function save_wiki() { function restore_wikipage($r_page_id, $r_reflink, $r_title, $r_content, $r_group_id, $r_assignment, $r_progress, $c_version, $r_version, $r_linksto) { - global $tbl_wiki; + global $tbl_wiki, $_course; $r_user_id= api_get_user_id(); $r_dtime = date( "Y-m-d H:i:s" ); @@ -580,7 +580,7 @@ function save_new_wiki() { **/ function display_new_wiki_form() { - +global $_course; ?> '; + echo ''; echo ''.get_lang('Print').''; echo ''; @@ -976,16 +972,6 @@ function display_wiki_entry($newtitle) }//end filter visibility } // end function display_wiki_entry - -//more for export to course document area. See display_wiki_entry -if ($_POST['export2DOC']) -{ - $titleDOC=$_POST['titleDOC']; - $contentDOC=$_POST['contentDOC']; - $groupIdDOC=(int)$_SESSION['_gid']; - export2doc($titleDOC,$contentDOC,$groupIdDOC); -} - /** * This function counted the words in a document. Thanks Adeel Khan */ @@ -1720,6 +1706,8 @@ function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='') */ function export2doc($wikiTitle, $wikiContents, $groupId) { + global $_course; + $template = ' @@ -1771,6 +1759,13 @@ function export2doc($wikiTitle, $wikiContents, $groupId) $wikiContents = str_replace('{CONTENT}', $wikiContents, $template); + // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents + if (api_strpos($wikiContents,'../../courses/') !== false) { + $web_course_path = api_get_path(WEB_COURSE_PATH); + $wikiContents = str_replace('../../courses/',$web_course_path,$wikiContents); + } + + $doc_id = 0; $i = 1; while ( file_exists($exportDir . '/' .$exportFile.'_'.$i.'.html') ) $i++; //only export last version, but in new export new version in document area $wikiFileName = $exportFile . '_' . $i . '.html'; @@ -1778,6 +1773,8 @@ function export2doc($wikiTitle, $wikiContents, $groupId) file_put_contents( $exportPath, $wikiContents ); $doc_id = add_document($_course, $groupPath.'/'.$wikiFileName, 'file', filesize($exportPath), $wikiTitle); api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $groupId); + + return $doc_id; // TODO: link to go document area } @@ -2122,4 +2119,4 @@ function two_digits($number) return ($number < 10) ? '0'.$number : $number; } -?> \ No newline at end of file +?>