Преглед на файлове

HTML code editor for not rich edition

pecesama преди 15 години
родител
ревизия
4772809453
променени са 33 файла, в които са добавени 267 реда и са изтрити 8 реда
  1. 34 7
      admin/index.php
  2. 27 0
      admin/scripts/markitup/jquery.markitup.pack.js
  3. BIN
      admin/scripts/markitup/sets/html/images/bold.png
  4. BIN
      admin/scripts/markitup/sets/html/images/clean.png
  5. BIN
      admin/scripts/markitup/sets/html/images/code.png
  6. BIN
      admin/scripts/markitup/sets/html/images/fonts.png
  7. BIN
      admin/scripts/markitup/sets/html/images/h1.png
  8. BIN
      admin/scripts/markitup/sets/html/images/h2.png
  9. BIN
      admin/scripts/markitup/sets/html/images/h3.png
  10. BIN
      admin/scripts/markitup/sets/html/images/h4.png
  11. BIN
      admin/scripts/markitup/sets/html/images/h5.png
  12. BIN
      admin/scripts/markitup/sets/html/images/h6.png
  13. BIN
      admin/scripts/markitup/sets/html/images/image.png
  14. BIN
      admin/scripts/markitup/sets/html/images/italic.png
  15. BIN
      admin/scripts/markitup/sets/html/images/link.png
  16. BIN
      admin/scripts/markitup/sets/html/images/list-bullet.png
  17. BIN
      admin/scripts/markitup/sets/html/images/list-item.png
  18. BIN
      admin/scripts/markitup/sets/html/images/list-numeric.png
  19. BIN
      admin/scripts/markitup/sets/html/images/more.png
  20. BIN
      admin/scripts/markitup/sets/html/images/paragraph.png
  21. BIN
      admin/scripts/markitup/sets/html/images/picture.png
  22. BIN
      admin/scripts/markitup/sets/html/images/preview.png
  23. BIN
      admin/scripts/markitup/sets/html/images/quotes.png
  24. BIN
      admin/scripts/markitup/sets/html/images/stroke.png
  25. BIN
      admin/scripts/markitup/sets/html/images/underline.png
  26. BIN
      admin/scripts/markitup/sets/html/images/url.png
  27. 35 0
      admin/scripts/markitup/sets/html/set.js
  28. 39 0
      admin/scripts/markitup/sets/html/style.css
  29. BIN
      admin/scripts/markitup/skins/simple/images/handle.png
  30. BIN
      admin/scripts/markitup/skins/simple/images/menu.png
  31. BIN
      admin/scripts/markitup/skins/simple/images/submenu.png
  32. 131 0
      admin/scripts/markitup/skins/simple/style.css
  33. 1 1
      classes/functions.php

+ 34 - 7
admin/index.php Целия файл

@@ -66,10 +66,15 @@ if ($user->isAuthenticated()) {
66 66
 			$_POST["description"] = addslashes($_POST["description"]);
67 67
 		}		
68 68
 		
69
+		/*
69 70
 		$textile = new Textile();
70 71
 		
71 72
 		$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
72 73
 		$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
74
+		*/
75
+		
76
+		$_POST["title"] = removeBadTags($_POST["title"],true);
77
+		$_POST["description"] = removeBadTags($_POST["description"]);
73 78
 		
