From 6078fe75dc8385abe17c46bfdf971578b3843062 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 18 Nov 2008 21:32:01 +0000 Subject: [PATCH] BUGFIX #118 - Fixed count of marked pages (hamish) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@66162 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/CMSMain_left.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/javascript/CMSMain_left.js b/javascript/CMSMain_left.js index 7b57f8fa..0b256432 100755 --- a/javascript/CMSMain_left.js +++ b/javascript/CMSMain_left.js @@ -240,8 +240,7 @@ batchActionGlobals = { }, getCsvIds : function() { - var csvIDs = ""; - batchActionGlobals.count = 0; + var csvIDs = new Array(); var st = $('sitetree'); batchActionGlobals.newNodes = new Array(); for(var idx in batchActionGlobals.selectedNodes) { @@ -253,15 +252,18 @@ batchActionGlobals = { } else { var i, item, childrenTopublish = st.getTreeNodeByIdx(idx).getElementsByTagName('li'); for(i=0;item=childrenTopublish[i];i++) { - csvIDs += (csvIDs ? "," : "") + st.getIdxOf(childrenTopublish[i]); - batchActionGlobals.count++; + if(csvIDs.indexOf(st.getIdxOf(childrenTopublish[i])) == -1) { + csvIDs.push(st.getIdxOf(childrenTopublish[i])); + } + } + if(csvIDs.indexOf(idx) == -1) { + csvIDs.push(idx); } - csvIDs += (csvIDs ? "," : "") + idx; - batchActionGlobals.count++; } } } - return csvIDs; + batchActionGlobals.count=csvIDs.length; + return (csvIDs.toString()); }, unfilterSiteTree : function() { // Reload the site tree if it has been filtered