Working on note HTML edits

svn: r19685
This commit is contained in:
Doug Blank 2012-05-28 17:17:15 +00:00
parent 9f63d657cd
commit 8bcc160985
44 changed files with 19577 additions and 16 deletions

View File

@ -16,9 +16,12 @@
<link type="text/css" href="/styles/css/swanky-purse/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/styles/javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/styles/javascript/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="/styles/jhtmlarea/scripts/jHtmlArea-0.7.0.js"></script>
<link rel="Stylesheet" type="text/css" href="/styles/jhtmlarea/style/jHtmlArea.css" />
{% endblock %}
<style>
<style type="text/css">
table td {
vertical-align: middle;
}

View File

@ -3,13 +3,23 @@
{% block content %}
<script type="text/javascript">
$(function(){
$('#tabs').tabs();
});
</script>
<script type="text/javascript">
$(function(){
$('#tabs').tabs();
$('.wysiwyg').htmlarea({
toolbar: [
"bold", "italic", "underline",
"|",
"link", "unlink"
]
});
// FIXME: easier way?
$('.jHtmlArea').contents().find('iframe').contents().find('body').css({"background-color": "white"});
});
function setnotetext() {
document.getElementById('notetext').value = $('.jHtmlArea').contents().find('iframe').contents().find('body').text();
}
</script>
<div class="content" id="IndividualDetail">
{% include "detail_breadcrumb.html" %}
@ -23,10 +33,18 @@
<div id="error">{{noteform.errors}}</div>
<hr>
{% endif %}
<form method="post">{% csrf_token %}
<form method="post" onsubmit="setnotetext()">{% csrf_token %}
<tr>
<td class="ColumnAttribute">{{noteform.text.label}}:</td>
<td class="ColumnValue" id="data" colspan="3">{% render noteform.text user action %}</td>
<td class="ColumnValue" id="data" colspan="3">
{% if action == "edit" or action == "add" %}
<input type="hidden" id="notetext" name="notetext" value="this is hidden"></input>
{% render noteform.notetext user action %}
{% else %}
<p style="overflow-y: scroll; height: 100px;">{{notetext}}</p>
{% endif %}
</td>
</tr>
</tr>
<tr>
<td></td>

View File