74 79
 		if (isset($_POST["id_post"])) {
75 80
 			$tumble->modifyPost($_POST, $_POST["id_post"]);
@@ -112,12 +117,29 @@ if ($user->isAuthenticated()) {
112 117
 		if($conf->richText) {
113 118
 ?>
114 119
         	<script src="<?php echo $conf->urlGelato;?>/admin/scripts/nicEdit.js" type="text/javascript"></script>
115
-			<script type="text/javascript">
120
+                        <script type="text/javascript">
116 121
                  bkLib.onDomLoaded(nicEditors.allTextAreas);
117
-            </script>
122
+            </script>			
123
+<?php
124
+		} else {
125
+		
126
+?>
127
+		<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/jquery.markitup.pack.js"></script>
128
+			<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/set.js"></script>
129
+			
130
+			<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/skins/simple/style.css" />
131
+			<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/style.css" />
132
+			
133
+			<script type="text/javascript" >
134
+			   $(document).ready(function() {
135
+				  $("#description").markItUp(my_html);
136
+			   });
137
+			</script>		
118 138
 <?php
119 139
 		}
140
+		
120 141
 ?>
142
+
121 143
 		<style type="text/css" media="screen">	
122 144
 			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
123 145
 			@import "<?php echo $conf->urlGelato;?>/admin/css/lightbox.css";
@@ -292,11 +314,16 @@ if ($user->isAuthenticated()) {
292 314
 ?>
293 315
 								<p>
294 316
 									<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
295
-                                    	<a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?>
296
-                                        <br />
297
-                                        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>
298
-                                    </span>
299
-								</p>
317
+                                    	<?php echo __("Some HTML allowed")?>:<br />
318
+										&nbsp;&nbsp;&nbsp;&nbsp;
319
+										<code>
320
+										&lt;strong&gt; &lt;em&gt; &lt;del&gt; &lt;ul&gt;  &lt;ol&gt;  &lt;li&gt; &lt;a&gt;
321
+										<br />
322
+										&nbsp;&nbsp;&nbsp;&nbsp;&lt;blockquote&gt;
323
+                                        &lt;code&gt; &lt;pre&gt; &lt;img&gt;
324
+										<code>
325
+										<br />
326
+                                        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>
300 327
 								<p>
301 328
 									<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
302 329
 								</p>

Файловите разлики са ограничени, защото са твърде много
+ 27 - 0
admin/scripts/markitup/jquery.markitup.pack.js


BIN
admin/scripts/markitup/sets/html/images/bold.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/clean.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/code.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/fonts.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h1.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h2.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h3.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h4.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h5.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/h6.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/image.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/italic.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/link.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/list-bullet.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/list-item.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/list-numeric.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/more.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/paragraph.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/picture.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/preview.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/quotes.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/stroke.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/underline.png Целия файл


BIN
admin/scripts/markitup/sets/html/images/url.png Целия файл


+ 35 - 0
admin/scripts/markitup/sets/html/set.js Целия файл

@@ -0,0 +1,35 @@
1
+// ----------------------------------------------------------------------------
2
+// markItUp!
3
+// ----------------------------------------------------------------------------
4
+// Copyright (C) 2008 Jay Salvat
5
+// http://markitup.jaysalvat.com/
6
+// ----------------------------------------------------------------------------
7
+// Html tags
8
+// http://en.wikipedia.org/wiki/html
9
+// ----------------------------------------------------------------------------
10
+// Basic set. Feel free to add more tags
11
+// ----------------------------------------------------------------------------
12
+my_html = {
13
+	nameSpace:      "my_html", // Used to prevent multi-instances CSS conflict
14
+	onShiftEnter:	{keepDefault:false, replaceWith:'<br />\n'},
15
+	onCtrlEnter:	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
16
+	onTab:			{keepDefault:false, openWith:'	 '},
17
+	markupSet: [		
18
+		{name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' },
19
+		{separator:'---------------' },
20
+		{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
21
+		{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
22
+		{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
23
+		{separator:'---------------' },
24
+		{name:'Ul', openWith:'<ul>\n', closeWith:'</ul>\n' },
25
+		{name:'Ol', openWith:'<ol>\n', closeWith:'</ol>\n' },
26
+		{name:'Li', openWith:'<li>', closeWith:'</li>' },
27
+		{separator:'---------------' },		
28
+		{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
29
+		{separator:'---------------' },
30
+		{name:'Quote block', openWith:'<blockquote>\n', closeWith:'</blockquote>\n' },
31
+        {name:'Code block', openWith:'<code>\n', closeWith:'</code>\n' },		
32
+		{separator:'---------------' },
33
+		{name:'Clean', replaceWith:function(h) { return h.selection.replace(/<(.*?)>/g, "") } }
34
+	]
35
+}

+ 39 - 0
admin/scripts/markitup/sets/html/style.css Целия файл

@@ -0,0 +1,39 @@
1
+/* -------------------------------------------------------------------
2
+// markItUp!
3
+// By Jay Salvat - http://markitup.jaysalvat.com/
4
+// ------------------------------------------------------------------*/
5
+.markItUpButton1 a {
6
+	background-image:url(images/paragraph.png); 
7
+}
8
+.markItUpButton2 a {
9
+	background-image:url(images/bold.png); 
10
+}
11
+.markItUpButton3 a {
12
+	background-image:url(images/italic.png); 
13
+}
14
+.markItUpButton4 a {
15
+	background-image:url(images/stroke.png); 
16
+}
17
+.markItUpButton5 a {
18
+	background-image:url(images/list-bullet.png); 
19
+}
20
+.markItUpButton6 a {
21
+	background-image:url(images/list-numeric.png);
22
+}
23
+.markItUpButton7 a {
24
+	background-image:url(images/list-item.png);
25
+}
26
+
27
+.markItUpButton8 a {
28
+	background-image:url(images/link.png);	
29
+}
30
+.markItUpButton9 a {
31
+	background-image:url(images/quotes.png);
32
+}
33
+.markItUpButton10 a {
34
+	background-image:url(images/code.png);
35
+}
36
+
37
+.markItUpButton11 a {
38
+	background-image:url(images/clean.png);
39
+}

BIN
admin/scripts/markitup/skins/simple/images/handle.png Целия файл


BIN
admin/scripts/markitup/skins/simple/images/menu.png Целия файл


BIN
admin/scripts/markitup/skins/simple/images/submenu.png Целия файл


+ 131 - 0
admin/scripts/markitup/skins/simple/style.css Целия файл

@@ -0,0 +1,131 @@
1
+#poststuff {
2
+	position: relative !important;
3
+}
4
+
5
+#submitpost {
6
+	position: absolute !important;
7
+	right: 0px !important;
8
+	float: none !important;
9
+}
10
+
11
+.markItUp * {
12
+	margin: 0;
13
+	padding: 0;
14
+	border: 0;
15
+	outline: 0;
16
+	font-weight: inherit;
17
+	font-style: inherit;
18
+	font-size: 100%;
19
+	font-family: inherit;
20
+	vertical-align: baseline;
21
+}
22
+.markItUp a:link,
23
+.markItUp a:visited {
24
+	color:#000;
25
+	text-decoration:none;
26
+}
27
+.markItUp  {
28
+	width:700px;
29
+	margin:5px 0 5px 0;
30
+}
31
+.markItUpContainer  {
32
+	font:11px Verdana, Arial, Helvetica, sans-serif;
33
+}
34
+.markItUpEditor {
35
+	font:12px 'Courier New', Courier, monospace;
36
+	padding:5px;
37
+	width:690px;
38
+	height:320px;
39
+	clear:both; display:block;
40
+	line-height:18px;
41
+	overflow:auto;
42
+}
43
+.markItUpPreviewFrame	{
44
+	overflow:auto;
45
+	background-color:#FFF;
46
+	width:99.9%;
47
+	height:300px;
48
+	margin:5px 0;
49
+}
50
+.markItUpFooter {
51
+	width:100%;
52
+}
53
+.markItUpResizeHandle {
54
+	overflow:hidden;
55
+	width:22px; height:5px;
56
+	margin-left:auto;
57
+	margin-right:auto;
58
+	background-image:url(images/handle.png);
59
+	cursor:n-resize;
60
+}
61
+/***************************************************************************************/
62
+/* first row of buttons */
63
+.markItUpHeader ul li	{
64
+	list-style:none;
65
+	float:left;
66
+	position:relative;
67
+}
68
+.markItUpHeader ul li:hover > ul{
69
+	display:block;
70
+}
71
+.markItUpHeader ul .markItUpDropMenu {
72
+	background:transparent url(images/menu.png) no-repeat 115% 50%;
73
+	margin-right:5px;
74
+}
75
+.markItUpHeader ul .markItUpDropMenu li {
76
+	margin-right:0px;
77
+}
78
+/* next rows of buttons */
79
+.markItUpHeader ul ul {
80
+	display:none;
81
+	position:absolute;
82
+	top:18px; left:0px;	
83
+	background:#FFF;
84
+	border:1px solid #000;
85
+}
86
+.markItUpHeader ul ul li {
87
+	float:none;
88
+	border-bottom:1px solid #000;
89
+}
90
+.markItUpHeader ul ul .markItUpDropMenu {
91
+	background:#FFF url(images/submenu.png) no-repeat 100% 50%;
92
+}
93
+.markItUpHeader ul .markItUpSeparator {
94
+	margin:0 10px;
95
+	width:1px;
96
+	height:16px;
97
+	overflow:hidden;
98
+	background-color:#CCC;
99
+}
100
+.markItUpHeader ul ul .markItUpSeparator {
101
+	width:auto; height:1px;
102
+	margin:0px;
103
+}
104
+/* next rows of buttons */
105
+.markItUpHeader ul ul ul {
106
+	position:absolute;
107
+	top:-1px; left:150px; 
108
+}
109
+.markItUpHeader ul ul ul li {
110
+	float:none;
111
+}
112
+.markItUpHeader ul a {
113
+	display:block;
114
+	width:16px; height:16px;
115
+	text-indent:-10000px;
116
+	background-repeat:no-repeat;
117
+	padding:3px;
118
+	margin:0px;
119
+}
120
+.markItUpHeader ul ul a {
121
+	display:block;
122
+	padding-left:0px;
123
+	text-indent:0;
124
+	width:120px; 
125
+	padding:5px 5px 5px 25px;
126
+	background-position:2px 50%;
127
+}
128
+.markItUpHeader ul ul a:hover  {
129
+	color:#FFF;
130
+	background-color:#000;
131
+}

+ 1 - 1
classes/functions.php Целия файл

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