Commit 69e78bfd authored by mose's avatar mose

[MOD] notepad: removed template type of note, and simplified code for wysiwyg use

parent bc3e34d0
......@@ -10,11 +10,9 @@
<form id='formread' action="tiki-notepad_read.php" method="post">
<input type="hidden" name="noteId" value="{$noteId|escape}" />
<select name="parse_mode" onchange="javascript:document.getElementById('formread').submit();">
<option value="raw" {if $parse_mode eq 'raw'}selected="selected"{/if}>{tr}Normal{/tr}</option>
<option value="wiki"{if $parse_mode eq 'wiki'}selected="selected"{/if}>{tr}Wiki{/tr}</option>
<option value="template"{if $parse_mode eq 'template'}selected="selected"{/if}>{tr}Template{/tr}</option>
<option value="raw"{if $info.parse_mode eq 'raw'} selected="selected"{/if}>{tr}Text{/tr}</option>
<option value="wiki"{if $info.parse_mode eq 'wiki'} selected="selected"{/if}>{tr}Wiki{/tr}</option>
</select>
<!--<input type="submit" name="setpm" value="{tr}set{/tr}" />-->
</form>
</td>
<td>
......@@ -42,18 +40,11 @@
<input type="hidden" name="noteId" value="{$noteId|escape}" />
<input type="submit" name="wikify" value="{tr}wiki overwrite{/tr}" />
<input size="20" type="text" name="wiki_name" value="{$info.name|escape}" />
<input type="checkbox" name="over" />
</form>
{/if}
</td>
{/if}
</tr></table>
{if $smarty.request.parse_mode eq 'template'}
<div class="wikitext">
{$info.data}
</div>
{else}
<div class="wikitext">
{$info.parsed}
</div>
{/if}
<div class="wikitext">
{$info.parsed}
</div>
......@@ -9,7 +9,7 @@
<input type="hidden" name="noteId" value="{$noteId|escape}" />
<table class="normal">
<tr class="formcolor"><td>{tr}Name{/tr}</td><td><input type="text" name="name" value="{$info.name|escape}" /></td></tr>
{if $feature_wysiwyg eq 'y'}
{if $feature_wysiwyg eq 'y' and $wysiwyg eq 'y'}
<tr class="formcolor"><td colspan="2">
{editform InstanceName=data Meat=$info.data}
</td></tr>
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-notepad_read.php,v 1.16 2006-12-03 16:30:51 mose Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-notepad_read.php,v 1.17 2006-12-17 06:49:48 mose Exp $
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
$section = 'mytiki';
require_once ('tiki-setup.php');
include_once ('lib/notepad/notepadlib.php');
if ($feature_notepad != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_notepad");
$smarty->display("error.tpl");
die;
}
if (!$user) {
$smarty->assign('msg', tra("Must be logged to use this feature"));
$smarty->display("error.tpl");
die;
}
if ($tiki_p_notepad != 'y') {
$smarty->assign('msg', tra("Permission denied to use this feature"));
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST["noteId"])) {
$smarty->assign('msg', tra("No note indicated"));
$smarty->display("error.tpl");
die;
}
......@@ -41,7 +36,6 @@ if (!isset($_REQUEST["noteId"])) {
if (isset($_REQUEST["remove"])) {
check_ticket('notepad-read');
$notepadlib->remove_note($user, $_REQUEST['noteId']);
header ('location: tiki-notepad_list.php');
die;
}
......@@ -50,27 +44,23 @@ $info = $notepadlib->get_note($user, $_REQUEST["noteId"]);
if ($tiki_p_edit == 'y') {
if (isset($_REQUEST['wikify'])) {
check_ticket('notepad-read');
check_ticket('notepad-read');
if (empty($_REQUEST['wiki_name'])) {
$smarty->assign('msg', tra("No name indicated for wiki page"));
$smarty->display("error.tpl");
die;
}
if ($tikilib->page_exists($_REQUEST['wiki_name']) && !isset($_REQUEST['over'])) {
$smarty->assign('msg', tra("Page already exists"));
$smarty->display("error.tpl");
die;
}
if ($tikilib->page_exists($_REQUEST['wiki_name'])) {
$tikilib->update_page($_REQUEST['wiki_name'], $info['data'], tra('created from notepad'), $user,
'127.0.1.1', $info['name']);
$tikilib->update_page($_REQUEST['wiki_name'], $info['data'], tra('created from notepad'), $user, '127.0.1.1', $info['name']);
} else {
$tikilib->create_page($_REQUEST['wiki_name'],
0, $info['data'], date("U"), tra('created from notepad'), $user, $ip = '0.0.0.0', $info['name']);
$tikilib->create_page($_REQUEST['wiki_name'], 0, $info['data'], date("U"), tra('created from notepad'), $user, $ip = '0.0.0.0', $info['name']);
}
}
}
......@@ -81,20 +71,19 @@ if ($tikilib->page_exists($info['name'])) {
$smarty->assign("wiki_exists", "n");
}
if (!isset($_REQUEST['parse_mode']))
$_REQUEST['parse_mode'] = $info['parse_mode'];
if (isset($_REQUEST['parse_mode']) and $_REQUEST['parse_mode'] != $info['parse_mode']) {
$notepadlib->set_note_parsing($user, $_REQUEST['noteId'], $_REQUEST['parse_mode']);
$info['parse_mode'] = $_REQUEST['parse_mode'];
}
if ($_REQUEST['parse_mode'] == 'raw') {
if ($info['parse_mode'] == 'raw') {
$info['parsed'] = nl2br(htmlspecialchars($info['data']));
$smarty->assign('wysiwyg','n');
} else {
include 'tiki-parsemode_setup.php';
$info['parsed'] = $tikilib->parse_data($info['data'],$is_html);
}
if ($_REQUEST['parse_mode'] == 'wiki') {
$info['parsed'] = $tikilib->parse_data(htmlspecialchars($info['data']));
}
$notepadlib->set_note_parsing($user, $_REQUEST['noteId'], $_REQUEST['parse_mode']);
$smarty->assign('parse_mode', $_REQUEST['parse_mode']);
$smarty->assign('noteId', $_REQUEST["noteId"]);
$smarty->assign('info', $info);
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-notepad_write.php,v 1.12 2006-12-03 16:30:51 mose Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-notepad_write.php,v 1.13 2006-12-17 06:49:48 mose Exp $
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
$section = 'mytiki';
require_once ('tiki-setup.php');
include_once ('lib/notepad/notepadlib.php');
if ($feature_notepad != 'y') {
$smarty->assign('msg', tra("This feature is disabled").": feature_notepad");
$smarty->display("error.tpl");
die;
}
if (!$user) {
$smarty->assign('msg', tra("Must be logged to use this feature"));
$smarty->display("error.tpl");
die;
}
if ($tiki_p_notepad != 'y') {
$smarty->assign('msg', tra("Permission denied to use this feature"));
$smarty->display("error.tpl");
die;
}
if (!isset($_REQUEST["noteId"]))
$_REQUEST["noteId"] = 0;
if (isset($_REQUEST["remove"])) {
check_ticket('notepad-write');
$notepadlib->remove_note($user, $_REQUEST['remove']);
......@@ -41,19 +36,25 @@ if (isset($_REQUEST["remove"])) {
if ($_REQUEST["noteId"]) {
$info = $notepadlib->get_note($user, $_REQUEST["noteId"]);
if ($info['parse_mode'] == 'raw') {
$info['parsed'] = nl2br(htmlspecialchars($info['data']));
$smarty->assign('wysiwyg','n');
} else {
include 'tiki-parsemode_setup.php';
$info['parsed'] = $tikilib->parse_data($info['data'],$is_html);
}
} else {
$info = array();
$info['name'] = '';
$info['data'] = '';
$info['parse_mode'] = 'raw';
$smarty->assign('wysiwyg','n');
}
if (isset($_REQUEST['save'])) {
check_ticket('notepad-write');
$notepadlib->replace_note($user, $_REQUEST["noteId"], $_REQUEST["name"], $_REQUEST["data"]);
//:TODO: replace this putting the code in notepad-list
header ('location: tiki-notepad_list.php');
header ('location: tiki-notepad_read.php?noteId='.$_REQUEST["noteId"]);
die;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment