Commits

Anonymous committed b06f6b7

Moving project directory (again); LICENCE:

Comments (0)

Files changed (138)

 syntax: glob
 
+main.py
+eagproject/settings.py
 *.pyc
 *.swp
 *.yaml

dproject/__init__.py

Empty file removed.

dproject/eag-static/css/MooEditable/Editable.css

-table { border: 1px dashed #BBBBBB; font:inherit; }
-table td, table th { border: 1px dashed #BBBBBB; }
-table th { font-weight:bold ; }
-object { display:block; border: 1px dashed gray; background: url(Other/flash.png) no-repeat center center; }

dproject/eag-static/css/MooEditable/MooEditable.Charmap.css

-
-.mooeditable-ui-toolbar .charmap-item .button-icon {
-	background: transparent url(Other/character.png) no-repeat center center;
-}

dproject/eag-static/css/MooEditable/MooEditable.Extras.css

-.mooeditable-ui-toolbar .justifycenter-item .button-icon,
-.mooeditable-ui-toolbar .justifyright-item .button-icon,
-.mooeditable-ui-toolbar .justifyfull-item .button-icon,
-.mooeditable-ui-toolbar .justifyleft-item .button-icon{
-	background-image: url(images/mooeditable-extras-toolbarbuttons-tango.png);
-}
-
-.mooeditable-ui-toolbar .justifycenter-item .button-icon{ background-position: 0 0; } 
-.mooeditable-ui-toolbar .justifyfull-item .button-icon{ background-position: 0 -16px; } 
-.mooeditable-ui-toolbar .justifyleft-item .button-icon{ background-position: 0 -32px; } 
-.mooeditable-ui-toolbar .justifyright-item .button-icon{ background-position: 0 -48px; } 
-
-.mooeditable-ui-toolbar .removeformat-item .button-icon { background: transparent url(Other/removeformat.png) no-repeat center center; }
-.mooeditable-ui-toolbar .insertHorizontalRule-item .button-icon { background: transparent url(Other/hr.png) no-repeat center center; }

dproject/eag-static/css/MooEditable/MooEditable.Flash.css

-
-.mooeditable-ui-toolbar .flash-item .button-icon {
-	background: transparent url(Other/flash.png) no-repeat center center;
-}

dproject/eag-static/css/MooEditable/MooEditable.Forecolor.css

-.mooeditable-ui-toolbar .forecolor-item .button-icon{
-	background: transparent url(images/mooeditable-toolbarbuttons-silk.png) no-repeat top left;
-	background-position: 0 -192px;
-}
-
-.forecolor-overlay .overlay-content{
-    padding: 4px 0 0 4px;
-}
-
-.forecolor-overlay .forecolor-colorpicker-color{
-    line-height: 0;
-	overflow: hidden;
-	height: 12px;
-	width: 12px;
-	float: left;
-    margin: 0 4px 4px 0;
-	border: 1px solid #fff;
-	border-radius: 2px;
-	-webkit-border-radius: 2px;
-	-moz-border-radius: 2px;
-}
-
-.forecolor-overlay .forecolor-colorpicker-color:hover {
-	border-color: #000;
-}
-
-.forecolor-overlay .forecolor-colorpicker-br{
-    display: block;
-    clear: left;
-}

dproject/eag-static/css/MooEditable/MooEditable.Table.css

-
-.mooeditable-ui-toolbar .tableadd-item .button-icon {
-	background: transparent url(Other/table-add.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tableedit-item .button-icon {
-	background: transparent url(Other/table-edit.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowadd-item .button-icon {
-	background: transparent url(Other/table-rowadd.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowedit-item .button-icon {
-	background: transparent url(Other/table-rowedit.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowspan-item .button-icon {
-	background: transparent url(Other/table-rowspan.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowsplit-item .button-icon {
-	background: transparent url(Other/table-rowsplit.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowspan-item .button-icon {
-	background: transparent url(Other/table-rowspan.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablerowdelete-item .button-icon {
-	background: transparent url(Other/table-rowdelete.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablecoladd-item .button-icon {
-	background: transparent url(Other/table-coladd.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablecoledit-item .button-icon {
-	background: transparent url(Other/table-coledit.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablecolspan-item .button-icon {
-	background: transparent url(Other/table-colspan.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablecolsplit-item .button-icon {
-	background: transparent url(Other/table-colsplit.png) no-repeat center center;
-}
-
-.mooeditable-ui-toolbar .tablecoldelete-item .button-icon {
-	background: transparent url(Other/table-coldelete.png) no-repeat center center;
-}

dproject/eag-static/css/MooEditable/MooEditable.css

-.mooeditable-container{
-	position: relative;
-	border: 2px solid #ddd;
-}
-
-.mooeditable-ui-toolbar{
-	color: inherit;
-	background-color: #eee;
-	padding: 2px;
-}
-
-.mooeditable-ui-toolbar:after{
-	content: ".";
-	display: block;
-	height: 0;
-	clear: both;
-	visibility: hidden;
-}
-
-.mooeditable-ui-toolbar .toolbar-item,
-.mooeditable-ui-toolbar .toolbar-separator{
-	display: -moz-inline-box;
-	display: inline-block;
-	vertical-align: middle;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button{
-	cursor: pointer;
-	border: 0;
-	width: auto;
-	height: auto;
-	margin: 2px;
-	padding: 2px;
-	vertical-align: middle;
-	color: inherit;
-	background-color: transparent;
-}
-* html .mooeditable-ui-toolbar .mooeditable-ui-button{ /* IE6 */
-	width: 24px;
-	overflow: visible;
-	padding: 2px 4px;
-}
-*:first-child+html .mooeditable-ui-toolbar .mooeditable-ui-button{ /* IE7 */
-	min-width: 24px;
-	overflow: visible;
-	padding: 2px 4px;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button.active,
-.mooeditable-ui-toolbar .mooeditable-ui-button.onActive{
-	color: inherit;
-	background-color: #ddd;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button:hover,
-.mooeditable-ui-toolbar .mooeditable-ui-button.hover{
-	color: inherit;
-	background-color: #fff;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button.disabled{
-	cursor: default;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button.disabled:hover{
-	color: inherit;
-	background-color: transparent;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button .button-icon{
-	display: -moz-inline-box;
-	display: inline-block;
-	width: 16px;
-	height: 16px;
-	vertical-align: middle;
-	color: inherit;
-	background: transparent url(images/mooeditable-toolbarbuttons-tango.png) no-repeat 0 -8px;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button .button-text{
-	display: none;
-	font-size: 13px;
-	vertical-align: middle;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button-text .button-icon{
-	display: none;
-}
-.mooeditable-ui-toolbar .mooeditable-ui-button-text .button-text{
-	display: inline;
-}
-
-.mooeditable-ui-toolbar .mooeditable-ui-button-icon-text{
-	width: auto;
-}
-.mooeditable-ui-toolbar .mooeditable-ui-button-icon-text .button-text{
-	display: inline;
-	margin-left: 4px;
-}
-
-.mooeditable-ui-toolbar .toolbar-separator{
-	width: 1px;
-	height: 24px;
-	margin: 2px;
-	text-indent: -999em;
-	color: inherit;
-	background-color: #fafafa;
-}
-
-.mooeditable-ui-toolbar .bold-item .button-icon{ background-position: 0 0; } 
-.mooeditable-ui-toolbar .createlink-item .button-icon{ background-position: 0 -16px; } 
-.mooeditable-ui-toolbar .indent-item .button-icon{ background-position: 0 -32px; } 
-.mooeditable-ui-toolbar .insertorderedlist-item .button-icon{ background-position: 0 -48px; } 
-.mooeditable-ui-toolbar .insertunorderedlist-item .button-icon{ background-position: 0 -64px; } 
-.mooeditable-ui-toolbar .italic-item .button-icon{ background-position: 0 -80px; } 
-.mooeditable-ui-toolbar .outdent-item .button-icon{ background-position: 0 -96px; } 
-.mooeditable-ui-toolbar .redo-item .button-icon{ background-position: 0 -112px; } 
-.mooeditable-ui-toolbar .strikethrough-item .button-icon{ background-position: 0 -128px; } 
-.mooeditable-ui-toolbar .toggleview-item .button-icon{ background-position: 0 -144px; } 
-.mooeditable-ui-toolbar .underline-item .button-icon{ background-position: 0 -160px; } 
-.mooeditable-ui-toolbar .undo-item .button-icon{ background-position: 0 -176px; } 
-.mooeditable-ui-toolbar .unlink-item .button-icon{ background-position: 0 -192px; } 
-.mooeditable-ui-toolbar .urlimage-item .button-icon{ background-position: 0 -208px; } 
-
-.mooeditable-iframe{
-	margin: 0;
-	padding: 0;
-	border: 0;
-	width: 100%;
-	vertical-align: top;
-}
-
-.mooeditable-textarea{
-	margin: 0 !important;
-	padding: 0 !important;
-	border: 0 !important;
-	width: 100% !important;
-	resize: none !important; /* disable resizable textareas in Webkit */
-	outline: 0 !important; /* disable focus ring in Safari */
-}
-
-.mooeditable-ui-dialog{
-	color: inherit;
-	background-color: #ddd;
-	position: absolute;
-	display: block;
-	cursor: default;
-	font-size: 12px;
-	z-index: 100;
-	width: 100%;
-}
-
-.mooeditable-ui-dialog .dialog-content{
-	padding: 4px 10px;
-}
-
-.mooeditable-ui-dialog .dialog-content *{
-	vertical-align: middle;
-}
-
-.mooeditable-ui-dialog input{
-	margin: 0 8px;
-}
-
-.mooeditable-ui-dialog input.text{
-	width: 300px;
-}
-
-.mooeditable-ui-button-overlay{
-	color: inherit;
-	background-color: #ddd;
-	font-size: 12px;
-	z-index: 100;
-	outline: 0;
-	-moz-outline: 0;
-	-webkit-outline: 0;
-}
-
-.mooeditable-ui-button-overlay .overlay-content{
-	padding: 10px;
-}

dproject/eag-static/css/MooEditable/Other/character.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/flash.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/hr.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/pagebreak.gif

Removed
Old image

dproject/eag-static/css/MooEditable/Other/pagebreak.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/removeformat.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-add.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-coladd.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-coldelete.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-coledit.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-colspan.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-colsplit.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-edit.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-rowadd.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-rowdelete.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-rowedit.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-rowspan.png

Removed
Old image

dproject/eag-static/css/MooEditable/Other/table-rowsplit.png

Removed
Old image

dproject/eag-static/css/MooEditable/images/mooeditable-extras-toolbarbuttons-tango.png

Removed
Old image

dproject/eag-static/css/MooEditable/images/mooeditable-toolbarbuttons-silk.png

Removed
Old image

dproject/eag-static/css/MooEditable/images/mooeditable-toolbarbuttons-tango.png

Removed
Old image

dproject/eag-static/css/style.css

-html, body {
-    width: 100%;
-    height: 100%;
-    padding: 0;
-    margin: 0;
-    font-family: sans-serif;
-}
-
-ul, li, form {
-    padding: 0;
-    margin: 0;
-    border: 0;
-}
-
-h1 {
-    font-size: 16pt;
-    font-family: sans-serif;
-    margin-bottom: 4pt;
-}
-
-a {
-    text-decoration: underline;
-}
-
-a:hover {
-    text-decoration: none;
-}
-
-.clear {
-    clear: both;
-}
-
-.left {
-    float: left;
-}
-
-.right {
-    float: right;
-}
-
-body {
-    background-color: #cfcfda;
-}
-
-#Everything {
-    padding: 0 2.0em;
-}
-
-#Header {
-    padding: 0.5em 0;
-}
-
-#Header .logout {
-    font-size: 8pt;
-}
-
-#Header .logout a {
-    display: block;
-    background-color: #000;
-    float: right;
-    color: #fff;
-    text-decoration: none;
-    padding: 0.25em 0.5em;
-    margin-top: -0.5em;
-    border-radius: 3pt;
-    -moz-border-radius: 3pt;
-}
-
-#Footer {
-    border-top: 7px solid #000;
-    padding-bottom: 3em;
-}
-
-/* Menu */
-#TopMenu {
-    list-style-type: none;
-}
-
-#TopMenu li {
-    border-top-left-radius: 5pt;
-    border-top-right-radius: 5pt;
-    -moz-border-radius-topleft: 5pt;
-    -moz-border-radius-topright: 5pt;
-    background-color: #000;
-    font-size: 10pt;
-    font-weight: bold;
-    padding: 4pt 9pt 0 9pt;
-    float: left;
-}
-
-#TopMenu li a {
-    color: #cfcfda;
-    text-decoration: none;
-}
-
-#TopMenu li.active {
-    background-color: #fff;
-    border-bottom: 4px solid #fff;
-    margin-bottom: -4px;
-}
-
-#TopMenu li.active a {
-    color: #000;
-}
-
-/* Content */
-#Content {
-    border-top: 4px solid #000;
-    padding: 1em 1.5em;
-    background-color: #fff;
-}
-
-/* Actions */
-#Actions {
-    height: 16pt;
-    list-style-type: none;
-    border-top: 1px solid #ccc;
-    border-bottom: 1px solid #ccc;
-    background-color: #f5f2ff;
-    margin: 0.5em 0;
-}
-
-#Actions li {
-    float: left;
-    border-right: 1px solid #ccc;
-    padding: 0 1.5em;
-    height: 16pt;
-    line-height: 16pt;
-    font-size: 8pt;
-    font-weight: bold;
-}
-
-#Actions li.last {
-    border-right: 0;
-}
-
-#Actions li a {
-    color: #6b6b70;
-}
-
-#Actions li a:hover {
-    color: #000;
-}
-
-/* Tree */
-#Tree {
-    list-style-type: none;
-    margin-bottom: 3em;
-}
-
-#Root,
-#Tree li {
-    border-radius: 0.4em;
-    -moz-border-radius: 0.4em;
-    background-color: #f0f0f0;
-    margin: 0.4em 0;
-    border: 1px solid #ccc;
-    padding: 0 0.6em;
-    line-height: 22pt;
-    font-size: 14pt;
-}
-
-#Root {
-    margin-top: 1.5em;
-    margin-bottom: 0.4em;
-}
-
-#Root .info,
-#Tree .info {
-    float: right;
-    font-size: 10pt;
-}
-
-#Root .info a,
-#Root .info span.delete,
-#Tree .info a {
-    font-weight: bold;
-    margin: 0 0 0 1.5em;
-    color: #000;
-}
-
-#Root .info .delete,
-#Tree .info .delete {
-    color: #b02d0e;
-}
-
-#Root .info span.delete {
-    color: #f0f0f0;
-}
-
-#Tree.ordering {
-}
-
-#Tree.ordering .info a {
-    visibility: hidden;
-}
-
-#Tree.ordering li {
-    background-color: #e2e2ec;
-    background-color: #dadada;
-    border: 1px solid #888;
-    cursor: move;
-}
-
-#OrderButtons {
-    margin-top: -1.0em;
-    margin-bottom: 2.0em;
-}
-
-#OrderButtons button {
-    padding: 0.2em 0.5em;
-}
-
-#OrderButtons {
-    margin-left: 3em;
-    padding: 0.3em 0.5em;
-    font-weight: bold;
-    border-top: 1px solid #ccc;
-    border-bottom: 1px solid #ccc;
-    background-color: #f5f2ff;
-}
-
-#SaveOrder {
-    font-weight: bold;
-}
-
-#Messages {
-    list-style-type: none;
-    padding-top: 1em;
-    margin-bottom: -0.5em;
-}
-
-#Messages li.error {
-    border: 1px solid #b40808;
-    padding: 0.3em;
-    font-size: 10pt;
-    background-color: #ffe9e4;
-    color: #940707;
-    font-weight: bold;
-}
-
-/* Forms */
-form {
-    padding-bottom: 2.5em;
-}
-#ReorderForm {
-    padding: 0;
-}
-
-fieldset {
-    border: 1px solid #ccc;
-    margin: 1.0em 0;
-    background-color: #f5f2ff;
-    padding: 0.5em 4.0em 1.5em 2.0em;
-}
-
-legend {
-    font-weight: bold;
-    font-size: 12pt;
-    padding: 0.2em 1em;
-    border: 1px solid #ccc;
-    background-color: #f0f0f0;
-}
-
-fieldset,
-legend {
-    -moz-border-radius: 0.4em;
-    border-radius: 0.4em;
-}
-
-label {
-    font-weight: bold;
-    display: block;
-    font-size: 11pt;
-    padding-bottom: 0.1em;
-}
-
-
-#ContentInfo input[type=text],
-#ContentInfo textarea,
-#PageInfo input[type=text],
-#PageInfo textarea {
-    border: 1px solid #aaa;
-    background-color: #f8f8f8;
-    padding: 0.2em;
-}
-
-#ContentInfo input[type=text],
-#ContentInfo select,
-#ContentInfo textarea,
-#PageInfo input[type=text],
-#PageInfo select,
-#PageInfo textarea {
-    width: 100%;
-}
-
-#ContentInfo input[type=text]:focus,
-#ContentInfo textarea:focus,
-#PageInfo input[type=text]:focus,
-#PageInfo textarea:focus {
-    background-color: #fff;
-    border: 1px solid #000;
-}
-
-.mooeditable-container select {
-    width: auto!important;
-}
-
-.mooeditable-container input {
-    font-size: small!important;
-    width: auto!important;
-}
-
-.mooeditable-container table {
-    border: 1px solid #000;
-}
-
-#ContentInfo input[type=text],
-#PageInfo input[type=text] {
-}
-
-#PageInfo textarea {
-    height: 8em;
-}
-
-#ContentInfo textarea {
-    height: 25em;
-}
-
-form input[type=submit] {
-    font-size: 16pt;
-}
-
-form p {
-    margin: 1.0em 0;
-}
-
-form ul.errorlist {
-    padding: 0;
-    margin: 0 0 -1.0em 0;
-}
-
-form ul.errorlist li {
-    font-size: 10pt;
-    color: #940707;
-    font-weight: bold;
-}
-
-.to-wysiwyg,
-.picasa-trigger {
-    cursor: pointer;
-    display: block;
-    float: right;
-    font-size: 10pt;
-}
-
-.mooeditable-container iframe {
-    background-color: #fff;
-}
-
-.mooeditable-container .picasa-trigger {
-    float: none;
-    display: inline;
-    font-weight: normal;
-}
-
-.mooeditable-container {
-    border-width: 1px!important;
-}
-
-.picasa-back {
-    width: 100%;
-    height: 100%;
-    position: fixed;
-    top: 0;
-    left: 0;
-    background-color: #000;
-    z-index: 101;
-}
-
-.picasa-wait {
-    width: 100%;
-    height: 100%;
-    background: transparent url('../img/loader.gif') no-repeat center center;
-}
-
-.picasa-window {
-    width: 40em;
-    height: 30em;
-    margin: -20em 0 0 -15em;
-    padding: 2.0em;
-    border: 2px solid #000;
-    left: 50%;
-    top: 50%;
-    background-color: #fff;
-    position: fixed;
-    z-index: 102;
-    overflow: auto;
-}
-
-.picasa-window img {
-    border: 1px solid #aaa;
-}
-
-.picasa-window div.gallery-holder {
-    padding: 1em;
-    background-color: #efefef;
-    border: 1px solid #aaa;
-    margin-bottom: 1em;
-    cursor: pointer;
-}
-
-.picasa-window div.gallery-holder:hover {
-    background-color: #e0e0e0;
-}
-
-.picasa-window div.gallery-holder h2 {
-    font-size: 16pt;
-    margin: 0 0 0.2em 0;
-}
-
-.picasa-window div.gallery-holder img {
-}
-
-.picasa-window div.image-holder {
-    border: 1px solid #aaa;
-    overflow: hidden;
-    background-color: #efefef;
-    text-align: center;
-    width: 164px;
-    height: 164px;
-    margin: 0.5em;
-    float: left;
-    cursor: pointer;
-}
-
-.picasa-window div.image-holder:hover {
-    background-color: #e0e0e0;
-}
-
-.picasa-window div.image-holder img {
-}
-
-.picasa-window div.image-holder h3 {
-    margin: 0.1em 0 0.2em 0;
-    padding: 0;
-    font-size: 8pt;
-    font-weight: normal;
-}
-

