Commit ec1a4987 authored by Christophe Dumez's avatar Christophe Dumez

code clean up

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6828 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b23c1849
...@@ -69,274 +69,266 @@ ...@@ -69,274 +69,266 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
if "files" in context.REQUEST.keys():\n if "files" in context.REQUEST.keys():\n
files=context.REQUEST["files"]\n files = context.REQUEST["files"]\n
else:\n else:\n
files=None\n files = None\n
\n \n
print \'\'\'<script>var tree = null;\n print \'\'\'\n
var business_template;\n <script>\n
var is_expanded=false;\n var tree = null;\n
var business_template;\n
var is_expanded=false;\n
var ie = document.all\n
var ns6 = document.getElementById&&!document.all\n
var isMenu = false ;\n
var menuSelObj = null ;\n
var overpopupmenu = false;\n
\n \n
// This script is intended for use with a minimum of Netscape 4 or IE 4.\n // This script is intended for use with a minimum of Netscape 4 or IE 4.\n
if(document.getElementById) {\n if(document.getElementById) {\n
\t var upLevel = true;\n var upLevel = true;\n
\t} else if(document.layers) {\n } else if(document.layers) {\n
\t var ns4 = true;\n var ns4 = true;\n
\t} else if(document.all) {\n } else if(document.all) {\n
\t var ie4 = true;\n var ie4 = true;\n
\t}\n }\n
\n \n
\tfunction preLoadImages(){\n function preLoadImages(){\n
\t\tvar imSrcAr = new \n var imSrcAr = new \n
Array(\'document.png\',\'iconCheckAll.gif\',\'line2.gif\',\'minus2.gif\',\'minus5.gif\',\'plus2.gif\',\'plus5.gif\',\'folder_open.png\',\'iconCheckGray.gif\',\'line3.gif\',\'minus3.gif\',\'minus_ar.gif\',\'plus3.gif\',\'plus_ar.gif\',\'folder.png\',\'line1.gif\',\'line4.gif\',\'minus4.gif\',\'minus.gif\',\'plus4.gif\',\'plus.gif\',\'iconUnCheckAll.gif\', \'blank.gif\')\n Array(\'document.png\',\'iconCheckAll.gif\',\'line2.gif\',\'minus2.gif\',\'minus5.gif\',\'plus2.gif\',\'plus5.gif\',\'folder_open.png\',\'iconCheckGray.gif\',\'line3.gif\',\'minus3.gif\',\'minus_ar.gif\',\'plus3.gif\',\'plus_ar.gif\',\'folder.png\',\'line1.gif\',\'line4.gif\',\'minus4.gif\',\'minus.gif\',\'plus4.gif\',\'plus.gif\',\'iconUnCheckAll.gif\', \'blank.gif\')\n
\t\tvar imAr = new Array(0);\n var imAr = new Array(0);\n
\t\tfor(var i=0;i<imSrcAr.length;i++){\n for(var i=0;i<imSrcAr.length;i++){\n
\t\t\timAr[imAr.length] = new Image();\n imAr[imAr.length] = new Image();\n
\t\t\timAr[imAr.length-1].src = \'imgs/\'+imSrcAr[i]\n imAr[imAr.length-1].src = \'imgs/\'+imSrcAr[i]\n
\t\t}\n }\n
\t}\n }\n
\n \n
\tfunction doOnLoad(){\n function doOnLoad(){\n
\t\tpreLoadImages();\n preLoadImages();\n
\t\t//tree\n tree=new dhtmlXTreeObject(document.getElementById(\'treebox1\'),\'100%%\',\'100%%\',0);\n
\t\ttree=new dhtmlXTreeObject(document.getElementById(\'treebox1\'),\'100%%\',\'100%%\',0);\n tree.setImagePath(\'imgs/\');\n
\t\ttree.setImagePath(\'imgs/\');\n tree.setDragHandler();\n
\t\ttree.setDragHandler();\n tree.enableCheckBoxes(true)\n
\t\ttree.enableCheckBoxes(true)\n tree.enableThreeStateCheckboxes(true);\n
\t\ttree.enableThreeStateCheckboxes(true);\n tree.enableDragAndDrop(false)\n
\t\ttree.enableDragAndDrop(false)\n tree.loadXML(\'tree.xml?bt_id=%s\', hideObject)\n
tree.loadXML(\'tree.xml?bt_id=%s\', hideObject)\n tree.setOnClickHandler(showMenu)\n
//tree.setOnClickHandler(clickHandler)\n }\n
tree.setOnClickHandler(showMenu)\n
}\n
\n \n
function expandCollapse(){\n function expandCollapse(){\n
if(! is_expanded){\n if(! is_expanded){\n
tree.openAllItems(0);\n tree.openAllItems(0);\n
is_expanded=true;\n is_expanded=true;\n
}else{\n }else{\n
tree.closeAllItems(0);\n tree.closeAllItems(0);\n
is_expanded=false;\n is_expanded=false;\n
}\n }\n
}\n }\n
\n \n
function commit(popup, form){\n function commit(popup, form){\n
nbModified=0;\n nbModified=0;\n
nbAdded=0;\n nbAdded=0;\n
nbRemoved=0;\n nbRemoved=0;\n
FilesRemovedArray=[]\n FilesRemovedArray=[]\n
FilesAddedArray=[]\n FilesAddedArray=[]\n
FilesModifiedArray=[]\n FilesModifiedArray=[]\n
if(popup == 1){\n if(popup == 1){\n
//hide popup\n //hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n document.getElementById(\'menudiv\').style.display = "none";\n
filesCheckedArray = [tree.getSelectedItemId()];\n filesCheckedArray = [tree.getSelectedItemId()];\n
filesCheckedArray=filesCheckedArray.concat(tree.getAllSubItems(filesCheckedArray[0]).split(\',\'));\n filesCheckedArray=filesCheckedArray.concat(tree.getAllSubItems(filesCheckedArray[0]).split(\',\'));\n
}else{\n }else{\n
filesCheckedArray=tree.getAllChecked().split(\',\');\n filesCheckedArray=tree.getAllChecked().split(\',\');\n
}\n }\n
for(i=0;i<filesCheckedArray.length; ++i){\n for(i=0;i<filesCheckedArray.length; ++i){\n
if(tree.getItemColor(filesCheckedArray[i])==\'red\'){\n if(tree.getItemColor(filesCheckedArray[i])==\'red\'){\n
FilesRemovedArray[nbRemoved++]=filesCheckedArray[i];\n FilesRemovedArray[nbRemoved++]=filesCheckedArray[i];\n
}else{\n }else{\n
if(tree.getItemColor(filesCheckedArray[i])==\'green\'){\n if(tree.getItemColor(filesCheckedArray[i])==\'green\'){\n
FilesAddedArray[nbAdded++]=filesCheckedArray[i];\n FilesAddedArray[nbAdded++]=filesCheckedArray[i];\n
}else\n }else\n
if(tree.getItemColor(filesCheckedArray[i])==\'orange\'){\n if(tree.getItemColor(filesCheckedArray[i])==\'orange\'){\n
FilesModifiedArray[nbModified++]=filesCheckedArray[i];\n FilesModifiedArray[nbModified++]=filesCheckedArray[i];\n
}\n
}\n
}\n
partialToCommit=tree.getAllPartiallyChecked();\n
if(nbModified!=0){\n
filesModified=FilesModifiedArray.join(\',\');\n
if(partialToCommit!=\'\'){\n
filesModified=filesModified+\',\'+partialToCommit\n
}\n
}else{\n
filesModified=\'none\'\n
if(partialToCommit!=\'\'){\n
filesModified=partialToCommit\n
}\n
}\n
form.modified.value=filesModified;\n
if(nbAdded!=0){\n
filesAdded=FilesAddedArray.join(\',\');\n
}else{\n
filesAdded=\'none\'\n
}\n
form.added.value=filesAdded;\n
if(nbRemoved!=0){\n
filesRemoved=FilesRemovedArray.join(\',\');\n
}else{\n
filesRemoved=\'none\'\n
}\n
form.removed.value=filesRemoved;\n
if (nbRemoved==0 && nbAdded==0 && nbModified==0) {\n
alert(\'Nothing to commit !\');\n
} else {\n
submitAction(form,\'%s/BusinessTemplate_doSvnCommit\');\n
}\n }\n
}\n }\n
}\n
partialToCommit=tree.getAllPartiallyChecked();\n
if(nbModified!=0){\n
filesModified=FilesModifiedArray.join(\',\');\n
if(partialToCommit!=\'\'){\n
filesModified=filesModified+\',\'+partialToCommit\n
}\n
}else{\n
filesModified=\'none\'\n
if(partialToCommit!=\'\'){\n
filesModified=partialToCommit\n
}\n
}\n
form.modified.value=filesModified;\n
if(nbAdded!=0){\n
filesAdded=FilesAddedArray.join(\',\');\n
}else{\n
filesAdded=\'none\'\n
}\n
form.added.value=filesAdded;\n
if(nbRemoved!=0){\n
filesRemoved=FilesRemovedArray.join(\',\');\n
}else{\n
filesRemoved=\'none\'\n
}\n
form.removed.value=filesRemoved;\n
if (nbRemoved==0 && nbAdded==0 && nbModified==0) {\n
alert(\'Nothing to commit !\');\n
} else {\n
submitAction(form,\'%s/BusinessTemplate_doSvnCommit\');\n
}\n
}\n
\n \n
function clickHandler(item_id){\n function viewDiff(popup, form){\n
if (tree.isItemChecked(item_id) == 0) {\n nbModified=0;\n
tree.setCheck(item_id, 1);\n nbAdded=0;\n
}else{\n nbRemoved=0;\n
tree.setCheck(item_id, 0);\n FilesRemovedArray=[]\n
}\n FilesAddedArray=[]\n
}\n FilesModifiedArray=[]\n
\n if(popup == 1){\n
function viewDiff(popup, form){\n //hide popup\n
nbModified=0;\n document.getElementById(\'menudiv\').style.display = "none";\n
nbAdded=0;\n filesCheckedArray = [tree.getSelectedItemId()];\n
nbRemoved=0;\n filesCheckedArray=filesCheckedArray.concat(tree.getAllSubItems(filesCheckedArray[0]).split(\',\'));\n
FilesRemovedArray=[]\n }else{\n
FilesAddedArray=[]\n filesCheckedArray=tree.getAllChecked().split(\',\');\n
FilesModifiedArray=[]\n }\n
if(popup == 1){\n for(i=0;i<filesCheckedArray.length; ++i){\n
//hide popup\n if(tree.getItemColor(filesCheckedArray[i])==\'red\'){\n
document.getElementById(\'menudiv\').style.display = "none";\n FilesRemovedArray[nbRemoved++]=filesCheckedArray[i];\n
filesCheckedArray = [tree.getSelectedItemId()];\n }else{\n
filesCheckedArray=filesCheckedArray.concat(tree.getAllSubItems(filesCheckedArray[0]).split(\',\'));\n if(tree.getItemColor(filesCheckedArray[i])==\'green\'){\n
}else{\n FilesAddedArray[nbAdded++]=filesCheckedArray[i];\n
filesCheckedArray=tree.getAllChecked().split(\',\');\n }else\n
}\n if(tree.getItemColor(filesCheckedArray[i])==\'orange\'){\n
for(i=0;i<filesCheckedArray.length; ++i){\n FilesModifiedArray[nbModified++]=filesCheckedArray[i];\n
if(tree.getItemColor(filesCheckedArray[i])==\'red\'){\n
FilesRemovedArray[nbRemoved++]=filesCheckedArray[i];\n
}else{\n
if(tree.getItemColor(filesCheckedArray[i])==\'green\'){\n
FilesAddedArray[nbAdded++]=filesCheckedArray[i];\n
}else\n
if(tree.getItemColor(filesCheckedArray[i])==\'orange\'){\n
FilesModifiedArray[nbModified++]=filesCheckedArray[i];\n
}\n
}\n
}\n
if(nbModified!=0){\n
filesModified=FilesModifiedArray.join(\',\');\n
}else{\n
filesModified=\'none\'\n
}\n
form.modified.value=filesModified;\n
if(nbAdded!=0){\n
filesAdded=FilesAddedArray.join(\',\');\n
}else{\n
filesAdded=\'none\'\n
}\n
form.added.value=filesAdded;\n
if(nbRemoved!=0){\n
filesRemoved=FilesRemovedArray.join(\',\');\n
}else{\n
filesRemoved=\'none\'\n
}\n
form.removed.value=filesRemoved;\n
if (nbRemoved==0 && nbAdded==0 && nbModified==0) {\n
alert(\'Nothing to diff !\');\n
} else {\n
submitAction(form,\'%s/BusinessTemplate_viewSvnDiff\');\n
}\n }\n
}\n }\n
}\n
if(nbModified!=0){\n
filesModified=FilesModifiedArray.join(\',\');\n
}else{\n
filesModified=\'none\'\n
}\n
form.modified.value=filesModified;\n
if(nbAdded!=0){\n
filesAdded=FilesAddedArray.join(\',\');\n
}else{\n
filesAdded=\'none\'\n
}\n
form.added.value=filesAdded;\n
if(nbRemoved!=0){\n
filesRemoved=FilesRemovedArray.join(\',\');\n
}else{\n
filesRemoved=\'none\'\n
}\n
form.removed.value=filesRemoved;\n
if (nbRemoved==0 && nbAdded==0 && nbModified==0) {\n
alert(\'Nothing to diff !\');\n
} else {\n
submitAction(form,\'%s/BusinessTemplate_viewSvnDiff\');\n
}\n
}\n
\n \n
var ie = document.all\n function mouseSelect(e)\n
var ns6 = document.getElementById&&!document.all\n
var isMenu = false ;\n
var menuSelObj = null ;\n
var overpopupmenu = false;\n
function mouseSelect(e)\n
{\n
var obj = ns6 ? e.target.parentNode : event.srcElement.parentElement;\n
if( isMenu )\n
{\n
if( overpopupmenu == false )\n
{\n {\n
isMenu = false ;\n var obj = ns6 ? e.target.parentNode : event.srcElement.parentElement;\n
overpopupmenu = false;\n if( isMenu )\n
document.getElementById(\'menudiv\').style.display = "none" ;\n {\n
if( overpopupmenu == false )\n
{\n
isMenu = false ;\n
overpopupmenu = false;\n
document.getElementById(\'menudiv\').style.display = "none" ;\n
}\n
}\n
return true;\n
}\n }\n
}\n
return true;\n
}\n
\n \n
function showMenu()\n function showMenu()\n
{\n {\n
document.getElementById(\'menudiv\').style.left = mouseX;\n document.getElementById(\'menudiv\').style.left = mouseX;\n
document.getElementById(\'menudiv\').style.top = mouseY;\n document.getElementById(\'menudiv\').style.top = mouseY;\n
document.getElementById(\'menudiv\').style.display = "";\n document.getElementById(\'menudiv\').style.display = "";\n
document.getElementById(\'item1\').style.backgroundColor=\'#FFFFFF\';\n document.getElementById(\'item1\').style.backgroundColor=\'#FFFFFF\';\n
document.getElementById(\'item2\').style.backgroundColor=\'#FFFFFF\';\n document.getElementById(\'item2\').style.backgroundColor=\'#FFFFFF\';\n
document.getElementById(\'item3\').style.backgroundColor=\'#FFFFFF\';\n document.getElementById(\'item3\').style.backgroundColor=\'#FFFFFF\';\n
isMenu = true;\n isMenu = true;\n
return false ;\n return false ;\n
}\n }\n
\n \n
function getMouse(e)\n function getMouse(e)\n
{\n {\n
if(overpopupmenu){\n if(overpopupmenu){\n
document.body.style.cursor = \'default\';\n document.body.style.cursor = \'default\';\n
}\n }\n
if (ns6)\n if (ns6)\n
{\n {\n
mouseX = e.clientX+window.pageXOffset+\'px\';\n mouseX = e.clientX+window.pageXOffset+\'px\';\n
mouseY = e.clientY+window.pageYOffset+\'px\';\n mouseY = e.clientY+window.pageYOffset+\'px\';\n
} else\n } else\n
{\n {\n
mouseX = event.clientX+document.body.scrollLeft+\'px\';\n mouseX = event.clientX+document.body.scrollLeft+\'px\';\n
mouseY = event.clientY+document.body.scrollTop+\'px\';\n mouseY = event.clientY+document.body.scrollTop+\'px\';\n
}\n }\n
return true;\n return true;\n
}\n }\n
\n \n
document.onmousedown = mouseSelect;\n document.onmousedown = mouseSelect;\n
document.onmousemove = getMouse;\n document.onmousemove = getMouse;\n
\n \n
function revert(popup,form){\n function revert(popup,form){\n
if(popup==1){\n if(popup==1){\n
//hide popup\n //hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n document.getElementById(\'menudiv\').style.display = "none";\n
to_revert = tree.getSelectedItemId();\n to_revert = tree.getSelectedItemId();\n
sub = tree.getAllSubItems(to_revert);\n sub = tree.getAllSubItems(to_revert);\n
if(sub != \'\'){\n if(sub != \'\'){\n
to_revert = to_revert + \',\' + sub;\n to_revert = to_revert + \',\' + sub;\n
}\n
}else{\n
to_revert = tree.getAllChecked();\n
}\n
if (to_revert == \'\') {\n
alert("Nothing to revert !");\n
} else {\n
if(confirm(\'Are you sure you want to revert changes?\')){\n
form.files.value=to_revert;\n
submitAction(form,\'%s/BusinessTemplate_doSvnRevert\');\n
}\n
}\n
}\n }\n
\n }else{\n
function update(){\n to_revert = tree.getAllChecked();\n
open(\'%s/BusinessTemplate_doSvnUpdate\', \'_self\');\n }\n
if (to_revert == \'\') {\n
alert("Nothing to revert !");\n
} else {\n
if(confirm(\'Are you sure you want to revert changes?\')){\n
form.files.value=to_revert;\n
submitAction(form,\'%s/BusinessTemplate_doSvnRevert\');\n
}\n }\n
}\n
}\n
\n \n
function infos(){\n function update(){\n
open(\'%s/BusinessTemplate_doSvnInfo\', \'_self\');\n open(\'%s/BusinessTemplate_doSvnUpdate\', \'_self\');\n
}\n }\n
\n \n
function cleanup(){\n function infos(){\n
open(\'%s/BusinessTemplate_doSvnCleanup\', \'_self\');\n open(\'%s/BusinessTemplate_doSvnInfo\', \'_self\');\n
}\n }\n
\n \n
function log(){\n function cleanup(){\n
//hide popup\n open(\'%s/BusinessTemplate_doSvnCleanup\', \'_self\');\n
document.getElementById(\'menudiv\').style.display = "none";\n }\n
open(\'%s/BusinessTemplate_viewSvnLog?file=\'+tree.getSelectedItemId(), \'_self\');\n
}\n
\n \n
function ls(){\n function log(){\n
//hide popup\n //hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n document.getElementById(\'menudiv\').style.display = "none";\n
open(\'%s/BusinessTemplate_doSvnLs?file=\'+tree.getSelectedItemId(), \'_self\');\n open(\'%s/BusinessTemplate_viewSvnLog?file=\'+tree.getSelectedItemId(), \'_self\');\n
}\n }\n
</script>\n \n
function ls(){\n
//hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n
open(\'%s/BusinessTemplate_doSvnLs?file=\'+tree.getSelectedItemId(), \'_self\');\n
}\n
</script>\n
\'\'\'% (context.getId(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url())\n \'\'\'% (context.getId(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url(), context.absolute_url())\n
\n \n
return printed\n return printed\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment