Skip to content
Browse files

git-svn-id: http://svn.django-cms.org/branches/django-cms2@174 92ec83…

…17-e278-4cfe-9719-05471b91e6e2
  • Loading branch information...
1 parent d24882f commit 6c61f4a7350b46bdffdff497df7acb872de0269d divio committed Dec 17, 2008
Showing with 844 additions and 102 deletions.
  1. +263 −4 cms/media/cms/css/pages.css
  2. BIN cms/media/cms/images/simpletree/Thumbs.db
  3. BIN cms/media/cms/images/simpletree/arrow_refresh.png
  4. BIN cms/media/cms/images/simpletree/collapsable-last.gif
  5. BIN cms/media/cms/images/simpletree/collapsable.gif
  6. BIN cms/media/cms/images/simpletree/cross.png
  7. BIN cms/media/cms/images/simpletree/disk.png
  8. BIN cms/media/cms/images/simpletree/expandable-last.gif
  9. BIN cms/media/cms/images/simpletree/expandable.gif
  10. BIN cms/media/cms/images/simpletree/folder_add.png
  11. BIN cms/media/cms/images/simpletree/folder_delete.png
  12. BIN cms/media/cms/images/simpletree/folder_edit.png
  13. BIN cms/media/cms/images/simpletree/leaf-last.gif
  14. BIN cms/media/cms/images/simpletree/leaf.gif
  15. BIN cms/media/cms/images/simpletree/line_bg.gif
  16. BIN cms/media/cms/images/simpletree/line_bg_over.gif
  17. BIN cms/media/cms/images/simpletree/line_bg_over_last.gif
  18. BIN cms/media/cms/images/simpletree/minus.gif
  19. BIN cms/media/cms/images/simpletree/page_add.png
  20. BIN cms/media/cms/images/simpletree/page_delete.png
  21. BIN cms/media/cms/images/simpletree/page_edit.png
  22. BIN cms/media/cms/images/simpletree/plus.gif
  23. BIN cms/media/cms/images/simpletree/root.gif
  24. BIN cms/media/cms/images/simpletree/spacer.gif
  25. BIN cms/media/cms/images/simpletree/spinner.gif
  26. BIN cms/media/cms/images/simpletree/tree_line.gif
  27. +2 −2 cms/media/cms/javascript/change_list.js
  28. +451 −0 cms/media/cms/javascript/jquery.simple.tree.js
  29. +28 −2 cms/templates/admin/cms/page/change_list.html
  30. +27 −0 cms/templates/admin/cms/page/change_list_simpletree.html
  31. +1 −21 cms/templates/admin/cms/page/change_list_table.html
  32. +71 −73 cms/templates/admin/cms/page/menu.html
  33. +1 −0 cms/templatetags/pages_tags.py