dproject/eag-static/img/loader.gif

Removed
Old image

dproject/eag-static/js/content.js

-window.addEvent('domready', function () {
-    var mooEditableOptions = {
-        'actions': 'bold italic underline strikethrough | '
-            + 'insertunorderedlist insertorderedlist indent outdent | '
-            + 'undo redo | createlink unlink | urlimage | forecolor | '
-            + 'toggleview | formatBlock justifyleft justifyright '
-            + 'justifycenter justifyfull | '
-            + 'tableadd tableedit tablerowadd tablerowedit tablerowspan '
-            + 'tablerowsplit tablerowdelete tablecoladd tablecoledit '
-            + 'tablecolspan tablecolsplit tablecoldelete ',
-        'externalCSS': MEDIA_URL + 'eag-static/css/MooEditable/Editable.css'
-    };
-
-    function newMooWYSIWYG(textarea) {
-        var mooEdit = new MooEditable(textarea, mooEditableOptions);
-        new PicasaChoiceField(mooEdit.dialogs.urlimage.prompt.el.getElement('input'));
-    };
-
-    $('ContentInfo').getElements('textarea.semi-wysiwyg').each(function (textarea) {
-        var button = new Element('a', {'text': 'to wysiwyg', 'class': 'to-wysiwyg'})
-            .inject(textarea, 'after')
-            .addEvent('click', function (e) {
-                e.preventDefault();
-                this.dispose();
-                newMooWYSIWYG(textarea);
-                textarea.focus();
-            });
-    });
-
-    $('ContentInfo').getElements('textarea.wysiwyg').each(function (textarea) {
-        newMooWYSIWYG(textarea);
-    });
-
-    makePicasaChoiceFields('input.picasa');
-});
-

dproject/eag-static/js/mooeditable.js

