Skip to content

Commit

Permalink
Show options if wiki page exists see BT#7058
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed May 22, 2015
1 parent b39d0cf commit c7f6b07
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions main/wiki/wiki.inc.php
Expand Up @@ -293,7 +293,7 @@ public function save_wiki($values)
$values['content'] = Security::remove_XSS($values['content']);
}
$version = intval($values['version']) + 1 ;
$linkTo = self::links_to($_clean['content']); //and check links content
$linkTo = self::links_to($values['content']); //and check links content

//cleaning config variables
if (!empty($values['task'])) {
Expand Down Expand Up @@ -372,13 +372,13 @@ public function save_wiki($values)

if ($pageId == 0) {
$sql = 'UPDATE '.$tbl_wiki.' SET
page_id="'.$id.'"
page_id = "'.$id.'"
WHERE c_id = '.$course_id.' AND id="'.$id.'"';
Database::query($sql);
}

//update wiki config
if ($values['reflink'] == 'index' && $_clean['version'] == 1 ) {
if ($values['reflink'] == 'index' && $version == 1 ) {
$sql = "INSERT INTO ".$tbl_wiki_conf." (c_id, page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit)
VALUES ($course_id, '".$id."','".$_clean['task']."','".$_clean['feedback1']."','".$_clean['feedback2']."','".$_clean['feedback3']."','".$_clean['fprogress1']."','".$_clean['fprogress2']."','".$_clean['fprogress3']."','".$_clean['max_text']."','".$_clean['max_version']."','".$_clean['startdate_assig']."','".$_clean['enddate_assig']."','".$_clean['delayedsubmit']."')";
Database::query($sql);
Expand Down Expand Up @@ -925,20 +925,21 @@ public function display_wiki_entry($newtitle)
//page action: notification
if (api_is_allowed_to_session_edit()) {
if (self::check_notify_page($page)==1) {
$notify_page= Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL);
$notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL);
$lock_unlock_notify_page='unlocknotify';
} else {
$notify_page= Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL);
$notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL);
$lock_unlock_notify_page='locknotify';
}
}

echo '<span style="float:right;">';
echo '<a href="index.php?action=showpage&amp;actionpage='.$lock_unlock_notify_page.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_page.'</a>';
echo '</span>';

//ONly available if row['id'] is set
// ONly available if row['id'] is set
if ($row['id']) {

echo '<span style="float:right;">';
echo '<a href="index.php?action=showpage&amp;actionpage='.$lock_unlock_notify_page.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_page.'</a>';
echo '</span>';

//page action: export to pdf
echo '<span style="float:right;">';
echo '<form name="form_export2PDF" method="get" action="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?'.api_get_cidreq().'" >';
Expand Down Expand Up @@ -966,24 +967,23 @@ public function display_wiki_entry($newtitle)
Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a>';
echo '</span>';
}
}

//export to print
?>
<script>
function goprint() {
var a = window.open('','','width=800,height=600');
a.document.open("text/html");
a.document.write(document.getElementById('wikicontent').innerHTML);
a.document.close();
a.print();
}
</script>
<?php
echo '<span style="float:right; cursor: pointer;">';
echo Display::return_icon('printer.png', get_lang('Print'),array('onclick' => "javascript: goprint();"),ICON_SIZE_SMALL);
echo '</span>';

//export to print
?>
<script>
function goprint() {
var a = window.open('','','width=800,height=600');
a.document.open("text/html");
a.document.write(document.getElementById('wikicontent').innerHTML);
a.document.close();
a.print();
}
</script>
<?php
echo '<span style="float:right; cursor: pointer;">';
echo Display::return_icon('printer.png', get_lang('Print'),array('onclick' => "javascript: goprint();"),ICON_SIZE_SMALL);
echo '</span>';
}
if (empty($title)) {
$title=get_lang('DefaultTitle');
}
Expand Down

0 comments on commit c7f6b07

Please sign in to comment.