View
267 cms/media/cms/css/pages.css
@@ -133,6 +133,171 @@ a.collapsed span.collapsed{
/* Sitemap */
+
+.simpleTree {
+ /*margin: 0 !important;*/
+ padding: 0 0 2em 0 !important;
+ }
+
+ .simpleTree li {
+ list-style: none;
+ margin:0;
+ padding:0 0 0 34px;
+ }
+
+ .simpleTree li span.row {
+ display:block;
+ background:url(../images/sitemap-li-bg.jpg) repeat-x 0px 0px;
+ height:27px;
+ border:1px solid #DEDEDC;
+ border-top:none;
+ border-right:none;
+ overflow:hidden;
+ line-height:27px;
+ padding: 0 0 0 10px;
+ margin-left: -7px;
+ min-width: 500px;
+ }
+
+ .simpleTree ul {
+ margin:0;
+ padding:0;
+ }
+
+ .simpleTree .root {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/root.gif) no-repeat 16px 0 #ffffff;
+ }
+
+ .simpleTree span.root {
+ display: none;
+ }
+
+ .simpleTree .line,
+ .simpleTree .line-last,
+ .simpleTree .line-over,
+ .simpleTree .line-over-last {
+ margin: -2px 0 0 -14px;
+ padding:0;
+ line-height: 5px;
+ height:5px;
+ font-size:5px;
+
+ position: absolute;
+ width: 500px;
+
+ background: none;
+ }
+
+ .simpleTree .line-over,
+ .simpleTree .line-over-last {
+ background: url(/media/cms/images/simpletree/line_bg_over.gif) 0 0 no-repeat transparent;
+ }
+
+ .simpleTree .folder-open {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/collapsable.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .folder-open-last {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/collapsable-last.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .folder-close {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/expandable.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .folder-close-last {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/expandable-last.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .doc {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/leaf.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .doc-last {
+ margin-left:-16px;
+ background: url(/media/cms/images/simpletree/leaf-last.gif) 0 0 no-repeat #fff;
+ }
+
+ .simpleTree .ajax {
+ background: url(/media/cms/images/simpletree/spinner.gif) no-repeat 0 0 #ffffff;
+ height: 16px;
+ display:none;
+ }
+
+ .simpleTree .ajax li {
+ display:none;
+ margin:0;
+ padding:0;
+ }
+
+ .simpleTree .trigger {
+ display:inline;
+ margin-left:-32px;
+ width: 18px;
+ height: 27px;
+ cursor:pointer;
+ }
+
+ .simpleTree .text { cursor: default; }
+
+ .simpleTree .active {
+ cursor: default;
+ background: #F7BE77 none;
+ padding:0px 10px;
+ }
+
+#drag_container {
+ background:#ffffff;
+ color:#000;
+ font: normal 11px arial, tahoma, helvetica, sans-serif;
+ border: 1px dashed #767676;
+ }
+
+ #drag_container ul {
+ list-style: none;
+ padding:0;
+ margin:0;
+ }
+
+ #drag_container li {
+ list-style: none;
+ background-color:#ffffff;
+ line-height:18px;
+ white-space: nowrap;
+ padding:1px 1px 0px 16px;
+ margin:0;
+ }
+
+ #drag_container li span {
+ padding:0;
+ }
+
+ #drag_container li.doc, #drag_container li.doc-last {
+ background: url(/media/cms/images/simpletree/leaf.gif) no-repeat -17px 0 #ffffff;
+ }
+
+ #drag_container .folder-close, #drag_container .folder-close-last {
+ background: url(/media/cms/images/simpletree/expandable.gif) no-repeat -17px 0 #ffffff;
+ }
+
+ #drag_container .folder-open, #drag_container .folder-open-last {
+ background: url(/media/cms/images/simpletree/collapsable.gif) no-repeat -17px 0 #ffffff;
+ }
+
+.contextMenu { display:none; }
+
+#tree_plus {
+ margin: 7px 0 0 4px;
+ }
+
+
+/*
div#sitemap {
margin:0px;
padding:0px;
@@ -182,7 +347,6 @@ div#sitemap li.last, div#sitemap li:last-child {
display:block;
height:28px;
line-height:27px;
- /*padding-left:16px;*/
}
#sitemap li .col1 .info a.collapse, #sitemap li .col1 .info a.collapsed{
display:block;
@@ -225,7 +389,6 @@ div#sitemap li.last, div#sitemap li:last-child {
border-left:1px solid #DEDEDC;
text-align:center;
height:28px;
- /*width:100px; */
width:auto;
line-height:28px;
float:left;
@@ -249,7 +412,6 @@ div#sitemap li.last, div#sitemap li:last-child {
#sitemap li .col-language a{text-transform:uppercase;}
#sitemap li .col-language a:hover{text-decoration:underline;}
#sitemap li .col-actions{
- /*width:105px;*/
}
#sitemap li .col-published{
@@ -318,6 +480,103 @@ div#sitemap li.last, div#sitemap li:last-child {
.activ-filter #sitemap li .col1 .info{padding-left:5px;}
.activ-filter div#sitemap li{margin-left:0px; padding-left:0px;}
+
+*/
+br.clear {
+ clear: both;
+}
+
+#sitemap ul.header {
+ background:#E1E1E1 url(../images/nav-bg.gif) repeat-x scroll left top;
+ }
+
+ #sitemap ul.header,
+ #sitemap ul.header li {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ }
+
+ #sitemap ul.header li {
+ border-bottom: 1px solid #DEDEDC;
+ line-height: 22px;
+ }
+
+ #sitemap ul div {
+ float: right;
+ padding: 0;
+ border-left: 1px solid #DEDEDC;
+ text-align: center;
+ overflow: hidden;
+ }
+
+ #sitemap ul.header div {
+ color:#666666;
+ font-weight: bold;
+ }
+
+ #sitemap ul div.col-title {
+ float: left;
+ border: none;
+ }
+
+ #sitemap ul.header div.col-title { padding-left: 8px; }
+
+#sitemap .col-actions { width: 90px; }
+#sitemap .col-published { width: 65px; }
+#sitemap .col-navigation { width: 90px; }
+#sitemap .col-soft { width: 55px; }
+#sitemap .col-template { width: 94px; }
+#sitemap .col-creator { width: 65px; }
+
+#sitemap li a.move {
+ width:15px;
+ height:14px;
+ display:inline-block;
+ background:url(../images/cut.gif) 0px 0px no-repeat;
+}
+#sitemap li a.move span{display:none;}
+
+#sitemap li a.selector-add {
+ margin-left:4px;
+ width:16px;
+ height:14px;
+ display:inline-block;
+ background:url(../images/page_find.gif) 0 -1px no-repeat;
+}
+#sitemap li a.selector-add span{display:none;}
+
+
+#sitemap li a.addlink, #sitemap li a.deletelink{
+ width:10px;
+ height:10px;
+ display:inline-block;
+ background-position:0 0px;
+ margin:0;
+ padding:0;
+ margin-left:4px;
+}
+#sitemap li a.addlink span, #sitemap li a.deletelink span{display:none;}
+
+
+/*div#sitemap ul.header li, div#sitemap ul.header {
+ padding: 0px 0px 0px 12px;
+ margin: 0px;
+ list-style-type: none;
+ }
+div#sitemap ul.header {
+ margin: 0px 0px 0px -12px;
+ padding-bottom:0px; padding-top:0px;
+ background: url(../images/sitemap-exim.gif) repeat-y;
+ clear: both;
+}*/
+
+/*div#sitemap ul.header .cont div {
+ display: block;
+ float: left;
+ padding: 0 2em;
+}
+
div#sitemap ul.header, div#sitemap ul.header li{
background:none;
border:none;
@@ -349,7 +608,7 @@ div#sitemap ul.header li{
background:none;
line-height:14px;
}
-#sitemap ul.header li .cont:hover{}
+#sitemap ul.header li .cont:hover{}*/
#changelist{
width:auto;
View
BIN cms/media/cms/images/simpletree/Thumbs.db
Binary file not shown.
View
BIN cms/media/cms/images/simpletree/arrow_refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/collapsable-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/collapsable.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/cross.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/disk.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/expandable-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/expandable.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/folder_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/folder_delete.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/folder_edit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/leaf-last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/leaf.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/line_bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/line_bg_over.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/line_bg_over_last.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/minus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/page_add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/page_delete.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/page_edit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/plus.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/root.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/spacer.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN cms/media/cms/images/simpletree/tree_line.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 cms/media/cms/javascript/change_list.js
@@ -229,7 +229,7 @@ $(document).ready(function() {
/* START DRAG'N'DROP INTERFACE */
- $('#sitemap .drag').each(function() {
+ /*$('#sitemap .drag').each(function() {
$(this).click(function() {
});
@@ -288,7 +288,7 @@ $(document).ready(function() {
});
}
});
- });
+ });*/
/* END DRAG'N'DROP INTERFACE */
});
View
451 cms/media/cms/javascript/jquery.simple.tree.js
@@ -0,0 +1,451 @@
+/*
+* jQuery SimpleTree Drag&Drop plugin
+* Update on 22th May 2008
+* Version 0.3
+*
+* Licensed under BSD <http://en.wikipedia.org/wiki/BSD_License>
+* Copyright (c) 2008, Peter Panov <panov@elcat.kg>, IKEEN Group http://www.ikeen.com
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the Peter Panov, IKEEN Group nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY Peter Panov, IKEEN Group ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL Peter Panov, IKEEN Group BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+$.fn.simpleTree = function(opt){
+ return this.each(function(){
+ var TREE = this;
+ var ROOT = $('.root',this);
+ var mousePressed = false;
+ var mouseMoved = false;
+ var dragMoveType = false;
+ var dragNode_destination = false;
+ var dragNode_source = false;
+ var dragDropTimer = false;
+ var ajaxCache = Array();
+
+ TREE.option = {
+ drag: true,
+ animate: false,
+ autoclose: false,
+ speed: 'fast',
+ afterAjax: false,
+ afterMove: false,
+ afterClick: false,
+ afterDblClick: false,
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu cliks available
+ afterContextMenu: false,
+ docToFolderConvert:false
+ };
+ TREE.option = $.extend(TREE.option,opt);
+ $.extend(this, {getSelected: function(){
+ return $('span.active', this).parent();
+ }});
+ TREE.closeNearby = function(obj)
+ {
+ $(obj).siblings().filter('.folder-open, .folder-open-last').each(function(){
+ var childUl = $('>ul',this);
+ var className = this.className;
+ this.className = className.replace('open','close');
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed);
+ }else{
+ childUl.hide();
+ }
+ });
+ };
+ TREE.nodeToggle = function(obj)
+ {
+ var childUl = $('>ul',obj);
+ if(childUl.is(':visible')){
+ obj.className = obj.className.replace('open','close');
+
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed);
+ }else{
+ childUl.hide();
+ }
+ }else{
+ obj.className = obj.className.replace('close','open');
+ if(TREE.option.animate)
+ {
+ childUl.animate({height:"toggle"},TREE.option.speed, function(){
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
+ });
+ }else{
+ childUl.show();
+ if(TREE.option.autoclose)TREE.closeNearby(obj);
+ if(childUl.is('.ajax'))TREE.setAjaxNodes(childUl, obj.id);
+ }
+ }
+ };
+ TREE.setAjaxNodes = function(node, parentId, callback)
+ {
+ if($.inArray(parentId,ajaxCache) == -1){
+ ajaxCache[ajaxCache.length]=parentId;
+ var url = $.trim($('>li', node).text());
+ if(url && url.indexOf('url:'))
+ {
+ url=$.trim(url.replace(/.*\{url:(.*)\}/i ,'$1'));
+ $.ajax({
+ type: "GET",
+ url: url,
+ contentType:'html',
+ cache:false,
+ success: function(responce){
+ node.removeAttr('class');
+ node.html(responce);
+ $.extend(node,{url:url});
+ TREE.setTreeNodes(node, true);
+ if(typeof TREE.option.afterAjax == 'function')
+ {
+ TREE.option.afterAjax(node);
+ }
+ if(typeof callback == 'function')
+ {
+ callback(node);
+ }
+ }
+ });
+ }
+
+ }
+ };
+ TREE.setTreeNodes = function(obj, useParent){
+ obj = useParent? obj.parent():obj;
+ $('li>span', obj).addClass('text')
+ .bind('selectstart', function() {
+ return false;
+ }).click(function(){
+ $('.active',TREE).attr('class','text');
+ if(this.className=='text')
+ {
+ this.className='active';
+ }
+ if(typeof TREE.option.afterClick == 'function')
+ {
+ TREE.option.afterClick($(this).parent());
+ }
+ return false;
+ }).dblclick(function(){
+ mousePressed = false;
+ TREE.nodeToggle($(this).parent().get(0));
+ if(typeof TREE.option.afterDblClick == 'function')
+ {
+ TREE.option.afterDblClick($(this).parent());
+ }
+ return false;
+ // added by Erik Dohmen (2BinBusiness.nl) to make context menu actions
+ // available
+ }).bind("contextmenu",function(){
+ $('.active',TREE).attr('class','text');
+ if(this.className=='text')
+ {
+ this.className='active';
+ }
+ if(typeof TREE.option.afterContextMenu == 'function')
+ {
+ TREE.option.afterContextMenu($(this).parent());
+ }
+ return false;
+ }).mousedown(function(event){
+ mousePressed = true;
+ cloneNode = $(this).parent().clone();
+ var LI = $(this).parent();
+ if(TREE.option.drag)
+ {
+ $('>ul', cloneNode).hide();
+ $('body').append('<div id="drag_container"><ul></ul></div>');
+ $('#drag_container').hide().css({opacity:'0.8'});
+ $('#drag_container >ul').append(cloneNode);
+ $("<img>").attr({id : "tree_plus",src : "/media/cms/images/simpletree/plus.gif"}).css({width: "7px",display: "block",position: "absolute",left : "5px",top: "5px", display:'none'}).appendTo("body");
+ $(document).bind("mousemove", {LI:LI}, TREE.dragStart).bind("mouseup",TREE.dragEnd);
+ }
+ return false;
+ }).mouseup(function(){
+ if(mousePressed && mouseMoved && dragNode_source)
+ {
+ TREE.moveNodeToFolder($(this).parent());
+ }
+ TREE.eventDestroy();
+ });
+ $('li', obj).each(function(i){
+ var className = this.className;
+ var open = false;
+ var cloneNode=false;
+ var LI = this;
+ var childNode = $('>ul',this);
+ if(childNode.size()>0){
+ var setClassName = 'folder-';
+ if(className && className.indexOf('open')>=0){
+ setClassName=setClassName+'open';
+ open=true;
+ }else{
+ setClassName=setClassName+'close';
+ }
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
+
+ if(!open || className.indexOf('ajax')>=0)childNode.hide();
+
+ TREE.setTrigger(this);
+ }else{
+ var setClassName = 'doc';
+ this.className = setClassName + ($(this).is(':last-child')? '-last':'');
+ }
+ }).before('<li class="line">&nbsp;</li>')
+ .filter(':last-child').after('<li class="line-last"></li>');
+ TREE.setEventLine($('.line, .line-last', obj));
+ };
+ TREE.setTrigger = function(node){
+ $('>span',node).before('<img class="trigger" src="/media/cms/images/simpletree/spacer.gif" border=0>');
+ var trigger = $('>.trigger', node);
+ trigger.click(function(event){
+ TREE.nodeToggle(node);
+ });
+ if(!$.browser.msie)
+ {
+ trigger.css('float','left');
+ }
+ };
+ TREE.dragStart = function(event){
+ var LI = $(event.data.LI);
+ if(mousePressed)
+ {
+ mouseMoved = true;
+ if(dragDropTimer) clearTimeout(dragDropTimer);
+ if($('#drag_container:not(:visible)')){
+ $('#drag_container').show();
+ LI.prev('.line').hide();
+ dragNode_source = LI;
+ }
+ $('#drag_container').css({position:'absolute', "left" : (event.pageX + 5), "top": (event.pageY + 15) });
+ if(LI.is(':visible'))LI.hide();
+ var temp_move = false;
+ if(event.target.tagName.toLowerCase()=='span' && $.inArray(event.target.className, Array('text','active','trigger'))!= -1)
+ {
+ var parent = event.target.parentNode;
+ var offs = $(parent).offset({scroll:false});
+ var screenScroll = {x : (offs.left - 3),y : event.pageY - offs.top};
+ var isrc = $("#tree_plus").attr('src');
+ var ajaxChildSize = $('>ul.ajax',parent).size();
+ var ajaxChild = $('>ul.ajax',parent);
+ screenScroll.x += 19;
+ screenScroll.y = event.pageY - screenScroll.y + 5;
+
+ if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize==0)
+ {
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','/media/cms/images/simpletree/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ dragDropTimer = setTimeout(function(){
+ parent.className = parent.className.replace('close','open');
+ $('>ul',parent).show();
+ }, 700);
+ }else if(parent.className.indexOf('folder')>=0 && ajaxChildSize==0){
+ if(isrc.indexOf('minus')!=-1)$("#tree_plus").attr('src','/media/cms/images/simpletree/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ }else if(parent.className.indexOf('folder-close')>=0 && ajaxChildSize>0)
+ {
+ mouseMoved = false;
+ $("#tree_plus").attr('src','/media/cms/images/simpletree/minus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+
+ $('>ul',parent).show();
+ /*
+ Thanks for the idea of Erik Dohmen
+ */
+ TREE.setAjaxNodes(ajaxChild,parent.id, function(){
+ parent.className = parent.className.replace('close','open');
+ mouseMoved = true;
+ $("#tree_plus").attr('src','/media/cms/images/simpletree/plus.gif');
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ });
+
+ }else{
+ if(TREE.option.docToFolderConvert)
+ {
+ $("#tree_plus").css({"left": screenScroll.x, "top": screenScroll.y}).show();
+ }else{
+ $("#tree_plus").hide();
+ }
+ }
+ }else{
+ $("#tree_plus").hide();
+ }
+ return false;
+ }
+ return true;
+ };
+ TREE.dragEnd = function(){
+ if(dragDropTimer) clearTimeout(dragDropTimer);
+ TREE.eventDestroy();
+ };
+ TREE.setEventLine = function(obj){
+ obj.mouseover(function(){
+ if(this.className.indexOf('over')<0 && mousePressed && mouseMoved)
+ {
+ this.className = this.className.replace('line','line-over');
+ }
+ }).mouseout(function(){
+ if(this.className.indexOf('over')>=0)
+ {
+ this.className = this.className.replace('-over','');
+ }
+ }).mouseup(function(){
+ if(mousePressed && dragNode_source && mouseMoved)
+ {
+ dragNode_destination = $(this).parents('li:first');
+ TREE.moveNodeToLine(this);
+ TREE.eventDestroy();
+ }
+ });
+ };
+ TREE.checkNodeIsLast = function(node)
+ {
+ if(node.className.indexOf('last')>=0)
+ {
+ var prev_source = dragNode_source.prev().prev();
+ if(prev_source.size()>0)
+ {
+ prev_source[0].className+='-last';
+ }
+ node.className = node.className.replace('-last','');
+ }
+ };
+ TREE.checkLineIsLast = function(line)
+ {
+ if(line.className.indexOf('last')>=0)
+ {
+ var prev = $(line).prev();
+ if(prev.size()>0)
+ {
+ prev[0].className = prev[0].className.replace('-last','');
+ }
+ dragNode_source[0].className+='-last';
+ }
+ };
+ TREE.eventDestroy = function()
+ {
+ // added by Erik Dohmen (2BinBusiness.nl), the unbind mousemove TREE.dragStart action
+ // like this other mousemove actions binded through other actions ain't removed (use it myself
+ // to determine location for context menu)
+ $(document).unbind('mousemove',TREE.dragStart).unbind('mouseup').unbind('mousedown');
+ $('#drag_container, #tree_plus').remove();
+ if(dragNode_source)
+ {
+ $(dragNode_source).show().prev('.line').show();
+ }
+ dragNode_destination = dragNode_source = mousePressed = mouseMoved = false;
+ //ajaxCache = Array();
+ };
+ TREE.convertToFolder = function(node){
+ node[0].className = node[0].className.replace('doc','folder-open');
+ node.append('<ul><li class="line-last"></li></ul>');
+ TREE.setTrigger(node[0]);
+ TREE.setEventLine($('.line, .line-last', node));
+ };
+ TREE.convertToDoc = function(node){
+ $('>ul', node).remove();
+ $('img', node).remove();
+ node[0].className = node[0].className.replace(/folder-(open|close)/gi , 'doc');
+ };
+ TREE.moveNodeToFolder = function(node)
+ {
+ if(!TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1)
+ {
+ return true;
+ }else if(TREE.option.docToFolderConvert && node[0].className.indexOf('doc')!=-1){
+ TREE.convertToFolder(node);
+ }
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ var lastLine = $('>ul >.line-last', node);
+ if(lastLine.size()>0)
+ {
+ TREE.moveNodeToLine(lastLine[0]);
+ }
+ };
+ TREE.moveNodeToLine = function(node){
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ TREE.checkLineIsLast(node);
+ var parent = $(dragNode_source).parents('li:first');
+ var line = $(dragNode_source).prev('.line');
+ $(node).before(dragNode_source);
+ $(dragNode_source).before(line);
+ node.className = node.className.replace('-over','');
+ var nodeSize = $('>ul >li', parent).not('.line, .line-last').filter(':visible').size();
+ if(TREE.option.docToFolderConvert && nodeSize==0)
+ {
+ TREE.convertToDoc(parent);
+ }else if(nodeSize==0)
+ {
+ parent[0].className=parent[0].className.replace('open','close');
+ $('>ul',parent).hide();
+ }
+
+ // added by Erik Dohmen (2BinBusiness.nl) select node
+ if($('span:first',dragNode_source).attr('class')=='text')
+ {
+ $('.active',TREE).attr('class','text');
+ $('span:first',dragNode_source).attr('class','active');
+ }
+
+ if(typeof(TREE.option.afterMove) == 'function')
+ {
+ var pos = $(dragNode_source).prevAll(':not(.line)').size();
+ TREE.option.afterMove($(node).parents('li:first'), $(dragNode_source), pos);
+ }
+ };
+
+ TREE.addNode = function(id, text, callback)
+ {
+ var temp_node = $('<li><ul><li id="'+id+'"><span>'+text+'</span></li></ul></li>');
+ TREE.setTreeNodes(temp_node);
+ dragNode_destination = TREE.getSelected();
+ dragNode_source = $('.doc-last',temp_node);
+ TREE.moveNodeToFolder(dragNode_destination);
+ temp_node.remove();
+ if(typeof(callback) == 'function')
+ {
+ callback(dragNode_destination, dragNode_source);
+ }
+ };
+ TREE.delNode = function(callback)
+ {
+ dragNode_source = TREE.getSelected();
+ TREE.checkNodeIsLast(dragNode_source[0]);
+ dragNode_source.prev().remove();
+ dragNode_source.remove();
+ if(typeof(callback) == 'function')
+ {
+ callback(dragNode_destination);
+ }
+ };
+
+ TREE.init = function(obj)
+ {
+ TREE.setTreeNodes(obj, false);
+ };
+ TREE.init(ROOT);
+ });
+}
View
30 cms/templates/admin/cms/page/change_list.html
@@ -20,8 +20,34 @@
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/jquery.ui.droppable.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/jquery.query.js"></script>
-<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/jquery.create.js"></script>
<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/change_list.js"></script>
+
+
+<script type="text/javascript" src="{{ CMS_MEDIA_URL }}javascript/jquery.simple.tree.js"></script>
+<script type="text/javascript">
+var simpleTreeCollection;
+$(document).ready(function(){
+ simpleTreeCollection = $('.simpleTree').simpleTree({
+ autoclose: false,
+ docToFolderConvert: true,
+ afterClick:function(node){
+ //alert("text-"+$('span:first',node).text());
+ },
+ afterDblClick:function(node){
+ //alert("text-"+$('span:first',node).text());
+ },
+ afterMove:function(destination, source, pos){
+ //alert("destination-"+destination.attr('id')+" source-"+source.attr('id')+" pos-"+pos);
+ },
+ afterAjax:function()
+ {
+ //alert('Loaded');
+ },
+ animate:true
+ //,docToFolderConvert:true
+ });
+});
+</script>
{% endblock %}
@@ -58,7 +84,7 @@
<div class="module" id="changelist">
-{% include "admin/cms/page/change_list_table.html" %}
+{% include "admin/cms/page/change_list_simpletree.html" %}
</div>
</div>
View
27 cms/templates/admin/cms/page/change_list_simpletree.html
@@ -0,0 +1,27 @@
+{% load i18n pages_tags %}
+
+<div id="sitemap">
+<ul class="header">
+ <li>
+ <div class="col-creator">{% trans "creator" %}</div>
+ <div class="col-template">{% trans "template" %}</div>
+ <div class="col-soft">{% trans "softroot" %}</div>
+ <div class="col-navigation">{% trans "in navigation" %}</div>
+ <div class="col-published">{% trans "published" %}</div>
+ <div class="col-actions">{% trans "quick actions" %}</div>
+ <div class="col-title">{% trans "title" %}</div>
+ <br class="clear" />
+ </li>
+</ul>
+
+<ul class="simpleTree">
+ <li class="root">
+ <span class="root">Treeroot</span>
+ <ul>
+ {% for page in cl.query_set %}{% show_admin_menu page cl.is_filtered %}{% endfor %}
+ </ul>
+ </li>
+</ul>
+
+<!--<ul class="last">{% for page in cl.query_set %}{% show_admin_menu page cl.is_filtered %}{% endfor %}</ul>-->
+</div>
View
22 cms/templates/admin/cms/page/change_list_table.html
@@ -16,24 +16,4 @@
</li>
</ul>
<ul class="last">{% for page in cl.query_set %}{% show_admin_menu page cl.is_filtered %}{% endfor %}</ul>
-</div>
-
-
-<!--
-<table cellspacing="0" id="page-list">
-<thead>
-<tr>
-<th class="title">{% trans "title" %}</th>
-<th>{% trans "quick actions" %}</th>
-<th>{% trans "published" %}</th>
-<th>{% trans "in navigation" %}</th>
-<th>{% trans "softroot" %}</th>
-<th>{% trans "template" %}</th>
-<th>{% trans "creator" %}</th>
-</tr>
-</thead>
-<tbody>
-
-</tbody>
-</table>
--->
+</div>
View
144 cms/templates/admin/cms/page/menu.html
@@ -1,3 +1,73 @@
+{% load pages_tags i18n adminmedia %}
+
+<li class="{% if children %}open{% endif %}" id="c{{ page.id }}">
+ {% if has_permission %}
+ <span class="row">
+ <div class="col-title">{{ page }}</div>
+
+ <div class="col-creator">
+ {% firstof page.author.get_full_name page.author.first_name page.author.username %}
+ </div>
+ <div class="col-template">
+ {{ page.get_template_name }}
+ </div>
+ <div class="col-soft">
+ {% if page.soft_root %}
+ <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
+ {% else %}
+ <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif"/>
+ {% endif %}
+ </div>
+ <div class="col-navigation">
+ {% if page.in_navigation %}
+ <label>
+ <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
+ <input type="checkbox" class="navigation-checkbox" name="navigation-{{ page.id }}" checked="checked" value="1" />
+ </label>
+ {% else %}
+ <label>
+ <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif" />
+ <input type="checkbox" class="navigation-checkbox" name="navigation-{{ page.id }}" value="0" />
+ </label>
+ {% endif %}
+ </div>
+ <div class="col-published">
+ {% if page.status %}
+ <label>
+ <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
+ {% if has_publish_permission %}
+ <input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" checked="checked" value="1" />
+ {% endif %}
+ </label>
+ {% else %}
+ <label>
+ <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif" />
+ {% if has_publish_permission %}
+ <input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" value="0" />
+ {% endif %}
+ </label>
+ {% endif %}
+ </div>
+ <div class="col-actions">
+ <a href="#" class="move" id="move-link-{{ page.id }}"><span>{% trans "cut" %}</span></a>
+ <a href="{{ page.get_absolute_url }}" class="selector-add"><span>{% trans "view" %}</span></a>
+ <a href="#" class="addlink" id="add-link-{{ page.id }}"><span>{% trans "add" %}</span></a>
+ <a href="{{ page.id }}/delete/" class="deletelink"><span>{% trans "delete" %}</span></a>
+ </div>
+
+
+
+
+
+ <br class="clear" />
+ </span>
+
+
+ {% if children %}<ul>{% for child in children %}{% show_admin_menu child no_children level %}{% endfor %}</ul>{% endif %}
+ {% endif %}
+</li>
+
+{% comment %}
<li{% if page.last %} class="last"{% endif %}>{% load pages_tags i18n adminmedia %}{#%# if has_permission %#}<div class="cont">
<div class="col1">
<div class="info">
@@ -63,76 +133,4 @@
{% endif %}
</div>
<div class="col-template">{{ page.get_template_name }}</div>
-<div class="col-creator">{% firstof page.author.get_full_name page.author.first_name page.author.username %}</div></div></div>{% comment %}
-<tr id="page-row-{{ page.id }}" class="child-of-{{ page.parent.id }}">
-<td {% if level %}style="padding-left:{{level}}em"{% endif %}>
- <div class="row-container">
- <span id="move-target-{{ page.id }}" class="move-target-container" style="display:none;float:right">
- <a href="#" class="move-target left"><img alt="" src="{% admin_media_prefix %}img/admin/arrow-up.gif"/></a> |
- <a href="#" class="move-target right"><img alt="" src="{% admin_media_prefix %}img/admin/arrow-down.gif"/></a></a> |
- <a href="#" class="move-target first-child">↘</a>
- </span>
- <a href="#" {% ifequal 0 page.children.all.count %}style="display: none"{% endifequal %} id="c{{ page.id }}" class="collapse">{% if not no_children %}
- <span class="collapsed">+</span>
- <span>-</span>{% endif %}
- </a>
- <a href="{{ url }}{{ page.id }}/" class="changelink" style="margin-right:1em;">{{ page.get_slug }}</a>
- <span class="language-container">
- {% for lang in page.get_languages %}
- <a href="{{ url }}{{ page.id }}/?language={{ lang }}" class="changelink">{{ lang }}</a>
- <span style="font-weight:normal">{% if not forloop.last %}|{% endif %}</span>
- {% endfor %}
- </span>
- </div>
-</td>
-<td class="actions">
- <a href="#" class="move" id="move-link-{{ page.id }}"><span>{% trans "cut" %}</span></a> |
- <a href="{{ page.get_absolute_url }}" class="selector-add"><span>{% trans "view" %}</span></a> |
- <a href="#" class="addlink" id="add-link-{{ page.id }}"><span>{% trans "add" %}</span></a> |
- <a href="{{ page.id }}/delete/" class="deletelink"><span>{% trans "delete" %}</span</a>
-</td>
-
-<td>
-{% if page.status %}
- <label>
- <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
- {% if has_publish_permission %}
- <input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" checked="checked" value="1" />
- {% endif %}
- </label>
-{% else %}
- <label>
- <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif" />
- {% if has_publish_permission %}
- <input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" value="0" />
- {% endif %}
- </label>
-{% endif %}
-</td>
-<td>
-{% if page.in_navigation %}
- <label>
- <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
- <input type="checkbox" class="navigation-checkbox" name="navigation-{{ page.id }}" checked="checked" value="1" />
- </label>
-{% else %}
- <label>
- <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif" />
- <input type="checkbox" class="navigation-checkbox" name="navigation-{{ page.id }}" value="0" />
- </label>
-{% endif %}
-</td>
-<td>
-{% if page.soft_root %}
- <label>
- <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
- </label>
-{% endif %}
-</td>
-<td>
-{{ page.get_template }}
-</td>
-<td>
-{% firstof page.author.get_full_name page.author.first_name page.author.username %}
-</td>
-</tr>{#% endif %#}{% endcomment %}{% if children %}<ul{% if page.last %} class="last"{% endif %}>{% for child in children %}{% show_admin_menu child no_children level %}{% endfor %}</ul>{% endif %}</li>
+<div class="col-creator">{% firstof page.author.get_full_name page.author.first_name page.author.username %}</div></div></div>{% if children %}<ul{% if page.last %} class="last"{% endif %}>{% for child in children %}{% show_admin_menu child no_children level %}{% endfor %}</ul>{% endif %}</li>{% endcomment %}
View
1 cms/templatetags/pages_tags.py
@@ -148,6 +148,7 @@ def show_admin_menu(context, page, no_children=False, level=None):
children = page.childrens
else:
children = []
+ page.root_node = True
if not no_children:
pages = Page.objects.filter(tree_id=page.tree_id, level__gt=page.level).order_by('tree_id', 'parent', 'lft')
if settings.CMS_PERMISSION:

0 comments on commit 6c61f4a

Please sign in to comment.
Something went wrong with that request. Please try again.