Changeset 27010
- Timestamp:
- 2013-03-05T16:36:03+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js
r27009 r27010 18 18 var _selectedElement; 19 19 20 var _overTrash = false; 21 20 22 var _validDropSpot = false; 21 23 var _validDropType; … … 156 158 157 159 return true; 160 } 161 162 var placeTrashBin = function() 163 { 164 var bin = $("<div id=\"veTrash\">Trash</div>"); 165 bin.addClass("ui-state-default"); 166 bin.addClass("ui-corner-all"); 167 bin.droppable( 168 { 169 "over":function() 170 { 171 _overTrash = true; 172 }, 173 "out":function() 174 { 175 _overTrash = false; 176 } 177 }); 178 _editorContainer.append(bin); 158 179 } 159 180 … … 445 466 446 467 populateToolbar(); 468 placeTrashBin(); 447 469 448 470 _editorContainer.append(_editorDiv); … … 451 473 _mainDiv.append($("<div>", {"id":"veSpacerDiv"})); 452 474 _mainDiv.append(_infoDiv); 453 _mainDiv.append($("<div>", {"style":"clear:both;"})); 475 _mainDiv.append($("<div>", {"style":"clear:both;"})); 454 476 } 455 477 … … 638 660 "start":function(event, ui) 639 661 { 662 _overTrash = false; 640 663 _origDDParent = _div.parent(); 641 664 _origDDPosition = _div.index(); … … 746 769 _div.css("border", "1px dashed black"); 747 770 _div.css("background", _div.data("prevBackground")); 748 771 749 772 //If the element was not dropped in a valid place then put it back 750 773 if(!_validDropSpot) … … 762 785 { 763 786 _origDDParent.children(".veElement").eq(_origDDPosition).before(_div); 787 } 788 789 if(_overTrash) 790 { 791 _div.data("parentVEElement").remove(); 792 return; 764 793 } 765 794 … … 916 945 removeButton.click(function() 917 946 { 918 var divParent = _div.parents(".veElement"); 919 _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div}); 920 _div.data("expanded", "normal"); 921 $(_xmlNode).remove(); 922 _div.detach(); 923 _infoDiv.empty(); 924 925 if(divParent.length) 926 { 927 divParent.first().trigger("click"); 928 } 947 _div.data("parentVEElement").remove(); 929 948 }); 949 } 950 951 this.remove = function() 952 { 953 var divParent = _div.parents(".veElement"); 954 _transactions.push({type:"remMvElem", vElemParent:_div.parent(), vElemPos:_div.index(), vElem:_div}); 955 _div.data("expanded", "normal"); 956 $(_xmlNode).remove(); 957 _div.detach(); 958 _infoDiv.empty(); 959 960 if(divParent.length) 961 { 962 divParent.first().trigger("click"); 963 } 930 964 } 931 965
Note:
See TracChangeset
for help on using the changeset viewer.