HTML code editor for not rich edition

master
pecesama 2008-10-23 20:09:39 +00:00
parent dcc69bcd1f
commit 4772809453
33 changed files with 267 additions and 8 deletions

View File

@ -66,10 +66,15 @@ if ($user->isAuthenticated()) {
$_POST["description"] = addslashes($_POST["description"]); $_POST["description"] = addslashes($_POST["description"]);
} }
/*
$textile = new Textile(); $textile = new Textile();
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true)); $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"])); $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
*/
$_POST["title"] = removeBadTags($_POST["title"],true);
$_POST["description"] = removeBadTags($_POST["description"]);
if (isset($_POST["id_post"])) { if (isset($_POST["id_post"])) {
$tumble->modifyPost($_POST, $_POST["id_post"]); $tumble->modifyPost($_POST, $_POST["id_post"]);
@ -112,12 +117,29 @@ if ($user->isAuthenticated()) {
if($conf->richText) { if($conf->richText) {
?> ?>
<script src="<?php echo $conf->urlGelato;?>/admin/scripts/nicEdit.js" type="text/javascript"></script> <script src="<?php echo $conf->urlGelato;?>/admin/scripts/nicEdit.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
bkLib.onDomLoaded(nicEditors.allTextAreas); bkLib.onDomLoaded(nicEditors.allTextAreas);
</script> </script>
<?php
} else {
?>
<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/jquery.markitup.pack.js"></script>
<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/set.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/skins/simple/style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/style.css" />
<script type="text/javascript" >
$(document).ready(function() {
$("#description").markItUp(my_html);
});
</script>
<?php <?php
} }
?> ?>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
@import "<?php echo $conf->urlGelato;?>/admin/css/style.css"; @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
@import "<?php echo $conf->urlGelato;?>/admin/css/lightbox.css"; @import "<?php echo $conf->urlGelato;?>/admin/css/lightbox.css";
@ -292,11 +314,16 @@ if ($user->isAuthenticated()) {
?> ?>
<p> <p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"> <span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
<a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?> <?php echo __("Some HTML allowed")?>:<br />
<br /> &nbsp;&nbsp;&nbsp;&nbsp;
Bookmarklet - <a href="javascript:var w; setTimeout('w.focus()',100);w=window.open('<?php echo $conf->urlGelato; ?>/admin/bm.php?url='+encodeURIComponent(location.href)+'&sel='+encodeURIComponent(window.getSelection()),'bookmarklet','toolbar=0,resizable=0,status=1,width=650,height=460,dependent=yes' ); w.focus();"><?php echo __("add to gelato")?></a> <code>
</span> &lt;strong&gt; &lt;em&gt; &lt;del&gt; &lt;ul&gt; &lt;ol&gt; &lt;li&gt; &lt;a&gt;
</p> <br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;blockquote&gt;
&lt;code&gt; &lt;pre&gt; &lt;img&gt;
<code>
<br />
Bookmarklet - <a href="javascript:var w; setTimeout('w.focus()',100);w=window.open('<?php echo $conf->urlGelato; ?>/admin/bm.php?url='+encodeURIComponent(location.href)+'&sel='+encodeURIComponent(window.getSelection()),'bookmarklet','toolbar=0,resizable=0,status=1,width=650,height=460,dependent=yes' ); w.focus();"><?php echo __("add to gelato")?></a> </span> </p>
<p> <p>
<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" /> <input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
</p> </p>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

View File

@ -0,0 +1,35 @@
// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Html tags
// http://en.wikipedia.org/wiki/html
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
// ----------------------------------------------------------------------------
my_html = {
nameSpace: "my_html", // Used to prevent multi-instances CSS conflict
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
onTab: {keepDefault:false, openWith:' '},
markupSet: [
{name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' },
{separator:'---------------' },
{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
{separator:'---------------' },
{name:'Ul', openWith:'<ul>\n', closeWith:'</ul>\n' },
{name:'Ol', openWith:'<ol>\n', closeWith:'</ol>\n' },
{name:'Li', openWith:'<li>', closeWith:'</li>' },
{separator:'---------------' },
{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
{separator:'---------------' },
{name:'Quote block', openWith:'<blockquote>\n', closeWith:'</blockquote>\n' },
{name:'Code block', openWith:'<code>\n', closeWith:'</code>\n' },
{separator:'---------------' },
{name:'Clean', replaceWith:function(h) { return h.selection.replace(/<(.*?)>/g, "") } }
]
}

View File

@ -0,0 +1,39 @@
/* -------------------------------------------------------------------
// markItUp!
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUpButton1 a {
background-image:url(images/paragraph.png);
}
.markItUpButton2 a {
background-image:url(images/bold.png);
}
.markItUpButton3 a {
background-image:url(images/italic.png);
}
.markItUpButton4 a {
background-image:url(images/stroke.png);
}
.markItUpButton5 a {
background-image:url(images/list-bullet.png);
}
.markItUpButton6 a {
background-image:url(images/list-numeric.png);
}
.markItUpButton7 a {
background-image:url(images/list-item.png);
}
.markItUpButton8 a {
background-image:url(images/link.png);
}
.markItUpButton9 a {
background-image:url(images/quotes.png);
}
.markItUpButton10 a {
background-image:url(images/code.png);
}
.markItUpButton11 a {
background-image:url(images/clean.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

View File

@ -0,0 +1,131 @@
#poststuff {
position: relative !important;
}
#submitpost {
position: absolute !important;
right: 0px !important;
float: none !important;
}
.markItUp * {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
.markItUp a:link,
.markItUp a:visited {
color:#000;
text-decoration:none;
}
.markItUp {
width:700px;
margin:5px 0 5px 0;
}
.markItUpContainer {
font:11px Verdana, Arial, Helvetica, sans-serif;
}
.markItUpEditor {
font:12px 'Courier New', Courier, monospace;
padding:5px;
width:690px;
height:320px;
clear:both; display:block;
line-height:18px;
overflow:auto;
}
.markItUpPreviewFrame {
overflow:auto;
background-color:#FFF;
width:99.9%;
height:300px;
margin:5px 0;
}
.markItUpFooter {
width:100%;
}
.markItUpResizeHandle {
overflow:hidden;
width:22px; height:5px;
margin-left:auto;
margin-right:auto;
background-image:url(images/handle.png);
cursor:n-resize;
}
/***************************************************************************************/
/* first row of buttons */
.markItUpHeader ul li {
list-style:none;
float:left;
position:relative;
}
.markItUpHeader ul li:hover > ul{
display:block;
}
.markItUpHeader ul .markItUpDropMenu {
background:transparent url(images/menu.png) no-repeat 115% 50%;
margin-right:5px;
}
.markItUpHeader ul .markItUpDropMenu li {
margin-right:0px;
}
/* next rows of buttons */
.markItUpHeader ul ul {
display:none;
position:absolute;
top:18px; left:0px;
background:#FFF;
border:1px solid #000;
}
.markItUpHeader ul ul li {
float:none;
border-bottom:1px solid #000;
}
.markItUpHeader ul ul .markItUpDropMenu {
background:#FFF url(images/submenu.png) no-repeat 100% 50%;
}
.markItUpHeader ul .markItUpSeparator {
margin:0 10px;
width:1px;
height:16px;
overflow:hidden;
background-color:#CCC;
}
.markItUpHeader ul ul .markItUpSeparator {
width:auto; height:1px;
margin:0px;
}
/* next rows of buttons */
.markItUpHeader ul ul ul {
position:absolute;
top:-1px; left:150px;
}
.markItUpHeader ul ul ul li {
float:none;
}
.markItUpHeader ul a {
display:block;
width:16px; height:16px;
text-indent:-10000px;
background-repeat:no-repeat;
padding:3px;
margin:0px;
}
.markItUpHeader ul ul a {
display:block;
padding-left:0px;
text-indent:0;
width:120px;
padding:5px 5px 5px 25px;
background-position:2px 50%;
}
.markItUpHeader ul ul a:hover {
color:#FFF;
background-color:#000;
}

View File

@ -403,7 +403,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
if($secure){ if($secure){
$validTags ='<abbr><acronym><em><i><strong><b><span>'; $validTags ='<abbr><acronym><em><i><strong><b><span>';
} else { } else {
$validTags ='<p><ol><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strong><b><br><span><div><img>'; $validTags ='<p><ol><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strong><b><del><br><span><div><img>';
} }
$source = strip_tags($source, $validTags); $source = strip_tags($source, $validTags);
return preg_replace('/<(.*?)>/ie', "'<'.removeBadAtributes('\\1').'>'", $source); return preg_replace('/<(.*?)>/ie', "'<'.removeBadAtributes('\\1').'>'", $source);