return target;
}
-FolderDDropControler = function(listing, firstItemPos) {
+FolderDDropControler = function(listing, orderable, firstItemPos) {
this.folderUrl = document.getElementById("FolderUrl").innerHTML;
this.targetRow = null;
this.lastOverPosition = null;
this._updatePositions();
this.lastCBChecked = undefined;
var thisControler = this;
- this.listing.onmousedown = function(evt) {thisControler.drag(evt);};
- this.listing.onmouseover = function(evt) {thisControler.moveRow(evt);};
- this.listing.onmouseup = function(evt) {thisControler.drop(evt);};
- addListener(this.listing, 'click', function(evt) {thisControler.disableClickAfterDrop(evt);});
+ if (orderable) {
+ this.listing.onmousedown = function(evt) {thisControler.drag(evt);};
+ this.listing.onmouseover = function(evt) {thisControler.moveRow(evt);};
+ this.listing.onmouseup = function(evt) {thisControler.drop(evt);};
+ addListener(this.listing, 'click', function(evt) {thisControler.disableClickAfterDrop(evt);});
+ }
addListener(this.listing, 'click', function(evt) {thisControler.selectCBRange(evt);});
if (browser.isIE) {
</div>
<script type="text/javascript">
(function(){
- // variables for drag-and-drop ordered support
- var ddEnabled = false
- try {
- var firstItemPos = parseInt(document.getElementById("FirstItemPos").innerHTML);
- ddEnabled = true;
- }
- catch (e) {}
-
- var topNavBatchBar = document.getElementById("topNavBatchBar");
- var bottomNavBatchBar = document.getElementById("bottomNavBatchBar");
+ // ordering / selecting
+ var firsItemPosElement = document.getElementById('FirstItemPos');
var listing = document.getElementById("FolderListingBody");
-
- if (ddEnabled) {
- var fDDcontroler = new FolderDDropControler(listing, firstItemPos);
- var topNavBatchBar = document.getElementById("topNavBatchBar");
- var bottomNavBatchBar = document.getElementById("bottomNavBatchBar");
+ var orderable = firsItemPosElement ? true : false;
+ var firstItemPos = orderable ? parseInt(firsItemPosElement.innerHTML, 10) : 1;
+ var fDDcontroler = new FolderDDropControler(listing, orderable, firstItemPos);
+ var topNavBatchBar, bottomNavBatchBar;
+ if (orderable) {
+ topNavBatchBar = document.getElementById("topNavBatchBar");
+ bottomNavBatchBar = document.getElementById("bottomNavBatchBar");
if (topNavBatchBar && bottomNavBatchBar) {
new DropTarget(topNavBatchBar, fDDcontroler);
new DropTarget(bottomNavBatchBar, fDDcontroler);
}
}
-
-
addListener(document.getElementById("FolderListingHeader"), "click", loadListing);
if (topNavBatchBar && bottomNavBatchBar) {
addListener(topNavBatchBar, "click", loadListing);
addListener(bottomNavBatchBar, "click", loadListing);
}
-
+ // upload by drag and drop
var uploadUrl = absolute_url() + '/put_upload';
- new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, listing);
+ new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, listing);
}());
</script>