[Jifty-commit] r3344 - in jifty/trunk/plugins/CodePress: . doc lib lib/Jifty lib/Jifty/Plugin lib/Jifty/Plugin/CodePress share share/po share/web share/web/static share/web/static/codepress share/web/static/codepress/engines share/web/static/codepress/images share/web/static/codepress/languages share/web/static/js t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun Jun 3 21:09:19 EDT 2007


Author: dpavlin
Date: Sun Jun  3 21:09:18 2007
New Revision: 3344

Added:
   jifty/trunk/plugins/CodePress/
   jifty/trunk/plugins/CodePress/Makefile.PL
   jifty/trunk/plugins/CodePress/doc/
   jifty/trunk/plugins/CodePress/doc/index.html
   jifty/trunk/plugins/CodePress/lib/
   jifty/trunk/plugins/CodePress/lib/Jifty/
   jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/
   jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress/
   jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress.pm
   jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress/Model/
   jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress/Textarea.pm
   jifty/trunk/plugins/CodePress/share/
   jifty/trunk/plugins/CodePress/share/po/
   jifty/trunk/plugins/CodePress/share/web/
   jifty/trunk/plugins/CodePress/share/web/static/
   jifty/trunk/plugins/CodePress/share/web/static/codepress/
   jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.html
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/gecko.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/khtml.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/msie.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/older.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/opera.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/images/
   jifty/trunk/plugins/CodePress/share/web/static/codepress/images/line-numbers.png   (contents, props changed)
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.js
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.css
   jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.js
   jifty/trunk/plugins/CodePress/share/web/static/js/
   jifty/trunk/plugins/CodePress/share/web/static/js/codepress.js
   jifty/trunk/plugins/CodePress/t/

Log:
CodePress plugin for web-based source code editor with syntax highlighting

Added: jifty/trunk/plugins/CodePress/Makefile.PL
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/Makefile.PL	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,8 @@
+use inc::Module::Install;
+name('Jifty-Plugin-CodePress');
+version('0.01');
+requires('Jifty' => '0.70422');
+
+install_share;
+
+WriteAll;