@ -0,0 +1,36 @@
<%@ Page Language="VB" ValidateRequest="false" AutoEventWireup="false" CodeFile="AutoPostTest.aspx.vb" Inherits="PostTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript" src="scripts/jquery-1.3.2.js"></script>
<script type="text/javascript" src="scripts/jHtmlArea-0.7.0.js"></script>
<link rel="Stylesheet" type="text/css" href="style/jHtmlArea.css" />
<script type="text/javascript">
$(function() {
$("textarea").htmlarea(); // Initialize jHtmlArea's with all default values
//window.setTimeout(function() { $("form").submit(); }, 3000);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server" ID="sm1"></asp:ScriptManager>
<asp:Literal runat="server" ID="litText"></asp:Literal><br />
<textarea runat="server" id="txtText" cols="50" rows="15"></textarea>
<input type="submit" value='manual submit' />
<br />
<asp:Button runat="server" ID="btnSubmit" Text="asp:Button" />
<asp:LinkButton runat="server" ID="lbSubmit" Text="asp:LinkButton"></asp:LinkButton>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,9 @@

Partial Class PostTest
Inherits System.Web.UI.Page
Public Sub PostTest_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
txtText.Value = Request("txtText")
litText.Text = txtText.Value
End Sub
End Class

View File

@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/jHtmlArea-0.7.0.min.js"></script>
<link rel="Stylesheet" type="text/css" href="style/jHtmlArea.css" />
<script type="text/javascript" src="scripts/jHtmlArea.ColorPickerMenu-0.7.0.js"></script>
<link rel="Stylesheet" type="text/css" href="style/jHtmlArea.ColorPickerMenu.css" />
<style type="text/css">
div.jHtmlArea { border: solid 1px #ccc; }
</style>
</head>
<body>
<h3>jHtmlArea Live Demo - jHtmlAreaColorPickerMenu Example</h3>
<p>The jHtmlAreaColorPickerMenu plugin/extension allows you to show a simple Color Picker Menu when the user clicks on the "forecolor" Toolbar Button.</p>
<p>
<a href="http://jhtmlarea.codeplex.com">jHtmlArea Project Homepage</a>
&nbsp;|&nbsp;
<a href="http://jhtmlarea.codeplex.com/Release/ProjectReleases.aspx">Downloads</a>
&nbsp;|&nbsp;
<a href="http://jhtmlarea.codeplex.com/Thread/List.aspx">Discussions</a>
&nbsp;|&nbsp;
<a href="http://jhtmlarea.codeplex.com/WorkItem/List.aspx">Issue Tracker</a>
</p>
<script type="text/javascript">
//// You can also override the "default" colors option of the jHtmlAreaColorPickerMenu
//// to show only the specific colors you want.
// jHtmlAreaColorPickerMenu.defaultOptions.colors = ["red", "yellow", "blue", "green", "purple", "white", "black"];
// The followin creates a jHtmlArea and adds a custom list of toolbar buttons.
// Among the buttons is the "forecolor" button that will automatically take
// advantage of the jHtmlAreaColorPickerMenu plugin.
$(function() {
$("#Textarea1").htmlarea({
toolbar: ["html", "|",
"forecolor", // <-- Add the "forecolor" Toolbar Button
"|", "bold", "italic", "underline", "|", "p", "h1", "h2", "h3", "|", "link", "unlink"] // Overrides/Specifies the Toolbar buttons to show
});
});
</script>
<textarea id="Textarea1" cols="50" rows="15"><p><h3>Another TextArea</h3>This is some sample text to test out the <b>WYSIWYG Control</b>.</p></textarea>
<hr />
The jHtmlAreaColorPickerMenu object can also be reused for other purposes. For example clicking on the button below will allow you to change the background color of the page.
<br />
<input id="choosecolor" type="button" value="Choose Color..." />
<script type="text/javascript">
$(function() {
$("#choosecolor").click(function() {
jHtmlAreaColorPickerMenu(this, {
colorChosen: function(color) {
$(document.body).css('background-color', color);
}
});
});
});
</script>
<br /><br /><br /><br /><br />
<hr />
<div style="position: relative;border: solid 30px #cccccc;">
<h3>Editor within a "position: relative" DIV element.</h3>
<textarea id="txtInDiv" cols="50" rows="15">Some <b>Test</b> content.</textarea>
<script type="text/javascript">
$(function() {
$("#txtInDiv").htmlarea({
toolbar: ["html", "|",
"forecolor", // <-- Add the "forecolor" Toolbar Button
"|", "bold", "italic", "underline", "|", "p", "h1", "h2", "h3", "|", "link", "unlink"] // Overrides/Specifies the Toolbar buttons to show
});
});
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,128 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="Stylesheet" type="text/css" href="style/jqueryui/ui-lightness/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="scripts/jHtmlArea-0.7.0.js"></script>
<link rel="Stylesheet" type="text/css" href="style/jHtmlArea.css" />
<style type="text/css">
/* body { background: #ccc;} */
div.jHtmlArea .ToolBar ul li a.custom_disk_button
{
background: url(images/disk.png) no-repeat;
background-position: 0 0;
}
div.jHtmlArea { border: solid 1px #ccc; }
</style>
</head>
<body>
<script type="text/javascript">
// You can do this to perform a global override of any of the "default" options
// jHtmlArea.fn.defaultOptions.css = "jHtmlArea.Editor.css";
$(function() {
//$("textarea").htmlarea(); // Initialize all TextArea's as jHtmlArea's with default values
$("#txtDefaultHtmlArea").htmlarea(); // Initialize jHtmlArea's with all default values
$("#txtCustomHtmlArea").htmlarea({
// Override/Specify the Toolbar buttons to show
toolbar: [
["bold", "italic", "underline", "|", "forecolor"],
["p", "h1", "h2", "h3", "h4", "h5", "h6"],
["link", "unlink", "|", "image"],
[{
// This is how to add a completely custom Toolbar Button
css: "custom_disk_button",
text: "Save",
action: function(btn) {
// 'this' = jHtmlArea object
// 'btn' = jQuery object that represents the <A> "anchor" tag for the Toolbar Button
alert('SAVE!\n\n' + this.toHtmlString());
}
}]
],
// Override any of the toolbarText values - these are the Alt Text / Tooltips shown
// when the user hovers the mouse over the Toolbar Buttons
// Here are a couple translated to German, thanks to Google Translate.
toolbarText: $.extend({}, jHtmlArea.defaultOptions.toolbarText, {
"bold": "fett",
"italic": "kursiv",
"underline": "unterstreichen"
}),
// Specify a specific CSS file to use for the Editor
css: "style//jHtmlArea.Editor.css",
// Do something once the editor has finished loading
loaded: function() {
//// 'this' is equal to the jHtmlArea object
//alert("jHtmlArea has loaded!");
//this.showHTMLView(); // show the HTML view once the editor has finished loading
}
});
});
</script>
<textarea id="txtDefaultHtmlArea" cols="50" rows="15"><p><h3>Test H3</h3>This is some sample text to test out the <b>WYSIWYG Control</b>.</p></textarea>
<input type="button" value="Alert HTML" onclick="alert($('#txtDefaultHtmlArea').htmlarea('toHtmlString'));" />
<input type="button" value="Change Color to Blue" onclick="$('#txtDefaultHtmlArea').htmlarea('forecolor', 'blue');" />
<br /><hr /><br />
<textarea id="txtCustomHtmlArea" cols="50" rows="15"><p><h3>Another TextArea</h3>This is some sample text to test out the <b>WYSIWYG Control</b>.</p></textarea>
<input type="button" id="btnRemoveCustomHtmlArea" value="Remove jHtmlArea" />
<script type="text/javascript">
$(function() {
$("#btnRemoveCustomHtmlArea").click(function() {
$("#txtCustomHtmlArea").htmlarea("dispose");
});
});
</script>
<input type="button" id="btnResetCustomHtmlArea" value="Reset To Default Options" />
<script type="text/javascript">
$(function() {
$("#btnResetCustomHtmlArea").click(function() {
$("#txtCustomHtmlArea").htmlarea("dispose");
$("#txtCustomHtmlArea").htmlarea();
});
});
</script>
<br /><hr /><br />
<h3>Use jHtmlArea within jQuery UI Dialog</h3>
<script type="text/javascript">
$.ui.dialog.defaults.bgiframe = true;
$(function() {
$("#dialogShowButton").click(function() {
$("#dialog").dialog({width: 420});
$("#dialogEditor").htmlarea();
});
});
</script>
<input type="button" id="dialogShowButton" value="Show Dialog with jHtmlArea Editor" />
<div id="dialog" title="Basic dialog" style="display: none">
Basic jHtmlArea within jQuery UI Dialog
<br />
<textarea id="dialogEditor" rows="10" style="width: 400px">Some <b>Basic</b> text.</textarea>
</div>
<p>To see a "proper" example of the "Font Color" button, you'll want to see the "<a href="ColorPickerMenu.htm">jHtmlAreaColorPickerMenu</a>" in action here: <a href="ColorPickerMenu.htm">ColorPickerMenu.htm</a></p>
</body>
</html>

View File

@ -0,0 +1,117 @@
/* jHtmlArea - WYSIWYG Html Editor jQuery Plugin
* Copyright (c) 2009 Chris Pietschmann
* http://jhtmlarea.codeplex.com
* Licensed under the Microsoft Reciprocal License (Ms-RL)
* http://jhtmlarea.codeplex.com/license
*/
EXAMPLE USAGE:
-----------------------
See "Default.htm" for example usages.
Or, check out http://jhtmlarea.codeplex.com
CHANGE LOG
-----------------------
v0.7.0
- Fixed ColorPickerMenu positioning when placed within a "position: relative"
div element.
- Fixed ColorPickerMenu to auto-hide after a short delay (1 second) once the
user moves the mouse off the menu.
- Fixed Form Submit issue that caused the text to not be posted. Also fixed a
related issue with ASP.NET Postbacks.
- Added jHtmlArea.p method and "paragraph" functionality + toolbar button
This allows the user to change the formatting from <H1>, <H2>, etc. to <P>
- Added an "Automatic" color option to the ColorPickerMenu.
v0.6.0
- Hide All Toolbar buttons except the "html" button when entering
HTML Source view (via clicking "html" button or executing
jHtmlArea.showHTMLView). When toggling view back to the WYSIWYG editor
all other buttons will then be shown again.
- Added jHtmlArea.dispose method - Allows you to remove the WYSIWYG
editor, and go back to having a plain TextArea. Beware, there is a
memory leak when using this method; it's not too bad, but you want
to call this as few a number of times if you can. The memory leak
is due to the way the browsers handle removing DOM Elements.
- Added Indent and Outdent functionality - This includes toolbar buttons
and jHtmlArea.indent and jHtmlArea.outdent buttons.
- Added justifyLeft, justifyCenter, justifyRight functionality and toolbar
buttons.
- Added insertHorizontalRule functionality and toolbar button. This adds a
<hr> tag to the currently selected area.
- Added an "alias" method for jHtmlArea.execCommand named "ec" to help reduce the
file size of the script.
- Added increaseFontSize and decreaseFontSize functionality and toolbar buttons.
The increaseFontSize and decreaseFontSize doesn't currently work in Safari.
- Added forecolor functionality - Changes a font color for the selection or at the
insertion point. Requires a color value string to be passed in as a value argument.
- Fixed bug in jHtmlArea.toString method
- Added jHtmlArea.queryCommandValue method and it's alias "jHtmlArea.qc"
- Added the jHtmlAreaColorPickerMenu plugin/extension that resides within the
"jHtmlAreaColorPickerMenu.js" file. This file includes a somewhat generic color
picker menu that can be used for any purpose, plus it includes the code to wire
up and override the "stock" jHtmlColor.forecolor functionality and inject the new
Color Picker Menu functionality in it's place when you click on the "forecolor"
toolbar button.
- Changed the "execCommand" and "ec" second parameter to default to "false" if not
specified, and third parameter to default to "null" if not specified. This helps to
reduce the overall file size of the script.
- Added support for Toolbar Button Grouping, now with the additional buttons included
in this release, or even when any custom buttons are used, they will be able to display
nicely by "auto-wrapping" to the next line.
- Added a gradient background to the Toolbar Button Groups, with a slight reverse
gradient on the Buttons when the mouse is hovered over.
v0.5.0 - Initial Release
ICONS / IMAGES:
-----------------------
Some of the Icons within the jHtmlArea.png file are from the
Silk icon set at www.famfamfam.com.
They are licensed under the following license:
Silk icon set 1.3
_________________________________________
Mark James
http://www.famfamfam.com/lab/icons/silk/
_________________________________________
This work is licensed under a
Creative Commons Attribution 2.5 License.
[ http://creativecommons.org/licenses/by/2.5/ ]
This means you may use it for any purpose,
and make any changes you like.
All I ask is that you include a link back
to this page in your credits.
Are you using this icon set? Send me an email
(including a link or picture if available) to
mjames@gmail.com
Any other questions about this icon set please
contact mjames@gmail.com

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

View File

@ -0,0 +1,365 @@
/*
* This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only
* intended to be used only for design-time IntelliSense. Please use the
* standard jHtmlArea library for all production use.
*/
/*
* jHtmlArea 0.7.0 - WYSIWYG Html Editor jQuery Plugin
* Copyright (c) 2009 Chris Pietschmann
* http://jhtmlarea.codeplex.com
* Licensed under the Microsoft Reciprocal License (Ms-RL)
* http://jhtmlarea.codeplex.com/license
*/
(function($) {
$.fn.htmlarea = function(options) {
/// <summary>
/// 1: (options) - Convert all TextArea DOM Elements to be displayed as jHtmlArea WYSIWYG Editors.
/// 2: (string, arguments) - This function accepts a string containing the method name that you want to execute against the jHtmlArea object.
/// </summary>
/// <param name="options" type="Object">
/// 1: options - The custom options you want applied to the jHtmlArea's that are created.
/// 2: string - The name of the jHtmlArea object method to be executed. The results of the method call are then returned instead of the jQuery object.
/// </param>
};
var jHtmlArea = window.jHtmlArea = function(elem, options) {
/// <summary>
/// Converts the passed in TextArea DOM Element to a jHtmlArea WYSIWYG Editor.
/// </summary>
/// <param name="elem" type="TextArea DOM Element">
/// The TextArea DOM Element to be converted to a jHtmlArea WYSIWYG Editor. Required.
/// </param>
/// <param name="options" type="Object">
/// The custom options you want applied to the jHtmlArea that is created. Optional.
/// </param>
/// <field name="defaultOptions" Type="Object">
/// The Default Options that are used for configuring the jHtmlArea WYSIWYG Editor upon creation.
/// </field>
/// <returns type="jHtmlArea" />
};
jHtmlArea.fn = jHtmlArea.prototype = {
// The current version of jHtmlArea being used
jhtmlarea: "0.7.0",
init: function(elem, options) {
/// <summary>
/// Converts the passed in TextArea DOM Element to a jHtmlArea WYSIWYG Editor.
/// </summary>
/// <param name="elem" type="TextArea DOM Element">
/// Required. The TextArea DOM Element to be converted to a jHtmlArea WYSIWYG Editor.
/// </param>
/// <param name="options" type="Object">
/// Optional. The custom options you want applied to the jHtmlArea that is created.
/// </param>
/// <returns type="jHtmlArea" />
},
execCommand: function(a, b, c) {
/// <summary>
/// Executes a command on the current document, current selection, or the given range.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
/// </param>
/// <param name="b" type="Boolean">
/// Optional. Boolean that specifies one of the following values:
/// "false" = Default. Do not display a user interface. Must be combined with vValue, if the command requires a value.
/// "true" = Display a user interface if the command supports one.
/// </param>
/// <param name="c" type="Object">
/// Optional. Variant that specifies the string, number, or other value to assign. Possible values depend on the command.
/// </param>
},
ec: function(a, b, c) {
/// <summary>
/// Executes a command on the current document, current selection, or the given range. An alias for the "execCommand" method.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
/// </param>
/// <param name="b" type="Boolean">
/// Optional. Boolean that specifies one of the following values:
/// "false" = Default. Do not display a user interface. Must be combined with vValue, if the command requires a value.
/// "true" = Display a user interface if the command supports one.
/// </param>
/// <param name="c" type="Object">
/// Optional. Variant that specifies the string, number, or other value to assign. Possible values depend on the command.
/// </param>
},
queryCommandValue: function(a) {
/// <summary>
/// Returns the current value of the document, range, or current selection for the given command.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies a command identifier.
/// </param>
/// <returns type="Variant" />
},
qc: function(a) {
/// <summary>
/// Returns the current value of the document, range, or current selection for the given command. An alias for the "queryCommandValue" method.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies a command identifier.
/// </param>
/// <returns type="Variant" />
},
getSelectedHTML: function() {
/// <summary>
/// Returns the HTML that is currently selected within the editor.
/// </summary>
/// <returns type="String" />
},
getSelection: function() {
/// <summary>
/// Returns the Browser Selection object that represents the currently selected region of the editor.
/// </summary>
/// <returns type="Object" />
},
getRange: function() {
/// <summary>
/// Returns the Browser Range object that represents the currently selected region of the editor. (This uses the "getSelection" method internally.)
/// </summary>
/// <returns type="Object" />
},
html: function(v) {
/// <summary>
/// 1: () Returns the HTML text value contained within the editor. 2: (v) Sets the editors value to the HTML text passed in.
/// </summary>
/// <param name="v" type="String">
/// The HTML text to set the editors value to.
/// </param>
},
pasteHTML: function(html) {
/// <summary>
/// Pastes HTML text into the editor, replacing any currently selected text and HTML elements.
/// </summary>
/// <param name="html" type="String">
/// The HTML text to paste/insert.
/// </param>
},
cut: function() {
/// <summary>
/// Copies the current selection to the clipboard and then deletes it.
/// </summary>
},
copy: function() {
/// <summary>
/// Copies the current selection to the clipboard.
/// </summary>
},
paste: function() {
/// <summary>
/// Overwrites the contents of the clipboard on the current selection.
/// </summary>
},
bold: function() {
/// <summary>
/// Toggles the current selection between bold and nonbold.
/// </summary>
},
italic: function() {
/// <summary>
/// Toggles the current selection between italic and nonitalic.
/// </summary>
},
underline: function() {
/// <summary>
/// Toggles the current selection between underlined and not underlined.
/// </summary>
},
strikeThrough: function() {
/// <summary>
/// If there is a selection and all of the characters are already striked, the strikethrough will be removed. Otherwise, all selected characters will have a line drawn through them.
/// </summary>
},
image: function(url) {
/// <summary>
/// This command will insert an image (referenced by url) at the insertion point.
/// If no URL is specified, a prompt will be displayed to the user.
/// </summary>
/// <param name="url" type="String">
/// The URL to the Image to be inserted. If no URL is specified, a prompt will be shown.
/// </param>
},
removeFormat: function() {
/// <summary>
/// Removes the formatting tags from the current selection.
/// </summary>
},
link: function() {
/// <summary>
/// Inserts a hyperlink on the current selection, or displays a dialog box enabling the user to specify a URL to insert as a hyperlink on the current selection.
/// </summary>
},
unlink: function() {
/// <summary>
/// Removes any hyperlink from the current selection.
/// </summary>
},
orderedList: function() {
/// <summary>
/// Converts the text selection into an ordered list.
/// </summary>
},
unorderedList: function() {
/// <summary>
/// Converts the text selection into an unordered list.
/// </summary>
},
superscript: function() {
/// <summary>
/// If there is a selection and all of the characters are already superscripted, the superscript will be removed. Otherwise, all selected characters will be drawn slightly higher than normal text.
/// </summary>
},
subscript: function() {
/// <summary>
/// If there is a selection and all of the characters are already subscripted, the subscript will be removed. Otherwise, all selected characters will be drawn slightly lower than normal text.
/// </summary>
},
p: function() {
/// <summary>
/// Sets the current block format tag to <P>.
/// </summary>
},
h1: function() {
/// <summary>
/// Sets the current block format tag to <H1>.
/// </summary>
},
h2: function() {
/// <summary>
/// Sets the current block format tag to <H2>.
/// </summary>
},
h3: function() {
/// <summary>
/// Sets the current block format tag to <H3>.
/// </summary>
},
h4: function() {
/// <summary>
/// Sets the current block format tag to <H4>.
/// </summary>
},
h5: function() {
/// <summary>
/// Sets the current block format tag to <H5>.
/// </summary>
},
h6: function() {
/// <summary>
/// Sets the current block format tag to <H6>.
/// </summary>
},
heading: function(h) {
/// <summary>
/// Sets the current block format tag to <H?> tag.
/// Example: Calling jHtmlArea.heading(2) will be the same as calling jHtmlArea.h2()
/// </summary>
/// <param name="h" type="Number">
/// The Number of Header (<H?>) tag to format the current block with.
/// For Example: Passing a 2 or "2" will cause the current block to be formatted with a <H2> tag.
/// </param>
},
indent: function() {
/// <summary>
/// Indents the selection or insertion point.
/// </summary>
},
outdent: function() {
/// <summary>
/// Outdents the selection or insertion point.
/// </summary>
},
insertHorizontalRule: function() {
/// <summary>
/// Inserts a horizontal rule at the insertion point (deletes selection).
/// </summary>
},
justifyLeft: function() {
/// <summary>
/// Justifies the selection or insertion point to the left.
/// </summary>
},
justifyCenter: function() {
/// <summary>
/// Centers the selection or insertion point.
/// </summary>
},
justifyRight: function() {
/// <summary>
/// Right-justifies the selection or the insertion point.
/// </summary>
},
increaseFontSize: function() {
/// <summary>
/// Increases the Font Size around the selection or at the insertion point.
/// </summary>
},
decreaseFontSize: function() {
/// <summary>
/// Decreases the Font Size around the selection or at the insertion point.
/// </summary>
},
forecolor: function(c) {
/// <summary>
/// Changes a font color for the selection or at the insertion point. Requires a color value string to be passed in as a value argument.
/// </summary>
},
formatBlock: function(v) {
/// <summary>
/// Sets the current block format tag.
/// </summary>
},
showHTMLView: function() {
/// <summary>
/// Shows the HTML/Source View (TextArea DOM Element) within the Editor and hides the WYSIWYG interface.
/// </summary>
},
hideHTMLView: function() {
/// <summary>
/// Hides the HTML/Source View (TextArea DOM Element) within the Editor and displays the WYSIWYG interface.
/// </summary>
},
toggleHTMLView: function() {
/// <summary>
/// Toggles between HTML/Source View (TextArea DOM Element) and the WYSIWYG interface within the Editor.
/// </summary>
},
toHtmlString: function() {
/// <summary>
/// Returns the HTML text contained within the editor.
/// </summary>
/// <returns type="String" />
},
toString: function() {
/// <summary>
/// Return the Text contained within the editor, with all HTML tags removed.
/// </summary>
/// <returns type="String" />
},
updateTextArea: function() {
/// <summary>
/// Forces the TextArea DOM Element to by sync'd with the contents of the HTML WYSIWYG Editor.
/// </summary>
},
updateHtmlArea: function() {
/// <summary>
/// Forces the HTML WYSIWYG Editor to be sync'd with the contents of the TextArea DOM Element.
/// </summary>
}
};
jHtmlArea.fn.init.prototype = jHtmlArea.fn;
})(jQuery);

View File

@ -0,0 +1,403 @@
/*
* jHtmlArea 0.7.0 - WYSIWYG Html Editor jQuery Plugin
* Copyright (c) 2009 Chris Pietschmann
* http://jhtmlarea.codeplex.com
* Licensed under the Microsoft Reciprocal License (Ms-RL)
* http://jhtmlarea.codeplex.com/license
*/
(function($) {
$.fn.htmlarea = function(opts) {
if (opts && typeof (opts) === "string") {
var args = [];
for (var i = 1; i < arguments.length; i++) { args.push(arguments[i]); }
var htmlarea = jHtmlArea(this[0]);
var f = htmlarea[opts];
if (f) { return f.apply(htmlarea, args); }
}
return this.each(function() { jHtmlArea(this, opts); });
};
var jHtmlArea = window.jHtmlArea = function(elem, options) {
if (elem.jquery) {
return jHtmlArea(elem[0]);
}
if (elem.jhtmlareaObject) {
return elem.jhtmlareaObject;
} else {
return new jHtmlArea.fn.init(elem, options);
}
};
jHtmlArea.fn = jHtmlArea.prototype = {
// The current version of jHtmlArea being used
jhtmlarea: "0.7.0",
init: function(elem, options) {
if (elem.nodeName.toLowerCase() === "textarea") {
var opts = $.extend({}, jHtmlArea.defaultOptions, options);
elem.jhtmlareaObject = this;
var textarea = this.textarea = $(elem);
var container = this.container = $("<div/>").addClass("jHtmlArea").width(textarea.width()).insertAfter(textarea);
var toolbar = this.toolbar = $("<div/>").addClass("ToolBar").appendTo(container);
priv.initToolBar.call(this, opts);
var iframe = this.iframe = $("<iframe/>").height(textarea.height());
iframe.width(textarea.width() - ($.browser.msie ? 0 : 4));
var htmlarea = this.htmlarea = $("<div/>").append(iframe);
container.append(htmlarea).append(textarea.hide());
priv.initEditor.call(this, opts);
priv.attachEditorEvents.call(this);
// Fix total height to match TextArea
iframe.height(iframe.height() - toolbar.height());
toolbar.width(textarea.width() - 2);
if (opts.loaded) { opts.loaded.call(this); }
}
},
dispose: function() {
this.textarea.show().insertAfter(this.container);
this.container.remove();
this.textarea[0].jhtmlareaObject = null;
},
execCommand: function(a, b, c) {
this.iframe[0].contentWindow.focus();
this.editor.execCommand(a, b || false, c || null);
this.updateTextArea();
},
ec: function(a, b, c) {
this.execCommand(a, b, c);
},
queryCommandValue: function(a) {
this.iframe[0].contentWindow.focus();
return this.editor.queryCommandValue(a);
},
qc: function(a) {
return this.queryCommandValue(a);
},
getSelectedHTML: function() {
if ($.browser.msie) {
return this.getRange().htmlText;
} else {
var elem = this.getRange().cloneContents();
return $("<p/>").append($(elem)).html();
}
},
getSelection: function() {
if ($.browser.msie) {
//return (this.editor.parentWindow.getSelection) ? this.editor.parentWindow.getSelection() : this.editor.selection;
return this.editor.selection;
} else {
return this.iframe[0].contentDocument.defaultView.getSelection();
}
},
getRange: function() {
var s = this.getSelection();
if (!s) { return null; }
//return (s.rangeCount > 0) ? s.getRangeAt(0) : s.createRange();
return (s.getRangeAt) ? s.getRangeAt(0) : s.createRange();
},
html: function(v) {
if (v) {
this.pastHTML(v);
} else {
return toHtmlString();
}
},
pasteHTML: function(html) {
this.iframe[0].contentWindow.focus();
var r = this.getRange();
if ($.browser.msie) {
r.pasteHTML(html);
} else if ($.browser.mozilla) {
r.deleteContents();
r.insertNode($((html.indexOf("<") != 0) ? $("<span/>").append(html) : html)[0]);
} else { // Safari
r.deleteContents();
r.insertNode($(this.iframe[0].contentWindow.document.createElement("span")).append($((html.indexOf("<") != 0) ? "<span>" + html + "</span>" : html))[0]);
}
r.collapse(false);
r.select();
},
cut: function() {
this.ec("cut");
},
copy: function() {
this.ec("copy");
},
paste: function() {
this.ec("paste");
},
bold: function() { this.ec("bold"); },
italic: function() { this.ec("italic"); },
underline: function() { this.ec("underline"); },
strikeThrough: function() { this.ec("strikethrough"); },
image: function(url) {
if ($.browser.msie && !url) {
this.ec("insertImage", true);
} else {
this.ec("insertImage", false, (url || prompt("Image URL:", "http://")));
}
},
removeFormat: function() {
this.ec("removeFormat", false, []);
this.unlink();
},
link: function() {
if ($.browser.msie) {
this.ec("createLink", true);
} else {
this.ec("createLink", false, prompt("Link URL:", "http://"));
}
},
unlink: function() { this.ec("unlink", false, []); },
orderedList: function() { this.ec("insertorderedlist"); },
unorderedList: function() { this.ec("insertunorderedlist"); },
superscript: function() { this.ec("superscript"); },
subscript: function() { this.ec("subscript"); },
p: function() {
this.formatBlock("<p>");
},
h1: function() {
this.heading(1);
},
h2: function() {
this.heading(2);
},
h3: function() {
this.heading(3);
},
h4: function() {
this.heading(4);
},
h5: function() {
this.heading(5);
},
h6: function() {
this.heading(6);
},
heading: function(h) {
this.formatBlock($.browser.msie ? "Heading " + h : "h" + h);
},
indent: function() {
this.ec("indent");
},
outdent: function() {
this.ec("outdent");
},
insertHorizontalRule: function() {
this.ec("insertHorizontalRule", false, "ht");
},
justifyLeft: function() {
this.ec("justifyLeft");
},
justifyCenter: function() {
this.ec("justifyCenter");
},
justifyRight: function() {
this.ec("justifyRight");
},
increaseFontSize: function() {
if ($.browser.msie) {
this.ec("fontSize", false, this.qc("fontSize") + 1);
} else if ($.browser.safari) {
this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "larger")[0]);
} else {
this.ec("increaseFontSize", false, "big");
}
},
decreaseFontSize: function() {
if ($.browser.msie) {
this.ec("fontSize", false, this.qc("fontSize") - 1);
} else if ($.browser.safari) {
this.getRange().surroundContents($(this.iframe[0].contentWindow.document.createElement("span")).css("font-size", "smaller")[0]);
} else {
this.ec("decreaseFontSize", false, "small");
}
},
forecolor: function(c) {
this.ec("foreColor", false, c || prompt("Enter HTML Color:", "#"));
},
formatBlock: function(v) {
this.ec("formatblock", false, v || null);
},
showHTMLView: function() {
this.updateTextArea();
this.textarea.show();
this.htmlarea.hide();
$("ul li:not(li:has(a.html))", this.toolbar).hide();
$("ul:not(:has(:visible))", this.toolbar).hide();
$("ul li a.html", this.toolbar).addClass("highlighted");
},
hideHTMLView: function() {
this.updateHtmlArea();
this.textarea.hide();
this.htmlarea.show();
$("ul", this.toolbar).show();
$("ul li", this.toolbar).show().find("a.html").removeClass("highlighted");
},
toggleHTMLView: function() {
(this.textarea.is(":hidden")) ? this.showHTMLView() : this.hideHTMLView();
},
toHtmlString: function() {
return this.editor.body.innerHTML;
},
toString: function() {
return this.editor.body.innerText;
},
updateTextArea: function() {
this.textarea.val(this.toHtmlString());
},
updateHtmlArea: function() {
this.editor.body.innerHTML = this.textarea.val();
}
};
jHtmlArea.fn.init.prototype = jHtmlArea.fn;
jHtmlArea.defaultOptions = {
toolbar: [
["html"], ["bold", "italic", "underline", "strikethrough", "|", "subscript", "superscript"],
["increasefontsize", "decreasefontsize"],
["orderedlist", "unorderedlist"],
["indent", "outdent"],
["justifyleft", "justifycenter", "justifyright"],
["link", "unlink", "image", "horizontalrule"],
["p", "h1", "h2", "h3", "h4", "h5", "h6"],
["cut", "copy", "paste"]
],
css: null,
toolbarText: {
bold: "Bold", italic: "Italic", underline: "Underline", strikethrough: "Strike-Through",
cut: "Cut", copy: "Copy", paste: "Paste",
h1: "Heading 1", h2: "Heading 2", h3: "Heading 3", h4: "Heading 4", h5: "Heading 5", h6: "Heading 6", p: "Paragraph",
indent: "Indent", outdent: "Outdent", horizontalrule: "Insert Horizontal Rule",
justifyleft: "Left Justify", justifycenter: "Center Justify", justifyright: "Right Justify",
increasefontsize: "Increase Font Size", decreasefontsize: "Decrease Font Size", forecolor: "Text Color",
link: "Insert Link", unlink: "Remove Link", image: "Insert Image",
orderedlist: "Insert Ordered List", unorderedlist: "Insert Unordered List",
subscript: "Subscript", superscript: "Superscript",
html: "Show/Hide HTML Source View"
}
};
var priv = {
toolbarButtons: {
strikethrough: "strikeThrough", orderedlist: "orderedList", unorderedlist: "unorderedList",
horizontalrule: "insertHorizontalRule",
justifyleft: "justifyLeft", justifycenter: "justifyCenter", justifyright: "justifyRight",
increasefontsize: "increaseFontSize", decreasefontsize: "decreaseFontSize",
html: function(btn) {
this.toggleHTMLView();
}
},
initEditor: function(options) {
var edit = this.editor = this.iframe[0].contentWindow.document;
edit.designMode = 'on';
edit.open();
edit.write(this.textarea.val());
edit.close();
if (options.css) {
var e = edit.createElement('link'); e.rel = 'stylesheet'; e.type = 'text/css'; e.href = options.css; edit.getElementsByTagName('head')[0].appendChild(e);
}
},
initToolBar: function(options) {
var that = this;
var menuItem = function(className, altText, action) {
return $("<li/>").append($("<a href='javascript:void(0);'/>").addClass(className).attr("title", altText).click(function() { action.call(that, $(this)); }));
};
function addButtons(arr) {
var ul = $("<ul/>").appendTo(that.toolbar);
for (var i = 0; i < arr.length; i++) {
var e = arr[i];
if ((typeof (e)).toLowerCase() === "string") {
if (e === "|") {
ul.append($('<li class="separator"/>'));
} else {
var f = (function(e) {
// If button name exists in priv.toolbarButtons then call the "method" defined there, otherwise call the method with the same name
var m = priv.toolbarButtons[e] || e;
if ((typeof (m)).toLowerCase() === "function") {
return function(btn) { m.call(this, btn); };
} else {
return function() { this[m](); this.editor.body.focus(); };
}
})(e.toLowerCase());
var t = options.toolbarText[e.toLowerCase()];
ul.append(menuItem(e.toLowerCase(), t || e, f));
}
} else {
ul.append(menuItem(e.css, e.text, e.action));
}
}
};
if (options.toolbar.length !== 0 && priv.isArray(options.toolbar[0])) {
for (var i = 0; i < options.toolbar.length; i++) {
addButtons(options.toolbar[i]);
}
} else {
addButtons(options.toolbar);
}
},
attachEditorEvents: function() {
var t = this;
var fnHA = function() {
t.updateHtmlArea();
};
this.textarea.click(fnHA).
keyup(fnHA).
keydown(fnHA).
mousedown(fnHA).
blur(fnHA);
var fnTA = function() {
t.updateTextArea();
};
$(this.editor.body).click(fnTA).
keyup(fnTA).
keydown(fnTA).
mousedown(fnTA).
blur(fnTA);
$('form').submit(function() { t.toggleHTMLView(); t.toggleHTMLView(); });
//$(this.textarea[0].form).submit(function() { //this.textarea.closest("form").submit(function() {
// Fix for ASP.NET Postback Model
if (window.__doPostBack) {
var old__doPostBack = __doPostBack;
window.__doPostBack = function() {
if (t) {
if (t.toggleHTMLView) {
t.toggleHTMLView();
t.toggleHTMLView();
}
}
return old__doPostBack.apply(window, arguments);
};
}
},
isArray: function(v) {
return v && typeof v === 'object' && typeof v.length === 'number' && typeof v.splice === 'function' && !(v.propertyIsEnumerable('length'));
}
};
})(jQuery);

View File

@ -0,0 +1,357 @@
/*
* This file has been commented to support Visual Studio Intellisense.
* You should not use this file at runtime inside the browser--it is only
* intended to be used only for design-time IntelliSense. Please use the
* standard jHtmlArea library for all production use.
*/
/*
* jHtmlArea 0.7.0 - WYSIWYG Html Editor jQuery Plugin
* Copyright (c) 2009 Chris Pietschmann
* http://jhtmlarea.codeplex.com
* Licensed under the Microsoft Reciprocal License (Ms-RL)
* http://jhtmlarea.codeplex.com/license
*/
(function($) {
$.fn.htmlarea = function(options) {
/// <summary>
/// 1: (options) - Convert all TextArea DOM Elements to be displayed as jHtmlArea WYSIWYG Editors.
/// 2: (string, arguments) - This function accepts a string containing the method name that you want to execute against the jHtmlArea object.
/// </summary>
/// <param name="options" type="Object">
/// 1: options - The custom options you want applied to the jHtmlArea's that are created.
/// 2: string - The name of the jHtmlArea object method to be executed. The results of the method call are then returned instead of the jQuery object.
/// </param>
};
var jHtmlArea = window.jHtmlArea = function(elem, options) {
/// <summary>
/// Converts the passed in TextArea DOM Element to a jHtmlArea WYSIWYG Editor.
/// </summary>
/// <param name="elem" type="TextArea DOM Element">
/// The TextArea DOM Element to be converted to a jHtmlArea WYSIWYG Editor. Required.
/// </param>
/// <param name="options" type="Object">
/// The custom options you want applied to the jHtmlArea that is created. Optional.
/// </param>
/// <field name="defaultOptions" Type="Object">
/// The Default Options that are used for configuring the jHtmlArea WYSIWYG Editor upon creation.
/// </field>
/// <returns type="jHtmlArea" />
};
jHtmlArea.fn = jHtmlArea.prototype = {
// The current version of jHtmlArea being used
jhtmlarea: "0.7.0",
init: function(elem, options) {
/// <summary>
/// Converts the passed in TextArea DOM Element to a jHtmlArea WYSIWYG Editor.
/// </summary>
/// <param name="elem" type="TextArea DOM Element">
/// Required. The TextArea DOM Element to be converted to a jHtmlArea WYSIWYG Editor.
/// </param>
/// <param name="options" type="Object">
/// Optional. The custom options you want applied to the jHtmlArea that is created.
/// </param>
/// <returns type="jHtmlArea" />
},
execCommand: function(a, b, c) {
/// <summary>
/// Executes a command on the current document, current selection, or the given range.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
/// </param>
/// <param name="b" type="Boolean">
/// Optional. Boolean that specifies one of the following values:
/// "false" = Default. Do not display a user interface. Must be combined with vValue, if the command requires a value.
/// "true" = Display a user interface if the command supports one.
/// </param>
/// <param name="c" type="Object">
/// Optional. Variant that specifies the string, number, or other value to assign. Possible values depend on the command.
/// </param>
},
ec: function(a, b, c) {
/// <summary>
/// Executes a command on the current document, current selection, or the given range. An alias for the "execCommand" method.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
/// </param>
/// <param name="b" type="Boolean">
/// Optional. Boolean that specifies one of the following values:
/// "false" = Default. Do not display a user interface. Must be combined with vValue, if the command requires a value.
/// "true" = Display a user interface if the command supports one.
/// </param>
/// <param name="c" type="Object">
/// Optional. Variant that specifies the string, number, or other value to assign. Possible values depend on the command.
/// </param>
},
queryCommandValue: function(a) {
/// <summary>
/// Returns the current value of the document, range, or current selection for the given command.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies a command identifier.
/// </param>
/// <returns type="Variant" />
},
qc: function(a) {
/// <summary>
/// Returns the current value of the document, range, or current selection for the given command. An alias for the "queryCommandValue" method.
/// </summary>
/// <param name="a" type="String">
/// Required. String that specifies a command identifier.
/// </param>
/// <returns type="Variant" />
},
getSelectedHTML: function() {
/// <summary>
/// Returns the HTML that is currently selected within the editor.
/// </summary>
/// <returns type="String" />
},
getSelection: function() {
/// <summary>
/// Returns the Browser Selection object that represents the currently selected region of the editor.
/// </summary>
/// <returns type="Object" />
},
getRange: function() {
/// <summary>
/// Returns the Browser Range object that represents the currently selected region of the editor. (This uses the "getSelection" method internally.)
/// </summary>
/// <returns type="Object" />
},
pasteHTML: function(html) {
/// <summary>
/// Pastes HTML text into the editor, replacing any currently selected text and HTML elements.
/// </summary>
/// <param name="html" type="String">
/// The HTML text to paste/insert.
/// </param>
},
cut: function() {
/// <summary>
/// Copies the current selection to the clipboard and then deletes it.
/// </summary>
},
copy: function() {
/// <summary>
/// Copies the current selection to the clipboard.
/// </summary>
},
paste: function() {
/// <summary>
/// Overwrites the contents of the clipboard on the current selection.
/// </summary>
},
bold: function() {
/// <summary>
/// Toggles the current selection between bold and nonbold.
/// </summary>
},
italic: function() {
/// <summary>
/// Toggles the current selection between italic and nonitalic.
/// </summary>
},
underline: function() {
/// <summary>
/// Toggles the current selection between underlined and not underlined.
/// </summary>
},
strikeThrough: function() {
/// <summary>
/// If there is a selection and all of the characters are already striked, the strikethrough will be removed. Otherwise, all selected characters will have a line drawn through them.
/// </summary>
},
image: function(url) {
/// <summary>
/// This command will insert an image (referenced by url) at the insertion point.
/// If no URL is specified, a prompt will be displayed to the user.
/// </summary>
/// <param name="url" type="String">
/// The URL to the Image to be inserted. If no URL is specified, a prompt will be shown.
/// </param>
},
removeFormat: function() {
/// <summary>
/// Removes the formatting tags from the current selection.
/// </summary>
},
link: function() {
/// <summary>
/// Inserts a hyperlink on the current selection, or displays a dialog box enabling the user to specify a URL to insert as a hyperlink on the current selection.
/// </summary>
},
unlink: function() {
/// <summary>
/// Removes any hyperlink from the current selection.
/// </summary>
},
orderedList: function() {
/// <summary>
/// Converts the text selection into an ordered list.
/// </summary>
},
unorderedList: function() {
/// <summary>
/// Converts the text selection into an unordered list.
/// </summary>
},
superscript: function() {
/// <summary>
/// If there is a selection and all of the characters are already superscripted, the superscript will be removed. Otherwise, all selected characters will be drawn slightly higher than normal text.
/// </summary>
},
subscript: function() {
/// <summary>
/// If there is a selection and all of the characters are already subscripted, the subscript will be removed. Otherwise, all selected characters will be drawn slightly lower than normal text.
/// </summary>
},
p: function() {
/// <summary>
/// Sets the current block format tag to <P>.
/// </summary>
},
h1: function() {
/// <summary>
/// Sets the current block format tag to <H1>.
/// </summary>
},
h2: function() {
/// <summary>
/// Sets the current block format tag to <H2>.
/// </summary>
},
h3: function() {
/// <summary>
/// Sets the current block format tag to <H3>.
/// </summary>
},
h4: function() {
/// <summary>
/// Sets the current block format tag to <H4>.
/// </summary>
},
h5: function() {
/// <summary>
/// Sets the current block format tag to <H5>.
/// </summary>
},
h6: function() {
/// <summary>
/// Sets the current block format tag to <H6>.
/// </summary>
},
heading: function(h) {
/// <summary>
/// Sets the current block format tag to <H?> tag.
/// Example: Calling jHtmlArea.heading(2) will be the same as calling jHtmlArea.h2()
/// </summary>
/// <param name="h" type="Number">
/// The Number of Header (<H?>) tag to format the current block with.
/// For Example: Passing a 2 or "2" will cause the current block to be formatted with a <H2> tag.
/// </param>
},
indent: function() {
/// <summary>
/// Indents the selection or insertion point.
/// </summary>
},
outdent: function() {
/// <summary>
/// Outdents the selection or insertion point.
/// </summary>
},
insertHorizontalRule: function() {
/// <summary>
/// Inserts a horizontal rule at the insertion point (deletes selection).
/// </summary>
},
justifyLeft: function() {
/// <summary>
/// Justifies the selection or insertion point to the left.
/// </summary>
},
justifyCenter: function() {
/// <summary>
/// Centers the selection or insertion point.
/// </summary>
},
justifyRight: function() {
/// <summary>
/// Right-justifies the selection or the insertion point.
/// </summary>
},
increaseFontSize: function() {
/// <summary>
/// Increases the Font Size around the selection or at the insertion point.
/// </summary>
},
decreaseFontSize: function() {
/// <summary>
/// Decreases the Font Size around the selection or at the insertion point.
/// </summary>
},
forecolor: function(c) {
/// <summary>
/// Changes a font color for the selection or at the insertion point. Requires a color value string to be passed in as a value argument.
/// </summary>
},
formatBlock: function(v) {
/// <summary>
/// Sets the current block format tag.
/// </summary>
},
showHTMLView: function() {
/// <summary>
/// Shows the HTML/Source View (TextArea DOM Element) within the Editor and hides the WYSIWYG interface.
/// </summary>
},
hideHTMLView: function() {
/// <summary>
/// Hides the HTML/Source View (TextArea DOM Element) within the Editor and displays the WYSIWYG interface.
/// </summary>
},
toggleHTMLView: function() {
/// <summary>
/// Toggles between HTML/Source View (TextArea DOM Element) and the WYSIWYG interface within the Editor.
/// </summary>
},
toHtmlString: function() {
/// <summary>
/// Returns the HTML text contained within the editor.
/// </summary>
/// <returns type="String" />
},
toString: function() {
/// <summary>
/// Return the Text contained within the editor, with all HTML tags removed.
/// </summary>
/// <returns type="String" />
},
updateTextArea: function() {
/// <summary>
/// Forces the TextArea DOM Element to by sync'd with the contents of the HTML WYSIWYG Editor.
/// </summary>
},
updateHtmlArea: function() {
/// <summary>
/// Forces the HTML WYSIWYG Editor to be sync'd with the contents of the TextArea DOM Element.
/// </summary>
}
};
jHtmlArea.fn.init.prototype = jHtmlArea.fn;
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,189 @@
/*
* jHtmlAreaColorPickerMenu 0.7.0 - A Color Picker Extension to jHtmlArea
* Part of the jHtmlArea Project
* Copyright (c) 2009 Chris Pietschmann
* http://jhtmlarea.codeplex.com
* Licensed under the Microsoft Reciprocal License (Ms-RL)
* http://jhtmlarea.codeplex.com/license
*/
(function($) {
if (jHtmlArea) {
var oldForecolor = jHtmlArea.fn.forecolor;
jHtmlArea.fn.forecolor = function(c) {
if (c) {
// If color is specified, then use the "default" method functionality
oldForecolor.call(this, c);
} else {
// If no color is specified, then display color picker ui
var that = this;
var rng = this.getRange();
jHtmlAreaColorPickerMenu($(".forecolor", this.toolbar), {
colorChosen: function(color) {
if ($.browser.msie) {
rng.execCommand("ForeColor", false, color);
} else {
that.forecolor(color);
}
}
});
}
};
}
var menu = window.jHtmlAreaColorPickerMenu = function(ownerElement, options) {
return new jHtmlAreaColorPickerMenu.fn.init(ownerElement, options);
};
menu.fn = menu.prototype = {
jhtmlareacolorpickermenu: "0.7.0",
init: function(ownerElement, options) {
var opts = $.extend({}, menu.defaultOptions, options);
var that = this;
var owner = this.owner = $(ownerElement);
var position = owner.position();
if (menu.instance) {
menu.instance.hide();
}
jHtmlAreaColorPickerMenu.instance = this;
var picker = this.picker = $("<div/>").css({
position: "absolute",
left: position.left + opts.offsetLeft,
top: position.top + owner.height() + opts.offsetTop,
"z-index": opts["z-index"]
}).addClass("jHtmlAreaColorPickerMenu");
for (var i = 0; i < opts.colors.length; i++) {
var c = opts.colors[i];
$("<div/>").css("background-color", c).appendTo(picker).click(
(function(color) {
return function() {
if (opts.colorChosen) {
opts.colorChosen.call(this, color);
}
that.hide();
};
})(c)
);
}
$("<div/>").html("<div></div>Automatic").addClass("automatic").appendTo(picker).click(
function() {
if (opts.colorChosen) {
opts.colorChosen.call(this, null);
}
that.hide();
}
);
var autoHide = false;
picker.appendTo(owner.parent()).
show().
mouseout(function() {
autoHide = true;
that.currentTimeout = window.setTimeout(function() { if (autoHide === true) { that.hide(); } }, 1000);
}).
mouseover(function() {
if (that.currentTimeout) {
window.clearTimeout(that.currentTimeout);
that.currentTimeout = null;
}
autoHide = false;
});
},
hide: function() {
this.picker.hide();
this.picker.remove();
}
};
menu.fn.init.prototype = menu.fn;
menu.defaultOptions = {
"z-index": 0,
offsetTop: 0,
offsetLeft: 0,
colors: [
"#ffffff",
"#cccccc",
"#c0c0c0",
"#999999",
"#666666",
"#333333",
"#000000",
"#ffcccc",
"#ff6666",
"#ff0000",
"#cc0000",
"#990000",
"#660000",
"#330000",
"#ffcc99",
"#ff9966",
"#ff9900",
"#ff6600",
"#cc6600",
"#993300",
"#663300",
"#ffff99",
"#ffff66",
"#ffcc66",
"#ffcc33",
"#cc9933",
"#996633",
"#663333",
"#ffffcc",
"#ffff33",
"#ffff00",
"#ffcc00",
"#999900",
"#666600",
"#333300",
"#99ff99",
"#66ff99",
"#33ff33",
"#33cc00",
"#009900",
"#006600",
"#003300",
"#99FFFF",
"#33FFFF",
"#66CCCC",
"#00CCCC",
"#339999",
"#336666",
"#003333",
"#CCFFFF",
"#66FFFF",
"#33CCFF",
"#3366FF",
"#3333FF",
"#000099",
"#000066",
"#CCCCFF",
"#9999FF",
"#6666CC",
"#6633FF",
"#6600CC",
"#333399",
"#330099",
"#FFCCFF",
"#FF99FF",
"#CC66CC",
"#CC33CC",
"#993399",
"#663366",
"#330033"
],
colorChosen: null
};
})(jQuery);

View File

@ -0,0 +1,8 @@
// jHtmlArea - http://jhtmlarea.codeplex.com - (c)2009 Chris Pietschmann
(function($){if(jHtmlArea){var oldForecolor=jHtmlArea.fn.forecolor;jHtmlArea.fn.forecolor=function(c){if(c){oldForecolor.call(this,c);}else{var that=this;var rng=this.getRange();jHtmlAreaColorPickerMenu($(".forecolor",this.toolbar),{colorChosen:function(color){if($.browser.msie){rng.execCommand("ForeColor",false,color);}else{that.forecolor(color);}}});}};}
var menu=window.jHtmlAreaColorPickerMenu=function(ownerElement,options){return new jHtmlAreaColorPickerMenu.fn.init(ownerElement,options);};menu.fn=menu.prototype={jhtmlareacolorpickermenu:"0.7.0",init:function(ownerElement,options){var opts=$.extend({},menu.defaultOptions,options);var that=this;var owner=this.owner=$(ownerElement);var position=owner.position();if(menu.instance){menu.instance.hide();}
jHtmlAreaColorPickerMenu.instance=this;var picker=this.picker=$("<div/>").css({position:"absolute",left:position.left+opts.offsetLeft,top:position.top+owner.height()+opts.offsetTop,"z-index":opts["z-index"]}).addClass("jHtmlAreaColorPickerMenu");for(var i=0;i<opts.colors.length;i++){var c=opts.colors[i];$("<div/>").css("background-color",c).appendTo(picker).click((function(color){return function(){if(opts.colorChosen){opts.colorChosen.call(this,color);}
that.hide();};})(c));}
$("<div/>").html("<div></div>Automatic").addClass("automatic").appendTo(picker).click(function(){if(opts.colorChosen){opts.colorChosen.call(this,null);}
that.hide();});var autoHide=false;picker.appendTo(owner.parent()).show().mouseout(function(){autoHide=true;that.currentTimeout=window.setTimeout(function(){if(autoHide===true){that.hide();}},1000);}).mouseover(function(){if(that.currentTimeout){window.clearTimeout(that.currentTimeout);that.currentTimeout=null;}
autoHide=false;});},hide:function(){this.picker.hide();this.picker.remove();}};menu.fn.init.prototype=menu.fn;menu.defaultOptions={"z-index":0,offsetTop:0,offsetLeft:0,colors:["#ffffff","#cccccc","#c0c0c0","#999999","#666666","#333333","#000000","#ffcccc","#ff6666","#ff0000","#cc0000","#990000","#660000","#330000","#ffcc99","#ff9966","#ff9900","#ff6600","#cc6600","#993300","#663300","#ffff99","#ffff66","#ffcc66","#ffcc33","#cc9933","#996633","#663333","#ffffcc","#ffff33","#ffff00","#ffcc00","#999900","#666600","#333300","#99ff99","#66ff99","#33ff33","#33cc00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366","#330033"],colorChosen:null};})(jQuery);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
div.jHtmlAreaColorPickerMenu {border: solid 1px #bbb; background-color: #ddd; width: 112px;}
div.jHtmlAreaColorPickerMenu div {float: left; margin: 2px; width: 12px; height: 14px;}
div.jHtmlAreaColorPickerMenu div:hover {margin: 0px; border: dotted 2px black;}
div.jHtmlAreaColorPickerMenu div.automatic { width: 104px; height: auto; padding: 2px;}
div.jHtmlAreaColorPickerMenu div.automatic div { margin: 2px; width: 12px; height: 14px; border: solid 1px black;}

View File

@ -0,0 +1,6 @@
body
{
background: #000;
color: #fff;
margin: 2px;
}

View File

@ -0,0 +1,48 @@
div.jHtmlArea { display: inline block; }
div.jHtmlArea div { padding: 0px; margin: 0px; }
div.jHtmlArea .ToolBar { }
div.jHtmlArea .ToolBar ul { border: solid 1px #ccc; margin: 1px; padding: 1px; float: left; background: #fff url(jHtmlArea_Toolbar_Group_BG.png) repeat-x;}
div.jHtmlArea .ToolBar ul li { list-style-type: none; float: left; border: none; padding: 1px; margin: 1px; }
div.jHtmlArea .ToolBar ul li:hover { border: solid 1px #ccc; background: #ddd url(jHtmlArea_Toolbar_Group__Btn_Select_BG.png); padding: 0; }
div.jHtmlArea .ToolBar ul li a { display: block; width: 16px; height: 16px; background: url(jHtmlArea.png) no-repeat -16px -500px; border: none; cursor: pointer; padding: 0px; }
div.jHtmlArea .ToolBar ul li a.highlighted { border: solid 1px #aaa; background-color: #bbb; padding: 0; }
div.jHtmlArea .ToolBar ul li.separator {height: 16px; margin: 0 2px 0 3px; border-left: 1px solid #ccc;}
div.jHtmlArea .ToolBar ul li.separator:hover { padding: 1px; background-color: #fff; border-top:none; border-bottom:none; border-right:none;}
div.jHtmlArea .ToolBar ul li a:hover { }
div.jHtmlArea .ToolBar ul li a.bold { background-position: 0 0; }
div.jHtmlArea .ToolBar ul li a.italic { background-position: -16px 0; }
div.jHtmlArea .ToolBar ul li a.underline { background-position: -32px 0; }
div.jHtmlArea .ToolBar ul li a.strikethrough { background-position: -48px 0; }
div.jHtmlArea .ToolBar ul li a.link { background-position: -64px 0; }
div.jHtmlArea .ToolBar ul li a.unlink { background-position: -80px 0; }
div.jHtmlArea .ToolBar ul li a.orderedlist { background-position: -96px 0; }
div.jHtmlArea .ToolBar ul li a.unorderedlist { background-position: -112px 0; }
div.jHtmlArea .ToolBar ul li a.image { background-position: -128px 0; }
div.jHtmlArea .ToolBar ul li a.cut { background-position: -144px 0; }
div.jHtmlArea .ToolBar ul li a.copy { background-position: -160px 0; }
div.jHtmlArea .ToolBar ul li a.paste { background-position: -176px 0; }
div.jHtmlArea .ToolBar ul li a.html { background-position: -192px 0; opacity:0.6; filter:alpha(opacity=60);}
div.jHtmlArea .ToolBar ul li a.html.highlighted { opacity:1.0; filter:alpha(opacity=100);}
div.jHtmlArea .ToolBar ul li a.h1 { background-position: 0 -16px;}
div.jHtmlArea .ToolBar ul li a.h2 { background-position: -16px -16px;}
div.jHtmlArea .ToolBar ul li a.h3 { background-position: -32px -16px;}
div.jHtmlArea .ToolBar ul li a.h4 { background-position: -48px -16px;}
div.jHtmlArea .ToolBar ul li a.h5 { background-position: -64px -16px;}
div.jHtmlArea .ToolBar ul li a.h6 { background-position: -80px -16px;}
div.jHtmlArea .ToolBar ul li a.subscript { background-position: -96px -16px;}
div.jHtmlArea .ToolBar ul li a.superscript { background-position: -112px -16px;}
div.jHtmlArea .ToolBar ul li a.indent { background-position: -128px -16px;}
div.jHtmlArea .ToolBar ul li a.outdent { background-position: -144px -16px;}
div.jHtmlArea .ToolBar ul li a.horizontalrule { background-position: -160px -16px;}
div.jHtmlArea .ToolBar ul li a.p { background-position: -176px -16px;}
div.jHtmlArea .ToolBar ul li a.justifyleft { background-position: 0 -32px;}
div.jHtmlArea .ToolBar ul li a.justifycenter { background-position: -16px -32px;}
div.jHtmlArea .ToolBar ul li a.justifyright { background-position: -32px -32px;}
div.jHtmlArea .ToolBar ul li a.increasefontsize { background-position: -48px -32px;}
div.jHtmlArea .ToolBar ul li a.decreasefontsize { background-position: -64px -32px;}
div.jHtmlArea .ToolBar ul li a.forecolor { background-position: -80px -32px;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,406 @@
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; outline: none; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; outline: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; outline: none; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; outline: none; }
.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; outline: none; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; outline: none; text-decoration: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; }/* Accordion
----------------------------------*/
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; }
.ui-accordion .ui-accordion-content-active { display: block; }/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/* Dialog
----------------------------------*/
.ui-dialog { position: relative; padding: .2em; width: 300px; }
.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/* Progressbar
----------------------------------*/
.ui-progressbar { height:2em; text-align: left; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* Resizable
----------------------------------*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Slider
----------------------------------*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs
----------------------------------*/
.ui-tabs { padding: .2em; zoom: 1; }
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; }
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }

View File

@ -161,7 +161,10 @@ class EventForm(forms.ModelForm):
class NoteForm(forms.ModelForm):
class Meta:
model = Note
exclude = ["handle"]
exclude = ["handle", "text"]
notetext = forms.CharField(label="Text",
widget=forms.widgets.Textarea(attrs={'rows':'10', 'cols': '80', 'class':'wysiwyg'}))
class MediaForm(forms.ModelForm):
class Meta:

View File

@ -51,16 +51,17 @@ def process_note(request, context, handle, action, add_to=None): # view, edit, s
# Handle: edit, view, add, create, save, delete
if action == "add":
note = Note(gramps_id=dji.get_next_id(Note, "N"))
noteform = NoteForm(instance=note)
noteform = NoteForm(instance=note, initial={"notetext": note.text})
noteform.model = note
elif action in ["view", "edit"]:
note = Note.objects.get(handle=handle)
noteform = NoteForm(instance=note)
noteform = NoteForm(instance=note, initial={"notetext": note.text})
noteform.model = note
elif action == "save":
note = Note.objects.get(handle=handle)
noteform = NoteForm(request.POST, instance=note)
noteform = NoteForm(request.POST, instance=note, initial={"notetext": note.text})
noteform.model = note
note.text = noteform.data["notetext"]
if noteform.is_valid():
update_last_changed(note, request.user.username)
note = noteform.save()
@ -70,8 +71,9 @@ def process_note(request, context, handle, action, add_to=None): # view, edit, s
action = "edit"
elif action == "create":
note = Note(handle=create_id())
noteform = NoteForm(request.POST, instance=note)
noteform = NoteForm(request.POST, instance=note, initial={"notetext": note.text})
noteform.model = note
note.text = noteform.data["notetext"]
if noteform.is_valid():
update_last_changed(note, request.user.username)
note = noteform.save()
@ -94,6 +96,7 @@ def process_note(request, context, handle, action, add_to=None): # view, edit, s
context["noteform"] = noteform
context["object"] = note
context["notetext"] = note.text
context["note"] = note
context["action"] = action

View File

@ -29,3 +29,9 @@ dp = parser.parse
#import_file(db,
# "/home/dblank/gramps/trunk/example/gramps/data.gramps",
# cli.user.User())
#from webapp.utils import StyledNoteFormatter
#snf = StyledNoteFormatter(db)
#for n in Note.objects.all():
# note = db.get_note_from_handle(n.handle)
# print snf.get_note_format(note)

View File

@ -733,6 +733,88 @@ register_plugins()
# works after registering plugins:
import HtmlDoc
from libhtmlbackend import HtmlBackend
from libhtmlbackend import HtmlBackend, process_spaces
from libhtml import Html
class StyledNoteFormatter(object):
def __init__(self, database):
self.database = database
self._backend = HtmlBackend()
self._backend.build_link = self.build_link
#self.report = report
def get_note_format(self, note):
"""
will get the note from the database, and will return either the
styled text or plain note
"""
# retrieve the body of the note
note_text = note.get()
# styled notes
htmlnotetext = self.styled_note(note.get_styledtext(),
note.get_format(), contains_html =
note.get_type() == gen.lib.NoteType.HTML_CODE)
text = htmlnotetext or Html("p", note_text)
# return text of the note to its callers
return text
def styled_note(self, styledtext, format, contains_html=False):
"""
styledtext : assumed a StyledText object to write
format : = 0 : Flowed, = 1 : Preformatted
style_name : name of the style to use for default presentation
"""
text = str(styledtext)
if not text:
return ''
s_tags = styledtext.get_tags()
markuptext = self._backend.add_markup_from_styled(text, s_tags,
split='\n')
htmllist = Html("div", class_="grampsstylednote")
if contains_html:
htmllist += text
else:
linelist = []
linenb = 1
for line in markuptext.split('\n'):
[line, sigcount] = process_spaces(line, format)
if sigcount == 0:
# The rendering of an empty paragraph '<p></p>'
# is undefined so we use a non-breaking space
if linenb == 1:
linelist.append('&nbsp;')
htmllist.extend(Html('p') + linelist)
linelist = []
linenb = 1
else:
if linenb > 1:
linelist[-1] += '<br />'
linelist.append(line)
linenb += 1
if linenb > 1:
htmllist.extend(Html('p') + linelist)
# if the last line was blank, then as well as outputting the previous para,
# which we have just done,
# we also output a new blank para
if sigcount == 0:
linelist = ["&nbsp;"]
htmllist.extend(Html('p') + linelist)
return htmllist
def build_link(self, prop, handle, obj_class):
"""
Build a link to an item.
"""
if prop == "gramps_id":
if obj_class in self.database.get_table_names():
obj = self.database.get_table_metadata(obj_class)["gramps_id_func"](handle)
if obj:
handle = obj.handle
else:
raise AttributeError("gramps_id '%s' not found in '%s'" %
handle, obj_class)
else:
raise AttributeError("invalid gramps_id lookup "
"in table name '%s'" % obj_class)
# handle, ppl
return "/%s/%s" % (obj_class.lower(), handle)