Subversion Repositories SmartDukaan

Rev

Rev 637 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 637 Rev 650
Line 31... Line 31...
31
	
31
	
32
	private static final long serialVersionUID = 1L;
32
	private static final long serialVersionUID = 1L;
33
	private static Log log = LogFactory.getLog(ShippingController.class);
33
	private static Log log = LogFactory.getLog(ShippingController.class);
34
	Map<String, String[]> reqparams = null;
34
	Map<String, String[]> reqparams = null;
35
	
35
	
36
	private Map<String,String> htmlSnippets;
-
 
37
	private PageManager pageManager = null;
36
	private PageManager pageManager = null;
38
	private long addressId = 0;
37
	private long addressId = 0;
39
	private String errorMsg = "";
38
	private String errorMsg = "";
40
	
39
	
41
	public ShippingController(){
40
	public ShippingController(){
Line 44... Line 43...
44
	}
43
	}
45
	
44
	
46
	 // GET /shipping
45
	 // GET /shipping
47
	 public String index() {
46
	 public String index() {
48
		if(!userinfo.isLoggedIn()){
47
		if(!userinfo.isLoggedIn()){
49
			this.request.getSession().setAttribute("REDIRECT_URL", this.request.getRequestURI());
48
			setRedirectUrl();
50
			return "login";
49
			return "login";
51
		}
50
		}
52
    	long userId = userinfo.getUserId();
51
    	long userId = userinfo.getUserId();
53
    	boolean isLoggedIn = userinfo.isLoggedIn();
52
    	boolean isLoggedIn = userinfo.isLoggedIn();
54
    	
53
    	
Line 66... Line 65...
66
			// innocent when this occurs at the time of checkout or when the
65
			// innocent when this occurs at the time of checkout or when the
67
			// user is proceeding to pay.
66
			// user is proceeding to pay.
68
			e.printStackTrace();
67
			e.printStackTrace();
69
		}
68
		}
70
    	
69
    	
71
		Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
-
 
72
		
70
		
73
		params.put(PageContentKeys.CUSTOMER_ID, userId+"");
-
 
74
		params.put(PageContentKeys.IS_LOGGED_IN, isLoggedIn+"");
-
 
75
		params.put(PageContentKeys.CART_ID, userinfo.getCartId()+"");
-
 
76
		params.put(PageContentKeys.ITEM_COUNT, userinfo.getTotalItems()+"");
-
 
77
		params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());
71
		htmlSnippets.put("SHIPPING_HEADER", pageLoader.getShippingHeaderHtml());
78
		params.put(PageContentKeys.ERROR_MSG, errorMsg);
-
 
79
		htmlSnippets = pageManager.getPageContents(PageEnum.SHIPPING_PAGE, params);
72
		htmlSnippets.put("SHIPPING_DETAILS", pageLoader.getShippingDetailsHtml(userinfo.getCartId(), errorMsg));
80
		
73
		
81
    	return "index";
74
    	return "index";
82
	 }
75
	 }
83
 
76
 
84
	// POST /entity
77
	// POST /entity
Line 124... Line 117...
124
			return "failure";
117
			return "failure";
125
		}
118
		}
126
		return null;
119
		return null;
127
	}
120
	}
128
 
121
 
129
 
-
 
130
	@Override
122
	@Override
131
	public void setParameters(Map<String, String[]> reqmap) {
123
	public void setParameters(Map<String, String[]> reqmap) {
132
		log.info("setParameters:" + reqmap);
124
		log.info("setParameters:" + reqmap);
133
		
125
		
134
		this.reqparams = reqmap;
126
		this.reqparams = reqmap;
135
	}
127
	}
136
 
128
 
137
    public String getHeaderSnippet(){
-
 
138
		return htmlSnippets.get("HEADER");
-
 
139
	}
-
 
140
	
-
 
141
	public String getMainMenuSnippet(){
-
 
142
		return htmlSnippets.get("MAIN_MENU");
-
 
143
	}
-
 
144
	
-
 
145
	public String getSearchBarSnippet(){
-
 
146
		return htmlSnippets.get("SEARCH_BAR");
-
 
147
	}
-
 
148
			
-
 
149
	
-
 
150
	public String getCustomerServiceSnippet(){
-
 
151
		return htmlSnippets.get("CUSTOMER_SERVICE");
-
 
152
	}
-
 
153
	
-
 
154
	public String getShippingHeaderSnippet(){
129
	public String getShippingHeaderSnippet(){
155
		return htmlSnippets.get("SHIPPING_HEADER");
130
		return htmlSnippets.get("SHIPPING_HEADER");
156
	}
131
	}
157
	
132
	
158
	public String getShippingDetailsSnippet(){
133
	public String getShippingDetailsSnippet(){
159
		return htmlSnippets.get("SHIPPING_DETAILS");
134
		return htmlSnippets.get("SHIPPING_DETAILS");
160
	}
135
	}
161
	
136
	
162
	public String getFooterSnippet(){
-
 
163
		return htmlSnippets.get("FOOTER");
-
 
164
	}
-
 
165
	
-
 
166
	public String getJsFileSnippet(){
-
 
167
		return htmlSnippets.get("JS_FILES");
-
 
168
	}
-
 
169
	
-
 
170
	public String getCssFileSnippet(){
-
 
171
		return htmlSnippets.get("CSS_FILES");
-
 
172
	}
-
 
173
 
-
 
174
	public long getAddressId(){
137
	public long getAddressId(){
175
		return this.addressId;
138
		return this.addressId;
176
	}
139
	}
177
	
140
	
178
	public String getErrorMsg(){
141
	public String getErrorMsg(){