| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package com.xpn.xwiki.web; |
| 21 |
|
|
| 22 |
|
import com.xpn.xwiki.XWikiContext; |
| 23 |
|
import com.xpn.xwiki.XWikiException; |
| 24 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
| 25 |
|
import com.xpn.xwiki.util.Util; |
| 26 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.38 |
|
| 27 |
|
public class ResetVersionsAction extends XWikiAction |
| 28 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 5 |
Complexity Density: 0.31 |
|
| 29 |
0 |
@Override... |
| 30 |
|
public boolean action(XWikiContext context) throws XWikiException |
| 31 |
|
{ |
| 32 |
0 |
XWikiRequest request = context.getRequest(); |
| 33 |
0 |
XWikiResponse response = context.getResponse(); |
| 34 |
0 |
XWikiDocument doc = context.getDoc(); |
| 35 |
0 |
String language = Util.normalizeLanguage(context.getRequest().getParameter("language")); |
| 36 |
|
|
| 37 |
0 |
String confirm = request.getParameter("confirm"); |
| 38 |
0 |
if ((confirm != null) && (confirm.equals("1"))) { |
| 39 |
|
|
| 40 |
0 |
if (!csrfTokenCheck(context)) { |
| 41 |
0 |
return false; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
0 |
XWikiDocument tdoc = getTranslatedDocument(doc, language, context); |
| 45 |
|
|
| 46 |
0 |
tdoc.resetArchive(context); |
| 47 |
0 |
return true; |
| 48 |
|
} else { |
| 49 |
0 |
String redirect = Utils.getRedirect(request, null); |
| 50 |
0 |
if (redirect == null) { |
| 51 |
0 |
return true; |
| 52 |
|
} else { |
| 53 |
0 |
sendRedirect(response, redirect); |
| 54 |
0 |
return false; |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
} |
| 58 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 59 |
0 |
@Override... |
| 60 |
|
public String render(XWikiContext context) throws XWikiException |
| 61 |
|
{ |
| 62 |
0 |
XWikiRequest request = context.getRequest(); |
| 63 |
0 |
String confirm = request.getParameter("confirm"); |
| 64 |
0 |
if ((confirm != null) && (confirm.equals("1"))) { |
| 65 |
0 |
return "resetversionsdone"; |
| 66 |
|
} else { |
| 67 |
0 |
return "resetversions"; |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
} |