-/*
----
-
-script: MooEditable.js
-
-description: Class for creating a WYSIWYG editor, for contentEditable-capable browsers.
-
-license: MIT-style license
-
-authors:
-- Lim Chee Aun
-- Radovan Lozej
-- Ryan Mitchell
-- Olivier Refalo
-- T.J. Leahy
-
-requires:
-  core/1.2.4:
-  - Events
-  - Options
-  - Element.Event
-  - Element.Style
-  - Element.Dimensions
-  - Selectors
-
-inspiration:
-- Code inspired by Stefan's work [Safari Supports Content Editing!](http://www.xs4all.nl/~hhijdra/stefan/ContentEditable.html) from [safari gets contentEditable](http://walkah.net/blog/walkah/safari-gets-contenteditable)
-- Main reference from Peter-Paul Koch's [execCommand compatibility](http://www.quirksmode.org/dom/execCommand.html)
-- Some ideas and code inspired by [TinyMCE](http://tinymce.moxiecode.com/)
-- Some functions inspired by Inviz's [Most tiny wysiwyg you ever seen](http://forum.mootools.net/viewtopic.php?id=746), [mooWyg (Most tiny WYSIWYG 2.0)](http://forum.mootools.net/viewtopic.php?id=5740)
-- Some regex from Cameron Adams's [widgEditor](http://widgeditor.googlecode.com/)
-- Some code from Juan M Martinez's [jwysiwyg](http://jwysiwyg.googlecode.com/)
-- Some reference from MoxieForge's [PunyMCE](http://punymce.googlecode.com/)
-- IE support referring Robert Bredlau's [Rich Text Editing](http://www.rbredlau.com/drupal/node/6)
-- Tango icons from the [Tango Desktop Project](http://tango.freedesktop.org/)
-- Additional Tango icons from Jimmacs' [Tango OpenOffice](http://www.gnome-look.org/content/show.php/Tango+OpenOffice?content=54799)
-
-provides: [MooEditable, MooEditable.Selection, MooEditable.UI, MooEditable.Actions]
-
-...
-*/
-(function(){var a=/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD)$/i;var b=/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i;this.MooEditable=new Class({Implements:[Events,Options],options:{toolbar:true,cleanup:true,paragraphise:true,xhtml:true,semantics:true,actions:"bold italic underline strikethrough | insertunorderedlist insertorderedlist indent outdent | undo redo | createlink unlink | urlimage | toggleview",handleSubmit:true,handleLabel:true,baseCSS:"html{ height: 100%; cursor: text; } body{ font-family: sans-serif; }",extraCSS:"",externalCSS:"",html:'<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><style>{BASECSS} {EXTRACSS}</style>{EXTERNALCSS}</head><body>{CONTENT}</body></html>',rootElement:"p"},initialize:function(d,c){this.setOptions(c);this.textarea=document.id(d);this.textarea.store("MooEditable",this);this.actions=this.options.actions.clean().split(" ");this.keys={};this.dialogs={};this.actions.each(function(g){var e=MooEditable.Actions[g];if(!e){return}if(e.options){var f=e.options.shortcut;if(f){this.keys[f]=g}}if(e.dialogs){$each(e.dialogs,function(j,h){j=j.attempt(this);j.name=g+":"+h;if($type(this.dialogs[g])!="object"){this.dialogs[g]={}}this.dialogs[g][h]=j},this)}if(e.events){$each(e.events,function(h,j){this.addEvent(j,h)},this)}}.bind(this));this.render()},toElement:function(){return this.textarea},render:function(){var c=this;var d=this.textarea.getSize();this.container=new Element("div",{id:(this.textarea.id)?this.textarea.id+"-mooeditable-container":null,"class":"mooeditable-container",styles:{width:d.x}});this.textarea.addClass("mooeditable-textarea").setStyle("height",d.y);this.iframe=new IFrame({"class":"mooeditable-iframe",frameBorder:0,src:'javascript:""',styles:{height:d.y}});this.toolbar=new MooEditable.UI.Toolbar({onItemAction:function(){var e=$splat(arguments);var f=e[0];c.action(f.name,e)}});this.attach.delay(1,this);if(this.options.handleLabel&&this.textarea.id){$$('label[for="'+this.textarea.id+'"]').addEvent("click",function(f){if(c.mode!="iframe"){return}f.preventDefault();c.focus()})}if(this.options.handleSubmit){this.form=this.textarea.getParent("form");if(!this.form){return}this.form.addEvent("submit",function(){if(c.mode=="iframe"){c.saveContent()}})}this.fireEvent("render",this)},attach:function(){var c=this;this.mode="iframe";this.editorDisabled=false;this.container.wraps(this.textarea);this.textarea.setStyle("display","none");this.iframe.setStyle("display","").inject(this.textarea,"before");$each(this.dialogs,function(g,f){$each(g,function(j){document.id(j).inject(c.iframe,"before");var h;j.addEvents({open:function(){h=c.selection.getRange();c.editorDisabled=true;c.toolbar.disable(f);c.fireEvent("dialogOpen",this)},close:function(){c.toolbar.enable();c.editorDisabled=false;c.focus();if(h){c.selection.setRange(h)}c.fireEvent("dialogClose",this)}})})});this.win=this.iframe.contentWindow;this.doc=this.win.document;var e=this.options.html.substitute({BASECSS:this.options.baseCSS,EXTRACSS:this.options.extraCSS,EXTERNALCSS:(this.options.externalCSS)?'<link rel="stylesheet" href="'+this.options.externalCSS+'">':"",CONTENT:this.cleanup(this.textarea.get("value"))});this.doc.open();this.doc.write(e);this.doc.close();(Browser.Engine.trident)?this.doc.body.contentEditable=true:this.doc.designMode="On";if(!this.win.$family){new Window(this.win)}if(!this.doc.$family){new Document(this.doc)}document.id(this.doc.body);this.doc.addEvents({mouseup:this.editorMouseUp.bind(this),mousedown:this.editorMouseDown.bind(this),mouseover:this.editorMouseOver.bind(this),mouseout:this.editorMouseOut.bind(this),mouseenter:this.editorMouseEnter.bind(this),mouseleave:this.editorMouseLeave.bind(this),contextmenu:this.editorContextMenu.bind(this),click:this.editorClick.bind(this),dbllick:this.editorDoubleClick.bind(this),keypress:this.editorKeyPress.bind(this),keyup:this.editorKeyUp.bind(this),keydown:this.editorKeyDown.bind(this),focus:this.editorFocus.bind(this),blur:this.editorBlur.bind(this)});this.win.addEvents({focus:this.editorFocus.bind(this),blur:this.editorBlur.bind(this)});["cut","copy","paste"].each(function(f){c.doc.body.addListener(f,c["editor"+f.capitalize()].bind(c))});this.textarea.addEvent("keypress",this.textarea.retrieve("mooeditable:textareaKeyListener",this.keyListener.bind(this)));if(Browser.Engine.gecko&&Browser.Engine.version==18){this.doc.addEvent("focus",function(){c.win.fireEvent("focus").focus()})}if(!(/trident|presto/i).test(Browser.Engine.name)){var d=function(){c.execute("styleWithCSS",false,false);c.doc.removeEvent("focus",d)};this.win.addEvent("focus",d)}if(this.options.toolbar){document.id(this.toolbar).inject(this.container,"top");this.toolbar.render(this.actions)}this.selection=new MooEditable.Selection(this.win);this.oldContent=this.getContent();this.fireEvent("attach",this);return this},detach:function(){this.saveContent();this.textarea.setStyle("display","").removeClass("mooeditable-textarea").inject(this.container,"before");this.textarea.removeEvent("keypress",this.textarea.retrieve("mooeditable:textareaKeyListener"));this.container.dispose();this.fireEvent("detach",this);return this},editorFocus:function(c){this.oldContent="";this.fireEvent("editorFocus",[c,this])},editorBlur:function(c){this.oldContent=this.saveContent().getContent();this.fireEvent("editorBlur",[c,this])},editorMouseUp:function(c){if(this.editorDisabled){c.stop();return}if(this.options.toolbar){this.checkStates()}this.fireEvent("editorMouseUp",[c,this])},editorMouseDown:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorMouseDown",[c,this])},editorMouseOver:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorMouseOver",[c,this])},editorMouseOut:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorMouseOut",[c,this])},editorMouseEnter:function(c){if(this.editorDisabled){c.stop();return}if(this.oldContent&&this.getContent()!=this.oldContent){this.focus();this.fireEvent("editorPaste",[c,this])}this.fireEvent("editorMouseEnter",[c,this])},editorMouseLeave:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorMouseLeave",[c,this])},editorContextMenu:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorContextMenu",[c,this])},editorClick:function(d){if(Browser.Engine.webkit){var c=d.target;if(c.get("tag")=="img"){this.selection.selectNode(c)}}this.fireEvent("editorClick",[d,this])},editorDoubleClick:function(c){this.fireEvent("editorDoubleClick",[c,this])},editorKeyPress:function(c){if(this.editorDisabled){c.stop();return}this.keyListener(c);this.fireEvent("editorKeyPress",[c,this])},editorKeyUp:function(d){if(this.editorDisabled){d.stop();return}var f=d.code;if(this.options.toolbar&&(/^enter|left|up|right|down|delete|backspace$/i.test(d.key)||(f>=33&&f<=36)||f==45||d.meta||d.control)){if(Browser.Engines.trident4){$clear(this.checkStatesDelay);this.checkStatesDelay=this.checkStates.delay(500,this)}else{this.checkStates()}}this.fireEvent("editorKeyUp",[d,this])},editorKeyDown:function(j){if(this.editorDisabled){j.stop();return}if(j.key=="enter"){if(this.options.paragraphise){if(j.shift&&Browser.Engine.webkit){var o=this.selection;var c=o.getRange();var n=this.doc.createElement("br");c.insertNode(n);c.setStartAfter(n);c.setEndAfter(n);o.setRange(c);if(o.getSelection().focusNode==n.previousSibling){var m=this.doc.createTextNode("\u00a0");var d=n.parentNode;var l=n.nextSibling;(l)?d.insertBefore(m,l):d.appendChild(m);o.selectNode(m);o.collapse(1)}this.win.scrollTo(0,Element.getOffsets(o.getRange().startContainer).y);j.preventDefault()}else{if(Browser.Engine.gecko||Browser.Engine.webkit){var g=this.selection.getNode();var f=g.getParents().include(g).some(function(e){return e.nodeName.test(a)});if(!f){this.execute("insertparagraph")}}}}else{if(Browser.Engine.trident){var c=this.selection.getRange();var g=this.selection.getNode();if(c&&g.get("tag")!="li"){this.selection.insertContent("<br>");this.selection.collapse(false)}j.preventDefault()}}}if(Browser.Engine.presto){var h=j.control||j.meta;if(h&&j.key=="x"){this.fireEvent("editorCut",[j,this])}else{if(h&&j.key=="c"){this.fireEvent("editorCopy",[j,this])}else{if((h&&j.key=="v")||(j.shift&&j.code==45)){this.fireEvent("editorPaste",[j,this])}}}}this.fireEvent("editorKeyDown",[j,this])},editorCut:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorCut",[c,this])},editorCopy:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorCopy",[c,this])},editorPaste:function(c){if(this.editorDisabled){c.stop();return}this.fireEvent("editorPaste",[c,this])},keyListener:function(f){var c=(Browser.Platform.mac)?f.meta:f.control;if(!c||!this.keys[f.key]){return}f.preventDefault();var d=this.toolbar.getItem(this.keys[f.key]);d.action(f)},focus:function(){(this.mode=="iframe"?this.win:this.textarea).focus();this.fireEvent("focus",this);return this},action:function(e,c){var d=MooEditable.Actions[e];if(d.command&&$type(d.command)=="function"){d.command.run(c,this)}else{this.focus();this.execute(e,false,c);if(this.mode=="iframe"){this.checkStates()}}},execute:function(e,d,c){if(this.busy){return}this.busy=true;this.doc.execCommand(e,d,c);this.saveContent();this.busy=false;return false},toggleView:function(){this.fireEvent("beforeToggleView",this);if(this.mode=="textarea"){this.mode="iframe";this.iframe.setStyle("display","");this.setContent(this.textarea.value);this.textarea.setStyle("display","none")}else{this.saveContent();this.mode="textarea";this.textarea.setStyle("display","");this.iframe.setStyle("display","none")}this.fireEvent("toggleView",this);this.focus.delay(10,this);return this},getContent:function(){return this.cleanup(this.doc.body.get("html"))},setContent:function(c){this.doc.body.set("html",this.ensureRootElement(c));return this},saveContent:function(){if(this.mode=="iframe"){this.textarea.set("value",this.ensureRootElement(this.getContent()))}return this},ensureRootElement:function(h){if(this.options.rootElement){var g=new Element("div",{html:h.trim()});var e=-1;var j=false;var l="";var f=g.childNodes.length;for(i=0;i<f;i++){var c=g.childNodes[i];var m=c.nodeName;if(!m.test(a)&&m!=="#comment"){if(m==="#text"){if(c.nodeValue.trim()){if(e<0){e=i}l+=c.nodeValue}}else{if(e<0){e=i}l+=new Element("div").adopt($(c).clone()).get("html")}}else{j=true}if(i==(f-1)){j=true}if(e>=0&&j){var d=new Element(this.options.rootElement,{html:l});g.replaceChild(d,g.childNodes[e]);for(k=e+1;k<i;k++){g.removeChild(g.childNodes[k]);f--;i--;k--}e=-1;j=false;l=""}}h=g.get("html").replace(/\n\n/g,"")}return h},checkStates:function(){var c=this.selection.getNode();if(!c){return}if($type(c)!="element"){return}this.actions.each(function(g){var l=this.toolbar.getItem(g);if(!l){return}l.deactivate();var m=MooEditable.Actions[g]["states"];if(!m){return}if($type(m)=="function"){m.attempt([document.id(c),l],this);return}try{if(this.doc.queryCommandState(g)){l.activate();return}}catch(j){}if(m.tags){var f=c;do{var o=f.tagName.toLowerCase();if(m.tags.contains(o)){l.activate(o);break}}while((f=Element.getParent(f))!=null)}if(m.css){var f=c;do{var n=false;for(var d in m.css){var h=m.css[d];if(Element.getStyle(f,d).contains(h)){l.activate(h);n=true}}if(n||f.tagName.test(a)){break}}while((f=Element.getParent(f))!=null)}}.bind(this))},cleanup:function(d){if(!this.options.cleanup){return d.trim()}do{var c=d;d=d.replace(/<br class\="webkit-block-placeholder">/gi,"<br />");d=d.replace(/<span class="Apple-style-span">(.*)<\/span>/gi,"$1");d=d.replace(/ class="Apple-style-span"/gi,"");d=d.replace(/<span style="">/gi,"");d=d.replace(/<p>\s*<br ?\/?>\s*<\/p>/gi,"<p>\u00a0</p>");d=d.replace(/<p>(&nbsp;|\s)*<\/p>/gi,"<p>\u00a0</p>");if(!this.options.semantics){d=d.replace(/\s*<br ?\/?>\s*<\/p>/gi,"</p>")}if(this.options.xhtml){d=d.replace(/<br>/gi,"<br />")}if(this.options.semantics){if(Browser.Engine.trident){d=d.replace(/<li>\s*<div>(.+?)<\/div><\/li>/g,"<li>$1</li>")}if(Browser.Engine.webkit){d=d.replace(/^([\w\s]+.*?)<div>/i,"<p>$1</p><div>");d=d.replace(/<div>(.+?)<\/div>/ig,"<p>$1</p>")}if(["gecko","presto","webkit"].contains(Browser.Engine.name)){d=d.replace(/<p>[\s\n]*(<(?:ul|ol)>.*?<\/(?:ul|ol)>)(.*?)<\/p>/ig,"$1<p>$2</p>");d=d.replace(/<\/(ol|ul)>\s*(?!<(?:p|ol|ul|img).*?>)((?:<[^>]*>)?\w.*)$/g,"</$1><p>$2</p>")}d=d.replace(/<br[^>]*><\/p>/g,"</p>");d=d.replace(/<p>\s*(<img[^>]+>)\s*<\/p>/ig,"$1\n");d=d.replace(/<p([^>]*)>(.*?)<\/p>(?!\n)/g,"<p$1>$2</p>\n");d=d.replace(/<\/(ul|ol|p)>(?!\n)/g,"</$1>\n");d=d.replace(/><li>/g,">\n\t<li>");d=d.replace(/([^\n])<\/(ol|ul)>/g,"$1\n</$2>");d=d.replace(/([^\n])<img/ig,"$1\n<img");d=d.replace(/^\s*$/g,"")}d=d.replace(/<br ?\/?>$/gi,"");d=d.replace(/^<br ?\/?>/gi,"");d=d.replace(/><br ?\/?>/gi,">");d=d.replace(/<br ?\/?>\s*<\/(h1|h2|h3|h4|h5|h6|li|p)/gi,"</$1");d=d.replace(/<span style="font-weight: bold;">(.*)<\/span>/gi,"<strong>$1</strong>");d=d.replace(/<span style="font-style: italic;">(.*)<\/span>/gi,"<em>$1</em>");d=d.replace(/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>");d=d.replace(/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,"<em>$1</em>");d=d.replace(/<u\b[^>]*>(.*?)<\/u[^>]*>/gi,'<span style="text-decoration: underline;">$1</span>');d=d.replace(/<strong><span style="font-weight: normal;">(.*)<\/span><\/strong>/gi,"$1");d=d.replace(/<em><span style="font-weight: normal;">(.*)<\/span><\/em>/gi,"$1");d=d.replace(/<span style="text-decoration: underline;"><span style="font-weight: normal;">(.*)<\/span><\/span>/gi,"$1");d=d.replace(/<strong style="font-weight: normal;">(.*)<\/strong>/gi,"$1");d=d.replace(/<em style="font-weight: normal;">(.*)<\/em>/gi,"$1");d=d.replace(/<[^> ]*/g,function(e){return e.toLowerCase()});d=d.replace(/<[^>]*>/g,function(e){e=e.replace(/ [^=]+=/g,function(f){return f.toLowerCase()});return e});d=d.replace(/<[^>]*>/g,function(e){e=e.replace(/( [^=]+=)([^"][^ >]*)/g,'$1"$2"');return e});if(this.options.xhtml){d=d.replace(/<img([^>]+)(\s*[^\/])>(<\/img>)*/gi,"<img$1$2 />")}d=d.replace(/<p>(?:\s*)<p>/g,"<p>");d=d.replace(/<\/p>\s*<\/p>/g,"</p>");d=d.replace(/<pre[^>]*>.*?<\/pre>/gi,function(e){return e.replace(/<br ?\/?>/gi,"\n")});d=d.trim()}while(d!=c);return d}});MooEditable.Selection=new Class({initialize:function(c){this.win=c},getSelection:function(){this.win.focus();return(this.win.getSelection)?this.win.getSelection():this.win.document.selection},getRange:function(){var c=this.getSelection();if(!c){return null}try{return c.rangeCount>0?c.getRangeAt(0):(c.createRange?c.createRange():null)}catch(d){return this.doc.body.createTextRange()}},setRange:function(c){if(c.select){$try(function(){c.select()})}else{var d=this.getSelection();if(d.addRange){d.removeAllRanges();d.addRange(c)}}},selectNode:function(e,f){var d=this.getRange();var c=this.getSelection();if(d.moveToElementText){$try(function(){d.moveToElementText(e);d.select()})}else{if(c.addRange){f?d.selectNodeContents(e):d.selectNode(e);c.removeAllRanges();c.addRange(d)}else{c.setBaseAndExtent(e,0,e,1)}}return e},isCollapsed:function(){var c=this.getRange();if(c.item){return false}return c.boundingWidth==0||this.getSelection().isCollapsed},collapse:function(c){var e=this.getRange();var d=this.getSelection();if(e.select){e.collapse(c);e.select()}else{c?d.collapseToStart():d.collapseToEnd()}},getContent:function(){var e=this.getRange();var c=new Element("body");if(this.isCollapsed()){return""}if(e.cloneContents){c.appendChild(e.cloneContents())}else{if($defined(e.item)||$defined(e.htmlText)){c.set("html",e.item?e.item(0).outerHTML:e.htmlText)}else{c.set("html",e.toString())}}var d=c.get("html");return d},getText:function(){var d=this.getRange();var c=this.getSelection();return this.isCollapsed()?"":d.text||(c.toString?c.toString():"")},getNode:function(){var d=this.getRange();if(!Browser.Engine.trident){var c=null;if(d){c=d.commonAncestorContainer;if(!d.collapsed){if(d.startContainer==d.endContainer){if(d.startOffset-d.endOffset<2){if(d.startContainer.hasChildNodes()){c=d.startContainer.childNodes[d.startOffset]}}}}while($type(c)!="element"){c=c.parentNode}}return document.id(c)}return document.id(d.item?d.item(0):d.parentElement())},insertContent:function(d){if(Browser.Engine.trident){var c=this.getRange();c.pasteHTML(d);c.collapse(false);c.select()}else{this.win.document.execCommand("insertHTML",false,d)}}});MooEditable.UI={};MooEditable.UI.Toolbar=new Class({Implements:[Events,Options],options:{"class":""},initialize:function(c){this.setOptions(c);this.el=new Element("div",{"class":"mooeditable-ui-toolbar "+this.options["class"]});this.items={};this.content=null},toElement:function(){return this.el},render:function(c){if(this.content){this.el.adopt(this.content)}else{this.content=c.map(function(d){return(d=="|")?this.addSeparator():this.addItem(d)}.bind(this))}return this},addItem:function(h){var d=this;var c=MooEditable.Actions[h];if(!c){return}var f=c.type||"button";var e=c.options||{};var g=new MooEditable.UI[f.camelCase().capitalize()]($extend(e,{name:h,"class":h+"-item toolbar-item",title:c.title,onAction:d.itemAction.bind(d)}));this.items[h]=g;document.id(g).inject(this.el);return g},getItem:function(c){return this.items[c]},addSeparator:function(){return new Element("span",{"class":"toolbar-separator"}).inject(this.el)},itemAction:function(){this.fireEvent("itemAction",arguments)},disable:function(c){$each(this.items,function(d){(d.name==c)?d.activate():d.deactivate().disable()});return this},enable:function(){$each(this.items,function(c){c.enable()});return this},show:function(){this.el.setStyle("display","");return this},hide:function(){this.el.setStyle("display","none");return this}});MooEditable.UI.Button=new Class({Implements:[Events,Options],options:{title:"",name:"",text:"Button","class":"",shortcut:"",mode:"icon"},initialize:function(c){this.setOptions(c);this.name=this.options.name;this.render()},toElement:function(){return this.el},render:function(){var d=this;var e=(Browser.Platform.mac)?"Cmd":"Ctrl";var c=(this.options.shortcut)?" ( "+e+"+"+this.options.shortcut.toUpperCase()+" )":"";var g=this.options.title||name;var f=g+c;this.el=new Element("button",{"class":"mooeditable-ui-button "+d.options["class"],title:f,html:'<span class="button-icon"></span><span class="button-text">'+g+"</span>",events:{click:d.click.bind(d),mousedown:function(h){h.preventDefault()}}});if(this.options.mode!="icon"){this.el.addClass("mooeditable-ui-button-"+this.options.mode)}this.active=false;this.disabled=false;if(Browser.Engine.trident){this.el.addEvents({mouseenter:function(h){this.addClass("hover")},mouseleave:function(h){this.removeClass("hover")}})}return this},click:function(c){c.preventDefault();if(this.disabled){return}this.action(c)},action:function(){this.fireEvent("action",[this].concat($A(arguments)))},enable:function(){if(this.active){this.el.removeClass("onActive")}if(!this.disabled){return}this.disabled=false;this.el.removeClass("disabled").set({disabled:false,opacity:1});return this},disable:function(){if(this.disabled){return}this.disabled=true;this.el.addClass("disabled").set({disabled:true,opacity:0.4});return this},activate:function(){if(this.disabled){return}this.active=true;this.el.addClass("onActive");return this},deactivate:function(){this.active=false;this.el.removeClass("onActive");return this}});MooEditable.UI.Dialog=new Class({Implements:[Events,Options],options:{"class":"",contentClass:""},initialize:function(e,d){this.setOptions(d);this.html=e;var c=this;this.el=new Element("div",{"class":"mooeditable-ui-dialog "+c.options["class"],html:'<div class="dialog-content '+c.options.contentClass+'">'+e+"</div>",styles:{display:"none"},events:{click:c.click.bind(c)}})},toElement:function(){return this.el},click:function(){this.fireEvent("click",arguments);return this},open:function(){this.el.setStyle("display","");this.fireEvent("open",this);return this},close:function(){this.el.setStyle("display","none");this.fireEvent("close",this);return this}});MooEditable.UI.AlertDialog=function(d){if(!d){return}var c=d+' <button class="dialog-ok-button">OK</button>';return new MooEditable.UI.Dialog(c,{"class":"mooeditable-alert-dialog",onOpen:function(){var e=this.el.getElement(".dialog-ok-button");(function(){e.focus()}).delay(10)},onClick:function(f){f.preventDefault();if(f.target.tagName.toLowerCase()!="button"){return}if(document.id(f.target).hasClass("dialog-ok-button")){this.close()}}})};MooEditable.UI.PromptDialog=function(e,f,d){if(!e){return}var c='<label class="dialog-label">'+e+' <input type="text" class="text dialog-input" value="'+f+'"></label> <button class="dialog-button dialog-ok-button">OK</button><button class="dialog-button dialog-cancel-button">Cancel</button>';return new MooEditable.UI.Dialog(c,{"class":"mooeditable-prompt-dialog",onOpen:function(){var g=this.el.getElement(".dialog-input");(function(){g.focus();g.select()}).delay(10)},onClick:function(l){l.preventDefault();if(l.target.tagName.toLowerCase()!="button"){return}var h=document.id(l.target);var g=this.el.getElement(".dialog-input");if(h.hasClass("dialog-cancel-button")){g.set("value",f);this.close()}else{if(h.hasClass("dialog-ok-button")){var j=g.get("value");g.set("value",f);this.close();if(d){d.attempt(j,this)}}}}})};MooEditable.Actions=new Hash({bold:{title:"Bold",options:{shortcut:"b"},states:{tags:["b","strong"],css:{"font-weight":"bold"}},events:{beforeToggleView:function(){if(Browser.Engine.gecko){var c=this.textarea.get("value").replace(/<strong([^>]*)>/gi,"<b$1>").replace(/<\/strong>/gi,"</b>");this.textarea.set("value",c)}},attach:function(){if(Browser.Engine.gecko){var c=this.textarea.get("value").replace(/<strong([^>]*)>/gi,"<b$1>").replace(/<\/strong>/gi,"</b>");this.textarea.set("value",c);this.setContent(c)}}}},italic:{title:"Italic",options:{shortcut:"i"},states:{tags:["i","em"],css:{"font-style":"italic"}},events:{beforeToggleView:function(){if(Browser.Engine.gecko){var c=this.textarea.get("value").replace(/<embed([^>]*)>/gi,"<tmpembed$1>").replace(/<em([^>]*)>/gi,"<i$1>").replace(/<tmpembed([^>]*)>/gi,"<embed$1>").replace(/<\/em>/gi,"</i>");this.textarea.set("value",c)}},attach:function(){if(Browser.Engine.gecko){var c=this.textarea.get("value").replace(/<embed([^>]*)>/gi,"<tmpembed$1>").replace(/<em([^>]*)>/gi,"<i$1>").replace(/<tmpembed([^>]*)>/gi,"<embed$1>").replace(/<\/em>/gi,"</i>");this.textarea.set("value",c);this.setContent(c)}}}},underline:{title:"Underline",options:{shortcut:"u"},states:{tags:["u"],css:{"text-decoration":"underline"}}},strikethrough:{title:"Strikethrough",options:{shortcut:"s"},states:{tags:["s","strike"],css:{"text-decoration":"line-through"}}},insertunorderedlist:{title:"Unordered List",states:{tags:["ul"]}},insertorderedlist:{title:"Ordered List",states:{tags:["ol"]}},indent:{title:"Indent",states:{tags:["blockquote"]}},outdent:{title:"Outdent"},undo:{title:"Undo",options:{shortcut:"z"}},redo:{title:"Redo",options:{shortcut:"y"}},unlink:{title:"Remove Hyperlink"},createlink:{title:"Add Hyperlink",options:{shortcut:"l"},states:{tags:["a"]},dialogs:{alert:MooEditable.UI.AlertDialog.pass("Please select the text you wish to hyperlink."),prompt:function(c){return MooEditable.UI.PromptDialog("Enter URL","http://",function(d){c.execute("createlink",false,d.trim())})}},command:function(){if(this.selection.isCollapsed()){this.dialogs.createlink.alert.open()}else{var d=this.selection.getText();var c=this.dialogs.createlink.prompt;if(b.test(d)){c.el.getElement(".dialog-input").set("value",d)}c.open()}}},urlimage:{title:"Add Image",options:{shortcut:"m"},dialogs:{prompt:function(c){return MooEditable.UI.PromptDialog("Enter image URL","http://",function(d){c.execute("insertimage",false,d.trim())})}},command:function(){this.dialogs.urlimage.prompt.open()}},toggleview:{title:"Toggle View",command:function(){(this.mode=="textarea")?this.toolbar.enable():this.toolbar.disable("toggleview");this.toggleView()}}});MooEditable.Actions.Settings={};Element.Properties.mooeditable={set:function(c){return this.eliminate("mooeditable").store("mooeditable:options",c)},get:function(c){if(c||!this.retrieve("mooeditable")){if(c||!this.retrieve("mooeditable:options")){this.set("mooeditable",c)}this.store("mooeditable",new MooEditable(this,this.retrieve("mooeditable:options")))}return this.retrieve("mooeditable")}};Element.implement({mooEditable:function(c){return this.get("mooeditable",c)}})})();MooEditable.Actions.Settings.charmap={chars:[["&nbsp;","&#160;"],["&amp;","&#38;"],["&quot;","&#34;"],["&cent;","&#162;"],["&euro;","&#8364;"],["&pound;","&#163;"],["&yen;","&#165;"],["&copy;","&#169;"],["&reg;","&#174;"],["&trade;","&#8482;"],["&permil;","&#8240;"],["&micro;","&#181;"],["&middot;","&#183;"],["&bull;","&#8226;"],["&hellip;","&#8230;"],["&prime;","&#8242;"],["&Prime;","&#8243;"],["&sect;","&#167;"],["&para;","&#182;"],["&szlig;","&#223;"],["&lsaquo;","&#8249;"],["&rsaquo;","&#8250;"],["&laquo;","&#171;"],["&raquo;","&#187;"],["&lsquo;","&#8216;"],["&rsquo;","&#8217;"],["&ldquo;","&#8220;"],["&rdquo;","&#8221;"],["&sbquo;","&#8218;"],["&bdquo;","&#8222;"],["&lt;","&#60;"],["&gt;","&#62;"],["&le;","&#8804;"],["&ge;","&#8805;"],["&ndash;","&#8211;"],["&mdash;","&#8212;"],["&macr;","&#175;"],["&oline;","&#8254;"],["&curren;","&#164;"],["&brvbar;","&#166;"],["&uml;","&#168;"],["&iexcl;","&#161;"],["&iquest;","&#191;"],["&circ;","&#710;"],["&tilde;","&#732;"],["&deg;","&#176;"],["&minus;","&#8722;"],["&plusmn;","&#177;"],["&divide;","&#247;"],["&frasl;","&#8260;"],["&times;","&#215;"],["&sup1;","&#185;"],["&sup2;","&#178;"],["&sup3;","&#179;"],["&frac14;","&#188;"],["&frac12;","&#189;"],["&frac34;","&#190;"],["&fnof;","&#402;"],["&int;","&#8747;"],["&sum;","&#8721;"],["&infin;","&#8734;"],["&radic;","&#8730;"],["&sim;","&#8764;"],["&cong;","&#8773;"],["&asymp;","&#8776;"],["&ne;","&#8800;"],["&equiv;","&#8801;"],["&isin;","&#8712;"],["&notin;","&#8713;"],["&ni;","&#8715;"],["&prod;","&#8719;"],["&and;","&#8743;"],["&or;","&#8744;"],["&not;","&#172;"],["&cap;","&#8745;"],["&cup;","&#8746;"],["&part;","&#8706;"],["&forall;","&#8704;"],["&exist;","&#8707;"],["&empty;","&#8709;"],["&nabla;","&#8711;"],["&lowast;","&#8727;"],["&prop;","&#8733;"],["&ang;","&#8736;"],["&acute;","&#180;"],["&cedil;","&#184;"],["&ordf;","&#170;"],["&ordm;","&#186;"],["&dagger;","&#8224;"],["&Dagger;","&#8225;"],["&Agrave;","&#192;"],["&Aacute;","&#193;"],["&Acirc;","&#194;"],["&Atilde;","&#195;"],["&Auml;","&#196;"],["&Aring;","&#197;"],["&AElig;","&#198;"],["&Ccedil;","&#199;"],["&Egrave;","&#200;"],["&Eacute;","&#201;"],["&Ecirc;","&#202;"],["&Euml;","&#203;"],["&Igrave;","&#204;"],["&Iacute;","&#205;"],["&Icirc;","&#206;"],["&Iuml;","&#207;"],["&ETH;","&#208;"],["&Ntilde;","&#209;"],["&Ograve;","&#210;"],["&Oacute;","&#211;"],["&Ocirc;","&#212;"],["&Otilde;","&#213;"],["&Ouml;","&#214;"],["&Oslash;","&#216;"],["&OElig;","&#338;"],["&Scaron;","&#352;"],["&Ugrave;","&#217;"],["&Uacute;","&#218;"],["&Ucirc;","&#219;"],["&Uuml;","&#220;"],["&Yacute;","&#221;"],["&Yuml;","&#376;"],["&THORN;","&#222;"],["&agrave;","&#224;"],["&aacute;","&#225;"],["&acirc;","&#226;"],["&atilde;","&#227;"],["&auml;","&#228;"],["&aring;","&#229;"],["&aelig;","&#230;"],["&ccedil;","&#231;"],["&egrave;","&#232;"],["&eacute;","&#233;"],["&ecirc;","&#234;"],["&euml;","&#235;"],["&igrave;","&#236;"],["&iacute;","&#237;"],["&icirc;","&#238;"],["&iuml;","&#239;"],["&eth;","&#240;"],["&ntilde;","&#241;"],["&ograve;","&#242;"],["&oacute;","&#243;"],["&ocirc;","&#244;"],["&otilde;","&#245;"],["&ouml;","&#246;"],["&oslash;","&#248;"],["&oelig;","&#339;"],["&scaron;","&#353;"],["&ugrave;","&#249;"],["&uacute;","&#250;"],["&ucirc;","&#251;"],["&uuml;","&#252;"],["&yacute;","&#253;"],["&thorn;","&#254;"],["&yuml;","&#255;"],["&Alpha;","&#913;"],["&Beta;","&#914;"],["&Gamma;","&#915;"],["&Delta;","&#916;"],["&Epsilon;","&#917;"],["&Zeta;","&#918;"],["&Eta;","&#919;"],["&Theta;","&#920;"],["&Iota;","&#921;"],["&Kappa;","&#922;"],["&Lambda;","&#923;"],["&Mu;","&#924;"],["&Nu;","&#925;"],["&Xi;","&#926;"],["&Omicron;","&#927;"],["&Pi;","&#928;"],["&Rho;","&#929;"],["&Sigma;","&#931;"],["&Tau;","&#932;"],["&Upsilon;","&#933;"],["&Phi;","&#934;"],["&Chi;","&#935;"],["&Psi;","&#936;"],["&Omega;","&#937;"],["&alpha;","&#945;"],["&beta;","&#946;"],["&gamma;","&#947;"],["&delta;","&#948;"],["&epsilon;","&#949;"],["&zeta;","&#950;"],["&eta;","&#951;"],["&theta;","&#952;"],["&iota;","&#953;"],["&kappa;","&#954;"],["&lambda;","&#955;"],["&mu;","&#956;"],["&nu;","&#957;"],["&xi;","&#958;"],["&omicron;","&#959;"],["&pi;","&#960;"],["&rho;","&#961;"],["&sigmaf;","&#962;"],["&sigma;","&#963;"],["&tau;","&#964;"],["&upsilon;","&#965;"],["&phi;","&#966;"],["&chi;","&#967;"],["&psi;","&#968;"],["&omega;","&#969;"],["&alefsym;","&#8501;"],["&piv;","&#982;"],["&real;","&#8476;"],["&thetasym;","&#977;"],["&upsih;","&#978;"],["&weierp;","&#8472;"],["&image;","&#8465;"],["&larr;","&#8592;"],["&uarr;","&#8593;"],["&rarr;","&#8594;"],["&darr;","&#8595;"],["&harr;","&#8596;"],["&crarr;","&#8629;"],["&lArr;","&#8656;"],["&uArr;","&#8657;"],["&rArr;","&#8658;"],["&dArr;","&#8659;"],["&hArr;","&#8660;"],["&there4;","&#8756;"],["&sub;","&#8834;"],["&sup;","&#8835;"],["&nsub;","&#8836;"],["&sube;","&#8838;"],["&supe;","&#8839;"],["&oplus;","&#8853;"],["&otimes;","&#8855;"],["&perp;","&#8869;"],["&sdot;","&#8901;"],["&lceil;","&#8968;"],["&rceil;","&#8969;"],["&lfloor;","&#8970;"],["&rfloor;","&#8971;"],["&lang;","&#9001;"],["&rang;","&#9002;"],["&loz;","&#9674;"],["&spades;","&#9824;"],["&clubs;","&#9827;"],["&hearts;","&#9829;"],["&diams;","&#9830;"]]};MooEditable.UI.CharacterDialog=function(d){var c='character <select class="char">';var e=MooEditable.Actions.Settings.charmap.chars;for(var b=0,a=e.length;b<a;b++){c+='<option data-code="'+e[b][0]+'">'+e[b][1]+"</option>"}c+='</select><button class="dialog-button dialog-ok-button">OK</button><button class="dialog-button dialog-cancel-button">Cancel</button>';return new MooEditable.UI.Dialog(c,{"class":"mooeditable-prompt-dialog",onClick:function(h){if(h.target.tagName.toLowerCase()=="button"){h.preventDefault()}var f=document.id(h.target);if(f.hasClass("dialog-cancel-button")){this.close()}else{if(f.hasClass("dialog-ok-button")){this.close();var g=f.getPrevious("select.char");var j=new Element("div").set("html",g.options[g.selectedIndex].getProperty("data-code").trim());d.selection.insertContent(j.get("html"))}}}})};MooEditable.Actions.extend({charmap:{title:"Insert custom character",dialogs:{prompt:function(a){return MooEditable.UI.CharacterDialog(a)}},command:function(){this.dialogs.charmap.prompt.open()},events:{toggleView:function(){if(this.mode=="textarea"){var a=this.textarea.get("value");MooEditable.Actions.Settings.charmap.chars.each(function(c){if(!["&amp;","&gt;","&lt;","&quot;","&nbsp;"].contains(c[0])){var b=new RegExp(String.fromCharCode(parseInt(c[1].replace("&#","").replace(";",""))),"g");a=a.replace(b,c[0])}},this);this.textarea.set("value",a)}}}}});MooEditable.UI.ButtonOverlay=new Class({Extends:MooEditable.UI.Button,options:{overlayHTML:"",overlayClass:"",overlaySize:{x:150,y:"auto"},overlayContentClass:""},initialize:function(a){this.parent(a);this.render();this.el.addClass("mooeditable-ui-buttonOverlay");this.renderOverlay(this.options.overlayHTML)},renderOverlay:function(b){var a=this;this.overlay=new Element("div",{"class":"mooeditable-ui-button-overlay "+a.name+"-overlay "+a.options.overlayClass,html:'<div class="overlay-content '+a.options.overlayContentClass+'">'+b+"</div>",tabindex:0,styles:{left:"-999em",position:"absolute",width:a.options.overlaySize.x,height:a.options.overlaySize.y},events:{mousedown:a.clickOverlay.bind(a),focus:a.openOverlay.bind(a),blur:a.closeOverlay.bind(a)}}).inject(document.body).store("MooEditable.UI.ButtonOverlay",this);this.overlayVisible=false},openOverlay:function(){if(this.overlayVisible){return}this.overlayVisible=true;this.activate();this.fireEvent("openOverlay",this);return this},closeOverlay:function(){if(!this.overlayVisible){return}this.overlay.setStyle("left","-999em");this.overlayVisible=false;this.deactivate();this.fireEvent("closeOverlay",this);return this},clickOverlay:function(a){if(a.target==this.overlay||a.target.parentNode==this.overlay){return}this.overlay.blur();a.preventDefault();this.action(a)},click:function(b){b.preventDefault();if(this.disabled){return}if(this.overlayVisible){this.overlay.blur();return}else{var a=this.el.getCoordinates();this.overlay.setStyles({top:a.bottom,left:a.left});this.overlay.focus()}}});MooEditable.Actions.Settings.forecolor={colors:[["000000","993300","333300","003300","003366","000077","333399","333333"],["770000","ff6600","777700","007700","007777","0000ff","666699","777777"],["ff0000","ff9900","99cc00","339966","33cccc","3366f0","770077","999999"],["ff00ff","ffcc00","ffff00","00ff00","00ffff","00ccff","993366","cccccc"],["ff99cc","ffcc99","ffff99","ccffcc","ccffff","99ccff","cc9977","ffffff"]]};MooEditable.Actions.forecolor={type:"button-overlay",title:"Change Color",options:{overlaySize:{x:"auto"},overlayHTML:(function(){var a="";MooEditable.Actions.Settings.forecolor.colors.each(function(b){b.each(function(d){a+='<a href="#" class="forecolor-colorpicker-color" style="background-color: #'+d+'" title="#'+d.toUpperCase()+'"></a>'});a+='<span class="forecolor-colorpicker-br"></span>'});return a})()},command:function(d,c){var b=c.target;if(b.tagName.toLowerCase()!="a"){return}var a=$(b).getStyle("background-color");this.execute("forecolor",false,a);this.focus()}};MooEditable.Actions.extend({formatBlock:{title:"Block Formatting",type:"menu-list",options:{list:[{text:"Paragraph",value:"p"},{text:"Heading 1",value:"h1",style:"font-size:24px; font-weight:bold;"},{text:"Heading 2",value:"h2",style:"font-size:18px; font-weight:bold;"},{text:"Heading 3",value:"h3",style:"font-size:14px; font-weight:bold;"}]},states:{tags:["p","h1","h2","h3"]},command:function(c,a){var b="<"+a+">";this.focus();this.execute("formatBlock",false,b)}},justifyleft:{title:"Align Left",states:{css:{"text-align":"left"}}},justifyright:{title:"Align Right",states:{css:{"text-align":"right"}}},justifycenter:{title:"Align Center",states:{tags:["center"],css:{"text-align":"center"}}},justifyfull:{title:"Align Justify",states:{css:{"text-align":"justify"}}},removeformat:{title:"Remove Formatting"},insertHorizontalRule:{title:"Insert Horizontal Rule",states:{tags:["hr"]},command:function(){this.selection.insertContent("<hr>")}}});MooEditable.Actions.Settings.smiley={imagesPath:"../../Assets/MooEditable/Smiley/",smileys:["angryface","blush","gasp","grin","halo","lipsaresealed","smile","undecided","wink"],fileExt:".png"};MooEditable.Actions.smiley={type:"button-overlay",title:"Insert Smiley",options:{overlaySize:{x:"auto"},overlayHTML:(function(){var b=MooEditable.Actions.Settings.smiley;var a="";b.smileys.each(function(c){a+='<img src="'+b.imagesPath+c+b.fileExt+'" alt="" class="smiley-image">'});return a})()},command:function(f,c){var a=c.target;if(a.tagName.toLowerCase()!="img"){return}var d=$(a).get("src");var b='<img style="border:0;" class="smiley" src="'+d+'" alt="">';this.focus();this.selection.insertContent(b)},events:{attach:function(a){if(Browser.Engine.trident){a.doc.addListener("controlselect",function(c){var b=c.target;if(b.tagName.toLowerCase()!="img"){return}if(!$(b).hasClass("smiley")){return}c.preventDefault()})}},editorMouseDown:function(d,c){var b=d.target;var a=(b.tagName.toLowerCase()=="img")&&$(b).hasClass("smiley");$try(function(){c.doc.execCommand("enableObjectResizing",false,!a)})}}};MooEditable.Group=new Class({Implements:[Options],options:{actions:"bold italic underline strikethrough | insertunorderedlist insertorderedlist indent outdent | undo redo | createlink unlink | urlimage | toggleview"},initialize:function(a,c){this.setOptions(c);this.actions=this.options.actions.clean().split(" ");var b=this;this.toolbar=new MooEditable.UI.Toolbar({onItemAction:function(){var d=$splat(arguments);var e=d[0];if(!b.activeEditor){return}b.activeEditor.focus();b.activeEditor.action(e.name,d);if(b.activeEditor.mode=="iframe"){b.activeEditor.checkStates()}}}).render(this.actions);document.id(a).adopt(this.toolbar)},add:function(a,b){return this.activeEditor=new MooEditable.Group.Item(a,this,$merge({toolbar:false},this.options,b))}});MooEditable.Group.Item=new Class({Extends:MooEditable,initialize:function(b,d,c){this.group=d;this.parent(b,c);var a=function(){this.group.activeEditor=this}.bind(this);this.textarea.addEvent("focus",a);this.win.addEvent("focus",a)}});MooEditable.UI.MenuList=new Class({Implements:[Events,Options],options:{title:"",name:"","class":"",list:[]},initialize:function(a){this.setOptions(a);this.name=this.options.name;this.render()},toElement:function(){return this.el},render:function(){var a=this;var b="";this.options.list.each(function(c){b+='<option value="{value}" style="{style}">{text}</option>'.substitute(c)});this.el=new Element("select",{"class":a.options["class"],title:a.options.title,html:b,styles:{height:"21px"},events:{change:a.change.bind(a)}});this.disabled=false;if(Browser.Engine.trident){this.el.addEvents({mouseenter:function(c){this.addClass("hover")},mouseleave:function(c){this.removeClass("hover")}})}return this},change:function(b){b.preventDefault();if(this.disabled){return}var a=b.target.value;this.action(a)},action:function(){this.fireEvent("action",[this].concat($A(arguments)))},enable:function(){if(!this.disabled){return}this.disabled=false;this.el.set("disabled",false).removeClass("disabled").set({disabled:false,opacity:1});return this},disable:function(){if(this.disabled){return}this.disabled=true;this.el.set("disabled",true).addClass("disabled").set({disabled:true,opacity:0.4});return this},activate:function(b){if(this.disabled){return}var a=0;if(b){this.options.list.each(function(d,c){if(d.value==b){a=c}})}this.el.selectedIndex=a;return this},deactivate:function(){this.el.selectedIndex=0;this.el.removeClass("onActive");return this}});MooEditable.UI.TableDialog=function(c,b){var a={tableadd:'columns <input type="text" class="table-c" value="" size="4" /> rows <input type="text" class="table-r" value="" size="4" /> ',tableedit:'width <input type="text" class="table-w" value="" size="4" /> class <input type="text" class="table-c" value="" size="15" /> ',tablerowedit:'class <input type="text" class="table-c" value="" size="15" /> type <select class="table-c-type"><option value="th">Header</option><option value="td">Cell</option></select> ',tablecoledit:'width <input type="text" class="table-w" value="" size="4" /> class <input type="text" class="table-c" value="" size="15" /> align <select class="table-a"><option>none</option><option>left</option><option>center</option><option>right</option></select> valign <select class="table-va"><option>none</option><option>top</option><option>middle</option><option>bottom</option></select> '};a[b]+='<button class="dialog-button dialog-ok-button">OK</button><button class="dialog-button dialog-cancel-button">Cancel</button>';var d={tableadd:{click:function(m){var h=this.el.getElement(".table-c").value.toInt();var p=this.el.getElement(".table-r").value.toInt();if(!(p>0&&h>0)){return}var g,o,j,l=[];g=new Element("tdiv");o=new Element("table").set("border",0).set("width","100%").inject(g);j=new Element("tbody").inject(o);for(var f=0;f<p;f++){l[f]=new Element("tr").inject(j,"bottom");for(var n=0;n<h;n++){new Element("td").set("html","&nbsp;").inject(l[f],"bottom")}}c.selection.insertContent(g.get("html"))}},tableedit:{load:function(g){var f=c.selection.getNode().getParent("table");this.el.getElement(".table-w").set("value",f.get("width"));this.el.getElement(".table-c").set("value",f.className)},click:function(g){var f=c.selection.getNode().getParent("table");f.set("width",this.el.getElement(".table-w").value);f.className=this.el.getElement(".table-c").value}},tablerowedit:{load:function(g){var f=c.selection.getNode().getParent("tr");this.el.getElement(".table-c").set("value",f.className);this.el.getElement(".table-c-type").set("value",c.selection.getNode().get("tag"))},click:function(g){var f=c.selection.getNode().getParent("tr");f.className=this.el.getElement(".table-c").value;f.getElements("td,th").each(function(h){if(this.el.getElement(".table-c-type")!=h.get("tag")){var e=c.doc.createElement(this.el.getElement(".table-c-type").get("value"));$(e).set("html",h.get("html")).replaces(h)}},this)}},tablecoledit:{load:function(g){var f=c.selection.getNode();if(f.get("tag")!="td"){f=f.getParent("td")}this.el.getElement(".table-w").set("value",f.get("width"));this.el.getElement(".table-c").set("value",f.className);this.el.getElement(".table-a").set("value",f.get("align"));this.el.getElement(".table-va").set("value",f.get("valign"))},click:function(g){var f=c.selection.getNode();if(f.get("tag")!="td"){f=f.getParent("td")}f.set("width",this.el.getElement(".table-w").value);f.className=this.el.getElement(".table-c").value;f.set("align",this.el.getElement(".table-a").value);f.set("valign",this.el.getElement(".table-va").value)}}};return new MooEditable.UI.Dialog(a[b],{"class":"mooeditable-prompt-dialog",onOpen:function(){if(d[b].load){d[b].load.apply(this)}var e=this.el.getElement("input");(function(){e.focus()}).delay(10)},onClick:function(g){if(g.target.tagName.toLowerCase()=="button"){g.preventDefault()}var f=document.id(g.target);if(f.hasClass("dialog-cancel-button")){this.close()}else{if(f.hasClass("dialog-ok-button")){this.close();d[b].click.apply(this)}}}})};MooEditable.Actions.extend({tableadd:{title:"Add Table",dialogs:{prompt:function(a){return MooEditable.UI.TableDialog(a,"tableadd")}},command:function(){this.dialogs.tableadd.prompt.open()}},tableedit:{title:"Edit Table",dialogs:{prompt:function(a){return MooEditable.UI.TableDialog(a,"tableedit")}},command:function(){if(this.selection.getNode().getParent("table")){this.dialogs.tableedit.prompt.open()}}},tablerowadd:{title:"Add Row",command:function(){var a=this.selection.getNode().getParent("tr");if(a){a.clone().inject(a,"after")}}},tablerowedit:{title:"Edit Row",dialogs:{prompt:function(a){return MooEditable.UI.TableDialog(a,"tablerowedit")}},command:function(){if(this.selection.getNode().getParent("table")){this.dialogs.tablerowedit.prompt.open()}}},tablerowspan:{title:"Merge Row",command:function(){var b=this.selection.getNode();if(b.get("tag")!="td"){b=b.getParent("td")}if(b){var a=b.cellIndex;var c=b.getParent().rowIndex;if(b.getParent().getParent().childNodes[c+b.rowSpan]){b.getParent().getParent().childNodes[c+b.rowSpan].deleteCell(a);b.rowSpan++}}}},tablerowsplit:{title:"Split Row",command:function(){var b=this.selection.getNode();if(b.get("tag")!="td"){b=b.getParent("td")}if(b){var a=b.cellIndex;var d=b.getParent().rowIndex;if(b.getProperty("rowspan")){var c=parseInt(b.getProperty("rowspan"));for(i=1;i<c;i++){b.getParent().getParent().childNodes[d+i].insertCell(a)}b.removeProperty("rowspan")}}},states:function(a){if(a.get("tag")!="td"){return}if(a){if(a.getProperty("rowspan")&&parseInt(a.getProperty("rowspan"))>1){this.el.addClass("onActive")}}}},tablerowdelete:{title:"Delete Row",command:function(){var a=this.selection.getNode().getParent("tr");if(a){a.getParent().deleteRow(a.rowIndex)}}},tablecoladd:{title:"Add Column",command:function(){var e=this.selection.getNode();if(e.get("tag")!="td"){e=e.getParent("td")}if(e){var b=e.cellIndex;var a=e.getParent().getParent().childNodes.length;for(var c=0;c<a;c++){var d=$(e.getParent().getParent().childNodes[c].childNodes[b]);d.clone().inject(d,"after")}}}},tablecoledit:{title:"Edit Column",dialogs:{prompt:function(a){return MooEditable.UI.TableDialog(a,"tablecoledit")}},command:function(){if(this.selection.getNode().getParent("table")){this.dialogs.tablecoledit.prompt.open()}}},tablecolspan:{title:"Merge Cell",command:function(){var b=this.selection.getNode();if(b.get("tag")!="td"){b=b.getParent("td")}if(b){var a=b.cellIndex+1;if(b.getParent().childNodes[a]){b.getParent().deleteCell(a);b.colSpan++}}}},tablecolsplit:{title:"Split Cell",command:function(){var b=this.selection.getNode();if(b.get("tag")!="td"){b=b.getParent("td")}if(b){var a=b.cellIndex+1;if(b.getProperty("colspan")){var c=parseInt(b.getProperty("colspan"));for(i=1;i<c;i++){b.getParent().insertCell(a+i)}b.removeProperty("colspan")}}},states:function(a){if(a.get("tag")!="td"){return}if(a){if(a.getProperty("colspan")&&parseInt(a.getProperty("colspan"))>1){this.el.addClass("onActive")}}}},tablecoldelete:{title:"Delete Column",command:function(){var e=this.selection.getNode();if(e.get("tag")!="td"){e=e.getParent("td")}if(e){var a=e.getParent().getParent().childNodes.length;var b=e.cellIndex;var d=e.getParent().getParent();for(var c=0;c<a;c++){d.childNodes[c].deleteCell(b)}}}}});MooEditable.Actions.Settings.pagebreak={imageFile:"../../Assets/MooEditable/Other/pagebreak.gif"};MooEditable.Actions.extend({pagebreak:{title:"Page break",command:function(){this.selection.insertContent('<img class="mooeditable-visual-aid mooeditable-pagebreak" />')},events:{beforeToggleView:function(){if(this.mode=="iframe"){var a=this.getContent().replace(/<img([^>]*)class="mooeditable-visual-aid mooeditable-pagebreak"([^>]*)>/gi,"<!-- page break -->");this.setContent(a)}else{var a=this.textarea.get("value").replace(/<!-- page break -->/gi,'<img class="mooeditable-visual-aid mooeditable-pagebreak" />');this.textarea.set("value",a)}},render:function(){this.options.extraCSS="img.mooeditable-pagebreak { display:block; width:100%; height:16px; background: url("+MooEditable.Actions.Settings.pagebreak.imageFile+") repeat-x; }"+this.options.extraCSS}}}});MooEditable.UI.FlashDialog=function(b){var a='embed <textarea class="dialog-f" value="" rows="2" cols="40" /></textarea> <button class="dialog-button dialog-ok-button">OK</button> <button class="dialog-button dialog-cancel-button">Cancel</button>';return new MooEditable.UI.Dialog(a,{"class":"mooeditable-prompt-dialog",onOpen:function(){var c=this.el.getElement(".dialog-f");(function(){c.focus();c.select()}).delay(10)},onClick:function(d){if(d.target.tagName.toLowerCase()=="button"){d.preventDefault()}var c=document.id(d.target);if(c.hasClass("dialog-cancel-button")){this.close()}else{if(c.hasClass("dialog-ok-button")){this.close();var f=new Element("div").set("html",this.el.getElement(".dialog-f").get("value").trim());b.selection.insertContent(f.get("html"))}}}})};MooEditable.Actions.extend({flash:{title:"Flash embed",dialogs:{prompt:function(a){return MooEditable.UI.FlashDialog(a)}},command:function(){this.dialogs.flash.prompt.open()}}});MooEditable.UI.ImageDialog=function(b){var a='url <input type="text" class="dialog-url" value="" size="15" /> alt <input type="text" class="dialog-alt" value="" size="8" /> class <input type="text" class="dialog-class" value="" size="8" /> align <select class="dialog-align"><option>none</option><option>left</option><option>center</option><option>right</option></select> <button class="dialog-button dialog-ok-button">OK</button> <button class="dialog-button dialog-cancel-button">Cancel</button>';return new MooEditable.UI.Dialog(a,{"class":"mooeditable-prompt-dialog",onOpen:function(){var c=this.el.getElement(".dialog-url");var d=b.selection.getNode();if(d.get("tag")=="img"){this.el.getElement(".dialog-url").set("value",d.get("src"));this.el.getElement(".dialog-alt").set("value",d.get("alt"));this.el.getElement(".dialog-class").set("value",d.className);this.el.getElement(".dialog-align").set("align",d.get("align"))}(function(){c.focus();c.select()}).delay(10)},onClick:function(f){if(f.target.tagName.toLowerCase()=="button"){f.preventDefault()}var c=document.id(f.target);if(c.hasClass("dialog-cancel-button")){this.close()}else{if(c.hasClass("dialog-ok-button")){this.close();var d=b.selection.getNode();if(d.get("tag")=="img"){d.set("src",this.el.getElement(".dialog-url").get("value").trim());d.set("alt",this.el.getElement(".dialog-alt").get("value").trim());d.className=this.el.getElement(".dialog-class").get("value").trim();d.set("align",this.el.getElement(".dialog-align").get("value"))}else{var g=new Element("div");new Element("img",{src:this.el.getElement(".dialog-url").get("value").trim(),alt:this.el.getElement(".dialog-alt").get("value").trim(),"class":this.el.getElement(".dialog-class").get("value").trim(),align:this.el.getElement(".dialog-align").get("value")}).inject(g);b.selection.insertContent(g.get("html"))}}}}})};MooEditable.Actions.extend({image:{title:"Add/Edit Image",options:{shortcut:"m"},dialogs:{prompt:function(a){return MooEditable.UI.ImageDialog(a)}},command:function(){this.dialogs.image.prompt.open()}}});