Added: jifty/trunk/plugins/CodePress/doc/index.html
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/doc/index.html	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,436 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html>
+<head>
+	<title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
+
+	<style>
+	body {color:#000;background-color:white;font:15px georgia, "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif; letter-spacing:0.01em;margin:15px;}
+	p {margin:0 0 15px 0;}
+	a,a:visited {color:#7f0055;}
+	select {background:#ffffe1;}
+	button {margin-top:5px;}
+	button.actions {width:171px;font-family:arial;}
+	h1 {color:#7f0055;margin:0;padding:0;font-size:42px;font-weight:normal;}
+	h1 a {text-decoration:none;}
+	h2 {margin:0;}
+	h2 a {text-decoration:none;font-weight:normal;font-size:22px;color:black !important;}
+	h3 {font-size:20px;font-weight:normal;padding:0;margin:25px 0 5px 0;color:#7f0055;font-weight:bold;border-bottom:2px dotted #d8d8d8;}
+	h4 {font-size:18px;font-weight:normal;z-index:0;}	
+	code {color:#0080c0;font-size:13px;font-weight:bold;}
+	ol, ul {padding:5px 0 5px 25px;margin:0;}
+	ol li, ul li {margin:8px 0 8px 0;}
+	
+	#logo {text-align:center;background-color:#d6d6d6;padding:10px;-moz-border-radius:5px;border:1px solid silver;}
+	#container {width:700px;margin:20px auto;padding:25px;border:3px solid #d9d9d9;-moz-border-radius:10px;background:#f8f8f8;}
+	#languages {margin:5px 0;}
+	
+	#menu {width:100%;background:#7f0055;-moz-border-radius:4px;}
+	#menu a {font:bold 17px georgia;color:white;padding:4px;display:block;border-left:1px solid white;text-align:center;text-decoration:none;}
+	#menu a:hover {background:#b9669e;} 
+
+	.hidden-code {display:none;}
+	.copycode {border:1px dotted gray;padding:10px;background:white;font-family:monospace;color:gray}
+	</style>
+
+</head>
+
+<body>
+<div id="container">
+
+<div id="logo">
+	<h1><a href="http://codepress.org/">CodePress</a></h1>
+	<h2><a href="http://codepress.org/">Online Real Time Syntax Highlighting Editor</a></h2>
+</div>
+
+<br />
+
+<table cellpadding="0" cellspacing="0" id="menu">
+<tr>
+	<td>
+		<a href="http://www.codepress.org/index.php">Home/Download</a>
+	</td>
+	<td>
+		<a href="http://www.codepress.org/install.php">&nbsp;&nbsp;Install&nbsp;&nbsp;</a>
+	</td>
+	<td>
+		<a href="http://www.codepress.org/to-do.php">&nbsp;&nbsp;To-do&nbsp;&nbsp;</a>
+	</td>
+	<td>
+		<a href="http://www.codepress.org/about.php" id="about">&nbsp;&nbsp;About&nbsp;&nbsp;</a>
+	</td>
+</tr>
+</table>
+
+<h4>
+	CodePress is web-based source code editor with syntax highlighting written in JavaScript that colors text in real time while it's being typed in the browser.
+</h4>
+	
+<p>
+	Go to <strong><a href="http://codepress.org/">http://codepress.org/</a></strong> for updates.
+</p>
+
+<h3>Demo</h3>
+<div id="languages">
+	<em>choose example in:</em> 
+	<button onclick="cp1.edit('cp-php','php')">PHP</button> 
+	<button onclick="cp1.edit('cp-javascript','javascript')">JavaScript</button> 
+	<button onclick="cp1.edit('cp-java','java')">Java</button>
+	<button onclick="cp1.edit('cp-perl','perl')">Perl</button>
+	<button onclick="cp1.edit('cp-sql','sql')">SQL</button>	
+	<button onclick="cp1.edit('cp-html','html')">HTML</button> 
+	<button onclick="cp1.edit('cp-css','css')">CSS</button> 	
+</div>
+
+<textarea id="cp1" class="codepress php" style="width:700px;height:300px;" wrap="off">
+<?php
+// Very simple implementation of server side script
+
+if(isset($_GET['file'])) {
+	$file = basename($_GET['file']);
+	$full_file = $path['server'].'/'.$path['webdocs'].'/'.$path['files']."/".$file;
+	if(file_exists($full_file)) {
+		$code = file_get_contents($full_file);
+		$code = preg_replace("/>/","&amp;gt;",$code);
+		$code = preg_replace("/</","&amp;lt;",$code);
+		$language = getLanguage($file);
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+	<title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
+	<link type="text/css" href="languages/codepress-<?=$language?>.css" rel="stylesheet" id="cp-lang-style" />
+	<script type="text/javascript" src="codepress.js"></script>
+	<script type="text/javascript">
+		CodePress.language = '<?=$language?>';
+	</script>
+</head>
+<body id="ffedt"><pre id="ieedt"><?=$code?></pre></body>
+</html>
+</textarea>
+
+<br /><br />
+
+<textarea id="codepress2" class="codepress javascript linenumbers-off" style="width:700px;height:200px;" wrap="off">
+//set language
+this.setLanguage = function() {
+	if(arguments[0]) {
+		language = (typeof(Content.languages[arguments[0]])!='undefined') ? arguments[0] : this.setLanguage();
+		cpLanguage.innerHTML = Content.languages[language].name;
+		if(cpBody.document.designMode=='on') cpBody.document.designMode = 'off';
+		CodePress.loadScript(cpBody.document, '../languages/'+language+'.js', function () { cpBody.CodePress.syntaxHighlight('init'); })
+		cpBody.document.getElementById('cp-lang-style').href = '../languages/'+language+'.css';
+		this.hideMenu();
+	}
+	else {
+		var extension = filename.replace(/.*\.([^\.]+)$/,'$1');
+		var aux = false;
+		for(lang in Content.languages) {
+			extensions = ','+Content.languages[lang].extensions+',';
+			if(extensions.match(','+extension+',')) aux = lang;
+		}
+		language = (aux) ? aux : 'generic';
+	}
+}
+</textarea>
+
+<p>
+	<button class="actions" onclick="alert(codepress2.getCode())">get code from editor</button>
+	<button class="actions" onclick="codepress2.toggleEditor()">turn on/off CodePress</button>
+	<button class="actions" onclick="codepress2.toggleLineNumbers()">show/hide line numbers</button>
+	<button class="actions" onclick="codepress2.toggleAutoComplete()">turn on/off auto-complete</button>
+	<button class="actions" onclick="codepress2.toggleReadOnly()">turn on/off read only</button>
+</p>
+
+
+
+<h3>Installation</h3>
+<ol>
+	<li>
+		<p>
+			<a href="http://codepress.org/">Download</a> and uncompress CodePress under a directory inside your webserver.<br>
+			Example:<strong> http://yourserver/codepress/</strong><br />
+			Since CodePress is pure JavaScript and HTML, you can also test it without a webserver.
+		</p>
+	</li>
+	<li>
+		<p>
+			Insert CodePress script somewhere in your page inside the <code>&lt;head&gt;</code> or above the <code>&lt;/body&gt;</code> tag.
+		</p>
+	
+		<p class="copycode">
+			&lt;script src="/codepress/codepress.js" type="text/javascript"&gt;&lt;/script&gt;
+		</p>
+	</li>
+	
+	<li>
+		<p>
+			Add the <code>&lt;textarea&gt;</code> tag to the place on your page you want CodePress to appear. CodePress will inherit the width and height of your textarea.
+			When the page loads, it will automatically replace your textarea with a CodePress window.
+		</p>
+		<p class="copycode">
+			&lt;textarea id="myCpWindow" class="codepress javascript linenumbers-off"&gt;<br />
+			&nbsp;&nbsp;&nbsp;// your code here<br />
+			&lt;/textarea&gt;
+		</p>
+		<ul>
+			<li>
+				The <code>javascript</code> portion of the class="" means that the language being edited is JavaScript.
+			</li>
+			<li>
+				The <code>codepress</code> portion of the class="" is mandatory and indicates a textarea to be replaced for a CodePress window.
+			</li>
+			<li>
+				Other class options are <code>linenumbers-off</code>, <code>autocomplete-off</code> and <code>readonly-on</code>.
+			</li>			
+			<li>
+				Careful not to use the same id for two different CodePress windows (<code>&lt;textarea id="<strong>xx</strong>"...&gt;</code>)
+			</li>
+		</ul>
+
+	</li>
+</ol>
+
+<h3>You also can...</h3>
+<ol>
+	<li>
+		Open/edit code from a different textarea.<br />
+		Example: <code>textarea_id.edit('other_textarea_id','language')</code><br>
+	</li>
+	<li>
+		Get code from CodePress window.<br />
+		Example: <code>textarea_id.getCode()</code><br>
+	</li>
+	<li>
+		Turn on/off CodePress editor and return to the regular textarea.<br />
+		Example: <code>textarea_id.toggleEditor()</code><br>
+	</li>
+	<li>
+		Turn on/off line numbers.<br />
+		Example: <code>textarea_id.toggleLineNumbers()</code><br>
+	</li>
+	<li>
+		Turn on/off read only.<br />
+		Example: <code>textarea_id.toggleReadOnly()</code><br>
+	</li>
+	<li>
+		Turn on/off auto-complete.<br />
+		Example: <code>textarea_id.toggleAutoComplete()</code><br>
+	</li>
+	
+</ol>
+
+<!-- p>
+	You may want to use [id].getCode() to get the content code from CodePress window and save it to your server since CodePress only edit files and do not save them.
+</p>
+<p>
+	You may also want to open files from server. You'll have to write a server side script and replace the JavaScript call on codepress.js from codepress.html to codepress.php (if your server side language is PHP, of course).
+</p -->
+
+<h3>License</h3>
+<p>
+	CodePress is distributed under the <a href="http://www.opensource.org/licenses/lgpl-license.php">LGPL</a>. If your software is <a href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">compatible</a> with this licence or it is under <a href="http://creativecommons.org/">Creative Commons</a>, you can use it as you want. Just keep the credits somewhere around.
+</p>
+
+
+</div><!--/container-->
+
+
+
+<!-- hidden codes for loading -->
+<textarea id="cp-php" class="hidden-code">
+<?php
+// Very simple implementation of server side script
+
+if(isset($_GET['file'])) {
+	$file = basename($_GET['file']);
+	$full_file = $path['server'].'/'.$path['webdocs'].'/'.$path['files']."/".$file;
+	if(file_exists($full_file)) {
+		$code = file_get_contents($full_file);
+		$code = preg_replace("/>/","&amp;gt;",$code);
+		$code = preg_replace("/</","&amp;lt;",$code);
+		$language = getLanguage($file);
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+	<title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
+	<link type="text/css" href="languages/codepress-<?=$language?>.css" rel="stylesheet" id="cp-lang-style" />
+	<script type="text/javascript" src="codepress.js"></script>
+	<script type="text/javascript">
+		CodePress.language = '<?=$language?>';
+	</script>
+</head>
+<body id="ffedt"><pre id="ieedt"><?=$code?></pre></body>
+</html>
+</textarea>
+
+<textarea id="cp-javascript" class="hidden-code">
+CodePress = function(obj) {
+	var self = document.createElement('iframe');
+	self.textarea = obj;
+	self.textarea.disabled = true;
+	self.style.height = self.textarea.clientHeight +'px';
+	self.style.width = self.textarea.clientWidth +'px';
+	
+	self.initialize = function() {
+		self.editor = self.contentWindow.CodePress;
+		self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
+		self.editor.setCode(self.textarea.value);
+		self.editor.syntaxHighlight('init');
+	}
+	
+	self.edit = function(id,language) {
+		self.language = (language) ? language : self.textarea.className.replace(/ ?codepress ?/,'');
+		self.src = cpPath+'modules/codepress.html?engine='+self.getEngine()+'&language='+self.language;
+		if(self.attachEvent) self.attachEvent('onload',self.initialize);
+		else self.addEventListener('load',self.initialize,false);
+	}
+}
+</textarea>
+
+
+<textarea id="cp-java" class="hidden-code">
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * Project ECCO - File manager class
+ * @author Fernando M.A.d.S.
+ */
+public class FileManager extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+	private static String login = "feanndor"; // session var should come here
+	private static String usersPath = System.getProperty("user.dir")+File.separator+"htdocs"+File.separator+"ecco"+File.separator+"users"+File.separator;
+	private static File dir = new File(usersPath+login+File.separator);
+	static boolean existDirectories = false;
+	static int isDirectory = 0;
+
+	public FileFilter filterFiles(File dir) {
+		return (new FileFilter() {
+			public boolean accept(File pathname) {
+				return !(pathname.isDirectory());
+			}
+		});
+	}
+}
+</textarea>
+
+<textarea id="cp-perl" class="hidden-code">
+#!/usr/bin/perl      
+# The first line of the script envokes Perl 
+
+# Scalar variables
+$var1 = "Hello World";   
+$var2 = 14.6;
+
+# Array variables
+ at arr1 = ("zero","one","two","three","four");
+
+# Hash variable, or associative array
+%hash1 = ("one","Monday","two", "Tuesday","three", "Wednesday","four","Thursday");
+
+# Some simple printing
+print $var1; 
+
+# Subroutine
+sub test() {
+	print "ok";
+}
+</textarea>
+
+<textarea id="cp-sql" class="hidden-code">
+--
+-- simple select example
+-- 
+SELECT * FROM books
+	WHERE price > 100.00 and price < 150.00
+	ORDER BY title
+
+SELECT books.title, count(*) AS Authors
+	FROM books
+	JOIN book_authors 
+		ON books.book_number = book_authors.book_number
+	GROUP BY books.title
+
+-- insert, update and delete examples
+	
+INSERT INTO my_table (field1, field2, field3) VALUES ('test', 'N', NULL);
+
+BEGIN WORK;
+	UPDATE inventory SET quantity = quantity - 3 WHERE item = 'pants';
+COMMIT;
+</textarea>
+
+<textarea id="cp-html" class="hidden-code">
+<html>
+<head>
+	<title>CodePress - Online Real Time Syntax Highlighting Editor</title>
+
+	<style type="text/css">
+	@import url(styles.css);	
+	</style>
+	<script type="text/javascript">
+	function getCode() {
+		alert(textWithoutHighlighting);
+	}
+	</script>
+</head>
+<body>
+<div id="logo">
+	<h1><a href="http://codepress.org/">CodePress</a></h1>
+	<h2>Online Real Time Syntax Highlighting Editor</h2>
+	<img src="testimage.gif" />
+</div>
+<div id="languages">
+	<em>choose language:</em> 
+	<button onclick="edit('codepress.php',this)" id="default">PHP</button> 
+	<button onclick="edit('FileManager.java',this)">Java</button> 
+</div>
+</body>
+</html>
+</textarea>
+
+<textarea id="cp-css" class="hidden-code">
+/* CSS comment */
+
+body {
+	color:#000;
+	background-color:white;
+	font:15px Georgia, "Lucida Grande", Arial, sans-serif; 
+	letter-spacing:0.01em;
+	margin:15px;
+}
+
+p { 
+	margin:0 0 15px 0; 
+}
+
+a,a:visited {
+	color:#7f0055;
+}
+
+select {
+	background:#ffffe1;
+}
+
+h1 {
+	color:#7f0055;
+	margin:0;
+	padding:0;
+	font-size:42px;
+}
+</textarea>
+
+
+<script src="codepress.js" type="text/javascript"></script>
+</body>
+</html>

Added: jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress.pm	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,83 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::CodePress;
+use base qw/Jifty::Plugin/;
+
+=head1 NAME
+
+Jifty::Plugin::CodePress
+
+=head1 DESCRIPTION
+
+CodePress, web-based source code editor with syntax highlighting
+
+=head1 SYNOPSIS
+
+In etc/config.yml
+
+  Plugins:
+    - CodePress: {}
+
+In your Model instead of 
+
+  render_as 'teaxterea';
+
+use
+
+  render_as 'Jifty::Plugin::CodePress::Textarea';
+
+In your View replace submit button with
+
+  Jifty->web->submit( 
+	label   => _("Save"), 
+    onclick => [
+      { beforeclick => "CodePress.beforeSubmit();" },
+      { args => .... }
+    ]
+  );
+
+or if you are using L<Template::Declare>
+
+  form_submit(
+	label => _("Save"),
+	onclick => [
+		{ beforeclick => "CodePress.beforeSubmit();" },
+		{ args => .... },
+	],
+  );
+
+=head1 VERSION
+
+Created from L<https://codepress.svn.sourceforge.net/svnroot/codepress/trunk/stable>
+revision 219 with bunch of local changes to make it play nicer with Jifty.
+
+This involved some hard-coding of paths (because automatic path detection
+from CodePress doesn't work well with Jifty's expectation of JavaScript code
+in C</js/>), addition of C<CodePress.instances> object to track all
+instances and CodePress.beforeSubmit which prepare form for submission.
+
+This also side-stepped problem with original calling schematic which created
+functions with names from element ids. This was problematic with Jifty
+because ids are automatically generated and use dashes (C<->) in them which
+aren't valid JavaScript function names.
+
+=head1 BUGS
+
+Use original CodePress onload event handler which might affect Jifty
+
+=head1 SEE ALSO
+
+L<http://codepress.org/> - project site
+
+=cut
+
+sub init {
+	my $self = shift;
+	Jifty->web->javascript_libs([
+	@{ Jifty->web->javascript_libs },
+	"codepress.js",
+	]);
+}
+
+1;

Added: jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress/Textarea.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/lib/Jifty/Plugin/CodePress/Textarea.pm	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,22 @@
+package Jifty::Plugin::CodePress::Textarea;
+use base qw(Jifty::Web::Form::Field::Textarea);
+
+sub render_widget {
+    my $self  = shift;
+    my $field;
+    $field .= qq!<textarea!;
+    $field .= qq! name="@{[ $self->input_name ]}"!;
+    $field .= qq! id="@{[ $self->element_id ]}"!;
+    $field .= qq! rows="@{[$self->rows || 25]}"!;
+    $field .= qq! cols="@{[$self->cols || 80]}"!;
+    $field .= $self->_widget_class( 'codepress' );
+    $field .= qq! >!;
+    $field .= Jifty->web->escape($self->current_value) if $self->current_value;
+    $field .= qq!</textarea>\n!;
+
+    Jifty->web->out($field);
+    '';
+}
+
+
+1;

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,7 @@
+body {margin-top:13px;_margin-top:14px;background:white;font-family:monospace;font-size:13px;margin-left:32px;white-space:pre;background-image:url("images/line-numbers.png");background-repeat:repeat-y;background-position:0 3px;line-height:16px;}
+html>body{background-position:0 2px;}
+P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;}
+b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;}
+
+body.hide-line-numbers {background:white;margin-left:16px;}
+body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;}
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.html
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/codepress.html	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+	<title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
+	<meta name="description" content="CodePress - source code editor window" />
+
+	<script type="text/javascript">
+	var language = 'generic';
+	var engine = 'older';
+	var ua = navigator.userAgent;
+	var ts = (new Date).getTime(); // timestamp to avoid cache
+	var lh = location.href;
+	
+	if(ua.match('MSIE')) engine = 'msie';
+	else if(ua.match('KHTML')) engine = 'khtml'; 
+	else if(ua.match('Opera')) engine = 'opera'; 
+	else if(ua.match('Gecko')) engine = 'gecko';
+
+	if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
+
+	document.write('<link type="text/css" href="/static/codepress/codepress.css?ts='+ts+'" rel="stylesheet" />');
+	document.write('<link type="text/css" href="/static/codepress/languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
+	document.write('<scr'+'ipt type="text/javascript" src="/static/codepress/engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
+	document.write('<scr'+'ipt type="text/javascript" src="/static/codepress/languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
+	</script>
+
+</head>
+
+<script type="text/javascript">
+if (engine == "gecko") document.write('<body> </body>');
+else if(engine == "msie") document.write('<body><pre></pre></body>');
+else if(engine == "opera") document.write('<body></body>');
+// else if(engine == "khtml") document.write('<body> </body>');
+</script>
+
+</html>

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/gecko.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/gecko.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,273 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads at gmail.com>
+ *
+ * Developers:
+ *		Fernando M.A.d.S. <fermads at gmail.com>
+ *		Michael Hurni <michael.hurni at gmail.com>
+ * Contributors: 	
+ *		Martin D. Kirk
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+CodePress = {
+	scrolling : false,
+	autocomplete : true,
+
+	// set initial vars and start sh
+	initialize : function() {
+		if(typeof(editor)=='undefined' && !arguments[0]) return;
+		chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
+		cc = '\u2009'; // control char
+		editor = document.getElementsByTagName('body')[0];
+		document.designMode = 'on';
+		document.addEventListener('keypress', this.keyHandler, true);
+		window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
+		completeChars = this.getCompleteChars();
+		completeEndingChars =  this.getCompleteEndingChars();
+	},
+
+	// treat key bindings
+	keyHandler : function(evt) {
+    	keyCode = evt.keyCode;	
+		charCode = evt.charCode;
+		fromChar = String.fromCharCode(charCode);
+
+		if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+			CodePress.shortcuts(charCode?charCode:keyCode);
+		}
+		else if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1) && CodePress.autocomplete) { // auto complete
+			if(!CodePress.completeEnding(fromChar))
+			     CodePress.complete(fromChar);
+		}
+	    else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
+			top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
+		}
+		else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
+			CodePress.snippets(evt);
+		}
+		else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+		 	CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+		}
+		else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
+			(charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+			evt.preventDefault();
+		}
+		else if(charCode==118 && evt.ctrlKey)  { // handle paste
+		 	top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
+		}
+		else if(charCode==99 && evt.ctrlKey)  { // handle cut
+		 	//alert(window.getSelection().getRangeAt(0).toString().replace(/\t/g,'FFF'));
+		}
+
+	},
+
+	// put cursor back to its original position after every parsing
+	findString : function() {
+		if(self.find(cc))
+			window.getSelection().getRangeAt(0).deleteContents();
+	},
+	
+	// split big files, highlighting parts of it
+	split : function(code,flag) {
+		if(flag=='scroll') {
+			this.scrolling = true;
+			return code;
+		}
+		else {
+			this.scrolling = false;
+			mid = code.indexOf(cc);
+			if(mid-2000<0) {ini=0;end=4000;}
+			else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+			else {ini=mid-2000;end=mid+2000;}
+			code = code.substring(ini,end);
+			return code;
+		}
+	},
+	
+	// syntax highlighting parser
+	syntaxHighlight : function(flag) {
+		//if(document.designMode=='off') document.designMode='on'
+		if(flag!='init') window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
+
+		o = editor.innerHTML;
+		o = o.replace(/<br>/g,'\n');
+		o = o.replace(/<.*?>/g,'');
+		x = z = this.split(o,flag);
+		x = x.replace(/\n/g,'<br>');
+
+		if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+	
+		for(i=0;i<Language.syntax.length;i++) 
+			x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+
+		editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); 
+		if(flag!='init') this.findString();
+	},
+	
+	getLastWord : function() {
+		var rangeAndCaret = CodePress.getRangeAndCaret();
+		words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+		words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+		return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+	},
+	
+	snippets : function(evt) {
+		var snippets = Language.snippets;	
+		var trigger = this.getLastWord();
+		for (var i=0; i<snippets.length; i++) {
+			if(snippets[i].input == trigger) {
+				var content = snippets[i].output.replace(/</g,'&lt;');
+				content = content.replace(/>/g,'&gt;');
+				if(content.indexOf('$0')<0) content += cc;
+				else content = content.replace(/\$0/,cc);
+				content = content.replace(/\n/g,'<br>');
+				var pattern = new RegExp(trigger+cc,'gi');
+				evt.preventDefault(); // prevent the tab key from being added
+				this.syntaxHighlight('snippets',pattern,content);
+			}
+		}
+	},
+	
+	readOnly : function() {
+		document.designMode = (arguments[0]) ? 'off' : 'on';
+	},
+
+	complete : function(trigger) {
+		window.getSelection().getRangeAt(0).deleteContents();
+		var complete = Language.complete;
+		for (var i=0; i<complete.length; i++) {
+			if(complete[i].input == trigger) {
+				var pattern = new RegExp('\\'+trigger+cc);
+				var content = complete[i].output.replace(/\$0/g,cc);
+				parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+			}
+		}
+	},
+
+	getCompleteChars : function() {
+		var cChars = '';
+		for(var i=0;i<Language.complete.length;i++)
+			cChars += '|'+Language.complete[i].input;
+		return cChars+'|';
+	},
+	
+	getCompleteEndingChars : function() {
+		var cChars = '';
+		for(var i=0;i<Language.complete.length;i++)
+			cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
+		return cChars+'|';
+	},
+	
+	completeEnding : function(trigger) {
+		var range = window.getSelection().getRangeAt(0);
+		try {
+			range.setEnd(range.endContainer, range.endOffset+1)
+		}
+		catch(e) {
+			return false;
+		}
+		var next_character = range.toString()
+		range.setEnd(range.endContainer, range.endOffset-1)
+		if(next_character != trigger) return false;
+		else {
+			range.setEnd(range.endContainer, range.endOffset+1)
+			range.deleteContents();
+			return true;
+		}
+	},
+	
+	shortcuts : function() {
+		var cCode = arguments[0];
+		if(cCode==13) cCode = '[enter]';
+		else if(cCode==32) cCode = '[space]';
+		else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
+		for(var i=0;i<Language.shortcuts.length;i++)
+			if(Language.shortcuts[i].input == cCode)
+				this.insertCode(Language.shortcuts[i].output,false);
+	},
+	
+	getRangeAndCaret : function() {	
+		var range = window.getSelection().getRangeAt(0);
+		var range2 = range.cloneRange();
+		var node = range.endContainer;			
+		var caret = range.endOffset;
+		range2.selectNode(node);	
+		return [range2.toString(),caret];
+	},
+	
+	insertCode : function(code,replaceCursorBefore) {
+		var range = window.getSelection().getRangeAt(0);
+		var node = window.document.createTextNode(code);
+		var selct = window.getSelection();
+		var range2 = range.cloneRange();
+		// Insert text at cursor position
+		selct.removeAllRanges();
+		range.deleteContents();
+		range.insertNode(node);
+		// Move the cursor to the end of text
+		range2.selectNode(node);		
+		range2.collapse(replaceCursorBefore);
+		selct.removeAllRanges();
+		selct.addRange(range2);
+	},
+	
+	// get code from editor
+	getCode : function() {
+		var code = editor.innerHTML;
+		code = code.replace(/<br>/g,'\n');
+		code = code.replace(/\u2009/g,'');
+		code = code.replace(/<.*?>/g,'');
+		code = code.replace(/&lt;/g,'<');
+		code = code.replace(/&gt;/g,'>');
+		code = code.replace(/&amp;/gi,'&');
+		return code;
+	},
+
+	// put code inside editor
+	setCode : function() {
+		var code = arguments[0];
+		code = code.replace(/\u2009/gi,'');
+		code = code.replace(/&/gi,'&amp;');
+       	code = code.replace(/</g,'&lt;');
+        code = code.replace(/>/g,'&gt;');
+		editor.innerHTML = code;
+	},
+
+	// undo and redo methods
+	actions : {
+		pos : -1, // actual history position
+		history : [], // history vector
+		
+		undo : function() {
+			if(editor.innerHTML.indexOf(cc)==-1){
+				window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
+			 	this.history[this.pos] = editor.innerHTML;
+			}
+			this.pos--;
+			if(typeof(this.history[this.pos])=='undefined') this.pos++;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		redo : function() {
+			this.pos++;
+			if(typeof(this.history[this.pos])=='undefined') this.pos--;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		next : function() { // get next vector position and clean old ones
+			if(this.pos>20) this.history[this.pos-21] = undefined;
+			return ++this.pos;
+		}
+	}
+}
+
+Language={};
+window.addEventListener('load', function() { CodePress.initialize('new'); }, true);
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/khtml.js
==============================================================================

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/msie.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/msie.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,304 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads at gmail.com>
+ *
+ * Developers:
+ *		Fernando M.A.d.S. <fermads at gmail.com>
+ *		Michael Hurni <michael.hurni at gmail.com>
+ * Contributors: 	
+ *		Martin D. Kirk
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+CodePress = {
+	scrolling : false,
+	autocomplete : true,
+	
+	// set initial vars and start sh
+	initialize : function() {
+		if(typeof(editor)=='undefined' && !arguments[0]) return;
+		chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
+		cc = '\u2009'; // control char
+		editor = document.getElementsByTagName('pre')[0];
+		editor.contentEditable = 'true';
+		document.getElementsByTagName('body')[0].onfocus = function() {editor.focus();}
+		document.attachEvent('onkeydown', this.metaHandler);
+		document.attachEvent('onkeypress', this.keyHandler);
+		window.attachEvent('onscroll', function() { if(!CodePress.scrolling) setTimeout(function(){CodePress.syntaxHighlight('scroll')},1)});
+		completeChars = this.getCompleteChars();
+		completeEndingChars =  this.getCompleteEndingChars();
+		setTimeout(function() { window.scroll(0,0) },50); // scroll IE to top
+	},
+	
+	// treat key bindings
+	keyHandler : function(evt) {
+		charCode = evt.keyCode;
+		fromChar = String.fromCharCode(charCode);
+		
+		if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1  )&& CodePress.autocomplete) { // auto complete
+			if(!CodePress.completeEnding(fromChar))
+			     CodePress.complete(fromChar);
+		}
+	    else if(chars.indexOf('|'+charCode+'|')!=-1||charCode==13) { // syntax highlighting
+		 	CodePress.syntaxHighlight('generic');
+		}
+	},
+
+	metaHandler : function(evt) {
+		keyCode = evt.keyCode;
+		
+		if(keyCode==9 || evt.tabKey) { 
+			CodePress.snippets();
+		}
+		else if((keyCode==122||keyCode==121||keyCode==90) && evt.ctrlKey) { // undo and redo
+			(keyCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+			evt.returnValue = false;
+		}
+		else if(keyCode==34||keyCode==33) { // handle page up/down for IE
+			self.scrollBy(0, (keyCode==34) ? 200 : -200); 
+			evt.returnValue = false;
+		}
+		else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+		 	CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+		}
+		else if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && keyCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+			CodePress.shortcuts(keyCode);
+			evt.returnValue = false;
+		}
+		else if(keyCode==86 && evt.ctrlKey)  { // handle paste
+			window.clipboardData.setData('Text',window.clipboardData.getData('Text').replace(/\t/g,'\u2008'));
+		 	top.setTimeout(function(){CodePress.syntaxHighlight('paste');},10);
+		}
+		else if(keyCode==67 && evt.ctrlKey)  { // handle cut
+			// window.clipboardData.setData('Text',x[0]);
+			// code = window.clipboardData.getData('Text');
+		}
+	},
+
+	// put cursor back to its original position after every parsing
+	
+	
+	findString : function() {
+		range = self.document.body.createTextRange();
+		if(range.findText(cc)){
+			range.select();
+			range.text = '';
+		}
+	},
+	
+	// split big files, highlighting parts of it
+	split : function(code,flag) {
+		if(flag=='scroll') {
+			this.scrolling = true;
+			return code;
+		}
+		else {
+			this.scrolling = false;
+			mid = code.indexOf(cc);
+			if(mid-2000<0) {ini=0;end=4000;}
+			else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+			else {ini=mid-2000;end=mid+2000;}
+			code = code.substring(ini,end);
+			return code.substring(code.indexOf('<P>'),code.lastIndexOf('</P>')+4);
+		}
+	},
+	
+	// syntax highlighting parser
+	syntaxHighlight : function(flag) {
+		if(flag!='init') document.selection.createRange().text = cc;
+		o = editor.innerHTML;
+		if(flag=='paste') { // fix pasted text
+			o = o.replace(/<BR>/g,'\r\n'); 
+			o = o.replace(/\u2008/g,'\t');
+		}
+		o = o.replace(/<P>/g,'\n');
+		o = o.replace(/<\/P>/g,'\r');
+		o = o.replace(/<.*?>/g,'');
+		o = o.replace(/&nbsp;/g,'');			
+		o = '<PRE><P>'+o+'</P></PRE>';
+		o = o.replace(/\n\r/g,'<P></P>');
+		o = o.replace(/\n/g,'<P>');
+		o = o.replace(/\r/g,'<\/P>');
+		o = o.replace(/<P>(<P>)+/,'<P>');
+		o = o.replace(/<\/P>(<\/P>)+/,'</P>');
+		o = o.replace(/<P><\/P>/g,'<P><BR/></P>');
+		x = z = this.split(o,flag);
+
+		if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+	
+		for(i=0;i<Language.syntax.length;i++) 
+			x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+			
+		editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.replace(z,x);
+		if(flag!='init') this.findString();
+	},
+
+	snippets : function(evt) {
+		var snippets = Language.snippets;
+		var trigger = this.getLastWord();
+		for (var i=0; i<snippets.length; i++) {
+			if(snippets[i].input == trigger) {
+				var content = snippets[i].output.replace(/</g,'&lt;');
+				content = content.replace(/>/g,'&gt;');
+				if(content.indexOf('$0')<0) content += cc;
+				else content = content.replace(/\$0/,cc);
+				content = content.replace(/\n/g,'</P><P>');
+				var pattern = new RegExp(trigger+cc,"gi");
+				this.syntaxHighlight('snippets',pattern,content);
+			}
+		}
+	},
+	
+	readOnly : function() {
+		editor.contentEditable = (arguments[0]) ? 'false' : 'true';
+	},
+	
+	complete : function(trigger) {
+		var complete = Language.complete;
+		for (var i=0; i<complete.length; i++) {
+			if(complete[i].input == trigger) {
+				var pattern = new RegExp('\\'+trigger+cc);
+				var content = complete[i].output.replace(/\$0/g,cc);
+				setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+			}
+		}
+	},
+	
+	getCompleteChars : function() {
+		var cChars = '';
+		for(var i=0;i<Language.complete.length;i++)
+			cChars += '|'+Language.complete[i].input;
+		return cChars+'|';
+	},
+
+	getCompleteEndingChars : function() {
+		var cChars = '';
+		for(var i=0;i<Language.complete.length;i++)
+			cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
+		return cChars+'|';
+	},
+
+	completeEnding : function(trigger) {
+		var range = document.selection.createRange();
+		try {
+			range.moveEnd('character', 1)
+		}
+		catch(e) {
+			return false;
+		}
+		var next_character = range.text
+		range.moveEnd('character', -1)
+		if(next_character != trigger )  return false;
+		else {
+			range.moveEnd('character', 1)
+			range.text=''
+			return true;
+		}
+	},	
+
+	shortcuts : function() {
+		var cCode = arguments[0];
+		if(cCode==13) cCode = '[enter]';
+		else if(cCode==32) cCode = '[space]';
+		else cCode = '['+String.fromCharCode(keyCode).toLowerCase()+']';
+		for(var i=0;i<Language.shortcuts.length;i++)
+			if(Language.shortcuts[i].input == cCode)
+				this.insertCode(Language.shortcuts[i].output,false);
+	},
+	
+	getLastWord : function() {
+		var rangeAndCaret = CodePress.getRangeAndCaret();
+		words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+		words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+		return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+	}, 
+
+	getRangeAndCaret : function() {	
+		var range = document.selection.createRange();
+		var caret = Math.abs(range.moveStart('character', -1000000)+1);
+		range = this.getCode();
+		range = range.replace(/\n\r/gi,'  ');
+		range = range.replace(/\n/gi,'');
+		return [range.toString(),caret];
+	},
+	
+	insertCode : function(code,replaceCursorBefore) {
+		var repdeb = '';
+		var repfin = '';
+		
+		if(replaceCursorBefore) { repfin = code; }
+		else { repdeb = code; }
+		
+		if(typeof document.selection != 'undefined') {
+			var range = document.selection.createRange();
+			range.text = repdeb + repfin;
+			range = document.selection.createRange();
+			range.move('character', -repfin.length);
+			range.select();	
+		}	
+	},
+
+	// get code from editor	
+	getCode : function() {
+		var code = editor.innerHTML;
+		code = code.replace(/<br>/g,'\n');
+		code = code.replace(/<\/p>/gi,'\r');
+		code = code.replace(/<p>/i,''); // IE first line fix
+		code = code.replace(/<p>/gi,'\n');
+		code = code.replace(/&nbsp;/gi,'');
+		code = code.replace(/\u2009/g,'');
+		code = code.replace(/<.*?>/g,'');
+		code = code.replace(/&lt;/g,'<');
+		code = code.replace(/&gt;/g,'>');
+		code = code.replace(/&amp;/gi,'&');
+		return code;
+	},
+
+	// put code inside editor
+	setCode : function() {
+		var code = arguments[0];
+		code = code.replace(/\u2009/gi,'');
+		code = code.replace(/&/gi,'&amp;');		
+       	code = code.replace(/</g,'&lt;');
+        code = code.replace(/>/g,'&gt;');
+		editor.innerHTML = '<pre>'+code+'</pre>';
+	},
+
+	
+	// undo and redo methods
+	actions : {
+		pos : -1, // actual history position
+		history : [], // history vector
+		
+		undo : function() {
+			if(editor.innerHTML.indexOf(cc)==-1){
+				document.selection.createRange().text = cc;
+			 	this.history[this.pos] = editor.innerHTML;
+			}
+			this.pos--;
+			if(typeof(this.history[this.pos])=='undefined') this.pos++;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		redo : function() {
+			this.pos++;
+			if(typeof(this.history[this.pos])=='undefined') this.pos--;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		next : function() { // get next vector position and clean old ones
+			if(this.pos>20) this.history[this.pos-21] = undefined;
+			return ++this.pos;
+		}
+	}
+}
+
+Language={};
+window.attachEvent('onload', function() { CodePress.initialize('new');});
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/older.js
==============================================================================

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/opera.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/engines/opera.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,260 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads at gmail.com>
+ *
+ * Contributors :
+ *
+ * 	Michael Hurni <michael.hurni at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+
+CodePress = {
+	scrolling : false,
+	autocomplete : true,
+
+	// set initial vars and start sh
+	initialize : function() {
+		if(typeof(editor)=='undefined' && !arguments[0]) return;
+		chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
+		cc = '\u2009'; // control char
+		editor = document.getElementsByTagName('body')[0];
+		document.designMode = 'on';
+		document.addEventListener('keyup', this.keyHandler, true);
+		window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
+		completeChars = this.getCompleteChars();
+//		CodePress.syntaxHighlight('init');
+	},
+
+	// treat key bindings
+	keyHandler : function(evt) {
+    	keyCode = evt.keyCode;	
+		charCode = evt.charCode;
+
+		if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+			CodePress.shortcuts(charCode?charCode:keyCode);
+		}
+		else if(completeChars.indexOf('|'+String.fromCharCode(charCode)+'|')!=-1 && CodePress.autocomplete) { // auto complete
+			CodePress.complete(String.fromCharCode(charCode));
+		}
+	    else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
+		 	CodePress.syntaxHighlight('generic');
+		}
+		else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
+			CodePress.snippets(evt);
+		}
+		else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+		 	CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+		}
+		else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
+			(charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+			evt.preventDefault();
+		}
+		else if(keyCode==86 && evt.ctrlKey)  { // paste
+			// TODO: pasted text should be parsed and highlighted
+		}
+	},
+
+	// put cursor back to its original position after every parsing
+	findString : function() {
+		var sel = window.getSelection();
+		var range = window.document.createRange();
+		var span = window.document.getElementsByTagName('span')[0];
+			
+		range.selectNode(span);
+		sel.removeAllRanges();
+		sel.addRange(range);
+		span.parentNode.removeChild(span);
+		//if(self.find(cc))
+		//window.getSelection().getRangeAt(0).deleteContents();
+	},
+	
+	// split big files, highlighting parts of it
+	split : function(code,flag) {
+		if(flag=='scroll') {
+			this.scrolling = true;
+			return code;
+		}
+		else {
+			this.scrolling = false;
+			mid = code.indexOf('<SPAN>');
+			if(mid-2000<0) {ini=0;end=4000;}
+			else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+			else {ini=mid-2000;end=mid+2000;}
+			code = code.substring(ini,end);
+			return code;
+		}
+	},
+	
+	// syntax highlighting parser
+	syntaxHighlight : function(flag) {
+		//if(document.designMode=='off') document.designMode='on'
+		if(flag!='init') {
+			var span = document.createElement('span');
+			window.getSelection().getRangeAt(0).insertNode(span);
+		}
+
+		o = editor.innerHTML;
+//		o = o.replace(/<br>/g,'\r\n');
+//		o = o.replace(/<(b|i|s|u|a|em|tt|ins|big|cite|strong)?>/g,'');
+		//alert(o)
+		o = o.replace(/<(?!span|\/span|br).*?>/gi,'');
+//		alert(o)
+//		x = o;
+		x = z = this.split(o,flag);
+		//alert(z)
+//		x = x.replace(/\r\n/g,'<br>');
+		x = x.replace(/\t/g, '        ');
+
+
+		if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+	
+		for(i=0;i<Language.syntax.length;i++) 
+			x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+
+		editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); 
+
+		if(flag!='init') this.findString();
+	},
+	
+	getLastWord : function() {
+		var rangeAndCaret = CodePress.getRangeAndCaret();
+		words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+		words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+		return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+	}, 
+	
+	snippets : function(evt) {
+		var snippets = Language.snippets;	
+		var trigger = this.getLastWord();
+		for (var i=0; i<snippets.length; i++) {
+			if(snippets[i].input == trigger) {
+				var content = snippets[i].output.replace(/</g,'&lt;');
+				content = content.replace(/>/g,'&gt;');
+				if(content.indexOf('$0')<0) content += cc;
+				else content = content.replace(/\$0/,cc);
+				content = content.replace(/\n/g,'<br>');
+				var pattern = new RegExp(trigger+cc,'gi');
+				evt.preventDefault(); // prevent the tab key from being added
+				this.syntaxHighlight('snippets',pattern,content);
+			}
+		}
+	},
+	
+	readOnly : function() {
+		document.designMode = (arguments[0]) ? 'off' : 'on';
+	},
+
+	complete : function(trigger) {
+		window.getSelection().getRangeAt(0).deleteContents();
+		var complete = Language.complete;
+		for (var i=0; i<complete.length; i++) {
+			if(complete[i].input == trigger) {
+				var pattern = new RegExp('\\'+trigger+cc);
+				var content = complete[i].output.replace(/\$0/g,cc);
+				parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+			}
+		}
+	},
+
+	getCompleteChars : function() {
+		var cChars = '';
+		for(var i=0;i<Language.complete.length;i++)
+			cChars += '|'+Language.complete[i].input;
+		return cChars+'|';
+	},
+
+	shortcuts : function() {
+		var cCode = arguments[0];
+		if(cCode==13) cCode = '[enter]';
+		else if(cCode==32) cCode = '[space]';
+		else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
+		for(var i=0;i<Language.shortcuts.length;i++)
+			if(Language.shortcuts[i].input == cCode)
+				this.insertCode(Language.shortcuts[i].output,false);
+	},
+	
+	getRangeAndCaret : function() {	
+		var range = window.getSelection().getRangeAt(0);
+		var range2 = range.cloneRange();
+		var node = range.endContainer;			
+		var caret = range.endOffset;
+		range2.selectNode(node);	
+		return [range2.toString(),caret];
+	},
+	
+	insertCode : function(code,replaceCursorBefore) {
+		var range = window.getSelection().getRangeAt(0);
+		var node = window.document.createTextNode(code);
+		var selct = window.getSelection();
+		var range2 = range.cloneRange();
+		// Insert text at cursor position
+		selct.removeAllRanges();
+		range.deleteContents();
+		range.insertNode(node);
+		// Move the cursor to the end of text
+		range2.selectNode(node);		
+		range2.collapse(replaceCursorBefore);
+		selct.removeAllRanges();
+		selct.addRange(range2);
+	},
+	
+	// get code from editor
+	getCode : function() {
+		var code = editor.innerHTML;
+		code = code.replace(/<br>/g,'\n');
+		code = code.replace(/\u2009/g,'');
+		code = code.replace(/<.*?>/g,'');
+		code = code.replace(/&lt;/g,'<');
+		code = code.replace(/&gt;/g,'>');
+		code = code.replace(/&amp;/gi,'&');
+		return code;
+	},
+
+	// put code inside editor
+	setCode : function() {
+		var code = arguments[0];
+		code = code.replace(/\u2009/gi,'');
+		code = code.replace(/&/gi,'&amp;');
+       	code = code.replace(/</g,'&lt;');
+        code = code.replace(/>/g,'&gt;');
+		editor.innerHTML = code;
+	},
+
+	// undo and redo methods
+	actions : {
+		pos : -1, // actual history position
+		history : [], // history vector
+		
+		undo : function() {
+			if(editor.innerHTML.indexOf(cc)==-1){
+				window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
+			 	this.history[this.pos] = editor.innerHTML;
+			}
+			this.pos--;
+			if(typeof(this.history[this.pos])=='undefined') this.pos++;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		redo : function() {
+			this.pos++;
+			if(typeof(this.history[this.pos])=='undefined') this.pos--;
+			editor.innerHTML = this.history[this.pos];
+			CodePress.findString();
+		},
+		
+		next : function() { // get next vector position and clean old ones
+			if(this.pos>20) this.history[this.pos-21] = undefined;
+			return ++this.pos;
+		}
+	}
+}
+
+Language={};
+window.addEventListener('load', function() { CodePress.initialize('new'); }, true);

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/images/line-numbers.png
==============================================================================
Binary file. No diff available.

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,71 @@
+/*
+ * CodePress color styles for ASP-VB syntax highlighting
+ * By Martin D. Kirk
+ */
+/* tags */
+
+b {
+	color:#000080;
+} 
+/* comments */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
+	color:gray;
+	font-weight:normal;
+}
+/* ASP comments */
+strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
+	color:gray;
+	font-weight:normal;
+}
+ /* attributes */ 
+s, s b, span s u, span s cite, strong span s {
+	color:#5656fa ;
+	font-weight:normal;
+}
+ /* strings */ 
+strong s,strong s b, strong s u, strong s cite {
+	color:#009900;
+	font-weight:normal;
+}
+strong ins{
+	color:#000000;
+	font-weight:bold;
+}
+ /* Syntax */
+strong a, strong a u {
+	color:#0000FF;
+	font-weight:;
+}
+ /* Native Keywords */
+strong u {
+	color:#990099;
+	font-weight:bold;
+}
+/* Numbers */
+strong var{
+	color:#FF0000;
+}
+/* ASP Language */
+span{
+	color:#990000;
+	font-weight:bold;
+}
+strong i,strong a i, strong u i {
+	color:#009999;
+}
+/* style */
+em {
+	color:#800080;
+	font-style:normal;
+}
+ /* script */ 
+ins {
+	color:#800000;
+	font-weight:bold;
+}
+
+/* <?php and ?> */
+cite, s cite {
+	color:red;
+	font-weight:bold;
+}
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/asp.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,117 @@
+/*
+ * CodePress regular expressions for ASP-vbscript syntax highlighting
+ */
+
+// ASP VBScript
+Language.syntax = [
+// all tags
+	{ input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
+// style tags	
+	{ input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
+// script tags	
+	{ input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
+// strings "" and attributes
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
+// ASP Comment
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
+// <%.*
+	{ input : /(&lt;%)/g, output : '<strong>$1' }, 
+// .*%>	
+	{ input : /(%&gt;)/g, output : '$1</strong>' }, 
+// <%@...%>	
+	{ input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
+//Numbers	
+	{ input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
+// Reserved Words 1 (Blue)
+	{ input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
+	{ input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
+	{ input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
+// Reserved Words 2 (Purple)	
+	{ input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
+	{ input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
+// Reserved Words 3 (Turquis)
+	{ input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
+  	{ input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
+// html comments
+	{ input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
+]
+
+Language.Functions = [ 
+  	// Output at index 0, must be the desired tagname surrounding a $1
+	// Name is the index from the regex that marks the functionname
+	{input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
+]
+
+Language.snippets = [
+//Conditional
+	{ input : 'if', output : 'If $0 Then\n\t\nEnd If' },
+	{ input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
+	{ input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
+//Response
+	{ input : 'rw', output : 'Response.Write( $0 )' },
+	{ input : 'resc', output : 'Response.Cookies( $0 )' },
+	{ input : 'resb', output : 'Response.Buffer'},
+	{ input : 'resflu', output : 'Response.Flush()'},
+	{ input : 'resend', output : 'Response.End'},
+//Request
+	{ input : 'reqc', output : 'Request.Cookies( $0 )' },
+	{ input : 'rq', output : 'Request.Querystring("$0")' },
+	{ input : 'rf', output : 'Request.Form("$0")' },
+//FSO
+	{ input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
+	{ input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
+	{ input : 'setfi', output : 'Set fi = fso.getFile($0)' },
+	{ input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
+	{ input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
+//Server
+	{ input : 'mapp', output : 'Server.Mappath($0)' },
+//Loops
+	{ input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
+	{ input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
+	{ input : 'do', output : 'Do While($0)\n\t\nLoop' },
+	{ input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
+//ADO
+	{ input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
+	{ input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
+	{ input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
+//Http Request
+	{ input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
+	{ input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
+//Functions
+	{ input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
+	{ input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
+
+]
+
+Language.complete = [
+	//{ input : '\'', output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = [
+	{ input : '[space]', output : '&nbsp;' },
+	{ input : '[enter]', output : '<br />' } ,
+	{ input : '[j]', output : 'testing' },
+	{ input : '[7]', output : '&amp;' }
+]
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,9 @@
+/*
+ * CodePress color styles for Java syntax highlighting
+ * By Edwin de Jonge
+ */
+
+b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
+a {color:#2A0088;font-weight:bold;font-style:normal;} /* types */
+i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
+s, s b {color:#2A00FF;font-weight:normal;} /* strings */
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/csharp.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,25 @@
+/*
+ * CodePress regular expressions for C# syntax highlighting
+ * By Edwin de Jonge
+ */
+ 
+Language.syntax = [ // C#
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+	{ input : /\'(.?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote 
+	{ input : /\b(abstract|as|base|break|case|catch|checked|continue|default|delegate|do|else|event|explicit|extern|false|finally|fixed|for|foreach|get|goto|if|implicit|in|interface|internal|is|lock|namespace|new|null|object|operator|out|override|params|partial|private|protected|public|readonly|ref|return|set|sealed|sizeof|static|stackalloc|switch|this|throw|true|try|typeof|unchecked|unsafe|using|value|virtual|while)\b/g, output : '<b>$1</b>' }, // reserved words
+	{ input : /\b(bool|byte|char|class|double|float|int|interface|long|string|struct|void)\b/g, output : '<a>$1</a>' }, // types
+	{ input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //	
+	{ input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+];
+
+Language.snippets = [];
+
+Language.complete = [ // Auto complete only for 1 character
+	{input : '\'',output : '\'$0\'' },
+	{input : '"', output : '"$0"' },
+	{input : '(', output : '\($0\)' },
+	{input : '[', output : '\[$0\]' },
+	{input : '{', output : '{\n\t$0\n}' }		
+];
+
+Language.shortcuts = [];
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for CSS syntax highlighting
+ */
+
+b, b a, b u {color:#000080;} /* tags, ids, classes */
+i, i b, i s, i a, i u {color:gray;} /* comments */
+s, s b {color:#a0a0dd;} /* parameters */
+a {color:#0000ff;} /* keys */
+u {color:red;} /* values */
+

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/css.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,23 @@
+/*
+ * CodePress regular expressions for CSS syntax highlighting
+ */
+
+// CSS
+Language.syntax = [
+	{ input : /(.*?){(.*?)}/g,output : '<b>$1</b>{<u>$2</u>}' }, // tags, ids, classes, values
+	{ input : /([\w-]*?):([^\/])/g,output : '<a>$1</a>:$2' }, // keys
+	{ input : /\((.*?)\)/g,output : '(<s>$1</s>)' }, // parameters
+	{ input : /\/\*(.*?)\*\//g,output : '<i>/*$1*/</i>'} // comments
+]
+
+Language.snippets = []
+
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,9 @@
+/*
+ * CodePress color styles for generic syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+u {color:darkblue;font-weight:bold;} /* special words */
+i, i b, i s, i u, i em {color:green;font-weight:normal;} /* comments */
+s, s b, s em {color:#2A00FF;font-weight:normal;} /* strings */
+em {font-weight:bold;} /* special chars */
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/generic.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,25 @@
+/*
+ * CodePress regular expressions for generic syntax highlighting
+ */
+ 
+// generic languages
+Language.syntax = [
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+	{ input : /\b(abstract|continue|for|new|switch|default|goto|boolean|do|if|private|this|break|double|protected|throw|byte|else|import|public|throws|case|return|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|const|float|while|function|label)\b/g, output : '<b>$1</b>' }, // reserved words
+	{ input : /([\(\){}])/g, output : '<em>$1</em>' }, // special chars;
+	{ input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
+	{ input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+]
+
+Language.snippets = []
+
+Language.complete = [
+	{ input : '\'', output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,13 @@
+/*
+ * CodePress color styles for HTML syntax highlighting
+ */
+
+b {color:#000080;} /* tags */
+ins, ins b, ins s, ins em {color:gray;} /* comments */
+s, s b {color:#7777e4;} /* attribute values */
+a {color:green;} /* links */
+u {color:#E67300;} /* forms */
+big {color:#db0000;} /* images */
+em, em b {color:#800080;} /* style */
+strong {color:#800000;} /* script */
+tt i {color:darkblue;font-weight:bold;} /* script reserved words */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/html.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,59 @@
+/*
+ * CodePress regular expressions for HTML syntax highlighting
+ */
+
+// HTML
+Language.syntax = [
+	{ input : /(&lt;[^!]*?&gt;)/g, output : '<b>$1</b>'	}, // all tags
+	{ input : /(&lt;a .*?&gt;|&lt;\/a&gt;)/g, output : '<a>$1</a>' }, // links
+	{ input : /(&lt;img .*?&gt;)/g, output : '<big>$1</big>' }, // images
+	{ input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g, output : '<u>$1</u>' }, // forms
+	{ input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
+	{ input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' }, // script tags
+	{ input : /=(".*?")/g, output : '=<s>$1</s>' }, // atributes double quote
+	{ input : /=('.*?')/g, output : '=<s>$1</s>' }, // atributes single quote
+	{ input : /(&lt;!--.*?--&gt.)/g, output : '<ins>$1</ins>' }, // comments 
+	{ input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<i>$1</i>' } // script reserved words 
+]
+
+Language.snippets = [
+	{ input : 'aref', output : '<a href="$0"></a>' },
+	{ input : 'h1', output : '<h1>$0</h1>' },
+	{ input : 'h2', output : '<h2>$0</h2>' },
+	{ input : 'h3', output : '<h3>$0</h3>' },
+	{ input : 'h4', output : '<h4>$0</h4>' },
+	{ input : 'h5', output : '<h5>$0</h5>' },
+	{ input : 'h6', output : '<h6>$0</h6>' },
+	{ input : 'html', output : '<html>\n\t$0\n</html>' },
+	{ input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
+	{ input : 'img', output : '<img src="$0" alt="" />' },
+	{ input : 'input', output : '<input name="$0" id="" type="" value="" />' },
+	{ input : 'label', output : '<label for="$0"></label>' },
+	{ input : 'legend', output : '<legend>\n\t$0\n</legend>' },
+	{ input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },		
+	{ input : 'base', output : '<base href="$0" />' }, 
+	{ input : 'body', output : '<body>\n\t$0\n</body>' }, 
+	{ input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
+	{ input : 'div', output : '<div>\n\t$0\n</div>' },
+	{ input : 'divid', output : '<div id="$0">\n\t\n</div>' },
+	{ input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
+	{ input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
+	{ input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
+	{ input : 'meta', output : '<meta name="$0" content="" />' },
+	{ input : 'p', output : '<p>$0</p>' },
+	{ input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
+	{ input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
+	{ input : 'span', output : '<span>$0</span>' },
+	{ input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
+	{ input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' }
+]
+	
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,7 @@
+/*
+ * CodePress color styles for Java syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
+i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
+s, s b {color:#2A00FF;font-weight:normal;} /* strings */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/java.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,24 @@
+/*
+ * CodePress regular expressions for Java syntax highlighting
+ */
+ 
+// Java
+Language.syntax = [
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>'}, // strings double quote
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
+	{ input : /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g, output : '<b>$1</b>'}, // reserved words
+	{ input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3'}, // comments //	
+	{ input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }// comments /* */
+]
+
+Language.snippets = []
+
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,8 @@
+/*
+ * CodePress color styles for JavaScript syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+u {color:darkblue;font-weight:bold;} /* special words */
+i, i b, i s, i u {color:green;font-weight:normal;} /* comments */
+s, s b, s u {color:#2A00FF;font-weight:normal;} /* strings */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/javascript.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,30 @@
+/*
+ * CodePress regular expressions for JavaScript syntax highlighting
+ */
+ 
+// JavaScript
+Language.syntax = [ 
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+	{ input : /\b(break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<b>$1</b>' }, // reserved words
+	{ input : /\b(alert|isNaN|parent|Array|parseFloat|parseInt|blur|clearTimeout|prompt|prototype|close|confirm|length|Date|location|Math|document|element|name|self|elements|setTimeout|navigator|status|String|escape|Number|submit|eval|Object|event|onblur|focus|onerror|onfocus|onclick|top|onload|toString|onunload|unescape|open|valueOf|window|onmouseover)\b/g, output : '<u>$1</u>' }, // special words
+	{ input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
+	{ input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+]
+
+Language.snippets = [
+	{ input : 'dw', output : 'document.write(\'$0\');' },
+	{ input : 'getid', output : 'document.getElementById(\'$0\')' },
+	{ input : 'fun', output : 'function $0(){\n\t\n}' },
+	{ input : 'func', output : 'function $0(){\n\t\n}' }
+]
+
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,11 @@
+/*
+ * CodePress color styles for Perl syntax highlighting
+ * By J. Nick Koston
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
+s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
+a {color:#006700;font-weight:bold;} /* variables */
+em {color:darkblue;font-weight:bold;} /* functions */
+u {font-weight:bold;} /* special chars */
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/perl.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,27 @@
+/*
+ * CodePress regular expressions for Perl syntax highlighting
+ * By J. Nick Koston
+ */
+
+// Perl
+Language.syntax = [ 
+	{ input  : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+	{ input  : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+	{ input  : /([\$\@\%][\w\.]*)/g, output : '<a>$1</a>' }, // vars
+	{ input  : /(sub\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
+	{ input  : /\b(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|else|elsif|endgrent|endhostent|endnetent|endprotoent|endpwent|eof|eval|exec|exists|exit|fcntl|fileno|find|flock|for|foreach|fork|format|formlinegetc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyaddr|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|hostname|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|LoadExternals|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ordpack|package|pipe|pop|pos|print|printf|push|pwd|qq|quotemeta|qw|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|stty|study|sub|substr|symlink|syscall|sysopen|sysread|system|syswritetell|telldir|tie|tied|time|times|tr|truncate|uc|ucfirst|umask|undef|unless|unlink|until|unpack|unshift|untie|use|utime|values|vec|waitpid|wantarray|warn|while|write)\b/g, output : '<b>$1</b>' }, // reserved words
+	{ input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
+	{ input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
+]
+
+Language.snippets = []
+
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,12 @@
+/*
+ * CodePress color styles for PHP syntax highlighting
+ */
+
+b {color:#000080;} /* tags */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {color:gray;font-weight:normal;} /* comments */
+s, s b, strong s u, strong s cite {color:#5656fa;font-weight:normal;} /* attributes and strings */
+strong a, strong a u {color:#006700;font-weight:bold;} /* variables */
+em {color:#800080;font-style:normal;} /* style */
+ins {color:#800000;} /* script */
+strong u {color:#7F0055;font-weight:bold;} /* reserved words */
+cite, s cite {color:red;font-weight:bold;} /* <?php and ?> */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/php.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,61 @@
+/*
+ * CodePress regular expressions for PHP syntax highlighting
+ */
+
+// PHP
+Language.syntax = [
+	{ input : /(&lt;[^!\?]*?&gt;)/g, output : '<b>$1</b>' }, // all tags
+	{ input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
+	{ input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, // script tags
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
+	{ input : /(&lt;\?)/g, output : '<strong>$1' }, // <?.*
+	{ input : /(\?&gt;)/g, output : '$1</strong>' }, // .*?>
+	{ input : /(&lt;\?php|&lt;\?=|&lt;\?|\?&gt;)/g, output : '<cite>$1</cite>' }, // php tags
+	{ input : /(\$[\w\.]*)/g, output : '<a>$1</a>' }, // vars
+	{ input : /\b(false|true|and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|for|foreach|function|global|if|include|include_once|isset|list|new|print|require|require_once|return|static|switch|unset|use|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interface|implements|extends|public|private|protected|abstract|clone|try|catch|throw|this)\b/g, output : '<u>$1</u>' }, // reserved words
+	{ input : /([^:])\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // php comments //
+	{ input : /([^:])#(.*?)(<br|<\/P)/g, output : '$1<i>#$2</i>$3' }, // php comments #
+	{ input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }, // php comments /* */
+	{ input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } // html comments
+]
+
+Language.snippets = [
+	{ input : 'if', output : 'if($0){\n\t\n}' },
+	{ input : 'ifelse', output : 'if($0){\n\t\n}\nelse{\n\t\n}' },
+	{ input : 'else', output : '}\nelse {\n\t' },
+	{ input : 'elseif', output : '}\nelseif($0) {\n\t' },
+	{ input : 'do', output : 'do{\n\t$0\n}\nwhile();' },
+	{ input : 'inc', output : 'include_once("$0");' },
+	{ input : 'fun', output : 'function $0(){\n\t\n}' },	
+	{ input : 'func', output : 'function $0(){\n\t\n}' },	
+	{ input : 'while', output : 'while($0){\n\t\n}' },
+	{ input : 'for', output : 'for($0,,){\n\t\n}' },
+	{ input : 'fore', output : 'foreach($0 as ){\n\t\n}' },
+	{ input : 'foreach', output : 'foreach($0 as ){\n\t\n}' },
+	{ input : 'echo', output : 'echo \'$0\';' },
+	{ input : 'switch', output : 'switch($0) {\n\tcase "": break;\n\tdefault: ;\n}' },
+	{ input : 'case', output : 'case "$0" : break;' },
+	{ input : 'ret0', output : 'return false;' },
+	{ input : 'retf', output : 'return false;' },
+	{ input : 'ret1', output : 'return true;' },
+	{ input : 'rett', output : 'return true;' },
+	{ input : 'ret', output : 'return $0;' },
+	{ input : 'def', output : 'define(\'$0\',\'\');' },
+	{ input : '<?', output : 'php\n$0\n?>' }
+]
+
+Language.complete = [
+	{ input : '\'', output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = [
+	{ input : '[space]', output : '&nbsp;' },
+	{ input : '[enter]', output : '<br />' } ,
+	{ input : '[j]', output : 'testing' },
+	{ input : '[7]', output : '&amp;' }
+]
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for Ruby syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
+s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
+a {color:#006700;font-weight:bold;} /* variables */
+em {color:darkblue;font-weight:bold;} /* functions */
+u {font-weight:bold;} /* special chars */
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/ruby.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,26 @@
+/*
+ * CodePress regular expressions for Perl syntax highlighting
+ */
+
+// Ruby
+Language.syntax = [
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote 
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+	{ input : /([\$\@\%]+)([\w\.]*)/g, output : '<a>$1$2</a>' }, // vars
+	{ input : /(def\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
+	{ input : /\b(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/g, output : '<b>$1</b>' }, // reserved words
+	{ input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
+	{ input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
+];
+
+Language.snippets = []
+
+Language.complete = [
+	{ input : '\'',output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for SQL syntax highlighting
+ * By Merlin Moncure
+ */
+ 
+b {color:#0000FF;font-style:normal;font-weight:bold;} /* reserved words */
+u {color:#FF0000;font-style:normal;} /* types */
+a {color:#CD6600;font-style:normal;font-weight:bold;} /* commands */
+i, i b, i u, i a, i s  {color:#A9A9A9;font-weight:normal;font-style:italic;} /* comments */
+s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;} /* strings */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/sql.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,30 @@
+/*
+ * CodePress regular expressions for SQL syntax highlighting
+ * By Merlin Moncure
+ */
+ 
+// SQL
+Language.syntax = [
+	{ input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote
+	{ input : /\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|like|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/gi, output : '<b>$1</b>' }, // reserved words
+	{ input : /\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/gi, output : '<u>$1</u>' }, // types
+	{ input : /\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/gi, output : '<a>$1</a>' }, // commands
+	{ input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments //	
+]
+
+Language.snippets = [
+	{ input : 'select', output : 'select $0 from  where ' }
+]
+
+Language.complete = [
+	{ input : '\'', output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = []
+
+
+

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,5 @@
+/*
+ * CodePress color styles for Text syntax highlighting
+ */
+
+/* do nothing as expected */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/text.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,9 @@
+/*
+ * CodePress regular expressions for Text syntax highlighting
+ */
+
+// plain text
+Language.syntax = []
+Language.snippets = []
+Language.complete = []
+Language.shortcuts = []

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,71 @@
+/*
+ * CodePress color styles for ASP-VB syntax highlighting 
+ * By Martin D. Kirk
+ */
+
+/* tags */
+b {
+	color:#000080;
+} 
+/* comments */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
+	color:gray;
+	font-weight:normal;
+}
+/* ASP comments */
+strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
+	color:gray;
+	font-weight:normal;
+}
+ /* attributes */ 
+s, s b, span s u, span s cite, strong span s {
+	color:#5656fa ;
+	font-weight:normal;
+}
+ /* strings */ 
+strong s,strong s b, strong s u, strong s cite {
+	color:#009900;
+	font-weight:normal;
+}
+strong ins{
+	color:#000000;
+	font-weight:bold;
+}
+ /* Syntax */
+strong a, strong a u {
+	color:#0000FF;
+	font-weight:;
+}
+ /* Native Keywords */
+strong u {
+	color:#990099;
+	font-weight:bold;
+}
+/* Numbers */
+strong var{
+	color:#FF0000;
+}
+/* ASP Language */
+span{
+	color:#990000;
+	font-weight:bold;
+}
+strong i,strong a i, strong u i {
+	color:#009999;
+}
+/* style */
+em {
+	color:#800080;
+	font-style:normal;
+}
+ /* script */ 
+ins {
+	color:#800000;
+	font-weight:bold;
+}
+
+/* <?php and ?> */
+cite, s cite {
+	color:red;
+	font-weight:bold;
+}
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/vbscript.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,117 @@
+/*
+ * CodePress regular expressions for ASP-vbscript syntax highlighting
+ */
+
+// ASP VBScript
+Language.syntax = [
+// all tags
+	{ input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
+// style tags	
+	{ input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
+// script tags	
+	{ input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
+// strings "" and attributes
+	{ input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
+// ASP Comment
+	{ input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
+// <%.*
+	{ input : /(&lt;%)/g, output : '<strong>$1' }, 
+// .*%>	
+	{ input : /(%&gt;)/g, output : '$1</strong>' }, 
+// <%@...%>	
+	{ input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
+//Numbers	
+	{ input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
+// Reserved Words 1 (Blue)
+	{ input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
+	{ input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
+	{ input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
+// Reserved Words 2 (Purple)	
+	{ input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
+	{ input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
+	{ input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
+// Reserved Words 3 (Turquis)
+	{ input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
+  	{ input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
+	{ input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
+// html comments
+	{ input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
+]
+
+Language.Functions = [ 
+  	// Output at index 0, must be the desired tagname surrounding a $1
+	// Name is the index from the regex that marks the functionname
+	{input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
+]
+
+Language.snippets = [
+//Conditional
+	{ input : 'if', output : 'If $0 Then\n\t\nEnd If' },
+	{ input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
+	{ input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
+//Response
+	{ input : 'rw', output : 'Response.Write( $0 )' },
+	{ input : 'resc', output : 'Response.Cookies( $0 )' },
+	{ input : 'resb', output : 'Response.Buffer'},
+	{ input : 'resflu', output : 'Response.Flush()'},
+	{ input : 'resend', output : 'Response.End'},
+//Request
+	{ input : 'reqc', output : 'Request.Cookies( $0 )' },
+	{ input : 'rq', output : 'Request.Querystring("$0")' },
+	{ input : 'rf', output : 'Request.Form("$0")' },
+//FSO
+	{ input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
+	{ input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
+	{ input : 'setfi', output : 'Set fi = fso.getFile($0)' },
+	{ input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
+	{ input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
+//Server
+	{ input : 'mapp', output : 'Server.Mappath($0)' },
+//Loops
+	{ input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
+	{ input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
+	{ input : 'do', output : 'Do While($0)\n\t\nLoop' },
+	{ input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
+//ADO
+	{ input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
+	{ input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
+	{ input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
+//Http Request
+	{ input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
+	{ input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
+//Functions
+	{ input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
+	{ input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
+
+]
+
+Language.complete = [
+	//{ input : '\'', output : '\'$0\'' },
+	{ input : '"', output : '"$0"' },
+	{ input : '(', output : '\($0\)' },
+	{ input : '[', output : '\[$0\]' },
+	{ input : '{', output : '{\n\t$0\n}' }		
+]
+
+Language.shortcuts = [
+	{ input : '[space]', output : '&nbsp;' },
+	{ input : '[enter]', output : '<br />' } ,
+	{ input : '[j]', output : 'testing' },
+	{ input : '[7]', output : '&amp;' }
+]
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.css
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.css	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,15 @@
+/*
+ * CodePress color styles for HTML syntax highlighting
+ * By RJ Bruneel
+ */
+ 
+b {color:#000080;} /* tags */
+ins, ins b, ins s, ins em {color:gray;} /* comments */
+s, s b {color:#7777e4;} /* attribute values */
+a {color:#E67300;} /* links */
+u {color:#CC66CC;} /* forms */
+big {color:#db0000;} /* images */
+em, em b {color:#800080;} /* style */
+strong {color:#800000;} /* script */
+tt i {color:darkblue;font-weight:bold;} /* script reserved words */
+xsl {color:green;} /* xsl */

Added: jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/codepress/languages/xsl.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,103 @@
+/*
+ * CodePress regular expressions for XSL syntax highlighting
+ * By RJ Bruneel
+ */
+
+Language.syntax = [ // XSL
+	{
+	input : /(&lt;[^!]*?&gt;)/g,
+	output : '<b>$1</b>' // all tags
+	},{
+	input : /(&lt;a.*?&gt;|&lt;\/a&gt;)/g,
+	output : '<a>$1</a>' // links
+	},{
+	input : /(&lt;img .*?&gt;)/g,
+	output : '<big>$1</big>' // images
+	},{
+	input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g,
+	output : '<u>$1</u>' // forms
+	},{
+	input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g,
+	output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags
+	},{
+	input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g,
+	output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags
+	},{	
+	input : /(&lt;xsl.*?&gt;|&lt;\/xsl.*?&gt;)/g,
+	output : '<xsl>$1</xsl>' // xsl
+	},{
+	input : /=(".*?")/g,
+	output : '=<s>$1</s>' // atributes double quote
+	},{
+	input : /=('.*?')/g,
+	output : '=<s>$1</s>' // atributes single quote
+	},{
+	input : /(&lt;!--.*?--&gt.)/g,
+	output : '<ins>$1</ins>' // comments 
+	},{
+	input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g,
+	output : '<i>$1</i>' // script reserved words
+	}
+];
+
+Language.snippets = [
+	{input : 'aref', output : '<a href="$0"></a>' },
+	{input : 'h1', output : '<h1>$0</h1>' },
+	{input : 'h2', output : '<h2>$0</h2>' },
+	{input : 'h3', output : '<h3>$0</h3>' },
+	{input : 'h4', output : '<h4>$0</h4>' },
+	{input : 'h5', output : '<h5>$0</h5>' },
+	{input : 'h6', output : '<h6>$0</h6>' },
+	{input : 'html', output : '<html>\n\t$0\n</html>' },
+	{input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
+	{input : 'img', output : '<img src="$0" width="" height="" alt="" border="0" />' },
+	{input : 'input', output : '<input name="$0" id="" type="" value="" />' },
+	{input : 'label', output : '<label for="$0"></label>' },
+	{input : 'legend', output : '<legend>\n\t$0\n</legend>' },
+	{input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },		
+	{input : 'base', output : '<base href="$0" />' }, 
+	{input : 'body', output : '<body>\n\t$0\n</body>' }, 
+	{input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
+	{input : 'div', output : '<div>\n\t$0\n</div>' },
+	{input : 'divid', output : '<div id="$0">\n\t\n</div>' },
+	{input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
+	{input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
+	{input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
+	{input : 'meta', output : '<meta name="$0" content="" />' },
+	{input : 'p', output : '<p>$0</p>' },
+	{input : 'b', output : '<b>$0</b>' },
+	{input : 'li', output : '<li>$0</li>' },
+	{input : 'ul', output : '<ul>$0</ul>' },
+	{input : 'ol', output : '<ol>$0</ol>' },
+	{input : 'strong', output : '<strong>$0</strong>' },
+	{input : 'br', output : '<br />' },
+	{input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
+	{input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
+	{input : 'span', output : '<span>$0</span>' },
+	{input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
+	{input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' },
+	{input : 'xsl:stylesheet', output : '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' },
+	{input : 'xsl:template', output : '<xsl:template>$0</xsl:template>' },
+	{input : 'xsl:for-each', output : '<xsl:for-each select="$0"></xsl:for-each>' },
+	{input : 'xsl:choose', output : '<xsl:choose>$0<\xsl:choose>' },
+	{input : 'xsl:param', output : '<xsl:param name="$0" />' },
+	{input : 'xsl:variable', output : '<xsl:variable name="$0"></xsl:variable>' },
+	{input : 'xsl:if', output : '<xsl:if test="$0"></xsl:if>' },
+	{input : 'xsl:when', output : '<xsl:when test="$0"></xsl:when>' },
+	{input : 'xsl:otherwise', output : '<xsl:otherwise>$0</xsl:otherwise>' },
+	{input : 'xsl:attribute', output : '<xsl:attribute name="$0"></xsl:attribute>' },
+	{input : 'xsl:value-of', output : '<xsl:value-of select="$0"/>' },
+	{input : 'xsl:with-param', output : '<xsl:with-param name="$0" select="" />' },
+	{input : 'xsl:call-template', output : '<xsl:call-template name="$0">' }
+
+];
+	
+Language.complete = [ // Auto complete only for 1 character
+	{input : '\'',output : '\'$0\'' },
+	{input : '"', output : '"$0"' },
+	{input : '(', output : '\($0\)' },
+	{input : '[', output : '\[$0\]' },
+	{input : '{', output : '{\n\t$0\n}' }		
+];
+
+Language.shortcuts = [];
\ No newline at end of file

Added: jifty/trunk/plugins/CodePress/share/web/static/js/codepress.js
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/CodePress/share/web/static/js/codepress.js	Sun Jun  3 21:09:18 2007
@@ -0,0 +1,150 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2006 Fernando M.A.d.S. <fermads at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ *
+ * This version is locally modified for Jifty, see Jifty::Plugin::CodePress
+ */
+
+CodePress = function(obj) {
+	var self = document.createElement('iframe');
+
+	self.textarea = obj;
+	self.textarea.disabled = true;
+	self.textarea.style.overflow = 'hidden';
+	self.style.height = self.textarea.clientHeight +'px';
+	self.style.width = self.textarea.clientWidth +'px';
+	self.textarea.style.overflow = 'auto';
+	self.style.border = '1px solid gray';
+	self.frameBorder = 0; // remove IE internal iframe border
+	self.style.visibility = 'hidden';
+	self.style.position = 'absolute';
+	self.options = self.textarea.className;
+	
+	self.initialize = function() {
+		self.editor = self.contentWindow.CodePress;
+		self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
+		self.editor.setCode(self.textarea.value);
+		self.setOptions();
+		self.editor.syntaxHighlight('init');
+		self.textarea.style.display = 'none';
+		self.style.position = 'static';
+		self.style.visibility = 'visible';
+		self.style.display = 'inline';
+	}
+	
+	// obj can by a textarea id or a string (code)
+	self.edit = function(obj,language) {
+		if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;
+		if(!self.textarea.disabled) return;
+		self.language = language ? language : self.getLanguage();
+		self.src = '/static/codepress/codepress.html?language='+self.language+'&ts='+(new Date).getTime();
+		if(self.attachEvent) self.attachEvent('onload',self.initialize);
+		else self.addEventListener('load',self.initialize,false);
+	}
+
+	self.getLanguage = function() {
+		for (language in CodePress.languages) 
+			if(self.options.match('\\b'+language+'\\b')) 
+				return CodePress.languages[language];
+		return 'generic';
+	}
+
+	self.setOptions = function() {
+		if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
+		if(self.options.match('readonly-on')) self.toggleReadOnly();
+		if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
+	}
+	
+	self.getCode = function() {
+		return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
+	}
+
+	self.setCode = function(code) {
+		self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;
+	}
+
+	self.toggleAutoComplete = function() {
+		self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
+	}
+	
+	self.toggleReadOnly = function() {
+		self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
+		if(self.style.display != 'none') // prevent exception on FF + iframe with display:none
+			self.editor.readOnly(self.textarea.readOnly ? true : false);
+	}
+	
+	self.toggleLineNumbers = function() {
+		var cn = self.editor.body.className;
+		self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
+	}
+	
+	self.toggleEditor = function() {
+		if(self.textarea.disabled) {
+			self.textarea.value = self.getCode();
+			self.textarea.disabled = false;
+			self.style.display = 'none';
+			self.textarea.style.display = 'inline';
+		}
+		else {
+			self.textarea.disabled = true;
+			self.setCode(self.textarea.value);
+			self.editor.syntaxHighlight('init');
+			self.style.display = 'inline';
+			self.textarea.style.display = 'none';
+		}
+	}
+
+	self.edit();
+	return self;
+}
+
+CodePress.languages = {	
+	csharp : 'C#', 
+	css : 'CSS', 
+	generic : 'Generic',
+	html : 'HTML',
+	java : 'Java', 
+	javascript : 'JavaScript', 
+	perl : 'Perl', 
+	ruby : 'Ruby',	
+	php : 'PHP', 
+	text : 'Text', 
+	sql : 'SQL',
+	vbscript : 'VBScript'
+}
+
+CodePress.instances = {}
+
+CodePress.run = function() {
+	t = document.getElementsByTagName('textarea');
+	for(var i=0,n=t.length;i<n;i++) {
+		if(t[i].className.match('codepress')) {
+			id = t[i].id;
+			//t[i].id = id+'_cp';
+			CodePress.instances[id] = new CodePress(t[i]);
+			t[i].parentNode.insertBefore(CodePress.instances[id], t[i]);
+		} 
+	}
+}
+
+CodePress.beforeSubmit = function() {
+	for (instance in CodePress.instances)  {
+		//CodePress.instances[ instance ].toggleEditor();
+		var i = CodePress.instances[ instance ];
+		//alert( instance + ' -- ' + i );
+
+		i.textarea.value = i.getCode();
+		i.textarea.disabled = false;
+		i.style.display = 'none';
+		i.textarea.style.display = 'inline';
+	}
+}
+
+if(window.attachEvent) window.attachEvent('onload',CodePress.run);
+else window.addEventListener('DOMContentLoaded',CodePress.run,false);


More information about the Jifty-commit mailing list