[svn] - Remove feature (admin JSON / XML downloads) which won't work until we have django 1.1 installed (works on my SVN version, but not on seagrass debian package version).
- Copy feincms media to project so that we don't have to serve it separately. Also useful because we may want to customize it.
@ -101,22 +101,22 @@ def export_as_json(modeladmin, request, queryset):
|
||||
serializers.serialize("json", queryset, stream=response)
|
||||
return response
|
||||
|
||||
admin.site.add_action(export_as_json)
|
||||
|
||||
def export_as_xml(modeladmin, request, queryset):
|
||||
response = HttpResponse(mimetype="text/xml")
|
||||
response['Content-Disposition'] = 'attachment; filename=troggle_output.xml'
|
||||
return response
|
||||
|
||||
admin.site.add_action(export_as_xml)
|
||||
|
||||
def export_as_python(modeladmin, request, queryset):
|
||||
response = HttpResponse(mimetype="text/python")
|
||||
response['Content-Disposition'] = 'attachment; filename=troggle_output.py'
|
||||
serializers.serialize("json", queryset, stream=response)
|
||||
return response
|
||||
|
||||
admin.site.add_action(export_as_python)
|
||||
#These require django newer than 1.0 (SVN version) so we'll have to wait.
|
||||
#admin.site.add_action(export_as_xml)
|
||||
#admin.site.add_action(export_as_json)
|
||||
#admin.site.add_action(export_as_python)
|
||||
|
||||
try:
|
||||
mptt.register(Subcave, order_insertion_by=['name'])
|
||||
|
54
media/feincms/css/jquery.alerts.css
Normal file
@ -0,0 +1,54 @@
|
||||
#popup_container {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
min-width: 300px; /* Dialog will be no smaller than this */
|
||||
max-width: 600px; /* Dialog will wrap after this width */
|
||||
background: #FFF;
|
||||
border: solid 1px #666;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#popup_title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.75em;
|
||||
color: #666;
|
||||
background: #eee url(images/title.gif) top repeat-x;
|
||||
border: solid 1px #FFF;
|
||||
border-bottom: solid 1px #666;
|
||||
cursor: default;
|
||||
padding: 0em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content {
|
||||
background: 16px 16px no-repeat url(../img/info.gif);
|
||||
padding: 1em 1.75em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content.alert {
|
||||
background-image: url(../img/info.gif);
|
||||
}
|
||||
|
||||
#popup_content.confirm {
|
||||
background-image: url(../img/important.gif);
|
||||
}
|
||||
|
||||
#popup_content.prompt {
|
||||
background-image: url(../img/help.gif);
|
||||
}
|
||||
|
||||
#popup_message {
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
||||
#popup_panel {
|
||||
text-align: center;
|
||||
margin: 1em 0em 0em 1em;
|
||||
}
|
||||
|
||||
#popup_prompt {
|
||||
margin: .5em 0em;
|
||||
}
|
47
media/feincms/css/jquery.treeTable.css
Normal file
@ -0,0 +1,47 @@
|
||||
/* jQuery TreeTable Core 2.0 stylesheet
|
||||
*
|
||||
* This file contains styles that are used to display the tree table. Each tree
|
||||
* table is assigned the +treeTable+ class.
|
||||
* ========================================================================= */
|
||||
|
||||
/* jquery.treeTable.collapsible
|
||||
* ------------------------------------------------------------------------- */
|
||||
.treeTable tr td .expander {
|
||||
background-position: left center;
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
zoom: 1; /* IE7 Hack */
|
||||
}
|
||||
|
||||
.treeTable tr.collapsed td .expander {
|
||||
background-image: url(../img/toggle-expand-dark.png);
|
||||
}
|
||||
|
||||
.treeTable tr.expanded td .expander {
|
||||
background-image: url(../img/toggle-collapse-dark.png);
|
||||
}
|
||||
|
||||
/* jquery.treeTable.sortable
|
||||
* ------------------------------------------------------------------------- */
|
||||
.treeTable tr.selected, .treeTable tr.accept {
|
||||
/*background-color: #7799ff;
|
||||
color: #fff;*/
|
||||
}
|
||||
|
||||
.treeTable tr.append {
|
||||
border-bottom: 2px solid #7799ff;
|
||||
}
|
||||
|
||||
.treeTable tr.collapsed.selected td .expander, .treeTable tr.collapsed.accept td .expander {
|
||||
/*background-image: url(../img/toggle-expand-light.png);*/
|
||||
}
|
||||
|
||||
.treeTable tr.expanded.selected td .expander, .treeTable tr.expanded.accept td .expander {
|
||||
/*background-image: url(../img/toggle-collapse-light.png);*/
|
||||
}
|
||||
|
||||
.treeTable .ui-draggable-dragging {
|
||||
color: #000;
|
||||
z-index: 1;
|
||||
}
|
242
media/feincms/css/layout.css
Normal file
@ -0,0 +1,242 @@
|
||||
|
||||
#overview {
|
||||
background-color:none;
|
||||
padding:5px 0px 0px 5px;
|
||||
margin:10px 0px 0px 10px;
|
||||
}
|
||||
|
||||
#content {
|
||||
background-color:#fff;
|
||||
margin-bottom:0px;
|
||||
width:745px;
|
||||
}
|
||||
|
||||
.navi_tab {
|
||||
float:left;
|
||||
padding: 3px 10px 3px 10px;
|
||||
cursor:pointer;
|
||||
border: 1px solid #aaa;
|
||||
border-bottom:none;
|
||||
min-width:100px;
|
||||
}
|
||||
.tab_active {
|
||||
height:16px;
|
||||
font-weight: bold;
|
||||
background-image:url('../img/default-bg.gif');
|
||||
color: white;
|
||||
}
|
||||
.tab_inactive {
|
||||
margin-top:4px;
|
||||
height:12px;
|
||||
font-weight: normal;
|
||||
background-image:none;
|
||||
color: black;
|
||||
}
|
||||
#main_wrapper {margin-left:15px;}
|
||||
#main {
|
||||
clear:both;
|
||||
padding: 10px 10px 10px 10px;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
.panel {
|
||||
display:none;
|
||||
position:relative;
|
||||
padding-bottom:50px;
|
||||
}
|
||||
|
||||
|
||||
lab { font-weight: bold; margin-right:5px;}
|
||||
span { margin-right: 5px;}
|
||||
|
||||
.order-machine {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
margin: 5px 15px 10px 5px;
|
||||
background: #eee;
|
||||
position:relative;
|
||||
width:700px;
|
||||
min-height:24px;
|
||||
border: 1px solid #678;
|
||||
}
|
||||
.order-item span {
|
||||
font-weight:bold;
|
||||
margin-left:5px;
|
||||
}
|
||||
.order-item .handle {
|
||||
float: left;
|
||||
margin-top:2px;
|
||||
cursor: move;
|
||||
}
|
||||
.item-content {
|
||||
padding: 0px 10px 0px 15px;
|
||||
margin-right:5px;
|
||||
clear:both;
|
||||
margin-left:10px;
|
||||
}
|
||||
.item-header {
|
||||
padding: 3px 10px 3px 15px;
|
||||
margin-left:10px;
|
||||
margin-top:1px;
|
||||
}
|
||||
.item-header span {
|
||||
margin-right:10px;
|
||||
float:left;
|
||||
font-weight: strong;
|
||||
}
|
||||
.item-delete {
|
||||
cursor:pointer;
|
||||
float:right;
|
||||
margin:3px 0px 0px 5px;
|
||||
}
|
||||
.active-item {
|
||||
border: 1px solid #00a;
|
||||
background-color:#def;
|
||||
}
|
||||
.button {
|
||||
margin:5px; padding:5px;
|
||||
font-weight: bold;
|
||||
background-image:url('../img/nav-bg.gif');
|
||||
cursor:pointer;
|
||||
border: 1px solid #678;
|
||||
width:30px;
|
||||
}
|
||||
th { vertical-align: middle; }
|
||||
|
||||
#test-log { padding: 5px; border: 1px solid #ccc; }
|
||||
|
||||
#overview span { margin-right:15px; margin-left:5px;}
|
||||
|
||||
.richtextcontent {display:none;}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
margin-top:5px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
||||
.item-minimize {
|
||||
width: 15px;
|
||||
height:15px;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
margin-left:-17px;
|
||||
}
|
||||
|
||||
.item-minimize-disabled {
|
||||
width: 15px;
|
||||
height:15px;
|
||||
float: left;
|
||||
margin-left:-17px;
|
||||
}
|
||||
|
||||
.machine-control {
|
||||
height:50px;
|
||||
padding: 5px 0px 5px 0px;
|
||||
border: 1px solid #678;
|
||||
background-color:#ddd;
|
||||
width:728px;
|
||||
position:absolute;
|
||||
left:-11px;
|
||||
bottom:-21px;
|
||||
}
|
||||
|
||||
.control-unit {
|
||||
float:left;
|
||||
padding-left:15px;
|
||||
padding-right:10px;
|
||||
border-right: 1px solid #678;
|
||||
}
|
||||
|
||||
.control-unit span {
|
||||
font-weight:bold;
|
||||
margin-left:5px;
|
||||
}
|
||||
|
||||
hr {
|
||||
color: #f00;
|
||||
background-color: #bbb;
|
||||
height: 1px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.empty-machine-msg {
|
||||
margin:10px 0px 5px 300px;
|
||||
font-style: italic;
|
||||
font-size:14px;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
td span select {
|
||||
width:600px;
|
||||
}
|
||||
|
||||
.popup_bg {
|
||||
width:100%; height:100%;
|
||||
background-color:white;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
position:absolute;
|
||||
top:0px; left:0px;
|
||||
}
|
||||
|
||||
#sitetree {
|
||||
margin-left: 20px;
|
||||
margin-top: 20px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.title-col {
|
||||
position:relative;
|
||||
z-index:2;
|
||||
background-color:none;
|
||||
}
|
||||
td div.wrap {
|
||||
border: 0px solid #000;
|
||||
margin: -5px;
|
||||
padding: 4px;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.insert-as-child {
|
||||
position:absolute;
|
||||
bottom:-3px;
|
||||
left: 15px;
|
||||
height:15px;
|
||||
width:100%;
|
||||
border: 0px solid #0f0;
|
||||
}
|
||||
.insert-as-sibling {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left: 15px;
|
||||
height:10px;
|
||||
width:100%;
|
||||
border: 0px solid #f00;
|
||||
}
|
||||
|
||||
.nohover {
|
||||
background-color: #eef;
|
||||
}
|
||||
|
||||
.flash {
|
||||
background-color: #afa;
|
||||
}
|
||||
|
||||
.hover-as-child {
|
||||
background-color:#cdf;
|
||||
}
|
||||
|
||||
.hover-as-sibling {
|
||||
border: 1px solid #aee;
|
||||
}
|
||||
|
||||
.move-node {
|
||||
cursor: move;
|
||||
margin-left:5px;
|
||||
}
|
||||
.del-page {
|
||||
cursor: pointer;
|
||||
}
|
88
media/feincms/helper.js
Normal file
@ -0,0 +1,88 @@
|
||||
function region_append(region, obj, modname) {
|
||||
var wrp = [];
|
||||
wrp.push('<div class="order-item"><div class="item-header">');
|
||||
if (obj.children(":visible").length > 0)
|
||||
wrp.push('<div class="item-minimize"><img src="'+IMG_ARROW_DOWN_PATH+'" /></div>');
|
||||
else
|
||||
wrp.push('<div class="item-minimize-disabled"><img src="'+IMG_CIRCLE_PATH+'" /></div>');
|
||||
wrp.push('<span>' + modname + '</span><img class="handle" src='+IMG_MOVE_PATH+' />');
|
||||
wrp.push('<img class="item-delete" src="'+IMG_DELETELINK_PATH+'" />');
|
||||
wrp.push('</div><div class="item-content"></div></div>');
|
||||
|
||||
$("#"+REGIONS[region]+"_body").children(".order-machine").append(wrp.join(""))
|
||||
.children(".order-item:last").children(".item-content").append(obj);
|
||||
}
|
||||
|
||||
function create_new_from_form(form, modvar, last_id) {
|
||||
var new_form = form.html().replace(
|
||||
new RegExp(modvar+'-'+last_id, 'g'),
|
||||
modvar+'-'+(last_id+1));
|
||||
new_form = '<div id="'+modvar+'_set_item_'+(last_id+1)+'">'+new_form+'</div>';
|
||||
$("#"+modvar+"_set").append(new_form);
|
||||
}
|
||||
|
||||
function get_item_field_value(item,field) {
|
||||
// item: DOM object created by 'region_append' function
|
||||
// field: "order-field" | "delete-field" | "region-field"
|
||||
if (field=="delete-field")
|
||||
return item.find("."+field).attr("checked");
|
||||
else
|
||||
return item.find("."+field).val();
|
||||
}
|
||||
|
||||
function set_item_field_value(item,field, value) {
|
||||
// item: DOM object created by 'region_append' function
|
||||
// field: "order-field" | "delete-field" | "region-field"
|
||||
if (field=="delete-field")
|
||||
item.find("."+field).attr("checked",value);
|
||||
else if (field=="region-choice-field") {
|
||||
var old_region_id = REGION_MAP.indexOf(item.find("."+field).val());
|
||||
item.find("."+field).val(REGION_MAP[value]);
|
||||
|
||||
old_region_item = $("#"+REGIONS[old_region_id]+"_body");
|
||||
old_region_item.children(".empty-machine-msg").hide();
|
||||
if (old_region_item.children(".order-machine").children().length == 0)
|
||||
old_region_item.children(".empty-machine-msg").show();
|
||||
|
||||
new_region_item = $("#"+REGIONS[value]+"_body");
|
||||
new_region_item.children(".empty-machine-msg").hide();
|
||||
}
|
||||
else
|
||||
item.find("."+field).val(value);
|
||||
}
|
||||
|
||||
function move_item (region_id, item) {
|
||||
poorify_rich(item);
|
||||
$("#"+REGIONS[region_id]+"_body").children(".order-machine").append(item);
|
||||
set_item_field_value(item, "region-choice-field", region_id);
|
||||
richify_poor(item);
|
||||
}
|
||||
|
||||
function poorify_rich(item){
|
||||
item.children(".item-content").hide();
|
||||
if (item.find("div[id^=richtext]").length > 0) {
|
||||
var editor_id = item.find(".mceEditor").prev().attr("id");
|
||||
tinyMCE.execCommand('mceRemoveControl',false,editor_id);
|
||||
}
|
||||
}
|
||||
function richify_poor(item){
|
||||
item.children(".item-content").show();
|
||||
if (item.find("div[id^=richtext]").length > 0) {
|
||||
var editor_id = item.find('textarea[name*=richtext]:visible').attr("id");
|
||||
tinyMCE.execCommand('mceAddControl',false,editor_id);
|
||||
}
|
||||
}
|
||||
|
||||
function zucht_und_ordnung(move_item) {
|
||||
for (var i=0; i<REGIONS.length;i++) {
|
||||
var container = $("#"+REGIONS[i]+"_body .order-machine");
|
||||
for (var j=0; j<container.children().length; j++) {
|
||||
if (move_item)
|
||||
container.find(".order-field[value="+j+"]").parents(".order-item").appendTo(container);
|
||||
else
|
||||
set_item_field_value(container.find(".order-item:eq("+j+")"),"order-field",j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
media/feincms/img/arrow_down.gif
Normal file
After Width: | Height: | Size: 224 B |
BIN
media/feincms/img/arrow_right.gif
Normal file
After Width: | Height: | Size: 222 B |
BIN
media/feincms/img/circle.gif
Normal file
After Width: | Height: | Size: 198 B |
BIN
media/feincms/img/cut.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
media/feincms/img/default-bg.gif
Normal file
After Width: | Height: | Size: 844 B |
BIN
media/feincms/img/door.png
Normal file
After Width: | Height: | Size: 412 B |
BIN
media/feincms/img/help.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
media/feincms/img/icon_deletelink.gif
Normal file
After Width: | Height: | Size: 181 B |
BIN
media/feincms/img/icon_move.gif
Normal file
After Width: | Height: | Size: 185 B |
BIN
media/feincms/img/important.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
media/feincms/img/info.gif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
media/feincms/img/nav-bg.gif
Normal file
After Width: | Height: | Size: 273 B |
BIN
media/feincms/img/page_white_copy.png
Normal file
After Width: | Height: | Size: 309 B |
BIN
media/feincms/img/page_white_delete.png
Normal file
After Width: | Height: | Size: 536 B |
BIN
media/feincms/img/page_white_edit.png
Normal file
After Width: | Height: | Size: 618 B |
BIN
media/feincms/img/page_white_paste.png
Normal file
After Width: | Height: | Size: 620 B |
BIN
media/feincms/img/title.gif
Normal file
After Width: | Height: | Size: 317 B |
BIN
media/feincms/img/toggle-collapse-dark.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
media/feincms/img/toggle-collapse-light.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
media/feincms/img/toggle-expand-dark.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
media/feincms/img/toggle-expand-light.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
19
media/feincms/jquery-1.3.min.js
vendored
Normal file
54
media/feincms/jquery.alerts.css
Normal file
@ -0,0 +1,54 @@
|
||||
#popup_container {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
min-width: 300px; /* Dialog will be no smaller than this */
|
||||
max-width: 600px; /* Dialog will wrap after this width */
|
||||
background: #FFF;
|
||||
border: solid 1px #666;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#popup_title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.75em;
|
||||
color: #666;
|
||||
background: #eee url(img/title.gif) top repeat-x;
|
||||
border: solid 1px #FFF;
|
||||
border-bottom: solid 1px #666;
|
||||
cursor: default;
|
||||
padding: 0em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content {
|
||||
background: 16px 16px no-repeat url(img/info.gif);
|
||||
padding: 1em 1.75em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content.alert {
|
||||
background-image: url(img/info.gif);
|
||||
}
|
||||
|
||||
#popup_content.confirm {
|
||||
background-image: url(img/important.gif);
|
||||
}
|
||||
|
||||
#popup_content.prompt {
|
||||
background-image: url(img/help.gif);
|
||||
}
|
||||
|
||||
#popup_message {
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
||||
#popup_panel {
|
||||
text-align: center;
|
||||
margin: 1em 0em 0em 1em;
|
||||
}
|
||||
|
||||
#popup_prompt {
|
||||
margin: .5em 0em;
|
||||
}
|
235
media/feincms/jquery.alerts.js
Normal file
@ -0,0 +1,235 @@
|
||||
// jQuery Alert Dialogs Plugin
|
||||
//
|
||||
// Version 1.0
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
// 29 December 2008
|
||||
//
|
||||
// Visit http://abeautifulsite.net/notebook/87 for more information
|
||||
//
|
||||
// Usage:
|
||||
// jAlert( message, [title, callback] )
|
||||
// jConfirm( message, [title, callback] )
|
||||
// jPrompt( message, [value, title, callback] )
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 1.00 - Released (29 December 2008)
|
||||
//
|
||||
// License:
|
||||
//
|
||||
// This plugin is licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html
|
||||
//
|
||||
(function($) {
|
||||
|
||||
$.alerts = {
|
||||
|
||||
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
||||
|
||||
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
|
||||
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
|
||||
repositionOnResize: true, // re-centers the dialog on window resize
|
||||
overlayOpacity: .01, // transparency level of overlay
|
||||
overlayColor: '#FFF', // base color of overlay
|
||||
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
|
||||
okButton: ' OK ', // text for the OK button
|
||||
cancelButton: ' Cancel ', // text for the Cancel button
|
||||
dialogClass: null, // if specified, this class will be applied to all dialogs
|
||||
|
||||
// Public methods
|
||||
|
||||
alert: function(message, title, callback) {
|
||||
if( title == null ) title = 'Alert';
|
||||
$.alerts._show(title, message, null, 'alert', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
confirm: function(message, title, callback) {
|
||||
if( title == null ) title = 'Confirm';
|
||||
$.alerts._show(title, message, null, 'confirm', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
prompt: function(message, value, title, callback) {
|
||||
if( title == null ) title = 'Prompt';
|
||||
$.alerts._show(title, message, value, 'prompt', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_show: function(title, msg, value, type, callback) {
|
||||
|
||||
$.alerts._hide();
|
||||
$.alerts._overlay('show');
|
||||
|
||||
$("BODY").append(
|
||||
'<div id="popup_container">' +
|
||||
'<h1 id="popup_title"></h1>' +
|
||||
'<div id="popup_content">' +
|
||||
'<div id="popup_message"></div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
|
||||
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
|
||||
|
||||
// IE6 Fix
|
||||
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
||||
|
||||
$("#popup_container").css({
|
||||
position: pos,
|
||||
zIndex: 99999,
|
||||
padding: 0,
|
||||
margin: 0
|
||||
});
|
||||
|
||||
$("#popup_title").text(title);
|
||||
$("#popup_content").addClass(type);
|
||||
$("#popup_message").text(msg);
|
||||
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
|
||||
|
||||
$("#popup_container").css({
|
||||
minWidth: $("#popup_container").outerWidth(),
|
||||
maxWidth: $("#popup_container").outerWidth()
|
||||
});
|
||||
|
||||
$.alerts._reposition();
|
||||
$.alerts._maintainPosition(true);
|
||||
|
||||
switch( type ) {
|
||||
case 'alert':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
callback(true);
|
||||
});
|
||||
$("#popup_ok").focus().keypress( function(e) {
|
||||
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'confirm':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(true);
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(false);
|
||||
});
|
||||
$("#popup_ok").focus();
|
||||
$("#popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'prompt':
|
||||
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_prompt").width( $("#popup_message").width() );
|
||||
$("#popup_ok").click( function() {
|
||||
var val = $("#popup_prompt").val();
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( val );
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( null );
|
||||
});
|
||||
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
if( value ) $("#popup_prompt").val(value);
|
||||
$("#popup_prompt").focus().select();
|
||||
break;
|
||||
}
|
||||
|
||||
// Make draggable
|
||||
if( $.alerts.draggable ) {
|
||||
try {
|
||||
$("#popup_container").draggable({ handle: $("#popup_title") });
|
||||
$("#popup_title").css({ cursor: 'move' });
|
||||
} catch(e) { /* requires jQuery UI draggables */ }
|
||||
}
|
||||
},
|
||||
|
||||
_hide: function() {
|
||||
$("#popup_container").remove();
|
||||
$.alerts._overlay('hide');
|
||||
$.alerts._maintainPosition(false);
|
||||
},
|
||||
|
||||
_overlay: function(status) {
|
||||
switch( status ) {
|
||||
case 'show':
|
||||
$.alerts._overlay('hide');
|
||||
$("BODY").append('<div id="popup_overlay"></div>');
|
||||
$("#popup_overlay").css({
|
||||
position: 'absolute',
|
||||
zIndex: 99998,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
height: $(document).height(),
|
||||
background: $.alerts.overlayColor,
|
||||
opacity: $.alerts.overlayOpacity,
|
||||
display: 'none'
|
||||
});
|
||||
break;
|
||||
case 'hide':
|
||||
$("#popup_overlay").remove();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_reposition: function() {
|
||||
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
||||
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
||||
if( top < 0 ) top = 0;
|
||||
if( left < 0 ) left = 0;
|
||||
|
||||
// IE6 fix
|
||||
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
|
||||
|
||||
$("#popup_container").css({
|
||||
top: top + 'px',
|
||||
left: left + 'px'
|
||||
});
|
||||
$("#popup_overlay").height( $(document).height() );
|
||||
},
|
||||
|
||||
_maintainPosition: function(status) {
|
||||
if( $.alerts.repositionOnResize ) {
|
||||
switch(status) {
|
||||
case true:
|
||||
$(window).bind('resize', function() {
|
||||
$.alerts._reposition();
|
||||
});
|
||||
break;
|
||||
case false:
|
||||
$(window).unbind('resize');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Shortuct functions
|
||||
jAlert = function(message, title, callback) {
|
||||
$.alerts.alert(message, title, callback);
|
||||
}
|
||||
|
||||
jConfirm = function(message, title, callback) {
|
||||
$.alerts.confirm(message, title, callback);
|
||||
};
|
||||
|
||||
jPrompt = function(message, value, title, callback) {
|
||||
$.alerts.prompt(message, value, title, callback);
|
||||
};
|
||||
|
||||
})(jQuery);
|
156
media/feincms/jquery.json-1.3.js
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* jQuery JSON Plugin
|
||||
* version: 1.0 (2008-04-17)
|
||||
*
|
||||
* This document is licensed as free software under the terms of the
|
||||
* MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Brantley Harris technically wrote this plugin, but it is based somewhat
|
||||
* on the JSON.org website's http://www.json.org/json2.js, which proclaims:
|
||||
* "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
|
||||
* I uphold. I really just cleaned it up.
|
||||
*
|
||||
* It is also based heavily on MochiKit's serializeJSON, which is
|
||||
* copywrited 2005 by Bob Ippolito.
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
function toIntegersAtLease(n)
|
||||
// Format integers to have at least two digits.
|
||||
{
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
Date.prototype.toJSON = function(date)
|
||||
// Yes, it polutes the Date namespace, but we'll allow it here, as
|
||||
// it's damned usefull.
|
||||
{
|
||||
return this.getUTCFullYear() + '-' +
|
||||
toIntegersAtLease(this.getUTCMonth()) + '-' +
|
||||
toIntegersAtLease(this.getUTCDate());
|
||||
};
|
||||
|
||||
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
|
||||
var meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
|
||||
$.quoteString = function(string)
|
||||
// Places quotes around a string, inteligently.
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
{
|
||||
if (escapeable.test(string))
|
||||
{
|
||||
return '"' + string.replace(escapeable, function (a)
|
||||
{
|
||||
var c = meta[a];
|
||||
if (typeof c === 'string') {
|
||||
return c;
|
||||
}
|
||||
c = a.charCodeAt();
|
||||
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
|
||||
}) + '"';
|
||||
}
|
||||
return '"' + string + '"';
|
||||
};
|
||||
|
||||
$.toJSON = function(o, compact)
|
||||
{
|
||||
var type = typeof(o);
|
||||
|
||||
if (type == "undefined")
|
||||
return "undefined";
|
||||
else if (type == "number" || type == "boolean")
|
||||
return o + "";
|
||||
else if (o === null)
|
||||
return "null";
|
||||
|
||||
// Is it a string?
|
||||
if (type == "string")
|
||||
{
|
||||
return $.quoteString(o);
|
||||
}
|
||||
|
||||
// Does it have a .toJSON function?
|
||||
if (type == "object" && typeof o.toJSON == "function")
|
||||
return o.toJSON(compact);
|
||||
|
||||
// Is it an array?
|
||||
if (type != "function" && typeof(o.length) == "number")
|
||||
{
|
||||
var ret = [];
|
||||
for (var i = 0; i < o.length; i++) {
|
||||
ret.push( $.toJSON(o[i], compact) );
|
||||
}
|
||||
if (compact)
|
||||
return "[" + ret.join(",") + "]";
|
||||
else
|
||||
return "[" + ret.join(", ") + "]";
|
||||
}
|
||||
|
||||
// If it's a function, we have to warn somebody!
|
||||
if (type == "function") {
|
||||
throw new TypeError("Unable to convert object of type 'function' to json.");
|
||||
}
|
||||
|
||||
// It's probably an object, then.
|
||||
var ret = [];
|
||||
for (var k in o) {
|
||||
var name;
|
||||
type = typeof(k);
|
||||
|
||||
if (type == "number")
|
||||
name = '"' + k + '"';
|
||||
else if (type == "string")
|
||||
name = $.quoteString(k);
|
||||
else
|
||||
continue; //skip non-string or number keys
|
||||
|
||||
var val = $.toJSON(o[k], compact);
|
||||
if (typeof(val) != "string") {
|
||||
// skip non-serializable values
|
||||
continue;
|
||||
}
|
||||
|
||||
if (compact)
|
||||
ret.push(name + ":" + val);
|
||||
else
|
||||
ret.push(name + ": " + val);
|
||||
}
|
||||
return "{" + ret.join(", ") + "}";
|
||||
};
|
||||
|
||||
$.compactJSON = function(o)
|
||||
{
|
||||
return $.toJSON(o, true);
|
||||
};
|
||||
|
||||
$.evalJSON = function(src)
|
||||
// Evals JSON that we know to be safe.
|
||||
{
|
||||
return eval("(" + src + ")");
|
||||
};
|
||||
|
||||
$.secureEvalJSON = function(src)
|
||||
// Evals JSON in a way that is *more* secure.
|
||||
{
|
||||
var filtered = src;
|
||||
filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
|
||||
filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
|
||||
filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
|
||||
|
||||
if (/^[\],:{}\s]*$/.test(filtered))
|
||||
return eval("(" + src + ")");
|
||||
else
|
||||
throw new SyntaxError("Error parsing JSON, source is not valid.");
|
||||
};
|
||||
})(jQuery);
|
250
media/feincms/jquery.livequery.js
Normal file
@ -0,0 +1,250 @@
|
||||
/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.3
|
||||
* Requires jQuery 1.1.3+
|
||||
* Docs: http://docs.jquery.com/Plugins/livequery
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend($.fn, {
|
||||
livequery: function(type, fn, fn2) {
|
||||
var self = this, q;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// See if Live Query already exists
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
|
||||
// Found the query, exit the each loop
|
||||
return (q = query) && false;
|
||||
});
|
||||
|
||||
// Create new Live Query if it wasn't found
|
||||
q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
|
||||
|
||||
// Make sure it is running
|
||||
q.stopped = false;
|
||||
|
||||
// Run it immediately for the first time
|
||||
q.run();
|
||||
|
||||
// Contnue the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
expire: function(type, fn, fn2) {
|
||||
var self = this;
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
// Find the Live Query based on arguments and stop it
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
|
||||
$.livequery.stop(query.id);
|
||||
});
|
||||
|
||||
// Continue the chain
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$.livequery = function(selector, context, type, fn, fn2) {
|
||||
this.selector = selector;
|
||||
this.context = context || document;
|
||||
this.type = type;
|
||||
this.fn = fn;
|
||||
this.fn2 = fn2;
|
||||
this.elements = [];
|
||||
this.stopped = false;
|
||||
|
||||
// The id is the index of the Live Query in $.livequery.queries
|
||||
this.id = $.livequery.queries.push(this)-1;
|
||||
|
||||
// Mark the functions for matching later on
|
||||
fn.$lqguid = fn.$lqguid || $.livequery.guid++;
|
||||
if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
|
||||
|
||||
// Return the Live Query
|
||||
return this;
|
||||
};
|
||||
|
||||
$.livequery.prototype = {
|
||||
stop: function() {
|
||||
var query = this;
|
||||
|
||||
if ( this.type )
|
||||
// Unbind all bound events
|
||||
this.elements.unbind(this.type, this.fn);
|
||||
else if (this.fn2)
|
||||
// Call the second function for all matched elements
|
||||
this.elements.each(function(i, el) {
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
|
||||
// Clear out matched elements
|
||||
this.elements = [];
|
||||
|
||||
// Stop the Live Query from running until restarted
|
||||
this.stopped = true;
|
||||
},
|
||||
|
||||
run: function() {
|
||||
// Short-circuit if stopped
|
||||
if ( this.stopped ) return;
|
||||
var query = this;
|
||||
|
||||
var oEls = this.elements,
|
||||
els = $(this.selector, this.context),
|
||||
nEls = els.not(oEls);
|
||||
|
||||
// Set elements to the latest set of matched elements
|
||||
this.elements = els;
|
||||
|
||||
if (this.type) {
|
||||
// Bind events to newly matched elements
|
||||
nEls.bind(this.type, this.fn);
|
||||
|
||||
// Unbind events to elements no longer matched
|
||||
if (oEls.length > 0)
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
$.event.remove(el, query.type, query.fn);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Call the first function for newly matched elements
|
||||
nEls.each(function() {
|
||||
query.fn.apply(this);
|
||||
});
|
||||
|
||||
// Call the second function for elements no longer matched
|
||||
if ( this.fn2 && oEls.length > 0 )
|
||||
$.each(oEls, function(i, el) {
|
||||
if ( $.inArray(el, els) < 0 )
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.extend($.livequery, {
|
||||
guid: 0,
|
||||
queries: [],
|
||||
queue: [],
|
||||
running: false,
|
||||
timeout: null,
|
||||
|
||||
checkQueue: function() {
|
||||
if ( $.livequery.running && $.livequery.queue.length ) {
|
||||
var length = $.livequery.queue.length;
|
||||
// Run each Live Query currently in the queue
|
||||
while ( length-- )
|
||||
$.livequery.queries[ $.livequery.queue.shift() ].run();
|
||||
}
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
// Don't run anymore Live Queries until restarted
|
||||
$.livequery.running = false;
|
||||
},
|
||||
|
||||
play: function() {
|
||||
// Restart Live Queries
|
||||
$.livequery.running = true;
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
},
|
||||
|
||||
registerPlugin: function() {
|
||||
$.each( arguments, function(i,n) {
|
||||
// Short-circuit if the method doesn't exist
|
||||
if (!$.fn[n]) return;
|
||||
|
||||
// Save a reference to the original method
|
||||
var old = $.fn[n];
|
||||
|
||||
// Create a new method
|
||||
$.fn[n] = function() {
|
||||
// Call the original method
|
||||
var r = old.apply(this, arguments);
|
||||
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
|
||||
// Return the original methods result
|
||||
return r;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
run: function(id) {
|
||||
if (id != undefined) {
|
||||
// Put the particular Live Query in the queue if it doesn't already exist
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
}
|
||||
else
|
||||
// Put each Live Query in the queue if it doesn't already exist
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
});
|
||||
|
||||
// Clear timeout if it already exists
|
||||
if ($.livequery.timeout) clearTimeout($.livequery.timeout);
|
||||
// Create a timeout to check the queue and actually run the Live Queries
|
||||
$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
|
||||
},
|
||||
|
||||
stop: function(id) {
|
||||
if (id != undefined)
|
||||
// Stop are particular Live Query
|
||||
$.livequery.queries[ id ].stop();
|
||||
else
|
||||
// Stop all Live Queries
|
||||
$.each( $.livequery.queries, function(id) {
|
||||
$.livequery.queries[ id ].stop();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register core DOM manipulation methods
|
||||
$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
|
||||
|
||||
// Run Live Queries when the Document is ready
|
||||
$(function() { $.livequery.play(); });
|
||||
|
||||
|
||||
// Save a reference to the original init method
|
||||
var init = $.prototype.init;
|
||||
|
||||
// Create a new init method that exposes two new properties: selector and context
|
||||
$.prototype.init = function(a,c) {
|
||||
// Call the original init and save the result
|
||||
var r = init.apply(this, arguments);
|
||||
|
||||
// Copy over properties if they exist already
|
||||
if (a && a.selector)
|
||||
r.context = a.context, r.selector = a.selector;
|
||||
|
||||
// Set properties
|
||||
if ( typeof a == 'string' )
|
||||
r.context = c || document, r.selector = a;
|
||||
|
||||
// Return the result
|
||||
return r;
|
||||
};
|
||||
|
||||
// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
|
||||
$.prototype.init.prototype = $.prototype;
|
||||
|
||||
})(jQuery);
|
383
media/feincms/jquery.treeTable.js
Normal file
@ -0,0 +1,383 @@
|
||||
/* jQuery treeTable Plugin 2.2 - http://ludo.cubicphuse.nl/jquery-plugins/treeTable/ */
|
||||
(function($) {
|
||||
// Helps to make options available to all functions
|
||||
// TODO: This gives problems when there are both expandable and non-expandable
|
||||
// trees on a page. The options shouldn't be global to all these instances!
|
||||
var options;
|
||||
|
||||
$.fn.treeTable = function(opts) {
|
||||
options = $.extend({}, $.fn.treeTable.defaults, opts);
|
||||
|
||||
return this.each(function() {
|
||||
$(this).addClass("treeTable").find("tbody tr").each(function() {
|
||||
// Initialize root nodes only whenever possible
|
||||
if(!options.expandable || $(this)[0].className.search("child-of-") == -1) {
|
||||
initialize($(this));
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.treeTable.defaults = {
|
||||
childPrefix: "child-of-",
|
||||
expandable: true,
|
||||
indent: 19,
|
||||
initialState: "collapsed",
|
||||
treeColumn: 0
|
||||
};
|
||||
|
||||
// Recursively hide all node's children in a tree
|
||||
$.fn.collapse = function() {
|
||||
$(this).addClass("collapsed");
|
||||
|
||||
childrenOf($(this)).each(function() {
|
||||
initialize($(this));
|
||||
|
||||
if(!$(this).hasClass("collapsed")) {
|
||||
$(this).collapse();
|
||||
}
|
||||
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// Recursively show all node's children in a tree
|
||||
$.fn.expand = function() {
|
||||
$(this).removeClass("collapsed").addClass("expanded");
|
||||
|
||||
childrenOf($(this)).each(function() {
|
||||
initialize($(this));
|
||||
|
||||
if($(this).is(".expanded.parent")) {
|
||||
$(this).expand();
|
||||
}
|
||||
|
||||
$(this).show();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// Add an entire branch to +destination+
|
||||
$.fn.appendBranchTo = function(destination) {
|
||||
var node = $(this);
|
||||
var parent = parentOf(node);
|
||||
|
||||
var ancestorNames = $.map(ancestorsOf(destination), function(a) { return a.id; });
|
||||
|
||||
// Conditions:
|
||||
// 1: +node+ should not be inserted in a location in a branch if this would
|
||||
// result in +node+ being an ancestor of itself.
|
||||
// 2: +node+ should not have a parent OR the destination should not be the
|
||||
// same as +node+'s current parent (this last condition prevents +node+
|
||||
// from being moved to the same location where it already is).
|
||||
// 3: +node+ should not be inserted as a child of +node+ itself.
|
||||
if($.inArray(node[0].id, ancestorNames) == -1 && (!parent || (destination.attr("id") != parent[0].id)) && destination.attr("id") != node[0].id) {
|
||||
indent(node, ancestorsOf(node).length * options.indent * -1); // Remove indentation
|
||||
|
||||
if(parent) { node.removeClass(options.childPrefix + parent[0].id); }
|
||||
|
||||
var dest_id = $(destination).attr("id");
|
||||
while ($(".child-of-"+dest_id).length > 0) {
|
||||
var move_to = $(".child-of-"+dest_id+":last");
|
||||
dest_id = move_to.attr("id");
|
||||
}
|
||||
|
||||
node.addClass(options.childPrefix + destination.attr("id"));
|
||||
if (move_to)
|
||||
moveChild(node, move_to); // Recursively move nodes to new location
|
||||
else
|
||||
moveChild(node, destination);
|
||||
indent(node, ancestorsOf(node).length * options.indent);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.insertBranchBefore = function(destination) {
|
||||
var node = $(this);
|
||||
var parent = parentOf_jQuery(node);
|
||||
var dest_parent = parentOf_jQuery(destination);
|
||||
|
||||
if ($(this).attr("id")==destination.attr("id"))
|
||||
return false;
|
||||
|
||||
var ancestorNames = $.map(ancestorsOf_jQuery(destination), function(a) { return a.id; });
|
||||
|
||||
indent(node, ancestorsOf_jQuery(node).length * options.indent * -1); // Remove indentation
|
||||
|
||||
if(parent) { node.removeClass(options.childPrefix + parent[0].id); }
|
||||
|
||||
if (dest_parent)
|
||||
node.addClass(options.childPrefix + dest_parent.attr("id"));
|
||||
|
||||
moveBefore(node, destination); // Recursively move nodes to new location
|
||||
indent(node, (ancestorsOf_jQuery(node).length * options.indent));
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// Add reverse() function from JS Arrays
|
||||
$.fn.reverse = function() {
|
||||
return this.pushStack(this.get().reverse(), arguments);
|
||||
};
|
||||
|
||||
// Toggle an entire branch
|
||||
$.fn.toggleBranch = function() {
|
||||
if($(this).hasClass("collapsed")) {
|
||||
$(this).expand();
|
||||
} else {
|
||||
$(this).removeClass("expanded").collapse();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// === Private functions
|
||||
|
||||
function ancestorsOf(node) {
|
||||
var ancestors = [];
|
||||
while(node = parentOf(node)) {
|
||||
ancestors[ancestors.length] = node[0];
|
||||
}
|
||||
return ancestors;
|
||||
};
|
||||
|
||||
function childrenOf(node) {
|
||||
return $("table.treeTable tbody tr." + options.childPrefix + node[0].id);
|
||||
};
|
||||
|
||||
function indent(node, value) {
|
||||
var cell = $(node.children("td")[options.treeColumn]);
|
||||
var padding = parseInt(cell.css("padding-left"), 10) + value;
|
||||
|
||||
cell.css("padding-left", + padding + "px");
|
||||
|
||||
childrenOf(node).each(function() {
|
||||
indent($(this), value);
|
||||
});
|
||||
};
|
||||
|
||||
function initialize(node) {
|
||||
if(!node.hasClass("initialized")) {
|
||||
node.addClass("initialized");
|
||||
|
||||
var childNodes = childrenOf(node);
|
||||
|
||||
if(!node.hasClass("parent") && childNodes.length > 0) {
|
||||
node.addClass("parent");
|
||||
}
|
||||
|
||||
if(node.hasClass("parent")) {
|
||||
var cell = $(node.children("td")[options.treeColumn]);
|
||||
var padding = parseInt(cell.css("padding-left"), 10) + options.indent;
|
||||
|
||||
childNodes.each(function() {
|
||||
$($(this).children("td")[options.treeColumn]).css("padding-left", padding + "px");
|
||||
});
|
||||
|
||||
if(options.expandable) {
|
||||
cell.children(":first").children("span").prepend('<span style="margin-left: -' + (options.indent-15) + 'px; padding-left: ' + (options.indent-5) + 'px;" class="expander"></span>');
|
||||
//$(cell[0].firstChild).click(function() { node.toggleBranch(); });
|
||||
|
||||
// Check for a class set explicitly by the user, otherwise set the default class
|
||||
if(!(node.hasClass("expanded") || node.hasClass("collapsed"))) {
|
||||
node.addClass(options.initialState);
|
||||
}
|
||||
|
||||
if(node.hasClass("collapsed")) {
|
||||
node.collapse();
|
||||
} else if (node.hasClass("expanded")) {
|
||||
node.expand();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var cell = $(node.children("td")[options.treeColumn]);
|
||||
cell.children(":first").children("span").prepend('<span style="margin-left: -' + (options.indent-15) + 'px; padding-left: ' + (options.indent-5) + 'px;"></span>');
|
||||
}
|
||||
node.children(":first").addClass("padded");
|
||||
}
|
||||
};
|
||||
|
||||
function move(node, destination) {
|
||||
node.insertAfter(destination);
|
||||
childrenOf(node).reverse().each(function() { move($(this), node[0]); });
|
||||
};
|
||||
|
||||
function moveChild(node, destination) {
|
||||
node.insertAfter(destination)
|
||||
childrenOf(node).reverse().each(function() { move($(this), node[0]); });
|
||||
|
||||
};
|
||||
|
||||
function moveBefore(node, destination) {
|
||||
node.insertBefore(destination)
|
||||
childrenOf(node).reverse().each(function() { move($(this), node[0]); });
|
||||
};
|
||||
|
||||
function parentOf(node) {
|
||||
|
||||
var classNames = node[0].className.split(' ');
|
||||
|
||||
for(key in classNames) {
|
||||
if(classNames[key].match("child-of-")) {
|
||||
return $("#" + classNames[key].substring(9));
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
// public functions
|
||||
function handle_drop_event(source, dest, method){
|
||||
var ancestorNames = $.map(ancestorsOf_jQuery(dest), function(a) { return a.attr("id"); });
|
||||
if (method=="child")
|
||||
dest.find(".wrap").removeClass("hover-as-child").addClass("nohover");
|
||||
else // method == "sibling"
|
||||
dest.find("div:first").remove();
|
||||
// do not drop on itself or its own children, if method == "child"
|
||||
if ( (method == "sibling") || (source.attr("id") != dest.attr("id") && $.inArray(source.attr("id"), ancestorNames) == -1) ) {
|
||||
var source_child_of = null;
|
||||
if (source.attr("class").match(/child-of-node-(\d+)/))
|
||||
source_child_of = source.attr("class").match(/child-of-node-(\d+)/)[0];
|
||||
var dest_child_of = "child-of-" + dest.attr("id");
|
||||
if (source_child_of && $("."+source_child_of).length - 1 == 0) {
|
||||
var parent_id = "#" + source_child_of.substring(9);
|
||||
$(parent_id).removeClass("parent");
|
||||
if ($(parent_id).hasClass("expanded"))
|
||||
$(parent_id).removeClass("expanded").addClass("collapsed");
|
||||
$(parent_id+" .title-col span").removeClass("expander");
|
||||
}
|
||||
if (method=="child") {
|
||||
if ($("."+dest_child_of).length == 0) {
|
||||
var parent_id = "#" + dest_child_of.substring(9);
|
||||
$(parent_id).addClass("parent").find(".title-col span").addClass("expander");
|
||||
}
|
||||
if (!dest.hasClass("expanded"))
|
||||
dest.expand();
|
||||
// *** INSERT ***
|
||||
source.appendBranchTo(dest);
|
||||
} else // method == "sibling"
|
||||
source.insertBranchBefore(dest);
|
||||
}
|
||||
source.find(".wrap").switchClass("nohover","flash",0).switchClass("flash","nohover",500);
|
||||
}
|
||||
|
||||
function handle_page_delete(node) {
|
||||
var page_id = node.attr("class").match(/page-id-(\d+)/)[1];
|
||||
var parent_id = null;
|
||||
if (node.attr("class").match(/child-of-node-(\d+)/))
|
||||
parent_id = node.attr("class").match(/child-of-node-(\d+)/)[1];
|
||||
var popup_bg = '<div class="popup_bg"></div>';
|
||||
$("body").append(popup_bg);
|
||||
if (node.hasClass("parent")){
|
||||
jAlert('Cannot delete item, because it is parent of at least one other item.',
|
||||
'Cannot delete item', function(){
|
||||
$(".popup_bg").remove();
|
||||
});
|
||||
} else {
|
||||
jConfirm('Really delete item?', 'Confirm to delete item', function(r) {
|
||||
if (r==true) {
|
||||
$.post('.', {'__cmd': 'delete_item', 'item_id': page_id}, function(data){
|
||||
if (data == "OK") {
|
||||
if (parent_id && $(".child-of-node-"+parent_id).length == 1) {
|
||||
$("#node-"+parent_id).removeClass("parent")
|
||||
.removeClass("expanded").addClass("collapsed")
|
||||
.find(".expander").removeClass("expander");
|
||||
}
|
||||
node.remove();
|
||||
$("body").append(popup_bg);
|
||||
jAlert('Item deleted successfully.',
|
||||
'Item deleted', function(){
|
||||
$(".popup_bg").remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".popup_bg").remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function parentOf_jQuery(node) {
|
||||
if (node.attr("class").match(/child-of-node-(\d+)/)) {
|
||||
var parent_id = node.attr("class").match(/child-of-node-(\d+)/)[1];
|
||||
return $("#node-"+parent_id);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
function ancestorsOf_jQuery(node) {
|
||||
var ancestors = [];
|
||||
while(node = parentOf_jQuery(node)) {
|
||||
ancestors[ancestors.length] = node;
|
||||
}
|
||||
return ancestors;
|
||||
};
|
||||
|
||||
function save_page_tree() {
|
||||
var send_tree = new Array();
|
||||
|
||||
// prepare tree
|
||||
var i = 0;
|
||||
var ancestor_tree_ids = [];
|
||||
var ancestor_indeces = [];
|
||||
var tree_id = 0;
|
||||
$("#sitetree tbody tr").each(function(){
|
||||
var tobj = new Array();
|
||||
// 0 = tree_id, 1 = parent_id, 2 = left, 3 = right, 4 = level, 5 = page_id
|
||||
var classNames = $(this).attr("class").split(' ');
|
||||
var is_child = false; var is_parent = false;
|
||||
var parent_id = "";
|
||||
tobj[1] = null;
|
||||
// gather information
|
||||
for (key in classNames) {
|
||||
if(classNames[key].match("page-id-"))
|
||||
tobj[5] = parseInt(classNames[key].substring(8));
|
||||
if(classNames[key].match("parent"))
|
||||
is_parent = true;
|
||||
if(classNames[key].match("child-of-")) {
|
||||
is_child = true;
|
||||
var node_parent_id = classNames[key].substring(9);
|
||||
var parent_id = parseInt($("#"+node_parent_id).attr("class").match(/page-id-(\d+)/)[1])
|
||||
tobj[1] = parent_id;
|
||||
}
|
||||
}
|
||||
// save info
|
||||
var inArray = ancestor_tree_ids.indexOf(parent_id);
|
||||
while ( ( is_child && inArray < ancestor_tree_ids.length - 1 && inArray >= 0) || ( !is_child && ancestor_tree_ids.length > 0 ) ) {
|
||||
send_tree[ancestor_indeces.pop()][3] = i++;
|
||||
ancestor_tree_ids.pop();
|
||||
}
|
||||
if (!is_child) {
|
||||
tree_id++;
|
||||
i = 0;
|
||||
}
|
||||
tobj[0] = tree_id;
|
||||
tobj[4] = ancestor_tree_ids.length;
|
||||
tobj[2] = i++;
|
||||
if (is_parent) {
|
||||
ancestor_tree_ids.push(tobj[5]);
|
||||
ancestor_indeces.push(send_tree.length);
|
||||
} else {
|
||||
tobj[3] = i++;
|
||||
}
|
||||
send_tree.push(tobj);
|
||||
});
|
||||
while (ancestor_tree_ids.length>0) {
|
||||
send_tree[ancestor_indeces.pop()][3] = i++;
|
||||
ancestor_tree_ids.pop();
|
||||
}
|
||||
|
||||
// send tree to url
|
||||
$.post('.', {'__cmd': 'save_tree', 'tree': $.toJSON(send_tree)}, function(data){
|
||||
if (data == "OK") {
|
||||
var popup_bg = '<div class="popup_bg"></div>';
|
||||
$("body").append(popup_bg);
|
||||
jAlert("Tree saved successfully.", "Tree saved", function(){
|
||||
$(".popup_bg").remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
8894
media/feincms/jquery.ui.all.js
vendored
Normal file
183
media/feincms/layout.css
Normal file
@ -0,0 +1,183 @@
|
||||
|
||||
#overview {
|
||||
background-color:none;
|
||||
padding:5px 0px 0px 5px;
|
||||
margin:10px 0px 0px 10px;
|
||||
}
|
||||
|
||||
#content-main {
|
||||
background-color:#fff;
|
||||
margin-bottom:0px;
|
||||
width:730px;
|
||||
}
|
||||
|
||||
.navi_tab {
|
||||
float:left;
|
||||
padding: 3px 10px 3px 10px;
|
||||
cursor:pointer;
|
||||
border: 1px solid #aaa;
|
||||
border-bottom:none;
|
||||
min-width:100px;
|
||||
}
|
||||
.tab_active {
|
||||
height:16px;
|
||||
font-weight: bold;
|
||||
background-image:url('img/default-bg.gif');
|
||||
color: white;
|
||||
}
|
||||
.tab_inactive {
|
||||
margin-top:4px;
|
||||
height:12px;
|
||||
font-weight: normal;
|
||||
background-image:none;
|
||||
color: black;
|
||||
}
|
||||
#main {
|
||||
clear:both;
|
||||
padding: 10px 10px 10px 10px;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
.panel {
|
||||
display:none;
|
||||
position:relative;
|
||||
padding-bottom:70px;
|
||||
}
|
||||
|
||||
|
||||
span { margin-right: 5px;}
|
||||
|
||||
.order-machine {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
margin: 5px 15px 10px 5px;
|
||||
background: #eee;
|
||||
position:relative;
|
||||
width:700px;
|
||||
min-height:24px;
|
||||
border: 1px solid #678;
|
||||
}
|
||||
.order-item span {
|
||||
font-weight:bold;
|
||||
margin-left:5px;
|
||||
}
|
||||
.order-item .handle {
|
||||
float: left;
|
||||
cursor: move;
|
||||
background-color: #456;
|
||||
height:100%;
|
||||
border: 0px solid #456;
|
||||
width:5px;
|
||||
position:absolute;
|
||||
}
|
||||
.item-content {
|
||||
padding: 0px 10px 10px 15px;
|
||||
margin-right:5px;
|
||||
clear:both;
|
||||
margin-left:10px;
|
||||
}
|
||||
.item-header {
|
||||
padding: 3px 10px 3px 15px;
|
||||
margin-left:10px;
|
||||
margin-top:1px;
|
||||
}
|
||||
.item-header span {
|
||||
margin-right:10px;
|
||||
float:left;
|
||||
font-weight: strong;
|
||||
}
|
||||
.item-delete {
|
||||
cursor:pointer;
|
||||
float:right;
|
||||
margin:3px 0px 0px 5px;
|
||||
}
|
||||
.active-item {
|
||||
border: 1px solid #00a;
|
||||
background-color:#def;
|
||||
}
|
||||
.button {
|
||||
margin:5px; padding:5px;
|
||||
font-weight: bold;
|
||||
background-image:url('img/nav-bg.gif');
|
||||
cursor:pointer;
|
||||
border: 1px solid #678;
|
||||
width:30px;
|
||||
}
|
||||
|
||||
#test-log { padding: 5px; border: 1px solid #ccc; }
|
||||
|
||||
#overview span { margin-right:15px; margin-left:5px;}
|
||||
|
||||
.richtextcontent {display:none;}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.item-minimize {
|
||||
width: 15px;
|
||||
height:15px;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
margin-left:-17px;
|
||||
}
|
||||
|
||||
.item-minimize-disabled {
|
||||
width: 15px;
|
||||
height:15px;
|
||||
float: left;
|
||||
margin-left:-17px;
|
||||
}
|
||||
|
||||
.machine-control {
|
||||
height:50px;
|
||||
padding: 5px 0px 5px 0px;
|
||||
border: 1px solid #678;
|
||||
background-color:#ddd;
|
||||
width:700px;
|
||||
position:absolute;
|
||||
left:5px;
|
||||
bottom:5px;
|
||||
}
|
||||
|
||||
.control-unit {
|
||||
float:left;
|
||||
padding-left:15px;
|
||||
padding-right:10px;
|
||||
border-right: 1px solid #678;
|
||||
}
|
||||
|
||||
.control-unit span {
|
||||
font-weight:bold;
|
||||
margin-left:5px;
|
||||
}
|
||||
|
||||
hr {
|
||||
color: #f00;
|
||||
background-color: #bbb;
|
||||
height: 1px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.empty-machine-msg {
|
||||
margin:10px 0px 5px 300px;
|
||||
font-style: italic;
|
||||
font-size:14px;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
td span select {
|
||||
width:600px;
|
||||
}
|
||||
|
||||
.popup_bg {
|
||||
width:100%; height:100%;
|
||||
background-color:white;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
position:absolute;
|
||||
top:0px; left:0px;
|
||||
}
|
90
media/feincms/listener.js
Normal file
@ -0,0 +1,90 @@
|
||||
$(document).ready(function(){
|
||||
$(".navi_tab").livequery('click',function(){
|
||||
$(".navi_tab").removeClass("tab_active").addClass("tab_inactive");
|
||||
$(this).removeClass("tab_inactive").addClass("tab_active");
|
||||
$("#main > div:visible").hide();
|
||||
|
||||
var tab_str = $(this).attr("id").substr(0,$(this).attr("id").length-4);
|
||||
$('#'+tab_str+'_body').show();
|
||||
ACTIVE_REGION = REGIONS.indexOf(tab_str);
|
||||
|
||||
if (tab_str == "settings")
|
||||
$(".machine-control").hide();
|
||||
else
|
||||
$(".machine-control").show();
|
||||
|
||||
window.location.hash = '#'+tab_str;
|
||||
});
|
||||
|
||||
$(".order-machine-add-button").livequery('click', function(){
|
||||
var modvar = $(this).prev().val();
|
||||
var modname = $(this).prev().children("option:selected").html();
|
||||
var total_forms = $('#id_'+modvar+'-TOTAL_FORMS');
|
||||
var last_id = parseInt(total_forms.val()) - 1;
|
||||
var form = $("#"+modvar+"_set_item_"+last_id);
|
||||
|
||||
total_forms.val(last_id+2);
|
||||
create_new_from_form(form, modvar, last_id);
|
||||
region_append(ACTIVE_REGION, form, modname, modvar);
|
||||
set_item_field_value(form,"region-choice-field", ACTIVE_REGION);
|
||||
|
||||
init_pagecontent();
|
||||
});
|
||||
|
||||
$(".order-machine-move-button").livequery('click', function(){
|
||||
var moveTo = $(this).prev().val();
|
||||
move_item(REGIONS.indexOf(moveTo),$(".active-item"));
|
||||
});
|
||||
|
||||
$(".item-delete").livequery('click',function(){
|
||||
popup_bg = '<div class="popup_bg"></div>';
|
||||
$("body").append(popup_bg);
|
||||
var item = $(this).parents(".order-item");
|
||||
jConfirm('Really delete item?', 'Confirm to delete item', function(r) {
|
||||
if (r==true) {
|
||||
set_item_field_value(item,"delete-field","checked");
|
||||
item.fadeOut(200);
|
||||
}
|
||||
$(".popup_bg").remove();
|
||||
});
|
||||
});
|
||||
|
||||
$(".cancel").livequery('click',function(){
|
||||
popup_bg = '<div class="popup_bg"></div>';
|
||||
$("body").append(popup_bg);
|
||||
jConfirm('Really change template? <br/>All content will be moved to main region.',
|
||||
'Change template', function(r) {
|
||||
if (r==true) {
|
||||
var items = $(".panel").children(".order-machine").children();
|
||||
move_item(0, items);
|
||||
$(".submit_form").click();
|
||||
} else {
|
||||
$(".popup_bg").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".item-minimize").livequery('click',function(){
|
||||
var item = $(this).parent().next();
|
||||
if (item.is(":visible")) {
|
||||
$(this).html('<img src="'+IMG_ARROW_RIGHT_PATH+'" />');
|
||||
item.slideUp(200);
|
||||
} else {
|
||||
$(this).html('<img src="'+IMG_ARROW_DOWN_PATH+'" />');
|
||||
item.slideDown(200);
|
||||
}
|
||||
});
|
||||
|
||||
$(".order-item").livequery('click',function(){
|
||||
$(".order-item").removeClass("active-item");
|
||||
$(this).addClass("active-item");
|
||||
});
|
||||
|
||||
$(".submit_form").livequery('click',function(){
|
||||
zucht_und_ordnung(false);
|
||||
var form = $(this).parents('form');
|
||||
form.attr('action', form.attr('action')+window.location.hash);
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|