Commit 0c24defa authored by Christophe Dumez's avatar Christophe Dumez

Improved revert but revert added files still needs improvements

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6995 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bf8ad555
...@@ -196,6 +196,61 @@ print \'\'\'\n ...@@ -196,6 +196,61 @@ print \'\'\'\n
submitAction(form,\'%s/BusinessTemplate_doSvnCommit\');\n submitAction(form,\'%s/BusinessTemplate_doSvnCommit\');\n
}\n }\n
}\n }\n
\n
\n
function revert(popup,form){\n
nbModified=0;\n
nbAdded=0;\n
nbRemoved=0;\n
FilesRemovedArray=[];\n
FilesAddedArray=[];\n
FilesModifiedArray=[];\n
if(popup == 1){\n
//hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n
filesCheckedArray = [tree.getSelectedItemId()];\n
filesCheckedArray=filesCheckedArray.concat(tree.getAllSubItems(filesCheckedArray[0]).split(\',\'));\n
}else{\n
filesCheckedArray=tree.getAllChecked().split(\',\');\n
}\n
for(i=0;i<filesCheckedArray.length; ++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 revert !");\n
} else {\n
if(confirm(\'Are you sure you want to revert changes?\')){\n
submitAction(form,\'%s/BusinessTemplate_doSvnRevert\');\n
}\n
}\n
}\n
\n \n
function viewDiff(popup, form){\n function viewDiff(popup, form){\n
nbModified=0;\n nbModified=0;\n
...@@ -295,28 +350,6 @@ print \'\'\'\n ...@@ -295,28 +350,6 @@ print \'\'\'\n
\n \n
document.onmousedown = mouseSelect;\n document.onmousedown = mouseSelect;\n
document.onmousemove = getMouse;\n document.onmousemove = getMouse;\n
\n
function revert(popup,form){\n
if(popup==1){\n
//hide popup\n
document.getElementById(\'menudiv\').style.display = "none";\n
to_revert = tree.getSelectedItemId();\n
sub = tree.getAllSubItems(to_revert);\n
if(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
function update(){\n function update(){\n
open(\'%s/BusinessTemplate_doSvnUpdate\', \'_self\');\n open(\'%s/BusinessTemplate_doSvnUpdate\', \'_self\');\n
......
...@@ -66,14 +66,26 @@ ...@@ -66,14 +66,26 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if files != \'none\' and files !=\'\':\n <value> <string>if modified != \'\' and modified != \'none\':\n
to_revert = files.split(\',\')\n other_files = modified.split(\',\')\n
if removed != \'\' and removed != \'none\':\n
other_files.extend(removed.split(\',\'))\n
else:\n else:\n
if removed != \'\' and removed != \'none\':\n
other_files = removed.split(\',\')\n
else :\n
other_files = None\n
\n
if added != \'\' and added != \'none\':\n
added_files = added.split(\',\')\n
else:\n
added_files = None\n
\n
if not added_files and not other_files:\n
context.REQUEST.set(\'portal_status_message\', \'Nothing to revert.\')\n context.REQUEST.set(\'portal_status_message\', \'Nothing to revert.\')\n
return context.BusinessTemplate_viewSvnStatus()\n return context.BusinessTemplate_viewSvnStatus()\n
\n \n
if to_revert != \'none\' and to_revert != \'\':\n context.getPortalObject()["portal_subversion"].revertZODB(bt=context, added_files=added_files, other_files=other_files)\n
context.getPortalObject()["portal_subversion"].revert(path=to_revert, bt=context)\n
\n \n
context.REQUEST.set(\'portal_status_message\', \'Changes reverted successfully.\')\n context.REQUEST.set(\'portal_status_message\', \'Changes reverted successfully.\')\n
return context.BusinessTemplate_viewSvnStatus()\n return context.BusinessTemplate_viewSvnStatus()\n
...@@ -91,7 +103,7 @@ return context.BusinessTemplate_viewSvnStatus()\n ...@@ -91,7 +103,7 @@ return context.BusinessTemplate_viewSvnStatus()\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>files</string> </value> <value> <string>added=\'\',modified=\'\',removed=\'\',**kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -111,15 +123,20 @@ return context.BusinessTemplate_viewSvnStatus()\n ...@@ -111,15 +123,20 @@ return context.BusinessTemplate_viewSvnStatus()\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>files</string> <string>added</string>
<string>modified</string>
<string>removed</string>
<string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>to_revert</string> <string>other_files</string>
<string>None</string>
<string>added_files</string>
<string>context</string> <string>context</string>
<string>_getitem_</string> <string>_getitem_</string>
</tuple> </tuple>
...@@ -133,7 +150,11 @@ return context.BusinessTemplate_viewSvnStatus()\n ...@@ -133,7 +150,11 @@ return context.BusinessTemplate_viewSvnStatus()\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<string></string>
<string></string>
<string></string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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