1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.ginp.commands;
20
21 import net.sf.ginp.CommandParameter;
22 import net.sf.ginp.GinpModel;
23 import net.sf.ginp.config.Configuration;
24
25 import java.util.Vector;
26 /**
27 * Class to collect and write folder and picture data to xml data files.
28 *
29 *@author Doug Culnane
30 *@version $Revision: 287 $
31 */
32 public class SetConfiguration implements Command {
33
34 /**
35 * Description of the Method
36 *
37 *@param model Description of the Parameter
38 *@param params Description of the Parameter
39 */
40 public void action(GinpModel model, Vector params) {
41
42
43 if (model.getUserName().equals("admin")) {
44
45 String adminpassword = "";
46 String adminpasswordrepeat = "";
47
48 Configuration.writeConfig();
49
50 for (int i = 0; i < params.size(); i++) {
51 CommandParameter param = (CommandParameter) params.get(i);
52
53 if (param.getName().equals("thumbsize")) {
54 Configuration.setThumbSize(param.getValue());
55 } else if (param.getName().equals("filmstripthumbsize")) {
56 Configuration.setFilmStripThumbSize(param.getValue());
57 } else if (param.getName().equals("picturepagename")) {
58 Configuration.setPicturePageName(param.getValue());
59 } else if (param.getName().equals("collectionpagename")) {
60 Configuration.setCollectionPageName(param.getValue());
61 } else if (param.getName().equals("characterencoding")) {
62 Configuration.setCharacterEncoding(param.getValue());
63 } else if (param.getName().equals("adminpassword")) {
64 adminpassword = param.getValue();
65 } else if (param.getName().equals("adminpasswordrepeat")) {
66 adminpasswordrepeat = param.getValue();
67 }
68 }
69 if (adminpassword.equals(adminpasswordrepeat)) {
70 if (!(adminpassword.equals(""))) {
71 Configuration.setAdminpassword(adminpassword);
72 }
73 }
74 Configuration.writeConfig();
75 }
76
77
78 model.setCurrentPage("setup2.jsp");
79 }
80 }
81