dproject/eag-static/js/mootools-1.2.4.2-more.js

-//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License.
-
-MooTools.More={version:"1.2.4.2",build:"bd5a93c0913cce25917c48cbdacde568e15e02ef"};var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});
-this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
-this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};
-this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
-return this;},start:function(c){if(c.rightClick){return;}if(this.options.preventDefault){c.preventDefault();}if(this.options.stopPropagation){c.stopPropagation();
-}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;
-}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();}else{this.value.now[d]=this.element[this.options.modifiers[d]];
-}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();
-}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});
-this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));
-if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);
-}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;
-}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;}if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];
-}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];}}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);
-}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);}else{this.element[this.options.modifiers[b]]=this.value.now[b];
-}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);
-if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);
-this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(a){this.fireEvent("complete",[this.element,a]);
-}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);
-}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);
-b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=document.id(this.container.getDocument().body);
-}var c=b.getStyles("left","right","position");if(c.left=="auto"||c.top=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()));}if(c.position=="static"){b.setStyle("position","absolute");
-}this.addEvent("start",this.checkDroppables,true);this.overed=null;},start:function(a){if(this.container){this.options.limit=this.calculateLimit();}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates();
-});}this.parent(a);},calculateLimit:function(){var d=this.element.getOffsetParent(),g=this.container.getCoordinates(d),f={},c={},b={},i={},k={};["top","right","bottom","left"].each(function(o){f[o]=this.container.getStyle("border-"+o).toInt();
-b[o]=this.element.getStyle("border-"+o).toInt();c[o]=this.element.getStyle("margin-"+o).toInt();i[o]=this.container.getStyle("margin-"+o).toInt();k[o]=d.getStyle("padding-"+o).toInt();
-},this);var e=this.element.offsetWidth+c.left+c.right,n=this.element.offsetHeight+c.top+c.bottom,h=0,j=0,m=g.right-f.right-e,a=g.bottom-f.bottom-n;if(this.options.includeMargins){h+=c.left;
-j+=c.top;}else{m+=c.right;a+=c.bottom;}if(this.element.getStyle("position")=="relative"){var l=this.element.getCoordinates(d);l.left-=this.element.getStyle("left").toInt();
-l.top-=this.element.getStyle("top").toInt();h+=f.left-l.left;j+=f.top-l.top;m+=c.left-l.left;a+=c.top-l.top;if(this.container!=d){h+=i.left+k.left;j+=(Browser.Engine.trident4?0:i.top)+k.top;
-}}else{h-=c.left;j-=c.top;if(this.container==d){m-=f.left;a-=f.top;}else{h+=g.left+f.left;j+=g.top+f.top;}}return{x:[h,m],y:[j,a]};},checkAgainst:function(c,b){c=(this.positions)?this.positions[b]:c.getCoordinates();
-var a=this.mouse.now;return(a.x>c.left&&a.x<c.right&&a.y<c.bottom&&a.y>c.top);},checkDroppables:function(){var a=this.droppables.filter(this.checkAgainst,this).getLast();
-if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);
-if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);
-this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);this.store("dragger",b);return b;}});
-var Sortables=new Class({Implements:[Events,Options],options:{snap:4,opacity:1,clone:false,revert:false,handle:false,constrain:false},initialize:function(a,b){this.setOptions(b);
-this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,$merge({duration:250,link:"cancel"},this.options.revert));
-}},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a);
-var b=a.retrieve("sortables:start",this.start.bindWithEvent(this,a));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b);
-},this);return this;},addLists:function(){Array.flatten(arguments).each(function(a){this.lists.push(a);this.addItems(a.getChildren());},this);return this;
-},removeItems:function(){return $$(Array.flatten(arguments).map(function(a){this.elements.erase(a);var b=a.retrieve("sortables:start");(this.options.handle?a.getElement(this.options.handle)||a:a).removeEvent("mousedown",b);
-return a;},this));},removeLists:function(){return $$(Array.flatten(arguments).map(function(a){this.lists.erase(a);this.removeItems(a.getChildren());return a;
-},this));},getClone:function(b,a){if(!this.options.clone){return new Element("div").inject(document.body);}if($type(this.options.clone)=="function"){return this.options.clone.call(this,b,a,this.list);
-}return a.clone(true).setStyles({margin:"0px",position:"absolute",visibility:"hidden",width:a.getStyle("width")}).inject(this.list).setPosition(a.getPosition(a.getOffsetParent()));
-},getDroppables:function(){var a=this.list.getChildren();if(!this.options.constrain){a=this.lists.concat(a).erase(this.list);}return a.erase(this.clone).erase(this.element);
-},insert:function(c,b){var a="inside";if(this.lists.contains(b)){this.list=b;this.drag.droppables=this.getDroppables();}else{a=this.element.getAllPrevious().contains(b)?"before":"after";
-}this.element.inject(b,a);this.fireEvent("sort",[this.element,this.clone]);},start:function(b,a){if(!this.idle){return;}this.idle=false;this.element=a;
-this.opacity=a.get("opacity");this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,{snap:this.options.snap,container:this.options.constrain&&this.element.getParent(),droppables:this.getDroppables(),onSnap:function(){b.stop();
-this.clone.setStyle("visibility","visible");this.element.set("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]);}.bind(this),onEnter:this.insert.bind(this),onCancel:this.reset.bind(this),onComplete:this.end.bind(this)});
-this.clone.inject(this.element,"before");this.drag.start(b);},end:function(){this.drag.detach();this.element.set("opacity",this.opacity);if(this.effect){var a=this.element.getStyles("width","height");
-var b=this.clone.computePosition(this.element.getPosition(this.clone.offsetParent));this.effect.element=this.clone;this.effect.start({top:b.top,left:b.left,width:a.width,height:a.height,opacity:0.25}).chain(this.reset.bind(this));
-}else{this.reset();}},reset:function(){this.idle=true;this.clone.destroy();this.fireEvent("complete",this.element);},serialize:function(){var c=Array.link(arguments,{modifier:Function.type,index:$defined});
-var b=this.lists.map(function(d){return d.getChildren().map(c.modifier||function(e){return e.get("id");},this);},this);var a=c.index;if(this.lists.length==1){a=0;
-}return $chk(a)&&a>=0&&a<this.lists.length?b[a]:b;}});

dproject/eag-static/js/pageinfo.js

-window.addEvent('domready', function () {
-    function slugify(str) {
-        return str.toLowerCase().trim()
-            .replace(/\s+/g, '-')
-            .replace(/[^a-z0-9\-_]/g, '');
-    };
-
-    function toSlug () {
-        $('id_slug').set('value', slugify(this.get('value')));
-    };
-
-    if ($('id_slug').get('value') == slugify($('id_title').get('value'))) {
-        $('id_title').addEvent('keyup', toSlug);
-    }
-
-    $('id_slug').addEvent('change', function () {
-        $('id_title').removeEvent('keyup', toSlug);
-    });
-});

dproject/eag-static/js/picasa.js

-var PicasaUrl = {
-    galleries: 'http://picasaweb.google.com/data/feed/api/user/%user%',
-    gallery: 'http://picasaweb.google.com/data/feed/api/user/%user%/albumid/%albumid%',
-    genGalleryUrl: function (id) {
-        return this.gallery.replace('%albumid%', id);
-    }
-};
-
-function makePicasaChoiceFields(input) {
-    if ($(input)) {
-        var inputs = [$(input)];
-    } else {
-        var inputs = $$(input);
-    }
-
-    inputs.each(function (input) {
-        new PicasaChoiceField(input);
-    });
-};
-
-var PicasaChoiceField = new Class({
-    Implements: Options,
-    options: {
-        css: {
-            trigger: 'picasa-trigger',
-            back: 'picasa-back',
-            wait: 'picasa-wait',
-            gallery: 'gallery-holder',
-            image: 'image-holder',
-            window: 'picasa-window'
-        }
-    },
-
-    initialize: function (input, options) {
-        this.setOptions(options);
-
-        this._input = input;
-        this._trigger = new Element('a', {
-            'class': this.options.css.trigger, 'text': 'from picasa'
-        });
-        this._trigger.inject(this._input, 'after');
-
-        this._trigger.addEvent('click', this.open.bind(this));
-
-        this._back = new Element('div', {'class': this.options.css.back, 'opacity': 0.5});
-        this._window = new Element('div', {'class': this.options.css.window});
-
-        this._back.addEvent('click', this.close.bind(this));
-        window.document.addEvent('keydown', function (e) {
-            if (e.key == 'esc') {
-                this.close();
-            }
-        }.bind(this));
-    },
-
-    clear: function () {
-        this._back.empty();
-        this._window.empty();
-    },
-
-    close: function () {
-        this._back.dispose();
-        this._window.dispose();
-    },
-
-    wait: function () {
-        this.clear();
-        new Element('div', {'class': this.options.css.wait}).inject(this._window);
-    },
-
-    open: function() {
-        this._back.inject(document.body);
-        this._window.inject(document.body);
-        this.getGalleries();
-    },
-
-    getGalleries: function () {
-        this.wait();
-        new Request.JSON({
-            url: PicasaUrl.galleries,
-            method: 'get',
-            onSuccess: this.proccessGalleries.bind(this),
-            onFailure: function () { }
-        }).send();
-    },
-
-    proccessGalleries: function (json) {
-        this.clear();
-        var galleries = json.feed.entry;
-        galleries.each(function (item) {
-            var wrapper = new Element('div', {
-                'class': this.options.css.gallery});
-            var numPhotos = item.gphoto$numphotos.$t;
-            var title = item.gphoto$name.$t + ' (' + numPhotos + ')';
-            var galId = item.gphoto$id.$t;
-            var src = item.media$group.media$thumbnail[0].url;
-            new Element('h2', {'text': title}).inject(wrapper);
-            var img = new Element('img', {'alt': galId, 'src': src});
-            img.inject(wrapper);
-            wrapper.addEvent('click', function (e) {
-                this.getGallery(galId);
-            }.bind(this));
-            wrapper.inject(this._window);
-        }.bind(this));
-    },
-
-    getGallery: function (galId) {
-        this.wait();
-        new Request.JSON({
-            url: PicasaUrl.genGalleryUrl(galId),
-            method: 'get',
-            onSuccess: this.proccessGallery.bind(this),
-            onFailure: function () { }
-        }).send();
-    },
-
-    proccessGallery: function (json) {
-        this.clear();
-        var photos = json.feed.entry;
-        photos.each(function (item) {
-            var title = item.title.$t;
-            var url = item.content.src;
-            var src = item.media$group.media$thumbnail[1].url;
-
-            var wrapper = new Element('div', {
-                'class': this.options.css.image});
-            new Element('h3', {'text': title}).inject(wrapper);
-            var img = new Element('img', {'alt': url, 'src': src});
-            img.inject(wrapper);
-            wrapper.addEvent('click', function (e) {
-                this._input.set('value', url);
-                this.close();
-            }.bind(this));
-            wrapper.inject(this._window);
-        }.bind(this));
-    }
-});
-

dproject/eag-static/js/site-tree.js

-(function (postUrl) {
-    function getLevel(item) {
-        return item.get('class').toInt();
-    }
-
-    function setLevel(item, level) {
-        item.set('class', level);
-        item.setStyle('margin-left', (level - 1) * 3 + 'em');
-    }
-
-    function hideChilds(item) {
-        var childs = item.getAllNext();
-        var level = getLevel(item);
-        for (var i = 0; i < childs.length; ++i) {
-            if (level >= getLevel(childs[i]))
-                break;
-            childs[i].inject($('Holder'));
-        }
-    }
-
-    function showChilds(item) {
-        var curLevel = getLevel(item);
-        var lis = $('Holder').getElements('li');
-        if (!lis.length) {
-            return;
-        }
-        var delta = curLevel - (getLevel(lis[0]) - 1);
-        var last = item;
-        lis.each(function(li) {
-            setLevel(li, getLevel(li) + delta);
-            li.inject(last, 'after');
-            last = li;
-        });
-    }
-
-    function checkOrder (elem, clone, pages) {
-        var next = elem.getNext('li');
-        if (next && getLevel(next) == 0)
-            next = next.getNext('li');
-        var prev = elem.getPrevious('li');
-        if (prev && getLevel(prev) == 0)
-            prev = prev.getPrevious('li');
-
-        if (!prev) {
-            setLevel(elem, 1);
-            return;
-        }
-
-        if (!next) {
-            var from = 1;
-            var fx = pages[0].getPosition().x;
-        } else {
-            var from = getLevel(next);
-            var fx = next.getPosition().x;
-        }
-        var tx = prev.getPosition().x;
-
-        var to = getLevel(prev);
-        var cx = clone.getPosition().x;
-
-        if (from > to) {
-            setLevel(elem, from);
-            return;
-        }
-
-        if (cx > tx) {
-            setLevel(elem, to + 1);
-        } else if (cx < fx || from == to) {
-            setLevel(elem, from);
-        } else {
-            var w = (tx - fx) / (to - from);
-            var delta = (cx - fx) / parseFloat(w) + 0.5;
-            setLevel(elem, to + parseInt(delta));
-        }
-    }
-
-    function startReordering () {
-        var tree = $('Tree');
-        var pages = tree.getChildren();
-        pages.each(function(li) {
-            setLevel(li, getLevel(li));
-        });
-        var sortable = new Sortables(tree, {
-            clone: true,
-            opacity: 0.5,
-            onStart: function (elem, clone) {
-                hideChilds(elem);
-                setLevel(clone, 0);
-                clone.addEvent('mousemove', function () {
-                    checkOrder(elem, clone, pages);
-                });
-            },
-            onSort: function (elem, clone) {
-                checkOrder(elem, clone, pages);
-            },
-            onComplete: function (elem) {
-                $('OrderButtons').setStyle('display', 'block');
-                showChilds(elem);
-            }
-        });
-
-        return sortable;
-    };
-
-    window.addEvent('domready', function () {
-        $$('.reorder-button').addEvent('click', function (e) {
-            $('Tree').addClass('ordering');
-            $('Tree').highlight('#ababf8');
-            var sortable = startReordering();
-            e.preventDefault();
-            $('SaveOrder').addEvent('click', function () {
-                sortable.detach();
-                $('Tree').getChildren().each(function (li) {
-                    li.set('id', li.get('id') + '-' + li.get('class'));
-                });
-                $('ReorderData').set('value', sortable.serialize().join('&'));
-                $('ReorderForm').submit();
-            });
-        });
-
-        $$('#Tree .delete').addEvent('click', function (e) {
-            return confirm('Are You sure?');
-        });
-    });
-}) ();
-

dproject/eagadmin/__init__.py

-

dproject/eagadmin/account.py

-from google.appengine.api import users
-from django.shortcuts import redirect, render_to_response
-from django.conf import settings
-
-def admin_required(func):
-    def newfunc(request, *args, **kwargs):
-        if users.is_current_user_admin():
-            return func(request, *args, **kwargs)
-
-        user = users.get_current_user()
-        if not user:
-            return _toaccount(request)
-
-        emails = (email for name, email in settings.ADMINS)
-        if not user.email() in emails:
-            return _noaccess(request)
-        return func(request, *args, **kwargs)
-    return newfunc
-
-def _toaccount(request):
-    uri = request.build_absolute_uri()
-    return redirect(users.create_login_url(uri))
-
-def _noaccess(request):
-    return render_to_response('eagadmin/noaccess.html')
-

dproject/eagadmin/forms.py

-from google.appengine.ext.db import djangoforms
-from eagadmin.models.pages import Page, get_all, choices
-from django.utils.importlib import import_module
-from django import forms
-from eagadmin.types import get_namepairs
-
-def form_formclass(class_, additional=None):
-    class ContentForm(djangoforms.ModelForm):
-        def __init__(self, *args, **kwargs):
-            super(ContentForm, self).__init__(*args, **kwargs)
-            if not additional:
-                return
-            for k, field in additional.base_fields.iteritems():
-                self.fields[k] = field
-        class Meta:
-            model = class_
-            exclude = Page.properties().keys()
-    return ContentForm
-
-class TypeForm(forms.Form):
-    def __init__(self, *args, **kwargs):
-        super(TypeForm, self).__init__(*args, **kwargs)
-
-        self.fields['type'] = djangoforms.forms.ChoiceField(
-                choices=get_namepairs())
-
-class PageForm(djangoforms.ModelForm):
-    class Meta:
-        model = Page
-        exclude = ('order', 'level', 'updated_by', '_class',)
-
-    def __init__(self, *args, **kwargs):
-        super(PageForm, self).__init__(*args, **kwargs)
-
-        ChoiceField= djangoforms.forms.ChoiceField
-        if self.instance and self.instance.is_saved():
-            del(self.fields['top'])
-        else:
-            self.fields['top'] = ChoiceField(choices=choices(), widget=djangoforms.forms.Select)
-            self.fields['type'] = ChoiceField(choices=get_namepairs())
-
-class PicasaWidget(forms.TextInput):
-    def __init__(self, *args, **kwargs):
-        super(PicasaWidget, self).__init__(*args, **kwargs)
-        self.attrs['class'] = 'picasa'
-
-class WYSIWYGWidget(forms.Textarea):
-    def __init__(self, *args, **kwargs):
-        super(WYSIWYGWidget, self).__init__(*args, **kwargs)
-        self.attrs['class'] = 'wysiwyg'
-
-class SemiWYSIWYGWidget(forms.Textarea):
-    def __init__(self, *args, **kwargs):
-        super(SemiWYSIWYGWidget, self).__init__(*args, **kwargs)
-        self.attrs['class'] = 'semi-wysiwyg'
-

dproject/eagadmin/models/__init__.py

-import pages
-
-__all__ = ['pages']
-

dproject/eagadmin/models/pages.py

-from google.appengine.ext import db
-from google.appengine.api import users
-from google.appengine.ext.db import polymodel
-from eagadmin.types import get_types
-from django.shortcuts import render_to_response
-from django.template import TemplateDoesNotExist, RequestContext
-from django.core.urlresolvers import reverse
-# TODO: check all posible 'more than 1000' cases
-
-# Not sure about tree construction in
-# get_descendants, get_branch, get_all
-# It is possible that all these functions
-# just makes too many datastore calls
-#
-# Maybe (just maybe) it should fetch all
-# pages at the beginning, parse it,
-# construct tree and forget datastore
-
-def _caching(func):
-    """ Caching decorator (Only for request lifetime)
-
-        Chache key only depends on first arg
-    """
-    cache = {}
-    def newfunc(*args):
-        if not args: return func(*args)
-        key = getattr(args[0], 'key', lambda: str(args[0]))()
-        if not key in cache:
-            cache[key] = func(*args)
-        return cache[key]
-    return newfunc
-
-def _draft_filter(func):
-    """ Decorator prevents acsesing draft pages """
-    def newfunc(*args, **kwargs):
-        ret = func(*args, **kwargs)
-
-        user = users.get_current_user()
-        if user or not ret:
-            return ret
-
-        if hasattr(ret, 'draft'):
-            if ret.draft:
-                return None
-            return ret
-        elif hasattr(ret, 'filter'):
-            return ret.filter('draft =', False)
-        return [p for p in ret if not p.draft]
-    return newfunc
-
-@_caching
-def get_root():
-    root = Page.all().filter('level =', 0).get()
-    if root:
-        return root
-    return add_root()
-
-def choices():
-    for p in get_all():
-        yield (str(p.key()), str(p))
-
-def get_all():
-    root = get_root()
-    return [root,] + get_descendants(root)
-
-def get_branch(page):
-    return get_descendants(page)
-
-@_draft_filter
-@_caching
-def get_children(page):
-    return Page.all().filter('top =', page.key()).order('order')
-
-@_draft_filter
-@_caching
-def get_prev(page):
-    return Page.all() \
-            .filter('top =', page.top.key()) \
-            .filter('order =', page.order - 1)
-
-@_draft_filter
-@_caching
-def get_next(page):
-    return Page.all() \
-            .filter('top =', page.top.key()) \
-            .filter('order =', page.order + 1)
-
-@_draft_filter
-@_caching
-def get_by_slug(slug=''):
-    if slug:
-        return Page.all().filter('slug =', slug).get()
-    return get_root()
-
-def get_descendants(page, depth=-1):
-    if depth == 0:
-        return []
-    if depth != -1:
-        depth -= 1
-    pages = []
-    for c in get_children(page):
-        pages += [c] + get_descendants(c, depth)
-    return pages
-
-@_draft_filter
-@_caching
-def get_breadcrumb(page):
-    tops = []
-    top = page
-    while True:
-        if not top:
-            break
-        tops.append(top)
-        top = top.top
-    return list(reversed(tops))
-
-def add_as_last_child(page, destination):
-    try:
-        last_child = list(destination.children)[-1]
-        page.order = last_child.order + 1
-    except IndexError:
-        page.order = 0
-    page.level = destination.level + 1
-    page.top = destination.key()
-    page.put()
-
-def add_root():
-    root = Page(top=None,
-                 title='Home Page',
-                 menu_name='Home',
-                 slug='home-page')
-    root.put()
-    return root
-
-def delete_with_branch(page):
-    branch = get_branch(page)
-    for p in branch:
-        p.delete()
-    q = Page.all() \
-            .filter('top =', page.top.key()) \
-            .filter('order >', page.order)
-    for p in q:
-        p.order -= 1
-        p.put()
-    page.delete()
-
-def reorder(neworder):
-    """
-    neworder must be [(key, level), (key, level), ..]
-    """
-    all = get_all()
-    top = all[0]
-    pages = dict(((str(p.key()), p) for p in all[1:]))
-
-    if len(pages) != len(neworder):
-        raise ValueError("Lengths are not equal")
-
-    prev_level = 1 # First elem's below root
-    prev_page = top
-    orders = [0,]
-    tops = [top,]
-    for key, level in neworder:
-        page = pages[key]
-
-        if level > prev_level:
-            tops.append(prev_page), orders.append(0)
-        elif level < prev_level:
-            tops.pop(), orders.pop()
-
-        page.top = tops[-1]
-        page.level = level
-        page.order = orders[-1]
-
-        page.put()
-
-        orders[-1] += 1
-        prev_page = page
-        prev_level = level
-
-def to_type(page, newtype):
-    fields = page.fields()
-    args = ((k, getattr(page, k)) for k, v in fields.iteritems())
-    return get_types()[newtype].modelcl(**dict(args))
-
-def reparent(old_parent, new_parent):
-    for c in old_parent.children_set:
-        c.top = new_parent
-        c.put()
-
-class Page(polymodel.PolyModel):
-    top = db.SelfReferenceProperty(collection_name='children_set')
-    order = db.IntegerProperty(required=True, default=0)
-    level = db.IntegerProperty(required=True, default=0)
-
-    title = db.StringProperty(required=True)
-    slug = db.StringProperty(required=True)
-    menu_name = db.StringProperty()
-    draft = db.BooleanProperty()
-
-    keywords = db.TextProperty()
-    description = db.TextProperty()
-
-    updated_at = db.DateTimeProperty(auto_now=True)
-    updated_by = db.UserProperty(auto_current_user=True)
-
-    @property
-    def menu_title(self):
-        if self.menu_name:
-            return self.menu_name
-        return self.title
-
-    def is_root(self):
-        return self.top == None
-
-    def is_leaf(self):
-        return len(self.children_set) == 0
-
-    def has_top(self):
-        return (not self.is_root())
-
-    def has_children(self):
-        return (not self.is_leaf())
-
-    def has_next(self):
-        return (not self.get_next())
-
-    def has_prev(self):
-        return (not self.get_prev())
-
-    def get_response(self, request):
-        data = {
-            'current': self,
-            'breadcrumb': get_breadcrumb(self)
-        }
-        tname = 'gsite/types/%s.html' % self.class_name().lower()
-        try:
-            return render_to_response(tname, data,
-                    context_instance=RequestContext(request))
-        except TemplateDoesNotExist:
-            return render_to_response('eagsite/page.html', data,
-                    context_instance=RequestContext(request))
-        return None
-
-    def get_link_target(self):
-        return None
-
-    def get_absolute_url(self):
-        return reverse('eagadmin.views.site', args=[self.slug])
-
-    @property
-    def next(self):
-        return get_next(self)
-
-    @property
-    def prev(self):
-        return get_prev(self)
-
-    @property
-    def children(self):
-        return get_children(self)
-
-    def __eq__(self, other):
-        return self.slug == other.slug
-
-    def __str__(self):
-        return "%s %s" % ("--" * self.level, self.title)
-

dproject/eagadmin/templatetags/__init__.py

Empty file removed.

dproject/eagadmin/templatetags/eagadmin.py

-from django import template
-from django.template.defaultfilters import stringfilter
-from google.appengine.api import users
-from django.core.urlresolvers import reverse
-
-register = template.Library()
-
-@register.filter
-def margin_left(value):
-    return "margin-left: %dem;" % (int(value - 1) * 3)
-
-class LoginedUserNode(template.Node):
-    def render(self, context):
-        html = '<a class="logout" href="%s">Logout</a>%s&nbsp;'
-        username = users.get_current_user().nickname()
-        url = users.create_logout_url(reverse("eagadmin:index"))
-        return html % (url, username)
-
-def logout(parser, token):
-    return LoginedUserNode()
-register.tag('logout', logout)
-

dproject/eagadmin/templatetags/eagsite.py

-from django import template
-from django.template import TemplateSyntaxError
-from ..eagadmin.models import pages
-
-register = template.Library()
-
-class ListMenuNode(template.Node):
-    def __init__(self, item, depth):
-        self.item = template.Variable(item)
-        self.depth = int(depth)
-
-    def render(self, context):
-        item = self.item.resolve(context)
-        current = template.Variable('current').resolve(context)
-        breadcrumb = template.Variable('breadcrumb').resolve(context)
-        lis = []
-        try:
-            items = pages.get_descendants(item, self.depth)
-        except AttributeError:
-            item = pages.get_by_slug(str(item))
-            if not item:
-                return ''
-            items = pages.get_descendants(item, self.depth)
-        if not items:
-            return ''
-        return self.output(items, current, breadcrumb)
-
-    def output(self, items, current, breadcrumb):
-        level = items[0].level
-        out = []
-        for p in items:
-            if level < p.level:
-                out.append('<ul>')
-            if level > p.level:
-                out.append('</ul>')
-
-            cl = ''
-            if p == current:
-                cl = ' class="current"'
-            elif p in breadcrumb:
-                cl = ' class="branch"'
-            out.append('<li%s>' % (cl))
-
-            target = ''
-            if p.get_link_target():
-                target = ' target="%s"' % p.get_link_target()
-            params = (p.get_absolute_url(), target, p.menu_title)
-            out.append('<a href="%s"%s>%s</a>' % params)
-            level = p.level
-        return ''.join(out)
-
-def list_menu(parser, token):