Changeset 8724 for trunk/greenstone3-extensions/gsdl-as
- Timestamp:
- 2004-12-02T16:20:11+13:00 (19 years ago)
- Location:
- trunk/greenstone3-extensions/gsdl-as
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/AlertingService.java
r8717 r8724 14 14 import java.util.*; 15 15 16 import javax.mail.Session; 16 17 import javax.servlet.http.*; 17 18 … … 38 39 actions.add("login"); 39 40 actions.add("register"); 41 actions.add("logout"); 40 42 } 41 43 … … 99 101 return "login.vm"; 100 102 } 101 // TODO handle wizard-style stuff 102 // if "finish" 103 ProfileStore.getInstance().createSubscription(arguments); 104 return listSubscriptions(arguments, context); 105 // else show next page 103 if (arguments.containsKey("next_page") && arguments.get("next_page").equals("finish")) { 104 ProfileStore.getInstance().createSubscription(arguments); 105 return listSubscriptions(arguments, context); 106 } else { 107 return showSubscriptionWizardPage(arguments, context, true); 108 } 106 109 } 107 110 … … 117 120 } 118 121 119 public String editSubscription(Map arguments, Context context) {122 public String editSubscription(Map arguments, Context context) throws Exception { 120 123 HttpSession session = ((HttpServletRequest)context.get(REQUEST)).getSession(true); 121 124 if (!UserManager.getInstance().isLoggedIn(session)) { … … 123 126 return "login.vm"; 124 127 } 125 // TODO handle wizard-style stuff 126 // if "finish" 127 ProfileStore.getInstance().changeSubscription(arguments, session); 128 return listSubscriptions(arguments, context); 129 // else show next page 128 if (arguments.containsKey("next_page") && arguments.get("next_page").equals("finish")) { 129 ProfileStore.getInstance().changeSubscription(arguments, session); 130 return listSubscriptions(arguments, context); 131 } else { 132 return showSubscriptionWizardPage(arguments, context, false); 133 } 130 134 } 131 135 … … 156 160 UserManager.getInstance().createUser(arguments, session); 157 161 return login(arguments, context); 162 } 163 164 public String logout(Map arguments, Context context) { 165 HttpSession session = ((HttpServletRequest)context.get(REQUEST)).getSession(true); 166 Enumeration atts = session.getAttributeNames(); 167 while (atts.hasMoreElements()) { 168 session.removeAttribute((String) atts.nextElement()); 169 } 170 session.invalidate(); 171 return "general.vm"; 158 172 } 159 173 … … 211 225 return null; 212 226 } 227 228 /** 229 * @param arguments 230 * @param context 231 * @param create 232 * @return 233 * @throws Exception 234 */ 235 private String showSubscriptionWizardPage(Map arguments, Context context, boolean create) throws Exception { 236 if (create) { 237 context.put("action", "createSubscription"); 238 } else { 239 context.put("action", "editSubscription"); 240 } 241 if (!arguments.containsKey("current_page")) { 242 return "sub_type-details.vm"; 243 } 244 245 HttpSession session = ((HttpServletRequest)context.get(REQUEST)).getSession(true); 246 String currentPage = (String) arguments.get("current_page"); 247 String direction = (String) arguments.get("next_page"); 248 249 // save page arguments 250 savePageArgsToSession(currentPage, arguments, session); 251 252 String nextPage = getNextPage(currentPage, direction); 253 254 // fill prefill 255 context.put("prefill", getPageArgsFromSession(nextPage, session)); 256 257 // fill preview 258 context.put("preview", getPagePreview(nextPage, session)); 259 260 // get page-specific stuff 261 if (nextPage.equals("host")) { 262 263 } else if (nextPage.equals("collection")) { 264 265 } 266 267 return "sub_" + nextPage + ".vm"; 268 } 269 270 /** 271 * @param nextPage 272 * @param session 273 * @return 274 */ 275 private Map getPagePreview(String nextPage, HttpSession session) { 276 Map preview = new TreeMap(); 277 if (nextPage.equals("type-details")) { 278 return preview; 279 } 280 preview.putAll(getPageArgsFromSession("type-details", session)); 281 if (nextPage.equals("host")) { 282 return preview; 283 } 284 preview.putAll(getPageArgsFromSession("host", session)); 285 if (nextPage.equals("collection")) { 286 return preview; 287 } 288 preview.putAll(getPageArgsFromSession("collection", session)); 289 return preview; 290 } 291 292 /** 293 * @param currentPage 294 * @param direction 295 * @return 296 * @throws Exception 297 */ 298 private String getNextPage(String currentPage, String direction) throws Exception { 299 String nextPage; 300 if (currentPage.equals("host") && direction.equals("back")) { 301 nextPage = "type-details"; 302 } else if (currentPage.equals("type-details") || (currentPage.equals("collection") && direction.equals("back"))) { 303 nextPage = "host"; 304 } else if (currentPage.equals("host") || (currentPage.equals("notification") && direction.equals("back"))) { 305 nextPage = "collection"; 306 } else if (currentPage.equals("collection")) { 307 nextPage = "notification"; 308 } else { 309 throw new Exception("unknown combination of currentPage=" + currentPage + " and nextPage=" + direction); 310 } 311 return nextPage; 312 } 313 314 /** 315 * @param page 316 * @param session 317 * @return TODO 318 */ 319 private Map getPageArgsFromSession(String page, HttpSession session) { 320 Map pageArgs = (Map) session.getAttribute("page_args"); 321 if (pageArgs == null || !pageArgs.containsKey(page)) 322 return new TreeMap(); 323 return (Map) pageArgs.get(page); 324 } 325 326 /** 327 * @param page 328 * @param arguments 329 * @param session 330 */ 331 private void savePageArgsToSession(String page, Map arguments, HttpSession session) { 332 Map pageArgs = (Map) session.getAttribute("page_args"); 333 if (pageArgs == null) { 334 pageArgs = new TreeMap(); 335 } 336 pageArgs.put(page, arguments); 337 session.setAttribute("page_args", pageArgs); 338 } 213 339 } -
trunk/greenstone3-extensions/gsdl-as/web/default.css
r8720 r8724 51 51 color: #666633; 52 52 } 53 54 img.help {55 cursor: help;56 } -
trunk/greenstone3-extensions/gsdl-as/web/form.css
r8720 r8724 11 11 } 12 12 13 td, th { 14 padding: 0px 5px; 15 } 16 17 thead tr { 18 background-color: #CCCCCC; 19 } 20 21 tr.even { 22 background-color: #CCCCCC; 23 } 24 25 .explanation { 26 font-size: small; 27 } 28 29 #progress { 30 font-size: x-small; 31 border: 0px solid black; 32 width: 80%; 33 margin: 5px auto; 34 } 35 36 #progress td { 37 width: 25%; 38 vertical-align: top; 39 text-align: center; 40 color: #555; 41 border-top: 10px solid #CCC; 42 } 43 44 #progress td.completed { 45 border-top-color: #9CBE9C; 46 color: #000; 47 } 48 49 #progress td.current { 50 background-color: #F0E68C; 51 font-style: italic; 52 color: #000; 53 } 54 55 table.subscription { 56 font-size: small; 57 } 58 59 .rssbutton { 60 background: #ff6600; 61 color: #ffffff; 62 border-left: 1px solid #cc9966; 63 border-top: 1px solid #ccaa99; 64 border-right: 1px solid #993300; 65 border-bottom: 1px solid #331100; 66 padding: 0px 0.5em 0px 0.5em; 67 font-family: helvetica, arial, sans-serif; 68 font-weight: bold; 69 font-size: xx-small; 70 margin-top: 1em; 71 } 72 -
trunk/greenstone3-extensions/gsdl-as/web/subscribe.html
r8720 r8724 17 17 You can subscribe to be notified of events about these elements: 18 18 <ul> 19 <li><a href=" sub_document.html">documents</a> (new, modified or deleted documents)</li>19 <li><a href="/alerting/service?action=createSubscription">documents</a> (new, modified or deleted documents)</li> 20 20 <li><a href="sub_docparts.html">parts of documents</a> (new, modified or deleted parts of documents)</li> 21 21 <li><a href="sub_metadata.html">document metadata</a> (new, modified or deleted metadata of documents)</li>
Note:
See TracChangeset
for help on using the changeset viewer.