summaryrefslogtreecommitdiff
path: root/addons/document_page/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-09-10 16:20:35 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-09-10 16:20:35 +0200
commitb10e31d2042821e54f3febc88829cd769843a3fe (patch)
treedb0b8a06a9f2dd803a7db31914b55be73855fdc3 /addons/document_page/static/src
parent1c0dd3b01663e8fe587d7b515eaa33eb9885ce67 (diff)
[IMP] replaced wiki stuff by html field
bzr revid: nicolas.vanhoren@openerp.com-20120910142035-rzxwsv4nb3jfcf3o
Diffstat (limited to 'addons/document_page/static/src')
-rw-r--r--addons/document_page/static/src/js/document_page.js18
-rwxr-xr-xaddons/document_page/static/src/lib/wiky/Readme.md41
-rwxr-xr-xaddons/document_page/static/src/lib/wiky/index.html56
-rwxr-xr-xaddons/document_page/static/src/lib/wiky/input_complete35
-rwxr-xr-xaddons/document_page/static/src/lib/wiky/wiky.css79
-rwxr-xr-xaddons/document_page/static/src/lib/wiky/wiky.js303
6 files changed, 0 insertions, 532 deletions
diff --git a/addons/document_page/static/src/js/document_page.js b/addons/document_page/static/src/js/document_page.js
deleted file mode 100644
index 836803bf700..00000000000
--- a/addons/document_page/static/src/js/document_page.js
+++ /dev/null
@@ -1,18 +0,0 @@
-openerp.document_page = function (openerp) {
- openerp.web.form.widgets.add('text_wiki', 'openerp.web.form.FieldTextWiki');
-
- openerp.web.form.FieldTextWiki = openerp.web.form.FieldText.extend({
- render_value: function() {
- var show_value = openerp.web.format_value(this.get('value'), this, '');
- if (!this.get("effective_readonly")) {
- this.$textarea.val(show_value);
- if (show_value && this.view.options.resize_textareas) {
- this.do_resize(this.view.options.resize_textareas);
- }
- } else {
- var wiki_value = wiky.process(show_value || '');
- this.$el.html(wiki_value);
- }
- },
- });
-};
diff --git a/addons/document_page/static/src/lib/wiky/Readme.md b/addons/document_page/static/src/lib/wiky/Readme.md
deleted file mode 100755
index 5d9bfe175a6..00000000000
--- a/addons/document_page/static/src/lib/wiky/Readme.md
+++ /dev/null
@@ -1,41 +0,0 @@
-Wiky.js - a javascript library to convert Wiki Markup language to HTML.
-=======================
-
-(It is buggy, please use with care)
-
-Wiky.js is a javascript library that converts Wiki Markup language to HTML.
-
-
-How to use it
--------------------
-Include wiki.js into your HTML file. Wiky.js has only one function, which is wiky.process(wikitext).
-
-Please see index.html for an example.
-
-*wiky.js does not depend on jQuery, which is included for testing purpose.
-
-
-
-Supported Syntax
--------------------
-* == Heading ==
-* === Subheading ===
-* [http://www.url.com Name of URLs]
-* [[File:http://www.url.com/image.png Alternative Text]]
-* -------------------- (Horizontal line)
-* : (Indentation)
-* # Ordered bullet point
-* * Unordered bullet point
-
-
-
-License
-------------------
-Creative Commons 3.0
-
-
-
-Contributors
--------------------
-Tanin Na Nakorn
-Tanun Niyomjit (Designer) \ No newline at end of file
diff --git a/addons/document_page/static/src/lib/wiky/index.html b/addons/document_page/static/src/lib/wiky/index.html
deleted file mode 100755
index 97992354fd6..00000000000
--- a/addons/document_page/static/src/lib/wiky/index.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="wiky.js"></script>
- <title>Untitled Document</title>
- <link href="wiky.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <textarea id="textarea" onchange="$('#preview').html(wiky.process($(this).val()));" cols="60" rows="20">=== Heading ===
-Some content
-I would like to add another line
-
-== Subheading ==
-Some more content
-Some more lines1
-:A line with indent
-:: A 2-indented line
-:: more
-:back to 1-indented line
-
-This is Taeyeon.
-[[File:http://www.oknation.net/blog/home/blog_data/12/2012/images/ty4.jpg Taeyeon]]
-Taeyeon is so cute.
-
-This is a link:[http://www.google.com Google].
-This is a bold link:'''[http://www.google.com Google]'''.
-This is a bold-italic link:'''''[http://www.google.com Google]'''''.
-This is '''bold''', '''''bold-italic''''', and ''italic''
-
-[[Video:http://www.youtube.com/embed/ovVfLancwys]]
-# First
-# secon
-## Second-First
-*** First Point
-*** Second Point
-#### z
-#### y
-#### x
-*** Third Point
-## Second-Second [ftp://www.facebook.com FacebookFTP]
-## Second-Third [http://www.google.com Google Here]
-# third
-
-</textarea>
- <br/>
- <span style="display:block;width:600px;border:1px solid #999999;">
- <span style="display:block;margin:10px 10px 10px 10px;" class="wiky_preview_area" id="preview">
- </span>
- </span>
- </body>
-</html>
-<script language="javascript">
- $('#preview').html(wiky.process($('#textarea').val()));
-</script>
diff --git a/addons/document_page/static/src/lib/wiky/input_complete b/addons/document_page/static/src/lib/wiky/input_complete
deleted file mode 100755
index c7e860cccf9..00000000000
--- a/addons/document_page/static/src/lib/wiky/input_complete
+++ /dev/null
@@ -1,35 +0,0 @@
-=== Heading ===
-Some content
-I would like to add another line
-
-== Subheading ==
-Some more content
-Some more lines1
-:A line with indent
-:: A 2-indented line
-:: more
-:back to 1-indented line
-
-This is Taeyeon.
-[[File:http://www.oknation.net/blog/home/blog_data/12/2012/images/ty4.jpg Taeyeon]]
-Taeyeon is so cute.
-
-This is a link:[http://www.google.com Google].
-This is a bold link:'''[http://www.google.com Google]'''.
-This is a bold-italic link:'''''[http://www.google.com Google]'''''.
-This is '''bold''', '''''bold-italic''''', and ''italic''
-
-
-# First
-# second
-## Second-First
-*** First Point
-*** Second Point
-#### z
-#### y
-#### x
-*** Third Point
-## Second-Second [ftp://www.facebook.com FacebookFTP]
-## Second-Third [http://www.google.com Google Here]
-# third
-
diff --git a/addons/document_page/static/src/lib/wiky/wiky.css b/addons/document_page/static/src/lib/wiky/wiky.css
deleted file mode 100755
index 0adc7896df0..00000000000
--- a/addons/document_page/static/src/lib/wiky/wiky.css
+++ /dev/null
@@ -1,79 +0,0 @@
-@charset "UTF-8";
-.wiky_preview_area {
- font-family: "Helvetica Neue", Arial, Helvetica, 'Liberation Sans', FreeSans, sans-serif;
- font-size: 13px;
- line-height: 1.5em;
- color: #666;
- font-weight:350;
- width:600px;
- display:block;
-}
-.wiky_preview_area h2{
- font-size:24px;
- color:#333;
- font-weight:400;
-
- text-shadow:0 1px 0 rgba(000, 000, 000, .4);
-}
-.wiky_preview_area h3{
- font-size:18px;
- color:#555;
- font-weight:400;
-
- text-shadow:0 1px 0 rgba(000, 000, 000, .4);
-}
-.wiky_preview_area img{
- background-repeat: repeat;
- width: 400px;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- -webkit-box-shadow:0 1px 3px rgba(0, 0, 0, .8);
- -moz-box-shadow:0 1px 3px rgba(0, 0, 0, .8);
- box-shadow:0 1px 3px rgba(0, 0, 0, .8);
-}
-.wiky_preview_area a{
- padding:5px;
- font-weight:400;
-
- background: #999; /* for non-css3 browsers */
-
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000'); /* for IE */
- background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000)); /* for webkit browsers */
- background: -moz-linear-gradient(top, #ccc, #000); /* for firefox 3.6+ */
-
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-
- -webkit-box-shadow:none;
- -moz-box-shadow:none;
- box-shadow:none;
-
- text-shadow:0 1px 0 rgba(255, 255, 255, 1);
-}
-
-.wiky_preview_area a:hover{
- color:#333;
- padding:5px;
- font-weight:400;
- text-decoration:none;
-
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-
- -webkit-box-shadow:0 1px 3px rgba(0, 0, 0, .3);
- -moz-box-shadow:0 1px 3px rgba(0, 0, 0, .3);
- box-shadow:0 1px 3px rgba(0, 0, 0, .3);
-
- text-shadow:0 1px 0 rgba(255, 255, 255, 1);
-}
-
-
-.wiky_preview_area > ol,
-.wiky_preview_area > ul,
-.wiky_preview_area > ul > li,
-.wiky_preview_area > ol > li {
- list-style: disc inside none;
-} \ No newline at end of file
diff --git a/addons/document_page/static/src/lib/wiky/wiky.js b/addons/document_page/static/src/lib/wiky/wiky.js
deleted file mode 100755
index 5bc9c6f167d..00000000000
--- a/addons/document_page/static/src/lib/wiky/wiky.js
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * Wiky.js - Javascript library to converts Wiki MarkUp language to HTML.
- * You can do whatever with it. Please give me some credits (Apache License)
- * - Tanin Na Nakorn
- */
-
-var wiky = {};
-
-
-wiky.process = function(wikitext) {
- var lines = wikitext.split(/\r?\n/);
- var start;
- var html = "";
-
- for (var i=0;i<lines.length;i++)
- {
- var line = lines[i];
- if (line.match(/^===/)!=null && line.match(/===$/)!=null)
- {
- html += "<h2>"+line.substring(3,line.length-3)+"</h2>";
- }
- else if (line.match(/^==/)!=null && line.match(/==$/)!=null)
- {
- html += "<h3>"+line.substring(2,line.length-2)+"</h3>";
- }
- else if (line.match(/^:+/)!=null)
- {
- // find start line and ending line
- start = i;
- while (i < lines.length && lines[i].match(/^:+/)!=null) i++;
- i--;
-
- html += wiky.process_indent(lines,start,i);
- }
- else if (line.match(/^----+(\s*)$/)!=null)
- {
- html += "<hr/>";
- }
- else if (line.match(/^(\*+) /)!=null)
- {
- // find start line and ending line
- start = i;
- while (i < lines.length && lines[i].match(/^(\*+|##+):? /)!=null) i++;
- i--;
-
- html += wiky.process_bullet_point(lines,start,i);
- }
- else if (line.match(/^(#+) /)!=null)
- {
- // find start line and ending line
- start = i;
- while (i < lines.length && lines[i].match(/^(#+|\*\*+):? /)!=null) i++;
- i--;
-
- html += wiky.process_bullet_point(lines,start,i);
- }
- else
- {
- html += wiky.process_normal(line);
- }
-
- html += "<br/>\n";
- }
-
- return html;
-};
-
-wiky.process_indent = function(lines,start,end) {
- var html = "<dl>";
-
- for(var i=start;i<=end;i++) {
-
- html += "<dd>";
-
- var this_count = lines[i].match(/^(:+)/)[1].length;
-
- html += wiky.process_normal(lines[i].substring(this_count));
-
- var nested_end = i;
- for (var j=i+1;j<=end;j++) {
- var nested_count = lines[j].match(/^(:+)/)[1].length;
- if (nested_count <= this_count) break;
- else nested_end = j;
- }
-
- if (nested_end > i) {
- html += wiky.process_indent(lines,i+1,nested_end);
- i = nested_end;
- }
-
- html += "</dd>";
- }
-
- html += "</dl>";
- return html;
-};
-
-wiky.process_bullet_point = function(lines,start,end) {
- var html = (lines[start].charAt(0)=='*')?"<ul>":"<ol>";
-
- for(var i=start;i<=end;i++) {
-
- html += "<li>";
-
- var this_count = lines[i].match(/^(\*+|#+) /)[1].length;
-
- html += wiky.process_normal(lines[i].substring(this_count+1));
-
- // continue previous with #:
- {
- var nested_end = i;
- for (var j = i + 1; j <= end; j++) {
- var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
-
- if (nested_count < this_count)
- break;
- else {
- if (lines[j].charAt(nested_count) == ':') {
- html += "<br/>" + wiky.process_normal(lines[j].substring(nested_count + 2));
- nested_end = j;
- } else {
- break;
- }
- }
-
- }
-
- i = nested_end;
- }
-
- // nested bullet point
- {
- var nested_end = i;
- for (var j = i + 1; j <= end; j++) {
- var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
- if (nested_count <= this_count)
- break;
- else
- nested_end = j;
- }
-
- if (nested_end > i) {
- html += wiky.process_bullet_point(lines, i + 1, nested_end);
- i = nested_end;
- }
- }
-
- // continue previous with #:
- {
- var nested_end = i;
- for (var j = i + 1; j <= end; j++) {
- var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
-
- if (nested_count < this_count)
- break;
- else {
- if (lines[j].charAt(nested_count) == ':') {
- html += wiky.process_normal(lines[j].substring(nested_count + 2));
- nested_end = j;
- } else {
- break;
- }
- }
-
- }
-
- i = nested_end;
- }
-
- html += "</li>";
- }
-
- html += (lines[start].charAt(0)=='*')?"</ul>":"</ol>";
- return html;
-};
-
-wiky.process_url = function(txt) {
-
- var index = txt.indexOf(" ");
-
- if (index == -1)
- {
- return "<a target='"+txt+"' href='"+txt+"' style='background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC\") no-repeat scroll right center transparent;padding-right: 13px;'></a>";
- }
- else
- {
- var url = txt.substring(0,index);
- var label = txt.substring(index+1);
- return "<a target='"+url+"' href='"+url+"' style='background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC\") no-repeat scroll right center transparent;padding-right: 13px;'>"+label+"</a>";
- }
-};
-
-wiky.process_image = function(txt) {
- var index = txt.indexOf(" ");
- var url = txt;
- var label = "";
-
- if (index > -1)
- {
- url = txt.substring(0,index);
- label = txt.substring(index+1);
- }
-
-
- return "<img src='"+url+"' alt=\""+label+"\" />";
-};
-
-wiky.process_video = function(url) {
-
- if (url.match(/^(https?:\/\/)?(www.)?youtube.com\//) == null)
- {
- return "<b>"+url+" is an invalid YouTube URL</b>";
- }
- var result;
- if ((result = url.match(/^(https?:\/\/)?(www.)?youtube.com\/watch\?(.*)v=([^&]+)/)) != null)
- {
- url = "http://www.youtube.com/embed/"+result[4];
- }
-
-
- return '<iframe width="480" height="390" src="'+url+'" frameborder="0" allowfullscreen></iframe>';
-};
-
-wiky.process_normal = function(wikitext) {
-
- // Image
- {
- var index = wikitext.indexOf("[[File:");
- var end_index = wikitext.indexOf("]]", index + 7);
- while (index > -1 && end_index > -1) {
-
- wikitext = wikitext.substring(0,index)
- + wiky.process_image(wikitext.substring(index+7,end_index))
- + wikitext.substring(end_index+2);
-
- index = wikitext.indexOf("[[File:");
- end_index = wikitext.indexOf("]]", index + 7);
- }
- }
-
- // Video
- {
- var index = wikitext.indexOf("[[Video:");
- var end_index = wikitext.indexOf("]]", index + 8);
- while (index > -1 && end_index > -1) {
-
- wikitext = wikitext.substring(0,index)
- + wiky.process_video(wikitext.substring(index+8,end_index))
- + wikitext.substring(end_index+2);
-
- index = wikitext.indexOf("[[Video:");
- end_index = wikitext.indexOf("]]", index + 8);
- }
- }
-
-
- // URL
- var protocols = ["http","ftp","news"];
-
- for (var i=0;i<protocols.length;i++)
- {
- var index = wikitext.indexOf("["+protocols[i]+"://");
- var end_index = wikitext.indexOf("]", index + 1);
- while (index > -1 && end_index > -1) {
-
- wikitext = wikitext.substring(0,index)
- + wiky.process_url(wikitext.substring(index+1,end_index))
- + wikitext.substring(end_index+1);
-
- index = wikitext.indexOf("["+protocols[i]+"://",end_index+1);
- end_index = wikitext.indexOf("]", index + 1);
-
- }
- }
-
- var count_b = 0;
- var index = wikitext.indexOf("'''");
- while(index > -1) {
-
- if ((count_b%2)==0) wikitext = wikitext.replace(/'''/,"<b>");
- else wikitext = wikitext.replace(/'''/,"</b>");
-
- count_b++;
-
- index = wikitext.indexOf("'''",index);
- }
-
- var count_i = 0;
- var index = wikitext.indexOf("''");
- while(index > -1) {
-
- if ((count_i%2)==0) wikitext = wikitext.replace(/''/,"<i>");
- else wikitext = wikitext.replace(/''/,"</i>");
-
- count_i++;
-
- index = wikitext.indexOf("''",index);
- }
-
- wikitext = wikitext.replace(/<\/b><\/i>/g,"</i></b>");
-
- return wikitext;
-};