diff --git a/build.xml b/build.xml index 401b6bf..66b42bc 100644 --- a/build.xml +++ b/build.xml @@ -21,27 +21,52 @@ - + - - - - + + + + + + + + + + - + + + + + + + - + + + + + - + + + + + + + + + + @@ -51,7 +76,7 @@ - + @@ -65,17 +90,16 @@ - - + - + - + diff --git a/doc/buttons/gelcap_green.xcf b/doc/buttons/gelcap_green.xcf new file mode 100644 index 0000000..e7fb605 Binary files /dev/null and b/doc/buttons/gelcap_green.xcf differ diff --git a/doc/buttons/gelcap_pink.xcf b/doc/buttons/gelcap_pink.xcf new file mode 100644 index 0000000..b83ecb0 Binary files /dev/null and b/doc/buttons/gelcap_pink.xcf differ diff --git a/doc/buttons/gelcap_red.xcf b/doc/buttons/gelcap_red.xcf new file mode 100644 index 0000000..b5ab477 Binary files /dev/null and b/doc/buttons/gelcap_red.xcf differ diff --git a/doc/buttons/gelcap_teal.xcf b/doc/buttons/gelcap_teal.xcf new file mode 100644 index 0000000..10e87c6 Binary files /dev/null and b/doc/buttons/gelcap_teal.xcf differ diff --git a/doc/buttons/gelcap_violet.xcf b/doc/buttons/gelcap_violet.xcf new file mode 100644 index 0000000..9537ae0 Binary files /dev/null and b/doc/buttons/gelcap_violet.xcf differ diff --git a/doc/buttons/gelcap_yellow.xcf b/doc/buttons/gelcap_yellow.xcf new file mode 100644 index 0000000..e65ae18 Binary files /dev/null and b/doc/buttons/gelcap_yellow.xcf differ diff --git a/etc/logging-config.xml b/etc/logging-config.xml index ced654d..b70cc21 100644 --- a/etc/logging-config.xml +++ b/etc/logging-config.xml @@ -30,12 +30,6 @@ - - - - - - @@ -44,6 +38,12 @@ + + + + + + diff --git a/etc/render-config.xml b/etc/render-config.xml deleted file mode 100644 index bc2ec98..0000000 --- a/etc/render-config.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - Venice Test - - - - - - - - - - - - - - Arial, Helvetica - - - WEB-INF/template.css - - - - #9999FF - #6666CC - white - yellow - #9999FF - black - blue - white - black - #3333AA - silver - #660000 - #6666CC - white - #9999FF - black - blue - #006600 - white - #660000 - white - - - - 100 - - - - - - - /venice/images/ - - - /venice/static/ - - - /venice/images/powered-by-venice.gif - - - WEB-INF/sidebox-config.xml - - - photo_not_avail.gif - - - WEB-INF/services-config.xml - - - - - - - - Venice Web Communities System. To get the most out of this site, you should log in -or create an account, using one of the links above. - ]]> - - - - Welcome to Venice - - - Venice Currents - - - - -All messages posted by users on this page are owned by those users.
-The rest: Copyright © 2001 Silverwrist Design Studios, -All Rights Reserved.
-See our Policy Page for our copyright and privacy policies. - ]]> -
- - - - - - - - Venice User Agreement - -
- - - - - - -
Front Page
- Calendar - Chat -
- - - -
About This Site
- Documentation - About Venice -
- -
- -
diff --git a/etc/services-config.xml b/etc/services-config.xml index 8d5b834..79c4ed4 100644 --- a/etc/services-config.xml +++ b/etc/services-config.xml @@ -26,37 +26,37 @@ - Profile + Profile - Administration + Administration - System Administration + System Administration - Conferences + Conferences - Members + Members - \ No newline at end of file + diff --git a/etc/sidebox-config.xml b/etc/sidebox-config.xml index 73be1a0..06902ac 100644 --- a/etc/sidebox-config.xml +++ b/etc/sidebox-config.xml @@ -22,7 +22,7 @@ Your Communities Featured Communities - com.silverwrist.venice.servlets.format.sideboxes.CommunityBox + com.silverwrist.venice.ui.sidebox.CommunityBox You are not a member of any communities. Manage Create New @@ -33,7 +33,7 @@ Your Conference Hotlist Featured Conferences - com.silverwrist.venice.servlets.format.sideboxes.ConferenceBox + com.silverwrist.venice.ui.sidebox.ConferenceBox You have no conferences in your hotlist. Manage purple-ball.gif @@ -44,7 +44,7 @@ + + + + + WEB-INF/sidebox-config.xml + + + WEB-INF/services-config.xml + + + WEB-INF/scripts + + + WEB-INF/temp + + + + + + + /newui/images + + + /static + + + /newui/static + + + /format + + + photo_not_avail.gif + + + + + + + frame.jsp + + + Venice Test + + + 3 + + + WEB-INF/template.css + + + + + + /newui/images/powered-by-venice.gif + + + 100 + + + /newui/images/venice-icon.png + + + /newui/images/venice-favicon.ico + + + + + + + Arial, Helvetica + + + + 3 + 2 +
5
+ 3 + 2 + 2 + 1 + 3 + 3 + 4 + 1 + 3 + 3 + 1 +
+ + + + #9999FF + #6666CC + white + yellow + #9999FF + black + blue + white + black + #3333AA + silver + #660000 + #6666CC + white + #9999FF + black + blue + #006600 + white + #660000 + white + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + top.js.vs + verify_email.js.vs?tgt=${tgt} + + + + + + + Venice Web Communities System. To get the most out of this site, you should log in +or create an account, using one of the links above. + ]]> + + + Welcome to Venice + + + Venice Currents + + + +All messages posted by users on this page are owned by those users.
+The rest: Copyright © 2001 Silverwrist Design Studios, +All Rights Reserved.
+See our Policy Page for our copyright and privacy policies. + ]]>
+ + + + + + Venice User Agreement + +
+ + + + + + + Front Page + Calendar + Chat + + + + + About This Site + Documentation + About Venice + + + + + Community Administration: + ${name} + Community Profile + Set Community Category + Set Community Services + Membership Control + E-Mail To All Members + Display Audit Records + Delete Community + + + + + System Administration + Edit Global Properties + View/Edit Banned Users + User Account Management + System Audit Logs + Import User Accounts + + + + + Host Tools + Change Conference Information + Manage Conference Aliases + Manage Conference Members + Customize Conference Appearance + Conference Activity Reports + Conference E-Mail + Delete Conference + + + + + + + + + Log In + login.js.vs + Reminder button to receive a password +reminder via E-mail. + ]]> + + + + + + + + + + + Create Account + new_account_2.js.vs + + +
+ + + + + +
+ + + + +
+ +
+ + + + + + +
+ + + Verify E-mail Address + verify_email.js.vs + Send Again button below. + ]]> + + + + + + + + + Edit Your Profile + profile.js.vs + +
To change your password, enter a new password into the fields below.
+ + + +
+ + + + + +
+ + + + + + + + +
+ + + + + +
+ + + +
+ + +
+ + + + + + +
+ + + Join Key Required + comm/join_key.js.vs + + + + + + + + + Create New Community + comm/create.js.vs +
+ + + + + +
+ + + + +
+ + Public + Private + + + + Show in both directory and search + Hide in directory, but not in search + Hide in both directory and search + + + +
+ + + Edit Community Profile: + comm/profile.js.vs + +
+ + + + + + + +
+ + + + + + + +
+ + Public + Private + + + + + Show in both directory and search + Hide in directory, but not in search + Hide in both directory and search + + + + + + +
+ + + +
+ + + Edit Global Properties + sysadmin/global.js.vs +
+ + + + +
+ +
+ + + + + + +
+ + + Modify User Account + sysadmin/modify_user.js.vs + +
+ To change the user's password, enter a new password into the fields below. +
+ + + + + + + +
+ + + + + +
+ + + + + + + + +
+ + + + + +
+ + + +
+ + +
+ + + + + + +
+ + + Create New Conference + conf/create.js.vs + + + + + + Public + Private + + + + + + + + Edit Conference: + conf/edit.js.vs + + +
+ + + +
+ + + + + + + +
+ + + +
+ +
+ +
diff --git a/etc/venice-config.xml b/etc/venice-config.xml index e163e8e..ada24f6 100644 --- a/etc/venice-config.xml +++ b/etc/venice-config.xml @@ -327,16 +327,13 @@ be fed to emailed output. --> - - - ]]> - + ]]> - - . + Thank you, and enjoy the Venice conferencing system! -- The Management - ]]> - + ]]> Venice Email Confirmation - - - + ]]> Venice Password Reminder Message - - - + ]]> Venice Password Changed @@ -398,8 +392,7 @@ IMMEDIATELY. - - and click the "Create Account" link at the top of the page, @@ -412,15 +405,13 @@ ${personal} Hope to see you in "${community.name}" soon! -- ${fullname} (Venice user ID: ${username}) - ]]> - + ]]> - - and click the "Create Account" link at the top of the page, @@ -433,8 +424,7 @@ ${personal} Hope to see you in "${community.name}" soon! -- ${fullname} (Venice user ID: ${username}) - ]]> - + ]]> @@ -459,27 +449,23 @@ on the "${topic.name}" topic name in the topic list. - - - + ]]> - - - + ]]> diff --git a/etc/web.xml b/etc/web.xml index 322f046..87396f9 100644 --- a/etc/web.xml +++ b/etc/web.xml @@ -49,408 +49,178 @@ - render.config - WEB-INF/render-config.xml + ui.config + WEB-INF/ui-config.xml - The path and file name, relative to the application root directory, of the Venice rendering - configuration file, which needs to be loaded into the Venice rendering system at start-up. + The path and file name, relative to the application root directory, of the Venice user interface + configuration file, which needs to be loaded into the Venice UI at start-up. - + + - top - - Displays the top-level page of the Venice application. - - com.silverwrist.venice.servlets.Top - - 3 + ScriptExec + Executes a scripting language file as a servlet. + com.silverwrist.venice.ui.servlet.ScriptExecServlet - framestatic - - Displays static content inside the Venice frame. - - com.silverwrist.venice.servlets.FrameStatic + StyleSheet + Generates the stylesheet included by the frame JSP file. + com.silverwrist.venice.ui.servlet.StyleSheetServlet - account - - Account management operations - login, logout, create, verify email, enter profile. - - com.silverwrist.venice.servlets.Account + Frame + Displays static content inside the Venice frame. + com.silverwrist.venice.ui.servlet.FrameServlet - systemadmin - - System administration operations. - - com.silverwrist.venice.servlets.SystemAdmin + GetImage + Retrieves images from the database image store and displays them. + com.silverwrist.venice.ui.servlet.GetImageServlet - settings - - User customization and settings operations. - - com.silverwrist.venice.servlets.Settings + User + Displays user profiles. + com.silverwrist.venice.ui.servlet.UserServlet - userdisplay - - Displays Venice user profiles. - - com.silverwrist.venice.servlets.UserDisplay + CommunityDispatch + Redirects the user to the "default" service page for a community. + com.silverwrist.venice.ui.servlet.CommunityDispatchServlet - communityfrontend - - The "front end" for community display; it redirects the user to whatever page has - been defined as the "default" for that community. - - com.silverwrist.venice.servlets.CommunityFrontEnd + PostShortcut + Redirects the user to a comunity, conference, topic, or message. + com.silverwrist.venice.ui.conf.PostShortcutServlet - communityprofile - - Displays the profile for a given community. - - com.silverwrist.venice.servlets.CommunityProfile + PasswordRecovery + Performs a password change operation for a user that's forgotten their password. + com.silverwrist.venice.ui.servlet.PasswordRecoveryServlet - communityadmin - - Community administration functions. - - com.silverwrist.venice.servlets.CommunityAdmin + Gateway + Gateways access to a specific URL through the Venice login screen. + com.silverwrist.venice.ui.servlet.GatewayServlet - communityoperations - - General community operations. - - com.silverwrist.venice.servlets.CommunityOperations + Remapper + Remaps calls from one URL to another. + com.silverwrist.venice.ui.servlet.RemapperServlet - - find - - The main Find page. - - com.silverwrist.venice.servlets.Find - + - - confoperations - - General conference operations. - - com.silverwrist.venice.servlets.ConfOperations - - - - confdisplay - - Conference topic list and topic display. - - com.silverwrist.venice.servlets.ConfDisplay - - - - postmessage - - Posting messages to a conference. - - com.silverwrist.venice.servlets.PostMessage - - - - attachment - - Andles downloading and uploading attachments. - - com.silverwrist.venice.servlets.Attachment - - - - topicoperations - - General topic operations. - - com.silverwrist.venice.servlets.TopicOperations - - - - postoperations - - General post operations. - - com.silverwrist.venice.servlets.PostOperations - - - - postshortcut - - Processes post links and redirects to the appropriate page. - - com.silverwrist.venice.servlets.PostShortcut - - - - imageretrieve - - Retrieves images from the database image store and displays them. - - com.silverwrist.venice.servlets.ImageRetrieve - - - - userphoto - - Changes the photo in a user's profile (uploads a new one). - - com.silverwrist.venice.servlets.UserPhoto - - - - stylesheet - - Generates the stylesheet included by the top-level JSP file). - - com.silverwrist.venice.servlets.StyleSheet - - - - passrecovery - - Performs a password change operation for a user that's forgotten their password. - - com.silverwrist.venice.servlets.PasswordRecovery - - - - communitylogo - - Changes the logo for a community (uploads a new one). - - com.silverwrist.venice.servlets.CommunityLogo - - - - gateway - - Gateways access to a specific URL through the Venice login screen. - - com.silverwrist.venice.servlets.Gateway - - - - memberredirect - - Displays the members list for a community (internal redirect to CommunityOperations). - - com.silverwrist.venice.servlets.MemberRedirect - - - - adminuserphoto - - Changes the photo in a user's profile (uploads a new one). - - com.silverwrist.venice.servlets.AdminUserPhoto - - - - findpost - - Searches for posts in communities, conferences, or topics. - - com.silverwrist.venice.servlets.FindPost - - - - - - testformdata - com.silverwrist.util.test.FormDataTest - - - - dumpall - com.silverwrist.util.test.DumpAll - - - - top - /top + ScriptExec + *.vs - framestatic - /frame/* - - - - account - /account - - - - systemadmin - /sysadmin - - - - settings - /settings - - - - userdisplay - /user/* - - - - communityfrontend - /sig/* - - - - communityprofile - /sigprofile - - - - communityadmin - /sigadmin - - - - communityoperations - /sigops - - - - find - /find - - - - confoperations - /confops - - - - confdisplay - /confdisp - - - - postmessage - /post - - - - attachment - /attachment - - - - topicoperations - /topicops - - - - postoperations - /postops - - - - postshortcut - /go/* - - - - imageretrieve - /imagedata/* - - - - userphoto - /userphoto - - - - stylesheet + StyleSheet /stylesheet - passrecovery + Frame + /frame/* + + + + GetImage + /imagedata/* + + + + User + /user/* + + + + CommunityDispatch + /community/* + + + + CommunityDispatch + /sig/* + + + + PostShortcut + /go/* + + + + PasswordRecovery /passrecovery/* - - communitylogo - /commlogo - - - - gateway - /gw - - - - memberredirect - /members - - - - adminuserphoto - /adminuserphoto - - - - findpost - /findpost - - - - - testformdata - /testformdata - - - - dumpall - /dumpall - - - - dumpall - /dump/* - - default.jsp index.html + + Gateway + /gw + + + + Remapper + /verifyemail + + 60 + + + /tlds/util + /WEB-INF/tlds/utils-taglib.tld + + + + /tlds/frame + /WEB-INF/tlds/frame-taglib.tld + + + + /tlds/user + /WEB-INF/tlds/user-taglib.tld + + + + /tlds/community + /WEB-INF/tlds/community-taglib.tld + + + + /tlds/conference + /WEB-INF/tlds/conference-taglib.tld + + + + /tlds/topic + /WEB-INF/tlds/topic-taglib.tld + + + + /tlds/post + /WEB-INF/tlds/post-taglib.tld + + diff --git a/lib/.gitignore b/lib/.gitignore index f354abd..8bc3108 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,2 +1,7 @@ +bsf.jar +jacl.jar +js.jar log4j.jar mysql.jar +mm.mysql*.jar +tcljava.jar \ No newline at end of file diff --git a/lib/README.lib b/lib/README.lib index a0b8cd4..4b392a9 100644 --- a/lib/README.lib +++ b/lib/README.lib @@ -7,6 +7,8 @@ compatible with the versions specified here. Library Version File Name(s) Install To ------------------------------------------------------------------------------------------------- Apache LOG4J 1.1.3 log4j.jar Venice "lib" subdirectory +Bean Scripting Framework 2.2 bsf.jar Venice "lib" subdirectory +Jacl (Tcl interpreter) 1.3(CVS) jacl.jar, tcljava.jar Venice "lib" subdirectory Java Activation Framework 1.0.1 activation.jar JRE "ext" subdirectory Java Advanced Imaging API 1.1.1 jai_core.jar, jai_codec.jar, JRE "ext" subdirectory mlibwrapper_jai.jar @@ -15,6 +17,7 @@ JavaMail 1.2 imap.jar, mailapi.jar, mail.jar, JRE " pop3.jar, smtp.jar Java Secure Socket Extensions 1.0.2 jcert.jar, jnet.jar, jsse.jar JRE "ext" subdirectory MySQL JDBC Driver 2.0.2 mysql.jar Venice "lib" subdirectory +Rhino (JavaScript interpreter) 1.5R2 js.jar Venice "lib" subdirectory NOTES ===== diff --git a/scripts/comm/admin_menu.js b/scripts/comm/admin_menu.js new file mode 100644 index 0000000..6c87295 --- /dev/null +++ b/scripts/comm/admin_menu.js @@ -0,0 +1,46 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canAdministerCommunity())) +{ // no access - sorry buddy + logger.error("tried to call up community admin menu without access...naughty naughty!"); + vlib.output(new ErrorBox("Access Error","You do not have access to administer this community.", + "community/" + comm.alias)); + vlib.done(); + +} // end if + +// build the community admin menu +vars = new HashMap(); +vars.put("cid",comm.communityID + ""); +vars.put("name",comm.name); +menu = rinput.getMenu("community.admin",vars); + +// build a view around it and return it +rc = new MenuView(menu); +rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; +vlib.output(rc); diff --git a/scripts/comm/audit.js b/scripts/comm/audit.js new file mode 100644 index 0000000..8189411 --- /dev/null +++ b/scripts/comm/audit.js @@ -0,0 +1,59 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +rc = null; +try +{ // read off the offset parameter + offset = rinput.getParameterInt("ofs",0); + + // generate the audit lists + audit_list = comm.getAuditRecords(offset,rinput.engine.getNumAuditRecordsPerPage()); + audit_count = comm.getAuditRecordCount(); + + // output the audit data view + rc = new AuditView(rinput.engine,audit_list,offset,audit_count, + "Audit Records for Community \"" + comm.name + "\"", + "comm/audit.js.vs?cc=" + comm.communityID + "&ofs=${offset}", + "comm/admin_menu.js.vs?cc=" + comm.communityID, + "Return to Community Administration Menu"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // display an error + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting audit records: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/comm/category.js b/scripts/comm/category.js new file mode 100644 index 0000000..a8806ae --- /dev/null +++ b/scripts/comm/category.js @@ -0,0 +1,114 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canModifyProfile())) +{ // no access - sorry, dude + logger.error("tried to call up community profile screen without access...naughty naughty!"); + vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +rc = null; +if (rinput.hasParameter("set")) +{ // OK...they're actually setting the category here - change it and bail out + catid = rinput.getParameterInt("set",-1); + if (engine.isValidCategoryID(catid)) + { // try setting the category ID + try + { // set the category ID and bounce back to the menu + comm.categoryID = catid; + rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception setting category + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error updating community: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + + } // end if + else // invalid category ID + rc = new ErrorBox("Invalid Input","Invalid category ID passed to category browser.", + "comm/admin_menu.js.vs?cc=" + comm.communityID); + + vlib.output(rc); + vlib.done(); + +} // end if + +// we must be browsing - try and figure out what category we're supposed to be browsing +curr_catid = 0; +if (rinput.hasParameter("go")) + curr_catid = rinput.getParameterInt("go",-1); +else + curr_catid = comm.categoryID; +if (!(engine.isValidCategoryID(curr_catid))) +{ // this is not a valid category ID + vlib.output(new ErrorBox("Invalid Input","Invalid category ID passed to category browser.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +try +{ // get the categories + prev_cat = comm.category; + rinput.setRequestAttribute("category.previous",prev_cat); + curr_cat = null; + if (prev_cat.categoryID!=curr_catid) + curr_cat = rinput.user.getCategoryDescriptor(curr_catid); + else + curr_cat = prev_cat; + rinput.setRequestAttribute("category.current",curr_cat); + rinput.setRequestAttribute("category.subcats",curr_cat.getSubCategories()); + + // create a view and return it + rc = new JSPView("Set Community Category","comm/category.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // caught an exception here... + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error browsing categories: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); + diff --git a/scripts/comm/create.js b/scripts/comm/create.js new file mode 100644 index 0000000..d69b9e3 --- /dev/null +++ b/scripts/comm/create.js @@ -0,0 +1,124 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.canCreateCommunity())) +{ // can't create communities - bye! + if (rinput.user.isLoggedIn()) + vlib.output(new ErrorBox("Community Error","You are not permitted to create communities.","top.js.vs")); + else + vlib.output(new LogInOrCreate()); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("create.community"); +if ("GET"==rinput.verb) +{ // just output the dialog + dlg.setValue("language","en-US"); + dlg.setValue("country","US"); + vlib.output(dlg); + vlib.done(); + +} // end if + +// everything following is for a POST +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled - bail out + vlib.output(new Redirect("top.js.vs",LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (op=="create") +{ // actually creating a community + dlg.load(rinput); // load the dialog values + + try + { // start by validating the dialog + dlg.validate(); + + // validate some extra stuff + my_alias = dlg.getValue("alias"); + if (rinput.engine.aliasExists(my_alias,-1)) + throw new ValidationException("That alias is already used by another community on the system."); + my_comtype = dlg.getValue("comtype") + ""; + my_joinkey = null; + if (my_comtype=="1") + { // get the join key for this private community + my_joinkey = dlg.getValue("joinkey"); + if (vlib.emptyString(my_joinkey)) + throw new ValidationException("Private communities must specify a join key value."); + + } // end if + + my_hidemode = parseInt(dlg.getValue("hidemode"),10); // get the hide mode + + // Create the new community context. + new_comm = rinput.user.createCommunity(dlg.getValue("name"),my_alias,dlg.getValue("language"), + dlg.getValue("synopsis"),dlg.getValue("rules"),my_joinkey, + my_hidemode); + + // Get the new community's contact record and fill in the pieces of info we know. + ci = new_comm.getContactInfo(); + ci.locality = dlg.getValue("loc"); + ci.region = dlg.getValue("reg"); + ci.postalCode = dlg.getValue("pcode"); + ci.country = dlg.getValue("country"); + new_comm.putContactInfo(ci); + + // create the return view + rinput.setRequestAttribute("new.community",new_comm); + rc = new JSPView("New Community Created","comm/new.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // exception creating the community + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException") || etype.match("AccessError")) + { // reset the dialog and let them try again + dlg.setErrorMessage(e.message + " Please try again."); + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error creating community: " + e.message,"top.js.vs"); + else + rc = e; + + } // end catch + +} // end if +else +{ // don't know what button was pressed + logger.error("no known button click on POST to comm/create.js.vs"); + rc = new ErrorBox("Internal Error","Unknown command button pressed","top.js.vs"); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/comm/delete.js b/scripts/comm/delete.js new file mode 100644 index 0000000..758bf0c --- /dev/null +++ b/scripts/comm/delete.js @@ -0,0 +1,74 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canDelete())) +{ // we can't delete the community, so what are we doing here? + logger.error("you can't delete the community - not gonna do it, wouldn't be prudent"); + vlib.output(new ErrorBox("Access Error","You do not have permission to delete this community.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +CONFIRM_attr = "community.delete.confirm"; +CONFIRM_param = "confirm"; + +rc = null; + +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // we are confirmed - delete the community! + try + { // delete the community + comm.deleteCommunity(); + + // the community is now GONE - go back to the top + rc = new Redirect("top.js.vs",LinkTypes.SERVLET); + + } // end try + catch (e) + { // caught an exception while unjoining + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error deleting community: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end if +else +{ // need to get confirmation + message = "You are about to permanently delete the \"" + comm.name + "\" community, including all " + + "conferences and other resources it contains! Are you sure you want to do this?"; + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Community",message, + "comm/delete.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET, + "comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + +} // end else + +vlib.output(rc); diff --git a/scripts/comm/email.js b/scripts/comm/email.js new file mode 100644 index 0000000..1dcd358 --- /dev/null +++ b/scripts/comm/email.js @@ -0,0 +1,86 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canMassMail())) +{ // we can't send mass mail to the community, so what are we doing here? + logger.error("you can't mass-mail the community - not gonna do it, wouldn't be prudent"); + vlib.output(new ErrorBox("Access Error","You do not have permission to sent mass mail to this community.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +if ("GET"==rinput.verb) +{ // display the view + view = new JSPView("Community E-Mail: " + comm.name,"comm/email.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + vlib.output(view); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // user cancelled - go back to the menu + vlib.output(new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (rinput.isImageButtonClicked("send")) +{ // actually send the E-mail! + try + { // do it! + comm.massMail(rinput.getParameter("subj"),rinput.getParameter("pb")); + + // now bounce back to the menu + rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception caught in the mass mailing + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting mailing list: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end try +else +{ // what the hell was that button + logger.error("no known button click on POST to comm/email.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "comm/admin_menu.js.vs?cc=" + comm.communityID); + +} // end else + +vlib.output(rc); diff --git a/scripts/comm/invite.js b/scripts/comm/invite.js new file mode 100644 index 0000000..c8e3504 --- /dev/null +++ b/scripts/comm/invite.js @@ -0,0 +1,93 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canSendInvitation())) +{ // you can't send an invitation + vlib.output(new ErrorBox("Community Error","You are not permitted to send an invitation.", + "community/" + comm.alias)); + vlib.done(); + +} // end if + +locator = "cc=" + comm.communityID; +if ("GET"==rinput.verb) +{ // set up the invitation screen parameters + rinput.setRequestAttribute("invitation.title","Send Community Invitation:"); + rinput.setRequestAttribute("invitation.subtitle",comm.name); + rinput.setRequestAttribute("invitation.action",rinput.formatURL("comm/invite.js.vs",LinkTypes.SERVLET)); + rinput.setRequestAttribute("invitation.params", + ""); + + // create the invitation and display it + view = new JSPView("Send Invitation","comm/invite.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + view.pageQID = "comm/invite.js.vs?" + locator; + vlib.output(view); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // bounce back to the base page + vlib.output(new Redirect("comm/show.js.vs?" + locator,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (rinput.isImageButtonClicked("send")) +{ // do the actual send! + try + { // send out the invitation and then redirect back + comm.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb")); + rc = new Redirect("comm/show.js.vs?" + locator,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception sending the invitation + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/show.js.vs?" + locator); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message, + "comm/show.js.vs?" + locator); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,"comm/show.js.vs?" + locator); + else + rc = e; + + } // end catch + +} // end if +else +{ // no known button pressed + logger.error("no known button click on POST to comm/invite.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed","comm/show.js.vs?" + locator); + +} // end else + +vlib.output(rc); diff --git a/scripts/comm/join.js b/scripts/comm/join.js new file mode 100644 index 0000000..d790077 --- /dev/null +++ b/scripts/comm/join.js @@ -0,0 +1,70 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canJoin())) +{ // you can't join the community + vlib.output(new ErrorBox("Community Error","You are not permitted to join this community.","top.js.vs")); + vlib.done(); + +} // end if + +if (comm.isPublicCommunity()) +{ // the community is public - attempt to join right away + rc = null; + try + { // join the community! + comm.join(null); + + // force the menus to be redrawn + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + + // create a return view + rc = new JSPView("Welcome to " + comm.name,"comm/welcome.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // exception when we tried to join the community + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","Unable to join community: " + e.message,"top.js.vs"); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error joining community: " + e.message,"top.js.vs"); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// Get the "join key" dialog. +dlg = rinput.getDialog("join"); +dlg.setValue("cc",comm.communityID + ""); +vlib.output(dlg); diff --git a/scripts/comm/join_key.js b/scripts/comm/join_key.js new file mode 100644 index 0000000..3086dbe --- /dev/null +++ b/scripts/comm/join_key.js @@ -0,0 +1,98 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canJoin())) +{ // you can't join the community + vlib.output(new ErrorBox("Community Error","You are not permitted to join this community.","top.js.vs")); + vlib.done(); + +} // end if + +if (comm.isPublicCommunity()) +{ // we shouldn't have gotten here! + vlib.output(new ErrorBox("Internal Error","This community should already have been joined.", + "comm/show.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// Get the "join key" dialog. +dlg = rinput.getDialog("join"); +op = dlg.whichButton(rinput) + ""; + +if (op=="cancel") +{ // cancel the join and bounce back to the profile + vlib.output(new Redirect("comm/show.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (op=="join_now") +{ // go ahead and join up, if we can + dlg.load(rinput); + + try + { // get the join key + key = dlg.getValue("key"); + if (vlib.emptyString("key")) + throw new ValidationException("No join key specified."); + + comm.join(key); // join the community! + + // force the menus to be redrawn + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + + // create a return view + rc = new JSPView("Welcome to " + comm.name,"comm/welcome.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // exception when we tried to join the community + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException") || etype.match("AccessError")) + { // reset the dialog and try again + dlg.setErrorMessage(e.message + " Please try again."); + dlg.setValue("key",null); + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error joining community: " + e.message,"top.js.vs"); + + } // end catch + +} // end if +else +{ // we don't know what button was clicked + logger.error("no known button click on POST to comm.join_key.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed","top.js.vs"); + +} // end else + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/comm/members.js b/scripts/comm/members.js new file mode 100644 index 0000000..5cbfe98 --- /dev/null +++ b/scripts/comm/members.js @@ -0,0 +1,133 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// create the view object +view = new MembersView(rinput.engine.getStdNumSearchResults(),comm.name); +rc = null; +try +{ // set up the member list + if ("GET"==rinput.verb) + { // initial GET of the member list - just get the start of the list + mbr_list = comm.getMemberList(); + view.simple = true; + view.results = mbr_list; + view.findCount = mbr_list.size(); + + } // end if + else + { // this is a more complicated operation... + if ("1"==rinput.getParameter("sl")) + { // Set up some of the easy initial parameters. + view.simple = true; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + throw new ValidationException("Invalid button clicked."); // can't happen + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else + throw new ValidationException("Unable to determine what action triggered the form."); + + // Get the list and subset it if necessary. + mbr_list = comm.getMemberList(); + if (view.findCount<0) + view.findCount = mbr_list.size(); + if (view.offset==0) + view.results = mbr_list; + else + view.results = mbr_list.subList(offset,mbr_list.size()); + + } // end if + else + { // This is a search operation... + view.simple = false; + + // Get the search field parameter. + x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME); + if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION) + && (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + // Get the search mode parameter. + x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX); + if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) + && (x!=SearchMode.SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + view.mode = x; + + // Get the search term parameter. + view.term = rinput.getParameter("term"); + if (view.term==null) + view.term = ""; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + view.offset = 0; // begin a new search + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else + throw new ValidationException("Unable to determine what action triggered the form."); + + // Perform the search! + view.results = comm.searchForMembers(view.field,view.mode,view.term,view.offset,view.maxResults); + if (view.findCount<0) + view.findCount = comm.getSearchMemberCount(view.field,view.mode,view.term); + + } // end else (search operation) + + } // end else (POST) + + rc = view; + +} // end try +catch (e) +{ // exception in the find operation + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + rc = new ErrorBox("Find Error",e.message,"comm/members.js.vs?cc=" + comm.communityID); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting member list: " + e.message, + "community/" + comm.alias); + else + rc = e; + +} // end catch + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/comm/photo.js b/scripts/comm/photo.js new file mode 100644 index 0000000..89242b5 --- /dev/null +++ b/scripts/comm/photo.js @@ -0,0 +1,136 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importClass(java.awt.Dimension); +importPackage(Packages.com.silverwrist.util); +importPackage(Packages.com.silverwrist.util.image); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canModifyProfile())) +{ // no access - sorry, dude + logger.error("tried to call up community profile screen without access...naughty naughty!"); + vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +rc = null; +if ("GET"==rinput.verb) +{ // create a PhotoUploader to do the photo uploading + try + { // create and initialize the PhotoUploader + rc = new PhotoUploader("Upload Community Logo","comm/photo.js.vs",LinkTypes.SERVLET); + rc.addHiddenParameter("cc",comm.communityID); + rc.photoTag = rinput.getCommunityLogoTag(comm.getContactInfo().photoURL); + rc.label = "New community logo"; + + } // end try + catch (e) + { // an exception in the output... + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error generating display: " + e.message, + "comm/profile.js.vs?cc=" + comm.communityID); + else if (etype.match("Access Error")) + rc = new ErrorBox("Access Error",e.message,"comm/profile.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// If the cancel button was clicked, bounce out of here. +if (rinput.isImageButtonClicked("cancel")) +{ // user elected to cancel upload - bounce us out of here + vlib.output(new Redirect("comm/profile.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("upload")) +{ // do some shorts-checking in the parameters + if (!(rinput.isFileParam("thepic"))) + { // bogus file parameter + logger.error("Internal Error: 'thepic' should be a file param"); + vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param", + "comm/profile.js.vs?cc=" + comm.communityID)); + vlib.done(); + + } // end if + + mimetype = rinput.getParameterType("thepic") + ""; + if (!(mimetype.match("image/"))) + { // not an image file type that got uploaded + logger.error("Error: 'thepic' not an image type"); + vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.", + "comm/photo.js.vs?cc=" + comm.communityID)); + vlib.done(); + + } // end if + + try + { // normalize the photo to 100x100 pixels + real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"), + rinput.engine.getCommunityLogoSize(),"jpeg"); + + // set the community logo data! + ci = comm.getContactInfo(); + ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data); + comm.putContactInfo(ci); + + // Jump back to the profile form. + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + rc = new Redirect("comm/profile.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception while setting community logo + etype = vlib.exceptionType(e) + ""; + if (etype.match("ServletMultipartException")) + rc = new ErrorBox(null,"Internal Error: " + e.message,"comm/profile.js.vs?cc=" + comm.communityID); + else if (etype.match("ImageNormalizerException")) + rc = new ErrorBox(null,e.message,"comm/photo.js.vs?cc=" + comm.communityID); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error storing community logo: " + e.message, + "comm/profile.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end if +else +{ // don't know the command button! + logger.error("no known button click on POST to comm/photo.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "comm/profile.js.vs?cc=" + comm.communityID); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/comm/profile.js b/scripts/comm/profile.js new file mode 100644 index 0000000..8b1cbab --- /dev/null +++ b/scripts/comm/profile.js @@ -0,0 +1,237 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Define a simple function to set up the dialog stuff. +function setupDialog(dlg,comm) +{ + dlg.setSubtitle(comm.name); + dlg.sendMessage("logo","setLinkURL","comm/photo.js.vs?cc=" + comm.communityID); + sinf = comm.securityInfo; + dlg.sendMessage("read_lvl","setRoleList",sinf.getRoleList("Community.Read")); + dlg.sendMessage("write_lvl","setRoleList",sinf.getRoleList("Community.Write")); + dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Community.Create")); + dlg.sendMessage("delete_lvl","setRoleList",sinf.getRoleList("Community.Delete")); + dlg.sendMessage("join_lvl","setRoleList",sinf.getRoleList("Community.Join")); + + if (comm.isAdminCommunity()) + { // need to disable a bunch of crap if this is the admin community + dlg.setEnabled("comtype",false); + dlg.setEnabled("joinkey",false); + dlg.setEnabled("membersonly",false); + dlg.setEnabled("hidemode",false); + dlg.setEnabled("read_lvl",false); + dlg.setEnabled("write_lvl",false); + dlg.setEnabled("create_lvl",false); + dlg.setEnabled("delete_lvl",false); + dlg.setEnabled("join_lvl",false); + + } // end if + +} // end setupDialog + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canModifyProfile())) +{ // no access - sorry, dude + logger.error("tried to call up community profile screen without access...naughty naughty!"); + vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("community.profile"); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the dialog and return + setupDialog(dlg,comm); + dlg.setValue("cc",comm.communityID + ""); + + try + { // load the parameters of the dialog + ci = comm.getContactInfo(); + props = comm.properties; + dlg.setValue("name",comm.name); + dlg.setValue("alias",comm.alias); + dlg.setValue("synopsis",comm.synopsis); + dlg.setValue("rules",comm.rules); + dlg.setValue("language",comm.getLanguageCode()); + dlg.setValue("url",ci.URL); + dlg.setValue("logo",ci.photoURL); + dlg.setValue("company",ci.company); + dlg.setValue("addr1",ci.addressLine1); + dlg.setValue("addr2",ci.addressLine2); + dlg.setValue("loc",ci.locality); + dlg.setValue("reg",ci.region); + dlg.setValue("pcode",ci.postalCode); + dlg.setValue("country",ci.country); + if (comm.isPublicCommunity()) + { // public community - has no join key + dlg.setValue("comtype","0"); + dlg.setValue("joinkey",""); + + } // end if + else + { // private community - display the join key + dlg.setValue("comtype","1"); + dlg.setValue("joinkey",comm.joinKey); + + } // end else + + if (comm.membersOnly) + dlg.setValue("membersonly",1); + dlg.setValue("hidemode",comm.hideMode); + dlg.setValue("read_lvl",comm.readLevel); + dlg.setValue("write_lvl",comm.writeLevel); + dlg.setValue("create_lvl",comm.createLevel); + dlg.setValue("delete_lvl",comm.deleteLevel); + dlg.setValue("join_lvl",comm.joinLevel); + if (props.displayPostPictures) + dlg.setValue("pic_in_post",1); + + rc = dlg; + + } // end try + catch (e) + { // exception in dialog initialization + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error retrieving profile: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled profile update - bounce back to the target + vlib.output(new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (op=="update") +{ // OK, we can update the dialog! + dlg.load(rinput); // load the dialog parameters + + try + { // start by validating the dialog + dlg.validate(); + + // validate some other stuff we didn't pick up in the fixed validation + if (rinput.engine.aliasExists(dlg.getValue("alias"),comm.communityID)) + throw new ValidationException("That alias is already used by another community on the system."); + + if ("1"==dlg.getValue("comtype")) + { // make sure if they flagged it as Private that they specified a join key + if (vlib.emptyString(dlg.getValue("joinkey"))) + throw new ValidationException("Private communities must specify a join key value."); + + } // end if + + // save off the ContactInfo-related fields first + ci = comm.getContactInfo(); + ci.URL = dlg.getValue("url"); + ci.company = dlg.getValue("company"); + ci.addressLine1 = dlg.getValue("addr1"); + ci.addressLine2 = dlg.getValue("addr2"); + ci.locality = dlg.getValue("loc"); + ci.region = dlg.getValue("reg"); + ci.postalCode = dlg.getValue("pcode"); + ci.country = dlg.getValue("country"); + comm.putContactInfo(ci); + + // now save off the property-related fields + props = comm.properties; + props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue(); + comm.properties = props; + + // now save the big text fields + comm.name = dlg.getValue("name"); + comm.alias = dlg.getValue("alias"); + comm.synopsis = dlg.getValue("synopsis"); + comm.rules = dlg.getValue("rules"); + comm.setLanguage(dlg.getValue("language")); + + if (!(comm.isAdminCommunity())) + { // save off the security information + if ("1"==dlg.getValue("comtype")) + comm.joinKey = dlg.getValue("joinkey"); + else + comm.joinKey = null; + + comm.membersOnly = dlg.getValue("membersonly").booleanValue(); + comm.setHideMode(parseInt(dlg.getValue("hidemode"),10)); + comm.setSecurityLevels(parseInt(dlg.getValue("read_lvl"),10),parseInt(dlg.getValue("write_lvl"),10), + parseInt(dlg.getValue("create_lvl"),10),parseInt(dlg.getValue("delete_lvl"),10), + parseInt(dlg.getValue("join_lvl"),10)); + + } // end if + + // bounce back to the admin menu + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + rc = new Redirect("comm/admin_menu.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception setting the profile + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // validation error - redisplay the dialog + dlg.setErrorMessage(e.message + " Please try again."); + setupDialog(dlg,comm); + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error updating community: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end try +else +{ // what the hell was that button? + logger.error("no known button click on POST to comm/profile.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "comm/admin_menu.js.vs?cc=" + comm.communityID); + +} // end else + +vlib.output(rc); diff --git a/scripts/comm/sb_list.js b/scripts/comm/sb_list.js new file mode 100644 index 0000000..216d392 --- /dev/null +++ b/scripts/comm/sb_list.js @@ -0,0 +1,46 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +rc = null; +try +{ // get and save the member communities list + rinput.setRequestAttribute("communities.list",rinput.user.getMemberCommunities()); + + rc = new JSPView("Your Communities","comm/sb_list.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_TOP; + +} // end try +catch (e) +{ // try to catch an exception + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error getting communities list: " + e.message,"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/comm/sb_unjoin.js b/scripts/comm/sb_unjoin.js new file mode 100644 index 0000000..72b9b9f --- /dev/null +++ b/scripts/comm/sb_unjoin.js @@ -0,0 +1,72 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"comm/sb_list.js.vs"); + +if (!(comm.canUnjoin())) +{ // you can't unjoin the community + vlib.output(new ErrorBox("Community Error","You are not permitted to unjoin this community.", + "comm/sb_list.js.vs")); + vlib.done(); + +} // end if + +// the names of the confirmation attribute and parameter +CONFIRM_attr = "confirmbox.unjoin"; +CONFIRM_param = "confirm"; + +rc = null; +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // we are confirmed - unjoin us! + try + { // do the unjoin + comm.unjoin(); + + // force the menus to be redrawn + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + + // after which, return to the top + rc = new Redirect("comm/sb_list.js.vs",LinkTypes.SERVLET); + + } // end try + catch (e) + { // caught an exception while unjoining + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","Unable to unjoin community: " + e.message,"comm/sb_list.js.vs"); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error unjoining community: " + e.message, + "comm/sb_list.js.vs"); + else + rc = e; + + } // end catch + +} // end if +else // not yet confirmed - display the confirmation box + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Unjoining Community", + "Are you sure you want to unjoin the '" + comm.name + "' community?", + "comm/sb_unjoin.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET, + "comm/sb_list.js.vs",LinkTypes.SERVLET); + +vlib.output(rc); diff --git a/scripts/comm/set_member.js b/scripts/comm/set_member.js new file mode 100644 index 0000000..6c37220 --- /dev/null +++ b/scripts/comm/set_member.js @@ -0,0 +1,219 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// Function which sets the correct community access level onto each entry of the input list. +function augmentList(comm,list) +{ + var rl = new ArrayList(list.size()); + var it = list.iterator(); + while (it.hasNext()) + { // get the community level and add it to the UserFound object + var uf = vlib.castUserFound(it.next()); + var level = comm.getMemberLevel(uf.UID); + rl.add(uf.createNewLevel(level)); + + } // end while + + return rl; + +} // end augmentList + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canModifyProfile())) +{ // no access - sorry, dude + logger.error("tried to call up membership screen without access...naughty naughty!"); + vlib.output(new ErrorBox("Unauthorized","You do not have access to modify this community's membership.", + "comm/admin_menu.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// create the view object +view = new SetMemberView(rinput.engine.getStdNumSearchResults(),comm); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the initial state of the view + try + { // get the community membership list + mbr_list = comm.getMemberList(); + view.simple = true; + view.results = mbr_list; + view.findCount = mbr_list.size(); + rc = view; + + } // end try + catch (e) + { // we can get at least one exception here + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error retrieving membership list: " + e.message, + "comm/admin_menu.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("update")) +{ // do an update of privileges in this community + list_uids = vlib.splitList(rinput.getParameter("listuids"),":"); + try + { // loop through the defined UIDs and check the level... + it = list_uids.iterator(); + while (it.hasNext()) + { // get the current and new levels, compare them, and reset if needed + x = it.next(); + cur_level = rinput.getParameterInt("zxcur_" + x,-1); + new_level = rinput.getParameterInt("zxnew_" + x,-1); + if (cur_level!=new_level) + comm.setMembership(parseInt(x,10),new_level); + + } // end while + + } // end try + catch (e) + { // the update might throw an error message + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error adjusting permissions: " + e.message, + "comm/set_member.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/set_member.js.vs?cc=" + comm.communityID); + else + rc = e; + + vlib.output(rc); // bail out now with the error message + vlib.done(); + + } // end catch + +} // end if + +// Carry on with the search operation now. +try +{ // handle the actual search + if ("1"==rinput.getParameter("sl")) + { // Set up some of the easy initial parameters. + view.simple = true; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + // view.findCount = rinput.getParameterInt("fcount",-1); (N.B.: will get reassigned below) + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + throw new ValidationException("Invalid button clicked."); // can't happen + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else if (!(rinput.isImageButtonClicked("update"))) + throw new ValidationException("Unable to determine what action triggered the form."); + + // Get the list and subset it if necessary. + // N.B.: Since the update function can reduce the size of the member list, we need to take into account + // that the find count will need updating and the offset may be in the wrong place for the list now. + mbr_list = comm.getMemberList(); + view.findCount = mbr_list.size(); + while ((view.offset>0) && (view.offset>=view.findCount)) + view.offset = Math.max(view.offset-view.maxResults,0); + if (view.offset==0) + view.results = mbr_list; + else + view.results = mbr_list.subList(offset,mbr_list.size()); + + } // end if + else + { // This is a search operation... + view.simple = false; + + // Get the search field parameter. + x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME); + if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION) + && (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + // Get the search mode parameter. + x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX); + if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) + && (x!=SearchMode.SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + view.mode = x; + + // Get the search term parameter. + view.term = rinput.getParameter("term"); + if (view.term==null) + view.term = ""; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + view.offset = 0; // begin a new search + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else if (!(rinput.isImageButtonClicked("update"))) + throw new ValidationException("Unable to determine what action triggered the form."); + + // Perform the search! (Note that we search on USERS, not MEMBERS, as this is the way that we + // add additional members to a community.) + tmp_results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,view.maxResults); + view.results = augmentList(comm,tmp_results); + if (view.findCount<0) + view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term); + + } // end else (search operation) + + rc = view; + +} // end try +catch (e) +{ // handle an error in search + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + rc = new ErrorBox("Find Error",e.message + " Please try again.", + "comm/set_member.js.vs?cc=" + comm.communityID); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting member list: " + e.message, + "comm/set_member.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"comm/set_member.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/comm/show.js b/scripts/comm/show.js new file mode 100644 index 0000000..98417be --- /dev/null +++ b/scripts/comm/show.js @@ -0,0 +1,88 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +rc = null; +try +{ // retrieve certain possibly problematic data items and save them as attributes + ci = comm.getContactInfo(); + rinput.setRequestAttribute("contact.info",ci); + rinput.setRequestAttribute("host.profile",comm.getHostProfile()); + rinput.setRequestAttribute("category",comm.getCategory()); + + // determine the last line of the address and save it off + buf = null; + if (vlib.emptyString(ci.locality)) + { // allocate stringbuffer based on region + if (vlib.emptyString(ci.region)) + buf = new java.lang.StringBuffer(); + else + buf = new java.lang.StringBuffer(ci.region); + + } // end if + else if (vlib.emptyString(ci.region)) + buf = new java.lang.StringBuffer(ci.locality); + else + { // tack together both locality and region + buf = new java.lang.StringBuffer(ci.locality); + buf.append(", "); + buf.append(ci.region); + + } // end else + + if (!(vlib.emptyString(ci.postalCode))) + { // append the postal code + buf.append(" "); + buf.append(ci.postalCode); + + } // end if + + rinput.setRequestAttribute("address.lastline",buf.toString()); + + // get the full country name and save it off + ce = Packages.com.silverwrist.util.International.get().getCountryForCode(ci.country); + if (ce!=null) + rinput.setRequestAttribute("address.country",ce.name); + + // Save off the community logo tag. + rinput.setRequestAttribute("community.logo",rinput.getCommunityLogoTag(ci.photoURL)); + + // create the view object + rc = new JSPView("Community Profile: " + comm.name,"comm/profile.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + rc.pageQID = "go/" + comm.alias + "!"; + +} // end try +catch (e) +{ // handle an exception thrown by the profile code + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error accessing community: " + e.message,"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/comm/unjoin.js b/scripts/comm/unjoin.js new file mode 100644 index 0000000..86a1c64 --- /dev/null +++ b/scripts/comm/unjoin.js @@ -0,0 +1,70 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canUnjoin())) +{ // you can't unjoin the community + vlib.output(new ErrorBox("Community Error","You are not permitted to unjoin this community.","top.js.vs")); + vlib.done(); + +} // end if + +// the names of the confirmation attribute and parameter +CONFIRM_attr = "confirmbox.unjoin"; +CONFIRM_param = "confirm"; + +rc = null; +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // we are confirmed - unjoin us! + try + { // do the unjoin + comm.unjoin(); + + // force the menus to be redrawn + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + + // after which, return to the top + rc = new Redirect("top.js.vs",LinkTypes.SERVLET); + + } // end try + catch (e) + { // caught an exception while unjoining + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","Unable to unjoin community: " + e.message,"top.js.vs"); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error unjoining community: " + e.message,"top.js.vs"); + else + rc = e; + + } // end catch + +} // end if +else // not yet confirmed - display the confirmation box + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Unjoining Community", + "Are you sure you want to unjoin the '" + comm.name + "' community?", + "comm/unjoin.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET, + "community/" + comm.alias,LinkTypes.SERVLET); + +vlib.output(rc); diff --git a/scripts/conf/add_to_hotlist.js b/scripts/conf/add_to_hotlist.js new file mode 100644 index 0000000..3d98a87 --- /dev/null +++ b/scripts/conf/add_to_hotlist.js @@ -0,0 +1,53 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +rc = null; +try +{ // add to the hotlist + conf.addToHotlist(); + + // trap back to the topics list + rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +} // end try +catch (e) +{ // error doing the add + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error adding to hotlist: " + e.message, + "conf/conferences.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/alias_add.js b/scripts/conf/alias_add.js new file mode 100644 index 0000000..77994f1 --- /dev/null +++ b/scripts/conf/alias_add.js @@ -0,0 +1,79 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/aliases.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error", + "You do not have permission to change this conference's aliases.",on_error)); + vlib.done(); + +} // end if + +alias = rinput.getParameter("alias"); +if (vlib.emptyString(alias)) +{ // this is a no-op + vlib.output(new NullResponse()); + vlib.done(); + +} // end if + +if (!(vlib.validVeniceID(alias))) +{ // we're not a valid Venice ID + on_error += ("&errmsg=" + + vlib.encodeURL("The alias you have entered is not a valid identifier. Please try again.")); + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +try +{ // add the alias + conf.addAlias(alias); + + // bounce back to the aliases display + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error in the alias definitions + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error adding alias: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/alias_remove.js b/scripts/conf/alias_remove.js new file mode 100644 index 0000000..486edf2 --- /dev/null +++ b/scripts/conf/alias_remove.js @@ -0,0 +1,70 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/aliases.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error", + "You do not have permission to change this conference's aliases.",on_error)); + vlib.done(); + +} // end if + +alias = rinput.getParameter("alias"); +if (vlib.emptyString(alias)) +{ // this is a no-op + vlib.output(new NullResponse()); + vlib.done(); + +} // end if + +rc = null; +try +{ // remove the alias + conf.removeAlias(alias); + + // bounce back to the aliases display + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error in the alias definitions + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error removing alias: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/aliases.js b/scripts/conf/aliases.js new file mode 100644 index 0000000..58a2569 --- /dev/null +++ b/scripts/conf/aliases.js @@ -0,0 +1,62 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error", + "You do not have permission to change this conference's aliases.",on_error)); + vlib.done(); + +} // end if + +rc = null; +try +{ // get the aliases list + rinput.setRequestAttribute("conference.aliases.list",conf.aliases); + rinput.setRequestAttribute("conference.aliases.error_message",rinput.getParameter("errmsg")); + + // create the resulting view + rc = new JSPView("Manage Conference Aliases: " + conf.name,"conf/aliases.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error in the alias definitions + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting aliases: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/archive_topic.js b/scripts/conf/archive_topic.js new file mode 100644 index 0000000..f7e06e2 --- /dev/null +++ b/scripts/conf/archive_topic.js @@ -0,0 +1,56 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +rc = null; +try +{ // get the flag and set the archived status + flag = rinput.getParameterInt("flag",0); + topic.setArchived(flag==1); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting archived status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/conf_reports.js b/scripts/conf/conf_reports.js new file mode 100644 index 0000000..4ee7d0a --- /dev/null +++ b/scripts/conf/conf_reports.js @@ -0,0 +1,57 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +rc = null; +try +{ // get a topic list from the conference + topics = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER); + rinput.setRequestAttribute("conference.reports.topiclist",topics); + + // create the result view + rc = new JSPView("Conference Reports: " + conf.name,"conf/report_menu.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error generating the topic list + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error listing topics: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/conferences.js b/scripts/conf/conferences.js new file mode 100644 index 0000000..c5f7915 --- /dev/null +++ b/scripts/conf/conferences.js @@ -0,0 +1,71 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +rc = null; +try +{ // generate the conference listing + clist = comm.conferences; + + // get the list of hosts for each conference + hlist = new ArrayList(clist.size()); + for (i=0; i. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canCreateConference())) +{ // can't create a conference + vlib.output(new ErrorBox("Access Error","You are not permitted to create conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("conf.create"); + +if ("GET"==rinput.verb) +{ // return the dialog to be filled in + dlg.setSubtitle("in Community: " + comm.name); + dlg.setValue("cc",comm.communityID + ""); + vlib.output(dlg); + vlib.done(); + +} // end if + +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // they canceled - redirect back to the conferences list + vlib.output(new Redirect("conf/conferences.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the dialog + +rc = null; +if (op=="create") +{ // we actually want to create the conference... + try + { // first validate the dialog + dlg.validate(); + + // now validate that the alias doesn't exist yet + if (rinput.engine.confAliasExists(dlg.getValue("alias"))) + throw new ValidationException("That alias is already used by another conference on the system."); + + // OK, create the conference! + pvt = ("1"==dlg.getValue("ctype")); + conf = comm.createConference(dlg.getValue("name"),dlg.getValue("alias"),dlg.getValue("descr"),pvt, + dlg.getValue("hide").booleanValue()); + + // now bounce to the new conference's topic list so we can start setting it up + rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // error creating the conference + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // reset the dialog and try again + dlg.setErrorMessage(e.message + " Please try again."); + dlg.setSubtitle("in Community: " + comm.name); + rc = dlg; + + } // end if + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error creating conference: " + e.message, + "conf/conferences.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end if +else +{ // error - don't know what button was clicked + logger.error("no known button click on POST to conf/create.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "conf/conferences.js.vs?cc=" + comm.communityID); + +} // end else + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/conf/custom.js b/scripts/conf/custom.js new file mode 100644 index 0000000..045c295 --- /dev/null +++ b/scripts/conf/custom.js @@ -0,0 +1,111 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error", + "You do not have permission to change this conference's customizations.",on_error)); + vlib.done(); + +} // end if + +rc = null; +if ("GET"==rinput.verb) +{ // display the customization dialog + try + { // retrieve the existing customizations + tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); + if (tmp==null) + tmp = ""; + rinput.setRequestAttribute("conference.custom.top",tmp); + tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); + if (tmp==null) + tmp = ""; + rinput.setRequestAttribute("conference.custom.bottom",tmp); + + // create the view + rc = new JSPView("Customize Conference: " + conf.name,"conf/custom.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // error in getting custom blocks + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting customization blocks: " + e.message,on_error); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // cancelled - bail out! + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (!(rinput.isImageButtonClicked("update"))) +{ // what button got pressed?!?!? + logger.error("no known button click on POST to conf/custom.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error)); + vlib.done(); + +} // end if + +try +{ // reset the custom blocks + conf.setCustomBlock(ConferenceContext.CUST_BLOCK_TOP,rinput.getParameter("tx")); + conf.setCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM,rinput.getParameter("bx")); + + // bounce back to the manage conference menu + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error changing customizations + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting customizations: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/custom_remove.js b/scripts/conf/custom_remove.js new file mode 100644 index 0000000..73ba356 --- /dev/null +++ b/scripts/conf/custom_remove.js @@ -0,0 +1,62 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error", + "You do not have permission to change this conference's customizations.",on_error)); + vlib.done(); + +} // end if + +rc = null; +try +{ // clear the custom blocks + conf.removeCustomBlocks(); + + // bounce back to the manage conference menu + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error changing customizations + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error removing customizations: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/delete.js b/scripts/conf/delete.js new file mode 100644 index 0000000..3612734 --- /dev/null +++ b/scripts/conf/delete.js @@ -0,0 +1,84 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canManageConferences())) +{ // can't manage conferences, bail out + vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +if (!(conf.canDeleteConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to delete this conference.", + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID)); + vlib.done(); + +} // end if + +CONFIRM_attr = "conferences.manage.delete.ConfirmBox"; +CONFIRM_param = "confirm"; + +rc = null; +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // it is confirmed - we want to delete the conference! + try + { // delete the conference (using the alias function to avoid using the delete keyword) + conf.deleteConference(); + + // trap back to the conferences list + rc = new Redirect("conf/conferences.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // handle error in deletion + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error deleting conference: " + e.message, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + else + rc = e; + + } // end catch + +} // end if +else // come up with the confirm box + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Conference", + "You are about to permanently delete the '" + conf.name + + "' conference! Are you sure you want to do this?", + "conf/delete.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID, + LinkTypes.SERVLET); + +vlib.output(rc); // all done! diff --git a/scripts/conf/delete_topic.js b/scripts/conf/delete_topic.js new file mode 100644 index 0000000..37d38a1 --- /dev/null +++ b/scripts/conf/delete_topic.js @@ -0,0 +1,70 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +CONFIRM_attr = "conferences.topic.delete.ConfirmBox"; +CONFIRM_param = "confirm"; + +rc = null; +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // it is confirmed - we want to delete the topic! + try + { // delete the bloody thing! + topic.deleteTopic(); + + // bounce back to the topic list on success + rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // error deleting + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error deleting topic: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + } // end catch + +} // end if +else // come up with the confirm box + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Topic", + "You are about to delete topic " + topic.topicNumber + " ('" + topic.name + + "') from the '" + conf.name + "' conference! Are you sure you want to do this?", + "conf/delete_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber,LinkTypes.SERVLET,on_error,LinkTypes.SERVLET); + +vlib.output(rc); // all done... diff --git a/scripts/conf/edit.js b/scripts/conf/edit.js new file mode 100644 index 0000000..fe8f07b --- /dev/null +++ b/scripts/conf/edit.js @@ -0,0 +1,171 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Define a simple function to set up the dialog stuff. +function setupDialog(dlg,conf) +{ + dlg.setSubtitle(conf.name); + sinf = conf.securityInfo; + dlg.sendMessage("read_lvl","setRoleList",sinf.getRoleList("Conference.Read")); + dlg.sendMessage("post_lvl","setRoleList",sinf.getRoleList("Conference.Post")); + dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Conference.Create")); + dlg.sendMessage("hide_lvl","setRoleList",sinf.getRoleList("Conference.Hide")); + dlg.sendMessage("nuke_lvl","setRoleList",sinf.getRoleList("Conference.Nuke")); + dlg.sendMessage("change_lvl","setRoleList",sinf.getRoleList("Conference.Change")); + dlg.sendMessage("delete_lvl","setRoleList",sinf.getRoleList("Conference.Delete")); + dlg.setEnabled("hide",conf.canSetHideList()); + +} // end setupDialog + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to change this conference's attributes.", + on_error)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("conf.edit"); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the dialog + setupDialog(dlg,conf); + + try + { // fill the dialog with the conference information + dlg.setValue("cc",comm.communityID + ""); + dlg.setValue("conf",conf.confID + ""); + dlg.setValue("name",conf.name); + dlg.setValue("descr",conf.description); + if (conf.canSetHideList() && conf.getHideList()) + dlg.setValue("hide",1); + dlg.setValue("read_lvl",conf.getReadLevel() + ""); + dlg.setValue("post_lvl",conf.getPostLevel() + ""); + dlg.setValue("create_lvl",conf.getCreateLevel() + ""); + dlg.setValue("hide_lvl",conf.getHideLevel() + ""); + dlg.setValue("nuke_lvl",conf.getNukeLevel() + ""); + dlg.setValue("change_lvl",conf.getChangeLevel() + ""); + dlg.setValue("delete_lvl",conf.getDeleteLevel() + ""); + + props = conf.properties; + if (props.displayPostPictures) + dlg.setValue("pic_in_post",1); + + rc = dlg; + + } // end try + catch (e) + { // error initializing dialog + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting up dialog: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled profile update - bounce back to the target + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (op!="update") +{ // what the hell was that button? + logger.error("no known button click on POST to conf/edit.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the values into the dialog + +try +{ // validate the dialog + dlg.validate(); + + // get all the levels out of the dialog + read_lvl = dlg.getValue("read_lvl").intValue(); + post_lvl = dlg.getValue("post_lvl").intValue(); + create_lvl = dlg.getValue("create_lvl").intValue(); + hide_lvl = dlg.getValue("hide_lvl").intValue(); + nuke_lvl = dlg.getValue("nuke_lvl").intValue(); + change_lvl = dlg.getValue("change_lvl").intValue(); + delete_lvl = dlg.getValue("delete_lvl").intValue(); + + // set the various conference attributes + conf.setSecurityLevels(read_lvl,post_lvl,create_lvl,hide_lvl,nuke_lvl,change_lvl,delete_lvl); + conf.name = dlg.getValue("name"); + conf.description = dlg.getValue("descr"); + if (conf.canSetHideList()) + conf.setHideList(dlg.getValue("hide").booleanValue()); + + // set the conference properties + props = conf.properties; + props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue(); + conf.properties = props; + + // bounce back to the manage display + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error editing the conference + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // reset the dialog and try again + dlg.setErrorMessage(e.message + " Please try again."); + setupDialog(dlg,conf); + rc = dlg; + + } // end if + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error editing conference: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/email.js b/scripts/conf/email.js new file mode 100644 index 0000000..4eb2c83 --- /dev/null +++ b/scripts/conf/email.js @@ -0,0 +1,113 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +rc = null; +if ("GET"==rinput.verb) +{ // display the dialog + try + { // we need the topic list + tlist = conf.getTopicList(ConferenceContext.DISPLAY_ALL,ConferenceContext.SORT_NAME); + rinput.setRequestAttribute("topic.email.list",tlist); + + // create the dialog + rc = new JSPView("Conference E-Mail: " + conf.name,"conf/email.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // unable to get topic list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting up dialog: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // cancelled - bail out! + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (!(rinput.isImageButtonClicked("send"))) +{ // what button got pressed?!?!? + logger.error("no known button click on POST to conf/email.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error)); + vlib.done(); + +} // end if + +try +{ // retrieve the topic we want to send to + topic = null; + tnum = rinput.getParameterShort("top",0); + if (tnum>0) + topic = conf.getTopic(tnum); + + // retrieve other parameters + posters = (rinput.getParameterInt("porl",0)==0) + ndays = -1; + if ("Y"==rinput.getParameter("xday")) + ndays = rinput.getParameterInt("day",-1); + + // send the E-mail! + if (topic!=null) + topic.sendMailToParticipants(posters,ndays,rinput.getParameter("subj"),rinput.getParameter("pb")); + else + conf.sendMailToParticipants(posters,ndays,rinput.getParameter("subj"),rinput.getParameter("pb")); + + // bounce back to the manage conference menu + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // exception sending the E-mail + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending E-mail: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done.... diff --git a/scripts/conf/find.js b/scripts/conf/find.js new file mode 100644 index 0000000..6e5f17c --- /dev/null +++ b/scripts/conf/find.js @@ -0,0 +1,117 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); +on_error = "conf/conferences.js.vs?cc=" + comm.communityID; + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(false,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the topic +topic = null; +if (conf!=null) +{ // get the topic + on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + topic = currc.getTopic(false,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + if (topic!=null) + on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber; + +} // end if + +view = new FindPostsView(comm,conf,topic); +view.maxResults = rinput.engine.getStdNumSearchResults(); + +if ("GET"==rinput.verb) +{ // display the find dialog + vlib.output(view); + vlib.done(); + +} // end if + +// Retrieve the search term parameter. +tmp = rinput.getParameter("term"); +if (tmp==null) + view.term = ""; +else + view.term = tmp; + +// Retrieve the offset and find count parameters. +view.offset = rinput.getParameterInt("ofs",0); +view.findCount = rinput.getParameterInt("fcount",-1); + +// Adjust the search return offset based on the command button click. +if (rinput.isImageButtonClicked("search")) + view.offset = 0; +else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset - view.maxResults,0); // go backwards +else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; // go forwards instead +else + throw new InternalStateError("Unable to determine what action triggered the form."); + +rc = null; +try +{ // do the search + if (topic!=null) + { // search the topic + view.results = topic.searchPosts(term,offset,view.maxResults); + if (view.findCount<0) + view.findCount = topic.getSearchPostCount(term); + + } // end if + else if (conf!=null) + { // search the conference + view.results = conf.searchPosts(term,offset,view.maxResults); + if (view.findCount<0) + view.findCount = conf.getSearchPostCount(term); + + } // end else if + else + { // search the community + view.results = comm.searchPosts(term,offset,view.maxResults); + if (view.findCount<0) + view.findCount = comm.getSearchPostCount(term); + + } // end else + + rc = view; + +} // end try +catch (e) +{ // error doing the find + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error on find: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/conf/fixseen.js b/scripts/conf/fixseen.js new file mode 100644 index 0000000..e53b0e0 --- /dev/null +++ b/scripts/conf/fixseen.js @@ -0,0 +1,54 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/manage_conf.js.vs?cc=" + comm.communityID); + +rc = null; +try +{ // the dreaded fixseen :-) + conf.fixSeen(); + + // don't change the current view + rc = new NullResponse(); + +} // end try +catch (e) +{ // error resetting the pseud + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error catching up conference: " + e.message, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/freeze_topic.js b/scripts/conf/freeze_topic.js new file mode 100644 index 0000000..5d38a5f --- /dev/null +++ b/scripts/conf/freeze_topic.js @@ -0,0 +1,56 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +rc = null; +try +{ // get the flag and set the frozen status + flag = rinput.getParameterInt("flag",0); + topic.setFrozen(flag==1); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting frozen status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/hide_message.js b/scripts/conf/hide_message.js new file mode 100644 index 0000000..41e1928 --- /dev/null +++ b/scripts/conf/hide_message.js @@ -0,0 +1,61 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +// get the message under consideration +msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + + conf.confID + "&top=" + topic.topicNumber); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber + + "&p1=" + msg.getPostNumber() + "&shac=1"; + +rc = null; +try +{ // get the flag and set the hide status + flag = rinput.getParameterInt("flag",0); + msg.setHidden(flag==1); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/hide_topic.js b/scripts/conf/hide_topic.js new file mode 100644 index 0000000..2c276f1 --- /dev/null +++ b/scripts/conf/hide_topic.js @@ -0,0 +1,56 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +rc = null; +try +{ // get the flag and set the hide status + flag = rinput.getParameterInt("flag",0); + topic.setHidden(flag==1); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/hotlist.js b/scripts/conf/hotlist.js new file mode 100644 index 0000000..268c129 --- /dev/null +++ b/scripts/conf/hotlist.js @@ -0,0 +1,47 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +rc = null; +try +{ // get the hotlist and save it off for the display + rinput.setRequestAttribute("user.conf.hotlist",rinput.user.getConferenceHotlist()); + + // create a JSPView with the hot list + rc = new JSPView("Your Conference Hotlist","conf/hotlist.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_TOP; + +} // end try +catch (e) +{ // unable to get the hotlist + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error getting hotlist: " + e.message,"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/conf/hotlist_delete.js b/scripts/conf/hotlist_delete.js new file mode 100644 index 0000000..04d43de --- /dev/null +++ b/scripts/conf/hotlist_delete.js @@ -0,0 +1,64 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +// get the two index values +ndx = rinput.getParameterInt("ndx",-1); +if (ndx<0) +{ // index values out of range + vlib.output(new ErrorBox(null,"Invalid index parameter.","conf/hotlist.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // get the hotlist and further check the parameters + hotlist = rinput.user.getConferenceHotlist(); + if (ndx>=hotlist.size()) + throw new ErrorBox(null,"Invalid index parameter.","conf/hotlist.js.vs"); + + // get the hotlist entry and conference + ntry = vlib.castConferenceHotlistEntry(hotlist.get(ndx)); + conf = ntry.getConference(); + + // remove the conference + conf.removeFromHotlist(); + + // bounce back to the hotlist screen + rc = new Redirect("conf/hotlist.js.vs",LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error adjusting the hotlist sequence + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adjusting hotlist: " + e.message,"conf/hotlist.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done diff --git a/scripts/conf/hotlist_move.js b/scripts/conf/hotlist_move.js new file mode 100644 index 0000000..638a31e --- /dev/null +++ b/scripts/conf/hotlist_move.js @@ -0,0 +1,82 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +// get the two index values +ndx = rinput.getParameterInt("ndx",-1); +ndx2 = rinput.getParameterInt("ndx2",-1); +if ((ndx<0) || (ndx2<0) || (ndx==ndx2)) +{ // index values out of range + vlib.output(new ErrorBox(null,"Invalid index parameters.","conf/hotlist.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // get the hotlist and further check the parameters + hotlist = rinput.user.getConferenceHotlist(); + if ((ndx>=hotlist.size()) || (ndx2>=hotlist.size())) + throw new ErrorBox(null,"Invalid index parameters.","conf/hotlist.js.vs"); + + // get the hotlist entries + entry1 = vlib.castConferenceHotlistEntry(hotlist.get(ndx)); + entry2 = vlib.castConferenceHotlistEntry(hotlist.get(ndx2)); + + // get the sequence numbers + seq1 = entry1.getSequence(); + seq2 = entry2.getSequence(); + + // now reassign the sequences + entry1.setHotlistSequence(seq2); + restore = true; + try + { // set the second sequence + entry2.setHotlistSequence(seq1); + restore = false; + + } // end try + finally + { // restore the first sequence on error + if (restore) + entry1.setHotlistSequence(seq1); + + } // end finally + + // bounce back to the hotlist screen + rc = new Redirect("conf/hotlist.js.vs",LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error adjusting the hotlist sequence + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adjusting hotlist: " + e.message,"conf/hotlist.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done diff --git a/scripts/conf/invite_conf.js b/scripts/conf/invite_conf.js new file mode 100644 index 0000000..0c120c0 --- /dev/null +++ b/scripts/conf/invite_conf.js @@ -0,0 +1,96 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canSendInvitation())) +{ // you can't send an invitation + vlib.output(new ErrorBox("Conference Error","You are not permitted to send an invitation.",on_error)); + vlib.done(); + +} // end if + +if ("GET"==rinput.verb) +{ // set up the invitation screen parameters + rinput.setRequestAttribute("invitation.title","Send Conference Invitation:"); + rinput.setRequestAttribute("invitation.subtitle",conf.name); + rinput.setRequestAttribute("invitation.action",rinput.formatURL("conf/invite_conf.js.vs",LinkTypes.SERVLET)); + rinput.setRequestAttribute("invitation.params", + ""); + + // create the invitation and display it + view = new JSPView("Send Invitation","comm/invite.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + view.pageQID = "conf/invite_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + vlib.output(view); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // bounce back to the base page + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (rinput.isImageButtonClicked("send")) +{ // do the actual send! + try + { // send out the invitation and then redirect back + conf.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb")); + rc = new Redirect(on_error,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception sending the invitation + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message,on_error); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,on_error); + else + rc = e; + + } // end catch + +} // end if +else +{ // no known button pressed + logger.error("no known button click on POST to conf/invite_conf.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",on_error); + +} // end else + +vlib.output(rc); diff --git a/scripts/conf/invite_topic.js b/scripts/conf/invite_topic.js new file mode 100644 index 0000000..5706eaa --- /dev/null +++ b/scripts/conf/invite_topic.js @@ -0,0 +1,103 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber; + +if (!(topic.canSendInvitation())) +{ // you can't send an invitation + vlib.output(new ErrorBox("Conference Error","You are not permitted to send an invitation.",on_error)); + vlib.done(); + +} // end if + +if ("GET"==rinput.verb) +{ // set up the invitation screen parameters + rinput.setRequestAttribute("invitation.title","Send Topic Invitation:"); + rinput.setRequestAttribute("invitation.subtitle",topic.name); + rinput.setRequestAttribute("invitation.action", + rinput.formatURL("conf/invite_topic.js.vs",LinkTypes.SERVLET)); + rinput.setRequestAttribute("invitation.params", + ""); + + // create the invitation and display it + view = new JSPView("Send Invitation","comm/invite.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + view.pageQID = "conf/invite_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber; + vlib.output(view); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // bounce back to the base page + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (rinput.isImageButtonClicked("send")) +{ // do the actual send! + try + { // send out the invitation and then redirect back + topic.sendInvitation(rinput.getParameter("addr"),rinput.getParameter("pb")); + rc = new Redirect(on_error,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception sending the invitation + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending invitation: " + e.message,on_error); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-Mail Error","Error sending E-mail: " + e.message,on_error); + else + rc = e; + + } // end catch + +} // end if +else +{ // no known button pressed + logger.error("no known button click on POST to conf/invite_topic.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",on_error); + +} // end else + +vlib.output(rc); diff --git a/scripts/conf/lurker_report.js b/scripts/conf/lurker_report.js new file mode 100644 index 0000000..7e7dcde --- /dev/null +++ b/scripts/conf/lurker_report.js @@ -0,0 +1,90 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/conf_reports.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +// get the current topic (where applicable) +topic = currc.getTopic(false,on_error); + +rc = null; +try +{ // construct the activity list + my_list = null; + my_title = null; + title1 = null; + title2 = null; + nullmsg = null; + if (topic!=null) + { // get the reader list from the topic + my_list = topic.getActiveReaders(); + if (my_list.isEmpty()) + nullmsg = "No readers in topic \"" + topic.name + "\" found."; + my_title = "Users Reading Topic " + topic.name; + title1 = "Readers in Topic:"; + title2 = topic.name; + + } // end if + else + { // get the reader list from the conference + my_list = conf.getActiveReaders(); + if (my_list.isEmpty()) + nullmsg = "No readers in conference \"" + vlib.encodeHTML(conf.name) + "\" found."; + my_title = "Users Reading Conference " + conf.name; + title1 = "Readers in Conference:"; + title2 = conf.name; + + } // end else + + // save off the attributes + rinput.setRequestAttribute("conference.activity.list",my_list); + rinput.setRequestAttribute("conference.activity.nullmessage",nullmsg); + rinput.setRequestAttribute("conference.activity.posters",Boolean.FALSE); + rinput.setRequestAttribute("conference.activity.title",title1); + rinput.setRequestAttribute("conference.activity.subtitle",title2); + + // create the view + rc = new JSPView(my_title,"conf/activity_report.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error getting the list of readers + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting reader list: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/manage.js b/scripts/conf/manage.js new file mode 100644 index 0000000..b25060f --- /dev/null +++ b/scripts/conf/manage.js @@ -0,0 +1,86 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canManageConferences())) +{ // can't manage conferences, bail out + vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +rc = null; +try +{ // get the conference list + conf_list = comm.getConferences(); + + // allocate arrays to hold the next/previous/hidden data + a_next = vlib.createIntArray(conf_list.size()); + a_prev = vlib.createIntArray(conf_list.size()); + a_hidden = vlib.createBooleanArray(conf_list.size()); + + // determine the next/previous/hidden data in advance + prev_id = -1; + for (i=0; i0) + a_next[i-1] = conf.confID; + prev_id = conf.confID; + + } // end for + + a_next[conf_list.size()-1] = -1; + + // save off the data for the JSP page + rinput.setRequestAttribute("conference.list",conf_list); + rinput.setRequestAttribute("conference.prev.array",a_prev); + rinput.setRequestAttribute("conference.next.array",a_next); + rinput.setRequestAttribute("conference.hidden.array",a_hidden); + + // create the return view + rc = new JSPView("Manage Conference List","conf/manage_list.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error in getting the conference sequence stuff + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting conference list: " + e.message, + "conf/conferences.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/manage_conf.js b/scripts/conf/manage_conf.js new file mode 100644 index 0000000..699cce9 --- /dev/null +++ b/scripts/conf/manage_conf.js @@ -0,0 +1,45 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +if (conf.canChangeConference() || conf.canDeleteConference()) +{ // create the host tools menu + vars = new HashMap(); + vars.put("cid",comm.communityID + ""); + vars.put("confid",conf.confID + ""); + rinput.setRequestAttribute("conference.host.tools.menu",rinput.getMenu("conf.host.tools",vars)); + +} // end if + +// create and output the view +view = new JSPView("Manage Conference: " + conf.name,"conf/manage_conf.jsp"); +view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; +vlib.output(view); diff --git a/scripts/conf/manage_list_delete.js b/scripts/conf/manage_list_delete.js new file mode 100644 index 0000000..5a0ccb9 --- /dev/null +++ b/scripts/conf/manage_list_delete.js @@ -0,0 +1,82 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canManageConferences())) +{ // can't manage conferences, bail out + vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID); + +if (!(conf.canDeleteConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to delete this conference.", + "conf/manage.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +CONFIRM_attr = "conferences.manage_list.delete.ConfirmBox"; +CONFIRM_param = "confirm"; + +rc = null; +if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) +{ // it is confirmed - we want to delete the conference! + try + { // delete the conference (using the alias function to avoid using the delete keyword) + conf.deleteConference(); + + // trap back to the manage display + rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + + } // end try + catch (e) + { // handle error in deletion + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error deleting conference: " + e.message, + "conf/manage.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID); + else + rc = e; + + } // end catch + +} // end if +else // come up with the confirm box + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Delete Conference", + "You are about to permanently delete the '" + conf.name + + "' conference! Are you sure you want to do this?", + "conf/manage_list_delete.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID, + LinkTypes.SERVLET,"conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + +vlib.output(rc); // all done! diff --git a/scripts/conf/manage_list_sethide.js b/scripts/conf/manage_list_sethide.js new file mode 100644 index 0000000..fc0a7a7 --- /dev/null +++ b/scripts/conf/manage_list_sethide.js @@ -0,0 +1,72 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canManageConferences())) +{ // can't manage conferences, bail out + vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID); + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to modify this conference.", + "conf/manage.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// get the flag value +hide_flag = (rinput.getParameterInt("flag",0)==1); + +rc = null; +try +{ // set the hide flag + conf.hideList = hide_flag; + + // trap back to the manage display + rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // handle errors here + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting hide flag: " + e.message, + "conf/manage.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/manage_list_swap.js b/scripts/conf/manage_list_swap.js new file mode 100644 index 0000000..780fe4b --- /dev/null +++ b/scripts/conf/manage_list_swap.js @@ -0,0 +1,89 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +if (!(comm.canManageConferences())) +{ // can't manage conferences, bail out + vlib.output(new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", + "conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/manage.js.vs?cc=" + comm.communityID); + +// we need another conference here - get that conference parameter +other_conf = currc.getConferenceParam("other",true,"conf/manage.js.vs?cc=" + comm.communityID); + +if (!(conf.canChangeConference()) || !(other_conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to modify this conference.", + "conf/manage.js.vs?cc=" + comm.communityID)); + vlib.done(); + +} // end if + +rc = null; +try +{ // get the two sequences for starters + this_seq = conf.sequence; + other_seq = other_conf.sequence; + + // now exchange them + conf.sequence = other_seq; + restore = true; + try + { // set the second conference sequence + other_conf.sequence = this_seq; + restore = false; + + } // end try + finally + { // undo first set on error + if (restore) + conf.sequence = this_seq; + + } // end finally + + // trap back to the manage display + rc = new Redirect("conf/manage.js.vs?cc=" + comm.communityID,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error in exchanging the conference positions + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error changing sequence: " + e.message, + "conf/manage.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"conf/manage.js.vs?cc=" + comm.communityID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/manage_topic.js b/scripts/conf/manage_topic.js new file mode 100644 index 0000000..8e4e734 --- /dev/null +++ b/scripts/conf/manage_topic.js @@ -0,0 +1,57 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +rc = null; +try +{ // save off the attributes we require + rinput.setRequestAttribute("topic.bozos.list",topic.getBozos()); + + // return the view + rc = new JSPView("Manage Topic: " + topic.name,"conf/manage_topic.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error in generating bozos list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting filter list: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/membership.js b/scripts/conf/membership.js new file mode 100644 index 0000000..309352c --- /dev/null +++ b/scripts/conf/membership.js @@ -0,0 +1,222 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.conf.view); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Function which sets the correct conference access level onto each entry of the input list. +function augmentList(conf,list) +{ + var rl = new ArrayList(list.size()); + var it = list.iterator(); + while (it.hasNext()) + { // get the conference level and add it to the UserFound object + var uf = vlib.castUserFound(it.next()); + var level = conf.getMemberLevel(uf.UID); + rl.add(uf.createNewLevel(level)); + + } // end while + + return rl; + +} // end augmentList + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if (!(conf.canChangeConference())) +{ // you can't fiddle with this conference + vlib.output(new ErrorBox("Access Error","You do not have permission to change this conference's membership.", + on_error)); + vlib.done(); + +} // end if + +// create the view object +view = new ConfMemberView(rinput.engine.getStdNumSearchResults(),conf); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the initial state of the view + try + { // get the conference membership list + mbr_list = conf.getMemberList(); + view.simple = true; + view.results = mbr_list; + view.findCount = mbr_list.size(); + rc = view; + + } // end try + catch (e) + { // we can get at least one exception here + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error retrieving membership list: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("update")) +{ // do an update of privileges in this conference + list_uids = vlib.splitList(rinput.getParameter("listuids"),":"); + try + { // loop through the defined UIDs and check the level... + it = list_uids.iterator(); + while (it.hasNext()) + { // get the current and new levels, compare them, and reset if needed + x = it.next(); + cur_level = rinput.getParameterInt("zxcur_" + x,-1); + new_level = rinput.getParameterInt("zxnew_" + x,-1); + if (cur_level!=new_level) + conf.setMembership(parseInt(x,10),new_level); + + } // end while + + } // end try + catch (e) + { // the update might throw an error message + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error adjusting permissions: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + vlib.output(rc); // bail out now with the error message + vlib.done(); + + } // end catch + +} // end if + +// Carry on with the search operation now. +try +{ // handle the actual search + if ("1"==rinput.getParameter("sl")) + { // Set up some of the easy initial parameters. + view.simple = true; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + // view.findCount = rinput.getParameterInt("fcount",-1); (N.B.: will get reassigned below) + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + throw new ValidationException("Invalid button clicked."); // can't happen + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else if (!(rinput.isImageButtonClicked("update"))) + throw new ValidationException("Unable to determine what action triggered the form."); + + // Get the list and subset it if necessary. + // N.B.: Since the update function can reduce the size of the member list, we need to take into account + // that the find count will need updating and the offset may be in the wrong place for the list now. + mbr_list = conf.getMemberList(); + view.findCount = mbr_list.size(); + while ((view.offset>0) && (view.offset>=view.findCount)) + view.offset = Math.max(view.offset-view.maxResults,0); + if (view.offset==0) + view.results = mbr_list; + else + view.results = mbr_list.subList(offset,mbr_list.size()); + + } // end if + else + { // This is a search operation... + view.simple = false; + + // Get the search field parameter. + x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME); + if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION) + && (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + // Get the search mode parameter. + x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX); + if ( (x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) + && (x!=SearchMode.SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + view.mode = x; + + // Get the search term parameter. + view.term = rinput.getParameter("term"); + if (view.term==null) + view.term = ""; + + // Retrieve the offset and find count. + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // Adjust the offset based on the button clicked. + if (rinput.isImageButtonClicked("search")) + view.offset = 0; // begin a new search + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view.offset-view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else if (!(rinput.isImageButtonClicked("update"))) + throw new ValidationException("Unable to determine what action triggered the form."); + + // Perform the search! (Note that we search on COMMUNITY members, not CONFERENCE members, as this is the + // way that we add additional members to a conference.) + tmp_results = comm.searchForMembers(view.field,view.mode,view.term,view.offset,view.maxResults); + view.results = augmentList(conf,tmp_results); + if (view.findCount<0) + view.findCount = comm.getSearchMemberCount(view.field,view.mode,view.term); + + } // end else (search operation) + + rc = view; + +} // end try +catch (e) +{ // handle an error in search + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + rc = new ErrorBox("Find Error",e.message + " Please try again.",on_error); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting member list: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/message_bozo.js b/scripts/conf/message_bozo.js new file mode 100644 index 0000000..f61f9c1 --- /dev/null +++ b/scripts/conf/message_bozo.js @@ -0,0 +1,61 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +// get the message under consideration +msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + + conf.confID + "&top=" + topic.topicNumber); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber + + "&p1=" + msg.getPostNumber() + "&shac=1"; + +rc = null; +try +{ // get the flag and set the hide status + flag = rinput.getParameterInt("flag",0); + topic.setBozo(msg.creatorUID,(flag==1)); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting hide status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/new_topic.js b/scripts/conf/new_topic.js new file mode 100644 index 0000000..8e062c5 --- /dev/null +++ b/scripts/conf/new_topic.js @@ -0,0 +1,145 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +if ("GET"==rinput.verb) +{ // create the blank "New Topic Form" + rinput.setRequestAttribute("postbox.newtopic",""); + rinput.setRequestAttribute("postbox.pseud",conf.defaultPseud); + rinput.setRequestAttribute("postbox.data",""); + view = new JSPView("Create New Topic","conf/new_topic.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + vlib.output(view); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("cancel")) +{ // they cancelled - bail out + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("preview")) +{ // generate a preview! start by passing all the data through the HTML checker as needed + try + { // escape the title + checker = rinput.engine.getEscapingChecker(); + checker.append(rinput.getParameter("title")); + checker.finish(); + rinput.setRequestAttribute("postbox.newtopic",checker.getValue()); + + // escape the pseud + checker.reset(); + checker.append(rinput.getParameter("pseud")); + checker.finish(); + rinput.setRequestAttribute("postbox.pseud",checker.getValue()); + + // escape the data + postdata = rinput.getParameter("pb"); + checker.reset(); + checker.append(postdata); + checker.finish(); + rinput.setRequestAttribute("postbox.data",checker.getValue()); + + // run the preview + checker = conf.getNewTopicPreviewChecker(); + checker.append(postdata); + checker.finish(); + rinput.setRequestAttribute("preview.text",checker.getValue()); + rinput.setRequestAttribute("preview.num_errors",new java.lang.Integer(checker.getCounter("spelling"))); + + } // end try + catch (e) + { // watch out for spurious HTMLCheckerExceptions + etype = vlib.exceptionType(e) + ""; + if (etype.match("HTMLCheckerException")) + throw new InternalStateError("spurious HTMLCheckerException thrown"); + else + throw new InternalStateError("unknown exception thrown in new_topic.js preview: " + e); + + } // end catch + + // save off any additional parameters we need + tmp = rinput.getParameter("attach"); + if (!(vlib.emptyString(tmp))) + rinput.setRequestAttribute("postbox.attach","Y"); + + // create a JSPView for the preview and output it + view = new JSPView("Preview New Topic","conf/new_topic.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + vlib.output(view); + vlib.done(); + +} // end if + +if (!(rinput.isImageButtonClicked("post1"))) +{ // there were only the three buttons - bug out! + logger.error("no known button click on POST to conf/new_topic.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error)); + vlib.done(); + +} // end if + +rc = null; +try +{ // add the new topic! + topic = conf.addTopic(rinput.getParameter("title"),rinput.getParameter("pseud"),rinput.getParameter("pb")); + + // decide where we go from here + if (vlib.emptyString(rinput.getParameter("attach"))) + rc = new Redirect(on_error,LinkTypes.SERVLET); // bounce straight to our new view! + else + { // we need to display the attachment form + msg = topic.getMessage(0); // the message the attachment gets hooked to + rinput.setRequestAttribute("attachment.postid",msg.postID + ""); + rinput.setRequestAttribute("attachment.target",on_error); + rc = new JSPView("Upload Attachment","conf/attachment.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end else + +} // end try +catch (e) +{ // new topic creation failed + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error creating topic: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/nuke_message.js b/scripts/conf/nuke_message.js new file mode 100644 index 0000000..7e6873d --- /dev/null +++ b/scripts/conf/nuke_message.js @@ -0,0 +1,82 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +// get the message under consideration +msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + + conf.confID + "&top=" + topic.topicNumber); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber + + "&p1=" + msg.getPostNumber() + "&shac=1"; + +CONFIRM_attr = "conferences.message.nuke.ConfirmBox"; +CONFIRM_param = "confirm"; + +rc = null; +try +{ // do the nuke here... + if (ConfirmBox.isConfirmed(rinput,CONFIRM_attr,CONFIRM_param)) + { // it is confirmed - we want to nuke the message! + msg.nuke(); + + // bounce back to the topic display afterwards + rc = new Redirect("conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber,LinkTypes.SERVLET); + + } // end if + else + { // come up with the confirm box (this may throw exceptions too) + aliases = conf.aliases; + rc = new ConfirmBox(rinput,CONFIRM_attr,CONFIRM_param,"Nuke Message", + "You are about to nuke message <" + aliases.get(0).toString() + "." + topic.topicNumber + + "." + msg.postNumber + ">, originally composed by <" + msg.creatorName + + ">! Are you sure you want to do this?", + "conf/nuke_message.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber + "&msg=" + msg.postNumber,LinkTypes.SERVLET,on_error, + LinkTypes.SERVLET); + + } // end else + +} // end try +catch (e) +{ // error deleting + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error nuking message: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/post_message.js b/scripts/conf/post_message.js new file mode 100644 index 0000000..2d6f48f --- /dev/null +++ b/scripts/conf/post_message.js @@ -0,0 +1,227 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.htmlcheck); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber; + +if (rinput.isImageButtonClicked("cancel")) +{ // cancelling - go back where we came from + vlib.output(new Redirect(on_error,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +// get the current post number +post_num = rinput.getParameterInt("sd",-1); +if (post_num<0) +{ // this value is critical for slippage detection - we must have it + vlib.output(new ErrorBox(null,"Invalid parameter.",on_error)); + vlib.done(); + +} // end if + +// get the raw post data +raw_postdata = rinput.getParameter("pb"); +if (raw_postdata==null) + raw_postdata = ""; + +if (rinput.isImageButtonClicked("preview")) +{ // generate a preview! start by passing all the data through the HTML checker as needed + try + { // escape the pseud + checker = rinput.engine.getEscapingChecker(); + checker.append(rinput.getParameter("pseud")); + checker.finish(); + rinput.setRequestAttribute("postbox.pseud",checker.getValue()); + + // escape the data + checker.reset(); + checker.append(raw_postdata); + checker.finish(); + rinput.setRequestAttribute("postbox.data",checker.getValue()); + + // run the preview + checker = topic.getPreviewChecker(); + checker.append(raw_postdata); + checker.finish(); + rinput.setRequestAttribute("preview.text",checker.getValue()); + rinput.setRequestAttribute("preview.num_errors",new java.lang.Integer(checker.getCounter("spelling"))); + + } // end try + catch (e) + { // watch out for spurious HTMLCheckerExceptions + etype = vlib.exceptionType(e) + ""; + if (etype.match("HTMLCheckerException")) + throw new InternalStateError("spurious HTMLCheckerException thrown"); + else + throw new InternalStateError("unknown exception thrown in post_message.js preview: " + e); + + } // end catch + + // save off any additional parameters we need + tmp = rinput.getParameter("next"); + if (tmp!=null) + rinput.setRequestAttribute("postbox.hidden.next",tmp); + rinput.setRequestAttribute("postbox.hidden.sd",post_num + ""); + tmp = rinput.getParameter("attach"); + if (!(vlib.emptyString(tmp))) + rinput.setRequestAttribute("postbox.attach","Y"); + tmp = rinput.getParameter("slip"); + if (!(vlib.emptyString(tmp))) + rinput.setRequestAttribute("postbox.hidden.slip","Y"); + + // create a JSPView for the preview and output it + view = new JSPView("Previewing Message","conf/preview.jsp"); + view.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + vlib.output(view); + vlib.done(); + +} // end if + +if (!(rinput.isImageButtonClicked("post") || rinput.isImageButtonClicked("postnext") + || rinput.isImageButtonClicked("posttopics"))) +{ // one of the three POST buttons MUST have been checked! + logger.error("no known button click on POST to conf/post_message.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed",on_error)); + vlib.done(); + +} // end if + +if (post_num!=topic.getTotalMessages()) +{ // slippage detected! generate parameters for the Slippage view + rc = null; + try + { // get the list of messages associated with the slippage + rinput.setRequestAttribute("slippage.messages",topic.getMessages(post_num,topic.totalMessages-1)); + + // generate the topic stem + aliases = conf.aliases; + rinput.setRequestAttribute("slippage.topic_stem", + aliases.get(0).toString() + "." + topic.topicNumber + "."); + + // escape the pseud + checker = rinput.engine.getEscapingChecker(); + checker.append(rinput.getParameter("pseud")); + checker.finish(); + rinput.setRequestAttribute("postbox.pseud",checker.getValue()); + + // escape the data + checker.reset(); + checker.append(raw_postdata); + checker.finish(); + rinput.setRequestAttribute("postbox.data",checker.getValue()); + + // save off any additional parameters we need + tmp = rinput.getParameter("next"); + if (tmp!=null) + rinput.setRequestAttribute("postbox.hidden.next",tmp); + rinput.setRequestAttribute("postbox.hidden.sd",topic.totalMessages + ""); + tmp = rinput.getParameter("attach"); + if (!(vlib.emptyString(tmp))) + rinput.setRequestAttribute("postbox.attach","Y"); + + // create the slippage view + rc = new JSPView("Slippage or Double-Click Detected","conf/slippage.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end try + catch (e) + { // handle an exception generating the slippage view + etype = vlib.exceptionType(e) + ""; + if (etype.match("HTMLCheckerException")) + throw new InternalStateError("spurious HTMLCheckerException thrown"); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error generating slippage view: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +rc = null; +try +{ // actually post the darn thing! + msg = topic.postNewMessage(0,rinput.getParameter("pseud"),raw_postdata); + + // If there was no slippage, make sure we mark the new post as "read." + if (!(rinput.hasParameter("slip"))) + topic.fixSeen(); + + // Where do we want to go now? + tmp = ""; + if (rinput.isImageButtonClicked("posttopics")) + tmp = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + else + { // find the topic number to go to next and compute the new URL + my_topicnum = -1; + if (rinput.isImageButtonClicked("postnext")) + my_topicnum = rinput.getParameterShort("next",topic.topicNumber); + else + my_topicnum = topic.topicNumber; + tmp = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + my_topicnum + + "&rnm=1"; + + } // end else + + if (vlib.emptyString(rinput.getParameter("attach"))) + rc = new Redirect(tmp,LinkTypes.SERVLET); // bounce straight to our new view! + else + { // we need to display the attachment form + rinput.setRequestAttribute("attachment.postid",msg.postID + ""); + rinput.setRequestAttribute("attachment.target",tmp); + rc = new JSPView("Upload Attachment","conf/attachment.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + + } // end else + +} // end try +catch (e) +{ // handle an error in doing the post + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error posting message: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/poster_report.js b/scripts/conf/poster_report.js new file mode 100644 index 0000000..70752ce --- /dev/null +++ b/scripts/conf/poster_report.js @@ -0,0 +1,90 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); +on_error = "conf/conf_reports.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; + +// get the current topic (where applicable) +topic = currc.getTopic(false,on_error); + +rc = null; +try +{ // construct the activity list + my_list = null; + my_title = null; + title1 = null; + title2 = null; + nullmsg = null; + if (topic!=null) + { // get the poster list from the topic + my_list = topic.getActivePosters(); + if (my_list.isEmpty()) + nullmsg = "No posters to topic \"" + topic.name + "\" found."; + my_title = "Users Posting in Topic " + topic.name; + title1 = "Posters in Topic:"; + title2 = topic.name; + + } // end if + else + { // get the poster list from the conference + my_list = conf.getActivePosters(); + if (my_list.isEmpty()) + nullmsg = "No posters to conference \"" + vlib.encodeHTML(conf.name) + "\" found."; + my_title = "Users Posting in Conference " + conf.name; + title1 = "Posters in Conference:"; + title2 = conf.name; + + } // end else + + // save off the attributes + rinput.setRequestAttribute("conference.activity.list",my_list); + rinput.setRequestAttribute("conference.activity.nullmessage",nullmsg); + rinput.setRequestAttribute("conference.activity.posters",Boolean.TRUE); + rinput.setRequestAttribute("conference.activity.title",title1); + rinput.setRequestAttribute("conference.activity.subtitle",title2); + + // create the view + rc = new JSPView(my_title,"conf/activity_report.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + +} // end try +catch (e) +{ // error getting the list of posters + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting poster list: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done... diff --git a/scripts/conf/posts.js b/scripts/conf/posts.js new file mode 100644 index 0000000..a1a69a0 --- /dev/null +++ b/scripts/conf/posts.js @@ -0,0 +1,143 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importClass(java.awt.Dimension); +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.conf.view); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +SCALING_NUM = 1; +SCALING_DENOM = 2; + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +on_error = "conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID; +topic = currc.getTopic(true,on_error); + +// if we need to restore posts in another topic, do so +read_new = true; +if (rinput.hasParameter("rtop") && rinput.hasParameter("rct")) +{ // retrieve the "other topic" + other_topic = currc.getOptionalTopic("rtop"); + if (other_topic!=null) + { // get the number of unread messages + nunread = rinput.getParameterInt("rct",0); + if ((nunread>0) && (nunread<=other_topic.totalMessages)) + { // set the unread message count + try + { // reset the unread messages + other_topic.unreadMessages = nunread; + + } // end try + catch (e) + { // it didn't work - ignore the error + logger.warn("exception setting unread messages: " + e); + + } // end catch + + if (topic.topicID==other_topic.topicID) + read_new = false; // don't do a read new if we just restored this topic + + } // end if + else // ignore this + logger.warn("number of unread messages out of range"); + + } // end if + +} // end if + +// get the post interval +piv = currc.getPostInterval(on_error); + +// get the "read new" parameter +if (read_new) + read_new = rinput.hasParameter("rnm"); + +rc = null; +try +{ // create the view + rc = new PostsView(comm,currc); + logger.debug(rc.unread + " unread messages"); + + // fill in parameters + rc.first = piv.first; + rc.last = piv.last; + rc.showAdvanced = rinput.hasParameter("shac"); + rc.noBozos = rinput.hasParameter("nbz"); + rc.messages = topic.getMessages(piv.first,piv.last); + rc.topCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); + rc.bottomCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); + rc.title = topic.name; + rc.subtitle = topic.totalMessages + " Total; " + rc.unread + " New; Last: " + + rinput.formatDate(topic.lastUpdateDate); + + // do a "read new" on this topic + if (read_new) + topic.unreadMessages = 0; + + // visit the topic + visit_order = currc.getTopicVisitOrder(); + if (visit_order!=null) + visit_order.visit(topic.topicNumber); + rc.topicVisitOrder = visit_order; + + // get the aliases list and synthesize the topic stem and QID + aliases = conf.aliases; + tmp = aliases.get(0).toString() + "." + topic.topicNumber; + rc.topicStem = tmp + "."; + rc.pageQID = "go/" + comm.alias + "!" + tmp; + + if (conf.displayPostPictures() && rinput.user.displayPostPictures()) + { // set up the user p[hoto dimensions + old_psz = rinput.engine.getUserPhotoSize(); + rc.photoDims = new Dimension((old_psz.width * SCALING_NUM) / SCALING_DENOM, + (old_psz.height * SCALING_NUM) / SCALING_DENOM); + + } // end if + + rc.buildInternals(rinput.user); // build the bozo filter and user photo lists in compiled code + +} // end try +catch (e) +{ // handle an exception here + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error listing messages: " + e.message,on_error); + else if (etype.match("AccessError")) + { // unable to get message list - maybe we weren't logged in + if (rinput.user.isLoggedIn()) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = new LogInOrCreate(); + + } // end else if + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/conf/publish_message.js b/scripts/conf/publish_message.js new file mode 100644 index 0000000..7f76d5c --- /dev/null +++ b/scripts/conf/publish_message.js @@ -0,0 +1,60 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +// get the message under consideration +msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + + conf.confID + "&top=" + topic.topicNumber); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber + + "&p1=" + msg.getPostNumber() + "&shac=1"; + +rc = null; +try +{ // publish it! + msg.publish(); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error publishing + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error publishing message: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/read_new.js b/scripts/conf/read_new.js new file mode 100644 index 0000000..104d36c --- /dev/null +++ b/scripts/conf/read_new.js @@ -0,0 +1,66 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +rc = null; +try +{ // get the topic list, using the current view and sort options + topic_list = conf.getTopicList(currc.viewOption,currc.sortOption); + + // initialize and return the topic visit order + ord = currc.newTopicVisitOrder(topic_list); + + if (ord.isNext()) // retrieve the first topic number from the list and bounce directly there + rc = new Redirect("conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + ord.getNext() + "&rnm=1",LinkTypes.SERVLET); + else // no unread messages - bounce to the topics list + rc = new Redirect("conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error generating the topic list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error listing topics: " + e.message, + "conf/conferences.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + { // they might not be logged in, that's all + if (rinput.user.isLoggedIn()) + rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID); + else + rc = new LogInOrCreate(); + + } // end else if + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/conf/remove_bozo.js b/scripts/conf/remove_bozo.js new file mode 100644 index 0000000..7fc2241 --- /dev/null +++ b/scripts/conf/remove_bozo.js @@ -0,0 +1,58 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber; + +rc = null; +try +{ // get the UID and clear the bozo status + uid = rinput.getParameterInt("u",-1); + if (uid>0) + topic.setBozo(uid,false); + + // bounce back to the Manage Topics display + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // handle an error message + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting filter: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done diff --git a/scripts/conf/scribble_message.js b/scripts/conf/scribble_message.js new file mode 100644 index 0000000..913ec3c --- /dev/null +++ b/scripts/conf/scribble_message.js @@ -0,0 +1,60 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +// get the message under consideration +msg = currc.getTopicMessageParam("msg",true,"conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + + conf.confID + "&top=" + topic.topicNumber); +on_error = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + topic.topicNumber + + "&p1=" + msg.getPostNumber() + "&shac=1"; + +rc = null; +try +{ // scribble it! + msg.scribble(); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error scribbling + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error scribbling message: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/set_pseud.js b/scripts/conf/set_pseud.js new file mode 100644 index 0000000..5e7d4e6 --- /dev/null +++ b/scripts/conf/set_pseud.js @@ -0,0 +1,53 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/manage_conf.js.vs?cc=" + comm.communityID); + +rc = null; +try +{ // change the default pseud + pseud = rinput.getParameter("pseud"); + if (pseud!=null) + conf.defaultPseud = pseud; + + // don't change the current view + rc = new NullResponse(); + +} // end try +catch (e) +{ // error resetting the pseud + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting pseud: " + e.message, + "conf/manage_conf.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/subscribe_topic.js b/scripts/conf/subscribe_topic.js new file mode 100644 index 0000000..476792c --- /dev/null +++ b/scripts/conf/subscribe_topic.js @@ -0,0 +1,57 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the current topic +topic = currc.getTopic(true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); +on_error = "conf/manage_topic.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + + topic.topicNumber; + +rc = null; +try +{ // get the flag and set the archived status + flag = rinput.getParameterInt("flag",0); + topic.setSubscribed(flag==1); + rc = new Redirect(on_error,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // error setting the hide topic + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error setting subscription status: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/topics.js b/scripts/conf/topics.js new file mode 100644 index 0000000..38b711a --- /dev/null +++ b/scripts/conf/topics.js @@ -0,0 +1,125 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the view option +view_opt = currc.viewOption; +if (rinput.hasParameter("view")) +{ // get the new view option + view_opt = rinput.getParameterInt("view",view_opt); + if ( (view_opt!=ConferenceContext.DISPLAY_NEW) && (view_opt!=ConferenceContext.DISPLAY_ACTIVE) + && (view_opt!=ConferenceContext.DISPLAY_ALL) && (view_opt!=ConferenceContext.DISPLAY_HIDDEN) + && (view_opt!=ConferenceContext.DISPLAY_ARCHIVED)) + { // the view option is invalid + vlib.output(new ErrorBox(null,"Invalid view parameter.","conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + + } // end if + + currc.viewOption = view_opt; // save the changed view option + +} // end if + +// get the sort option +sort_opt = currc.sortOption; +if (rinput.hasParameter("sort")) +{ // get and test the new sort option + sort_opt = rinput.getParameterInt("sort",sort_opt); + tmp_sort = ((sort_opt<0) ? -sort_opt : sort_opt); + if ( (tmp_sort!=ConferenceContext.SORT_NUMBER) && (tmp_sort!=ConferenceContext.SORT_NAME) + && (tmp_sort!=ConferenceContext.SORT_UNREAD) && (tmp_sort!=ConferenceContext.SORT_TOTAL) + && (tmp_sort!=ConferenceContext.SORT_DATE)) + { // the sort option is invalid + vlib.output(new ErrorBox(null,"Invalid sort parameter.","conf/conferences.js.vs?cc=" + comm.communityID)); + vlib.done(); + + } // end if + + currc.sortOption = sort_opt; // save the changed sort option + +} // end if + +rc = null; +try +{ // get the topic list + topic_list = conf.getTopicList(view_opt,sort_opt); + + // initialize the visit order + ord = currc.newTopicVisitOrder(topic_list); + + // get the aliases list... + aliases = conf.aliases; + + // set the attributes we want to carry into the page + rinput.setRequestAttribute("topics.list",topic_list); + tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); + if (tmp==null) + tmp = ""; + rinput.setRequestAttribute("conference.custom.top",tmp); + tmp = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); + if (tmp==null) + tmp = ""; + rinput.setRequestAttribute("conference.custom.bottom",tmp); + if (ord.isNext()) + { // precalculate the "Read New" link and pass it to the page + tmp = "conf/posts.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID + "&top=" + ord.getNext() + + "&rnm=1"; + rinput.setRequestAttribute("conference.readnew",tmp); + + } // end if + + // create a JSPView to return + rc = new JSPView("Topics in " + conf.name,"conf/topics.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; + rc.pageQID = "go/" + comm.alias + "!" + aliases.get(0); + +} // end try +catch (e) +{ // error generating the topic list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error listing topics: " + e.message, + "conf/conferences.js.vs?cc=" + comm.communityID); + else if (etype.match("AccessError")) + { // they might not be logged in, that's all + if (rinput.user.isLoggedIn()) + rc = new ErrorBox("Access Error",e.message,"conf/conferences.js.vs?cc=" + comm.communityID); + else + rc = new LogInOrCreate(); + + } // end else if + else + rc = e; + +} // end catch + +vlib.output(rc); + diff --git a/scripts/conf/upload_attachment.js b/scripts/conf/upload_attachment.js new file mode 100644 index 0000000..8b31ebc --- /dev/null +++ b/scripts/conf/upload_attachment.js @@ -0,0 +1,84 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object +rinput = bsf.lookupBean("request"); + +if (rinput.isFileParam("target")) +{ // the target should be a normal parameter + logger.error("Internal Error: 'target' should be a normal param"); + vlib.output(new ErrorBox(null,"Internal Error: 'target' should be a normal param","top.js.vs")); + vlib.done(); + +} // end if + +// Get the operations target. +target = rinput.getParameter("target"); +logger.debug("Target URL: " + target); +rinput.location = target; + +// also check on file parameter status +if (!(rinput.isFileParam("thefile"))) +{ // bogus file parameter + logger.error("Internal Error: 'thefile' should be a file param"); + vlib.output(new ErrorBox(null,"Internal Error: 'thefile' should be a file param",target)); + vlib.done(); + +} // end if + +// get the community +comm = rinput.getCommunity(true,target); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,target); + +// get the message we're attaching to +msg = currc.getMessageParam("msg",true,target); + +rc = null; +try +{ // do the attachment! + msg.attachData(rinput.getParameterType("thefile"),rinput.getParameter("thefile"), + rinput.getParameterSize("thefile"),rinput.getParameterDataStream("thefile")); + + // now bounce us where we wanted to go in the first place + rc = new Redirect(target,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // failure in setting attachment + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error saving attachment: " + e.message,target); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,target); + else if (etype.match("ServletMultipartException")) + rc = new ErrorBox("Internal Error",e.message,target); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/conf/view_attachment.js b/scripts/conf/view_attachment.js new file mode 100644 index 0000000..c8d8f93 --- /dev/null +++ b/scripts/conf/view_attachment.js @@ -0,0 +1,56 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.conf); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// get the request object and the community +rinput = bsf.lookupBean("request"); +comm = rinput.getCommunity(true,"top.js.vs"); + +// get the current conference +currc = new CurrentConference(rinput); +conf = currc.getConference(true,"conf/conferences.js.vs?cc=" + comm.communityID); + +// get the message we're looking in +msg = currc.getMessageParam("msg",true,"conf/topics.js.vs?cc=" + comm.communityID + "&conf=" + conf.confID); + +rc = null; +try +{ // retrieve the attachment data and send it out + if (msg.hasAttachment()) + rc = new AttachmentContent(msg); + else + rc = new ErrorBox(null,"This message has no attachment.",null); + +} // end try +catch (e) +{ // failure in retrieving attachment + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error retrieving attachment: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/find.js b/scripts/find.js new file mode 100644 index 0000000..0852c60 --- /dev/null +++ b/scripts/find.js @@ -0,0 +1,214 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); + +// Determine which Find display needs to be brought up. +disp = 0; +if (rinput.hasParameter("disp")) +{ // get the display parameter from the input + disp = rinput.getParameterInt("disp",-1); + if ( (disp!=FindView.FD_COMMUNITIES) && (disp!=FindView.FD_USERS) && (disp!=FindView.FD_CATEGORIES) + && (disp!=FindView.FD_POSTS)) + { // the display parameter is not correct + vlib.output(new ErrorBox(null,"Invalid display parameter.","top.js.vs")); + vlib.done(); + + } // end if + + // save off the session attribute + rinput.setSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE,new java.lang.Integer(disp)); + +} // end if +else +{ // get the display parameter from the session attributes + tmp_disp = rinput.getSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE); + if (tmp_disp==null) + { // make a new entry and set it + tmp_disp = new java.lang.Integer(FindView.FD_COMMUNITIES); + rinput.setSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE,tmp_disp); + + } // end if + + disp = tmp_disp.intValue(); + +} // end else + +max_results = rinput.engine.getStdNumSearchResults(); +view = new FindView(disp,max_results); // create the view object + +rc = null; +if ("GET"==rinput.verb) +{ // set up the category parameter + catid = -1; + if (disp==FindView.FD_COMMUNITIES) + catid = rinput.getParameterInt("cat",-1); + + try + { // prep the view fields + if (disp==FindView.FD_COMMUNITIES) + { // set the category (which also sets up the subcategory list and contained communities) + view.category = rinput.user.getCategoryDescriptor(catid); + if (view.category.categoryID>=0) + { // fill in the communities that are in this category + view.results = rinput.user.getCommunitiesInCategory(view.category,view.offset,max_results); + view.findCount = rinput.user.getNumCommunitiesInCategory(view.category); + + } // end if + + view.field = SearchMode.FIELD_COMMUNITY_NAME; + + } // end if + else if (disp==FindView.FD_USERS) + view.field = SearchMode.FIELD_USER_NAME; + view.mode = SearchMode.SEARCH_PREFIX; + view.term = ""; + rc = view; + + } // end try + catch (e) + { // exception in initializing the view... + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error accessing category data: " + e.message,"top.js.vs"); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if ("GET" operation) + +// Set up the form for a POST. +try +{ // load some of the parameters + catid = -1; + + if (disp==FindView.FD_COMMUNITIES) + { // load the category ID and field parameters + catid = rinput.getParameterInt("cat",-1); + if (!(rinput.engine.isValidCategoryID(catid))) + throw new ValidationException("The category ID parameter is not valid."); + x = rinput.getParameterInt("field",SearchMode.FIELD_COMMUNITY_NAME); + if ((x!=SearchMode.FIELD_COMMUNITY_NAME) && (x!=SearchMode.FIELD_COMMUNITY_SYNOPSIS)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + } // end if + else if (disp==FindView.FD_USERS) + { // load the field parameter + x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME); + if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION) + && (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + } // end else if + + if (disp!=FindView.FD_POSTS) + { // load the search mode parameter + x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX); + if ((x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) && (x!=SearchMode.SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + view.mode = x; + + } // end if + + // load the search term, offset and find count + view.term = rinput.getParameter("term"); + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // adjust the offset based on the command button click + if (rinput.isImageButtonClicked("search")) + view.offset = 0; + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view_offset - max_results,0); + else if (rinput.isImageButtonClicked("next")) + view.offset = view.offset + max_results; + else + throw new ValidationException("Unable to determine what action triggered the form."); + + // run the actual search! + if (disp==FindView.FD_COMMUNITIES) + { // need to work it differently if there's a category ID + if (catid>=0) + { // set up the category + view.category = rinput.user.getCategoryDescriptor(catid); + if (view.category.categoryID>=0) + { // fill in the communities that are in this category + view.results = rinput.user.getCommunitiesInCategory(view.category,view.offset,max_results); + view.findCount = rinput.user.getNumCommunitiesInCategory(view.category); + + } // end if + + } // end if + else + { // set the results as the community search data + view.results = rinput.user.searchForCommunities(view.field,view.mode,view.term,view.offset,max_results); + if (view.findCount<0) + view.findCount = rinput.user.getSearchCommunityCount(view.field,view.mode,view.term); + + } // end else + + } // end if + else if (disp==FindView.FD_USERS) + { // search for users + view.results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,max_results); + if (view.findCount<0) + view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term); + + } // end else if + else if (disp==FindView.FD_CATEGORIES) + { // search for categories + view.results = rinput.user.searchForCategories(view.mode,view.term,view.offset,max_results); + if (view.findCount<0) + view.findCount = rinput.user.getSearchCategoryCount(view.mode,view.term); + + } // end else if + else if (disp==FindView.FD_POSTS) + { // search for posts + view.results = rinput.user.searchPosts(view.term,view.offset,max_results); + if (view.findCount<0) + view.findCount = rinput.user.getSearchPostCount(view.term); + + } // end else if + + rinput.location = "find.js.vs?disp=" + disp; // reset location for the POST + rc = view; + +} // end try +catch (e) +{ // exception thrown somewhere in the POST operation + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + rc = new ErrorBox("Find Error",e.message,"top.js.vs"); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error on find: " + e.message,"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/login.js b/scripts/login.js new file mode 100644 index 0000000..d568ee3 --- /dev/null +++ b/scripts/login.js @@ -0,0 +1,137 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is already logged in, this script is a no-op - just bounce to the specified target. +user = rinput.user; +if (user.isLoggedIn()) +{ // user already logged in - just bail on this + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("login"); + +if ("GET"==rinput.verb) +{ // display the dialog and have done with it + dlg.setValue("tgt",target); + rinput.location = target; + vlib.output(dlg); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled login - bounce back to the target + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the dialog parameters +rc = null; // return from this script +if (op=="remind") +{ // send the login reminder + try + { // perform the reminder operation + rinput.engine.sendPasswordReminder(dlg.getValue("user")); + + // recycle the dialog and output it again + dlg.setErrorMessage("Password reminder has been sent to your e-mail address."); + dlg.setValue("pass",null); + rinput.location = target; + rc = dlg; + + } // end try + catch (e) + { // caught an exception here - what do we do about it? + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error finding user: " + e.getMessage(),target); + else if (etype.match("AccessError")) + rc = new ErrorBox("User E-mail Address Not Found",e.getMessage(),target); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-mail Error","E-mail error sending reminder: " + e.getMessage(),target); + else + rc = e; + + } // end catch + +} // end if +else if (op=="login") +{ // actually log in! + try + { // authenticate the user + user.authenticate(dlg.getValue("user"),dlg.getValue("pass")); + + logger.debug("User \"" + user.userName + "\" logged in successfully"); + + // If the user wants a cookie, give it to them! + if (dlg.getValue("saveme").booleanValue()) + rinput.savePersistentCookie(RequestInput.LOGIN_COOKIE,user.getAuthenticationToken(), + RequestInput.LOGIN_COOKIE_AGE); + + // Clear the left menus (to force recomputation) and bounce us back to whereever we were + // supposed to go. + logger.debug("Ready to bounce to \"" + target + "\""); + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); + if (user.isEmailVerified()) + rc = new Redirect(target,LinkTypes.SERVLET); + else // jump to the Verify dialog before we do anything else + rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET); + + } // end try + catch (e) + { // caught an exception here - what do we do about it? + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error logging in: " + e.message,target); + else if (etype.match("AccessError")) + { // this indicates a problem with the user account or password + dlg.setErrorMessage(e.message); + dlg.setValue("pass",null); + rinput.location = target; + rc = dlg; + + } // end else if + else + rc = e; + + } // end catch + +} // end else if +else +{ // unknown button pressed! + logger.error("no known button click on POST to login.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",target); + +} // end else + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/logout.js b/scripts/logout.js new file mode 100644 index 0000000..391828d --- /dev/null +++ b/scripts/logout.js @@ -0,0 +1,41 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is not logged in, this script is a no-op - just bounce to the specified target. +user = rinput.user; +if (user.isLoggedIn()) +{ // user is logged in - we want to log out + // TODO: only remove the login cookie if it was actually set! + rinput.deleteCookie(RequestInput.LOGIN_COOKIE); // remove the login cookie + rinput.replaceUser(null); // no more user context + rinput.setSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR,null); // and clear menus too + + target = "top.js.vs"; // take 'em back to the top + +} // end if + +vlib.output(new Redirect(target,LinkTypes.SERVLET)); // do the redirect! diff --git a/scripts/new_account.js b/scripts/new_account.js new file mode 100644 index 0000000..a5afbd1 --- /dev/null +++ b/scripts/new_account.js @@ -0,0 +1,47 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is already logged in, this is an error. +user = rinput.user; +if (user.isLoggedIn()) +{ // user already logged in - just bail on this + vlib.output(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. " + + "You must log out first.",target)); + vlib.done(); + +} // end if + +// Return the text of the User Agreement. +rinput.displayLogin = false; +rc = new TextMessage(rinput.getStockMessage("user-agreement-title"), + rinput.getStockMessage("user-agreement-subtitle")); +rc.text = rinput.getStockMessage("user-agreement"); +rc.addButton(LinkTypes.SERVLET,"new_account_2.js.vs?tgt=" + vlib.encodeURL(target),"ua_accept"); +rc.addButton(LinkTypes.SERVLET,"top.js.vs","ua_decline"); +vlib.output(rc); + + diff --git a/scripts/new_account_2.js b/scripts/new_account_2.js new file mode 100644 index 0000000..fedcabf --- /dev/null +++ b/scripts/new_account_2.js @@ -0,0 +1,146 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is already logged in, this is an error. +user = rinput.user; +if (user.isLoggedIn()) +{ // user already logged in - just bail on this + vlib.output(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. " + + "You must log out first.",target)); + vlib.done(); + +} // end if + +// create the new account dialog +dlg = rinput.getDialog("newacct"); + +if ("GET"==rinput.verb) +{ // display the dialog and have done with it + dlg.setValue("tgt",target); + rinput.location = target; + rinput.displayLogin = false; + vlib.output(dlg); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled create - bounce back to the target + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +rc = null; +if (op=="create") +{ // we actually want to create the new account + dlg.load(rinput); + + try + { // start by validating the dialog + dlg.validate(); + + // validate a couple of other issues + if (!(dlg.getValue("pass1").equals(dlg.getValue("pass2")))) + throw new ValidationException("The typed passwords do not match."); + if (rinput.engine.isEmailAddressBanned(dlg.getValue("email"))) + throw new ValidationException("This email address may not register a new account."); + + // Create the new user account and set up its initial context. + uc = rinput.engine.createNewAccount(rinput.sourceAddress,dlg.getValue("user"),dlg.getValue("pass1"), + dlg.getValue("remind")); + + // Set up the account's contact info. + ci = uc.getContactInfo(); + ci.namePrefix = dlg.getValue("prefix"); + ci.givenName = dlg.getValue("first"); + blort = dlg.getValue("mid") + ""; + if (blort.length<1) + ci.middleInitial = " "; + else + ci.middleInitial = blort.substring(0,1); + ci.familyName = dlg.getValue("last"); + ci.nameSuffix = dlg.getValue("suffix"); + ci.locality = dlg.getValue("loc"); + ci.region = dlg.getValue("reg"); + ci.postalCode = dlg.getValue("pcode"); + ci.country = dlg.getValue("country"); + ci.email = dlg.getValue("email"); + + // save the contact info for the user (this also sends email confirmation messages as needed) + uc.putContactInfo(ci); + + rinput.replaceUser(uc); // this is now the user for this session! + + // Now bounce us immediately to the Verification dialog. + rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET); + + } // end try + catch (e) + { // we caught some sort of exception...but what is it? + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // put the dialog back up on a validation error + dlg.setErrorMessage(e.message + " Please try again."); + dlg.setValue("pass1",null); + dlg.setValue("pass2",null); + rinput.location = target; + rinput.displayLogin = false; + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error creating account: " + e.message,target); + else if (etype.match("AccessError")) + { // put the dialog back up on an access error + dlg.setErrorMessage(e.message); + dlg.setValue("pass1",null); + dlg.setValue("pass2",null); + rinput.location = target; + rinput.displayLogin = false; + rc = dlg; + + } // end if + else if (etype.match("EmailException")) + rc = new ErrorBox("E-mail Error","E-mail error creating account: " + e.message,target); + else + rc = e; + + } // end catch + +} // end if +else +{ // no dialog present + logger.error("no known button click on POST to new_account_2.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",target); + +} // end else + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/profile.js b/scripts/profile.js new file mode 100644 index 0000000..092053c --- /dev/null +++ b/scripts/profile.js @@ -0,0 +1,223 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is not logged in, this is an error. +user = rinput.user; +if (!(user.isLoggedIn())) +{ // user not logged in - just bail on this + vlib.output(new ErrorBox(null,"You must log in before you can modify the profile on your account.")); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("profile"); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the dialog + dlg.setValue("tgt",target); + + try + { // pull the user data... + ci = user.getContactInfo(); // get the main contact info + props = user.properties; // get the properties + + dlg.setEnabled("photo",ci.canSetPhoto()); + dlg.setValue("prefix",ci.namePrefix); + dlg.setValue("first",ci.givenName); + if (ci.middleInitial!=' ') + dlg.setValue("mid",String.fromCharCode(ci.middleInitial)); + dlg.setValue("last",ci.familyName); + dlg.setValue("suffix",ci.nameSuffix); + dlg.setValue("company",ci.company); + dlg.setValue("addr1",ci.addressLine1); + dlg.setValue("addr2",ci.addressLine2); + if (ci.privateAddress) + dlg.setValue("pvt_addr",1); + dlg.setValue("loc",ci.locality); + dlg.setValue("reg",ci.region); + dlg.setValue("pcode",ci.postalCode); + dlg.setValue("country",ci.country); + dlg.setValue("phone",ci.phone); + dlg.setValue("mobile",ci.mobile); + if (ci.privatePhone) + dlg.setValue("pvt_phone",1); + dlg.setValue("fax",ci.fax); + if (ci.privateFax) + dlg.setValue("pvt_fax",1); + dlg.setValue("email",ci.email); + if (ci.privateEmail) + dlg.setValue("pvt_email",1); + dlg.setValue("url",ci.URL); + dlg.setValue("descr",user.description); + dlg.setValue("photo",ci.photoURL); + dlg.sendMessage("photo","setLinkURL","profile_photo.js.vs?tgt=" + vlib.encodeURL(target)); + if (props.displayPostPictures) + dlg.setValue("pic_in_post",1); + if (props.massMailOptOut) + dlg.setValue("no_mass_mail",1); + dlg.setValue("locale",user.locale); + dlg.setValue("tz",user.timeZone); + rinput.displayLogin = false; + rc = dlg; + + } // end try + catch (e) + { // exception setting up the dialog + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error retrieving profile: " + e.message,target); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled profile update - bounce back to the target + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the dialog parameters + +if (op=="update") +{ // attempt to update the user profile + try + { // start by validating the dialog + dlg.validate(); // validate the dialog + + // check the passwords + pass1 = dlg.getValue("pass1") + ""; + pass2 = dlg.getValue("pass2") + ""; + + if (vlib.emptyString(pass1)) + { // empty must match empty + if (!(vlib.emptyString(pass2))) + throw new ValidationException("The typed passwords do not match."); + + } // end if + else + { // the two passwords must match + if (pass1!=pass2) + throw new ValidationException("The typed passwords do not match."); + + } // end else + + ci = user.getContactInfo(); // get the main contact info + props = user.properties; // get the properties + + // Reset the contact info fields. + ci.namePrefix = dlg.getValue("prefix"); + ci.givenName = dlg.getValue("first"); + blort = dlg.getValue("mid") + ""; + if (blort.length<1) + ci.middleInitial = " "; + else + ci.middleInitial = blort.substring(0,1); + ci.familyName = dlg.getValue("last"); + ci.nameSuffix = dlg.getValue("suffix"); + ci.company = dlg.getValue("company"); + ci.addressLine1 = dlg.getValue("addr1"); + ci.addressLine2 = dlg.getValue("addr2"); + ci.privateAddress = dlg.getValue("pvt_addr").booleanValue(); + ci.locality = dlg.getValue("loc"); + ci.region = dlg.getValue("reg"); + ci.postalCode = dlg.getValue("pcode"); + ci.country = dlg.getValue("country"); + ci.phone = dlg.getValue("phone"); + ci.mobile = dlg.getValue("mobile"); + ci.privatePhone = dlg.getValue("pvt_phone").booleanValue(); + ci.fax = dlg.getValue("fax"); + ci.privateFax = dlg.getValue("pvt_fax").booleanValue(); + ci.email = dlg.getValue("email"); + ci.privateEmail = dlg.getValue("pvt_email").booleanValue(); + ci.URL = dlg.getValue("url"); + + // Store the completed contact info. + need_verify = user.putContactInfo(ci); + + // Save off the properties. + props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue(); + props.massMailOptOut = dlg.getValue("no_mass_mail").booleanValue(); + user.properties = props; + + // Save off the user's description and preferences. + user.description = dlg.getValue("descr"); + user.locale = dlg.getValue("locale"); + user.timeZone = dlg.getValue("tz"); + + // Finally, change the password if applicable. + if (!(vlib.emptyString(pass1))) + user.setPassword(pass1,dlg.getValue("remind")); + + // Bounce back to our desired target. + if (need_verify) + rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET); + else + rc = new Redirect(target,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception changing the user profile + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // redisplay the dialog on validation error + dlg.setErrorMessage(e.message + " Please try again."); + dlg.setEnabled("photo",user.canSetUserPhoto()); + dlg.setValue("pass1",null); + dlg.setValue("pass2",null); + rinput.displayLogin = false; + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error updating profile: " + e.message,target); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-mail Error","E-mail error sending confirmation: " + e.message,target); + else + rc = e; + + } // end catch + +} // end if +else +{ // unknown button pressed... + logger.error("no known button click on POST to profile.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",target); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/profile_photo.js b/scripts/profile_photo.js new file mode 100644 index 0000000..55623cd --- /dev/null +++ b/scripts/profile_photo.js @@ -0,0 +1,137 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importClass(java.awt.Dimension); +importPackage(Packages.com.silverwrist.util); +importPackage(Packages.com.silverwrist.util.image); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is not logged in, this is an error. +user = rinput.user; +if (!(user.isLoggedIn())) +{ // user not logged in - just bail on this + vlib.output(new ErrorBox(null,"You must log in before you can modify the profile on your account.")); + vlib.done(); + +} // end if + +rc = null; +if ("GET"==rinput.verb) +{ // create a PhotoUploader to do the photo uploading + try + { // create and initialize the PhotoUploader + rc = new PhotoUploader("Upload User Photo","profile_photo.js.vs",LinkTypes.SERVLET); + rc.addHiddenParameter("tgt",target); + rc.photoTag = rinput.getUserPhotoTag(user.getContactInfo().photoURL); + rc.label = "New user photo"; + rinput.displayLogin = false; + + } // end try + catch (e) + { // an exception in the output... + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error generating display: " + e.message,target); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// If the cancel button was clicked, bounce out of here. +if (rinput.isImageButtonClicked("cancel")) +{ // user elected to cancel upload - bounce us out of here + vlib.output(new Redirect("profile.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("upload")) +{ // do some shorts-checking in the parameters + if (!(rinput.isFileParam("thepic"))) + { // bogus file parameter + logger.error("Internal Error: 'thepic' should be a file param"); + vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param", + "profile.js.vs?tgt=" + vlib.encodeURL(target))); + vlib.done(); + + } // end if + + mimetype = rinput.getParameterType("thepic") + ""; + if (!(mimetype.match("image/"))) + { // not an image file type that got uploaded + logger.error("Error: 'thepic' not an image type"); + vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.", + "profile_photo.js.vs?tgt=" + vlib.encodeURL(target))); + vlib.done(); + + } // end if + + try + { // normalize the photo to 100x100 pixels + real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"), + rinput.engine.getUserPhotoSize(),"jpeg"); + + // set the user photo data! + ci = user.getContactInfo(); + ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data); + user.putContactInfo(ci); + + // Jump back to the profile form. + rc = new Redirect("profile.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception while setting user photo + etype = vlib.exceptionType(e) + ""; + if (etype.match("ServletMultipartException")) + rc = new ErrorBox(null,"Internal Error: " + e.message,"profile.js.vs?tgt=" + vlib.encodeURL(target)); + else if (etype.match("ImageNormalizerException")) + rc = new ErrorBox(null,e.message,"profile_photo.js.vs?tgt=" + vlib.encodeURL(target)); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error storing user photo: " + e.message, + "profile.js.vs?tgt=" + vlib.encodeURL(target)); + else if (etype.match("EmailException")) + rc = new ErrorBox(null,"Internal Error: " + e.message,"profile.js.vs?tgt=" + vlib.encodeURL(target)); + else + rc = e; + + } // end catch + +} // end if +else +{ // don't know the command button! + logger.error("no known button click on POST to profile_photo.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "profile.js.vs?tgt=" + vlib.encodeURL(target)); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/quick_email.js b/scripts/quick_email.js new file mode 100644 index 0000000..3ad12da --- /dev/null +++ b/scripts/quick_email.js @@ -0,0 +1,62 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); + +to_uid = rinput.getParameterInt("to_uid",-1); +if (to_uid<=0) +{ // the user ID is not present + vlib.output(new ErrorBox(null,"Invalid user ID parameter.",null)); + vlib.done(); + +} // end if + +rc = null; +on_error = "top.js.vs"; +try +{ // retrieve the user profile + prof = rinput.user.getProfile(to_uid); + on_error = "user/" + prof.userName; + logger.debug("sending quick email message to " + prof.userName); + + // send the actual E-mail message + prof.sendQuickEmail(rinput.getParameter("subj"),rinput.getParameter("pb")); + + // redirect to the user profile page + rc = new Redirect("user/" + prof.userName,LinkTypes.SERVLET); + +} // end try +catch (e) +{ // determine what to do with an exception + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending message: " + e.message,on_error); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,on_error); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-Mail Error","Error sending e-mail: " + e.message,on_error); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/showuser.js b/scripts/showuser.js new file mode 100644 index 0000000..bb7297e --- /dev/null +++ b/scripts/showuser.js @@ -0,0 +1,107 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object and the username +rinput = bsf.lookupBean("request"); +username = rinput.getRequestAttribute("username"); + +rc = null; +try +{ // retrieve the user profile and save it off + prof = rinput.user.getProfile(username); + rinput.setRequestAttribute("profile",prof); + + // determine the full name of the user and save it off + buf = new java.lang.StringBuffer(prof.givenName); + if (!(vlib.emptyString(prof.namePrefix))) + { // insert the prefix at the beginning of the string + buf.insert(0," "); + buf.insert(0,prof.namePrefix); + + } // end if + + tmp = String.fromCharCode(prof.middleInitial); + if (tmp!=" ") + { // append the middle initial + buf.append(" "); + buf.append(tmp); + buf.append("."); + + } // end if + + buf.append(" "); + buf.append(prof.familyName); + if (!(vlib.emptyString(prof.nameSuffix))) + { // append the name suffix + buf.append(" "); + buf.append(prof.nameSuffix); + + } // end if + + rinput.setRequestAttribute("fullname",buf.toString()); + + // determine the last line of the address and save it off + if (vlib.emptyString(prof.locality)) + { // allocate stringbuffer based on region + if (vlib.emptyString(prof.region)) + buf = new java.lang.StringBuffer(); + else + buf = new java.lang.StringBuffer(prof.region); + + } // end if + else if (vlib.emptyString(prof.region)) + buf = new java.lang.StringBuffer(prof.locality); + else + { // tack together both locality and region + buf = new java.lang.StringBuffer(prof.locality); + buf.append(", "); + buf.append(prof.region); + + } // end else + + if (!(vlib.emptyString(prof.postalCode))) + { // append the postal code + buf.append(" "); + buf.append(prof.postalCode); + + } // end if + + rinput.setRequestAttribute("address.lastline",buf.toString()); + + // Save off the user photo tag. + rinput.setRequestAttribute("user.photo",rinput.getUserPhotoTag(prof.photoURL)); + + // Create a view object and send it out. + rc = new JSPView("User Profile - " + username,"user_profile.jsp"); + +} // end try +catch (e) +{ // handle an exception thrown by the profile code + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error finding user: " + e.message,"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! \ No newline at end of file diff --git a/scripts/sysadmin/audit.js b/scripts/sysadmin/audit.js new file mode 100644 index 0000000..4aec824 --- /dev/null +++ b/scripts/sysadmin/audit.js @@ -0,0 +1,59 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +rc = null; +try +{ // get the admin interface + adm = rinput.user.adminInterface; + + // read off the offset parameter + offset = rinput.getParameterInt("ofs",0); + + // generate the audit lists + audit_list = adm.getAuditRecords(offset,rinput.engine.getNumAuditRecordsPerPage()); + audit_count = adm.getAuditRecordCount(); + + // output the audit data view + rc = new AuditView(rinput.engine,audit_list,offset,audit_count,"System Audit Records", + "sysadmin/audit.js.vs?ofs=${offset}","sysadmin/menu.js.vs", + "Return to System Administration Menu"); + rc.menuSelector = Content.MENU_SELECTOR_NOCHANGE; + +} // end try +catch (e) +{ // display an error + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error getting audit records: " + e.message, + "sysadmin/menu.js.vs"); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error",e.message,"sysadmin/menu.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/sysadmin/find_user.js b/scripts/sysadmin/find_user.js new file mode 100644 index 0000000..6d160f8 --- /dev/null +++ b/scripts/sysadmin/find_user.js @@ -0,0 +1,96 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.hasAdminAccess())) +{ // no admin access - we can't do this + vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null)); + vlib.done(); + +} // end if + +// Create the new view. +view = new AdminFindUserView(rinput.engine.getStdNumSearchResults()); + +if ("GET"==rinput.verb) +{ // initialize the field, mode, and term and do the search + view.field = SearchMode.FIELD_USER_NAME; + view.mode = SearchMode.SEARCH_PREFIX; + view.term = ""; + vlib.output(view); + vlib.done(); + +} // end if + +// everything here on is for a POST +rc = null; +try +{ // load the search field parameter + x = rinput.getParameterInt("field",SearchMode.FIELD_USER_NAME); + if ( (x!=SearchMode.FIELD_USER_NAME) && (x!=SearchMode.FIELD_USER_DESCRIPTION) + && (x!=SearchMode.FIELD_USER_GIVEN_NAME) && (x!=SearchMode.FIELD_USER_FAMILY_NAME)) + throw new ValidationException("The search field parameter is not valid."); + view.field = x; + + // load the search mode parameter + x = rinput.getParameterInt("mode",SearchMode.SEARCH_PREFIX); + if ((x!=SearchMode.SEARCH_PREFIX) && (x!=SearchMode.SEARCH_SUBSTRING) && (x!=SearchMode.SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + view.mode = x; + + // load the search term, offset, and find count + view.term = rinput.getParameter("term"); + view.offset = rinput.getParameterInt("ofs",0); + view.findCount = rinput.getParameterInt("fcount",-1); + + // adjust the offset based on the command button click + if (rinput.isImageButtonClicked("search")) + view.offset = 0; + else if (rinput.isImageButtonClicked("previous")) + view.offset = Math.max(view_offset - view.maxResults,0); + else if (rinput.isImageButtonClicked("next")) + view.offset += view.maxResults; + else + throw new ValidationException("Unable to determine what action triggered the form."); + + // get the user results + view.results = rinput.engine.searchForUsers(view.field,view.mode,view.term,view.offset,view.maxResults); + if (view.findCount<0) + view.findCount = rinput.engine.getSearchUserCount(view.field,view.mode,view.term); + + rc = view; + +} // end try +catch (e) +{ // get the exception type + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error on find: " + e.message,"sysadmin/find_user.js.vs"); + else if (etype.match("ValidationException")) + rc = new ErrorBox("Find Error",e.message,"sysadmin/find_user.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/sysadmin/global.js b/scripts/sysadmin/global.js new file mode 100644 index 0000000..5b53b5e --- /dev/null +++ b/scripts/sysadmin/global.js @@ -0,0 +1,137 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// small function to setup the global properties dialog +function setupDialog(dlg,engine) +{ + sinf = engine.securityInfo; + dlg.sendMessage("create_lvl","setRoleList",sinf.getRoleList("Global.CreateCommunity")); + +} // end setupDialog + +// get the request object +rinput = bsf.lookupBean("request"); + +dlg = rinput.getDialog("global.properties"); +rc = null; +if ("GET"==rinput.verb) +{ // set up the dialog + setupDialog(dlg,rinput.engine); + + try + { // get the administrative interface + adm = user.adminInterface; + props = adm.properties; + dlg.setValue("search_items",props.searchItemsPerPage); + dlg.setValue("fp_posts",props.postsOnFrontPage); + dlg.setValue("audit_recs",props.auditRecordsPerPage); + dlg.setValue("create_lvl",props.communityCreateLevel); + dlg.setValue("comm_mbrs",props.communityMembersPerPage); + dlg.setValue("posts_page",props.postsPerPage); + dlg.setValue("old_posts",props.oldPostsAtTop); + dlg.setValue("conf_mbrs",props.conferenceMembersPerPage); + if (props.displayPostPictures) + dlg.setValue("pic_in_post",1); + + rc = dlg; + + } // end try + catch (e) + { // exception setting up dialog + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled profile update - bounce back to the menu + vlib.output(new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (op=="update") +{ // load the values from the dialog + dlg.load(rinput); + + try + { // validate the dialog first + dlg.validate(); + + // set all the properties correctly + adm = user.adminInterface; + props = adm.properties; + props.searchItemsPerPage = dlg.getValue("search_items").intValue(); + props.postsOnFrontPage = dlg.getValue("fp_posts").intValue(); + props.auditRecordsPerPage = dlg.getValue("audit_recs").intValue(); + props.communityCreateLevel = dlg.getValue("create_lvl").intValue(); + props.communityMembersPerPage = dlg.getValue("comm_mbrs").intValue(); + props.postsPerPage = dlg.getValue("posts_page").intValue(); + props.oldPostsAtTop = dlg.getValue("old_posts").intValue(); + props.conferenceMembersPerPage = dlg.getValue("conf_mbrs").intValue(); + props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue(); + adm.properties = props; + + // done - bounce back to the menu + rc = new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET); + + } // end try + catch (e) + { // caught an exception - figure out what to do + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // validation error - reset the dialog and try again + dlg.setErrorMessage(e.message + " Please try again."); + setupDialog(dlg,rinput.engine); + rc = dlg; + + } // end if + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Unable to update global properties: " + e.message, + "sysadmin/menu.js.vs"); + else + rc = e; + + } // end catch + +} // end if +else +{ // what the hell got clicked? + logger.error("no known button click on POST to sysadmin/global.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/menu.js.vs"); + +} // end else + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/sysadmin/import.js b/scripts/sysadmin/import.js new file mode 100644 index 0000000..ac6568e --- /dev/null +++ b/scripts/sysadmin/import.js @@ -0,0 +1,85 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.hasAdminAccess())) +{ // no admin access - we can't do this + vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null)); + vlib.done(); + +} // end if + +if ("GET"==rinput.verb) +{ // build a JSPView to hold the upload form + vlib.output(new JSPView("Import User Accounts","sysadmin/import_form.jsp")); + vlib.done(); + +} // end if + +// the following assumes a POST +if (rinput.isImageButtonClicked("cancel")) +{ // redirect back to the admin menu + vlib.output(new Redirect("sysadmin/menu.js.vs",LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (!(rinput.isImageButtonClicked("upload"))) +{ // the buttons must be wrong! + logger.error("no known button click on POST, to sysadmin/import.js"); + vlib.output(new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/menu.js.vs")); + vlib.done(); + +} // end if + +if (!(rinput.isFileParam("idata"))) +{ // the idata parameter MUST be a file parameter! + vlib.output(new ErrorBox("Internal Error","Invalid input file parameter.","sysadmin/menu.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // prepare and load the XML file + ihelper = new ImportHelper(rinput.user.adminInterface,rinput.getParameterDataStream("idata")); + + // set up the return value + rinput.setRequestAttribute("import.helper",ihelper); + rc = new JSPView("Import User Accounts","sysadmin/import_results.jsp"); + +} // end try +catch (e) +{ // translate the various exception types here + etype = vlib.exceptionType(e) + ""; + if (etype.match("ServletMultipartException")) + rc = new ErrorBox("Internal Error","Error loading post data: " + e.message,"sysadmin/menu.js.vs"); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/sysadmin/menu.js b/scripts/sysadmin/menu.js new file mode 100644 index 0000000..2b85d87 --- /dev/null +++ b/scripts/sysadmin/menu.js @@ -0,0 +1,37 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// get the request object +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.hasAdminAccess())) +{ // you don't have permission to administer the system + vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null)); + vlib.done(); + +} // end if + +// build a view around it and return it +rc = new MenuView(rinput.getMenu("system.admin")); +rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY; +vlib.output(rc); diff --git a/scripts/sysadmin/modify_photo.js b/scripts/sysadmin/modify_photo.js new file mode 100644 index 0000000..7ff984c --- /dev/null +++ b/scripts/sysadmin/modify_photo.js @@ -0,0 +1,148 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importClass(java.awt.Dimension); +importPackage(Packages.com.silverwrist.util); +importPackage(Packages.com.silverwrist.util.image); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +// Get the request object. +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.hasAdminAccess())) +{ // no admin access - we can't do this + vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null)); + vlib.done(); + +} // end if + +uid = rinput.getParameterInt("uid",0); +if (uid==0) +{ // user ID not found + vlib.output(new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs")); + vlib.done(); + +} // end if + +rc = null; +if ("GET"==rinput.verb) +{ // create a PhotoUploader to do the photo uploading + try + { // create and initialize the PhotoUploader + adm = rinput.user.adminInterface; + admuser = adm.getUserContext(uid); + rc = new PhotoUploader("Upload User Photo","sysadmin/modify_photo.js.vs",LinkTypes.SERVLET); + rc.addHiddenParameter("uid",uid); + rc.photoTag = rinput.getUserPhotoTag(admuser.getContactInfo().photoURL); + rc.label = "New user photo"; + + } // end try + catch (e) + { // an exception in the output... + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error generating display: " + e.message, + "sysadmin/find_user.js.vs"); + else if (etype.match("AccessError")) + rc = new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs"); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// If the cancel button was clicked, bounce out of here. +if (rinput.isImageButtonClicked("cancel")) +{ // user elected to cancel upload - bounce us out of here + vlib.output(new Redirect("sysadmin/modify_user.js.vs?uid=" + uid,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +if (rinput.isImageButtonClicked("upload")) +{ // do some shorts-checking in the parameters + if (!(rinput.isFileParam("thepic"))) + { // bogus file parameter + logger.error("Internal Error: 'thepic' should be a file param"); + vlib.output(new ErrorBox(null,"Internal Error: 'thepic' should be a file param", + "sysadmin/modify_user.js.vs?uid=" + uid)); + vlib.done(); + + } // end if + + mimetype = rinput.getParameterType("thepic") + ""; + if (!(mimetype.match("image/"))) + { // not an image file type that got uploaded + logger.error("Error: 'thepic' not an image type"); + vlib.output(new ErrorBox(null,"You did not upload an image file. Try again.", + "sysadmin/modify_photo.js.vs?uid=" + uid)); + vlib.done(); + + } // end if + + try + { // normalize the photo to 100x100 pixels + real_pic = ImageNormalizer.normalizeImage(rinput.getParameterDataStream("thepic"), + rinput.engine.getUserPhotoSize(),"jpeg"); + + // set the user photo data! + adm = rinput.user.adminInterface; + admuser = adm.getUserContext(uid); + ci = admuser.getContactInfo(); + ci.setPhotoData(rinput.contextPath + "/imagedata/","image/jpeg",real_pic.length,real_pic.data); + admuser.putContactInfo(ci); + + // Jump back to the profile form. + rc = new Redirect("sysadmin/modify_user.js.vs?uid=" + uid,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception while setting user photo + etype = vlib.exceptionType(e) + ""; + if (etype.match("ServletMultipartException")) + rc = new ErrorBox(null,"Internal Error: " + e.message,"sysadmin/modify_user.js.vs?uid=" + uid); + else if (etype.match("ImageNormalizerException")) + rc = new ErrorBox(null,e.message,"sysadmin/modify_photo.js.vs?uid=" + uid); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error storing user photo: " + e.message, + "sysadmin/modify_user.js.vs?uid=" + uid); + else if (etype.match("EmailException")) + rc = new ErrorBox(null,"Internal Error: " + e.message,"sysadmin/modify_user.js.vs?uid=" + uid); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else + rc = e; + + } // end catch + +} // end if +else +{ // don't know the command button! + logger.error("no known button click on POST to sysadmin/modify_photo.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed", + "sysadmin/modify_user.js.vs?uid=" + uid); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/sysadmin/modify_user.js b/scripts/sysadmin/modify_user.js new file mode 100644 index 0000000..51b396d --- /dev/null +++ b/scripts/sysadmin/modify_user.js @@ -0,0 +1,283 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +function setupDialog(dlg,adm,user) +{ + dlg.setSubtitle("User: " + user.userName); + var role_list = adm.getAllowedRoleList(); + dlg.sendMessage("base_lvl","setRoleList",role_list); + + // See if this level was found on the list. + var my_role = user.baseRole; + var found = false; + var it = role_list.iterator(); + while (it.hasNext()) + { // seek each role in turn + var r = it.next(); + if (r.equals(my_role)) + { // found it! + found = true; + break; + + } // end if + + } // end while + + if (!found) // role not found - set the defined role list to be a singleton + dlg.sendMessage("base_lvl","setRoleList",Collections.singletonList(my_role)); + dlg.sendMessage("photo","setLinkURL","sysadmin/modify_photo.js.vs?uid=" + admuser.UID); + +} // end setupDialog + +rinput = bsf.lookupBean("request"); + +if (!(rinput.user.hasAdminAccess())) +{ // no admin access - we can't do this + vlib.output(new ErrorBox("Access Error","You do not have permission to administer the system.",null)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("admin.modify.user"); + +rc = null; +if ("GET"==rinput.verb) +{ // set up the dialog + uid = rinput.getParameterInt("uid",0); + if (uid==0) + { // user ID not found + vlib.output(new ErrorBox(null,"User ID parameter not found.","sysadmin/find_user.js.vs")); + vlib.done(); + + } // end if + + try + { // load the user's data and populate the dialog box + adm = rinput.user.adminInterface; + admuser = adm.getUserContext(uid); + setupDialog(dlg,adm,admuser); // set up the dialog box + dlg.setValue("uid",admuser.UID); + + dlg.setValue("base_lvl",admuser.baseLevel); + if (admuser.isEmailVerified()) + dlg.setValue("verify_email",1); + if (admuser.isLockedOut()) + dlg.setValue("lockout",1); + + ci = admuser.getContactInfo(); // get the main contact info + props = admuser.properties; + + if (props.disallowPhoto) + dlg.setValue("nophoto",1); + dlg.setValue("prefix",ci.namePrefix); + dlg.setValue("first",ci.givenName); + if (ci.middleInitial!=' ') + dlg.setValue("mid",String.fromCharCode(ci.middleInitial)); + dlg.setValue("last",ci.familyName); + dlg.setValue("suffix",ci.nameSuffix); + dlg.setValue("company",ci.company); + dlg.setValue("addr1",ci.addressLine1); + dlg.setValue("addr2",ci.addressLine2); + if (ci.privateAddress) + dlg.setValue("pvt_addr",1); + dlg.setValue("loc",ci.locality); + dlg.setValue("reg",ci.region); + dlg.setValue("pcode",ci.postalCode); + dlg.setValue("country",ci.country); + dlg.setValue("phone",ci.phone); + dlg.setValue("mobile",ci.mobile); + if (ci.privatePhone) + dlg.setValue("pvt_phone",1); + dlg.setValue("fax",ci.fax); + if (ci.privateFax) + dlg.setValue("pvt_fax",1); + dlg.setValue("email",ci.email); + if (ci.privateEmail) + dlg.setValue("pvt_email",1); + dlg.setValue("url",ci.URL); + dlg.setValue("descr",admuser.description); + dlg.setValue("photo",ci.photoURL); + if (props.displayPostPictures) + dlg.setValue("pic_in_post",1); + if (props.massMailOptOut) + dlg.setValue("no_mass_mail",1); + dlg.setValue("locale",admuser.locale); + dlg.setValue("tz",admuser.timeZone); + + rc = dlg; + + } // end try + catch (e) + { // exception initializing dialog + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Unable to retrieve user information: " + e.message, + "sysadmin/find_user.js.vs"); + else if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else + rc = e; + + } // end catch + + vlib.output(rc); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled profile update - bounce back to the target + vlib.output(new Redirect("sysadmin/find_user.js.vs",LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the dialog parameters + +if (op=="update") +{ // we're updating the user + try + { // get the admin interface and the user information + uid = parseInt(dlg.getValue("uid"),10); + adm = rinput.user.adminInterface; + admuser = adm.getUserContext(uid); + + try + { // validate the dialog + dlg.validate(); + + // check the passwords + pass1 = dlg.getValue("pass1") + ""; + pass2 = dlg.getValue("pass2") + ""; + + if (vlib.emptyString(pass1)) + { // empty must match empty + if (!(vlib.emptyString(pass2))) + throw new ValidationException("The typed passwords do not match."); + + } // end if + else + { // the two passwords must match + if (pass1!=pass2) + throw new ValidationException("The typed passwords do not match."); + + } // end else + + // reset the base level + admuser.baseLevel = dlg.getValue("base_lvl").intValue(); + + // Change the password if applicable. + if (!(vlib.emptyString(pass1))) + admuser.setPassword(pass1,dlg.getValue("remind")); + + admuser.setEmailVerified(dlg.getValue("verify_email").booleanValue()); + admuser.setLockedOut(dlg.getValue("lockout").booleanValue()); + + ci = admuser.getContactInfo(); // get the main contact info + props = admuser.properties; + + // Reset all the contact info fields. + props.disallowPhoto = dlg.getValue("nophoto").booleanValue(); + ci.namePrefix = dlg.getValue("prefix"); + ci.givenName = dlg.getValue("first"); + blort = dlg.getValue("mid") + ""; + if (blort.length<1) + ci.middleInitial = " "; + else + ci.middleInitial = blort.substring(0,1); + ci.familyName = dlg.getValue("last"); + ci.nameSuffix = dlg.getValue("suffix"); + ci.company = dlg.getValue("company"); + ci.addressLine1 = dlg.getValue("addr1"); + ci.addressLine2 = dlg.getValue("addr2"); + ci.privateAddress = dlg.getValue("pvt_addr").booleanValue(); + ci.locality = dlg.getValue("loc"); + ci.region = dlg.getValue("reg"); + ci.postalCode = dlg.getValue("pcode"); + ci.country = dlg.getValue("country"); + ci.phone = dlg.getValue("phone"); + ci.mobile = dlg.getValue("mobile"); + ci.privatePhone = dlg.getValue("pvt_phone").booleanValue(); + ci.fax = dlg.getValue("fax"); + ci.privateFax = dlg.getValue("pvt_fax").booleanValue(); + ci.email = dlg.getValue("email"); + ci.privateEmail = dlg.getValue("pvt_email").booleanValue(); + ci.URL = dlg.getValue("url"); + props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue(); + props.massMailOptOut = dlg.getValue("no_mass_mail").booleanValue(); + + // Store the completed contact info. + admuser.putContactInfo(ci); + admuser.properties = props; + + // Save off the user's description and preferences. + admuser.description = dlg.getValue("descr"); + admuser.locale = dlg.getValue("locale"); + admuser.timeZone = dlg.getValue("tz"); + + // redirect back to the Find User page + rc = new Redirect("sysadmin/find_user.js.vs",LinkTypes.SERVLET); + + } // end try + catch (e) + { // catch ValidationExceptions here and redisplay the dialog + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // on a ValidationException, redisplay the dialog and try again + dlg.setErrorMessage(e.message + " Please try again."); + setupDialog(dlg,adm,admuser); // set up the dialog box + dlg.setValue("pass1",null); + dlg.setValue("pass2",null); + rc = dlg; + + } // end if + else // propagate other types of exceptions + throw e; + + } // end catch + + } // end try + catch (e) + { // this is used to catch the hard exceptions + etype = vlib.exceptionType(e) + ""; + if (etype.match("AccessError")) + rc = new ErrorBox("Access Error","You do not have permission to administer the system.",null); + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Unable to retrieve user information: " + e.message, + "sysadmin/find_user.js.vs"); + else + rc = e; + + } // end catch + +} // end if +else +{ // bogus button indicated + logger.error("no known button click on POST to sysadmin/modify_user.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed","sysadmin/find_user.js.vs"); + +} // end else + +vlib.output(rc); // all done! diff --git a/scripts/test/test1.jacl b/scripts/test/test1.jacl new file mode 100644 index 0000000..bfe3a8c --- /dev/null +++ b/scripts/test/test1.jacl @@ -0,0 +1,14 @@ +# Script for testing the new UI framework +package require java + +set request [bsf lookupBean "request"] + +if {[$request hasParameter "p"]} { + $logger debug "Got the parameter value!" + set tmp [$request getParameter "p"] + set part1 "Requested parameter: $tmp

" +} else { + set part1 "" +} ;# end if + +$vlib output "$part1 In the house!" \ No newline at end of file diff --git a/scripts/test/test2.jacl b/scripts/test/test2.jacl new file mode 100644 index 0000000..1cb755b --- /dev/null +++ b/scripts/test/test2.jacl @@ -0,0 +1,10 @@ +# Script for testing the View mechanism +package require java +java::import com.silverwrist.venice.ui.LinkTypes + +set rc [java::new com.silverwrist.venice.ui.view.TextMessage "Test Display" "subtitle"] +set blort "If this had been an actual emergency we would all be dead by now." +java::prop $rc text "This is a test.
This is only a test.
$blort" +$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "ok" +$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "cancel" +$vlib output $rc \ No newline at end of file diff --git a/scripts/test/test2.js b/scripts/test/test2.js new file mode 100644 index 0000000..dea10d3 --- /dev/null +++ b/scripts/test/test2.js @@ -0,0 +1,12 @@ +// Script for testing the View mechanism +// Translation of test2.jacl + +importPackage(Packages.com.silverwrist.venice.ui); +importClass(Packages.com.silverwrist.venice.ui.view.TextMessage); + +rc = new TextMessage("Test Display","JavaScript subtitle"); +blort = "If this had been an actual emergency we would all be dead by now." +rc.text = "This is a test.
This is only a test.
" + blort; +rc.addButton(LinkTypes.ABSOLUTE,"TODO","ok"); +rc.addButton(LinkTypes.ABSOLUTE,"TODO","cancel"); +vlib.output(rc); diff --git a/scripts/test/test3.jacl b/scripts/test/test3.jacl new file mode 100644 index 0000000..a9e3995 --- /dev/null +++ b/scripts/test/test3.jacl @@ -0,0 +1,17 @@ +# Script for testing the sidebox framework +# Translated from test3.js + +package require java +java::import com.silverwrist.venice.ui.LinkTypes +java::import com.silverwrist.venice.ui.view.SideBoxNestedView +java::import com.silverwrist.venice.ui.view.TextMessage + +set rinput [bsf lookupBean "request"] +set rc [java::new TextMessage "Test Display" "Jacl subtitle"] +set blort "If this had been an actual emergency we would all be dead by now." +java::prop $rc text "This is a test.
This is only a test.
$blort" +$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "ok" +$rc addButton [java::field LinkTypes ABSOLUTE] "TODO" "cancel" + +set rc2 [java::new SideBoxNestedView $rinput $rc] +$vlib output $rc2 \ No newline at end of file diff --git a/scripts/test/test3.js b/scripts/test/test3.js new file mode 100644 index 0000000..80d16bf --- /dev/null +++ b/scripts/test/test3.js @@ -0,0 +1,13 @@ +// Script for testing the sidebox framework + +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); +rc = new TextMessage("Test Display","JavaScript subtitle"); +blort = "If this had been an actual emergency we would all be dead by now." +rc.text = "This is a test.
This is only a test.
" + blort; +rc.addButton(LinkTypes.ABSOLUTE,"TODO","ok"); +rc.addButton(LinkTypes.ABSOLUTE,"TODO","cancel"); +rc2 = new SideBoxNestedView(rinput,rc); +vlib.output(rc2); diff --git a/scripts/top.js b/scripts/top.js new file mode 100644 index 0000000..533a23a --- /dev/null +++ b/scripts/top.js @@ -0,0 +1,73 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); +rc = null; +try +{ // get the list of front page posts! + post_list = rinput.engine.getPublishedMessages(false); + + // precalculate the message text and poster names of the front-page messages + poster_names = new ArrayList(post_list.size()); + message_text = new ArrayList(post_list.size()); + topic_names = new ArrayList(post_list.size()); + topic_links = new ArrayList(post_list.size()); + for (i=0; i. +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(java.util); +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); +importPackage(Packages.com.silverwrist.venice.ui.view); + +rinput = bsf.lookupBean("request"); + +rc = null; +try +{ // generate the list of sideboxes we have + in_list = rinput.user.getSideBoxList(); + ids = new HashSet(in_list.size()); + it = in_list.iterator(); + while (it.hasNext()) + { // add the IDs of all the sideboxes to the set + descr = vlib.castSideBoxDescriptor(it.next()); + ids.add(descr.sideBoxID); + + } // end for + + all_list = rinput.engine.getMasterSideBoxList(); + out_list = null; + if (all_list.size()>in_list.size()) + { // allocate an ArrayList to hold the sideboxes + out_list = new ArrayList(all_list.size()-in_list.size()); + it = all_list.iterator(); + while (it.hasNext()) + { // get all sideboxes not on the "in" list and put them on the "out" list + descr = vlib.castSideBoxDescriptor(it.next()); + if (!(ids.contains(descr.sideBoxID))) + out_list.add(descr); + + } // end while + + } // end if + else // nothing in the "out list" + out_list = Collections.EMPTY_LIST; + + // save off the two lists as request parameters + rinput.setRequestAttribute("sideboxes.included",in_list); + rinput.setRequestAttribute("sideboxes.excluded",out_list); + + // create a new JSPView for this + rc = new JSPView("Your Front Page Configuration","user/sidebox.jsp"); + rc.menuSelector = Content.MENU_SELECTOR_TOP; + +} // end try +catch (e) +{ // we got some sort of exception here + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error getting sidebox list: " + e.message(),"top.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); // all done! diff --git a/scripts/usr/sidebox_add.js b/scripts/usr/sidebox_add.js new file mode 100644 index 0000000..fa97887 --- /dev/null +++ b/scripts/usr/sidebox_add.js @@ -0,0 +1,52 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +rinput = bsf.lookupBean("request"); + +boxid = rinput.getParameterInt("box",0); +if (boxid==0) +{ // the box ID parameter is invalid + vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // add the sidebox + rinput.user.addSideBox(boxid); + + // now execute the "sidebox.js" script to do the redisplay + rc = vlib.exec("usr/sidebox.js"); + rinput.location = "usr/sidebox.js.vs"; + +} // end try +catch (e) +{ // exception adding to the sidebox list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adding to sidebox list: " + e.message,"usr/sidebox.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); \ No newline at end of file diff --git a/scripts/usr/sidebox_delete.js b/scripts/usr/sidebox_delete.js new file mode 100644 index 0000000..78c7286 --- /dev/null +++ b/scripts/usr/sidebox_delete.js @@ -0,0 +1,65 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +rinput = bsf.lookupBean("request"); + +boxid = rinput.getParameterInt("box",0); +if (boxid==0) +{ // the box ID parameter is invalid + vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // locate the specified sidebox in the list + sidebox_list = rinput.user.getSideBoxList(); + curr = null; + it = sidebox_list.iterator(); + found = false; + while (!found && it.hasNext()) + { // look for the right descriptor + curr = vlib.castUserSideBoxDescriptor(it.next()); + if (boxid==curr.sideBoxID) // found the current one + found = true; + + } // end while + + if (found) + curr.remove(); // remove the sidebox + + // now execute the "sidebox.js" script to do the redisplay + rc = vlib.exec("usr/sidebox.js"); + rinput.location = "usr/sidebox.js.vs"; + +} // end try +catch (e) +{ // exception modifying the sidebox list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/usr/sidebox_down.js b/scripts/usr/sidebox_down.js new file mode 100644 index 0000000..6742a65 --- /dev/null +++ b/scripts/usr/sidebox_down.js @@ -0,0 +1,90 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +rinput = bsf.lookupBean("request"); + +boxid = rinput.getParameterInt("box",0); +if (boxid==0) +{ // the box ID parameter is invalid + vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // locate the specified sidebox in the list + sidebox_list = rinput.user.getSideBoxList(); + next = null; + curr = null; + it = sidebox_list.iterator(); + found = false; + while (!found && it.hasNext()) + { // look for the right descriptor + curr = vlib.castUserSideBoxDescriptor(it.next()); + if (boxid==curr.sideBoxID) + { // found the current one - get the next one as well + found = true; + if (it.hasNext()) + next = vlib.castUserSideBoxDescriptor(it.next()); + + } // end if + + } // end while + + if (found && (next!=null)) + { // exchange sequence numbers between curr and next + seq_curr = curr.sequence; + seq_next = next.sequence; + curr.sequence = seq_next; // first "set" + restore = true; + try + { // do the second "set" + next.sequence = seq_curr; + restore = false; + + } // end try + finally + { // restore first if second failed + if (restore) + curr.sequence = seq_curr; + + } // end finally + + } // end if + // else just fall out and don't do anything + + // now execute the "sidebox.js" script to do the redisplay + rc = vlib.exec("usr/sidebox.js"); + rinput.location = "usr/sidebox.js.vs"; + +} // end try +catch (e) +{ // exception modifying the sidebox list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/usr/sidebox_up.js b/scripts/usr/sidebox_up.js new file mode 100644 index 0000000..de1212d --- /dev/null +++ b/scripts/usr/sidebox_up.js @@ -0,0 +1,87 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +rinput = bsf.lookupBean("request"); + +boxid = rinput.getParameterInt("box",0); +if (boxid==0) +{ // the box ID parameter is invalid + vlib.output(new ErrorBox(null,"Box parameter invalid!","usr/sidebox.js.vs")); + vlib.done(); + +} // end if + +rc = null; +try +{ // locate the specified sidebox in the list + sidebox_list = rinput.user.getSideBoxList(); + prev = null; + current = null; + it = sidebox_list.iterator(); + found = false; + while (!found && it.hasNext()) + { // look for the right descriptor + prev = current; + current = vlib.castUserSideBoxDescriptor(it.next()); + if (boxid==current.sideBoxID) // found the current one + found = true; + + } // end while + + if (found && (prev!=null)) + { // exchange sequence numbers between current and prev + seq_curr = current.sequence; + seq_prev = prev.sequence; + current.sequence = seq_prev; // first "set" + restore = true; + try + { // do the second "set" + prev.sequence = seq_curr; + restore = false; + + } // end try + finally + { // restore first if second failed + if (restore) + current.sequence = seq_curr; + + } // end finally + + } // end if + else + logger.debug("sidebox_up.js not doing anything"); + + // now execute the "sidebox.js" script to do the redisplay + rc = vlib.exec("usr/sidebox.js"); + rinput.location = "usr/sidebox.js.vs"; + +} // end try +catch (e) +{ // exception modifying the sidebox list + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Error adjusting sidebox list: " + e.message,"usr/sidebox.js.vs"); + else + rc = e; + +} // end catch + +vlib.output(rc); diff --git a/scripts/verify_email.js b/scripts/verify_email.js new file mode 100644 index 0000000..834afc4 --- /dev/null +++ b/scripts/verify_email.js @@ -0,0 +1,145 @@ +// The contents of this file are subject to the Mozilla Public License Version 1.1 +// (the "License"); you may not use this file except in compliance with the License. +// You may obtain a copy of the License at . +// +// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT +// WARRANTY OF ANY KIND, either express or implied. See the License for the specific +// language governing rights and limitations under the License. +// +// The Original Code is the Venice Web Communities System. +// +// The Initial Developer of the Original Code is Eric J. Bowersox , +// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are +// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +// +// Contributor(s): + +importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.except); +importPackage(Packages.com.silverwrist.venice.ui); +importPackage(Packages.com.silverwrist.venice.ui.dlg); +importPackage(Packages.com.silverwrist.venice.ui.helpers); + +// Get the request object and the target URI. +rinput = bsf.lookupBean("request"); +target = rinput.getParameter("tgt"); +if (target==null) + target = "top.js.vs"; + +// If the user is not logged in, this is an error. +user = rinput.user; +if (!(user.isLoggedIn())) +{ // user not logged in - just bail on this + vlib.output(new ErrorBox(null,"You must log in before you can verify your account's email address.")); + vlib.done(); + +} // end if + +// If the user's E-mail address is already verified, this is a no-op. +if (user.isEmailVerified()) +{ // user already verified - just bail on this + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg = rinput.getDialog("verify"); // retrieve the verification dialog + +if ("GET"==rinput.verb) +{ // display the dialog and have done with it + dlg.setValue("tgt",target); + rinput.location = target; + rinput.displayLogin = false; + vlib.output(dlg); + vlib.done(); + +} // end if + +// everything that follows is for a POST operation +op = dlg.whichButton(rinput) + ""; +if (op=="cancel") +{ // user cancelled verify - bounce back to the target + vlib.output(new Redirect(target,LinkTypes.SERVLET)); + vlib.done(); + +} // end if + +dlg.load(rinput); // load the dialog parameters +rc = null; // return from this script +if (op=="sendagain") +{ // we want to resend the E-mail confirmation + try + { // do the resend! + user.resendEmailConfirmation(); + + // now display the dialog again + dlg.clear(); + dlg.setValue("tgt",target); + rinput.location = target; + rinput.displayLogin = false; + rc = dlg; + + } // end try + catch (e) + { // exception when resending the email confirmation + etype = vlib.exceptionType(e) + ""; + if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error sending confirmation: " + e.message,target); + else if (etype.match("EmailException")) + rc = new ErrorBox("E-mail Error","E-mail error sending confirmation: " + e.message,target); + else + rc = e; + + } // end catch + +} // end if +else if (op=="ok") +{ // actually perform the confirmation + try + { // validate the dialog first + dlg.validate(); + + // now attempt the confirmation + user.confirmEmail(dlg.getValue("num")); + + // all done - go back to where we want to be + rc = new Redirect(target,LinkTypes.SERVLET); + + } // end try + catch (e) + { // exception when confirming... + etype = vlib.exceptionType(e) + ""; + if (etype.match("ValidationException")) + { // validation error thrown by dialog + dlg.setErrorMessage(e.message + " Please try again."); + dlg.setValue("num",null); + rinput.location = target; + rinput.displayLogin = false; + rc = dlg; + + } // end if + else if (etype.match("DataException")) + rc = new ErrorBox("Database Error","Database error verifying email: " + e.message,target); + else if (etype.match("AccessError")) + { // invalid confirmation number, perhaps? + dlg.setErrorMessage(e.message); + dlg.setValue("num",null); + rinput.location = target; + rinput.displayLogin = false; + rc = dlg; + + } // end if + else + rc = e; + + } // end catch + +} // end else if +else +{ // button not found... + logger.error("no known button click on POST to verify_email.js"); + rc = new ErrorBox("Internal Error","Unknown command button pressed",target); + +} // end else + +vlib.output(rc); // all done! diff --git a/src/com/silverwrist/venice/servlets/Account.java b/src/com/silverwrist/venice/servlets/Account.java deleted file mode 100644 index c9e1949..0000000 --- a/src/com/silverwrist/venice/servlets/Account.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.net.URLEncoder; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class Account extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String DISPLAY_LOGIN_ATTR = "com.silverwrist.venice.servlets.internal.DisplayLogin"; - - private static final int COOKIE_LIFETIME = 60*60*24*365; // one year - - private static Category logger = Category.getInstance(Account.class); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private void setDisplayLogins(ServletRequest request) - { - request.setAttribute(DISPLAY_LOGIN_ATTR,new Integer(0)); - - } // end setDisplayLogins - - private NewAccountDialog makeNewAccountDialog() throws ServletException - { - final String desired_name = "NewAccountDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - NewAccountDialog template = new NewAccountDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (NewAccountDialog)(cache.getNewDialog(desired_name)); - - } // end makeNewAccountDialog - - private LoginDialog makeLoginDialog() - { - final String desired_name = "LoginDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - LoginDialog template = new LoginDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (LoginDialog)(cache.getNewDialog(desired_name)); - - } // end makeLoginDialog - - private VerifyEmailDialog makeVerifyEmailDialog() - { - final String desired_name = "VerifyEmailDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - VerifyEmailDialog template = new VerifyEmailDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (VerifyEmailDialog)(cache.getNewDialog(desired_name)); - - } // end makeVerifyEmailDialog - - private EditProfileDialog makeEditProfileDialog() throws ServletException - { - final String desired_name = "EditProfileDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - EditProfileDialog template = new EditProfileDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (EditProfileDialog)(cache.getNewDialog(desired_name)); - - } // end makeEditProfileDialog - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "Account servlet - Handles login, logout, account creation, and profiles\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected String getMyLocation(HttpServletRequest request, VeniceEngine engine, UserContext user, - RenderData rdat) - { - String rc = super.getMyLocation(request,engine,user,rdat); - if (rc!=null) - return rc; - if (request.getAttribute(DISPLAY_LOGIN_ATTR)!=null) - return "account?cmd=" + getStandardCommandParam(request); - else - return null; - - } // end getMyLocation - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - String tgt = request.getParameter("tgt"); // target location - if (tgt==null) - tgt = "top"; // go back to the Top screen if nothing else - String cmd = getStandardCommandParam(request); - - if (cmd.equals("L")) - { // "L" = Log In/Out - if (user.isLoggedIn()) - { // this is a Logout command - clearUserContext(request); - - // delete the "login" cookie - Cookie del_login_info = rdat.createCookie(Variables.LOGIN_COOKIE,"",0); - Variables.saveCookie(request,del_login_info); - - throw new RedirectResult("top"); // take 'em back to the "top" page - - } // end if - - // this is a Login command - display the Login page - LoginDialog dlg = makeLoginDialog(); - dlg.setupNew(tgt); - setMyLocation(request,tgt); // fake out the location so we can display the "Log In/Create Account" links - return dlg; - - } // end if ("L" command) - - if (cmd.equals("C")) - { // "C" = create new account - if (user.isLoggedIn()) // you can't create a new account while logged in on an existing one! - return new ErrorBox("Error","You cannot create a new account while logged in on an existing " - + "one. You must log out first.",tgt); - - final String yes = "yes"; - if (yes.equals(request.getParameter("agree"))) - { // display the "Create Account" dialog - NewAccountDialog dlg = makeNewAccountDialog(); - dlg.setEngine(engine); - dlg.setTarget(tgt); - dlg.setFieldValue("country","US"); - return dlg; - - } // end if - else - { // display the account terms dialog - String[] choices = new String[2]; - choices[0] = "account?cmd=C&agree=yes&tgt=" + URLEncoder.encode(tgt); - choices[1] = "top"; - return new TextMessageDialog(TextMessageDialog.TYPE_ACCEPT_DECLINE, - rdat.getStockMessage("user-agreement-title"), - rdat.getStockMessage("user-agreement-subtitle"), - rdat.getStockMessage("user-agreement"),choices); - - } // end else - - } // end if ("C" command) - - if (cmd.equals("P")) - { // "P" = user profile - if (!(user.isLoggedIn())) // you have to be logged in for this one! - return new ErrorBox("Error","You must log in before you can modify the profile " - + "on your account.",tgt); - - // set up the Edit Profile dialog - EditProfileDialog dlg = makeEditProfileDialog(); - try - { /// set up the profile information for the dialog - dlg.setupDialog(user,tgt); - - } // end try - catch (DataException e) - { // unable to load the contact info for the profile - return new ErrorBox("Database Error","Database error retrieving profile: " + e.getMessage(),tgt); - - } // end catch - - return dlg; // display dialog - - } // end if ("P" command) - - if (cmd.equals("V")) - { // "V" = verify email address - setDisplayLogins(request); - if (!(user.isLoggedIn())) // you have to be logged in for this one! - return new ErrorBox("Error","You must log in before you can verify your account's " - + "email address.",tgt); - - // display the "verify email" dialog - VerifyEmailDialog dlg = makeVerifyEmailDialog(); - dlg.setTarget(tgt); - return dlg; - - } // end if ("V" command) - - // command not found! - logger.error("invalid command to Account.doGet: " + cmd); - return new ErrorBox("Internal Error","Invalid command to Account.doGet",tgt); - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - changeMenuTop(request); // this is "top" menus - String tgt = request.getParameter("tgt"); // target location - if (tgt==null) - tgt = "top"; // go back to the Top screen if nothing else - String cmd = getStandardCommandParam(request); - - if (cmd.equals("L")) - { // "L" = login the user - LoginDialog dlg = makeLoginDialog(); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(tgt); // we decided not to log in - go back where we came from - - if (dlg.isButtonClicked(request,"remind")) - { // this will email a password reminder to the owner's account - dlg.loadValues(request); // load the dialog values - - try - { // send the password reminder - engine.sendPasswordReminder(dlg.getFieldValue("user")); - - // recycle and redisplay the dialog box - dlg.resetOnError("Password reminder has been sent to your e-mail address."); - - } // end try - catch (DataException de) - { // there was a database error finding your email address - return new ErrorBox("Database Error","Database error finding user: " + de.getMessage(),tgt); - - } // end catch - catch (AccessError ae) - { // this indicates a problem with the user account or password - return new ErrorBox("User E-mail Address Not Found",ae.getMessage(),tgt); - - } // end catch - catch (EmailException ee) - { // error sending the confirmation email - return new ErrorBox("E-mail Error","E-mail error sending reminder: " + ee.getMessage(),tgt); - - } // end catch - - setMyLocation(request,tgt); // fake out the location - return dlg; // redisplay the dialog - - } // end if ("remind" button clicked) - - if (dlg.isButtonClicked(request,"login")) - { // we actually want to try and log in! imagine that! - dlg.loadValues(request); // load the values - - try - { // use the user context to authenticate - user.authenticate(dlg.getFieldValue("user"),dlg.getFieldValue("pass")); - - // If they want a cookie, give it to them! - final String yes = "Y"; - if (yes.equals(dlg.getFieldValue("saveme"))) - { // create the authentication cookie and save it - Cookie auth_cookie = rdat.createCookie(Variables.LOGIN_COOKIE,user.getAuthenticationToken(), - COOKIE_LIFETIME); - Variables.saveCookie(request,auth_cookie); - - } // end if - - // assuming it worked OK, redirect them back where they came from - // (or to the verification page if they need to go there) - clearMenu(request); - if (user.isEmailVerified()) - throw new RedirectResult(tgt); - else // they haven't verified yet - remind them to do so - throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt)); - - } // end try - catch (DataException de) - { // this indicates a database error - display an ErrorBox - return new ErrorBox("Database Error","Database error logging in: " + de.getMessage(),tgt); - - } // end catch - catch (AccessError ae) - { // this indicates a problem with the user account or password - dlg.resetOnError(ae.getMessage()); - - } // end catch - - setMyLocation(request,tgt); // fake out the location - return dlg; // go back and redisplay the dialog - - } // end if ("login" button clicked) - - // the button must be wrong! - logger.error("no known button click on Account.doPost, cmd=L"); - return new ErrorBox("Internal Error","Unknown command button pressed",tgt); - - } // end if ("L" command) - - if (cmd.equals("C")) - { // "C" = Create New Account - NewAccountDialog dlg = makeNewAccountDialog(); - dlg.setEngine(engine); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(tgt); // we decided not to create account - go back where we came from - - if (dlg.isButtonClicked(request,"create")) - { // OK, actually want to create the account! - dlg.loadValues(request); // load field values - - try - { // attempt to create the account - UserContext uc = dlg.doDialog(request); - putUserContext(request,uc); // effectively logging in the new user - - // now jump to the Verify page - throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt)); - - } // end try - catch (ValidationException ve) - { // unable to validate some of the data in the form - dlg.resetOnError(ve.getMessage() + " Please try again."); - - } // end catch - catch (DataException de) - { // data error in setting up account - return new ErrorBox("Database Error","Database error creating account: " + de.getMessage(),tgt); - - } // end catch - catch (AccessError ae) - { // access error in setting up the account - dlg.resetOnError(ae.getMessage()); - - } // end catch - catch (EmailException ee) - { // error sending the confirmation email - return new ErrorBox("E-mail Error","E-mail error creating account: " + ee.getMessage(),tgt); - - } // end catch - - return dlg; // redisplay me - - } // end if ("create" button pressed) - - // the button must be wrong! - logger.error("no known button click on Account.doPost, cmd=C"); - return new ErrorBox("Internal Error","Unknown command button pressed",tgt); - - } // end if ("C" command) - - if (cmd.equals("V")) - { // "V" = Verify E-mail Address - setDisplayLogins(request); - VerifyEmailDialog dlg = makeVerifyEmailDialog(); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(tgt); // we decided not to bother - go back where we came from - - if (dlg.isButtonClicked(request,"again")) - { // send the confirmation message again - try - { // resend the email confirmation - user.resendEmailConfirmation(); - - // now force the form to be redisplayed - dlg.clearAllFields(); - dlg.setTarget(tgt); - - } // end try - catch (DataException de) - { // database error resending confirmation - return new ErrorBox("Database Error","Database error sending confirmation: " + de.getMessage(),tgt); - - } // end catch - catch (EmailException ee) - { // error sending the confirmation email - return new ErrorBox("E-mail Error","E-mail error sending confirmation: " + ee.getMessage(),tgt); - - } // end catch - - return dlg; // redisplay the dialog - - } // end if ("again" button clicked) - - if (dlg.isButtonClicked(request,"ok")) - { // try to verify the confirmation number - dlg.loadValues(request); // load field values - - try - { // validate that we have a good number - dlg.validate(); - user.confirmEmail(dlg.getConfirmationNumber()); - - // go back to our desired location - throw new RedirectResult(tgt); - - } // end try - catch (ValidationException ve) - { // there was a validation error... - dlg.resetOnError(ve.getMessage() + " Please try again."); - - } // end catch - catch (DataException de) - { // data error in confirming account - return new ErrorBox("Database Error","Database error verifying email: " + de.getMessage(),tgt); - - } // end catch - catch (AccessError ae) - { // invalid confirmation number, perhaps? - dlg.resetOnError(ae.getMessage()); - - } // end catch - - return dlg; // redisplay the dialog - - } // end if ("ok" button clicked) - - // the button must be wrong! - logger.error("no known button click on Account.doPost, cmd=V"); - return new ErrorBox("Internal Error","Unknown command button pressed",tgt); - - } // end if ("V" command) - - if (cmd.equals("P")) - { // "P" = Edit User Profile - setDisplayLogins(request); - EditProfileDialog dlg = makeEditProfileDialog(); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(tgt); // we decided not to bother - go back where we came from - - if (dlg.isButtonClicked(request,"update")) - { // we're ready to update the user profile - dlg.loadValues(request); // load field values - - boolean photo_flag = true; - try - { // validate the dialog and reset profile info - photo_flag = user.canSetUserPhoto(); - if (dlg.doDialog(user)) // need to reconfirm email address - throw new RedirectResult("account?cmd=V&tgt=" + URLEncoder.encode(tgt)); - else - throw new RedirectResult(tgt); // just go straight on back - - } // end try - catch (ValidationException ve) - { // there was a validation error... - dlg.resetOnError(photo_flag,ve.getMessage() + " Please try again."); - - } // end catch - catch (DataException de) - { // data error in changing profile - return new ErrorBox("Database Error","Database error updating profile: " + de.getMessage(),tgt); - - } // end catch - catch (EmailException ee) - { // error sending the confirmation email - return new ErrorBox("E-mail Error","E-mail error sending confirmation: " + ee.getMessage(),tgt); - - } // end catch - - return dlg; // redisplay dialog - - } // end if ("update" button clicked) - - // the button must be wrong! - logger.error("no known button click on Account.doPost, cmd=P"); - return new ErrorBox("Internal Error","Unknown command button pressed",tgt); - - } // end if - - // unknown command - logger.error("invalid command to Account.doPost: " + cmd); - return new ErrorBox("Internal Error","Invalid command to Account.doPost",tgt); - - } // end doVenicePost - -} // end class Account diff --git a/src/com/silverwrist/venice/servlets/AdminUserPhoto.java b/src/com/silverwrist/venice/servlets/AdminUserPhoto.java deleted file mode 100644 index 67f3fae..0000000 --- a/src/com/silverwrist/venice/servlets/AdminUserPhoto.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.util.image.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class AdminUserPhoto extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(AdminUserPhoto.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "AdminUserPhoto servlet - changes the user photo for a user\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - try - { // get the user to be modified - AdminOperations adm = user.getAdminInterface(); - String s_uid = request.getParameter("uid"); - if (s_uid==null) - throw new ErrorBox(null,"User ID parameter not found.","sysadmin?cmd=UF"); - AdminUserContext admuser = adm.getUserContext(Integer.parseInt(s_uid)); - - if (request.getParameter("null")!=null) - { // null the photo out and return - ContactInfo ci = admuser.getContactInfo(); - ci.setPhotoURL(null); - admuser.putContactInfo(ci); - throw new RedirectResult("sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end if - - return new AdminUserPhotoData(engine,admuser,rdat); - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to retrieve user information: " + de.getMessage(), - "sysadmin?cmd=UF"); - - } // end catch - catch (NumberFormatException nfe) - { // this is if we get a bogus UID - return new ErrorBox(null,"Invalid user ID parameter.","sysadmin?cmd=UF"); - - } // end catch - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - AdminUserContext admuser; - try - { // get the user to be modified - AdminOperations adm = user.getAdminInterface(); - String s_uid = mphandler.getValue("uid"); - if (s_uid==null) - throw new ErrorBox(null,"User ID parameter not found.","sysadmin?cmd=UF"); - admuser = adm.getUserContext(Integer.parseInt(s_uid)); - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to retrieve user information: " + de.getMessage(), - "sysadmin?cmd=UF"); - - } // end catch - catch (NumberFormatException nfe) - { // this is if we get a bogus UID - return new ErrorBox(null,"Invalid user ID parameter.","sysadmin?cmd=UF"); - - } // end catch - - if (isImageButtonClicked(mphandler,"cancel")) - throw new RedirectResult("sysadmin?cmd=UM&uid=" + admuser.getUID()); - - if (isImageButtonClicked(mphandler,"upload")) - { // uploading the image here! - // also check on file parameter status - if (!(mphandler.isFileParam("thepic"))) - { // bogus file parameter - logger.error("Internal Error: 'thepic' should be a file param"); - return new ErrorBox(null,"Internal Error: 'thepic' should be a file param", - "sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end if - - if (!(mphandler.getContentType("thepic").startsWith("image/"))) - { // must be an image type we uploaded! - logger.error("Error: 'thepic' not an image type"); - return new ErrorBox(null,"You did not upload an image file. Try again.", - "sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end if - - try - { // get the real picture (normalized to 100x100 size) - ImageLengthPair real_pic = ImageNormalizer.normalizeImage(mphandler.getFileContentStream("thepic"), - engine.getUserPhotoSize(),"jpeg"); - - // set the user photo data! - ContactInfo ci = admuser.getContactInfo(); - ci.setPhotoData(request.getContextPath() + "/imagedata/","image/jpeg",real_pic.getLength(), - real_pic.getData()); - admuser.putContactInfo(ci); - - // Jump back to the profile form. - throw new RedirectResult("sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end try - catch (ServletMultipartException smpe) - { // the servlet multipart parser screwed up - logger.error("Servlet multipart error:",smpe); - return new ErrorBox(null,"Internal Error: " + smpe.getMessage(), - "sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end catch - catch (ImageNormalizerException ine) - { // the image was not valid - logger.error("Image normalizer error:",ine); - return new ErrorBox(null,ine.getMessage(),"admuserphoto?uid=" + admuser.getUID()); - - } // end catch - catch (DataException de) - { // error in the database! - logger.error("DataException:",de); - return new ErrorBox("Database Error","Database error storing user photo: " + de.getMessage(), - "sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end catch - - } // end if - else - { // the button must be wrong! - logger.error("no known button click on AdminUserPhoto.doPost"); - return new ErrorBox("Internal Error","Unknown command button pressed", - "sysadmin?cmd=UM&uid=" + admuser.getUID()); - - } // end else - - } // end doVenicePost - -} // end class AdminUserPhoto diff --git a/src/com/silverwrist/venice/servlets/Attachment.java b/src/com/silverwrist/venice/servlets/Attachment.java deleted file mode 100644 index 26208f5..0000000 --- a/src/com/silverwrist/venice/servlets/Attachment.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class Attachment extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(Attachment.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "Attachment servlet - Handles uploading and downloading attachments\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - - // get the conference - ConferenceContext conf = getConferenceParameter(request,comm,true,"top"); - - // get the message we want to use - TopicMessageContext msg = getMessageParameter(request,conf,true,"top"); - - String type, filename; - int length; - InputStream data; - - try - { // retrieve the information about the attachment - type = msg.getAttachmentType(); - filename = msg.getAttachmentFilename(); - length = msg.getAttachmentLength(); - if (logger.isInfoEnabled()) - logger.info("Uploaded file: " + filename + "(type " + type + ", " + length + " bytes)"); - data = msg.getAttachmentData(); - - } // end try - catch (AccessError ae) - { // unable to access the data stream - return new ErrorBox("Access Error",ae.getMessage(),"top"); - - } // end catch - catch (DataException de) - { // error getting at the data stream from the attachment - return new ErrorBox("Database Error","Database error retrieving attachment: " + de.getMessage(),"top"); - - } // end catch - - // now we want to send that data back to the user! - throw new SendFileResult(type,filename,length,data); - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - logger.debug("Attachment.doVenicePost: entry"); - - // Get target URL for the operation - if (mphandler.isFileParam("target")) - { // bogus target URL - logger.error("Internal Error: 'target' should be a normal param"); - return new ErrorBox(null,"Internal Error: 'target' should be a normal param","top"); - - } // end if - - String target = mphandler.getValue("target"); - if (logger.isDebugEnabled()) - logger.debug("Target URL: " + target); - setMyLocation(request,target); - - // also check on file parameter status - if (!(mphandler.isFileParam("thefile"))) - { // bogus file parameter - logger.error("Internal Error: 'thefile' should be a file param"); - return new ErrorBox(null,"Internal Error: 'thefile' should be a file param",target); - - } // end if - - // get the community - CommunityContext comm = getCommunityParameter(mphandler,user,true,"top"); - if (logger.isDebugEnabled()) - logger.debug("community param: #" + comm.getCommunityID()); - changeMenuCommunity(request,comm); - - // get the conference - ConferenceContext conf = getConferenceParameter(mphandler,comm,true,"top"); - if (logger.isDebugEnabled()) - logger.debug("Conference param: #" + conf.getConfID()); - - // get the message we want to use - TopicMessageContext msg = getMessageParameter(mphandler,conf,true,"top"); - if (logger.isDebugEnabled()) - logger.debug("Message param: #" + msg.getPostID()); - - try - { // attach the data to the message! - msg.attachData(mphandler.getContentType("thefile"),mphandler.getValue("thefile"), - mphandler.getContentSize("thefile"),mphandler.getFileContentStream("thefile")); - - } // end try - catch (ServletMultipartException smpe) - { // error processing the file parameter data - logger.error("Servlet multipart error:",smpe); - return new ErrorBox(null,"Internal Error: " + smpe.getMessage(),target); - - } // end catch - catch (AccessError ae) - { // access error posting the attachment data - logger.error("Access error:",ae); - return new ErrorBox("Access Error",ae.getMessage(),target); - - } // end catch - catch (DataException de) - { // error storing the attachment in the database - logger.error("DataException:",de); - return new ErrorBox("Database Error","Database error storing attachment: " + de.getMessage(),target); - - } // end catch - - logger.debug("Attachment.doVenicePost: done!"); - throw new RedirectResult(target); // get back, get back, get back to where you once belonged - - } // end doVenicePost - -} // end class Attachment diff --git a/src/com/silverwrist/venice/servlets/CommunityAdmin.java b/src/com/silverwrist/venice/servlets/CommunityAdmin.java deleted file mode 100644 index ff82171..0000000 --- a/src/com/silverwrist/venice/servlets/CommunityAdmin.java +++ /dev/null @@ -1,649 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class CommunityAdmin extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String DELETE_CONFIRM_ATTR = "servlets.CommunityAdmin.delete.confirm"; - private static final String DELETE_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(CommunityAdmin.class); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private CommunityAdminTop makeCommunityAdminTop() throws ServletException - { - final String desired_name = "CommunityAdminTop"; - MenuPanelCache cache = MenuPanelCache.getMenuPanelCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - CommunityAdminTop template = new CommunityAdminTop(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (CommunityAdminTop)(cache.getNewMenuPanel(desired_name)); - - } // end makeCommunityAdminTop - - private EditCommunityProfileDialog makeEditCommunityProfileDialog(SecurityInfo sinf) throws ServletException - { - final String desired_name = "EditCommunityProfileDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - EditCommunityProfileDialog template = new EditCommunityProfileDialog(sinf); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (EditCommunityProfileDialog)(cache.getNewDialog(desired_name)); - - } // end makeEditCommunityProfileDialog - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "CommunityAdmin servlet - Administrative functions for communities\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - /* Command values for CommunityAdmin: - * A = Display Audit Records - * DEL = Delete Community - * F = Set Features/Services (not implemented yet) - * I = E-Mail to All Members - * M = Membership Control - * P = Edit Profile - * T = Set Category - */ - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community context - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - setMyLocation(request,"sigadmin?" + request.getQueryString()); - String on_error = "sigadmin?sig=" + comm.getCommunityID(); - - if (logger.isDebugEnabled()) - logger.debug("CommunityAdmin/doGet operating on community \"" + comm.getName() + "\" (" - + comm.getCommunityID() + ")"); - - // now decide what to do based on the "cmd" parameter - String cmd = getStandardCommandParam(request); - if (logger.isDebugEnabled()) - logger.debug("CommunityAdmin/doGet command value = " + cmd); - - if (cmd.equals("P")) - { // "P" = "Edit Profile" - if (!(comm.canModifyProfile())) - { // no access - sorry, dude - logger.error("tried to call up community profile screen without access...naughty naughty!"); - return new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", - on_error); - - } // end if - - // construct the edit profile dialog and load it up for use - EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog(comm.getSecurityInfo()); - - try - { // load the values for this dialog - dlg.setupDialog(engine,comm); - - } // end try - catch (DataException de) - { // we could not load the values because of a data exception - logger.error("DB error loading community profile: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error retrieving profile: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // we don't have enough privilege - logger.error("Access error loading community profile: " + ae.getMessage(),ae); - return new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", - on_error); - - } // end catch - - return dlg; // display me! - - } // end if ("P" command) - - if (cmd.equals("T")) - { // "T" = "Set Category" - if (!(comm.canModifyProfile())) - { // no access - sorry man - logger.error("tried to call up community category set screen without access...naughty naughty!"); - return new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", - on_error); - - } // end else - - // did they actually send a "set" parameter? - String p = request.getParameter("set"); - if (!(StringUtil.isStringEmpty(p))) - { // OK, we're setting the category ID... - try - { // get the new category ID and set it - int catid = Integer.parseInt(p); - if (!(engine.isValidCategoryID(catid))) - throw new NumberFormatException(); // dump the category if it's not valid - - // change the category ID - comm.setCategoryID(catid); - - } // end try - catch (NumberFormatException nfe) - { // we got an invalid category value... - return new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",on_error); - - } // end catch - catch (DataException de) - { // unable to update the community properly - logger.error("DB error updating community: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error updating community: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // database access error - display an error box - logger.error("Access error updating community: " + ae.getMessage(),ae); - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // now that it's set, go back to the admin menu - throw new RedirectResult(on_error); - - } // end if (setting category ID) - else - { // we're browsing - try and figure out what to display - try - { // get the "go" parameter to see what the current category ID is - p = request.getParameter("go"); - int curr_catid; - if (StringUtil.isStringEmpty(p)) - curr_catid = comm.getCategoryID(); - else - curr_catid = Integer.parseInt(p); - - if (!(engine.isValidCategoryID(curr_catid))) - throw new NumberFormatException(); // dump the category if it's not valid - - // create the browser panel and let it rip - return new CommunityCategoryBrowseData(user,comm,curr_catid); - - } // end try - catch (NumberFormatException nfe) - { // we got an invalid category value... - return new ErrorBox("Invalid Input","Invalid category ID passed to category browser.",on_error); - - } // end catch - catch (DataException de) - { // unable to get the categories properly - logger.error("DB error browsing categories: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error browsing categories: " + de.getMessage(), - on_error); - - } // end catch - - } // end else - - } // end if ("T" command) - - if (cmd.equals("M")) - { // "M" = Set Membership - if (!(comm.canModifyProfile())) - { // no access - sorry man - logger.error("tried to call up membership set screen without access...naughty naughty!"); - return new ErrorBox("Unauthorized","You do not have access to modify this community's membership.", - on_error); - - } // end else - - try - { // display the conference member list! - CommunityMembership m = new CommunityMembership(engine,comm); - m.doCommunityMemberList(); - setMyLocation(request,"sigadmin?sig=" + comm.getCommunityID() + "&cmd=M"); - return m; - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error listing community members: " + de.getMessage(), - on_error); - - } // end catch - - } // end if ("M" command) - - if (cmd.equals("A")) - { // "A" = "Display Audit Records" - try - { - int offset = 0; - try - { // convert the offset parameter - String s_ofs = request.getParameter("ofs"); - if (!StringUtil.isStringEmpty(s_ofs)) - offset = Integer.parseInt(s_ofs); - - } // end try - catch (NumberFormatException nfe) - { // if it's untranslatable, set it at 0 - offset = 0; - - } // end catch - - // generate the lists - List audit_list = comm.getAuditRecords(offset,engine.getNumAuditRecordsPerPage()); - int audit_count = comm.getAuditRecordCount(); - - // return the audit viewer - return new AuditDataViewer(engine,audit_list,offset,audit_count,"Audit Records for Community \"" - + comm.getName() + "\"","sigadmin?sig=" + comm.getCommunityID() - + "&cmd=A&ofs=%"); - - } // end try - catch (AccessError ae) - { // you don't have access - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error getting audit records: " + de.getMessage(), - on_error); - - } // end catch - - } // end if ("A" command) - - if (cmd.equals("I")) - { // "I" = "Send E-Mail To All Members" - if (!(comm.canMassMail())) - { // we can't send mass mail to the community, so what are we doing here? - logger.error("you can't mass-mail the community - not gonna do it, wouldn't be prudent"); - return new ErrorBox("Access Error","You do not have permission to sent mass mail to this community.", - on_error); - - } // end if - - return new CommunityEMail(comm); // return the view object - - } // end if ("I" command) - - if (cmd.equals("DEL")) - { // "DEL" = "Delete Community" (requires a confirmation) - if (!(comm.canDelete())) - { // we can't delete the community, so what are we doing here? - logger.error("you can't delete the community - not gonna do it, wouldn't be prudent"); - return new ErrorBox("Access Error","You do not have permission to delete this community.",on_error); - - } // end if - - if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM)) - { // we are confirmed - delete the community! - try - { // delete the community! - comm.delete(); - - } // end try - catch (DataException de) - { // something wrong in the database - logger.error("Database error deleting community: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error deleting community: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // access error changing the community values - logger.error("Access error deleting community: " + ae.getMessage(),ae); - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // the community is now GONE - there's noplace else to go but back to the Top page - throw new RedirectResult("top"); - - } // end if - else - { // throw up a confirm box to let the user think it over - String message = "You are about to permanently delete the \"" + comm.getName() + "\" community, " - + "including all conferences and other resources it contains! Are you sure you want " - + "to do this?"; - return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Conference",message, - on_error + "&cmd=DEL",on_error); - - } // end else - - } // end if ("DEL" command) - - // all unknown requests get turned into menu display requests - if (!(comm.canAdministerCommunity())) - { // no access - sorry buddy - logger.error("tried to call up community admin menu without access...naughty naughty!"); - return new ErrorBox("Access Error","You do not have access to administer this community.",on_error); - - } // end if - - // create a community administration menu - CommunityAdminTop menu = makeCommunityAdminTop(); - menu.setCommunity(comm); - return menu; - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community context - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String on_error = "sigadmin?sig=" + comm.getCommunityID(); - setMyLocation(request,on_error); - - if (logger.isDebugEnabled()) - logger.debug("CommunityAdmin/doPost operating on community \"" + comm.getName() + "\" (" - + comm.getCommunityID() + ")"); - - // now decide what to do based on the "cmd" parameter - String cmd = getStandardCommandParam(request); - if (logger.isDebugEnabled()) - logger.debug("CommunityAdmin/doPost command value = " + cmd); - - if (cmd.equals("P")) - { // "P" = "Edit Profile" - if (!(comm.canModifyProfile())) - { // no access - sorry, dude - logger.error("tried to call up community profile screen without access...naughty naughty!"); - return new ErrorBox("Unauthorized","You do not have access to modify this community's profile.", - on_error); - - } // end if - - // construct the edit profile dialog and load it up for use - EditCommunityProfileDialog dlg = makeEditCommunityProfileDialog(comm.getSecurityInfo()); - dlg.setupDialogBasic(engine,comm); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(on_error); // go back - they canceled out - - if (dlg.isButtonClicked(request,"update")) - { // begin updating the community's contents - dlg.loadValues(request); // do value loading now - - try - { // attempt to change the community profile now... - dlg.doDialog(comm); - - // now jump back to the main menu - clearMenu(request); - throw new RedirectResult(on_error); - - } // end try - catch (ValidationException ve) - { // simple validation exception - if (logger.isDebugEnabled()) - logger.debug("validation failure: " + ve.getMessage()); - dlg.resetOnError(comm,ve.getMessage() + " Please try again."); - - } // end catch - catch (DataException de) - { // database error updating the community values - logger.error("DB error updating community: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error updating community: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // access error changing the community values - logger.error("Access error updating community: " + ae.getMessage(),ae); - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - return dlg; - - } // end if ("update" pressed) - - // what the hell was that button? - logger.error("no known button click on CommunityAdmin.doPost, cmd=P"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("P" command) - - if (cmd.equals("M")) - { // "M" = Modify Community Membership - on_error += "&cmd=M"; - setMyLocation(request,on_error); - - if (!(comm.canModifyProfile())) - { // no access - sorry, dude - logger.error("tried to call up community membership screen without access...naughty naughty!"); - return new ErrorBox("Unauthorized","You do not have access to modify this community's membership.", - on_error); - - } // end if - - if (isImageButtonClicked(request,"update")) - { // the "update" command that changes all the security levels - HashMap org_vals = new HashMap(); - HashMap new_vals = new HashMap(); - try - { // retrieve all parameters and filter them for the levels - Enumeration p_names = request.getParameterNames(); - while (p_names.hasMoreElements()) - { // examine each parameter name in turn - String p_name = (String)(p_names.nextElement()); - if (p_name.startsWith("zxcur_")) - { // this is a current value (from a hidden field) - int uid = Integer.parseInt(p_name.substring(6)); - int level = Integer.parseInt(request.getParameter(p_name)); - org_vals.put(new Integer(uid),new Integer(level)); - - } // end if - else if (p_name.startsWith("zxnew_")) - { // this is a new value (from a dropdown list box) - int uid = Integer.parseInt(p_name.substring(6)); - int level = Integer.parseInt(request.getParameter(p_name)); - new_vals.put(new Integer(uid),new Integer(level)); - - } // end else if - - } // end while - - if (org_vals.size()!=new_vals.size()) - { // we read the wrong number of parameters - this is bad - logger.error("level parameters mismatch (" + org_vals.size() + " old, " + new_vals.size() - + " new)"); - return new ErrorBox(null,"Invalid parameters.",on_error); - - } // end if - - } // end try - catch (NumberFormatException nfe) - { // error converting the parameters - logger.error("got number format exception parsing a level parameter"); - return new ErrorBox(null,"Invalid parameter conversion.",on_error); - - } // end catch - - try - { // loop through the hashmaps and set the value - Iterator it = org_vals.keySet().iterator(); - while (it.hasNext()) - { // extract the UID, old level, and new level - Integer uid = (Integer)(it.next()); - Integer org_level = (Integer)(org_vals.get(uid)); - Integer new_level = (Integer)(new_vals.get(uid)); - if (new_level==null) - { // whoops - logger.error("new community level not found for uid " + uid.intValue()); - return new ErrorBox(null,"Invalid new level parameter.",on_error); - - } // end if - - int new_level_x = new_level.intValue(); - if (new_level_x==0) - new_level_x = -1; - - // call down to set the membership level - if (org_level.intValue()!=new_level_x) - { // we need to reset the community membership - if (logger.isDebugEnabled()) - logger.debug("resetting community member level for uid " + uid.intValue() + "(old = " - + org_level.intValue() + ", new = " + new_level_x + ")"); - comm.setMembership(uid.intValue(),new_level_x); - - } // end if - - } // end while - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - logger.error("AccessError on comm.setMembership: " + ae.getMessage(),ae); - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - logger.error("DataException on comm.setMembership: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error setting memberships: " + de.getMessage(), - on_error); - - } // end catch - - // trap back to the community membership display - throw new RedirectResult(on_error); - - } // end if ("update" clicked) - - if ( isImageButtonClicked(request,"search") || isImageButtonClicked(request,"previous") - || isImageButtonClicked(request,"next")) - { // create the new dialog box - CommunityMembership m = new CommunityMembership(engine,comm); - - try - { // perform the search! - m.doSearch(request); - - } // end try - catch (ValidationException ve) - { // validation error - throw it back to the user - return new ErrorBox(null,ve.getMessage() + " Please try again.",on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error searching for users: " + de.getMessage(), - on_error); - - } // end catch - - return m; - - } // end if (search function clicked) - - // we don't know what button was pressed - logger.error("no known button click on CommunityAdmin.doPost, cmd=M"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("M" command) - - if (cmd.equals("I")) - { // "I" - "Send E-Mail To Community" - if (!(comm.canMassMail())) - { // we can't send mass mail to the community, so what are we doing here? - logger.error("you can't mass-mail the community - not gonna do it, wouldn't be prudent"); - return new ErrorBox("Access Error","You do not have permission to sent mass mail to this community.", - on_error); - - } // end if - - try - { // attempt to do the mass mailing! - comm.massMail(request.getParameter("subj"),request.getParameter("pb")); - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error getting mailing list: " + de.getMessage(), - on_error); - - } // end catch - - throw new RedirectResult(on_error); // bounce back to the menu - - } // end if ("I" command) - - // on unknown command, redirect to the GET function - return doVeniceGet(request,engine,user,rdat); - - } // end doVenicePost - -} // end class CommunityAdmin diff --git a/src/com/silverwrist/venice/servlets/CommunityLogo.java b/src/com/silverwrist/venice/servlets/CommunityLogo.java deleted file mode 100644 index 3f0e48b..0000000 --- a/src/com/silverwrist/venice/servlets/CommunityLogo.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.util.image.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class CommunityLogo extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(CommunityLogo.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "CommunityLogo servlet - changes the community logo for a community\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // Get the community. - CommunityContext comm = getCommunityParameter(request,user,true,null); - changeMenuCommunity(request,comm); - if (!(comm.canModifyProfile())) - return new ErrorBox("Community Error","You are not permitted to modify this community's profile.",null); - - try - { // create the display - return new CommunityLogoData(engine,comm,rdat); - - } // end try - catch (DataException de) - { // error getting at the data stream from the attachment - return new ErrorBox("Database Error","Database error generating display: " + de.getMessage(), - "sigadmin?cmd=P&sig=" + comm.getCommunityID()); - - } // end catch - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // Get the community. - CommunityContext comm = getCommunityParameter(mphandler,user,true,null); - changeMenuCommunity(request,comm); - String target = "sigadmin?cmd=P&sig=" + comm.getCommunityID(); - if (!(comm.canModifyProfile())) - return new ErrorBox("Community Error","You are not permitted to modify this community's profile.", - target); - - if (isImageButtonClicked(mphandler,"cancel")) - throw new RedirectResult(target); - - if (isImageButtonClicked(mphandler,"upload")) - { // uploading the image here! - // also check on file parameter status - if (!(mphandler.isFileParam("thepic"))) - { // bogus file parameter - logger.error("Internal Error: 'thepic' should be a file param"); - return new ErrorBox(null,"Internal Error: 'thepic' should be a file param",target); - - } // end if - - if (!(mphandler.getContentType("thepic").startsWith("image/"))) - { // must be an image type we uploaded! - logger.error("Error: 'thepic' not an image type"); - return new ErrorBox(null,"You did not upload an image file. Try again.", - "commlogo?sig=" + comm.getCommunityID()); - - } // end if - - try - { // get the real picture (normalized to 110x65 size) - ImageLengthPair real_pic = ImageNormalizer.normalizeImage(mphandler.getFileContentStream("thepic"), - engine.getCommunityLogoSize(),"jpeg"); - - // set the community logo data! - ContactInfo ci = comm.getContactInfo(); - ci.setPhotoData(request.getContextPath() + "/imagedata/","image/jpeg",real_pic.getLength(), - real_pic.getData()); - comm.putContactInfo(ci); - - // Jump back to the profile form. - clearMenu(request); // allow the menu to be redisplayed - throw new RedirectResult(target); - - } // end try - catch (ServletMultipartException smpe) - { // the servlet multipart parser screwed up - logger.error("Servlet multipart error:",smpe); - return new ErrorBox(null,"Internal Error: " + smpe.getMessage(),target); - - } // end catch - catch (ImageNormalizerException ine) - { // the image was not valid - logger.error("Image normalizer error:",ine); - return new ErrorBox(null,ine.getMessage(),"commlogo?sig=" + comm.getCommunityID()); - - } // end catch - catch (DataException de) - { // error in the database! - logger.error("DataException:",de); - return new ErrorBox("Database Error","Database error storing community logo: " + de.getMessage(), - target); - - } // end catch - catch (AccessError ae) - { // email exception (WTF?) - logger.error("Access error:",ae); - return new ErrorBox(null,"Access error: " + ae.getMessage(),target); - - } // end catch - - } // end if - else - { // the button must be wrong! - logger.error("no known button click on CommunityLogo.doPost"); - return new ErrorBox("Internal Error","Unknown command button pressed",target); - - } // end else - - } // end doVenicePost - -} // end class CommunityLogo diff --git a/src/com/silverwrist/venice/servlets/CommunityOperations.java b/src/com/silverwrist/venice/servlets/CommunityOperations.java deleted file mode 100644 index 13c3077..0000000 --- a/src/com/silverwrist/venice/servlets/CommunityOperations.java +++ /dev/null @@ -1,476 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class CommunityOperations extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String UNJOIN_CONFIRM_ATTR = "servlets.CommunityOperations.unjoin.confirm"; - private static final String UNJOIN_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(CommunityOperations.class); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private JoinKeyDialog makeJoinKeyDialog() - { - final String desired_name = "JoinKeyDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - JoinKeyDialog template = new JoinKeyDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (JoinKeyDialog)(cache.getNewDialog(desired_name)); - - } // end makeJoinKeyDialog - - private CreateCommunityDialog makeCreateCommunityDialog() throws ServletException - { - final String desired_name = "CreateCommunityDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - CreateCommunityDialog template = new CreateCommunityDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (CreateCommunityDialog)(cache.getNewDialog(desired_name)); - - } // end makeCreateCommunityDialog - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "CommunityOperations servlet - General community operations (join, unjoin, etc.)\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the command we want to use - String cmd = getStandardCommandParam(request); - setMyLocation(request,"sigops?" + request.getQueryString()); - - if (cmd.equals("J")) - { // "J" = "Join" (requires community parameter) - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - - if (!(comm.canJoin())) // not permitted to join! - return new ErrorBox("Community Error","You are not permitted to join this community.","top"); - - if (comm.isPublicCommunity()) - { // attempt to join right now! (no join key required) - try - { // call down to join the community - comm.join(null); - - // success! display the "welcome" page - clearMenu(request); // force the clear to regen the menus - changeMenuCommunity(request,comm); - return new CommunityWelcome(comm); - - } // end try - catch (AccessError ae) - { // access error - return new ErrorBox("Access Error","Unable to join community: " + ae.getMessage(),"top"); - - } // end catch - catch (DataException de) - { // data exception doing something - return new ErrorBox("Database Error","Database error joining community: " + de.getMessage(),"top"); - - } // end catch - - } // end if (public community) - else - { // we need to prompt them for the join key.... - JoinKeyDialog dlg = makeJoinKeyDialog(); - dlg.setupDialog(comm); - changeMenuCommunity(request,comm); - return dlg; - - } // end else (private community) - - } // end if ("J" command) - - if (cmd.equals("U")) - { // "U" = "Unjoin (requires community parameter) - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - - if (!(comm.canUnjoin())) - return new ErrorBox("Community Error","You cannot unjoin this community.","top"); - - // OK, let's test for a confirmation... - if (ConfirmBox.isConfirmed(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM)) - { // OK, if you say so, let's unjoin! - try - { // do the unjoin now... - comm.unjoin(); - - } // end try - catch (AccessError ae) - { // access error - return new ErrorBox("Access Error","Unable to unjoin community: " + ae.getMessage(),"top"); - - } // end catch - catch (DataException de) - { // data exception doing something - return new ErrorBox("Database Error","Database error unjoining community: " + de.getMessage(),"top"); - - } // end catch - - // after which, redirect back to the top - clearMenu(request); - throw new RedirectResult("top"); - - } // end if - else - { // not a proper confirmation - display the confirm box - String message = "Are you sure you want to unjoin the '" + comm.getName() + "' community?"; - return new ConfirmBox(request,UNJOIN_CONFIRM_ATTR,UNJOIN_CONFIRM_PARAM,"Unjoining community", - message,"sigops?cmd=U&sig=" + comm.getCommunityID(),"sig/" + comm.getAlias()); - - } // end else - - } // end if ("U" command) - - if (cmd.equals("C")) - { // "C" - Create community (no parameters) - if (!(user.canCreateCommunity())) - return new ErrorBox("Community Error","You are not permitted to create communities.","top"); - - // present the "Create New Community" dialog - CreateCommunityDialog dlg = makeCreateCommunityDialog(); - dlg.setupDialog(engine); - dlg.setFieldValue("language","en-US"); - dlg.setFieldValue("country","US"); - changeMenuTop(request); - return dlg; - - } // end if ("C" command) - - if (cmd.equals("I")) - { // "I" - Send Invitation (requires community parameter) - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - - if (!(comm.canSendInvitation())) - return new ErrorBox("Community Error","You are not permitted to send an invitation.", - "sig/" + comm.getAlias()); - - // get conference and topic parameters - ConferenceContext conf = getConferenceParameter(request,comm,false,"sig/" + comm.getAlias()); - TopicContext topic = null; - if (conf!=null) - topic = getTopicParameter(request,conf,false, - "confops?cmd=Q&sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID()); - - // present the "Invitation" dialog - return new Invitation(comm,conf,topic); - - } // end if ("I" command) - - if (cmd.equals("M")) - { // "M" = List Members - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - if (logger.isDebugEnabled()) - logger.debug("Member list for community: " + comm.getName()); - - try - { // return the view dialog - ViewCommunityMembers view = new ViewCommunityMembers(engine,comm); - view.doInitialList(); - changeMenuCommunity(request,comm); - return view; - - } // end try - catch (DataException de) - { // unable to get community members list - return new ErrorBox("Database Error","Database error getting community members list: " - + de.getMessage(),"top"); - - } // end catch - - } // end if ("M" command) - - // this is an error! - logger.error("invalid command to CommunityOperations.doGet: " + cmd); - return new ErrorBox("Internal Error","Invalid command to CommunityOperations.doGet","top"); - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the command we want to use - String cmd = getStandardCommandParam(request); - setMyLocation(request,"sigops?cmd=" + cmd); - - if (cmd.equals("J")) - { // "J" = Join Community (requires community parameter) - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - setMyLocation(request,"sigops?cmd=J&sig=" + comm.getCommunityID()); - JoinKeyDialog dlg = makeJoinKeyDialog(); - - if (dlg.isButtonClicked(request,"cancel")) // cancel - go back to community opening page - throw new RedirectResult("sig/" + comm.getAlias()); - - if (!(comm.canJoin())) // not permitted to join! - return new ErrorBox("Community Error","You are not permitted to join this community.","top"); - - if (dlg.isButtonClicked(request,"join")) - { // OK, go join the community - dlg.loadValues(request); // load the dialog - - try - { // attempt to join the community! - dlg.doDialog(comm); - - // success! display the "welcome" page - clearMenu(request); // force the clear to regen the menus - changeMenuCommunity(request,comm); - return new CommunityWelcome(comm); - - } // end try - catch (ValidationException ve) - { // here, a validation exception causes us to recycle and retry - dlg.resetOnError(ve.getMessage() + " Please try again."); - changeMenuCommunity(request,comm); - - } // end catch - catch (AccessError ae) - { // this is probably a bogus key - let them retry - dlg.resetOnError(ae.getMessage() + " Please try again."); - changeMenuCommunity(request,comm); - - } // end catch - catch (DataException de) - { // database error joining something - return new ErrorBox("Database Error","Database error joining community: " + de.getMessage(),"top"); - - } // end catch - - return dlg; // recycle and try aagin - - } // end if ("join" clicked) - - // error - don't know what button was clicked - logger.error("no known button click on CommunityOperations.doPost, cmd=J"); - return new ErrorBox("Internal Error","Unknown command button pressed","top"); - - } // end if ("J" command) - - if (cmd.equals("C")) - { // "C" = Create New Community - if (!(user.canCreateCommunity())) - { // EJB 11/25/2001 - give a different error message if they're not logged in - if (user.isLoggedIn()) - return new ErrorBox("Community Error","You are not permitted to create communities.","top"); - else - return new LogInOrCreate("sigops?cmd=C"); - - } // end if - - // load the "Create Communities" dialog - CreateCommunityDialog dlg = makeCreateCommunityDialog(); - dlg.setupDialog(engine); - - if (dlg.isButtonClicked(request,"cancel")) // cancel - go back to top - throw new RedirectResult("top"); - - if (dlg.isButtonClicked(request,"create")) - { // OK, they actually want to create the new community... - dlg.loadValues(request); // load the form data - - try - { // attempt to create the community! - CommunityContext comm = dlg.doDialog(user); - - // created successfully - display a "new community welcome" page - changeMenuCommunity(request,comm); // display menus for the first time! - return new NewCommunityWelcome(comm); - - } // end try - catch (ValidationException ve) - { // here, a validation exception causes us to recycle and retry - dlg.resetOnError(ve.getMessage() + " Please try again."); - changeMenuTop(request); - - } // end catch - catch (AccessError ae) - { // this is probably a bogus key - let them retry - dlg.resetOnError(ae.getMessage() + " Please try again."); - changeMenuTop(request); - - } // end catch - catch (DataException de) - { // database error doing something - return new ErrorBox("Database Error","Database error creating community: " + de.getMessage(),"top"); - - } // end catch - - return dlg; // put the dialog back up - - } // end if ("create" pressed) - - // error - don't know what button was clicked - logger.error("no known button click on CommunityOperations.doPost, cmd=C"); - return new ErrorBox("Internal Error","Unknown command button pressed","top"); - - } // end if ("C" command) - - if (cmd.equals("I")) - { // "I" = Send invitation (requires community parameter) - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - setMyLocation(request,"sigops?cmd=I&sig=" + comm.getCommunityID()); - String on_error = "sig/" + comm.getAlias(); - - // get conference and topic parameters - ConferenceContext conf = getConferenceParameter(request,comm,false,on_error); - if (conf!=null) - on_error = "confops?cmd=Q&sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - TopicContext topic = null; - if (conf!=null) - { // try and get a topic parameter - topic = getTopicParameter(request,conf,false,on_error); - if (topic!=null) - on_error = "topicops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" - + topic.getTopicNumber(); - - } // end if - - if (isImageButtonClicked(request,"cancel")) // cancel - go back to community opening page - throw new RedirectResult(on_error); - - if (isImageButtonClicked(request,"send")) - { // the "send" button was pressed - try - { // send out the invitation - if (topic!=null) - topic.sendInvitation(request.getParameter("addr"),request.getParameter("pb")); - else if (conf!=null) - conf.sendInvitation(request.getParameter("addr"),request.getParameter("pb")); - else - comm.sendInvitation(request.getParameter("addr"),request.getParameter("pb")); - - } // end try - catch (AccessError ae) - { // access error - display error box - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error doing something - return new ErrorBox("Database Error","Database error sending invitation: " + de.getMessage(), - on_error); - - } // end catch - catch (EmailException ee) - { // error sending the email message - return new ErrorBox("E-Mail Error","Error sending e-mail: " + ee.getMessage(),on_error); - - } // end catch - - // all sent - go back to community profile display - throw new RedirectResult(on_error); - - } // end if ("send" pressed) - - // error - don't know what button was clicked - logger.error("no known button click on CommunityOperations.doPost, cmd=I"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("I" command) - - if (cmd.equals("M")) - { // "M" = Display Members List - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - setMyLocation(request,"sigops?cmd=M&sig=" + comm.getCommunityID()); - String on_error = "sig/" + comm.getAlias(); - if (logger.isDebugEnabled()) - logger.debug("Member list for community: " + comm.getName()); - - try - { // generate the members list - ViewCommunityMembers view = new ViewCommunityMembers(engine,comm); - view.doSearch(request); - changeMenuCommunity(request,comm); - return view; - - } // end try - catch (ValidationException ve) - { // validation error - throw it back to the user - return new ErrorBox(null,ve.getMessage() + " Please try again.", - "sigops?cmd=M&sig=" + comm.getCommunityID()); - - } // end catch - catch (DataException de) - { // unable to get community members list - return new ErrorBox("Database Error","Database error getting community members list: " - + de.getMessage(),on_error); - - } // end catch - - } // end if ("M" command) - - // this is an error! - logger.error("invalid command to CommunityOperations.doPost: " + cmd); - return new ErrorBox("Internal Error","Invalid command to CommunityOperations.doPost","top"); - - } // end doVenicePost - -} // end class CommunityOperations - - - diff --git a/src/com/silverwrist/venice/servlets/ConfDisplay.java b/src/com/silverwrist/venice/servlets/ConfDisplay.java deleted file mode 100644 index 6e17250..0000000 --- a/src/com/silverwrist/venice/servlets/ConfDisplay.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class ConfDisplay extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Internal class used to get post number defaults - *-------------------------------------------------------------------------------- - */ - - static class PostInterval - { - private int first; - private int last; - - public PostInterval(int f, int l) - { - if (f<=l) - { // the sort is good - first = f; - last = l; - - } // end if - else - { // reverse the order - first = l; - last = f; - - } // end else - - } // end constructor - - public int getFirst() - { - return first; - - } // end getFirst - - public int getLast() - { - return last; - - } // end getLast - - } // end class PostInterval - - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(ConfDisplay.class); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static void getViewSortDefaults(ServletRequest request, int confid, TopicSortHolder tsc, - String on_error) throws ErrorBox - { - String str = request.getParameter("view"); - if (!(StringUtil.isStringEmpty(str))) - { // we need to change the view parameter - try - { // convert the parameter to an integer and then check it against defined values - int p = Integer.parseInt(str); - switch (p) - { - case ConferenceContext.DISPLAY_NEW: - case ConferenceContext.DISPLAY_ACTIVE: - case ConferenceContext.DISPLAY_ALL: - case ConferenceContext.DISPLAY_HIDDEN: - case ConferenceContext.DISPLAY_ARCHIVED: - tsc.setViewOption(confid,p); - break; - - default: - throw new ErrorBox(null,"Invalid view parameter.",on_error); - - } // end switch - - } // end try - catch (NumberFormatException nfe) - { // failure in parseInt - logger.error("Cannot convert view parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid view parameter.",on_error); - - } // end catch - - } // end if - - str = request.getParameter("sort"); - if (!(StringUtil.isStringEmpty(str))) - { // we need to change the sort parameter - try - { // convert the parameter to an integer and then check it against defined values - int p = Integer.parseInt(str); - int real_p = ((p<0) ? -p : p); - switch (real_p) - { - case ConferenceContext.SORT_NUMBER: - case ConferenceContext.SORT_NAME: - case ConferenceContext.SORT_UNREAD: - case ConferenceContext.SORT_TOTAL: - case ConferenceContext.SORT_DATE: - tsc.setSortOption(confid,p); - break; - - default: - throw new ErrorBox(null,"Invalid sort parameter.",on_error); - - } // end switch - - } // end try - catch (NumberFormatException nfe) - { // failure in parseInt - logger.error("Cannot convert sort parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid sort parameter.",on_error); - - } // end catch - - } // end if - - } // end getViewSortDefaults - - private static PostInterval getInterval(VeniceEngine engine, ServletRequest request, TopicContext topic, - String on_error) throws ErrorBox - { - int first, last; - - String foo = request.getParameter("pxg"); - if (!(StringUtil.isStringEmpty(foo))) - { // we have a Go box parameter - try and decode it - try - { // look for a range specifier - int p = foo.indexOf('-'); - if (p<0) - { // single post number - try and use it - first = Integer.parseInt(foo); - last = first; - - } // end if - else if (p==0) - { // "-number" - works like "0-number" - last = Integer.parseInt(foo.substring(1)); - first = 0; - - } // end if - else if (p==(foo.length()-1)) - { // "number-" - works like "number-end" - first = Integer.parseInt(foo.substring(0,p)); - last = topic.getTotalMessages() - 1; - - } // end else if - else - { // two numbers to decode - first = Integer.parseInt(foo.substring(0,p)); - last = Integer.parseInt(foo.substring(p+1)); - - } // end else - - return new PostInterval(first,last); - - } // end try - catch (NumberFormatException nfe) - { // if numeric conversion fails, just fall out and try to redisplay the other way - } // end catch - - } // end if - - foo = request.getParameter("p1"); - if (StringUtil.isStringEmpty(foo)) - { // no range specified - cook up a default one - last = topic.getTotalMessages(); - int ur = topic.getUnreadMessages(); - if ((ur==0) || (ur>=engine.getNumPostsPerPage())) - first = last - engine.getNumPostsPerPage(); - else - first = last - (ur + engine.getNumOldPostsBeforeNew()); - last--; - - } // end if - else - { // we have at least one parameter... - try - { // convert it to an integer and range-limit it - first = Integer.parseInt(foo); - if (first<0) - first = 0; - else if (first>=topic.getTotalMessages()) - first = topic.getTotalMessages() - 1; - - } // end try - catch (NumberFormatException nfe) - { // we could not translate the parameter to a number - throw new ErrorBox(null,"Message parameter is invalid.",on_error); - - } // end catch - - foo = request.getParameter("p2"); - if (StringUtil.isStringEmpty(foo)) - last = first; // just specify ONE post... - else - { // OK, we have an actual "last message" parameter... - try - { // convert it to an integer and range-limit it - last = Integer.parseInt(foo); - if ((last<0) || (last>=topic.getTotalMessages())) - last = topic.getTotalMessages() - 1; - - } // end try - catch (NumberFormatException nfe) - { // we could not translate the parameter to a number - throw new ErrorBox(null,"Message parameter is invalid.",on_error); - - } // end catch - - } // end else - - } // end else - - return new PostInterval(first,last); - - } // end getInterval - - private static boolean restorePosts(ServletRequest request, ConferenceContext conf, TopicContext curr_topic) - { - String xtopic = request.getParameter("rtop"); - if (StringUtil.isStringEmpty(xtopic)) - return true; - String xcount = request.getParameter("rct"); - if (StringUtil.isStringEmpty(xcount)) - return true; - - TopicContext topic; - try - { // get the topic corresponding to the first parameter - topic = conf.getTopic(Short.parseShort(xtopic)); - - } // end try - catch (NumberFormatException nfe) - { // the topic number was invalid - forget it - logger.warn("restorePosts: error translating topic number"); - return true; - - } // end catch - catch (DataException de) - { // could not get the topic... - logger.warn("restorePosts: DataException getting topic - " + de.getMessage(),de); - return true; - - } // end catch - catch (AccessError ae) - { // no access to the topic - logger.warn("restorePosts: AccessError getting topic - " + ae.getMessage(),ae); - return true; - - } // end catch - - int nunread; - try - { // translate the number of unread posts to set - nunread = Integer.parseInt(xcount); - if ((nunread<=0) || (nunread>topic.getTotalMessages())) - { // must be in the range [1, #messages]... - logger.warn("restorePosts: unread post count out of range"); - return true; - - } // end if - - } // end try - catch (NumberFormatException nfe) - { // the number of unread posts was invalid - forget it - logger.warn("restorePosts: error translating unread post count"); - return true; - - } // end catch - - try - { // now try to set the unread messages - topic.setUnreadMessages(nunread); - - } // end try - catch (DataException de) - { // could not get the topic... - logger.warn("restorePosts: DataException setting unread messages - " + de.getMessage(),de); - - } // end catch - - return (topic.getTopicID()!=curr_topic.getTopicID()); - - } // end restorePosts - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "ConfDisplay servlet - Display of conference topic and message lists\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - - // get the conference - ConferenceContext conf = getConferenceParameter(request,comm,true,"top"); - - // get the topic, if we have it - TopicContext topic = getTopicParameter(request,user,conf,false,"top", - "confdisp?" + request.getQueryString()); - - if (topic!=null) - { // we're handling messages within a single topic - if (logger.isDebugEnabled()) - logger.debug("MODE: display messages in topic"); - String on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - setMyLocation(request,on_error + "&top=" + topic.getTopicNumber()); - - // if this request is restoring the number of unread posts in another topic, try to do so - boolean do_readnew = restorePosts(request,conf,topic); - - // determine what the post interval is we want to display - PostInterval piv = getInterval(engine,request,topic,on_error); - boolean read_new = do_readnew && !(StringUtil.isStringEmpty(request.getParameter("rnm"))); - boolean show_adv = !(StringUtil.isStringEmpty(request.getParameter("shac"))); - boolean no_bozos = !(StringUtil.isStringEmpty(request.getParameter("nbz"))); - - // Create the post display. - try - { // create the display - return new TopicPosts(request,engine,user,comm,conf,topic,piv.getFirst(),piv.getLast(),read_new, - show_adv,no_bozos); - - } // end try - catch (DataException de) - { // there was a database error retrieving messages - return new ErrorBox("Database Error","Database error listing messages: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // we were unable to retrieve the message list - if (user.isLoggedIn()) - return new ErrorBox("Access Error",ae.getMessage(),on_error); - else - return new LogInOrCreate(getMyLocation(request)); - - } // end catch - - } // end if (messages in a topic) - else - { // we're displaying the conference's topic list - if (logger.isDebugEnabled()) - logger.debug("MODE: display topics in conference"); - String on_error = "confops?sig=" + comm.getCommunityID(); - String my_location = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - boolean read_new = !(StringUtil.isStringEmpty(request.getParameter("rnm"))); - if (read_new) - my_location += "&rnm=1"; - setMyLocation(request,my_location); - - // get any changes to view or sort options - TopicSortHolder opts = TopicSortHolder.retrieve(request.getSession(true)); - getViewSortDefaults(request,conf.getConfID(),opts,on_error); - - if (read_new) - { // we need to generate a TopicPosts view - try - { // generate a topic list first - List topic_list = conf.getTopicList(opts.getViewOption(conf.getConfID()), - opts.getSortOption(conf.getConfID())); - - // now generate the topic visit order - TopicVisitOrder ord = TopicVisitOrder.initialize(request.getSession(true),conf.getConfID(), - topic_list); - - // use the new visit order to get the topic we need to visit - short topic_nbr = ord.getNext(); - Iterator it = topic_list.iterator(); - while (it.hasNext()) - { // locate the first topic to be read - topic = (TopicContext)(it.next()); - if (topic.getTopicNumber()==topic_nbr) - break; - - } // end while - - if (topic==null) // no suitable topic found - just create the topic listing - return new TopicListing(request,comm,conf,opts.getViewOption(conf.getConfID()), - opts.getSortOption(conf.getConfID())); - - // determine what the post interval is we want to display - PostInterval piv = getInterval(engine,request,topic,on_error); - - // create the topic posts view - return new TopicPosts(request,engine,user,comm,conf,topic,piv.getFirst(),piv.getLast(),true, - false,false); - - } // end try - catch (DataException de) - { // there was a database error retrieving messages - return new ErrorBox("Database Error","Database error listing messages: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // we were unable to retrieve the message list - if (user.isLoggedIn()) - return new ErrorBox("Access Error",ae.getMessage(),on_error); - else - return new LogInOrCreate(getMyLocation(request)); - - } // end catch - - } // end if (creating a "read new" topic list view) - else - { // topic listing only... - TopicListing tl = null; - try - { // create the topic list - tl = new TopicListing(request,comm,conf,opts.getViewOption(conf.getConfID()), - opts.getSortOption(conf.getConfID())); - - } // end try - catch (DataException de) - { // there was a database error retrieving topics - return new ErrorBox("Database Error","Database error listing topics: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // we were unable to retrieve the topic list - if (user.isLoggedIn()) - return new ErrorBox("Access Error",ae.getMessage(),on_error); - else - return new LogInOrCreate(getMyLocation(request)); - - } // end catch - - return tl; - - } // end else (not reading new messages, but just displaying topics) - - } // end else (topics in a conference) - - } // end doVeniceGet - -} // end class ConfDisplay diff --git a/src/com/silverwrist/venice/servlets/ConfOperations.java b/src/com/silverwrist/venice/servlets/ConfOperations.java deleted file mode 100644 index 4a12109..0000000 --- a/src/com/silverwrist/venice/servlets/ConfOperations.java +++ /dev/null @@ -1,1260 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; -import com.silverwrist.venice.util.IDUtils; - -public class ConfOperations extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String DELETE_CONFIRM_ATTR = "servlets.ConfOperations.delete.confirm"; - private static final String DELETE_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(ConfOperations.class.getName()); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private CreateConferenceDialog makeCreateConferenceDialog() throws ServletException - { - final String desired_name = "CreateConferenceDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - CreateConferenceDialog template = new CreateConferenceDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (CreateConferenceDialog)(cache.getNewDialog(desired_name)); - - } // end makeCreateConferenceDialog - - private EditConferenceDialog makeEditConferenceDialog(SecurityInfo sinf) throws ServletException - { - final String desired_name = "EditConferenceDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - EditConferenceDialog template = new EditConferenceDialog(sinf); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (EditConferenceDialog)(cache.getNewDialog(desired_name)); - - } // end makeEditConferenceDialog - - private static boolean validateNewTopic(ServletRequest request, String on_error) throws ErrorBox - { - //boolean is_title_null, is_zp_null; - - String foo = request.getParameter("title"); - if (foo==null) - throw new ErrorBox(null,"Title parameter was not specified.",on_error); - //is_title_null = (foo.length()==0); - - foo = request.getParameter("pseud"); - if (foo==null) - throw new ErrorBox(null,"Pseud parameter was not specified.",on_error); - - foo = request.getParameter("pb"); - if (foo==null) - throw new ErrorBox(null,"Body text was not specified.",on_error); - //is_zp_null = (foo.length()==0); - - /* EJB 4/5/2001 - remove this for consistency. FUTURE: bring it back under a global option? - return is_title_null || is_zp_null; - -- end removed code */ - - return false; - - } // end validateNewTopic - - private static boolean getFlag(ServletRequest request, String param, String on_error) throws ErrorBox - { - String foo = request.getParameter(param); - if (foo==null) - throw new ErrorBox(null,"Parameter not specified!",on_error); - - int value; - try - { // try to get a numeric value - value = Integer.parseInt(foo); - - } // end try - catch (NumberFormatException nfe) - { // unable to decode value - throw new ErrorBox(null,"Invalid parameter value!",on_error); - - } // end catch - - if (value==0) - return false; - else if (value==1) - return true; - else - throw new ErrorBox(null,"Invalid parameter value!",on_error); - - } // end getFlag - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "ConfOperations servlet - General conference operations (list, create, etc.)\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - /* - * ConfOperations commands: - * A = Manage Conference Aliases (requires conference parameter) - * C = Create conference - * DEL = Delete conference (requires conference parameter) - * E = Edit Conference Settings (requires conference parameter) - * FX = Fixseen (requires conference parameter) - * H = Add Conference to Hotlist (requires conference parameter) - * I = Conference E-Mail (requires conference parameter) - * M = Manage Conference Membership (requires conference parameter) - * Q = Display Conference Manage menu (requires conference parameter) - * RP = Report on Posters (requires conference parameter) - * RR = Report on Readers (requires conference parameter) - * S = Manage conference ordering/sequence - * SDEL = Delete conference from sequence manager menu - * SH = Hide/show conference from sequence manager menu - * SS = Change conference sequence from sequence manager menu - * T = Create topic (requires conference parameter) - * U = Customize Conference Display (requires conference parameter) - * UX = Remove all custom blocks (requires conference parameter) - * Other = Display list of conferences in community - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String on_error = "confops?sig=" + comm.getCommunityID(); - - // get the command we want to use - String cmd = getStandardCommandParam(request); - - if (cmd.equals("S")) - { // "S" = Manage conferences sequence - if (!(comm.canManageConferences())) - return new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", - on_error); - - try - { // display the Conference Sequence screen - setMyLocation(request,"confops?cmd=S&sig=" + comm.getCommunityID()); - return new ConferenceSequence(comm); - - } // end try - catch (DataException de) - { // oops - database error here - return new ErrorBox("Database Error","Database error getting conference list: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - } // end if ("S" command) - - if (cmd.equals("SH")) - { // "SH" = Hide/show conference (requires conference parameter) - if (!(comm.canManageConferences())) - return new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", - on_error); - - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&cmd=S"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You do not have permission to modify this conference.",on_error); - - boolean new_flag = getFlag(request,"flag",on_error); - - try - { // go set the hide flag - conf.setHideList(new_flag); - - } // end try - catch (DataException de) - { // database error - display appropriate dialog - return new ErrorBox("Database Error","Database error setting hide flag: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - throw new RedirectResult(on_error); // trap back to the main display - - } // end if ("SH" command) - - if (cmd.equals("SS")) - { // "SS" = Change conference sequence (requires conference parameter) - if (!(comm.canManageConferences())) - return new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", - on_error); - - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&cmd=S"; - - // we need a second conference parameter to exchange with - ConferenceContext other_conf = getConferenceParameter(request.getParameter("oc"),comm,true,on_error); - - if (!(conf.canChangeConference()) || !(other_conf.canChangeConference())) - return new ErrorBox("Access Error","You do not have permission to modify this conference.",on_error); - - try - { // get the two sequences - short this_seq = conf.getSequence(); - short other_seq = other_conf.getSequence(); - - // now exchange them - conf.setSequence(other_seq); - boolean restore = true; - try - { // set the second conference sequence - other_conf.setSequence(this_seq); - restore = false; - - } // end try - finally - { // undo first set on error - if (restore) - conf.setSequence(this_seq); - - } // end finally - - } // end try - catch (DataException de) - { // database error - display appropriate dialog - return new ErrorBox("Database Error","Database error changing sequence: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - throw new RedirectResult(on_error); // trap back to the main display - - } // end if ("SS" command) - - if (cmd.equals("SDEL")) - { // "SDEL" = Delete conference (requires conference parameter) - if (!(comm.canManageConferences())) - return new ErrorBox("Access Error","You are not permitted to manage conferences in this community.", - on_error); - - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&cmd=S"; - - if (!(conf.canDeleteConference())) - return new ErrorBox("Access Error","You do not have permission to delete this conference.",on_error); - - if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM)) - { // we are confirmed - delete the conference! - try - { // tell it to go away - conf.delete(); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error deleting conference: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // that's it - trap back to the main display - throw new RedirectResult(on_error); - - } // end if - else - { // generate a confirmation box and wait for confirmation - String message = "You are about to permanently delete the \"" + conf.getName() + "\" conference! " - + "Are you sure you want to do this?"; - return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Conference",message, - "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=SDEL",on_error); - - } // end else - - } // end if ("SDEL" command) - - if (cmd.equals("C")) - { // "C" = "Create conference" - if (!(comm.canCreateConference())) - return new ErrorBox("Access Error","You are not permitted to create conferences in this community.", - on_error); - - // make the "create" dialog - CreateConferenceDialog dlg = makeCreateConferenceDialog(); - dlg.setupDialog(engine,comm); - setMyLocation(request,on_error + "&cmd=C"); - return dlg; - - } // end if ("C" command) - - if (cmd.equals("T")) - { // "T" = "Create topic" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - // Create the new topic form. - NewTopicForm ntf = new NewTopicForm(comm,conf); - ntf.setupNewRequest(); - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=T"); - return ntf; - - } // end if ("T" command) - - if (cmd.equals("Q")) - { // "Q" = display Manage menu (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - // display the "Manage Conference" display - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"); - return new ManageConference(comm,conf); - - } // end if ("Q" command) - - if (cmd.equals("FX")) - { // "FX" = the dreaded fixseen :-) - catches up the entire conference - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - try - { // do the fixseen operation - conf.fixSeen(); - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // some sort of error in the database - return new ErrorBox("Database Error","Database error catching up conference: " + de.getMessage(), - on_error); - - } // end catch - - return null; // null response here - - } // end if ("FX" command) - - if (cmd.equals("E")) - { // "E" = "Edit Conference Settings" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's settings.", - on_error); - - // create and return the Edit Conference dialog - EditConferenceDialog dlg = makeEditConferenceDialog(conf.getSecurityInfo()); - try - { // set up and return the dialog - dlg.setupDialog(comm,conf); - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=E"); - return dlg; - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error retrieving the conference information - return new ErrorBox("Database Error","Database error getting conference information: " - + de.getMessage(),on_error); - - } // end catch - - } // end if ("E" command) - - if (cmd.equals("A")) - { // "A" = "Manage Aliases" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's aliases.", - on_error); - - // process alias removal link - String remove = request.getParameter("rem"); - if (!(StringUtil.isStringEmpty(remove))) - { // do removal of an alias - try - { // go ahead and remove the alias! - conf.removeAlias(remove); - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error removing alias: " + de.getMessage(), - on_error); - - } // end catch - - } // end if (removing an alias) - - // display the "Manage Conference Aliases" display - try - { // generate the display box - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=A"); - return new ManageConferenceAliases(comm,conf); - - } // end try - catch (DataException de) - { // error generating the display box - return new ErrorBox("Database Error","Database error displaying aliases: " + de.getMessage(), - on_error); - - } // end catch - - } // end if ("A" command) - - if (cmd.equals("QR")) - { // "QR" = "Reports Menu" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - try - { // display the "Conference Reports" display - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=QR"); - return new ReportConferenceMenu(comm,conf); - - } // end try - catch (DataException de) - { // unable to get the data for the list - return new ErrorBox("Database Error","Database error getting topic list: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - } // end if ("QR" command) - - if (cmd.equals("RP") || cmd.equals("RR")) - { // "RP" = "Report Posters," "RR" = "Report Readers" (requires conference parameter, optional topic) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - TopicContext topic = getTopicParameter(request,conf,false,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=QR"; - - try - { // generate the listing on this page - String my_loc = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - if (topic!=null) - my_loc += ("&top=" + topic.getTopicNumber()); - setMyLocation(request,my_loc + "&cmd=" + cmd); - return new ConferenceActivity(comm,conf,topic,cmd.equals("RP")); - - } // end try - catch (DataException de) - { // unable to get the data for the list - return new ErrorBox("Database Error","Database error displaying conference users: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - } // end if ("RP" and "RR" commands) - - if (cmd.equals("M")) - { // "M" - Manage Conference Membership (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - try - { // display the conference member list! - ConferenceMembership m = new ConferenceMembership(engine,comm,conf); - m.doConferenceMemberList(); - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=M"); - return m; - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error listing conference members: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - } // end if ("M" command) - - if (cmd.equals("H")) - { // "H" = "Add Conference To Hotlist" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - try - { // add to the hotlist - conf.addToHotlist(); - - // and trap back to the conference display - throw new RedirectResult(on_error); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error adding to hotlist: " + de.getMessage(), - on_error); - - } // end catch - - } // end if ("H" command) - - if (cmd.equals("I")) - { // "I" = "Conference E-Mail" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - try - { // return the conference E-mail view - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=I"); - return new ConferenceEMail(comm,conf); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error getting topic list: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - } // end if ("I" command) - - if (cmd.equals("U")) - { // "U" = Customize Conference Displays (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's customizations.", - on_error); - - try - { // return the conference custom blocks view - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=U"); - return new ConferenceCustomBlocks(comm,conf); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error getting custom blocks: " + de.getMessage(), - on_error); - - } // end catch - - } // end if ("U" command) - - if (cmd.equals("UX")) - { // "UX" = Customize Conference Displays (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=U"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's customizations.", - on_error); - - try - { // zap the custom blocks - conf.removeCustomBlocks(); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error removing custom blocks: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // all done - bounce back to the menu - throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=Q"); - - } // end if ("UX" command) - - if (cmd.equals("DEL")) - { // "DEL" = "Delete Conference (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canDeleteConference())) - return new ErrorBox("Access Error","You do not have permission to delete this conference.",on_error); - - if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM)) - { // we are confirmed - delete the conference! - try - { // tell it to go away - conf.delete(); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error deleting conference: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // that's it - trap back to the main conference list - throw new RedirectResult("confops?sig=" + comm.getCommunityID()); - - } // end if - else - { // generate a confirmation box and wait for confirmation - String message = "You are about to permanently delete the \"" + conf.getName() + "\" conference! " - + "Are you sure you want to do this?"; - return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Conference",message, - "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=DEL",on_error); - - } // end else - - } // end if ("DEL" command) - - // Any unrecognized command shows us the conference list. - on_error = "sigprofile?sig=" + comm.getCommunityID(); - try - { // make a conference listing - setMyLocation(request,"confops?sig=" + comm.getCommunityID()); - return new ConferenceListing(comm); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error finding conferences: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - if (user.isLoggedIn()) - return new ErrorBox("Access Error",ae.getMessage(),on_error); - else - { // they might need to log in first - setMyLocation(request,"confops?sig=" + comm.getCommunityID()); - return new LogInOrCreate("confops?sig=" + comm.getCommunityID()); - - } // end else - - } // end catch - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String on_error = "confops?sig=" + comm.getCommunityID(); - - // get the command we want to use - String cmd = getStandardCommandParam(request); - - if (cmd.equals("C")) - { // "C" = "Create Conference" - if (!(comm.canCreateConference())) - return new ErrorBox("Access Error","You are not permitted to create conferences in this community.", - on_error); - - // load up the create conference dialog! - CreateConferenceDialog dlg = makeCreateConferenceDialog(); - dlg.setupDialog(engine,comm); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(on_error); // they chickened out - go back to the conference list - - if (dlg.isButtonClicked(request,"create")) - { // OK, they actually want to create the new conference... - dlg.loadValues(request); // load the form data - - try - { // attempt to create the conference! - ConferenceContext conf = dlg.doDialog(comm); - - // success! redirect to the conference's topic list - throw new RedirectResult("confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID()); - - } // end try - catch (ValidationException ve) - { // validation error - throw it back to the user - dlg.resetOnError(ve.getMessage() + " Please try again."); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error creating conference: " + de.getMessage(), - on_error); - - } // end catch - - setMyLocation(request,on_error + "&cmd=C"); - return dlg; // redisplay the dialog - - } // end if ("create" button clicked) - - // error - don't know what button was clicked - logger.error("no known button click on ConfOperations.doPost, cmd=C"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("C" command) - - if (cmd.equals("T")) - { // "T" command = Create New Topic (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - // determine what to do based on the button pressed - if (isImageButtonClicked(request,"cancel")) - throw new RedirectResult(on_error); // the user chickened out - go back to the conference display - - if (isImageButtonClicked(request,"preview")) - { // generate a preview and redisplay the form - NewTopicForm ntf = new NewTopicForm(comm,conf); - - try - { // generate a preview display - ntf.generatePreview(engine,conf,request); - - } // end try - catch (ValidationException ve) - { // something messed up in the preview generation - return new ErrorBox(null,ve.getMessage(),on_error); - - } // end catch - - /* EJB 4/5/2001 - code removed for consistency - FUTURE: bring it back controlled by - a global option? - if (ntf.isNullRequest()) - return null; // no title or text specified - "204 No Content" - -- end removed code */ - - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=T"); - return ntf; - - } // end if ("preview" clicked) - - if (isImageButtonClicked(request,"post")) - { // first validate that we've got all the parameters - if (validateNewTopic(request,on_error)) - return null; // this is a null request - send a null response - - try - { // add the new topic! - TopicContext topic = conf.addTopic(request.getParameter("title"),request.getParameter("pseud"), - request.getParameter("pb")); - - final String yes = "Y"; - if (yes.equals(request.getParameter("attach"))) - { // we need to upload an attachment for this post - setMyLocation(request,on_error); - return new AttachmentForm(comm,conf,topic.getMessage(0),on_error); - - } // end if - - } // end try - catch (DataException de) - { // display a database error - return new ErrorBox("Database Error","Database error adding topic: " + de.getMessage(),on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access problem - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // jump back to the form under normal circumstances - throw new RedirectResult(on_error); - - } // end if ("post" clicked) - - // we don't know what button was pressed - logger.error("no known button click on ConfOperations.doPost, cmd=T"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("T" command) - - if (cmd.equals("P")) - { // "P" = Set default pseud (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - try - { // go set the pseud! - String pseud = request.getParameter("pseud"); - if (pseud!=null) - conf.setDefaultPseud(pseud); - - } // end try - catch (DataException de) - { // oops - there was a problem! - return new ErrorBox("Database Error","Database error setting pseud: " + de.getMessage(),on_error); - - } // end catch - - return null; // don't change the view - - } // end if ("P" command) - - if (cmd.equals("E")) - { // "E" = "Edit Conference Settings" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's settings.", - on_error); - - // create the dialog class - EditConferenceDialog dlg = makeEditConferenceDialog(conf.getSecurityInfo()); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult(on_error); // they chickened out - go back to the conference list - - if (dlg.isButtonClicked(request,"update")) - { // they're changing the conference - do what you have to - dlg.loadValues(request); // load the form data - - try - { // run that baby! - dlg.doDialog(conf); - - // success - return back to where we started from - throw new RedirectResult(on_error); - - } // end try - catch (ValidationException ve) - { // validation error - throw it back to the user - dlg.resetOnError(comm,conf,ve.getMessage() + " Please try again."); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error updating conference: " + de.getMessage(), - on_error); - - } // end catch - - setMyLocation(request,"confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=E"); - return dlg; // redisplay the dialog - - } // end if - - } // end if ("E" command) - - if (cmd.equals("A")) - { // "A" = "Add Alias" (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's settings.", - on_error); - - String new_alias = request.getParameter("alias"); - if (StringUtil.isStringEmpty(new_alias)) - return null; // this is a no-op - - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=A"; - String error_message = null; - - if (IDUtils.isValidVeniceID(new_alias)) - { // the alias we have netered is perfectly valid... - try - { // go ahead and add the alias! - conf.addAlias(new_alias); - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error adding alias: " + de.getMessage(), - on_error); - - } // end catch - - } // end if - else // alias is not valid - error_message = "The alias you have entered is not a valid identifier. Please try again."; - - // redisplay the "Manage Conference Aliases" display - try - { // generate the display box - setMyLocation(request,on_error); - return new ManageConferenceAliases(comm,conf); - - } // end try - catch (DataException de) - { // error generating the display box - return new ErrorBox("Database Error","Database error displaying aliases: " + de.getMessage(), - "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=Q"); - - } // end catch - - } // end if ("A" command) - - if (cmd.equals("M")) - { // "M" - Manage Conference Membership (requires conference parameter) - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=M"; - - if (isImageButtonClicked(request,"update")) - { // the "update" command that changes all the security levels - HashMap org_vals = new HashMap(); - HashMap new_vals = new HashMap(); - try - { // retrieve all parameters and filter them for the levels - Enumeration p_names = request.getParameterNames(); - while (p_names.hasMoreElements()) - { // examine each parameter name in turn - String p_name = (String)(p_names.nextElement()); - if (p_name.startsWith("zxcur_")) - { // this is a current value (from a hidden field) - int uid = Integer.parseInt(p_name.substring(6)); - int level = Integer.parseInt(request.getParameter(p_name)); - org_vals.put(new Integer(uid),new Integer(level)); - - } // end if - else if (p_name.startsWith("zxnew_")) - { // this is a new value (from a dropdown list box) - int uid = Integer.parseInt(p_name.substring(6)); - int level = Integer.parseInt(request.getParameter(p_name)); - new_vals.put(new Integer(uid),new Integer(level)); - - } // end else if - - } // end while - - if (org_vals.size()!=new_vals.size()) - return new ErrorBox(null,"Invalid parameters.",on_error); - - } // end try - catch (NumberFormatException nfe) - { // error converting the parameters - return new ErrorBox(null,"Invalid parameter conversion.",on_error); - - } // end catch - - try - { // loop through the hashmaps and set the value - Iterator it = org_vals.keySet().iterator(); - while (it.hasNext()) - { // extract the UID, old level, and new level - Integer uid = (Integer)(it.next()); - Integer org_level = (Integer)(org_vals.get(uid)); - Integer new_level = (Integer)(new_vals.get(uid)); - if (new_level==null) // whoops - return new ErrorBox(null,"Invalid new level parameter.",on_error); - int new_level_x = new_level.intValue(); - if (new_level_x==0) - new_level_x = -1; - - // call down to set the membership level - if (org_level.intValue()!=new_level_x) - conf.setMembership(uid.intValue(),new_level_x); - - } // end while - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error setting memberships: " + de.getMessage(), - on_error); - - } // end catch - - // trap back to the conference membership display - throw new RedirectResult(on_error); - - } // end if ("update" clicked) - - if ( isImageButtonClicked(request,"search") || isImageButtonClicked(request,"previous") - || isImageButtonClicked(request,"next")) - { // create the new dialog box - ConferenceMembership m = new ConferenceMembership(engine,comm,conf); - - try - { // perform the search! - m.doSearch(request); - - } // end try - catch (ValidationException ve) - { // validation error - throw it back to the user - return new ErrorBox(null,ve.getMessage() + " Please try again.",on_error); - - } // end catch - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error updating conference: " + de.getMessage(), - on_error); - - } // end catch - - setMyLocation(request,on_error); - return m; - - } // end if (search function clicked) - - // we don't know what button was pressed - logger.error("no known button click on ConfOperations.doPost, cmd=M"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("M" command) - - if (cmd.equals("I")) - { // "I" = "Conference E-Mail" - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=I"; - - if (isImageButtonClicked(request,"cancel")) // "Cancel" button pressed - bail out - throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=Q"); - - if (isImageButtonClicked(request,"send")) - { // OK, figure out who we want to send E-mail to - try - { // retrieve the topic we want to send to - TopicContext topic = null; - String s = request.getParameter("top"); - if ((s!=null) && !(s.equals("0"))) - topic = conf.getTopic(Short.parseShort(s)); - - // retrieve other parameters - final String ZERO = "0"; - boolean posters = ZERO.equals(request.getParameter("porl")); - final String YES = "Y"; - int ndays = -1; - if (YES.equals(request.getParameter("xday"))) - { // they selected "within the last X days" - try - { // parse the number of days - s = request.getParameter("day"); - if (s!=null) - ndays = Integer.parseInt(s); - else - ndays = 0; - - } // end try - catch (NumberFormatException nfe) - { // always fail safe when doing e-mail parameters! - ndays = 0; - - } // end catch - - } // end if - - if (topic!=null) - topic.sendMailToParticipants(posters,ndays,request.getParameter("subj"), - request.getParameter("pb")); - else - conf.sendMailToParticipants(posters,ndays,request.getParameter("subj"), - request.getParameter("pb")); - - } // end try - catch (AccessError ae) - { // some sort of access error - display an error dialog - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error creating the conference - return new ErrorBox("Database Error","Database error sending E-mail: " + de.getMessage(), - on_error); - - } // end catch - - // all done - bounce back to the menu - throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=Q"); - - } // end if ("send" pressed) - - // we don't know what button was pressed - logger.error("no known button click on ConfOperations.doPost, cmd=I"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("I" command) - - if (cmd.equals("U")) - { // "U" command - Customize Conference - ConferenceContext conf = getConferenceParameter(request,comm,true,on_error); - on_error = "confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&cmd=U"; - - if (!(conf.canChangeConference())) - return new ErrorBox("Access Error","You are not permitted to change this conference's customizations.", - on_error); - - if (isImageButtonClicked(request,"cancel")) // cancel - bounce back to the menu - throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=Q"); - - if (isImageButtonClicked(request,"update")) - { // OK, actually update the operation - try - { // reset the custom blocks - conf.setCustomBlock(ConferenceContext.CUST_BLOCK_TOP,request.getParameter("tx")); - conf.setCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM,request.getParameter("bx")); - - } // end try - catch (DataException de) - { // something wrong in the database - return new ErrorBox("Database Error","Database error setting custom blocks: " + de.getMessage(), - on_error); - - } // end catch - catch (AccessError ae) - { // some lack of access is causing problems - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - - // all done - bounce back to the menu - throw new RedirectResult("confops?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() - + "&cmd=Q"); - - } // end if - - // we don't know what button was pressed - logger.error("no known button click on ConfOperations.doPost, cmd=U"); - return new ErrorBox("Internal Error","Unknown command button pressed",on_error); - - } // end if ("U" command) - - // unrecognized command! - logger.error("invalid command to ConfOperations.doPost: " + cmd); - return new ErrorBox("Internal Error","Invalid command to ConfOperations.doPost",on_error); - - } // end doVenicePost - -} // end class ConfOperations diff --git a/src/com/silverwrist/venice/servlets/Find.java b/src/com/silverwrist/venice/servlets/Find.java deleted file mode 100644 index cecc660..0000000 --- a/src/com/silverwrist/venice/servlets/Find.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class Find extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - protected static final String DISPLAY_PARAM_ATTRIBUTE = "servlet.Find.display"; - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getDisplayParam(HttpServletRequest request, int nchoices) - { - HttpSession session = request.getSession(true); - - try - { // attempt to get the display parameter - String dp_str = request.getParameter("disp"); - if (dp_str!=null) - { // attempt to convert to an integer and range-check it - int dp = Integer.parseInt(dp_str); - if ((dp>=0) && (dp. - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class FindPost extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "FindPost servlet - Searches for posts in communities, conferences, and/or topics\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String locator = "sig=" + comm.getCommunityID(); - - ConferenceContext conf = getConferenceParameter(request,comm,false,"confops?" + locator); - TopicContext topic = null; - if (conf!=null) - { // find the topic parameter - locator += ("&conf=" + conf.getConfID()); - topic = getTopicParameter(request,conf,false,"confdisp?" + locator); - if (topic!=null) - locator += ("&top=" + topic.getTopicNumber()); - - } // end if - - setMyLocation(request,"findpost?" + locator); - return new FindPostData(comm,conf,topic); - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String locator = "sig=" + comm.getCommunityID(); - - ConferenceContext conf = getConferenceParameter(request,comm,false,"confops?" + locator); - TopicContext topic = null; - if (conf!=null) - { // find the topic parameter - locator += ("&conf=" + conf.getConfID()); - topic = getTopicParameter(request,conf,false,"confdisp?" + locator); - if (topic!=null) - locator += ("&top=" + topic.getTopicNumber()); - - } // end if - - setMyLocation(request,"findpost?" + locator); - FindPostData data = new FindPostData(comm,conf,topic); - - try - { // attempt to configure the display - data.doSearch(request,engine); - - } // end try - catch (AccessError ae) - { // error in find parameters - return new ErrorBox("Find Error",ae.getMessage(),"top"); - - } // end catch - catch (DataException de) - { // database error, man - return new ErrorBox("Database Error","Database error on find: " + de.getMessage(),"top"); - - } // end catch - - return data; - - } // end doVenicePost - -} // end class FindPost diff --git a/src/com/silverwrist/venice/servlets/Gateway.java b/src/com/silverwrist/venice/servlets/Gateway.java deleted file mode 100644 index 5e3ccf1..0000000 --- a/src/com/silverwrist/venice/servlets/Gateway.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.net.URLEncoder; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.servlets.format.*; - -public class Gateway extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(Gateway.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "Gateway servlet - \"Gates\" a URL request based on whether or not the user is logged in\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - String target = request.getQueryString(); - if (target==null) - throw new ErrorResult(HttpServletResponse.SC_BAD_REQUEST,"no parameter specified"); - if (logger.isDebugEnabled()) - logger.debug("they want to redirect to: " + target); - if (user.isLoggedIn()) - throw new RedirectResult(target); - else - throw new RedirectResult("account?cmd=L&tgt=" + URLEncoder.encode(target)); - - } // end doVeniceGet - -} // end class Gateway diff --git a/src/com/silverwrist/venice/servlets/ImageRetrieve.java b/src/com/silverwrist/venice/servlets/ImageRetrieve.java deleted file mode 100644 index acee26d..0000000 --- a/src/com/silverwrist/venice/servlets/ImageRetrieve.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class ImageRetrieve extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(ImageRetrieve.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "ImageRetrieve servlet - Displays images from the database image store\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - int imgid; // image ID to retrieve. - - try - { // parse the image ID - imgid = Integer.parseInt(request.getPathInfo().substring(1)); - - } // end try - catch (NumberFormatException nfe) - { // invalid image URL - return new ErrorBox(null,"Invalid image URL.",null); - - } // end catch - - // the parameters of the response - String type, filename; - int length; - InputStream data; - - try - { // load the image from the database - BinaryData image = engine.loadImage(imgid); - - type = image.getMIMEType(); - filename = image.getFilename(); - length = image.getLength(); - data = image.getData(); - - } // end try - catch (DataException de) - { // unable to get the user name - return new ErrorBox("Database Error","Database error retrieving image: " + de.getMessage(),null); - - } // end catch - - // now we want to send that data back to the user! - throw new SendFileResult(type,filename,length,data); - - } // end doVeniceGet - -} // end class ImageRetrieve diff --git a/src/com/silverwrist/venice/servlets/PostMessage.java b/src/com/silverwrist/venice/servlets/PostMessage.java deleted file mode 100644 index 593fcab..0000000 --- a/src/com/silverwrist/venice/servlets/PostMessage.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class PostMessage extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(PostMessage.class.getName()); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getPostNumber(ServletRequest request, String on_error) throws ErrorBox - { - String str = request.getParameter("sd"); - if (StringUtil.isStringEmpty(str)) - throw new ErrorBox(null,"Invalid parameter.",on_error); - try - { // get the number of posts we think he topic has - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // not a good integer... - throw new ErrorBox(null,"Invalid parameter.",on_error); - - } // end catch - - } // end getPostNumber - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "PostMessage servlet - Handles posting messages to a conference\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - - // get the conference - ConferenceContext conf = getConferenceParameter(request,comm,true,"top"); - - // get the topic - TopicContext topic = getTopicParameter(request,conf,true,"top"); - - String on_error = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" - + topic.getTopicNumber(); - - if (isImageButtonClicked(request,"cancel")) - throw new RedirectResult(on_error); // canceled posting - take us back - - // make sure we've got some post data - String raw_postdata = request.getParameter("pb"); - /* EJB 4/4/2001 - take this code out, FUTURE: maybe make it a global setting? - if (StringUtil.isStringEmpty(raw_postdata)) - return null; // don't allow zero-size posts - -- end removed code */ - - if (raw_postdata==null) - raw_postdata = ""; - - final String yes = "Y"; - - if (isImageButtonClicked(request,"preview")) // generate a preview - return new PostPreview(engine,comm,conf,topic,request.getParameter("pseud"),raw_postdata, - request.getParameter("next"),getPostNumber(request,on_error), - yes.equals(request.getParameter("attach")), - yes.equals(request.getParameter("slip"))); - - if ( isImageButtonClicked(request,"post") || isImageButtonClicked(request,"postnext") - || isImageButtonClicked(request,"posttopics")) - { // post the message, and then either go back to the same topic or on to the next one - boolean go_next = isImageButtonClicked(request,"postnext"); - boolean go_topics = isImageButtonClicked(request,"posttopics"); - int pn = getPostNumber(request,on_error); - - try - { // first check for slippage - if (pn!=topic.getTotalMessages()) // slippage detected! display the slippage screen - return new PostSlippage(engine,comm,conf,topic,pn,request.getParameter("next"), - request.getParameter("pseud"),raw_postdata, - yes.equals(request.getParameter("attach"))); - - // post the darn thing! - TopicMessageContext msg = topic.postNewMessage(0,request.getParameter("pseud"),raw_postdata); - - if (!(yes.equals(request.getParameter("slip")))) - topic.fixSeen(); // no slippage = make sure we mark all as read - - // where do we want to go now? - String target; - if (go_topics) - target = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - else - { // figure out what topic to go to next - short next; - try - { // attempt to get the value of the "next topic" parameter - if (go_next) - { // get the "next topic" parameter - String foo = request.getParameter("next"); - if (StringUtil.isStringEmpty(foo)) - next = topic.getTopicNumber(); - else - next = Short.parseShort(foo); - - } // end if - else - next = topic.getTopicNumber(); - - } // end try - catch (NumberFormatException nfe) - { // just default me - next = topic.getTopicNumber(); - - } // end catch - - target = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" - + next + "&rnm=1"; - - } // end else - - if (yes.equals(request.getParameter("attach"))) - return new AttachmentForm(comm,conf,msg,target); // go to upload an attachment - - // no attachment - redirect where we need to go - throw new RedirectResult(target); - - } // end try - catch (DataException de) - { // there was a database error posting the message - return new ErrorBox("Database Error","Database error posting message: " + de.getMessage(),"top"); - - } // end catch - catch (AccessError ae) - { // we were unable to post the message - return new ErrorBox("Access Error",ae.getMessage(),"top"); - - } // end catch - - } // end if - - // unknown button clicked - logger.error("no known button click on PostMessage.doPost"); - return new ErrorBox("Internal Error","Unknown command button pressed","top"); - - } // end doVenicePost - -} // end class PostMessage diff --git a/src/com/silverwrist/venice/servlets/PostOperations.java b/src/com/silverwrist/venice/servlets/PostOperations.java deleted file mode 100644 index d8e8b6a..0000000 --- a/src/com/silverwrist/venice/servlets/PostOperations.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class PostOperations extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String NUKE_CONFIRM_ATTR = "servlets.PostOperations.nuke.confirm"; - private static final String NUKE_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(TopicOperations.class.getName()); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "PostOperations servlet - General post operations (hide, scribble, etc.)\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String locator = "sig=" + comm.getCommunityID(); - String location = "sigprofile?" + locator; - - // get the conference - ConferenceContext conf = getConferenceParameter(request,comm,true,location); - locator += "&conf=" + conf.getConfID(); - location = "confdisp?" + locator; - - // get the topic - TopicContext topic = getTopicParameter(request,conf,true,location); - locator += "&top=" + topic.getTopicNumber(); - location = "confdisp?" + locator; - - // get the message - TopicMessageContext msg = getMessageParameter(request,topic,true,location); - location = "confdisp?" + locator + "&p1=" + msg.getPostNumber() + "&shac=1"; - setMyLocation(request,location); - - // figure out what command we want to perform - String cmd = getStandardCommandParam(request); - - if (cmd.equals("HY") || cmd.equals("HN")) - { // we want to hide or show the message - try - { // attempt to hide or show the message - msg.setHidden(cmd.equals("HY")); - - // go back and display stuff - throw new RedirectResult(location); - - } // end if - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting hidden status: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - } // end if ("hide" or "show") - - if (cmd.equals("SCR")) - { // we want to scribble the message - try - { // attempt to scribble the message - msg.scribble(); - - // go back and display stuff - throw new RedirectResult(location); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error scribbling message: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - } // end if ("scribble") - - if (cmd.equals("BY") || cmd.equals("BN")) - { // we want to add or remove the bozo filter from the user here - try - { // attempt to set the bozo filter status - topic.setBozo(msg.getCreatorUID(),cmd.equals("BY")); - - // go back and display stuff - throw new RedirectResult(location); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting filter status: " + de.getMessage(), - location); - - } // end catch - - } // end if - - if (cmd.equals("NUKE")) - { // nuking requires confirmation - try - { // we need confirmation on this operation - if (ConfirmBox.isConfirmed(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM)) - { // OK, go ahead, nuke the message! - msg.nuke(); - - // after which, redirect to topic view - throw new RedirectResult("confdisp?" + locator); - - } // end if (confirmed) - else - { // not a proper confirmation - better display one - List aliases = conf.getAliases(); - String message = "You are about to nuke message <" + (String)(aliases.get(0)) + "." - + topic.getTopicNumber() + "." + msg.getPostNumber() + ">, originally composed by <" - + msg.getCreatorName() + ">! Are you sure you want to do this?"; - String confirm_url = "postops?" + locator + "&msg=" + msg.getPostNumber() + "&cmd=NUKE"; - return new ConfirmBox(request,NUKE_CONFIRM_ATTR,NUKE_CONFIRM_PARAM,"Nuke Message", - message,confirm_url,location); - - } // end else (not yet confirmed) - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error nuking message: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - } // end if ("nuke") - - if (cmd.equals("PU")) - { // we want to publish the message to the front page - try - { // attempt to publish the message - msg.publish(); - - // go back and display stuff - throw new RedirectResult(location); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error publishing message: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - } // end if - - // unrecognized command! - logger.error("invalid command to PostOperations.doGet: " + cmd); - return new ErrorBox("Internal Error","Invalid command to PostOperations.doGet",location); - - } // end doVeniceGet - -} // end class PostOperations diff --git a/src/com/silverwrist/venice/servlets/Settings.java b/src/com/silverwrist/venice/servlets/Settings.java deleted file mode 100644 index b7829c7..0000000 --- a/src/com/silverwrist/venice/servlets/Settings.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class Settings extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String UNJOIN_CONFIRM_ATTR = "servlets.Settings.unjoin.confirm"; - private static final String UNJOIN_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(Settings.class.getName()); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int findHotlistIndex(List hotlist, ServletRequest request) throws ErrorBox - { - String foo = request.getParameter("sig"); - if (foo==null) - throw new ErrorBox(null,"Parameter not specified!","settings?cmd=H"); - int cid; - try - { // this is the community id of the hotlist entry - cid = Integer.parseInt(foo); - - } // end try - catch (NumberFormatException nfe) - { // conversion error... - throw new ErrorBox(null,"Parameter invalid!","settings?cmd=H"); - - } // end catch - - foo = request.getParameter("conf"); - if (foo==null) - throw new ErrorBox(null,"Parameter not specified!","settings?cmd=H"); - int confid; - try - { // this is the conference id of the hotlist entry - confid = Integer.parseInt(foo); - - } // end try - catch (NumberFormatException nfe) - { // conversion error... - throw new ErrorBox(null,"Parameter invalid!","settings?cmd=H"); - - } // end catch - - for (int i=0; i. - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.servlets.format.RenderConfig; -import com.silverwrist.venice.servlets.format.RenderData; - -public class StyleSheet extends HttpServlet -{ - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "StyleSheet applet - Generates a Cascading Stylesheet for Venice's use\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - public void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - ServletContext ctxt = getServletContext(); - RenderData rdat = RenderConfig.createRenderData(ctxt,request,response); - String stylesheet = Variables.getStyleSheetData(ctxt,rdat); - if (stylesheet!=null) - { // send back the stylesheet - response.setContentType("text/css"); - response.setContentLength(stylesheet.length()); - PrintWriter out = response.getWriter(); - out.write(stylesheet); - out.flush(); - response.flushBuffer(); - - } // end if - else // no stylesheet data - response.sendError(HttpServletResponse.SC_NOT_FOUND,"stylesheets not enabled"); - - } // end doGet - -} // end class StyleSheet diff --git a/src/com/silverwrist/venice/servlets/SystemAdmin.java b/src/com/silverwrist/venice/servlets/SystemAdmin.java deleted file mode 100644 index 00f6c40..0000000 --- a/src/com/silverwrist/venice/servlets/SystemAdmin.java +++ /dev/null @@ -1,474 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class SystemAdmin extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(SystemAdmin.class); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private SystemAdminTop makeSystemAdminTop() throws ServletException - { - final String desired_name = "SystemAdminTop"; - MenuPanelCache cache = MenuPanelCache.getMenuPanelCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - SystemAdminTop template = new SystemAdminTop(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (SystemAdminTop)(cache.getNewMenuPanel(desired_name)); - - } // end makeSystemAdminTop - - private AdminModifyUserDialog makeAdminModifyUserDialog() throws ServletException - { - final String desired_name = "AdminModifyUserDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - AdminModifyUserDialog template = new AdminModifyUserDialog(); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (AdminModifyUserDialog)(cache.getNewDialog(desired_name)); - - } // end makeAdminModifyUserDialog - - private EditGlobalPropertiesDialog makeGlobalPropertiesDialog(SecurityInfo sinf) throws ServletException - { - final String desired_name = "EditGlobalPropertiesDialog"; - DialogCache cache = DialogCache.getDialogCache(getServletContext()); - - if (!(cache.isCached(desired_name))) - { // create a template and save it off - EditGlobalPropertiesDialog template = new EditGlobalPropertiesDialog(sinf); - cache.saveTemplate(template); - - } // end if - - // return a new copy - return (EditGlobalPropertiesDialog)(cache.getNewDialog(desired_name)); - - } // end makeGlobalPropertiesDialog - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "SystemAdmin servlet - Administrative functions for the entire system\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // decide what to do based on the "cmd" parameter - String cmd = getStandardCommandParam(request); - if (logger.isDebugEnabled()) - logger.debug("SystemAdmin/doGet command value = " + cmd); - - if (cmd.equals("A")) - { // "A" = View System Audit Records - try - { // get the list of audit records - AdminOperations adm = user.getAdminInterface(); - int offset = 0; - try - { // convert the offset parameter - String s_ofs = request.getParameter("ofs"); - if (!StringUtil.isStringEmpty(s_ofs)) - offset = Integer.parseInt(s_ofs); - - } // end try - catch (NumberFormatException nfe) - { // if it's untranslatable, set it at 0 - offset = 0; - - } // end catch - - // generate the lists - List audit_list = adm.getAuditRecords(offset,engine.getNumAuditRecordsPerPage()); - int audit_count = adm.getAuditRecordCount(); - - // return the audit viewer - setMyLocation(request,"sysadmin?cmd=A&ofs=" + offset); - return new AuditDataViewer(engine,audit_list,offset,audit_count,"System Audit Records", - "sysadmin?cmd=A&ofs=%"); - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to retrieve audit records: " + de.getMessage(), - "sysadmin"); - - } // end catch - - } // end if ("A" command) - - if (cmd.equals("UF")) - { // "UF" = "User Find" - the initial screen of User Account Management - if (!(user.hasAdminAccess())) - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - // prepare and load the display - AdminFindUser afu = new AdminFindUser(engine); - afu.loadGet(); - setMyLocation(request,"sysadmin?cmd=UF"); - return afu; - - } // end if ("UF" command) - - if (cmd.equals("UM")) - { // "UM" = "User Modify" - the second screen of user account management - try - { // get the user to be modified - AdminOperations adm = user.getAdminInterface(); - String s_uid = request.getParameter("uid"); - if (s_uid==null) - throw new ErrorBox(null,"User ID parameter not found.","sysadmin?cmd=UF"); - AdminUserContext admuser = adm.getUserContext(Integer.parseInt(s_uid)); - - AdminModifyUserDialog dlg = makeAdminModifyUserDialog(); - dlg.setupDialog(adm,admuser); - setMyLocation(request,"sysadmin?cmd=UM"); - return dlg; - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to retrieve user information: " + de.getMessage(), - "sysadmin?cmd=UF"); - - } // end catch - catch (NumberFormatException nfe) - { // this is if we get a bogus UID - return new ErrorBox(null,"Invalid user ID parameter.","sysadmin?cmd=UF"); - - } // end catch - - } // end if ("UM" command) - - if (cmd.equals("G")) - { // "G" = Edit Global Properties - try - { // get the global properties - AdminOperations adm = user.getAdminInterface(); - EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog(adm.getSecurityInfo()); - dlg.setupDialog(adm); - setMyLocation(request,"sysadmin?cmd=G"); - return dlg; - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - - } // end if ("G" command) - - if (cmd.equals("IMP")) - { // "IMP" = "Import Users" - try - { // get the import dialog - AdminImportUser rc = new AdminImportUser(user.getAdminInterface(),false); - setMyLocation(request,"sysadmin?cmd=IMP"); - return rc; - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - - } // end if ("IMP" command) - - // TODO: other command handling - - if (!(user.hasAdminAccess())) - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - setMyLocation(request,"sysadmin"); - return makeSystemAdminTop(); - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // decide what to do based on the "cmd" parameter - String cmd = getStandardCommandParam(request); - if (logger.isDebugEnabled()) - logger.debug("SystemAdmin/doPost command value = " + cmd); - - if (cmd.equals("UF")) - { // "UF" = "User Find" - the initial screen of User Account Management - if (!(user.hasAdminAccess())) - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - try - { // prepare and load the display - AdminFindUser afu = new AdminFindUser(engine); - afu.loadPost(request); - setMyLocation(request,"sysadmin?cmd=UF"); - return afu; - - } // end try - catch (DataException de) - { // catch a database error and return it - return new ErrorBox("Database Error","Database error on find: " + de.getMessage(),"sysadmin?cmd=UF"); - - } // end catch - catch (ValidationException ve) - { // there was a validation error - return new ErrorBox("Find Error",ve.getMessage(),"sysadmin?cmd=UF"); - - } // end catch - - } // end if ("UF" command) - - if (cmd.equals("UM")) - { // "UM" = "User Modify" - the second screen of user account management - try - { // get the dialog box - AdminModifyUserDialog dlg = makeAdminModifyUserDialog(); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult("sysadmin?cmd=UF"); // we decided not to bother - go back - - if (dlg.isButtonClicked(request,"update")) - { // get the user to be modified - AdminOperations adm = user.getAdminInterface(); - String s_uid = request.getParameter("uid"); - if (s_uid==null) - throw new ErrorBox(null,"User ID parameter not found.","sysadmin?cmd=UF"); - AdminUserContext admuser = adm.getUserContext(Integer.parseInt(s_uid)); - - dlg.loadValues(request); // load field values - - try - { // execute the dialog! - dlg.doDialog(admuser); - throw new RedirectResult("sysadmin?cmd=UF"); - - } // end try - catch (ValidationException ve) - { // this is a simple error - dlg.resetOnError(adm,admuser,ve.getMessage() + " Please try again."); - setMyLocation(request,"sysadmin?cmd=UM"); - return dlg; - - } // end catch - - } // end if - else - { // the button must be wrong! - logger.error("no known button click on SystemAdmin.doPost, cmd=UF"); - return new ErrorBox("Internal Error","Unknown command button pressed","sysadmin?cmd=UF"); - - } // end else - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to retrieve user information: " + de.getMessage(), - "sysadmin?cmd=UF"); - - } // end catch - catch (NumberFormatException nfe) - { // this is if we get a bogus UID - return new ErrorBox(null,"Invalid user ID parameter.","sysadmin?cmd=UF"); - - } // end catch - - } // end if ("UM" command) - - if (cmd.equals("G")) - { // "G" - Edit Global Properties - try - { // get the dialog box - EditGlobalPropertiesDialog dlg = makeGlobalPropertiesDialog(engine.getSecurityInfo()); - - if (dlg.isButtonClicked(request,"cancel")) - throw new RedirectResult("sysadmin"); // we decided not to bother - go back - - if (dlg.isButtonClicked(request,"update")) - { // update the system properties - AdminOperations adm = user.getAdminInterface(); - dlg.loadValues(request); - - try - { // execute the dialog! - dlg.doDialog(adm); - throw new RedirectResult("sysadmin"); - - } // end try - catch (ValidationException ve) - { // validation error - retry the dialog - dlg.setErrorMessage(ve.getMessage() + " Please try again."); - setMyLocation(request,"sysadmin?cmd=G"); - return dlg; - - } // end catch - - } // end if - else - { // the button must be wrong! - logger.error("no known button click on SystemAdmin.doPost, cmd=G"); - return new ErrorBox("Internal Error","Unknown command button pressed","sysadmin?cmd=UF"); - - } // end else - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (DataException de) - { // error pulling the audit records - return new ErrorBox("Database Error","Unable to update global properties: " + de.getMessage(), - "sysadmin"); - - } // end catch - - } // end if ("G" command) - - // TODO: other command handling - - if (!(user.hasAdminAccess())) - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - setMyLocation(request,"sysadmin"); - return makeSystemAdminTop(); - - } // end doVenicePost - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // decide what to do based on the "cmd" parameter - String cmd = getStandardCommandParam(mphandler); - if (logger.isDebugEnabled()) - logger.debug("SystemAdmin/doPost command value = " + cmd); - - if (cmd.equals("IMP")) - { // "IMP" = "Import User Accounts" - try - { // get the administrative interface and then check the buttons - AdminOperations adm = user.getAdminInterface(); - if (isImageButtonClicked(mphandler,"cancel")) - throw new RedirectResult("sysadmin"); // we decided not to bother - go back - if (!isImageButtonClicked(mphandler,"upload")) - { // the button must be wrong! - logger.error("no known button click on SystemAdmin.doPost, cmd=IMP"); - return new ErrorBox("Internal Error","Unknown command button pressed","sysadmin"); - - } // end if - - if (!(mphandler.isFileParam("idata"))) - return new ErrorBox("Internal Error","Invalid input file parameter.","sysadmin"); - - // create the view object and use it to execute the operation - AdminImportUser rc = new AdminImportUser(user.getAdminInterface(),true); - rc.execute(mphandler.getFileContentStream("idata")); - setMyLocation(request,"sysadmin?cmd=IMP"); - return rc; - - } // end try - catch (AccessError ae) - { // an access error generally means we're not an administrator - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - } // end catch - catch (ServletMultipartException smpe) - { // error loading the data stream - return new ErrorBox("Internal Error","Error loading post data: " + smpe.getMessage(),"sysadmin"); - - } // end catch - - } // end if - - // TODO: other command handling - - if (!(user.hasAdminAccess())) - return new ErrorBox("Access Error","You do not have permission to administer the system.",null); - - setMyLocation(request,"sysadmin"); - return makeSystemAdminTop(); - - } // end doVenicePost - -} // end class SystemAdmin diff --git a/src/com/silverwrist/venice/servlets/Top.java b/src/com/silverwrist/venice/servlets/Top.java deleted file mode 100644 index 4baeef7..0000000 --- a/src/com/silverwrist/venice/servlets/Top.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import org.apache.log4j.xml.DOMConfigurator; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class Top extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public void init(ServletConfig config) throws ServletException - { - super.init(config); // required before we do anything else - ServletContext ctxt = config.getServletContext(); - String root_file_path = ctxt.getRealPath("/"); - if (!(root_file_path.endsWith("/"))) - root_file_path += "/"; - - // Initialize LOG4J logging. - String lconf = ctxt.getInitParameter("logging.config"); - if (!(lconf.startsWith("/"))) - lconf = root_file_path + lconf; - DOMConfigurator.configure(lconf); - - // Initialize the Venice engine. - VeniceEngine engine = Variables.getVeniceEngine(ctxt); - - // Initialize the Venice rendering system. - RenderConfig.getRenderConfig(ctxt); - - } // end init - - public void destroy() - { - super.destroy(); - - } // end destroy - - public String getServletInfo() - { - String rc = "Top applet - Displays the Venice front page\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - changeMenuTop(request); - setMyLocation(request,"top"); - - try - { // attempt to get the user content - return new TopDisplay(getServletContext(),engine,user); - - } // end try - catch (DataException de) - { // there was a database error, whoops! - return new ErrorBox("Database Error","Error loading front page: " + de.getMessage(),null); - - } // end catch - catch (AccessError ae) - { // there was an access error, whoops! - return new ErrorBox("Access Error",ae.getMessage(),null); - - } // end catch - - } // end doVeniceGet - -} // end class Top diff --git a/src/com/silverwrist/venice/servlets/TopicOperations.java b/src/com/silverwrist/venice/servlets/TopicOperations.java deleted file mode 100644 index 7716f27..0000000 --- a/src/com/silverwrist/venice/servlets/TopicOperations.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class TopicOperations extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String DELETE_CONFIRM_ATTR = "servlets.TopicOperations.delete.confirm"; - private static final String DELETE_CONFIRM_PARAM = "confirm"; - - private static Category logger = Category.getInstance(TopicOperations.class.getName()); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "TopicOperations servlet - General topic operations (freeze, archive, etc.)\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - changeMenuCommunity(request,comm); - String locator = "sig=" + comm.getCommunityID(); - String location = "sigprofile?" + locator; - - // get the conference - ConferenceContext conf = getConferenceParameter(request,comm,true,location); - locator += "&conf=" + conf.getConfID(); - location = "confdisp?" + locator; - - // get the topic - TopicContext topic = getTopicParameter(request,conf,true,location); - locator += "&top=" + topic.getTopicNumber(); - location = "confdisp?" + locator; - - // figure out what command we want to perform... - String cmd = getStandardCommandParam(request); - - if (cmd.equals("HY") || cmd.equals("HN")) - { // we want to set the hide status of the topic - try - { // call down to set the topic! - topic.setHidden(cmd.equals("HY")); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting hide status: " + de.getMessage(), - location); - - } // end catch - - // go back to the topic view - throw new RedirectResult(location); - - } // end if ("hide" or "show") - - if (cmd.equals("FY") || cmd.equals("FN")) - { // we want to set the frozen status of the topic - try - { // call down to set the topic! - topic.setFrozen(cmd.equals("FY")); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting freeze status: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - // go back to the topic view - throw new RedirectResult(location); - - } // end if ("freeze" or "unfreeze") - - if (cmd.equals("AY") || cmd.equals("AN")) - { // we want to change the archived status of the topic - try - { // call down to set the topic! - topic.setArchived(cmd.equals("AY")); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting archive status: " + de.getMessage(), - location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - // go back to the topic view - throw new RedirectResult(location); - - } // end if ("archive" or "unarchive") - - if (cmd.equals("DEL")) - { // Delete Topic requires a confirmation! - if (ConfirmBox.isConfirmed(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM)) - { // OK, go ahead, delete the topic! - location = "confdisp?sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - try - { // delete the bloody topic! - topic.delete(); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error deleting topic: " + de.getMessage(),location); - - } // end catch - catch (AccessError ae) - { // naughty naughty = you can't do this! - return new ErrorBox("Access Error",ae.getMessage(),location); - - } // end catch - - // go back to the conference view - throw new RedirectResult(location); - - } // end if (confirmed) - else - { // not a proper confirmation - better display one - String message = "You are about to delete topic " + String.valueOf(topic.getTopicNumber()) - + " from the \"" + conf.getName() + "\" conference! Are you sure you want to do this?"; - return new ConfirmBox(request,DELETE_CONFIRM_ATTR,DELETE_CONFIRM_PARAM,"Delete Topic",message, - "topicops?" + locator + "&cmd=DEL",location); - - } // end else - - } // end if (delete) - - if (cmd.equals("RB")) - { // "RB" = "Remove Bozo" (UID specified as parameter "u") - int uid = -1; - try - { // get the user ID to un-bozo - String foo = request.getParameter("u"); - if (foo!=null) - uid = Integer.parseInt(foo); - - } // end try - catch (NumberFormatException nfe) - { // just don't do anything on error - uid = -1; - - } // end catch - - try - { // remove "bozo" status from this user - if (uid>0) - topic.setBozo(uid,false); - setMyLocation(request,"topicops?" + locator); - return new ManageTopic(user,comm,conf,topic); - - } // end try - catch (DataException de) - { // whoops! this is a problem! - return new ErrorBox("Database Error","Database error removing filtered user: " + de.getMessage(), - "topicops?" + locator); - - } // end catch - - } // end if (remove bozo) - - if (cmd.equals("SY") || cmd.equals("SN")) - { // "SY", "SN" - Set subscription status - try - { // call down to set the topic! - topic.setSubscribed(cmd.equals("SY")); - setMyLocation(request,"topicops?" + locator); - return new ManageTopic(user,comm,conf,topic); - - } // end try - catch (DataException de) - { // there was a database error - return new ErrorBox("Database Error","Database error setting subscription status: " + de.getMessage(), - location); - - } // end catch - - } // end if (subscription control) - - // unrecognized command - load the "Manage Topic menu" - try - { // return that "Manage Topic" page - setMyLocation(request,"topicops?" + locator); - return new ManageTopic(user,comm,conf,topic); - - } // end try - catch (DataException de) - { // whoops! this is a problem! - return new ErrorBox("Database Error","Database error loading manage page: " + de.getMessage(),location); - - } // end catch - - } // end doVeniceGet - -} // end class TopicOperations diff --git a/src/com/silverwrist/venice/servlets/UserDisplay.java b/src/com/silverwrist/venice/servlets/UserDisplay.java deleted file mode 100644 index a8f9522..0000000 --- a/src/com/silverwrist/venice/servlets/UserDisplay.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class UserDisplay extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(UserDisplay.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "UserDisplay servlet - Displays Venice user profiles\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - String uname = request.getPathInfo().substring(1); // the username we're looking at - - try - { // load the profile corresponding to that username and display it - UserProfile prof = user.getProfile(uname); - changeMenuTop(request); - setMyLocation(request,"user" + request.getPathInfo()); - return new UserProfileData(engine,prof); - - } // end try - catch (DataException de) - { // unable to get the user name - return new ErrorBox("Database Error","Database error finding user: " + de.getMessage(),"top"); - - } // end catch - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - String uname = request.getPathInfo().substring(1); // the username we're looking at - UserProfile prof; - String on_error; - - if (logger.isDebugEnabled()) - logger.debug("Posting to profile: " + uname); - - try - { // load the profile corresponding to that username and display it - prof = user.getProfile(uname); - on_error = "user/" + prof.getUserName(); - - } // end try - catch (DataException de) - { // unable to get the user name - logger.error("error retrieving user profile: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error finding user: " + de.getMessage(),"top"); - - } // end catch - - String cmd = getStandardCommandParam(request); - - if (cmd.equals("E")) - { // send a quick email message - let's do it! - if (logger.isDebugEnabled()) - logger.debug("sending quick email message"); - - try - { // send a quick email message... - prof.sendQuickEmail(request.getParameter("subj"),request.getParameter("pb")); - - } // end try - catch (AccessError ae) - { // throw an access error box - logger.error("access error sending email: " + ae.getMessage(),ae); - return new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // database error - logger.error("database error sending email: " + de.getMessage(),de); - return new ErrorBox("Database Error","Database error sending message: " + de.getMessage(),on_error); - - } // end catch - catch (EmailException ee) - { // error sending the actual email - logger.error("email exception: " + ee.getMessage(),ee); - return new ErrorBox("E-Mail Error","Error sending e-mail: " + ee.getMessage(),on_error); - - } // end catch - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("redisplaying profile window"); - changeMenuTop(request); - setMyLocation(request,"user" + request.getPathInfo()); - return new UserProfileData(engine,prof); - - } // end doVenicePost - -} // end class UserDisplay diff --git a/src/com/silverwrist/venice/servlets/UserPhoto.java b/src/com/silverwrist/venice/servlets/UserPhoto.java deleted file mode 100644 index 804195b..0000000 --- a/src/com/silverwrist/venice/servlets/UserPhoto.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.net.URLEncoder; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.util.image.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public class UserPhoto extends VeniceServlet -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(UserPhoto.class); - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public String getServletInfo() - { - String rc = "UserPhoto servlet - changes the user photo for a user\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - String tgt = request.getParameter("tgt"); // target location - if (tgt==null) - tgt = "top"; // go back to the Top screen if nothing else - - try - { // create the display - return new UserPhotoData(engine,user,rdat,tgt); - - } // end try - catch (DataException de) - { // error getting at the data stream from the attachment - return new ErrorBox("Database Error","Database error generating display: " + de.getMessage(),null); - - } // end catch - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - // Get target URL for the operation - if (mphandler.isFileParam("tgt")) - { // bogus target URL - logger.error("Internal Error: 'tgt' should be a normal param"); - return new ErrorBox(null,"Internal Error: 'tgt' should be a normal param","top"); - - } // end if - - String tgt = mphandler.getValue("tgt"); - if (tgt==null) - tgt = "top"; // go back to the Top screen if nothing else - - if (isImageButtonClicked(mphandler,"cancel")) - throw new RedirectResult("account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - if (isImageButtonClicked(mphandler,"upload")) - { // uploading the image here! - // also check on file parameter status - if (!(mphandler.isFileParam("thepic"))) - { // bogus file parameter - logger.error("Internal Error: 'thepic' should be a file param"); - return new ErrorBox(null,"Internal Error: 'thepic' should be a file param", - "account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end if - - if (!(mphandler.getContentType("thepic").startsWith("image/"))) - { // must be an image type we uploaded! - logger.error("Error: 'thepic' not an image type"); - return new ErrorBox(null,"You did not upload an image file. Try again.", - "userphoto?tgt=" + URLEncoder.encode(tgt)); - - } // end if - - try - { // get the real picture (normalized to 100x100 size) - ImageLengthPair real_pic = ImageNormalizer.normalizeImage(mphandler.getFileContentStream("thepic"), - engine.getUserPhotoSize(),"jpeg"); - - // set the user photo data! - ContactInfo ci = user.getContactInfo(); - ci.setPhotoData(request.getContextPath() + "/imagedata/","image/jpeg",real_pic.getLength(), - real_pic.getData()); - user.putContactInfo(ci); - - // Jump back to the profile form. - throw new RedirectResult("account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end try - catch (ServletMultipartException smpe) - { // the servlet multipart parser screwed up - logger.error("Servlet multipart error:",smpe); - return new ErrorBox(null,"Internal Error: " + smpe.getMessage(), - "account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end catch - catch (ImageNormalizerException ine) - { // the image was not valid - logger.error("Image normalizer error:",ine); - return new ErrorBox(null,ine.getMessage(),"userphoto?tgt=" + URLEncoder.encode(tgt)); - - } // end catch - catch (DataException de) - { // error in the database! - logger.error("DataException:",de); - return new ErrorBox("Database Error","Database error storing user photo: " + de.getMessage(), - "account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end catch - catch (EmailException ee) - { // email exception (WTF?) - logger.error("Email exception (shouldn't happen):",ee); - return new ErrorBox(null,"Internal Error: " + ee.getMessage(), - "account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end catch - - } // end if - else - { // the button must be wrong! - logger.error("no known button click on UserPhoto.doPost"); - return new ErrorBox("Internal Error","Unknown command button pressed", - "account?cmd=P&tgt=" + URLEncoder.encode(tgt)); - - } // end else - - } // end doVenicePost - -} // end class UserPhoto diff --git a/src/com/silverwrist/venice/servlets/Variables.java b/src/com/silverwrist/venice/servlets/Variables.java deleted file mode 100644 index c362e60..0000000 --- a/src/com/silverwrist/venice/servlets/Variables.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.lang.ref.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; -import com.silverwrist.venice.servlets.format.menus.*; - -public class Variables -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - // ServletContext ("application") attributes - protected static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine"; - protected static final String STYLESHEET_ATTRIBUTE = "com.silverwrist.venice.rendering.StyleSheet"; - - // HttpSession ("session") attributes - protected static final String USERCTXT_ATTRIBUTE = "user.context"; - protected static final String MENU_ATTRIBUTE = "current.menu"; - - // ServletRequest ("request" attributes) - protected static final String COOKIEJAR_ATTRIBUTE = "com.silverwrist.venice.servlets.CookieJar"; - - // Servlet initialization parameters - protected static final String ENGINE_INIT_PARAM = "venice.config"; - - // Cookie name - public static final String LOGIN_COOKIE = "VeniceAuth"; - - private static Category logger = Category.getInstance(Variables.class); - private static Integer engine_gate = new Integer(0); - - /*-------------------------------------------------------------------------------- - * External static operations - *-------------------------------------------------------------------------------- - */ - - public static VeniceEngine getVeniceEngine(ServletContext ctxt) throws ServletException - { - synchronized (engine_gate) - { // we must synchronize efforts to access the engine - Object foo = ctxt.getAttribute(ENGINE_ATTRIBUTE); - if (foo!=null) - return (VeniceEngine)foo; - - String root_file_path = ctxt.getRealPath("/"); - if (!(root_file_path.endsWith("/"))) - root_file_path += "/"; - - String cfgfile = ctxt.getInitParameter(ENGINE_INIT_PARAM); // get the config file name - if (!(cfgfile.startsWith("/"))) - cfgfile = root_file_path + cfgfile; - logger.info("Initializing Venice engine using config file: " + cfgfile); - - try - { // extract the configuration file name and create the engine - VeniceEngine engine = Startup.createEngine(cfgfile,root_file_path); - ctxt.setAttribute(ENGINE_ATTRIBUTE,engine); - return engine; - - } // end try - catch (ConfigException e) - { // configuration failed! post an error message - logger.fatal("Engine configuration failed: " + e.getMessage(),e); - throw new ServletException("Venice engine configuration failed: " + e.getMessage(),e); - - } // end catch - catch (DataException e2) - { // configuration failed! post an error message - logger.fatal("Engine data load failed: " + e2.getMessage(),e2); - throw new ServletException("Venice engine data load failed: " + e2.getMessage(),e2); - - } // end catch - - } // end synchronized block - - } // end getVeniceEngine - - public static UserContext getUserContext(ServletContext ctxt, HttpServletRequest request, - HttpSession session) - throws ServletException - { - Object uctmp = session.getAttribute(USERCTXT_ATTRIBUTE); - if (uctmp!=null) - return (UserContext)uctmp; - - try - { // use the Venice engine to create a new user context and save it off - VeniceEngine engine = getVeniceEngine(ctxt); - UserContext user = engine.createUserContext(request.getRemoteAddr()); - - // Did the user send a Venice authentication cookie? If so, try to use it. - Cookie[] cookies = request.getCookies(); - Cookie venice_cookie = null; - for (int i=0; (venice_cookie==null) && (i. - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.util.ServletMultipartHandler; -import com.silverwrist.util.ServletMultipartException; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; - -public abstract class VeniceServlet extends HttpServlet -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - private static final String LOCATION_ATTR = "com.silverwrist.venice.servlets.internal.Location"; - - private static Category logger = Category.getInstance(VeniceServlet.class.getName()); - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static final void notSupported(HttpServletRequest request, String message) throws ErrorResult - { - String protocol = request.getProtocol(); - if (protocol.endsWith("1.1")) - throw new ErrorResult(HttpServletResponse.SC_METHOD_NOT_ALLOWED,message); - else - throw new ErrorResult(HttpServletResponse.SC_BAD_REQUEST,message); - - } // end notSupported - - private static final CommunityContext getCommunityParameter(String str, UserContext user, boolean required, - String on_error) throws ErrorBox - { - if (StringUtil.isStringEmpty(str)) - { // there's no community parameter - if (required) - { // no communty parameter - bail out now! - logger.error("community parameter not specified!"); - throw new ErrorBox(null,"No community specified.",on_error); - - } // end if - else - { // a null CommunityContext is permitted - logger.debug("no community specified"); - return null; - - } // end else - - } // end if - - CommunityContext rc = null; - try - { // turn the string into a community ID, and thence to a CommunityContext - int tmp_id = Integer.parseInt(str); - rc = user.getCommunityContext(tmp_id); - if (rc==null) - { // trap any null results (may not be possible with communities, but you never know) - logger.error("Community #" + tmp_id + " was not found!"); - throw new ErrorBox(null,"The specified community (#" + tmp_id + ") was not found in the database.", - on_error); - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("found community #" + rc.getCommunityID()); - - } // end try - catch (NumberFormatException nfe) - { // error in Integer.parseInt - logger.error("Cannot convert community parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid community parameter.",on_error); - - } // end catch - catch (DataException de) - { // error looking up the community - throw new ErrorBox("Database Error","Database error finding community: " + de.getMessage(),on_error); - - } // end catch - - return rc; - - } // end getCommunityParameter - - private static TopicContext getTopicParameter(String str, UserContext user, ConferenceContext conf, - boolean required, String on_error, String target) - throws ErrorBox, LogInOrCreate - { - if (StringUtil.isStringEmpty(str)) - { // there's no topic parameter - if (required) - { // no topic parameter - bail out now! - logger.error("Topic parameter not specified!"); - throw new ErrorBox(null,"No topic specified.",on_error); - - } // end if - else - { // a null TopicContext is permitted - logger.debug("no topic specified"); - return null; - - } // end else - - } // end if - - TopicContext rc = null; - try - { // turn the string into a topic number, and thence to a TopicContext - short tmp_id = Short.parseShort(str); - rc = conf.getTopic(tmp_id); - if (rc==null) - { // the topic was not found! - logger.error("ConfID #" + conf.getConfID() + " did not have topic #" + tmp_id); - throw new ErrorBox(null,"Topic #" + tmp_id + " was not found in the '" + conf.getName() - + "' conference.",on_error); - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("found topic #" + rc.getTopicID()); - - } // end try - catch (NumberFormatException nfe) - { // error in Integer.parseInt - logger.error("Cannot convert topic parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid topic parameter.",on_error); - - } // end catch - catch (AccessError ae) - { // these all get handled in pretty much the same way - logger.error("getTopicParameter(): Access error retrieving topic parameter"); - if ((user!=null) && (target!=null) && !(user.isLoggedIn())) - throw new LogInOrCreate(target); - throw new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // error looking up the topic - throw new ErrorBox("Database Error","Database error finding topic: " + de.getMessage(),"top"); - - } // end catch - - return rc; - - } // end getTopicParameter - - private static TopicMessageContext getMessageParameter(String str, ConferenceContext conf, boolean required, - String on_error) throws ErrorBox - { - if (StringUtil.isStringEmpty(str)) - { // there's no message parameter - if (required) - { // no message parameter - bail out now! - logger.error("Message parameter not specified!"); - throw new ErrorBox(null,"No message specified.",on_error); - - } // end if - else - { // a null TopicMessageContext is permitted - logger.debug("no message specified"); - return null; - - } // end else - - } // end if - - TopicMessageContext rc = null; - try - { // turn the string into a postid, and thence to a TopicMessageContext - long tmp_id = Long.parseLong(str); - rc = conf.getMessageByPostID(tmp_id); - if (rc==null) - { // the message was not found - logger.error("ConfID #" + conf.getConfID() + " does not contain postid " + tmp_id); - throw new ErrorBox(null,"The post with ID number " + tmp_id + " was not found in the '" - + conf.getName() + "' conference.",on_error); - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("found post #" + rc.getPostID()); - - } // end try - catch (NumberFormatException nfe) - { // error in Integer.parseInt - logger.error("Cannot convert message parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid message parameter.",on_error); - - } // end catch - catch (AccessError ae) - { // these all get handled in pretty much the same way - throw new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // error looking up the conference - throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error); - - } // end catch - - return rc; - - } // end getMessageParameter - - private static TopicMessageContext getMessageParameter(String str, TopicContext topic, boolean required, - String on_error) throws ErrorBox - { - if (StringUtil.isStringEmpty(str)) - { // there's no message parameter - if (required) - { // no message parameter - bail out now! - logger.error("Message parameter not specified!"); - throw new ErrorBox(null,"No message specified.",on_error); - - } // end if - else - { // a null TopicMessageContext is permitted - logger.debug("no message specified"); - return null; - - } // end else - - } // end if - - TopicMessageContext rc = null; - try - { // turn the string into a post number, and thence to a TopicMessageContext - int tmp_id = Integer.parseInt(str); - rc = topic.getMessage(tmp_id); - if (rc==null) - { // could not find the message - logger.error("TopicID " + topic.getTopicID() + " does not contain message #" + tmp_id); - throw new ErrorBox(null,"There is no message #" + tmp_id + " in the '" + topic.getName() + "' topic.", - on_error); - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("found post #" + rc.getPostID()); - - } // end try - catch (NumberFormatException nfe) - { // error in Integer.parseInt - logger.error("Cannot convert message parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid message parameter.",on_error); - - } // end catch - catch (AccessError ae) - { // these all get handled in pretty much the same way - throw new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // error looking up the conference - throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error); - - } // end catch - - return rc; - - } // end getMessageParameter - - /*-------------------------------------------------------------------------------- - * Internal operations intended for use by derived classes - *-------------------------------------------------------------------------------- - */ - - protected static final boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - protected static final boolean isImageButtonClicked(ServletMultipartHandler mphandler, String name) - { - String val = mphandler.getValue(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - protected final void putUserContext(HttpServletRequest request, UserContext ctxt) - { - Variables.putUserContext(request.getSession(true),ctxt); - - } // end putUserContext - - protected final void clearUserContext(HttpServletRequest request) - { - Variables.clearUserContext(request.getSession(true)); - - } // end clearUserContext - - protected final void changeMenuTop(HttpServletRequest request) - { - Variables.setMenuTop(getServletContext(),request.getSession(true)); - - } // end changeMenuTop - - protected final void changeMenuCommunity(HttpServletRequest request, CommunityContext comm) - { - Variables.setMenuCommunity(getServletContext(),request.getSession(true),comm); - - } // end changeMenuCommunity - - protected final void clearMenu(HttpServletRequest request) - { - Variables.clearMenu(request.getSession(true)); - - } // end clearMenu - - protected final String getStandardCommandParam(ServletRequest request) - { - String foo = request.getParameter("cmd"); - if (foo==null) - return "???"; - else - return foo; - - } // end getStandardCommandParam - - protected final String getStandardCommandParam(ServletMultipartHandler mphandler) throws ErrorBox - { - if (mphandler.isFileParam("cmd")) - throw new ErrorBox(null,"Internal Error: command should be a normal param",null); - String foo = mphandler.getValue("cmd"); - if (foo==null) - return "???"; - else - return foo; - - } // end getStandardCommandParam - - protected final void setMyLocation(ServletRequest request, String loc) - { - request.setAttribute(LOCATION_ATTR,loc); - - } // end setMyLocation - - protected final static CommunityContext getCommunityParameter(ServletRequest request, UserContext user, - boolean required, String on_error) - throws ErrorBox - { - return getCommunityParameter(request.getParameter("sig"),user,required,on_error); - - } // end getCommunityParameter - - protected final static CommunityContext getCommunityParameter(ServletMultipartHandler mphandler, - UserContext user, boolean required, - String on_error) throws ErrorBox - { - if (mphandler.isFileParam("sig")) - throw new ErrorBox(null,"Internal Error: community should be a normal param",on_error); - return getCommunityParameter(mphandler.getValue("sig"),user,required,on_error); - - } // end getCommunityParameter - - protected static ConferenceContext getConferenceParameter(String str, CommunityContext comm, - boolean required, String on_error) throws ErrorBox - { - if (StringUtil.isStringEmpty(str)) - { // there's no conference parameter - if (required) - { // no conference parameter - bail out now! - logger.error("Conference parameter not specified!"); - throw new ErrorBox(null,"No conference specified.",on_error); - - } // end if - else - { // a null ConferenceContext is permitted - logger.debug("no conference specified"); - return null; - - } // end else - - } // end if - - ConferenceContext rc = null; - try - { // turn the string into a ConfID, and thence to a ConferenceContext - int tmp_id = Integer.parseInt(str); - rc = comm.getConferenceContext(tmp_id); - if (rc==null) - { // couldn't find the conference - logger.error("community #" + comm.getCommunityID() + " does not contain conference #" + tmp_id); - throw new ErrorBox(null,"The conference #" + tmp_id + " could not be found in the '" + comm.getName() - + "' community.",on_error); - - } // end if - - if (logger.isDebugEnabled()) - logger.debug("found conf #" + rc.getConfID()); - - } // end try - catch (NumberFormatException nfe) - { // error in Integer.parseInt - logger.error("Cannot convert conference parameter '" + str + "'!"); - throw new ErrorBox(null,"Invalid conference parameter.",on_error); - - } // end catch - catch (AccessError ae) - { // these all get handled in pretty much the same way - throw new ErrorBox("Access Error",ae.getMessage(),on_error); - - } // end catch - catch (DataException de) - { // error looking up the conference - throw new ErrorBox("Database Error","Database error finding conference: " + de.getMessage(),on_error); - - } // end catch - - return rc; - - } // end getConferenceParameter - - protected final static ConferenceContext getConferenceParameter(ServletRequest request, - CommunityContext comm, boolean required, - String on_error) throws ErrorBox - { - return getConferenceParameter(request.getParameter("conf"),comm,required,on_error); - - } // end getConferenceParameter - - protected final static ConferenceContext getConferenceParameter(ServletMultipartHandler mphandler, - CommunityContext comm, boolean required, - String on_error) throws ErrorBox - { - if (mphandler.isFileParam("conf")) - throw new ErrorBox(null,"Internal Error: conference should be a normal param",on_error); - return getConferenceParameter(mphandler.getValue("conf"),comm,required,on_error); - - } // end getConferenceParameter - - protected final static TopicContext getTopicParameter(ServletRequest request, ConferenceContext conf, - boolean required, String on_error) - throws ErrorBox, LogInOrCreate - { - return getTopicParameter(request.getParameter("top"),null,conf,required,on_error,null); - - } // end getTopicParameter - - protected final static TopicContext getTopicParameter(ServletRequest request, UserContext user, - ConferenceContext conf, boolean required, - String on_error, String target) - throws ErrorBox, LogInOrCreate - { - return getTopicParameter(request.getParameter("top"),user,conf,required,on_error,target); - - } // end getTopicParameter - - protected final static TopicContext getTopicParameter(ServletMultipartHandler mphandler, - ConferenceContext conf, boolean required, - String on_error) throws ErrorBox, LogInOrCreate - { - if (mphandler.isFileParam("top")) - throw new ErrorBox(null,"Internal Error: topic should be a normal param",on_error); - return getTopicParameter(mphandler.getValue("top"),null,conf,required,on_error,null); - - } // end getTopicParameter - - protected final static TopicMessageContext getMessageParameter(ServletRequest request, - ConferenceContext conf, boolean required, - String on_error) throws ErrorBox - { - return getMessageParameter(request.getParameter("msg"),conf,required,on_error); - - } // end getMessageParameter - - protected final static TopicMessageContext getMessageParameter(ServletMultipartHandler mphandler, - ConferenceContext conf, boolean required, - String on_error) throws ErrorBox - { - if (mphandler.isFileParam("msg")) - throw new ErrorBox(null,"Internal Error: message should be a normal param",on_error); - return getMessageParameter(mphandler.getValue("msg"),conf,required,on_error); - - } // end getMessageParameter - - protected final static TopicMessageContext getMessageParameter(ServletRequest request, TopicContext topic, - boolean required, String on_error) - throws ErrorBox - { - return getMessageParameter(request.getParameter("msg"),topic,required,on_error); - - } // end getMessageParameter - - protected final static TopicMessageContext getMessageParameter(ServletMultipartHandler mphandler, - TopicContext topic, boolean required, - String on_error) throws ErrorBox - { - if (mphandler.isFileParam("msg")) - throw new ErrorBox(null,"Internal Error: message should be a normal param",on_error); - return getMessageParameter(mphandler.getValue("msg"),topic,required,on_error); - - } // end getMessageParameter - - /*-------------------------------------------------------------------------------- - * Overrideable operations - *-------------------------------------------------------------------------------- - */ - - protected String getMyLocation(HttpServletRequest request) - { - return (String)(request.getAttribute(LOCATION_ATTR)); - - } // end getMyLocation - - protected String getMyLocation(HttpServletRequest request, VeniceEngine engine, UserContext user, - RenderData rdat) - { - return getMyLocation(request); - - } // end getMyLocation - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - notSupported(request,"GET method not supported"); - return null; - - } // end doVeniceGet - - protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - notSupported(request,"POST method not supported for normal form posts"); - return null; - - } // end doVenicePost - - protected VeniceContent doVenicePost(HttpServletRequest request, ServletMultipartHandler mphandler, - VeniceEngine engine, UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - notSupported(request,"POST method not supported for multipart/form-data posts"); - return null; - - } // end doVenicePost - - /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet - *-------------------------------------------------------------------------------- - */ - - public final void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - ServletContext ctxt = getServletContext(); - VeniceEngine engine = Variables.getVeniceEngine(ctxt); - VeniceContent content = null; - - // Make all log messages for the request carry the remote address. - NDC.push(request.getRemoteAddr()); - try - { // get the user context - UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true)); - boolean record_uname = user.isLoggedIn(); - if (record_uname) - NDC.push(user.getUserName()); - - try - { // and now we proceed! - RenderData rdat = RenderConfig.createRenderData(ctxt,user,request,response); - - try - { // run the actual "get" in the servlet - content = doVeniceGet(request,engine,user,rdat); - - } // end try - catch (VeniceServletResult res) - { // special VeniceServletResult catch here - figure out what result it is - if (res instanceof VeniceContent) - content = (VeniceContent)res; // this is content - else if (res instanceof ContentResult) - { // this contains content - ContentResult cres = (ContentResult)res; - content = cres.getContent(); - - } // end else if - else if (res instanceof ExecuteResult) - { // direct-execution result - ExecuteResult xres = (ExecuteResult)res; - Variables.flushCookies(request,response); - xres.execute(rdat); - return; - - } // end else if - else // unrecognized VeniceServletResult - content = null; - - } // end catch - catch (RuntimeException re) - { // record that we caught a runtime exception in here! - logger.error("VeniceServlet.doGet caught " + re.getClass().getName() + " in doVeniceGet",re); - throw re; - - } // end catch - - Variables.flushCookies(request,response); - if (content!=null) - { // display the content! - BaseJSPData base = new BaseJSPData(engine,user,getMyLocation(request,engine,user,rdat),content); - base.transfer(ctxt,rdat); - - } // end if - else // there is no content - display the null response - rdat.nullResponse(); - - } // end try - finally - { // pop the username from the NDC if we used it - if (record_uname) - NDC.pop(); - - } // end finally - - } // end try - finally - { // pop the nested diagnostic context - NDC.pop(); - - } // end finally - - } // end doGet - - public final void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - ServletContext ctxt = getServletContext(); - VeniceEngine engine = Variables.getVeniceEngine(ctxt); - ServletMultipartHandler mphandler = null; - VeniceContent content = null; - - // Make all log messages for the request carry the remote address. - NDC.push(request.getRemoteAddr()); - try - { // get the user context - UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true)); - boolean record_uname = user.isLoggedIn(); - if (record_uname) - NDC.push(user.getUserName()); - - try - { // and now we proceed! - RenderData rdat = RenderConfig.createRenderData(ctxt,user,request,response); - - if (ServletMultipartHandler.canHandle(request)) - { // if this is a multipart/form-data request, invoke our special handler code - try - { // create the multipart handler - mphandler = new ServletMultipartHandler(request); - - } // end try - catch (ServletMultipartException e) - { // this is an error message we need to generate and just bail out on - logger.error("ServletMultipartException caught in doVenicePost!",e); - BaseJSPData base = new BaseJSPData(engine,user,getMyLocation(request,engine,user,rdat), - new ErrorBox(null,"Internal Error: " + e.getMessage(),null)); - base.transfer(ctxt,rdat); - return; - - } // end if - - } // end if - - try - { // call the appropriate doVenicePost method - if (mphandler!=null) - content = doVenicePost(request,mphandler,engine,user,rdat); - else - content = doVenicePost(request,engine,user,rdat); - - } // end try - catch (VeniceServletResult res) - { // special VeniceServletResult catch here - figure out what result it is - if (res instanceof VeniceContent) - content = (VeniceContent)res; // this is content - else if (res instanceof ContentResult) - { // this contains content - ContentResult cres = (ContentResult)res; - content = cres.getContent(); - - } // end else if - else if (res instanceof ExecuteResult) - { // direct-execution result - ExecuteResult xres = (ExecuteResult)res; - Variables.flushCookies(request,response); - xres.execute(rdat); - return; - - } // end else if - else // unrecognized VeniceServletResult - content = null; - - } // end catch - catch (RuntimeException re) - { // record that we caught a runtime exception in here! - logger.error("VeniceServlet.doPost caught " + re.getClass().getName() + " in doVenicePost",re); - throw re; - - } // end catch - - Variables.flushCookies(request,response); - if (content!=null) - { // display the content! - BaseJSPData base = new BaseJSPData(engine,user,getMyLocation(request,engine,user,rdat),content); - base.transfer(ctxt,rdat); - - } // end if - else // there is no content - display the null response - rdat.nullResponse(); - - } // end try - finally - { // pop the username from the NDC if we used it - if (record_uname) - NDC.pop(); - - } // end finally - - } // end try - finally - { // pop the nested diagnostic context - NDC.pop(); - - } // end finally - - } // end doPost - -} // end class VeniceServlet diff --git a/src/com/silverwrist/venice/servlets/format/AdminFindUser.java b/src/com/silverwrist/venice/servlets/format/AdminFindUser.java deleted file mode 100644 index 0f1026d..0000000 --- a/src/com/silverwrist/venice/servlets/format/AdminFindUser.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class AdminFindUser implements JSPRender, SearchMode -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.AdminFindUser"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - private int field = -1; - private int mode = -1; - private String term = null; - private int offset = 0; - private List results = null; - private int find_count = -1; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public AdminFindUser(VeniceEngine engine) - { - this.engine = engine; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, return default - return default_val; - - } // end catch - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static AdminFindUser retrieve(ServletRequest request) - { - return (AdminFindUser)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "User Account Management"; - - } // end getPageTitle - - public String getPageQID() - { - return "sysadmin?cmd=UF"; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "admin_find.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getSearchField() - { - return field; - - } // end getSearchField - - public boolean searchFieldIs(int value) - { - return (value==field); - - } // end searchFieldIs - - public int getSearchMode() - { - return mode; - - } // end getSearchMode - - public boolean searchModeIs(int value) - { - return (value==mode); - - } // end searchModeIs - - public String getSearchTerm() - { - return term; - - } // end getSearchTerm - - public List getResultsList() - { - return results; - - } // end getResultsList - - public int getNumResultsDisplayed() - { - return engine.getStdNumSearchResults(); - - } // end getNumResultsDisplayed - - public int getFindCount() - { - return find_count; - - } // end getFindCount - - public int getOffset() - { - return offset; - - } // end getOffset - - public void loadGet() - { - field = FIELD_USER_NAME; - mode = SEARCH_PREFIX; - term = ""; - - } // end loadGet - - public void loadPost(ServletRequest request) throws ValidationException, DataException - { - int catid = -1; - - // Retrieve all the posted parameters from the form and validate them. - field = getParamInt(request,"field",FIELD_USER_NAME); - if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME) - && (field!=FIELD_USER_FAMILY_NAME)) - throw new ValidationException("The field search parameter is not valid."); - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Run the actual search. - results = engine.searchForUsers(field,mode,term,offset,count); - if (find_count<0) - find_count = engine.getSearchUserCount(field,mode,term); - - } // end loadPost - -} // end class AdminFindUser diff --git a/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java b/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java deleted file mode 100644 index 0f8067e..0000000 --- a/src/com/silverwrist/venice/servlets/format/AdminModifyUserDialog.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import com.silverwrist.util.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.security.Role; - -public class AdminModifyUserDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * The photo URL control class. - *-------------------------------------------------------------------------------- - */ - - static class CDUserPhotoControl extends CDBaseFormField - { - private String linkURL; - - public CDUserPhotoControl(String name, String caption, String linkURL) - { - super(name,caption,"(click to change)",false); - this.linkURL = linkURL; - - } // end constructor - - protected CDUserPhotoControl(CDUserPhotoControl other) - { - super(other); - this.linkURL = other.linkURL; - - } // end constructor - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - if (isEnabled()) - out.write(""); - String photo = getValue(); - if (StringUtil.isStringEmpty(photo)) - photo = rdat.getPhotoNotAvailURL(); - out.write("\"\""); - if (isEnabled()) - out.write(""); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { // this is a do-nothing value - } // end validateContents - - public CDFormField duplicate() - { - return new CDUserPhotoControl(this); - - } // end clone - - public void setLinkURL(String s) - { - linkURL = s; - - } // end setLinkURL - - } // end class CDUserPhotoControl - - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String YES = "Y"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CDUserPhotoControl photo_control; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public AdminModifyUserDialog() - { - super("Modify User Account",null,"moduserform","sysadmin"); - setHiddenField("cmd","UM"); - setHiddenField("uid",""); - - addFormField(new CDFormCategoryHeader("Security Information","To change the user's password, enter a new " - + "password into the fields below.")); - addFormField(new CDPasswordFormField("pass1","Password",null,false,32,128)); - addFormField(new CDPasswordFormField("pass2","Password","(retype)",false,32,128)); - addFormField(new CDTextFormField("remind","Password reminder phrase",null,false,32,255)); - addFormField(new CDRoleListFormField("base_lvl","Base security level",null,true, - Collections.EMPTY_LIST)); - addFormField(new CDCheckBoxFormField("verify_email","E-mail address verified",null,YES)); - addFormField(new CDCheckBoxFormField("lockout","Account locked out",null,YES)); - addFormField(new CDCheckBoxFormField("nophoto","Disallow photo uploads for this user",null,YES)); - addFormField(new CDFormCategoryHeader("Name")); - addFormField(new CDTextFormField("prefix","Prefix","(Mr., Ms., etc.)",false,8,8)); - addFormField(new CDTextFormField("first","First name",null,true,32,64)); - addFormField(new CDTextFormField("mid","Middle initial",null,false,1,1)); - addFormField(new CDTextFormField("last","Last name",null,true,32,64)); - addFormField(new CDTextFormField("suffix","Suffix","(Jr., III, etc.)",false,16,16)); - addFormField(new CDFormCategoryHeader("Location")); - addFormField(new CDTextFormField("company","Company",null,false,32,255)); - addFormField(new CDTextFormField("addr1","Address",null,false,32,255)); - addFormField(new CDTextFormField("addr2","Address","(line 2)",false,32,255)); - addFormField(new CDCheckBoxFormField("pvt_addr","Hide address in profile",null,YES)); - addFormField(new CDTextFormField("loc","City",null,true,32,64)); - addFormField(new CDTextFormField("reg","State/Province",null,true,32,64)); - addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64)); - addFormField(new CDCountryListFormField("country","Country",null,true)); - addFormField(new CDFormCategoryHeader("Phone Numbers")); - addFormField(new CDTextFormField("phone","Telephone",null,false,32,32)); - addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32)); - addFormField(new CDCheckBoxFormField("pvt_phone","Hide phone/mobile numbers in profile",null,YES)); - addFormField(new CDTextFormField("fax","Fax",null,false,32,32)); - addFormField(new CDCheckBoxFormField("pvt_fax","Hide fax number in profile",null,YES)); - addFormField(new CDFormCategoryHeader("Internet")); - addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255)); - addFormField(new CDCheckBoxFormField("pvt_email","Hide e-mail address in profile",null,YES)); - addFormField(new CDTextFormField("url","Home page","(URL)",false,32,255)); - addFormField(new CDFormCategoryHeader("Personal")); - addFormField(new CDTextFormField("descr","Personal description",null,false,32,255)); - photo_control = new CDUserPhotoControl("photo","User Photo","userphoto"); - addFormField(photo_control); - addFormField(new CDFormCategoryHeader("User Preferences")); - addFormField(new CDCheckBoxFormField("pic_in_post","Display user photos next to conference posts", - "(where applicable)",YES)); - addFormField(new CDCheckBoxFormField("no_mass_mail", - "Don't send user mass E-mail from community/conference hosts", - null,YES)); - addFormField(new CDLocaleListFormField("locale","Default locale","(for formatting dates/times)",true)); - addFormField(new CDTimeZoneListFormField("tz","Default time zone",null,true)); - addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected AdminModifyUserDialog(AdminModifyUserDialog other) - { - super(other); - photo_control = (CDUserPhotoControl)modifyField("photo"); - - } // end AdminModifyUserDialog - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private void coreSetup(AdminOperations ops, AdminUserContext admuser) - { - setSubtitle("User: " + admuser.getUserName()); - setHiddenField("uid",String.valueOf(admuser.getUID())); - - CDPickListFormField level_field = (CDPickListFormField)modifyField("base_lvl"); - List role_list = ops.getAllowedRoleList(); - level_field.setChoicesList(role_list); - - // See if this level was found on the list. - Role my_role = admuser.getBaseRole(); - boolean found = false; - Iterator it = role_list.iterator(); - while (it.hasNext()) - { // seek each role in turn - Role r = (Role)(it.next()); - if (r.equals(my_role)) - { // found it! - found = true; - break; - - } // end if - - } // end while - - if (!found) - { // not in the list - set the defined "role list" to be a singleton of our current level - role_list = Collections.singletonList(my_role); - level_field.setChoicesList(role_list); - - } // end if - - } // end coreSetup - - /*-------------------------------------------------------------------------------- - * Overrides from class Object - *-------------------------------------------------------------------------------- - */ - - public Object clone() - { - return new AdminModifyUserDialog(this); - - } // end clone - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - String pass1 = getFieldValue("pass1"); - String pass2 = getFieldValue("pass2"); - - if (StringUtil.isStringEmpty(pass1)) - { // empty must match empty - if (!StringUtil.isStringEmpty(pass2)) - throw new ValidationException("The typed passwords do not match."); - - } // end if - else - { // the two passwords must match - if (!(pass1.equals(pass2))) - throw new ValidationException("The typed passwords do not match."); - - } // end if - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(AdminOperations ops, AdminUserContext admuser) throws DataException - { - coreSetup(ops,admuser); - - setFieldValue("base_lvl",String.valueOf(admuser.getBaseLevel())); - if (admuser.isEmailVerified()) - setFieldValue("verify_email",YES); - if (admuser.isLockedOut()) - setFieldValue("lockout",YES); - - ContactInfo ci = admuser.getContactInfo(); // get the main contact info - AdminUserProperties props = admuser.getProperties(); - - if (props.getDisallowPhoto()) - setFieldValue("nophoto",YES); - setFieldValue("prefix",ci.getNamePrefix()); - setFieldValue("first",ci.getGivenName()); - char init = ci.getMiddleInitial(); - if (init!=' ') - setFieldValue("mid",String.valueOf(init)); - setFieldValue("last",ci.getFamilyName()); - setFieldValue("suffix",ci.getNameSuffix()); - setFieldValue("company",ci.getCompany()); - setFieldValue("addr1",ci.getAddressLine1()); - setFieldValue("addr2",ci.getAddressLine2()); - if (ci.getPrivateAddress()) - setFieldValue("pvt_addr",YES); - setFieldValue("loc",ci.getLocality()); - setFieldValue("reg",ci.getRegion()); - setFieldValue("pcode",ci.getPostalCode()); - setFieldValue("country",ci.getCountry()); - setFieldValue("phone",ci.getPhone()); - setFieldValue("mobile",ci.getMobile()); - if (ci.getPrivatePhone()) - setFieldValue("pvt_phone",YES); - setFieldValue("fax",ci.getFax()); - if (ci.getPrivateFax()) - setFieldValue("pvt_fax",YES); - setFieldValue("email",ci.getEmail()); - if (ci.getPrivateEmail()) - setFieldValue("pvt_email",YES); - setFieldValue("url",ci.getURL()); - setFieldValue("descr",admuser.getDescription()); - setFieldValue("photo",ci.getPhotoURL()); - photo_control.setLinkURL("adminuserphoto?uid=" + admuser.getUID()); - if (props.getDisplayPostPictures()) - setFieldValue("pic_in_post",YES); - if (props.getMassMailOptOut()) - setFieldValue("no_mass_mail",YES); - setFieldValue("locale",admuser.getLocale().toString()); - setFieldValue("tz",admuser.getTimeZone().getID()); - - } // end setupDialog - - public void doDialog(AdminUserContext admuser) throws ValidationException, DataException - { - validate(); // validate the dialog - - try - { // reset the base level - admuser.setBaseLevel(Integer.parseInt(getFieldValue("base_lvl"))); - - } // end try - catch (NumberFormatException nfe) - { // this shouldn't happen - throw new InternalStateError("new_level should be an integer - form screwup"); - - } // end catch - - // Change the password if applicable. - String foo = getFieldValue("pass1"); - if (!StringUtil.isStringEmpty(foo)) - admuser.setPassword(foo,getFieldValue("remind")); - - admuser.setEmailVerified(YES.equals(getFieldValue("verify_email"))); - admuser.setLockedOut(YES.equals(getFieldValue("lockout"))); - - ContactInfo ci = admuser.getContactInfo(); // get the main contact info - AdminUserProperties props = admuser.getProperties(); - - // Reset all the contact info fields. - props.setDisallowPhoto(YES.equals(getFieldValue("nophoto"))); - ci.setNamePrefix(getFieldValue("prefix")); - ci.setGivenName(getFieldValue("first")); - foo = getFieldValue("mid"); - if ((foo==null) || (foo.length()<1)) - ci.setMiddleInitial(' '); - else - ci.setMiddleInitial(foo.charAt(0)); - ci.setFamilyName(getFieldValue("last")); - ci.setNameSuffix(getFieldValue("suffix")); - ci.setCompany(getFieldValue("company")); - ci.setAddressLine1(getFieldValue("addr1")); - ci.setAddressLine2(getFieldValue("addr2")); - ci.setPrivateAddress(YES.equals(getFieldValue("pvt_addr"))); - ci.setLocality(getFieldValue("loc")); - ci.setRegion(getFieldValue("reg")); - ci.setPostalCode(getFieldValue("pcode")); - ci.setCountry(getFieldValue("country")); - ci.setPhone(getFieldValue("phone")); - ci.setMobile(getFieldValue("mobile")); - ci.setPrivatePhone(YES.equals(getFieldValue("pvt_phone"))); - ci.setFax(getFieldValue("fax")); - ci.setPrivateFax(YES.equals(getFieldValue("pvt_fax"))); - ci.setEmail(getFieldValue("email")); - ci.setPrivateEmail(YES.equals(getFieldValue("pvt_email"))); - ci.setURL(getFieldValue("url")); - props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post"))); - props.setMassMailOptOut(YES.equals(getFieldValue("no_mass_mail"))); - - // Store the completed contact info. - admuser.putContactInfo(ci); - admuser.setProperties(props); - - // Save off the user's description and preferences. - admuser.setDescription(getFieldValue("descr")); - admuser.setLocale(International.get().createLocale(getFieldValue("locale"))); - admuser.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz"))); - - } // end doDialog - - public void resetOnError(AdminOperations ops, AdminUserContext admuser, String message) - { - coreSetup(ops,admuser); - setErrorMessage(message); - setFieldValue("pass1",null); - setFieldValue("pass2",null); - - } // end resetOnError - -} // end class AdminModifyUserDialog diff --git a/src/com/silverwrist/venice/servlets/format/AdminUserPhotoData.java b/src/com/silverwrist/venice/servlets/format/AdminUserPhotoData.java deleted file mode 100644 index a1e7eb5..0000000 --- a/src/com/silverwrist/venice/servlets/format/AdminUserPhotoData.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.awt.Dimension; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class AdminUserPhotoData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.AdminUserPhotoData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private Dimension photo_dims; - private String photo_url; - private int uid; - private String user_name; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public AdminUserPhotoData(VeniceEngine engine, AdminUserContext admuser, RenderData rdat) - throws DataException - { - photo_dims = engine.getUserPhotoSize(); - photo_url = admuser.getContactInfo().getPhotoURL(); - if (StringUtil.isStringEmpty(photo_url)) - photo_url = rdat.getPhotoNotAvailURL(); - this.uid = admuser.getUID(); - this.user_name = admuser.getUserName(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static AdminUserPhotoData retrieve(ServletRequest request) - { - return (AdminUserPhotoData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Set User Photo"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "admin_user_photo.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getUID() - { - return uid; - - } // end getUID - - public String getUserName() - { - return user_name; - - } // end getUserName - - public String getPhotoTag(RenderData rdat) - { - StringBuffer buf = new StringBuffer("\"\""); - return buf.toString(); - - } // end getPhotoTag - -} // end class AdminUserPhotoData diff --git a/src/com/silverwrist/venice/servlets/format/AttachmentForm.java b/src/com/silverwrist/venice/servlets/format/AttachmentForm.java deleted file mode 100644 index 88ad534..0000000 --- a/src/com/silverwrist/venice/servlets/format/AttachmentForm.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.htmlcheck.*; -import com.silverwrist.venice.core.*; - -public class AttachmentForm implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.AttachmentForm"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private int cid; - private int confid; - private long postid; - private String target; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public AttachmentForm(CommunityContext comm, ConferenceContext conf, TopicMessageContext msg, String target) - { - this.cid = comm.getCommunityID(); - this.confid = conf.getConfID(); - this.postid = msg.getPostID(); - this.target = target; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static AttachmentForm retrieve(ServletRequest request) - { - return (AttachmentForm)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Upload Attachment"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "attach_form.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getCommunityID() - { - return cid; - - } // end getCommunityID - - public int getConfID() - { - return confid; - - } // end getConfID - - public long getPostID() - { - return postid; - - } // end getPostID - - public String getTarget() - { - return target; - - } // end getTarget - -} // end class AttachmentForm diff --git a/src/com/silverwrist/venice/servlets/format/BaseJSPData.java b/src/com/silverwrist/venice/servlets/format/BaseJSPData.java deleted file mode 100644 index 977ea86..0000000 --- a/src/com/silverwrist/venice/servlets/format/BaseJSPData.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.servlets.Variables; -import com.silverwrist.venice.servlets.format.menus.LeftMenu; - -public class BaseJSPData -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - protected static final String ATTR_NAME = "com.silverwrist.venice.BaseJSPData"; - - private static Category logger = Category.getInstance(BaseJSPData.class.getName()); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; // the Venice engine - private UserContext user; // user context - private String location; // location string to use for this page - private VeniceContent content; // the actual content - private boolean login_links = true; // show login links up top? - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public BaseJSPData(VeniceEngine engine, UserContext user, String location, VeniceContent content) - { - this.engine = engine; - this.user = user; - this.location = location; - this.content = content; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static operations - *-------------------------------------------------------------------------------- - */ - - public static BaseJSPData retrieve(ServletRequest request) - { - return (BaseJSPData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTitle(RenderData rdat) - { - if (content==null) - return ""; - else - return content.getPageTitle(rdat); - - } // end getTitle - - public String getPageQID() - { - if (content==null) - return null; - else - return content.getPageQID(); - - } // end getPageQID - - public boolean locationSpecified() - { - return (location!=null); - - } // end if - - public String getLocation() - { - return location; - - } // end getLocation - - public boolean displayLoginLinks() - { - return login_links && (location!=null); - - } // end displayLoginLinks - - public void displayLoginLinks(boolean value) - { - login_links = value; - - } // end displayLoginLinks - - public void transfer(ServletContext ctxt, RenderData rdat) throws IOException, ServletException - { - rdat.storeBaseJSPData(this); - RequestDispatcher dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath("base.jsp")); - rdat.forwardDispatch(dispatcher); - - } // end transfer - - public void renderBannerAd(Writer out, RenderData rdat) throws IOException - { - Advertisement advert; - if (user.isLoggedIn()) - advert = user.selectAd(); - else - advert = engine.selectAd(); - if (advert==null) - { // no advert found - bail out now! - out.write(" "); - return; - - } // end if - - String full_image_path; - if (advert.getImagePathStyle()==Advertisement.CONTEXT_RELATIVE) - { // return the full image path - full_image_path = rdat.getContextRelativePath(advert.getImagePath()); - - } // end if - else - { // can't render the ad - just punt - out.write(" "); - return; - - } // end else - - // Write the banner ad. - String url = advert.getLinkURL(); - String capt = advert.getCaption(); - if (url!=null) - out.write(""); - out.write("\"");"); - if (url!=null) - out.write(""); - - } // end renderBannerAd - - public void renderMenu(HttpSession session, Writer out, RenderData rdat) throws IOException - { - ComponentRender menu = Variables.getMenu(session); - if (menu==null) - menu = (ComponentRender)(rdat.getLeftMenu("top")); - menu.renderHere(out,rdat); - - } // end renderMenu - - public void renderFixedMenu(Writer out, RenderData rdat) throws IOException - { - ComponentRender menu = (ComponentRender)(rdat.getLeftMenu("fixed")); - menu.renderHere(out,rdat); - - } // end renderFixedMenu - - public void renderContent(ServletContext ctxt, Writer out, RenderData rdat) - throws IOException, ServletException - { - if (content==null) - { // there is no content! - new ErrorBox(null,"Internal Error: There is no content available",null).renderHere(out,rdat); - return; - - } // end if - - if (content instanceof ContentRender) - { // we have an old-style ContentRender - ContentRender cr = (ContentRender)content; - cr.renderHere(out,rdat); - return; - - } // end if - else if (content instanceof JSPRender) - { // we have a JSP-rendered page - include it - JSPRender jr = (JSPRender)content; - rdat.storeJSPRender(jr); - RequestDispatcher dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath(jr.getTargetJSPName())); - out.flush(); - rdat.flushOutput(); // make sure the stuff to be output first is output - rdat.includeDispatch(dispatcher); - rdat.flushOutput(); // now make sure the included page is properly flushed - return; - - } // end else if - else // this is the fallback if we don't recognize the content - new ErrorBox(null,"Internal Error: Content of invalid type",null).renderHere(out,rdat); - - } // end renderContent - -} // end class BaseJSPData diff --git a/src/com/silverwrist/venice/servlets/format/CDBaseFormFieldReverse.java b/src/com/silverwrist/venice/servlets/format/CDBaseFormFieldReverse.java deleted file mode 100644 index 6771843..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDBaseFormFieldReverse.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; - -public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String name; - private String caption; - private String caption2; - private boolean required; - private String value = null; - private boolean enabled; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - protected CDBaseFormFieldReverse(String name, String caption, String caption2, boolean required) - { - this.name = name; - this.caption = caption; - this.caption2 = caption2; - this.required = required; - this.enabled = true; - - } // end constructor - - protected CDBaseFormFieldReverse(CDBaseFormFieldReverse other) - { - this.name = other.name; - this.caption = other.caption; - this.caption2 = other.caption2; - this.required = other.required; - this.enabled = true; - // N.B.: do NOT copy value! - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal operations - *-------------------------------------------------------------------------------- - */ - - protected final String getCaption() - { - return caption; - - } // end getCaption - - /*-------------------------------------------------------------------------------- - * Abstract functions which MUST be overriden - *-------------------------------------------------------------------------------- - */ - - protected abstract void renderActualField(Writer out, RenderData rdat) - throws IOException; - - /*-------------------------------------------------------------------------------- - * Overridable operations - *-------------------------------------------------------------------------------- - */ - - protected void validateContents(String value) throws ValidationException - { // this is a do-nothing value - } // end validateContents - - /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - out.write("\n"); - renderActualField(out,rdat); - out.write("\n" - + StringUtil.encodeHTML(caption)); - if (caption2!=null) - out.write(" " + StringUtil.encodeHTML(caption2)); - out.write(""); - if (required) - out.write(rdat.getRequiredBullet()); - out.write("\n\n"); - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField - *-------------------------------------------------------------------------------- - */ - - public String getName() - { - return name; - - } // end getName - - public String getValue() - { - return value; - - } // end getValue - - public void setValue(String value) - { - this.value = value; - - } // end setValue - - public Object getObjValue() - { - return value; - - } // end getObjValue - - public void setObjValue(Object obj) - { - this.value = obj.toString(); - - } // end setObjValue - - public boolean isRequired() - { - return required; - - } // end isRequired - - public CDCommandButton findButton(String name) - { - return null; - - } // end findButton - - public void validate() throws ValidationException - { - if (required && enabled && StringUtil.isStringEmpty(value)) - throw new ValidationException("The '" + caption + "' field is required."); - validateContents(value); - - } // end validate - - public boolean isEnabled() - { - return enabled; - - } // end isEnabled - - public void setEnabled(boolean flag) - { - enabled = flag; - - } // end setEnabled - -} // end CDBaseFormFieldReverse diff --git a/src/com/silverwrist/venice/servlets/format/CDCommandButton.java b/src/com/silverwrist/venice/servlets/format/CDCommandButton.java deleted file mode 100644 index aae5f26..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDCommandButton.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import javax.servlet.ServletRequest; - -public interface CDCommandButton extends ComponentRender -{ - public abstract String getName(); - - public abstract boolean isClicked(ServletRequest request); - -} // end interface CDCommandButton diff --git a/src/com/silverwrist/venice/servlets/format/CDImageButton.java b/src/com/silverwrist/venice/servlets/format/CDImageButton.java deleted file mode 100644 index 15639dc..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDImageButton.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import javax.servlet.ServletRequest; - -public class CDImageButton implements CDCommandButton -{ - private String name; // name of the button field - private String image; // image file to output - private String alt_text; // alt text to output - private int width; // width of button image - private int height; // height of button image - - public CDImageButton(String name, String image, String alt_text, int width, int height) - { - this.name = name; - this.image = image; - this.alt_text = alt_text; - this.width = width; - this.height = height; - - } // end constructor - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - out.write(""); - - } // end renderHere - - public String getName() - { - return name; - - } // end getName - - public boolean isClicked(ServletRequest request) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isClicked - -} // end class CDImageButton diff --git a/src/com/silverwrist/venice/servlets/format/CDIntegerFormField.java b/src/com/silverwrist/venice/servlets/format/CDIntegerFormField.java deleted file mode 100644 index cb2c703..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDIntegerFormField.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import com.silverwrist.venice.except.ValidationException; - -public class CDIntegerFormField extends CDTextFormField -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final double LN10 = Math.log(10.0); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private int min_value; - private int max_value; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CDIntegerFormField(String name, String caption, String caption2, int min, int max) - { - super(name,caption,caption2,true,numDigits(min,max),numDigits(min,max)); - this.min_value = min; - this.max_value = max; - - } // end constructor - - protected CDIntegerFormField(CDIntegerFormField other) - { - super(other); - this.min_value = other.min_value; - this.max_value = other.max_value; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal operations - *-------------------------------------------------------------------------------- - */ - - private static int numDigits(int v) - { - if (v==0) - return 1; - else if (v>0) - return 1 + (int)(Math.floor(Math.log((double)v) / LN10)); - else - return 2 + (int)(Math.floor(Math.log((double)(-v)) / LN10)); - - } // end numDigits - - private static int numDigits(int min, int max) - { - return Math.max(Math.max(numDigits(min),numDigits(max)),2); - - } // end numDigits - - /*-------------------------------------------------------------------------------- - * Overrides from class CDTextFormField - *-------------------------------------------------------------------------------- - */ - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - super.renderActualField(out,rdat); - out.write(" (" + min_value + " - " + max_value + ")"); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { - super.validateContents(value); - try - { // convert to an integer and check against range - int x = Integer.parseInt(value); - if ((min_value>Integer.MIN_VALUE) && (xmax_value)) - throw new ValidationException("The value of the '" + getCaption() - + "' field must be less than or equal to " + max_value + "."); - - } // end try - catch (NumberFormatException nfe) - { // integer conversion failed - throw new ValidationException("Invalid non-numeric character in the '" + getCaption() + "' field."); - - } // end catch - - } // end validateContents - - /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField - *-------------------------------------------------------------------------------- - */ - - public Object getObjValue() - { - try - { // build an Integer and return it - return new Integer(getValue()); - - } // end try - catch (NumberFormatException nfe) - { // shouldn't happen - return null; - - } // end catch - - } // end getObjValue - - public CDFormField duplicate() - { - return new CDIntegerFormField(this); - - } // end clone - -} // end class CDIntegerFormField diff --git a/src/com/silverwrist/venice/servlets/format/CDPasswordFormField.java b/src/com/silverwrist/venice/servlets/format/CDPasswordFormField.java deleted file mode 100644 index 8a3dc2d..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDPasswordFormField.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.venice.except.ValidationException; - -public class CDPasswordFormField extends CDBaseFormField -{ - private int size; - private int maxlength; - - public CDPasswordFormField(String name, String caption, String caption2, boolean required, - int size, int maxlength) - { - super(name,caption,caption2,required); - this.size = size; - this.maxlength = maxlength; - - } // end constructor - - protected CDPasswordFormField(CDPasswordFormField other) - { - super(other); - this.size = other.size; - this.maxlength = other.maxlength; - - } // end constructor - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - out.write(""); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { // this is a do-nothing value - } // end validateContents - - public CDFormField duplicate() - { - return new CDPasswordFormField(this); - - } // end clone - -} // end class CDPasswordFormField diff --git a/src/com/silverwrist/venice/servlets/format/CDPasswordFormFieldCommand.java b/src/com/silverwrist/venice/servlets/format/CDPasswordFormFieldCommand.java deleted file mode 100644 index 7066b1b..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDPasswordFormFieldCommand.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import javax.servlet.ServletRequest; - -public class CDPasswordFormFieldCommand extends CDPasswordFormField -{ - private CDCommandButton button; - - public CDPasswordFormFieldCommand(String name, String caption, String caption2, boolean required, - int size, int maxlength, CDCommandButton button) - { - super(name,caption,caption2,required,size,maxlength); - this.button = button; - - } // end constructor - - protected CDPasswordFormFieldCommand(CDPasswordFormFieldCommand other) - { - super(other); - this.button = other.button; - - } // end constructor - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - super.renderActualField(out,rdat); - if (button!=null) - { // add the button - out.write("  "); - button.renderHere(out,rdat); - - } // end if - - } // end renderActualField - - public CDCommandButton findButton(String name) - { - if ((button!=null) && (button.getName().equals(name))) - return button; - else - return super.findButton(name); - - } // end findButton - - public CDFormField duplicate() - { - return new CDPasswordFormFieldCommand(this); - - } // end clone - -} // end class CDPasswordFormFieldCommand diff --git a/src/com/silverwrist/venice/servlets/format/CDSimplePickListFormField.java b/src/com/silverwrist/venice/servlets/format/CDSimplePickListFormField.java deleted file mode 100644 index f4dca99..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDSimplePickListFormField.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.List; -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.util.StringUtil; - -public class CDSimplePickListFormField extends CDPickListFormField -{ - private char separator; - - public CDSimplePickListFormField(String name, String caption, String caption2, boolean required, - List string_list, char separator) - { - super(name,caption,caption2,required,string_list); - this.separator = separator; - - } // end constructor - - protected CDSimplePickListFormField(CDSimplePickListFormField other) - { - super(other); - this.separator = other.separator; - - } // end constructor - - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException - { - String full = (String)obj; - int breakpt = full.indexOf(separator); - String val = full.substring(0,breakpt); - out.write("\n"); - - } // end renderChoice - - public CDFormField duplicate() - { - return new CDSimplePickListFormField(this); - - } // end duplicate - -} // end class CDSimplePickListFormField diff --git a/src/com/silverwrist/venice/servlets/format/CDTextFormField.java b/src/com/silverwrist/venice/servlets/format/CDTextFormField.java deleted file mode 100644 index 635ad84..0000000 --- a/src/com/silverwrist/venice/servlets/format/CDTextFormField.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.venice.except.ValidationException; - -public class CDTextFormField extends CDBaseFormField -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private int size; - private int maxlength; - private int real_maxlength; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CDTextFormField(String name, String caption, String caption2, boolean required, - int size, int maxlength) - { - super(name,caption,caption2,required); - this.size = Math.max(size,2); - this.maxlength = Math.max(maxlength,2); - this.real_maxlength = maxlength; - - } // end constructor - - protected CDTextFormField(CDTextFormField other) - { - super(other); - this.size = other.size; - this.maxlength = other.maxlength; - this.real_maxlength = other.real_maxlength; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class CDBaseFormField - *-------------------------------------------------------------------------------- - */ - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - out.write(""); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { - if (value.length()>real_maxlength) - throw new ValidationException("The value of the '" + getCaption() + "' field must be no longer than " - + real_maxlength + " characters."); - - } // end validateContents - - /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField - *-------------------------------------------------------------------------------- - */ - - public CDFormField duplicate() - { - return new CDTextFormField(this); - - } // end clone - -} // end class CDTextFormField diff --git a/src/com/silverwrist/venice/servlets/format/CommunityAdminTop.java b/src/com/silverwrist/venice/servlets/format/CommunityAdminTop.java deleted file mode 100644 index dbdfdfa..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityAdminTop.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.venice.core.CommunityContext; - -public class CommunityAdminTop extends ContentMenuPanel -{ - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CommunityAdminTop() - { - super("Community Administration:",null); - addChoice("Community Profile","sigadmin?sig=$s&cmd=P"); - addChoice("Set Community Category","sigadmin?sig=$s&cmd=T"); - addChoice("Set Community Features","sigadmin?sig=$s&cmd=F"); - addChoice("Membership Control","sigadmin?sig=$s&cmd=M"); - addChoice("E-Mail To All Members","sigadmin?sig=$s&cmd=I"); - addChoice("Display Audit Records","sigadmin?sig=$s&cmd=A"); - // TODO: More options - addChoice("Delete Community","sigadmin?sig=$s&cmd=DEL"); - - } // end constructor - - protected CommunityAdminTop(CommunityAdminTop other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setCommunity(CommunityContext comm) - { - setSubtitle(comm.getName()); - setParameter("s",String.valueOf(comm.getCommunityID())); - - } // end setCommunity - - public Object clone() - { - return new CommunityAdminTop(this); - - } // end clone - -} // end class CommunityAdminTop diff --git a/src/com/silverwrist/venice/servlets/format/CommunityCategoryBrowseData.java b/src/com/silverwrist/venice/servlets/format/CommunityCategoryBrowseData.java deleted file mode 100644 index 59e567d..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityCategoryBrowseData.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CommunityCategoryBrowseData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityCategoryBrowseData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String name; - private String base_applet; - private CategoryDescriptor prev_cat; - private CategoryDescriptor curr_cat; - private List subcats; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public CommunityCategoryBrowseData(UserContext user, CommunityContext comm, int current_id) - throws DataException - { - name = comm.getName(); - base_applet = "sigadmin?sig=" + String.valueOf(comm.getCommunityID()); - prev_cat = comm.getCategory(); - if (prev_cat.getCategoryID()==current_id) - curr_cat = prev_cat; - else - curr_cat = user.getCategoryDescriptor(current_id); - subcats = curr_cat.getSubCategories(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityCategoryBrowseData retrieve(ServletRequest request) - { - return (CommunityCategoryBrowseData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Set Community Category"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "commcatbrowser.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getCommunityName() - { - return name; - - } // end if - - public String getCancelURL(RenderData rdat) - { - return rdat.getEncodedServletPath(base_applet); - - } // end getCancelURL - - public String getPreviousCategory() - { - return prev_cat.toString(); - - } // end getPreviousCategory - - public CategoryDescriptor getCurrentCategory() - { - return curr_cat; - - } // end getCurrentCategory - - public String getGoLink(RenderData rdat, int catid) - { - return rdat.getEncodedServletPath(base_applet + "&cmd=T&go=" + String.valueOf(catid)); - - } // end getGoLink - - public String getSetLink(RenderData rdat, int catid) - { - return rdat.getEncodedServletPath(base_applet + "&cmd=T&set=" + String.valueOf(catid)); - - } // end getGoLink - - public Iterator getSubcategoryIterator() - { - return subcats.iterator(); - - } // end getSubcategoryIterator - - public boolean hasSubcategories() - { - return (subcats.size()>0); - - } // end hasSubcategories - -} // end class CommunityCategoryBrowseData diff --git a/src/com/silverwrist/venice/servlets/format/CommunityEMail.java b/src/com/silverwrist/venice/servlets/format/CommunityEMail.java deleted file mode 100644 index a4d6786..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityEMail.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CommunityEMail implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityEMail"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CommunityEMail(CommunityContext comm) - { - this.comm = comm; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityEMail retrieve(ServletRequest request) - { - return (CommunityEMail)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Community E-Mail: " + comm.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "comm_email.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final String getCommunityName() - { - return comm.getName(); - - } // end getCommunityName - -} // end class CommunityEMail diff --git a/src/com/silverwrist/venice/servlets/format/CommunityLogoData.java b/src/com/silverwrist/venice/servlets/format/CommunityLogoData.java deleted file mode 100644 index 861d869..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityLogoData.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.awt.Dimension; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CommunityLogoData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityLogoData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private int cid; - private Dimension logo_dims; - private String logo_url; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public CommunityLogoData(VeniceEngine engine, CommunityContext comm, RenderData rdat) - throws DataException - { - cid = comm.getCommunityID(); - logo_dims = engine.getCommunityLogoSize(); - logo_url = comm.getContactInfo().getPhotoURL(); - if (StringUtil.isStringEmpty(logo_url)) - logo_url = rdat.getFullImagePath("sig_other.jpg"); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityLogoData retrieve(ServletRequest request) - { - return (CommunityLogoData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Set Community Logo"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "comm_logo.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getCommunityID() - { - return cid; - - } // end getCommunityID - - public String getLogoTag(RenderData rdat) - { - StringBuffer buf = new StringBuffer("\"\""); - return buf.toString(); - - } // end getLogoTag - -} // end class CommunityLogoData diff --git a/src/com/silverwrist/venice/servlets/format/CommunityMembership.java b/src/com/silverwrist/venice/servlets/format/CommunityMembership.java deleted file mode 100644 index 4c380da..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityMembership.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CommunityMembership implements JSPRender, SearchMode -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityMembership"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; // reference to the engine - private CommunityContext comm; // the community we're in - private List display_list = null; // list of members to display - private boolean comm_members = false; // is this a list of community members? - private int field = -1; // search field - private int mode = -1; // search mode - private String term = null; // search term - private int offset = 0; // search result offset - private int find_count = -1; // search results count - private List role_choices; // the list of security roles - private Role role_comm_host; // the "Community Host" security role - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CommunityMembership(VeniceEngine engine, CommunityContext comm) - { - this.engine = engine; - this.comm = comm; - SecurityInfo sinf = comm.getSecurityInfo(); - this.role_choices = sinf.getRoleList("Community.UserLevels"); - this.role_comm_host = sinf.getRole("Community.Host"); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, return default - return default_val; - - } // end catch - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityMembership retrieve(ServletRequest request) - { - return (CommunityMembership)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Membership in Community " + comm.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "comm_member.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void doCommunityMemberList() throws DataException - { - this.display_list = comm.getMemberList(); - this.comm_members = true; - this.term = ""; - - } // end doCommunityMemberList - - public void doSearch(ServletRequest request) throws ValidationException, DataException, AccessError - { - // Validate the search field parameter. - field = getParamInt(request,"field",FIELD_USER_NAME); - if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME) - && (field!=FIELD_USER_FAMILY_NAME)) - throw new ValidationException("The field search parameter is not valid."); - - // Validate the search mode parameter. - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); - - // Retrieve the search term parameter. - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Perform the search! - List intermediate = engine.searchForUsers(field,mode,term,offset,count); - if (find_count<0) - find_count = engine.getSearchUserCount(field,mode,term); - - // Create the real display list by getting the community security levels. - Iterator it = intermediate.iterator(); - Vector rc = new Vector(count+1); - while (it.hasNext()) - { // loop around and find the member level of every one - UserFound uf = (UserFound)(it.next()); - int new_level = comm.getMemberLevel(uf.getUID()); - if (new_level==-1) - new_level = 0; - rc.add(uf.createNewLevel(new_level)); - - } // end while - - display_list = rc; // save display list for display - - } // end doSearch - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public String getCommunityName() - { - return comm.getName(); - - } // end getCommunityName - - public String getLocator() - { - return "sig=" + comm.getCommunityID(); - - } // end getLocator - - public boolean displayList() - { - if ((display_list==null) || (display_list.size()==0)) - return false; - if (comm_members && (display_list.size()>engine.getMaxNumCommunityMembersDisplay())) - return false; - return true; - - } // end displayList - - public boolean isCommunityMemberList() - { - return comm_members; - - } // end isCommunityMemberList - - public int getSearchField() - { - return field; - - } // end getSearchField - - public int getSearchMode() - { - return mode; - - } // end getSearchMode - - public boolean searchFieldIs(int value) - { - return (field==value); - - } // end searchFieldIs - - public boolean searchModeIs(int value) - { - return (mode==value); - - } // end searchModeIs - - public String getSearchTerm() - { - return term; - - } // end getSearchTerm - - public int getFindCount() - { - return find_count; - - } // end getFindCount - - public int getOffset() - { - return offset; - - } // end getOffset - - public int getSize() - { - return display_list.size(); - - } // end getSize - - public int getNumResultsDisplayed() - { - return engine.getStdNumSearchResults(); - - } // end getNumResultsDisplayed - - public UserFound getItem(int ndx) - { - return (UserFound)(display_list.get(ndx)); - - } // end getItem - - public void outputDropDown(Writer out, int uid, int cur_level) throws IOException - { - out.write("\n"); - out.write("\n"); - - } // end outputDropDown - -} // end class CommunityMembership diff --git a/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java b/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java deleted file mode 100644 index 3ece3fc..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityProfileData.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import javax.servlet.ServletRequest; -import com.silverwrist.util.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CommunityProfileData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityProfileData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; // the Venice engine - private UserContext user; // the current user managing this - private CommunityContext comm; // the community being displayed - private ContactInfo ci; // community's contact info - private UserProfile host_prof; // community host's user profile - private CategoryDescriptor cat; // community's full category descriptor - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public CommunityProfileData(VeniceEngine engine, UserContext user, CommunityContext ctxt) - throws DataException - { - this.engine = engine; - this.user = user; - this.comm = ctxt; - this.ci = ctxt.getContactInfo(); - this.host_prof = ctxt.getHostProfile(); - this.cat = ctxt.getCategory(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityProfileData retrieve(ServletRequest request) - { - return (CommunityProfileData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Community Profile: " + comm.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return "go/" + comm.getAlias() + "!"; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "commprofile.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public CommunityContext getCommunityContext() - { - return comm; - - } // end getCommunityContext - - public String getCommunityLogoURL(RenderData rdat) - { - String tmp = ci.getPhotoURL(); - if (StringUtil.isStringEmpty(tmp)) - tmp = rdat.getFullImagePath("sig_other.jpg"); - return tmp; - - } // end getCommunityLogoURL - - public boolean isUserLoggedIn() - { - return user.isLoggedIn(); - - } // end isUserLoggedIn - - public String getHostUserName() - { - return host_prof.getUserName(); - - } // end getHostUserName - - public ContactInfo getCommunityContactInfo() - { - return ci; - - } // end getCommunityContactInfo - - public String getAddressLastLine() - { - String tmp_c = ci.getLocality(); - String tmp_s = ci.getRegion(); - StringBuffer buf = new StringBuffer(); - if (!(StringUtil.isStringEmpty(tmp_c)) && !(StringUtil.isStringEmpty(tmp_s))) - buf.append(tmp_c).append(", ").append(tmp_s); - else if (!(StringUtil.isStringEmpty(tmp_c))) - buf.append(tmp_c); - else if (!(StringUtil.isStringEmpty(tmp_s))) - buf.append(tmp_s); - tmp_s = ci.getPostalCode(); - if (!(StringUtil.isStringEmpty(tmp_s))) - buf.append(' ').append(tmp_s); - return buf.toString(); - - } // end getAddressLastLine - - public String getFullCountry() - { - Country c = International.get().getCountryForCode(ci.getCountry()); - return ((c==null) ? null : c.getName()); - - } // end getFullCountry - - public CategoryDescriptor getCategory() - { - return cat; - - } // end getCategory - -} // end class CommunityProfileData diff --git a/src/com/silverwrist/venice/servlets/format/CommunityWelcome.java b/src/com/silverwrist/venice/servlets/format/CommunityWelcome.java deleted file mode 100644 index 9282f85..0000000 --- a/src/com/silverwrist/venice/servlets/format/CommunityWelcome.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.CommunityContext; - -public class CommunityWelcome implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.CommunityWelcome"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String name; - private String entry_url; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public CommunityWelcome(CommunityContext comm) - { - name = comm.getName(); - entry_url = "sig/" + comm.getAlias(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static CommunityWelcome retrieve(ServletRequest request) - { - return (CommunityWelcome)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Welcome to " + name; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "commwelcome.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getCommunityName() - { - return name; - - } // end getCommunityName - - public String getEntryURL(RenderData rdat) - { - return rdat.getEncodedServletPath(entry_url); - - } // end getEntryURL - -} // end class CommunityWelcome diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceActivity.java b/src/com/silverwrist/venice/servlets/format/ConferenceActivity.java deleted file mode 100644 index e329238..0000000 --- a/src/com/silverwrist/venice/servlets/format/ConferenceActivity.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceActivity implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceActivity"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private TopicContext topic; // the topic being listed - private boolean posters; // is this a list of posters? - private List records; // the actual data records - private String locator = null; // our locator - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ConferenceActivity(CommunityContext comm, ConferenceContext conf, TopicContext topic, boolean posters) - throws DataException, AccessError - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - this.posters = posters; - if (topic!=null) - { // do the report on the topic - if (posters) - this.records = topic.getActivePosters(); - else - this.records = topic.getActiveReaders(); - - } // end if - else - { // do the report on the conference - if (posters) - this.records = conf.getActivePosters(); - else - this.records = conf.getActiveReaders(); - - } // end else - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ConferenceActivity retrieve(ServletRequest request) - { - return (ConferenceActivity)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - if (topic!=null) - { // it's a topic report - if (posters) - return "Users Posting in Topic " + topic.getName(); - else - return "Users Reading Topic " + topic.getName(); - - } // end if - else - { // it's a conference report - if (posters) - return "Users Posting in Conference " + conf.getName(); - else - return "Users Reading Conference " + conf.getName(); - - } // end else - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "conf_activity.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getConfName() - { - return conf.getName(); - - } // end getConfName - - public String getTopicName() - { - if (topic==null) - return null; - else - return topic.getName(); - - } // end getTopicName - - public String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - return locator; - - } // end getLocator - - public boolean isTopicReport() - { - return (topic!=null); - - } // end isTopicReport - - public boolean isPosterReport() - { - return posters; - - } // end isPosterReport - - public boolean anyElements() - { - return (records.size()>0); - - } // end anyElements - - public Iterator getRecordsIterator() - { - return records.iterator(); - - } // end getRecordsIterator - -} // end class ConferenceActivity diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceCustomBlocks.java b/src/com/silverwrist/venice/servlets/format/ConferenceCustomBlocks.java deleted file mode 100644 index 242e967..0000000 --- a/src/com/silverwrist/venice/servlets/format/ConferenceCustomBlocks.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceCustomBlocks implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceCustomBlocks"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being diddled with - private String top_custom; // the top custom block - private String bottom_custom; // the bottom custom block - private String locator = null; // locator string - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ConferenceCustomBlocks(CommunityContext comm, ConferenceContext conf) throws DataException - { - this.comm = comm; - this.conf = conf; - this.top_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); - this.bottom_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ConferenceCustomBlocks retrieve(ServletRequest request) - { - return (ConferenceCustomBlocks)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Customize Conference: " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "conf_custom.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConferenceID() - { - return conf.getConfID(); - - } // end getConferenceID - - public final String getConferenceName() - { - return conf.getName(); - - } // end getConferenceName - - public final String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - return locator; - - } // end getLocator - - public final String getTopCustomBlock() - { - return (top_custom==null) ? "" : StringUtil.encodeHTML(top_custom); - - } // end getTopCustomBlock - - public final String getBottomCustomBlock() - { - return (bottom_custom==null) ? "" : StringUtil.encodeHTML(bottom_custom); - - } // end getBottomCustomBlock - -} // end class ConferenceCustomBlocks diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceEMail.java b/src/com/silverwrist/venice/servlets/format/ConferenceEMail.java deleted file mode 100644 index ce7a264..0000000 --- a/src/com/silverwrist/venice/servlets/format/ConferenceEMail.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.IOException; -import java.io.Writer; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceEMail implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceEMail"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private List topics; // list of topics in that conference - private String locator = null; // locator string - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ConferenceEMail(CommunityContext comm, ConferenceContext conf) throws DataException, AccessError - { - this.comm = comm; - this.conf = conf; - this.topics = conf.getTopicList(ConferenceContext.DISPLAY_ALL,ConferenceContext.SORT_NAME); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ConferenceEMail retrieve(ServletRequest request) - { - return (ConferenceEMail)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Conference E-Mail: " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "conf_email.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConferenceID() - { - return conf.getConfID(); - - } // end getConferenceID - - public final String getConferenceName() - { - return conf.getName(); - - } // end getConferenceName - - public final String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - return locator; - - } // end getLocator - - public final void writeTopicChoices(Writer out) throws IOException - { - out.write("\n"); - Iterator it = topics.iterator(); - while (it.hasNext()) - { // write out the entire topic list as a drop-down list - TopicContext topic = (TopicContext)(it.next()); - out.write("\n"); - - } // end while - - } // end writeTopicChoices - -} // end class ConferenceEMail diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceListing.java b/src/com/silverwrist/venice/servlets/format/ConferenceListing.java deleted file mode 100644 index 454b162..0000000 --- a/src/com/silverwrist/venice/servlets/format/ConferenceListing.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceListing implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceListing"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; - private List conferences; - private List[] hosts; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ConferenceListing(CommunityContext comm) throws DataException, AccessError - { - this.comm = comm; - this.conferences = comm.getConferences(); - this.hosts = new List[this.conferences.size()]; - for (int i=0; i. - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceMembership implements JSPRender, SearchMode -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceMembership"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; // reference to the engine - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private List display_list = null; // list of members to display - private boolean conf_members = false; // is this a list of conference members? - private int field = -1; // search field - private int mode = -1; // search mode - private String term = null; // search term - private int offset = 0; // search result offset - private int find_count = -1; // search results count - private List role_choices; // the list of security roles - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public ConferenceMembership(VeniceEngine engine, CommunityContext comm, ConferenceContext conf) - { - this.engine = engine; - this.comm = comm; - this.conf = conf; - this.role_choices = conf.getSecurityInfo().getRoleList("Conference.UserLevels"); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, return default - return default_val; - - } // end catch - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ConferenceMembership retrieve(ServletRequest request) - { - return (ConferenceMembership)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Membership in Conference " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "conf_member.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void doConferenceMemberList() throws DataException, AccessError - { - this.display_list = conf.getMemberList(); - this.conf_members = true; - this.term = ""; - - } // end doConferenceMemberList - - public void doSearch(ServletRequest request) throws ValidationException, DataException, AccessError - { - // Validate the search field parameter. - field = getParamInt(request,"field",FIELD_USER_NAME); - if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME) - && (field!=FIELD_USER_FAMILY_NAME)) - throw new ValidationException("The field search parameter is not valid."); - - // Validate the search mode parameter. - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); - - // Retrieve the search term parameter. - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Perform the search! - List intermediate = comm.searchForMembers(field,mode,term,offset,count); - if (find_count<0) - find_count = comm.getSearchMemberCount(field,mode,term); - - // Create the real display list by getting the conference security levels. - Iterator it = intermediate.iterator(); - Vector rc = new Vector(count+1); - while (it.hasNext()) - { // loop around and find the member level of every one - UserFound uf = (UserFound)(it.next()); - int new_level = conf.getMemberLevel(uf.getUID()); - if (new_level==-1) - new_level = 0; - rc.add(uf.createNewLevel(new_level)); - - } // end while - - display_list = rc; // save display list for display - - } // end doSearch - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public String getCommunityName() - { - return comm.getName(); - - } // end getCommunityName - - public String getConfName() - { - return conf.getName(); - - } // end getConfName - - public String getLocator() - { - return "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - } // end getLocator - - public boolean displayList() - { - if ((display_list==null) || (display_list.size()==0)) - return false; - if (conf_members && (display_list.size()>engine.getMaxNumConferenceMembersDisplay())) - return false; - return true; - - } // end displayList - - public boolean conferenceMemberList() - { - return conf_members; - - } // end conferenceMemberList - - public int getSearchField() - { - return field; - - } // end getSearchField - - public int getSearchMode() - { - return mode; - - } // end getSearchMode - - public boolean searchFieldIs(int value) - { - return (field==value); - - } // end searchFieldIs - - public boolean searchModeIs(int value) - { - return (mode==value); - - } // end searchModeIs - - public String getSearchTerm() - { - return term; - - } // end getSearchTerm - - public int getFindCount() - { - return find_count; - - } // end getFindCount - - public int getOffset() - { - return offset; - - } // end getOffset - - public int getSize() - { - return display_list.size(); - - } // end getSize - - public int getNumResultsDisplayed() - { - return engine.getStdNumSearchResults(); - - } // end getNumResultsDisplayed - - public UserFound getItem(int ndx) - { - return (UserFound)(display_list.get(ndx)); - - } // end getItem - - public void outputDropDown(Writer out, int uid, int cur_level) throws IOException - { - out.write("\n"); - out.write("\n"); - - } // end outputDropDown - -} // end class ConferenceMembership diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceSequence.java b/src/com/silverwrist/venice/servlets/format/ConferenceSequence.java deleted file mode 100644 index 196446f..0000000 --- a/src/com/silverwrist/venice/servlets/format/ConferenceSequence.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ConferenceSequence implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ConferenceSequence"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; - private List conf_list; - private Hashtable hidden_stat = new Hashtable(); - private Hashtable next_id = new Hashtable(); - private Hashtable prev_id = new Hashtable(); - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ConferenceSequence(CommunityContext comm) throws DataException, AccessError - { - this.comm = comm; - this.conf_list = comm.getConferences(); - - Integer last_id = null; - for (int i=0; i. - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import java.io.Writer; -import java.io.IOException; -import javax.servlet.ServletRequest; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; - -public class ContentDialog implements Cloneable, ContentRender, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String title; // dialog title - private String subtitle; // dialog subtitle - private String formname; // name of the built-in form - private String action; // action applet - private String error_message = null; // error message - private String instructions = null; // instructions - private Hashtable hidden_fields; // list of all hidden fields & values - private Hashtable command_buttons; // command buttons by name - private Vector command_order; // command buttons in order (left to right) - private Hashtable form_fields; // form fields by name - private Vector form_order; // form fields in order (top to bottom) - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public ContentDialog(String title, String subtitle, String formname, String action) - { - this.title = title; - this.subtitle = subtitle; - this.formname = formname; - this.action = action; - hidden_fields = new Hashtable(); - command_buttons = new Hashtable(); - command_order = new Vector(); - form_fields = new Hashtable(); - form_order = new Vector(); - - } // end constructor - - protected ContentDialog(ContentDialog other) - { - this.title = other.title; - this.subtitle = other.subtitle; - this.formname = other.formname; - this.action = other.action; - this.instructions = other.instructions; - this.hidden_fields = (Hashtable)(other.hidden_fields.clone()); - command_buttons = new Hashtable(); - command_order = new Vector(); - form_fields = new Hashtable(); - form_order = new Vector(); - - Enumeration enum = other.command_order.elements(); - while (enum.hasMoreElements()) - { // share the command buttons with the new dialog - CDCommandButton button = (CDCommandButton)(enum.nextElement()); - addCommandButton(button); - - } // end while - - enum = other.form_order.elements(); - while (enum.hasMoreElements()) - { // clone the form fields and put them in the new dialog - CDFormField field = (CDFormField)(enum.nextElement()); - addFormField(field.duplicate()); - - } // end while - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private boolean anyRequired() - { - boolean rc = false; - Enumeration enum = form_order.elements(); - while (!rc && enum.hasMoreElements()) - { // look for the first field that's marked "required" - CDFormField fld = (CDFormField)(enum.nextElement()); - rc = fld.isRequired(); - - } // end while - - return rc; - - } // end anyRequired - - /*-------------------------------------------------------------------------------- - * Overrideable operations - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { // do nothing at this level - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return title; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - Enumeration enum; - - // Output the content header - rdat.writeContentHeader(out,title,subtitle); - - if (error_message!=null) - { // print the error message - out.write("" - + "
\n" + rdat.getStdFontTag(CONTENT_ERROR,3) + ""); - out.write(StringUtil.encodeHTML(error_message)); - out.write("\n
\n"); - - } // end if - - // Output the start of the form - out.write("

" + rdat.getStdFontTag(CONTENT_FOREGROUND,2) + "\n"); - - enum = hidden_fields.keys(); - while (enum.hasMoreElements()) - { // output all the hidden fields - String name = (String)(enum.nextElement()); - String value = (String)(hidden_fields.get(name)); - out.write("\n"); - - } // end while - - if (instructions!=null) - out.write(StringUtil.encodeHTML(instructions)); - if (anyRequired()) - { // print the "required fields" instruction - if (instructions!=null) - out.write("

"); - out.write("Required fields are marked with a " + rdat.getRequiredBullet() + ".
\n"); - - } // end if - else if (instructions!=null) - out.write("
\n"); - - out.write("\n"); - - if (form_order.size()>0) - { // render the form elements now - enum = form_order.elements(); - while (enum.hasMoreElements()) - { // render all the fields in order - CDFormField fld = (CDFormField)(enum.nextElement()); - fld.renderHere(out,rdat); - - } // end while - - } // end if - - out.write("
\n"); - - if (command_order.size()>0) - { // render the command buttons at the bottom - boolean is_first = true; - out.write("

"); - enum = command_order.elements(); - while (enum.hasMoreElements()) - { // render each of the command buttons in the list - CDCommandButton button = (CDCommandButton)(enum.nextElement()); - if (is_first) - is_first = false; - else - out.write("  "); - button.renderHere(out,rdat); - - } // end while - - out.write("
\n"); - - } // end if - - out.write("
\n"); - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * Operations usable only from derived classes - *-------------------------------------------------------------------------------- - */ - - protected CDFormField modifyField(String name) - { - return (CDFormField)(form_fields.get(name)); - - } // end modifyField - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setTitle(String title) - { - this.title = title; - - } // end setTitle - - public void setSubtitle(String subtitle) - { - this.subtitle = subtitle; - - } // end setSubtitle - - public void setErrorMessage(String message) - { - this.error_message = message; - - } // end setErrorMessage - - public void setInstructions(String instructions) - { - this.instructions = StringUtil.encodeHTML(instructions); - - } // end setInstructions - - public void setHiddenField(String name, String value) - { - if (value!=null) - hidden_fields.put(name,value); - - } // end setHiddenField - - public void removeHiddenField(String name) - { - hidden_fields.remove(name); - - } // end removeHiddenField - - public void addCommandButton(CDCommandButton button, int position) - { - command_buttons.put(button.getName(),button); - if (position<0) - command_order.addElement(button); - else - command_order.insertElementAt(button,position); - - } // end addCommandButton - - public void addCommandButton(CDCommandButton button) - { - addCommandButton(button,-1); - - } // end addCommandButton - - public void addFormField(CDFormField field, int position) - { - String name = field.getName(); - if (name!=null) - form_fields.put(name,field); - if (position<0) - form_order.addElement(field); - else - form_order.insertElementAt(field,position); - - } // end addFormField - - public void addFormField(CDFormField field) - { - addFormField(field,-1); - - } // end addFormField - - public boolean isButtonClicked(ServletRequest request, String name) - { - CDCommandButton button = (CDCommandButton)(command_buttons.get(name)); - if (button!=null) - return button.isClicked(request); - - // now look in all form fields for the embedded button - Enumeration enum = form_order.elements(); - while (enum.hasMoreElements()) - { // zap the state of the fields - CDFormField fld = (CDFormField)(enum.nextElement()); - button = fld.findButton(name); - if (button!=null) - return button.isClicked(request); - - } // end while - - return false; - - } // end isButtonClicked - - public void loadValues(ServletRequest request) - { - // Look for the values of the hidden fields first. - Enumeration enum = hidden_fields.keys(); - Hashtable updates = new Hashtable(); - while (enum.hasMoreElements()) - { // get updates to the hidden field values - String name = (String)(enum.nextElement()); - String value = request.getParameter(name); - if (value!=null) - updates.put(name,value); - - } // end while - - hidden_fields.putAll(updates); // make all the updates be recognized - - // Now look for the values of the form fields. - enum = form_order.elements(); - while (enum.hasMoreElements()) - { // look for the first field that's marked "required" - CDFormField fld = (CDFormField)(enum.nextElement()); - String name = fld.getName(); - if (name!=null) // load the parameter value - fld.setValue(request.getParameter(name)); - - } // end while - - } // end loadValues - - public void clearAllFields() - { - Enumeration enum = form_order.elements(); - while (enum.hasMoreElements()) - { // zap the state of the fields - CDFormField fld = (CDFormField)(enum.nextElement()); - fld.setValue(null); - - } // end while - - } // end clearAllFields - - public String getFieldValue(String fieldname) - { - String value = (String)(hidden_fields.get(fieldname)); - if (value!=null) - return value; - - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - return fld.getValue(); - else - return null; - - } // end getFieldValue - - public void setFieldValue(String fieldname, String value) - { - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - fld.setValue(value); - else if (value!=null) - setHiddenField(fieldname,value); - - } // end setFieldValue - - public Object getFieldObjValue(String fieldname) - { - String value = (String)(hidden_fields.get(fieldname)); - if (value!=null) - return value; - - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - return fld.getObjValue(); - else - return null; - - } // end getFieldObjValue - - public void setFieldObjValue(String fieldname, Object value) - { - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - fld.setObjValue(value); - else if (value!=null) - setHiddenField(fieldname,value.toString()); - - } // end setFieldObjValue - - public boolean isFieldEnabled(String fieldname) - { - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - return fld.isEnabled(); - else - return false; - - } // end isFieldEnabled - - public void setFieldEnabled(String fieldname, boolean flag) - { - CDFormField fld = (CDFormField)(form_fields.get(fieldname)); - if (fld!=null) - fld.setEnabled(flag); - - } // end setFieldEnabled - - public void validate() throws ValidationException - { - // validate each field in isolation - Enumeration enum = form_order.elements(); - while (enum.hasMoreElements()) - { // look for the first field that's marked "required" - CDFormField fld = (CDFormField)(enum.nextElement()); - fld.validate(); - - } // end while - - // now validate the form as a whole - validateWholeForm(); - - } // end validate - - public Object clone() - { - return new ContentDialog(this); - - } // end clone - -} // end class Dialog diff --git a/src/com/silverwrist/venice/servlets/format/ContentMenuPanel.java b/src/com/silverwrist/venice/servlets/format/ContentMenuPanel.java deleted file mode 100644 index 64b2f76..0000000 --- a/src/com/silverwrist/venice/servlets/format/ContentMenuPanel.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.util.StringUtil; - -public class ContentMenuPanel implements Cloneable, ContentRender, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Internal class for storing content items - *-------------------------------------------------------------------------------- - */ - - class ContentMenuPanelItem - { - private String title; - private String url; - - public ContentMenuPanelItem(String title, String url) - { - this.title = title; - this.url = url; - - } // end constructor - - public void renderHere(Writer out, RenderData rdat, Hashtable params) throws IOException - { - StringBuffer buf = new StringBuffer(url); - Enumeration enum = params.keys(); - while (enum.hasMoreElements()) - { // do the parameter replacement - String curkey = (String)(enum.nextElement()); - String rparam = "$" + curkey; - int p = buf.toString().indexOf(rparam); - while (p>=0) - { // replace the parameter and look for another instance - buf.replace(p,p+rparam.length(),(String)(params.get(curkey))); - p = buf.toString().indexOf(rparam); - - } // end while - - } // end while - - out.write(""); - out.write(StringUtil.encodeHTML(title) + ""); - - } // end renderHere - - } // end class ContentMenuPanelItem - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String title; // menu title - private String subtitle; // menu subtitle - private Vector items; // list of menu items - private Hashtable params; // set of parameters - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public ContentMenuPanel(String title, String subtitle) - { - this.title = title; - this.subtitle = subtitle; - this.items = new Vector(); - this.params = new Hashtable(); - - } // end constructor - - protected ContentMenuPanel(ContentMenuPanel other) - { - this.title = other.title; - this.subtitle = other.subtitle; - this.items = other.items; - this.params = (Hashtable)(other.params.clone()); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return title; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - rdat.writeContentHeader(out,title,subtitle); - - out.write("\n\n\n\n"); - - } // end while - - out.write("
\"*\""); - out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,2)); - ContentMenuPanelItem item = (ContentMenuPanelItem)(it.next()); - item.renderHere(out,rdat,params); - out.write("
\n"); - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void addChoice(String title, String url) - { - items.add(new ContentMenuPanelItem(title,url)); - - } // end addChoice - - public void setParameter(String name, String value) - { - params.put(name,value); - - } // end setParameter - - public void setTitle(String s) - { - title = s; - - } // end setTitle - - public void setSubtitle(String s) - { - subtitle = s; - - } // end setSubtitle - - public Object clone() - { - return new ContentMenuPanel(this); - - } // end clone - -} // end class ContentMenuPanel diff --git a/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java b/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java deleted file mode 100644 index df33495..0000000 --- a/src/com/silverwrist/venice/servlets/format/CreateCommunityDialog.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class CreateCommunityDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CreateCommunityDialog() - { - super("Create New Community",null,"createcommform","sigops"); - setHiddenField("cmd","C"); - - Vector vec_pubpriv = new Vector(2); - vec_pubpriv.add("0|Public"); - vec_pubpriv.add("1|Private"); - vec_pubpriv.trimToSize(); - - Vector vec_hidemode = new Vector(3); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_NONE) + "|Show in both directory and search"); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_DIRECTORY) - + "|Hide in directory, but not in search"); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_BOTH) + "|Hide in both directory and search"); - vec_hidemode.trimToSize(); - - addFormField(new CDFormCategoryHeader("Basic Information")); - addFormField(new CDTextFormField("name","Community Name",null,true,32,128)); - addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32)); - addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255)); - addFormField(new CDTextFormField("rules","Rules",null,false,32,255)); - addFormField(new CDLanguageListFormField("language","Primary language",null,true)); - addFormField(new CDFormCategoryHeader("Location")); - addFormField(new CDTextFormField("loc","City",null,false,32,64)); - addFormField(new CDTextFormField("reg","State/Province",null,false,32,64)); - addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64)); - addFormField(new CDCountryListFormField("country","Country",null,true)); - addFormField(new CDFormCategoryHeader("Security")); - addFormField(new CDSimplePickListFormField("comtype","Community type:",null,true,vec_pubpriv,'|')); - addFormField(new CDTextFormField("joinkey","Join key","(for private communities)",false,32,64)); - addFormField(new CDSimplePickListFormField("hidemode","Community visibility:",null,true,vec_hidemode,'|')); - addCommandButton(new CDImageButton("create","bn_create.gif","Create",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected CreateCommunityDialog(CreateCommunityDialog other) - { - super(other); - - } // end CreateCommunityDialog - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - if (engine.aliasExists(getFieldValue("alias"),-1)) - throw new ValidationException("That alias is already used by another community on the system."); - - if (getFieldValue("comtype").equals("1")) - { // make sure if they flagged it as Private that they specified a join key - if (StringUtil.isStringEmpty(getFieldValue("joinkey"))) - throw new ValidationException("Private communities must specify a join key value."); - - } // end if - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(VeniceEngine engine) - { - this.engine = engine; - - } // end setupDialog - - public CommunityContext doDialog(UserContext user) throws ValidationException, DataException, AccessError - { - validate(); // validate the dialog entries - - int hidemode; - - try - { // attempt to get the hide mode first... - hidemode = Integer.parseInt(getFieldValue("hidemode")); - - } // end try - catch (NumberFormatException nfe) - { // how rude! - throw new InternalStateError("somehow we got a non-numeric result from a numeric dropdown list!"); - - } // end catch - - // Determine what the "join key" should be. - String jkey; - if (getFieldValue("comtype").equals("1")) - jkey = getFieldValue("joinkey"); - else - jkey = null; - - // Create the new community context. - CommunityContext rc = user.createCommunity(getFieldValue("name"),getFieldValue("alias"), - getFieldValue("language"),getFieldValue("synopsis"), - getFieldValue("rules"),jkey,hidemode); - - // Get the new community's contact record and fill in the pieces of info we know. - ContactInfo ci = rc.getContactInfo(); - ci.setLocality(getFieldValue("loc")); - ci.setRegion(getFieldValue("reg")); - ci.setPostalCode(getFieldValue("pcode")); - ci.setCountry(getFieldValue("country")); - rc.putContactInfo(ci); - - return rc; // all done! - - } // end doDialog - - public void resetOnError(String message) - { - setErrorMessage(message); - - } // end resetOnError - - public Object clone() - { - return new CreateCommunityDialog(this); - - } // end clone - -} // end class CreateCommunityDialog diff --git a/src/com/silverwrist/venice/servlets/format/CreateConferenceDialog.java b/src/com/silverwrist/venice/servlets/format/CreateConferenceDialog.java deleted file mode 100644 index e51a0d5..0000000 --- a/src/com/silverwrist/venice/servlets/format/CreateConferenceDialog.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.AccessError; -import com.silverwrist.venice.except.DataException; -import com.silverwrist.venice.except.ValidationException; - -public class CreateConferenceDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public CreateConferenceDialog() - { - super("Create New Conference",null,"newconfform","confops"); - setHiddenField("cmd","C"); - setHiddenField("sig",""); - - Vector vec_pubpriv = new Vector(2); - vec_pubpriv.add("0|Public"); - vec_pubpriv.add("1|Private"); - vec_pubpriv.trimToSize(); - - addFormField(new CDTextFormField("name","Conference Name",null,true,32,128)); - addFormField(new CDVeniceIDFormField("alias","Conference Alias",null,true,32,64)); - addFormField(new CDTextFormField("descr","Description",null,false,32,255)); - addFormField(new CDSimplePickListFormField("ctype","Conference type",null,true,vec_pubpriv,'|')); - addFormField(new CDCheckBoxFormField("hide","Hide conference in the community's conference list", - null,"Y")); - addCommandButton(new CDImageButton("create","bn_create.gif","Create",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected CreateConferenceDialog(CreateConferenceDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - if (engine.confAliasExists(getFieldValue("alias"))) - throw new ValidationException("That alias is already used by another conference on the system."); - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(VeniceEngine engine, CommunityContext comm) - { - this.engine = engine; - setHiddenField("sig",String.valueOf(comm.getCommunityID())); - - } // end setupDialog - - public ConferenceContext doDialog(CommunityContext comm) - throws ValidationException, DataException, AccessError - { - validate(); // validate the form - - // Convert a couple of fields to Booleans, which we need. - final String yes = "Y"; - boolean pvt = getFieldValue("ctype").equals("1"); - boolean hide_list = yes.equals(getFieldValue("hide")); - - // create the conference! - return comm.createConference(getFieldValue("name"),getFieldValue("alias"),getFieldValue("descr"),pvt, - hide_list); - - } // end if - - public void resetOnError(String message) - { - setErrorMessage(message); - - } // end resetOnError - - public Object clone() - { - return new CreateConferenceDialog(this); - - } // end clone - -} // end class CreateConferenceDialog diff --git a/src/com/silverwrist/venice/servlets/format/DialogCache.java b/src/com/silverwrist/venice/servlets/format/DialogCache.java deleted file mode 100644 index 731b5b2..0000000 --- a/src/com/silverwrist/venice/servlets/format/DialogCache.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.Hashtable; -import javax.servlet.ServletContext; -import org.apache.log4j.*; - -public class DialogCache -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - protected static final String ATTR_NAME = "com.silverwrist.venice.servlets.DialogCache"; - - private static Category logger = Category.getInstance(DialogCache.class.getName()); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - Hashtable cache; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - protected DialogCache() - { - cache = new Hashtable(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public boolean isCached(String name) - { - return (cache.get(name)!=null); - - } // end isCached - - public void saveTemplate(ContentDialog template) - { - String fullname = template.getClass().getName(); - int clip_pos = fullname.lastIndexOf('.'); - if (clip_pos>=0) - fullname = fullname.substring(clip_pos+1); - cache.put(fullname,template); - - } // end saveTemplate - - public ContentDialog getNewDialog(String name) - { - ContentDialog template = (ContentDialog)(cache.get(name)); - if (template!=null) - return (ContentDialog)(template.clone()); - else - return null; - - } // end getNewDialog - - /*-------------------------------------------------------------------------------- - * Static operations for use by servlets - *-------------------------------------------------------------------------------- - */ - - public static DialogCache getDialogCache(ServletContext ctxt) - { - // Look in the servlet attributes first. - Object foo = ctxt.getAttribute(ATTR_NAME); - if (foo!=null) - return (DialogCache)foo; - - // create a new one and return it - DialogCache cache = new DialogCache(); - ctxt.setAttribute(ATTR_NAME,cache); - return cache; - - } // end getDialogCache - -} // end class DialogCache diff --git a/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java b/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java deleted file mode 100644 index d5c7043..0000000 --- a/src/com/silverwrist/venice/servlets/format/EditCommunityProfileDialog.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class EditCommunityProfileDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * The logo URL control class. - *-------------------------------------------------------------------------------- - */ - - static class CDCommunityLogoControl extends CDBaseFormField - { - private String linkURL; - - public CDCommunityLogoControl(String name, String caption, String linkURL) - { - super(name,caption,"(click to change)",false); - this.linkURL = linkURL; - - } // end constructor - - protected CDCommunityLogoControl(CDCommunityLogoControl other) - { - super(other); - this.linkURL = other.linkURL; - - } // end constructor - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - if (isEnabled()) - out.write(""); - String photo = getValue(); - if (StringUtil.isStringEmpty(photo)) - photo = rdat.getFullImagePath("sig_other.jpg"); - out.write("\"\""); - if (isEnabled()) - out.write(""); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { // this is a do-nothing value - } // end validateContents - - public CDFormField duplicate() - { - return new CDCommunityLogoControl(this); - - } // end clone - - public void setLinkURL(String s) - { - linkURL = s; - - } // end setLinkURL - - } // end class CDCommunityLogoControl - - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String YES = "Y"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CDCommunityLogoControl logo_control; - private VeniceEngine engine; - private int cid; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public EditCommunityProfileDialog(SecurityInfo sinf) - { - super("Edit Community Profile:",null,"commprofform","sigadmin"); - setHiddenField("cmd","P"); - setHiddenField("sig",""); - - Vector vec_pubpriv = new Vector(2); - vec_pubpriv.add("0|Public"); - vec_pubpriv.add("1|Private"); - vec_pubpriv.trimToSize(); - - Vector vec_hidemode = new Vector(3); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_NONE) + "|Show in both directory and search"); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_DIRECTORY) - + "|Hide in directory, but not in search"); - vec_hidemode.add(String.valueOf(CommunityContext.HIDE_BOTH) + "|Hide in both directory and search"); - vec_hidemode.trimToSize(); - - addFormField(new CDFormCategoryHeader("Basic Information")); - addFormField(new CDTextFormField("name","Community Name",null,true,32,128)); - addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32)); - addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255)); - addFormField(new CDTextFormField("rules","Rules",null,false,32,255)); - addFormField(new CDLanguageListFormField("language","Primary language",null,true)); - addFormField(new CDTextFormField("url","Home page",null,false,32,255)); - logo_control = new CDCommunityLogoControl("logo","Community logo","commlogo"); - addFormField(logo_control); - - addFormField(new CDFormCategoryHeader("Location")); - addFormField(new CDTextFormField("company","Company",null,false,32,255)); - addFormField(new CDTextFormField("addr1","Address",null,false,32,255)); - addFormField(new CDTextFormField("addr2","Address","(line 2)",false,32,255)); - addFormField(new CDTextFormField("loc","City",null,false,32,64)); - addFormField(new CDTextFormField("reg","State/Province",null,false,32,64)); - addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64)); - addFormField(new CDCountryListFormField("country","Country",null,true)); - - addFormField(new CDFormCategoryHeader("Security")); - addFormField(new CDSimplePickListFormField("comtype","Communty type",null,true,vec_pubpriv,'|')); - addFormField(new CDTextFormField("joinkey","Join key","(for private communities)",false,32,64)); - addFormField(new CDCheckBoxFormField("membersonly","Allow only members to access this community", - null,YES)); - addFormField(new CDSimplePickListFormField("hidemode","Community visibility",null,true,vec_hidemode,'|')); - addFormField(new CDRoleListFormField("read_lvl","Security level required to read contents",null,true, - sinf.getRoleList("Community.Read"))); - addFormField(new CDRoleListFormField("write_lvl","Security level required to update profile",null,true, - sinf.getRoleList("Community.Write"))); - addFormField(new CDRoleListFormField("create_lvl","Security level required to create new subobjects", - null,true,sinf.getRoleList("Community.Create"))); - addFormField(new CDRoleListFormField("delete_lvl","Security level required to delete community",null,true, - sinf.getRoleList("Community.Delete"))); - addFormField(new CDRoleListFormField("join_lvl","Security level required to join community",null,true, - sinf.getRoleList("Community.Join"))); - - addFormField(new CDFormCategoryHeader("Conferencing Options")); - addFormField(new CDCheckBoxFormField("pic_in_post","Display user pictures next to posts in conferences", - "(by default; user can override)",YES)); - - addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end EditCommunityProfileDialog - - protected EditCommunityProfileDialog(EditCommunityProfileDialog other) - { - super(other); - logo_control = (CDCommunityLogoControl)modifyField("logo"); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private void doDisable(CommunityContext comm) - { - if (comm.isAdminCommunity()) - { // make sure certain fields are disabled for admin community - setFieldEnabled("comtype",false); - setFieldEnabled("joinkey",false); - setFieldEnabled("membersonly",false); - setFieldEnabled("hidemode",false); - setFieldEnabled("read_lvl",false); - setFieldEnabled("write_lvl",false); - setFieldEnabled("create_lvl",false); - setFieldEnabled("delete_lvl",false); - setFieldEnabled("join_lvl",false); - - } // end if - - } // end doDisable - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - if (engine.aliasExists(getFieldValue("alias"),cid)) - throw new ValidationException("That alias is already used by another community on the system."); - - if (getFieldValue("comtype").equals("1")) - { // make sure if they flagged it as Private that they specified a join key - if (StringUtil.isStringEmpty(getFieldValue("joinkey"))) - throw new ValidationException("Private communities must specify a join key value."); - - } // end if - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialogBasic(VeniceEngine engine, CommunityContext comm) - { - this.engine = engine; - this.cid = comm.getCommunityID(); - - } // end setupDialogBasic - - public void setupDialog(VeniceEngine engine, CommunityContext comm) throws DataException, AccessError - { - setupDialogBasic(engine,comm); - ContactInfo ci = comm.getContactInfo(); - CommunityProperties props = comm.getProperties(); - - setHiddenField("sig",String.valueOf(comm.getCommunityID())); - setFieldValue("name",comm.getName()); - setFieldValue("alias",comm.getAlias()); - setFieldValue("synopsis",comm.getSynopsis()); - setFieldValue("rules",comm.getRules()); - setFieldValue("language",comm.getLanguageCode()); - setFieldValue("url",ci.getURL()); - setFieldValue("logo",ci.getPhotoURL()); - logo_control.setLinkURL("commlogo?sig=" + comm.getCommunityID()); - setFieldValue("company",ci.getCompany()); - setFieldValue("addr1",ci.getAddressLine1()); - setFieldValue("addr2",ci.getAddressLine2()); - setFieldValue("loc",ci.getLocality()); - setFieldValue("reg",ci.getRegion()); - setFieldValue("pcode",ci.getPostalCode()); - setFieldValue("country",ci.getCountry()); - if (comm.isPublicCommunity()) - { // public community - no join key - setFieldValue("comtype","0"); - setFieldValue("joinkey",""); - - } // end if - else - { // private community - display the join key - setFieldValue("comtype","1"); - setFieldValue("joinkey",comm.getJoinKey()); - - } // end else - - if (comm.getMembersOnly()) - setFieldValue("membersonly",YES); - setFieldValue("hidemode",String.valueOf(comm.getHideMode())); - setFieldValue("read_lvl",String.valueOf(comm.getReadLevel())); - setFieldValue("write_lvl",String.valueOf(comm.getWriteLevel())); - setFieldValue("create_lvl",String.valueOf(comm.getCreateLevel())); - setFieldValue("delete_lvl",String.valueOf(comm.getDeleteLevel())); - setFieldValue("join_lvl",String.valueOf(comm.getJoinLevel())); - if (props.getDisplayPostPictures()) - setFieldValue("pic_in_post",YES); - - doDisable(comm); - - } // end setupDialog - - public void doDialog(CommunityContext comm) throws ValidationException, DataException, AccessError - { - validate(); // validate the dialog entries - - int hidemode, read_lvl, write_lvl, create_lvl, delete_lvl, join_lvl; - try - { // convert the values of some dropdowns to real numbers - hidemode = Integer.parseInt(getFieldValue("hidemode")); - read_lvl = Integer.parseInt(getFieldValue("read_lvl")); - write_lvl = Integer.parseInt(getFieldValue("write_lvl")); - create_lvl = Integer.parseInt(getFieldValue("create_lvl")); - delete_lvl = Integer.parseInt(getFieldValue("delete_lvl")); - join_lvl = Integer.parseInt(getFieldValue("join_lvl")); - - } // end try - catch (NumberFormatException nfe) - { // how rude! - throw new InternalStateError("somehow we got a non-numeric result from a numeric dropdown list!"); - - } // end catch - - // save off the ContactInfo-related fields first - ContactInfo ci = comm.getContactInfo(); - ci.setURL(getFieldValue("url")); - ci.setCompany(getFieldValue("company")); - ci.setAddressLine1(getFieldValue("addr1")); - ci.setAddressLine2(getFieldValue("addr2")); - ci.setLocality(getFieldValue("loc")); - ci.setRegion(getFieldValue("reg")); - ci.setPostalCode(getFieldValue("pcode")); - ci.setCountry(getFieldValue("country")); - comm.putContactInfo(ci); - - // now save off the property-related fields - CommunityProperties props = comm.getProperties(); - props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post"))); - comm.setProperties(props); - - // now save the big text fields - comm.setName(getFieldValue("name")); - comm.setAlias(getFieldValue("alias")); - comm.setSynopsis(getFieldValue("synopsis")); - comm.setRules(getFieldValue("rules")); - comm.setLanguage(getFieldValue("language")); - - if (!(comm.isAdminCommunity())) - { // save off the security information - String jkey; - if (getFieldValue("comtype").equals("1")) - jkey = getFieldValue("joinkey"); - else - jkey = null; - comm.setJoinKey(jkey); - comm.setMembersOnly(YES.equals(getFieldValue("membersonly"))); - comm.setHideMode(hidemode); - comm.setSecurityLevels(read_lvl,write_lvl,create_lvl,delete_lvl,join_lvl); - - } // end if - - } // end doDialog - - public void resetOnError(CommunityContext comm, String message) - { - setErrorMessage(message); - doDisable(comm); - - } // end resetOnError - - public Object clone() - { - return new EditCommunityProfileDialog(this); - - } // end clone - -} // end class EditCommunityProfileDialog - diff --git a/src/com/silverwrist/venice/servlets/format/EditConferenceDialog.java b/src/com/silverwrist/venice/servlets/format/EditConferenceDialog.java deleted file mode 100644 index acf8657..0000000 --- a/src/com/silverwrist/venice/servlets/format/EditConferenceDialog.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class EditConferenceDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String YES = "Y"; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public EditConferenceDialog(SecurityInfo sinf) - { - super("Edit Conference:",null,"editconfform","confops"); - setHiddenField("cmd","E"); - setHiddenField("sig",""); - setHiddenField("conf",""); - - addFormField(new CDFormCategoryHeader("Basic Information")); - addFormField(new CDTextFormField("name","Conference Name",null,true,32,128)); - addFormField(new CDTextFormField("descr","Description",null,false,32,255)); - addFormField(new CDCheckBoxFormField("hide","Hide conference in the community's conference list", - null,YES)); - addFormField(new CDFormCategoryHeader("Security Information")); - addFormField(new CDRoleListFormField("read_lvl","Security level required to read conference",null,true, - sinf.getRoleList("Conference.Read"))); - addFormField(new CDRoleListFormField("post_lvl","Security level required to post to conference",null,true, - sinf.getRoleList("Conference.Post"))); - addFormField(new CDRoleListFormField("create_lvl", - "Security level required to create new topics in conference",null, - true,sinf.getRoleList("Conference.Create"))); - addFormField(new CDRoleListFormField("hide_lvl", - "Security level required to archive or freeze topics", - "(or to hide posts of which you are not the owner)",true, - sinf.getRoleList("Conference.Hide"))); - addFormField(new CDRoleListFormField("nuke_lvl", - "Security level required to delete topics or nuke posts", - "(or to scribble posts of which you are not the owner)",true, - sinf.getRoleList("Conference.Nuke"))); - addFormField(new CDRoleListFormField("change_lvl", - "Security level required to change conference attributes",null,true, - sinf.getRoleList("Conference.Change"))); - addFormField(new CDRoleListFormField("delete_lvl", - "Security level required to delete conference",null,true, - sinf.getRoleList("Conference.Delete"))); - addFormField(new CDFormCategoryHeader("Conference Properties")); - addFormField(new CDCheckBoxFormField("pic_in_post","Display users' pictures next to their posts", - "(user can override)",YES)); - addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected EditConferenceDialog(EditConferenceDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal operations - *-------------------------------------------------------------------------------- - */ - - private final void doDisable(CommunityContext comm, ConferenceContext conf) - { - setFieldEnabled("hide",conf.canSetHideList()); - - } // end doDisable - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(CommunityContext comm, ConferenceContext conf) throws DataException, AccessError - { - doDisable(comm,conf); - setHiddenField("sig",String.valueOf(comm.getCommunityID())); - setHiddenField("conf",String.valueOf(conf.getConfID())); - setTitle("Edit Conference: " + conf.getName()); - setFieldValue("name",conf.getName()); - setFieldValue("descr",conf.getDescription()); - if (conf.canSetHideList()) - { // this is only valid at community level - if (conf.getHideList()) - setFieldValue("hide",YES); - else - setFieldValue("hide",""); - - } // end if - - setFieldValue("read_lvl",String.valueOf(conf.getReadLevel())); - setFieldValue("post_lvl",String.valueOf(conf.getPostLevel())); - setFieldValue("create_lvl",String.valueOf(conf.getCreateLevel())); - setFieldValue("hide_lvl",String.valueOf(conf.getHideLevel())); - setFieldValue("nuke_lvl",String.valueOf(conf.getNukeLevel())); - setFieldValue("change_lvl",String.valueOf(conf.getChangeLevel())); - setFieldValue("delete_lvl",String.valueOf(conf.getDeleteLevel())); - ConferenceProperties props = conf.getProperties(); - if (props.getDisplayPostPictures()) - setFieldValue("pic_in_post",YES); - else - setFieldValue("pic_in_post",""); - - } // end setupDialog - - public void doDialog(ConferenceContext conf) throws ValidationException, DataException, AccessError - { - validate(); // validate the dialog entries - - ConferenceProperties props = conf.getProperties(); - int read_lvl, post_lvl, create_lvl, hide_lvl, nuke_lvl, change_lvl, delete_lvl; - try - { // get all the security levels out of their form fields - read_lvl = Integer.parseInt(getFieldValue("read_lvl")); - post_lvl = Integer.parseInt(getFieldValue("post_lvl")); - create_lvl = Integer.parseInt(getFieldValue("create_lvl")); - hide_lvl = Integer.parseInt(getFieldValue("hide_lvl")); - nuke_lvl = Integer.parseInt(getFieldValue("nuke_lvl")); - change_lvl = Integer.parseInt(getFieldValue("change_lvl")); - delete_lvl = Integer.parseInt(getFieldValue("delete_lvl")); - - } // end try - catch (NumberFormatException nfe) - { // how rude! - throw new InternalStateError("somehow we got a non-numeric result from a numeric dropdown list!"); - - } // end catch - - // sweep through the conference and set the appropriate changes - conf.setName(getFieldValue("name")); - conf.setDescription(getFieldValue("descr")); - if (conf.canSetHideList()) - conf.setHideList(YES.equals(getFieldValue("hide"))); - conf.setSecurityLevels(read_lvl,post_lvl,create_lvl,hide_lvl,nuke_lvl,change_lvl,delete_lvl); - - // reset the properties - props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post"))); - conf.setProperties(props); - - } // end doDialog - - public void resetOnError(CommunityContext comm, ConferenceContext conf, String message) - { - doDisable(comm,conf); - setHiddenField("sig",String.valueOf(comm.getCommunityID())); - setHiddenField("conf",String.valueOf(conf.getConfID())); - setTitle("Edit Conference: " + conf.getName()); - setErrorMessage(message); - - } // end resetOnError - - public Object clone() - { - return new EditConferenceDialog(this); - - } // end clone - -} // end class EditConferenceDialog diff --git a/src/com/silverwrist/venice/servlets/format/EditGlobalPropertiesDialog.java b/src/com/silverwrist/venice/servlets/format/EditGlobalPropertiesDialog.java deleted file mode 100644 index 1a0c35e..0000000 --- a/src/com/silverwrist/venice/servlets/format/EditGlobalPropertiesDialog.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class EditGlobalPropertiesDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public EditGlobalPropertiesDialog(SecurityInfo sinf) - { - super("Edit Global Properties",null,"globpropform","sysadmin"); - setHiddenField("cmd","G"); - - addFormField(new CDFormCategoryHeader("System Properties")); - addFormField(new CDIntegerFormField("search_items","Number of search items to display per page", - null,5,100)); - addFormField(new CDIntegerFormField("fp_posts","Number of published posts to display on front page", - null,1,50)); - addFormField(new CDIntegerFormField("audit_recs","Number of audit records to display per page", - null,10,500)); - addFormField(new CDRoleListFormField("create_lvl","Security level required to create a new community", - null,true,sinf.getRoleList("Global.CreateCommunity"))); - - addFormField(new CDFormCategoryHeader("Community Properties")); - addFormField(new CDIntegerFormField("comm_mbrs","Number of community members to display per page", - null,10,100)); - - addFormField(new CDFormCategoryHeader("Conferencing Properties")); - addFormField(new CDIntegerFormField("posts_page","Maximum number of posts to display per page", - null,5,100)); - addFormField(new CDIntegerFormField("old_posts","Number of \"old\" posts to display at top of page", - null,1,5)); - addFormField(new CDIntegerFormField("conf_mbrs","Number of conference members to display per page", - null,10,100)); - addFormField(new CDCheckBoxFormField("pic_in_post","Display user pictures next to posts in conferences", - "(by default; user can override)")); - - addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected EditGlobalPropertiesDialog(EditGlobalPropertiesDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(AdminOperations adm) - { - GlobalProperties props = adm.getProperties(); - setFieldObjValue("search_items",new Integer(props.getSearchItemsPerPage())); - setFieldObjValue("fp_posts",new Integer(props.getPostsOnFrontPage())); - setFieldObjValue("audit_recs",new Integer(props.getAuditRecordsPerPage())); - setFieldObjValue("create_lvl",new Integer(props.getCommunityCreateLevel())); - setFieldObjValue("comm_mbrs",new Integer(props.getCommunityMembersPerPage())); - setFieldObjValue("posts_page",new Integer(props.getPostsPerPage())); - setFieldObjValue("old_posts",new Integer(props.getOldPostsAtTop())); - setFieldObjValue("conf_mbrs",new Integer(props.getConferenceMembersPerPage())); - setFieldObjValue("pic_in_post",new Boolean(props.getDisplayPostPictures())); - - } // end setupDialog - - public void doDialog(AdminOperations adm) throws ValidationException, DataException - { - validate(); // validate the dialog - - // Reset the global properties. - GlobalProperties props = adm.getProperties(); - Integer iv = (Integer)(getFieldObjValue("search_items")); - props.setSearchItemsPerPage(iv.intValue()); - iv = (Integer)(getFieldObjValue("fp_posts")); - props.setPostsOnFrontPage(iv.intValue()); - iv = (Integer)(getFieldObjValue("audit_recs")); - props.setAuditRecordsPerPage(iv.intValue()); - iv = (Integer)(getFieldObjValue("create_lvl")); - props.setCommunityCreateLevel(iv.intValue()); - iv = (Integer)(getFieldObjValue("comm_mbrs")); - props.setCommunityMembersPerPage(iv.intValue()); - iv = (Integer)(getFieldObjValue("posts_page")); - props.setPostsPerPage(iv.intValue()); - iv = (Integer)(getFieldObjValue("old_posts")); - props.setOldPostsAtTop(iv.intValue()); - iv = (Integer)(getFieldObjValue("conf_mbrs")); - props.setConferenceMembersPerPage(iv.intValue()); - Boolean bv = (Boolean)(getFieldObjValue("pic_in_post")); - props.setDisplayPostPictures(bv.booleanValue()); - adm.setProperties(props); - - } // end doDialog - - public Object clone() - { - return new EditGlobalPropertiesDialog(this); - - } // end clone - -} // end class EditGlobalPropertiesDialog diff --git a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java b/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java deleted file mode 100644 index e5e6b1c..0000000 --- a/src/com/silverwrist/venice/servlets/format/EditProfileDialog.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.net.URLEncoder; -import java.util.*; -import com.silverwrist.util.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class EditProfileDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * The photo URL control class. - *-------------------------------------------------------------------------------- - */ - - static class CDUserPhotoControl extends CDBaseFormField - { - private String linkURL; - - public CDUserPhotoControl(String name, String caption, String linkURL) - { - super(name,caption,"(click to change)",false); - this.linkURL = linkURL; - - } // end constructor - - protected CDUserPhotoControl(CDUserPhotoControl other) - { - super(other); - this.linkURL = other.linkURL; - - } // end constructor - - protected void renderActualField(Writer out, RenderData rdat) throws IOException - { - if (isEnabled()) - out.write(""); - String photo = getValue(); - if (StringUtil.isStringEmpty(photo)) - photo = rdat.getPhotoNotAvailURL(); - out.write("\"\""); - if (isEnabled()) - out.write(""); - - } // end renderActualField - - protected void validateContents(String value) throws ValidationException - { // this is a do-nothing value - } // end validateContents - - public CDFormField duplicate() - { - return new CDUserPhotoControl(this); - - } // end clone - - public void setLinkURL(String s) - { - linkURL = s; - - } // end setLinkURL - - } // end class CDUserPhotoControl - - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static final String YES = "Y"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CDUserPhotoControl photo_control; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public EditProfileDialog() - { - super("Edit Your Profile",null,"profform","account"); - setHiddenField("cmd","P"); - setHiddenField("tgt",""); - addFormField(new CDFormCategoryHeader("Password","To change your password, enter a new password " - + "into the fields below.")); - addFormField(new CDPasswordFormField("pass1","Password",null,false,32,128)); - addFormField(new CDPasswordFormField("pass2","Password","(retype)",false,32,128)); - addFormField(new CDTextFormField("remind","Password reminder phrase",null,false,32,255)); - addFormField(new CDFormCategoryHeader("Name")); - addFormField(new CDTextFormField("prefix","Prefix","(Mr., Ms., etc.)",false,8,8)); - addFormField(new CDTextFormField("first","First name",null,true,32,64)); - addFormField(new CDTextFormField("mid","Middle initial",null,false,1,1)); - addFormField(new CDTextFormField("last","Last name",null,true,32,64)); - addFormField(new CDTextFormField("suffix","Suffix","(Jr., III, etc.)",false,16,16)); - addFormField(new CDFormCategoryHeader("Location")); - addFormField(new CDTextFormField("company","Company",null,false,32,255)); - addFormField(new CDTextFormField("addr1","Address",null,false,32,255)); - addFormField(new CDTextFormField("addr2","Address","(line 2)",false,32,255)); - addFormField(new CDCheckBoxFormField("pvt_addr","Hide address in profile",null,YES)); - addFormField(new CDTextFormField("loc","City",null,true,32,64)); - addFormField(new CDTextFormField("reg","State/Province",null,true,32,64)); - addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64)); - addFormField(new CDCountryListFormField("country","Country",null,true)); - addFormField(new CDFormCategoryHeader("Phone Numbers")); - addFormField(new CDTextFormField("phone","Telephone",null,false,32,32)); - addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32)); - addFormField(new CDCheckBoxFormField("pvt_phone","Hide phone/mobile numbers in profile",null,YES)); - addFormField(new CDTextFormField("fax","Fax",null,false,32,32)); - addFormField(new CDCheckBoxFormField("pvt_fax","Hide fax number in profile",null,YES)); - addFormField(new CDFormCategoryHeader("Internet")); - addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255)); - addFormField(new CDCheckBoxFormField("pvt_email","Hide e-mail address in profile",null,YES)); - addFormField(new CDTextFormField("url","Home page","(URL)",false,32,255)); - addFormField(new CDFormCategoryHeader("Personal")); - addFormField(new CDTextFormField("descr","Personal description",null,false,32,255)); - photo_control = new CDUserPhotoControl("photo","User Photo","userphoto"); - addFormField(photo_control); - addFormField(new CDFormCategoryHeader("User Preferences")); - addFormField(new CDCheckBoxFormField("pic_in_post","Display user photos next to conference posts", - "(where applicable)",YES)); - addFormField(new CDCheckBoxFormField("no_mass_mail", - "Don't send me mass E-mail from community/conference hosts", - null,YES)); - addFormField(new CDLocaleListFormField("locale","Default locale","(for formatting dates/times)",true)); - addFormField(new CDTimeZoneListFormField("tz","Default time zone",null,true)); - addCommandButton(new CDImageButton("update","bn_update.gif","Update",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected EditProfileDialog(EditProfileDialog other) - { - super(other); - photo_control = (CDUserPhotoControl)modifyField("photo"); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class Object - *-------------------------------------------------------------------------------- - */ - - public Object clone() - { - return new EditProfileDialog(this); - - } // end clone - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - String pass1 = getFieldValue("pass1"); - String pass2 = getFieldValue("pass2"); - - if (StringUtil.isStringEmpty(pass1)) - { // empty must match empty - if (!StringUtil.isStringEmpty(pass2)) - throw new ValidationException("The typed passwords do not match."); - - } // end if - else - { // the two passwords must match - if (!(pass1.equals(pass2))) - throw new ValidationException("The typed passwords do not match."); - - } // end if - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setTarget(String target) - { - setHiddenField("tgt",target); - - } // end setTarget - - public void setupDialog(UserContext uc, String target) throws DataException - { - setTarget(target); - ContactInfo ci = uc.getContactInfo(); // get the main contact info - UserProperties props = uc.getProperties(); // get the properties - - setFieldEnabled("photo",ci.canSetPhoto()); - setFieldValue("prefix",ci.getNamePrefix()); - setFieldValue("first",ci.getGivenName()); - char init = ci.getMiddleInitial(); - if (init!=' ') - setFieldValue("mid",String.valueOf(init)); - setFieldValue("last",ci.getFamilyName()); - setFieldValue("suffix",ci.getNameSuffix()); - setFieldValue("company",ci.getCompany()); - setFieldValue("addr1",ci.getAddressLine1()); - setFieldValue("addr2",ci.getAddressLine2()); - if (ci.getPrivateAddress()) - setFieldValue("pvt_addr",YES); - setFieldValue("loc",ci.getLocality()); - setFieldValue("reg",ci.getRegion()); - setFieldValue("pcode",ci.getPostalCode()); - setFieldValue("country",ci.getCountry()); - setFieldValue("phone",ci.getPhone()); - setFieldValue("mobile",ci.getMobile()); - if (ci.getPrivatePhone()) - setFieldValue("pvt_phone",YES); - setFieldValue("fax",ci.getFax()); - if (ci.getPrivateFax()) - setFieldValue("pvt_fax",YES); - setFieldValue("email",ci.getEmail()); - if (ci.getPrivateEmail()) - setFieldValue("pvt_email",YES); - setFieldValue("url",ci.getURL()); - setFieldValue("descr",uc.getDescription()); - setFieldValue("photo",ci.getPhotoURL()); - photo_control.setLinkURL("userphoto?tgt=" + URLEncoder.encode(target)); - if (props.getDisplayPostPictures()) - setFieldValue("pic_in_post",YES); - if (props.getMassMailOptOut()) - setFieldValue("no_mass_mail",YES); - setFieldValue("locale",uc.getLocale().toString()); - setFieldValue("tz",uc.getTimeZone().getID()); - - } // end setupDialog - - public boolean doDialog(UserContext uc) throws ValidationException, DataException, EmailException - { - validate(); // validate the dialog - - ContactInfo ci = uc.getContactInfo(); // get the main contact info - UserProperties props = uc.getProperties(); - - // Reset all the contact info fields. - ci.setNamePrefix(getFieldValue("prefix")); - ci.setGivenName(getFieldValue("first")); - String foo = getFieldValue("mid"); - if ((foo==null) || (foo.length()<1)) - ci.setMiddleInitial(' '); - else - ci.setMiddleInitial(foo.charAt(0)); - ci.setFamilyName(getFieldValue("last")); - ci.setNameSuffix(getFieldValue("suffix")); - ci.setCompany(getFieldValue("company")); - ci.setAddressLine1(getFieldValue("addr1")); - ci.setAddressLine2(getFieldValue("addr2")); - ci.setPrivateAddress(YES.equals(getFieldValue("pvt_addr"))); - ci.setLocality(getFieldValue("loc")); - ci.setRegion(getFieldValue("reg")); - ci.setPostalCode(getFieldValue("pcode")); - ci.setCountry(getFieldValue("country")); - ci.setPhone(getFieldValue("phone")); - ci.setMobile(getFieldValue("mobile")); - ci.setPrivatePhone(YES.equals(getFieldValue("pvt_phone"))); - ci.setFax(getFieldValue("fax")); - ci.setPrivateFax(YES.equals(getFieldValue("pvt_fax"))); - ci.setEmail(getFieldValue("email")); - ci.setPrivateEmail(YES.equals(getFieldValue("pvt_email"))); - ci.setURL(getFieldValue("url")); - - // Store the completed contact info. - boolean retval = uc.putContactInfo(ci); - - // Save off the properties. - props.setDisplayPostPictures(YES.equals(getFieldValue("pic_in_post"))); - props.setMassMailOptOut(YES.equals(getFieldValue("no_mass_mail"))); - uc.setProperties(props); - - // Save off the user's description and preferences. - uc.setDescription(getFieldValue("descr")); - uc.setLocale(International.get().createLocale(getFieldValue("locale"))); - uc.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz"))); - - // Finally, change the password if applicable. - foo = getFieldValue("pass1"); - if (!StringUtil.isStringEmpty(foo)) - uc.setPassword(foo,getFieldValue("remind")); - - return retval; // pass back up so we can decide where to jump - - } // end doDialog - - public void resetOnError(boolean photo_flag, String message) - { - setErrorMessage(message); - setFieldValue("pass1",null); - setFieldValue("pass2",null); - setFieldEnabled("photo",photo_flag); - - } // end resetOnError - -} // end class EditProfileDialog diff --git a/src/com/silverwrist/venice/servlets/format/ErrorBox.java b/src/com/silverwrist/venice/servlets/format/ErrorBox.java deleted file mode 100644 index 4e57abd..0000000 --- a/src/com/silverwrist/venice/servlets/format/ErrorBox.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.servlets.VeniceServletResult; - -public class ErrorBox extends VeniceServletResult implements ContentRender, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String title; - private String message; - private String back; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ErrorBox(String title, String message, String back) - { - super(); - this.title = title; - this.message = message; - this.back = back; - - if (this.title==null) - this.title = "Error!"; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return title; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - out.write("

"); - out.write("
\n"); - out.write(rdat.getStdFontTag(ERROR_TITLE_FOREGROUND,3) + StringUtil.encodeHTML(title) + "\n"); - out.write("
\n"); - out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,3) + "

" + StringUtil.encodeHTML(message) + "

\n"); - if (back==null) - out.write("Use your browser's Back button to go back.\n"); - else - out.write("Go back.\n"); - out.write("

\n"); - - } // end renderHere - -} // end class ErrorBox diff --git a/src/com/silverwrist/venice/servlets/format/FindData.java b/src/com/silverwrist/venice/servlets/format/FindData.java deleted file mode 100644 index 4cbcd8b..0000000 --- a/src/com/silverwrist/venice/servlets/format/FindData.java +++ /dev/null @@ -1,443 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import javax.servlet.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class FindData implements JSPRender, SearchMode -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.FindData"; - - // The various display categories - public static final int FD_COMMUNITIES = 0; - public static final int FD_USERS = 1; - public static final int FD_CATEGORIES = 2; - public static final int FD_POSTS = 3; - - // The titles and URLs of the header data - private static Vector header_titles = null; - private static Vector header_urls = null; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - private UserContext user; - private int disp; - private int field = -1; - private int mode = -1; - private String term = null; - private int offset = 0; - private CategoryDescriptor cat = null; - private List subcats = null; - private List results = null; - private int find_count = -1; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public FindData(VeniceEngine engine, UserContext user, int disp) - { - this.engine = engine; - this.user = user; - this.disp = disp; - - if (header_titles==null) - { // construct the title and URL vectors - header_titles = new Vector(); - header_titles.add("Communities"); - header_titles.add("Users"); - header_titles.add("Categories"); - header_titles.add("Posts"); - header_titles.trimToSize(); - - header_urls = new Vector(); - header_urls.add("find?disp=" + String.valueOf(FD_COMMUNITIES)); - header_urls.add("find?disp=" + String.valueOf(FD_USERS)); - header_urls.add("find?disp=" + String.valueOf(FD_CATEGORIES)); - header_urls.add("find?disp=" + String.valueOf(FD_POSTS)); - header_urls.trimToSize(); - - } // end if - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, return default - return default_val; - - } // end catch - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static int getNumChoices() - { - return FD_POSTS + 1; - - } // end getNumChoices - - public static FindData retrieve(ServletRequest request) - { - return (FindData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Find"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "find.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void writeHeader(RenderData rdat, Writer out) throws IOException - { - rdat.writeContentSelectorHeader(out,"Find:",header_titles,header_urls,disp); - - } // end writeHeader - - public int getDisplayOption() - { - return disp; - - } // end getDisplayOption - - public int getSearchField() - { - return field; - - } // end getSearchField - - public boolean searchFieldIs(int value) - { - return (value==field); - - } // end searchFieldIs - - public int getSearchMode() - { - return mode; - - } // end getSearchMode - - public boolean searchModeIs(int value) - { - return (value==mode); - - } // end searchModeIs - - public String getSearchTerm() - { - return term; - - } // end getSearchTerm - - public CategoryDescriptor getCategory() - { - return cat; - - } // end getCategory - - public List getSubCategoryList() - { - return subcats; - - } // end getSubCategoryList - - public List getResultsList() - { - return results; - - } // end getResultsList - - public int getNumResultsDisplayed() - { - return engine.getStdNumSearchResults(); - - } // end getNumResultsDisplayed - - public int getFindCount() - { - return find_count; - - } // end getFindCount - - public int getOffset() - { - return offset; - - } // end getOffset - - public void loadGet(int catid) throws DataException - { - if (disp==FD_COMMUNITIES) - { // fill in the list of subcategories and of communities in this category - cat = user.getCategoryDescriptor(catid); - subcats = cat.getSubCategories(); - if (cat.getCategoryID()>=0) - { // fill in the communities that are in this category - results = user.getCommunitiesInCategory(cat,offset,getNumResultsDisplayed()); - find_count = user.getNumCommunitiesInCategory(cat); - - } // end if - field = FIELD_COMMUNITY_NAME; - - } // end if - else if (disp==FD_USERS) - field = FIELD_USER_NAME; - - mode = SEARCH_PREFIX; - term = ""; - - } // end loadGet - - public void loadPost(ServletRequest request) throws ValidationException, DataException - { - int catid = -1; - - // Retrieve all the posted parameters from the form and validate them. First validate the - // category ID (if specified) and the field identifier. - switch (disp) - { - case FD_COMMUNITIES: - catid = getParamInt(request,"cat",-1); - if (!engine.isValidCategoryID(catid)) - throw new ValidationException("The category ID parameter is not valid."); - field = getParamInt(request,"field",FIELD_COMMUNITY_NAME); - if ((field!=FIELD_COMMUNITY_NAME) && (field!=FIELD_COMMUNITY_SYNOPSIS)) - throw new ValidationException("The field search parameter is not valid."); - break; - - case FD_USERS: - field = getParamInt(request,"field",FIELD_USER_NAME); - if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME) - && (field!=FIELD_USER_FAMILY_NAME)) - throw new ValidationException("The field search parameter is not valid."); - break; - - case FD_CATEGORIES: - case FD_POSTS: - // no parameters to set here - there's no "field" for category/post search - break; - - default: - throw new InternalStateError("loadPost failure - invalid display parameter"); - - } // end switch - - if (disp!=FD_POSTS) - { // Validate the search mode parameter. - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); - - } // end if - - // Retrieve the search term parameter. - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Run the actual search. - switch (disp) - { - case FD_COMMUNITIES: - if (catid>=0) - { // retrieve the category descriptor and the subcategory list - cat = user.getCategoryDescriptor(catid); - subcats = cat.getSubCategories(); - if (cat.getCategoryID()>=0) - { // fill in the communities that are in this category - results = user.getCommunitiesInCategory(cat,offset,count); - if (find_count<0) - find_count = user.getNumCommunitiesInCategory(cat); - - } // end if - - } // end if - else - { // retrieve the community search data - results = user.searchForCommunities(field,mode,term,offset,count); - if (find_count<0) - find_count = user.getSearchCommunityCount(field,mode,term); - - } // end else - break; - - case FD_USERS: - results = engine.searchForUsers(field,mode,term,offset,count); - if (find_count<0) - find_count = engine.getSearchUserCount(field,mode,term); - break; - - case FD_CATEGORIES: - results = user.searchForCategories(mode,term,offset,count); - if (find_count<0) - find_count = user.getSearchCategoryCount(mode,term); - break; - - case FD_POSTS: - results = user.searchPosts(term,offset,count); - if (find_count<0) - find_count = user.getSearchPostCount(term); - break; - - } // end switch - - } // end loadPost - - public static String getCatJumpLink(RenderData rdat, int catid) - { - return rdat.getEncodedServletPath("find?disp=" + String.valueOf(FD_COMMUNITIES) + "&cat=" - + String.valueOf(catid)); - - } // end getCatJumpLink - - public static String getCommunityHostName(CommunityContext comm) - { - try - { // get the host name for the specified community - UserProfile prof = comm.getHostProfile(); - return prof.getUserName(); - - } // end try - catch (DataException e) - { // just return NULL if an exception strikes - return null; - - } // end catch - - } // end getCommunityHostName - - public static int getCommunityMemberCount(CommunityContext comm) - { - try - { // get the member count for the specified community - return comm.getMemberCount(); - - } // end try - catch (DataException e) - { // just return -1 if an exception strikes - return -1; - - } // end catch - - } // end getCommunityMemberCount - - public static String getActivityString(CommunityContext comm, RenderData rdat) - { - return rdat.getActivityString(comm.getLastAccessDate()); - - } // end getActivityString - -} // end class FindData diff --git a/src/com/silverwrist/venice/servlets/format/FindPostData.java b/src/com/silverwrist/venice/servlets/format/FindPostData.java deleted file mode 100644 index ba8e696..0000000 --- a/src/com/silverwrist/venice/servlets/format/FindPostData.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import javax.servlet.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class FindPostData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.FindPostData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; - private ConferenceContext conf; - private TopicContext topic; - private String term = ""; - private int offset = 0; - private int find_count = 0; - private List results = null; - private int max_results = 0; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public FindPostData(CommunityContext comm, ConferenceContext conf, TopicContext topic) - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal static functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, fall through - } // end catch - - return default_val; - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static FindPostData retrieve(ServletRequest request) - { - return (FindPostData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Find Posts"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "findpost.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final void doSearch(ServletRequest request, VeniceEngine engine) throws AccessError, DataException - { - max_results = engine.getStdNumSearchResults(); - - // Retrieve the search term parameter. - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= max_results; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += max_results; // go forwards instead - else - throw new InternalStateError("Unable to determine what action triggered the form."); - - if (topic!=null) - { // search the topic - results = topic.searchPosts(term,offset,max_results); - if (find_count<0) - find_count = topic.getSearchPostCount(term); - - } // end if - else if (conf!=null) - { // search the conference - results = conf.searchPosts(term,offset,max_results); - if (find_count<0) - find_count = conf.getSearchPostCount(term); - - } // end else if - else - { // search the community - results = comm.searchPosts(term,offset,max_results); - if (find_count<0) - find_count = comm.getSearchPostCount(term); - - } // end else - - } // end doSearch - - public final String getExtraParameters() - { - StringBuffer buf = new StringBuffer(""); - if (conf!=null) - { // append the conference number parameter - buf.append("\n"); - if (topic!=null) - { // append the topic number parameter - buf.append("\n"); - - } // end if - - } // end if - - return buf.toString(); - - } // end getExtraParameters - - public final String getReturnLink(RenderData rdat) - { - if (topic!=null) - return "Return to Topic"; - else if (conf!=null) - return "Return to Topic List"; - else - return "Return to Topic List"; - - } // end getReturnLink - - public final String getSubtitle() - { - if (topic!=null) - return "Topic: " + topic.getName(); - else if (conf!=null) - return "Conference: " + conf.getName(); - else - return "Community: " + comm.getName(); - - } // end getSubtitle - - public final String getTerm() - { - return term; - - } // end getTerm - - public final int getOffset() - { - return offset; - - } // end getOffset - - public final int getFindCount() - { - return find_count; - - } // end getFindCount - - public final List getResults() - { - return results; - - } // end getResults - - public final int getMaxResults() - { - return max_results; - - } // end getMaxResults - -} // end class FindPostData diff --git a/src/com/silverwrist/venice/servlets/format/Hotlist.java b/src/com/silverwrist/venice/servlets/format/Hotlist.java deleted file mode 100644 index 6b36d3d..0000000 --- a/src/com/silverwrist/venice/servlets/format/Hotlist.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class Hotlist implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.Hotlist"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private UserContext uc; - private List hotlist; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public Hotlist(UserContext uc) throws DataException - { - this.uc = uc; - this.hotlist = uc.getConferenceHotlist(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static Hotlist retrieve(ServletRequest request) - { - return (Hotlist)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Your Conference Hotlist"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "hotlist.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getHotlistSize() - { - return hotlist.size(); - - } // end getHotlistSize - - public ConferenceContext getConference(int ndx) - { - ConferenceHotlistEntry tmp = (ConferenceHotlistEntry)(hotlist.get(ndx)); - return tmp.getConference(); - - } // end getConference - -} // end class Hotlist diff --git a/src/com/silverwrist/venice/servlets/format/Invitation.java b/src/com/silverwrist/venice/servlets/format/Invitation.java deleted file mode 100644 index ee1f172..0000000 --- a/src/com/silverwrist/venice/servlets/format/Invitation.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.IOException; -import java.io.Writer; -import javax.servlet.ServletRequest; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; - -public class Invitation implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.Invitation"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community context - private ConferenceContext conf; // the conference context - private TopicContext topic; // the topic context - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public Invitation(CommunityContext comm, ConferenceContext conf, TopicContext topic) - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static Invitation retrieve(ServletRequest request) - { - return (Invitation)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Send Invitation"; - - } // end getPageTitle - - public String getPageQID() - { - String rc = "sigops?cmd=I&sig=" + comm.getCommunityID(); - if (conf!=null) - { // add conference and topic parameters, as needed - rc += ("&conf=" + conf.getConfID()); - if (topic!=null) - rc += ("&top=" + topic.getTopicNumber()); - - } // end if - - return rc; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "invitation.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final void writeHeader(Writer out, RenderData rdat) throws IOException - { - if (topic!=null) - rdat.writeContentHeader(out,"Send Topic Invitation:", - topic.getName() + " (in " + conf.getName() + ", in " + comm.getName() + ")"); - else if (conf!=null) - rdat.writeContentHeader(out,"Send Conference Invitation:", - conf.getName() + " (in " + comm.getName() + ")"); - else - rdat.writeContentHeader(out,"Send Community Invitation:",comm.getName()); - - } // end writeHeader - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final String getParameters() - { - String rc = ""; - if (conf==null) - return rc; - rc += ("\n"); - if (topic==null) - return rc; - rc += ("\n"); - return rc; - - } // end getAdditionalParameters - -} // end class Invitation diff --git a/src/com/silverwrist/venice/servlets/format/JoinKeyDialog.java b/src/com/silverwrist/venice/servlets/format/JoinKeyDialog.java deleted file mode 100644 index d71c2f4..0000000 --- a/src/com/silverwrist/venice/servlets/format/JoinKeyDialog.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class JoinKeyDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public JoinKeyDialog() - { - super("Join Key Required",null,"joinkeyform","sigops"); - setHiddenField("cmd","J"); - setHiddenField("sig",""); - setInstructions("You must specify a join key before you can join this community. You might have received " - + "the join key from the community's host, or via an invitation e-mail message. Please " - + "enter it in the box below."); - addFormField(new CDTextFormField("key","Join key",null,false,32,64)); - addCommandButton(new CDImageButton("join","bn_join_now.gif","Join Now",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected JoinKeyDialog(JoinKeyDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - if (StringUtil.isStringEmpty(getFieldValue("key"))) - throw new ValidationException("No join key specified."); - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupDialog(CommunityContext comm) - { - setHiddenField("sig",String.valueOf(comm.getCommunityID())); - - } // end setupDialog - - public void doDialog(CommunityContext comm) throws ValidationException, DataException, AccessError - { - validate(); - comm.join(getFieldValue("key")); - - } // end doDialog - - public void resetOnError(String message) - { - setErrorMessage(message); - setFieldValue("key",null); - - } // end resetOnError - - public Object clone() - { - return new JoinKeyDialog(this); - - } // end clone - -} // end class JoinKeyDialog - diff --git a/src/com/silverwrist/venice/servlets/format/LoginDialog.java b/src/com/silverwrist/venice/servlets/format/LoginDialog.java deleted file mode 100644 index a4b6627..0000000 --- a/src/com/silverwrist/venice/servlets/format/LoginDialog.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; -import com.silverwrist.venice.servlets.Variables; - -public class LoginDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public LoginDialog() - { - super("Log In",null,"loginform","account"); - setHiddenField("cmd","L"); - setHiddenField("tgt",""); - setInstructions("Forgot your password? Enter your user name and click the Reminder button to receive " - + "a password reminder via E-mail."); - addFormField(new CDVeniceIDFormField("user","User name",null,false,32,64)); - addFormField(new CDPasswordFormField("pass","Password",null,false,32,128)); - addFormField(new CDCheckBoxFormField("saveme","Remember me for next time so I can log in automatically", - null,"Y")); - addCommandButton(new CDImageButton("login","bn_log_in.gif","Log In",80,24)); - addCommandButton(new CDImageButton("remind","bn_reminder.gif","Password Reminder",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected LoginDialog(LoginDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setTarget(String target) - { - setHiddenField("tgt",target); - - } // end setTarget - - public void setupNew(String target) - { - setHiddenField("tgt",target); - - } // end setupNew - - public void resetOnError(String message) - { - setErrorMessage(message); - setFieldValue("pass",null); - - } // end resetOnError - - public Object clone() - { - return new LoginDialog(this); - - } // end clone - -} // end class LoginDialog diff --git a/src/com/silverwrist/venice/servlets/format/ManageConference.java b/src/com/silverwrist/venice/servlets/format/ManageConference.java deleted file mode 100644 index 9200342..0000000 --- a/src/com/silverwrist/venice/servlets/format/ManageConference.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; - -public class ManageConference implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ManageConference"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private String locator = null; // the locator we use - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ManageConference(CommunityContext comm, ConferenceContext conf) - { - this.comm = comm; - this.conf = conf; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ManageConference retrieve(ServletRequest request) - { - return (ManageConference)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Manage Conference: " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "manage_conf.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public final String getConfName() - { - return conf.getName(); - - } // end getConfName - - public final String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - return locator; - - } // end getLocator - - public final String getDefaultPseud() - { - return conf.getDefaultPseud(); - - } // end getDefaultPseud - - public final boolean displayInviteSection() - { - return conf.canSendInvitation(); - - } // end displayInviteSection - - public final boolean displayAdminSection() - { - return conf.canChangeConference() || conf.canDeleteConference(); - - } // end displayAdminSection - -} // end class ManageConference diff --git a/src/com/silverwrist/venice/servlets/format/ManageConferenceAliases.java b/src/com/silverwrist/venice/servlets/format/ManageConferenceAliases.java deleted file mode 100644 index fd3d8a2..0000000 --- a/src/com/silverwrist/venice/servlets/format/ManageConferenceAliases.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ManageConferenceAliases implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ManageConferenceAliases"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private List aliases; // list of aliases generated - private String error_message; // error message to display - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public ManageConferenceAliases(CommunityContext comm, ConferenceContext conf) throws DataException - { - this.comm = comm; - this.conf = conf; - this.aliases = conf.getAliases(); - this.error_message = null; - - } // end constructor - - public ManageConferenceAliases(CommunityContext comm, ConferenceContext conf, String message) - throws DataException - { - this.comm = comm; - this.conf = conf; - this.aliases = conf.getAliases(); - this.error_message = message; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ManageConferenceAliases retrieve(ServletRequest request) - { - return (ManageConferenceAliases)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Manage Conference Aliases: " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "manage_aliases.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public String getConfName() - { - return conf.getName(); - - } // end getConfName - - public String getLocator() - { - return "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - - } // end getLocator - - public boolean canRemoveAliases() - { - return (aliases.size()>1); - - } // end canRemoveAliases - - public Iterator getAliasIterator() - { - return aliases.iterator(); - - } // end getAliasIterator - - public String getErrorMessage() - { - return error_message; - - } // end getErrorMessage - -} // end class ManageConferenceAliases diff --git a/src/com/silverwrist/venice/servlets/format/ManageTopic.java b/src/com/silverwrist/venice/servlets/format/ManageTopic.java deleted file mode 100644 index da215e7..0000000 --- a/src/com/silverwrist/venice/servlets/format/ManageTopic.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ManageTopic implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ManageTopic"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private TopicContext topic; // the topic being managed - private String locator = null; // the locator we use - private List bozos_list; // the list of "bozo" users - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ManageTopic(UserContext user, CommunityContext comm, ConferenceContext conf, TopicContext topic) - throws DataException - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - - // Load up the list of bozos, sorting them in user name order. - List bozo_uids = topic.getBozos(); - if (bozo_uids.size()>0) - { // use a TreeMap to do the sorting - TreeMap load_map = new TreeMap(); - Iterator it = bozo_uids.iterator(); - while (it.hasNext()) - { // fill in the list of user profiles - Integer uid = (Integer)(it.next()); - UserProfile prof = user.getProfile(uid.intValue()); - load_map.put(prof.getUserName(),prof); - - } // end while - - bozos_list = new ArrayList(load_map.values()); - - } // end if - else // no bozos - just set empty list - bozos_list = Collections.EMPTY_LIST; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ManageTopic retrieve(ServletRequest request) - { - return (ManageTopic)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Manage Topic: " + topic.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "manage_topic.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public final int getTopicNumber() - { - return topic.getTopicNumber(); - - } // end getTopicID - - public final String getTopicName() - { - return topic.getName(); - - } // end getConfName - - public final String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID() + "&top=" - + topic.getTopicNumber(); - return locator; - - } // end getLocator - - public final int getNumBozos() - { - return bozos_list.size(); - - } // end getNumBozos() - - public final Iterator getBozosIterator() - { - return bozos_list.iterator(); - - } // end getBozosIterator - - public final boolean isSubscribed() - { - return topic.isSubscribed(); - - } // end isSubscribed - - public final boolean displayInviteSection() - { - return topic.canSendInvitation(); - - } // end displayInviteSection - -} // end class ManageTopic diff --git a/src/com/silverwrist/venice/servlets/format/MenuPanelCache.java b/src/com/silverwrist/venice/servlets/format/MenuPanelCache.java deleted file mode 100644 index 504b978..0000000 --- a/src/com/silverwrist/venice/servlets/format/MenuPanelCache.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.Hashtable; -import javax.servlet.ServletContext; -import org.apache.log4j.*; - -public class MenuPanelCache -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - protected static final String ATTR_NAME = "com.silverwrist.venice.servlets.MenuPanelCache"; - - private static Category logger = Category.getInstance(MenuPanelCache.class.getName()); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - Hashtable cache; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - protected MenuPanelCache() - { - cache = new Hashtable(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public boolean isCached(String name) - { - return (cache.get(name)!=null); - - } // end isCached - - public void saveTemplate(ContentMenuPanel template) - { - String fullname = template.getClass().getName(); - int clip_pos = fullname.lastIndexOf('.'); - if (clip_pos>=0) - fullname = fullname.substring(clip_pos+1); - cache.put(fullname,template); - - } // end saveTemplate - - public ContentMenuPanel getNewMenuPanel(String name) - { - ContentMenuPanel template = (ContentMenuPanel)(cache.get(name)); - if (template!=null) - return (ContentMenuPanel)(template.clone()); - else - return null; - - } // end getNewMenuPanel - - /*-------------------------------------------------------------------------------- - * Static operations for use by servlets - *-------------------------------------------------------------------------------- - */ - - public static MenuPanelCache getMenuPanelCache(ServletContext ctxt) - { - // Look in the servlet attributes first. - Object foo = ctxt.getAttribute(ATTR_NAME); - if (foo!=null) - return (MenuPanelCache)foo; - - // create a new one and return it - MenuPanelCache cache = new MenuPanelCache(); - ctxt.setAttribute(ATTR_NAME,cache); - return cache; - - } // end getMenuPanelCache - -} // end class MenuPanelCache diff --git a/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java b/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java deleted file mode 100644 index a11646d..0000000 --- a/src/com/silverwrist/venice/servlets/format/NewAccountDialog.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.List; -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class NewAccountDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine = null; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public NewAccountDialog() - { - super("Create Account",null,"createform","account"); - setInstructions("To create a new account, please enter your information below."); - setHiddenField("cmd","C"); - setHiddenField("tgt",""); - addFormField(new CDFormCategoryHeader("Name")); - addFormField(new CDTextFormField("prefix","Prefix","(Mr., Ms., etc.)",false,8,8)); - addFormField(new CDTextFormField("first","First name",null,true,32,64)); - addFormField(new CDTextFormField("mid","Middle initial",null,false,1,1)); - addFormField(new CDTextFormField("last","Last name",null,true,32,64)); - addFormField(new CDTextFormField("suffix","Suffix","(Jr., III, etc.)",false,16,16)); - addFormField(new CDFormCategoryHeader("Location")); - addFormField(new CDTextFormField("loc","City",null,true,32,64)); - addFormField(new CDTextFormField("reg","State/Province",null,true,32,64)); - addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64)); - addFormField(new CDCountryListFormField("country","Country",null,true)); - addFormField(new CDFormCategoryHeader("E-mail")); - addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255)); - addFormField(new CDFormCategoryHeader("Account Information")); - addFormField(new CDVeniceIDFormField("user","User name",null,true,32,64)); - addFormField(new CDPasswordFormField("pass1","Password",null,true,32,128)); - addFormField(new CDPasswordFormField("pass2","Password","(retype)",true,32,128)); - addFormField(new CDTextFormField("remind","Password reminder phrase",null,false,32,255)); - addCommandButton(new CDImageButton("create","bn_create.gif","Create",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected NewAccountDialog(NewAccountDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - if (!(getFieldValue("pass1").equals(getFieldValue("pass2")))) - throw new ValidationException("The typed passwords do not match."); - - if (engine.isEmailAddressBanned(getFieldValue("email"))) - throw new ValidationException("This email address may not register a new account."); - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setEngine(VeniceEngine engine) - { - this.engine = engine; - - } // end setEngine - - public void setTarget(String target) - { - setHiddenField("tgt",target); - - } // end setTarget - - public UserContext doDialog(ServletRequest request) - throws ValidationException, DataException, AccessError, EmailException - { - validate(); // validate the dialog - - // Create the new user account and set up its initial context. - UserContext uc = engine.createNewAccount(request.getRemoteAddr(),getFieldValue("user"), - getFieldValue("pass1"),getFieldValue("remind")); - - // Set up the account's contact info. - ContactInfo ci = uc.getContactInfo(); - ci.setNamePrefix(getFieldValue("prefix")); - ci.setGivenName(getFieldValue("first")); - String blort = getFieldValue("mid"); - if ((blort==null) || (blort.length()<1)) - ci.setMiddleInitial(' '); - else - ci.setMiddleInitial(blort.charAt(0)); - ci.setFamilyName(getFieldValue("last")); - ci.setNameSuffix(getFieldValue("suffix")); - ci.setLocality(getFieldValue("loc")); - ci.setRegion(getFieldValue("reg")); - ci.setPostalCode(getFieldValue("pcode")); - ci.setCountry(getFieldValue("country")); - ci.setEmail(getFieldValue("email")); - - // save the contact info for the user (this also sends email confirmation messages as needed) - uc.putContactInfo(ci); - - return uc; - - } // end doDialog - - public void resetOnError(String message) - { - setErrorMessage(message); - setFieldValue("pass1",null); - setFieldValue("pass2",null); - - } // end resetOnError - - public Object clone() - { - return new NewAccountDialog(this); - - } // end clone - -} // end class NewAccountDialog - - diff --git a/src/com/silverwrist/venice/servlets/format/NewCommunityWelcome.java b/src/com/silverwrist/venice/servlets/format/NewCommunityWelcome.java deleted file mode 100644 index 5b9ffd3..0000000 --- a/src/com/silverwrist/venice/servlets/format/NewCommunityWelcome.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.CommunityContext; - -public class NewCommunityWelcome implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.NewCommunityWelcome"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String name; - private String entry_url; - private String invite_url; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public NewCommunityWelcome(CommunityContext comm) - { - name = comm.getName(); - entry_url = "sig/" + comm.getAlias(); - invite_url = "sigops?cmd=I&sig=" + comm.getCommunityID(); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static NewCommunityWelcome retrieve(ServletRequest request) - { - return (NewCommunityWelcome)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "New Community Created"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "newcommwelcome.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getCommunityName() - { - return name; - - } // end getCommunityName - - public String getEntryURL(RenderData rdat) - { - return rdat.getEncodedServletPath(entry_url); - - } // end getEntryURL - - public String getDisplayURL(RenderData rdat) - { - return rdat.getCompleteServletPath(entry_url); - - } // end getEntryURL - - public String getInviteURL(RenderData rdat) - { - return rdat.getEncodedServletPath(invite_url); - - } // end getInviteURL - -} // end class NewCommunityWelcome diff --git a/src/com/silverwrist/venice/servlets/format/NewTopicForm.java b/src/com/silverwrist/venice/servlets/format/NewTopicForm.java deleted file mode 100644 index fe259a0..0000000 --- a/src/com/silverwrist/venice/servlets/format/NewTopicForm.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import com.silverwrist.venice.htmlcheck.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class NewTopicForm implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.NewTopicForm"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being created in - private String topic_name; // the initial topic name - private String pseud; // the pseud to display - private boolean attach; // is there an attachment? - private String post_box; // stuff from the post box - private String preview = null; // the preview & spellchuck data - private int num_errors = 0; // the number of spelling errors we get - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public NewTopicForm(CommunityContext comm, ConferenceContext conf) - { - this.comm = comm; - this.conf = conf; - - } // end constrcutor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static NewTopicForm retrieve(ServletRequest request) - { - return (NewTopicForm)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Create New Topic"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "newtopic.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setupNewRequest() - { - topic_name = ""; - pseud = conf.getDefaultPseud(); - attach = false; - post_box = ""; - - } // end setupNewRequest - - public void generatePreview(VeniceEngine engine, ConferenceContext conf, ServletRequest request) - throws ValidationException - { - HTMLChecker check; - - try - { // run the data through the HTML Checker - check = engine.getEscapingChecker(); - - // sanitize the "title" parameter - String foo = request.getParameter("title"); - if (foo==null) - throw new ValidationException("Title parameter was not specified."); - check.append(foo); - check.finish(); - topic_name = check.getValue(); - check.reset(); - - // sanitize the "pseud" parameter - foo = request.getParameter("pseud"); - if (foo==null) - throw new ValidationException("Pseud parameter was not specified."); - check.append(foo); - check.finish(); - pseud = check.getValue(); - check.reset(); - - // sanitize the body text itself - foo = request.getParameter("pb"); - if (foo==null) - throw new ValidationException("Body text was not specified."); - check.append(foo); - check.finish(); - post_box = check.getValue(); - - // generate the body text preview - check = conf.getNewTopicPreviewChecker(); - check.append(foo); - check.finish(); - preview = check.getValue(); - num_errors = check.getCounter("spelling"); - - } // end try - catch (HTMLCheckerException e) - { // make sure we catch the HTML Checker exceptions - throw new InternalStateError("spurious HTMLCheckerException in generatePreview",e); - - } // end catch - - // set the "attach" flag to save the checkbox state - final String yes = "Y"; - attach = yes.equals(request.getParameter("attach")); - - } // end generatePreview - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public String getConfName() - { - return conf.getName(); - - } // end getConfName - - public String getTopicName() - { - return topic_name; - - } // end getTopicName - - public String getPseud() - { - return pseud; - - } // end getPseud - - public boolean getAttachCheck() - { - return attach; - - } // end getAttachCheck - - public String getPostBoxData() - { - return post_box; - - } // end getPostBoxData - - public boolean isPreview() - { - return (preview!=null); - - } // end isPreview - - public String getPreviewData() - { - return preview; - - } // end getPreviewData - - public int getNumSpellingErrors() - { - return num_errors; - - } // end getNumSpellingErrors - - public boolean isNullRequest() - { - return ((topic_name.length()==0) || (post_box.length()==0)); - - } // end isNullRequest - -} // end class NewTopicForm diff --git a/src/com/silverwrist/venice/servlets/format/PostPreview.java b/src/com/silverwrist/venice/servlets/format/PostPreview.java deleted file mode 100644 index 61798e1..0000000 --- a/src/com/silverwrist/venice/servlets/format/PostPreview.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.htmlcheck.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class PostPreview implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.PostPreview"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; - private ConferenceContext conf; - private TopicContext topic; - private String next; - private String pseud; - private String data; - private String preview; - private int num_errors; - private int msgs; - private boolean attach; - private boolean slippage; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public PostPreview(VeniceEngine engine, CommunityContext comm, ConferenceContext conf, TopicContext topic, - String pseud, String data, String next, int msgs, boolean attach, boolean slippage) - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - this.next = next; - this.msgs = msgs; - this.attach = attach; - this.slippage = slippage; - - try - { // sanitize the pseud data - HTMLChecker check = engine.getEscapingChecker(); - check.append(pseud); - check.finish(); - this.pseud = check.getValue(); - - // sanitize the post box data - check.reset(); - check.append(data); - check.finish(); - this.data = check.getValue(); - - // now generate the preview - check = topic.getPreviewChecker(); - check.append(data); - check.finish(); - this.preview = check.getValue(); - this.num_errors = check.getCounter("spelling"); - - } // end try - catch (HTMLCheckerException e) - { // this is a bad issue... - throw new InternalStateError("spurious HTMLCheckerException thrown"); - - } // end catch - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static PostPreview retrieve(ServletRequest request) - { - return (PostPreview)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Previewing Message"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "preview.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getNumSpellingErrors() - { - return num_errors; - - } // end getNumSpellingErrors - - public String getPreviewData() - { - return preview; - - } // end getPreviewData - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public int getTopicNumber() - { - return topic.getTopicNumber(); - - } // end getTopicNumber - - public int getTotalMessages() - { - return msgs; - - } // end getTotalMessages - - public String getNextVal() - { - return next; - - } // end getNextVal - - public String getPseud() - { - return pseud; - - } // end getPseud - - public boolean attachChecked() - { - return attach; - - } // end attachChecked - - public String getBodyText() - { - return data; - - } // end getBodyText - - public boolean slippageDetected() - { - return slippage; - - } // end slippageDetected - -} // end class PostPreview diff --git a/src/com/silverwrist/venice/servlets/format/PostSlippage.java b/src/com/silverwrist/venice/servlets/format/PostSlippage.java deleted file mode 100644 index e2d02a8..0000000 --- a/src/com/silverwrist/venice/servlets/format/PostSlippage.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.htmlcheck.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class PostSlippage implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.PostSlippage"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; - private ConferenceContext conf; - private TopicContext topic; - private List messages; - private String next; - private String pseud; - private String text; - private boolean attach; - private String topic_stem; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public PostSlippage(VeniceEngine engine, CommunityContext comm, ConferenceContext conf, TopicContext topic, - int lastval, String next, String pseud, String text, boolean attach) - throws DataException, AccessError - { - this.comm = comm; - this.conf = conf; - this.topic = topic; - this.messages = topic.getMessages(lastval,topic.getTotalMessages()-1); - this.next = next; - this.attach = attach; - List aliases = conf.getAliases(); - topic_stem = (String)(aliases.get(0)) + "." + String.valueOf(topic.getTopicNumber()) + "."; - - try - { // run the text and pseud through an HTML checker to escape them - HTMLChecker ch = engine.getEscapingChecker(); - ch.append(pseud); - ch.finish(); - this.pseud = ch.getValue(); - ch.reset(); - ch.append(text); - ch.finish(); - this.text = text; - - } // end try - catch (HTMLCheckerException e) - { // this shouldn't happen - throw new InternalStateError("spurious HTMLCheckerException thrown"); - - } // end catch - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static PostSlippage retrieve(ServletRequest request) - { - return (PostSlippage)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Slippage or Double-Click Detected"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "slippage.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public static String getPosterName(TopicMessageContext msg) - { - try - { // have to guard agains a DataException here - return msg.getCreatorName(); - - } // end try - catch (DataException de) - { // just return "unknown" on failure - return "(unknown)"; - - } // end catch - - } // end getPosterName - - public static String getMessageBodyText(TopicMessageContext msg) - { - try - { // have to guard against a DataException here - return msg.getBodyText(); - - } // end try - catch (DataException de) - { // just return an error message - return "(Unable to retrieve message data: " + StringUtil.encodeHTML(de.getMessage()) + ")"; - - } // end catch - - } // end getMessageBodyText - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public int getTopicNumber() - { - return topic.getTopicNumber(); - - } // end getTopicNumber - - public String getTopicName() - { - return topic.getName(); - - } // end getTopicName - - public String getIdentifyingData() - { - return "Slippage posting to topic " + String.valueOf(topic.getTopicID()); - - } // end getIdentifyingData - - public int getTotalMessages() - { - return topic.getTotalMessages(); - - } // end getTotalMessages - - public Iterator getMessageIterator() - { - return messages.iterator(); - - } // end getMessageIterator - - public String getNextVal() - { - return next; - - } // end getNextVal - - public String getPseud() - { - return pseud; - - } // end getPseud - - public boolean attachChecked() - { - return attach; - - } // end attachChecked - - public String getBodyText() - { - return text; - - } // end getBodyText - - public String getMessageReference(TopicMessageContext msg) - { - return topic_stem + String.valueOf(msg.getPostNumber()); - - } // end getMessageReference - -} // end class PostSlippage diff --git a/src/com/silverwrist/venice/servlets/format/RenderConfig.java b/src/com/silverwrist/venice/servlets/format/RenderConfig.java deleted file mode 100644 index e6771a4..0000000 --- a/src/com/silverwrist/venice/servlets/format/RenderConfig.java +++ /dev/null @@ -1,675 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import org.w3c.dom.*; -import com.silverwrist.util.*; -import com.silverwrist.venice.core.CommunityContext; -import com.silverwrist.venice.core.UserContext; -import com.silverwrist.venice.core.VeniceEngine; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.Variables; -import com.silverwrist.venice.servlets.format.menus.*; -import com.silverwrist.venice.servlets.format.sideboxes.SideBoxFactory; -import com.silverwrist.venice.util.XMLLoader; - -public class RenderConfig implements ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - protected static final String ATTR_NAME = "com.silverwrist.venice.servlets.RenderConfig"; - protected static final String CONFIG_FILE_PARAM = "render.config"; - - private static Category logger = Category.getInstance(RenderConfig.class); - - private static Map colornames_map; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String site_title; - private boolean want_comments; - private boolean allow_gzip; - private boolean no_smart_tags; - private String font_face; - private File stylesheet; - private long stylesheet_time = 0; - private String image_url; - private String static_url; - private String site_logo; - private int site_logo_width = 140; - private int site_logo_height = 80; - private String site_logo_linkURL = null; - private StockMessages stock_messages; - private Map menus; - private String[] colors_array; - private int footer_logo_scale; - private Map sidebox_factories; - private String photo_not_avail; - private boolean photo_not_avail_fixup; - private CommunityLeftMenuFactory comm_menu_fact; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - protected RenderConfig(String config_file, String root_file_path) throws ConfigException - { - XMLLoader loader = XMLLoader.get(); - Document doc = loader.loadConfigDocument(config_file); - - // Make sure the document is valid. - Element root = loader.configGetRootElement(doc,"render-config"); - DOMElementHelper root_h = new DOMElementHelper(root); - - // Get the site title. - site_title = loader.configGetSubElementText(root_h,"site-name"); - if (logger.isDebugEnabled()) - logger.debug("Site title: " + site_title); - - // Get the section. - Element sect = loader.configGetSubSection(root_h,"rendering"); - - // Load the quick Boolean values indicated by the presence or absence of a tag. - DOMElementHelper sect_h = new DOMElementHelper(sect); - want_comments = sect_h.hasChildElement("html-comments"); - allow_gzip = sect_h.hasChildElement("gzip-output"); - no_smart_tags = !(sect_h.hasChildElement("ms-copyright-violations")); - if (logger.isDebugEnabled()) - { // log the read values - logger.debug("Use HTML comments: " + want_comments); - logger.debug("Use GZIP encoding: " + allow_gzip); - logger.debug("Disable IE Smart Tags: " + no_smart_tags); - - } // end if - - // Load the default font face. - font_face = loader.configGetSubElementText(sect_h,"font"); - if (logger.isDebugEnabled()) - logger.debug("Font face: " + font_face); - - // Load the default stylesheet file reference. - String tmp = sect_h.getSubElementText("stylesheet"); - if (tmp!=null) - { // we're using Cascading Stylesheets - load it and test for existence - if (!(tmp.startsWith("/"))) // prepend app root - tmp = root_file_path + tmp; - if (logger.isDebugEnabled()) - logger.debug("Stylesheet location: " + tmp); - - // Test to make sure the stylesheet is actually present. - stylesheet = new File(tmp); - if (!(stylesheet.exists() && stylesheet.canRead())) - { // it's not there - bail out! - logger.fatal("unable to read stylesheet file: " + tmp); - throw new ConfigException("stylesheet " + tmp + " cannot be read",sect); - - } // end if - - } // end if - else // no stylesheet - stylesheet = null; - - // Get the section and load the colors out of it.. - Element sect1 = loader.configGetSubSection(sect_h,"colors"); - colors_array = new String[colornames_map.size()]; - int i; - NodeList nl = sect1.getChildNodes(); - for (i=0; i section. - sect = loader.configGetSubSection(root_h,"paths"); - sect_h = new DOMElementHelper(sect); - - // Load the image path. - image_url = loader.configGetSubElementText(sect_h,"image"); - if (logger.isDebugEnabled()) - logger.debug("Image path: " + image_url); - - // Load the static path. - static_url = loader.configGetSubElementText(sect_h,"static"); - if (logger.isDebugEnabled()) - logger.debug("Static files path: " + static_url); - - // Get the site logo element. - sect1 = loader.configGetSubSection(sect_h,"site-logo"); - DOMElementHelper sect1_h = new DOMElementHelper(sect1); - site_logo = loader.configGetText(sect1_h); - - // Get the width and height of the logo. - itmp = sect1_h.getAttributeInt("width"); - if (itmp!=null) - site_logo_width = itmp.intValue(); - itmp = sect1_h.getAttributeInt("height"); - if (itmp!=null) - site_logo_height = itmp.intValue(); - - // Get the link URL of the logo. - tmp = sect1.getAttribute("href"); - if (!(StringUtil.isStringEmpty(tmp))) - site_logo_linkURL = tmp; - - if (logger.isDebugEnabled()) - logger.debug("Site logo: " + site_logo); - - // Get the name of the sidebox configuration file. - String sidebox_config = loader.configGetSubElementText(sect_h,"sidebox-config"); - if (!(sidebox_config.startsWith("/"))) - sidebox_config = root_file_path + sidebox_config; - - // Get the name of the "photo not available" image. - sect1 = sect_h.getSubElement("photo-not-avail"); - if (sect1!=null) - { // load the element text and fixup information - sect1_h = new DOMElementHelper(sect1); - photo_not_avail = sect1_h.getElementText(); - photo_not_avail_fixup = sect1_h.hasAttribute("fixup"); - - } // end if - else - { // just load the defaults - photo_not_avail = "photo_not_avail.gif"; - photo_not_avail_fixup = true; - - } // end else - - // Get the name of the services configuration file. - String services_config = loader.configGetSubElementText(sect_h,"services-config"); - if (!(services_config.startsWith("/"))) - services_config = root_file_path + services_config; - - // Load the section. - sect = loader.configGetSubSection(root_h,"messages"); - - // Initialize the stock messages list. - stock_messages = new StockMessages(sect); - - // Load the section. - sect = loader.configGetSubSection(root_h,"menu-definitions"); - - // Initialize the menus list. - HashMap tmp_menus = new HashMap(); - nl = sect.getChildNodes(); - for (i=0; i subnodes and use them to initialize menus - Node n = nl.item(i); - if (n.getNodeType()==Node.ELEMENT_NODE) - { // verify that it's a menu definition, then get its ID and build a menu - loader.configVerifyNodeName(n,"menudef",sect); - String menuid = loader.configGetAttribute((Element)n,"id"); - - // create the menu and add it to the mapping - LeftMenu menu = new LeftMenu((Element)n,menuid); - tmp_menus.put(menuid,menu); - if (logger.isDebugEnabled()) - logger.debug("menu \"" + menuid + "\" defined"); - - } // end if - // else just ignore it - - } // end for - - // save off the menus as an unmodifiable map - if (tmp_menus.isEmpty()) - menus = Collections.EMPTY_MAP; - else - menus = Collections.unmodifiableMap(tmp_menus); - if (logger.isDebugEnabled()) - logger.debug(menus.size() + " menu definitions loaded from config"); - - // done with the render-config.xml file - // Load up the sidebox-config.xml file. - doc = loader.loadConfigDocument(sidebox_config); - root = loader.configGetRootElement(doc,"sidebox-config"); - - // Examine the child nodes for sidebox configuration data. - nl = root.getChildNodes(); - HashMap tmp_factories = new HashMap(); - for (i=0; i ID not numeric!"); - throw new ConfigException("non-numeric ID specified in ",(Element)n); - - } // end catch - - SideBoxFactory factory = createSideBoxFactory((Element)n); - tmp_factories.put(itmp,factory); - - } // end if - // else ignore this node - - } // end for - - if (tmp_factories.isEmpty()) - sidebox_factories = Collections.EMPTY_MAP; - else - sidebox_factories = Collections.unmodifiableMap(tmp_factories); - - // done with the sidebox-config.xml file - // Load up the services-config.xml file. - doc = loader.loadConfigDocument(services_config); - root = loader.configGetRootElement(doc,"services-config"); - root_h = new DOMElementHelper(root); - - // Get the community section and pass it to the CommunityLeftMenuFactory. - comm_menu_fact = new CommunityLeftMenuFactory(root_h.getSubElement("community")); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static SideBoxFactory createSideBoxFactory(Element cfg) throws ConfigException - { - XMLLoader loader = XMLLoader.get(); - String cname = loader.configGetSubElementText(cfg,"factory-class"); - - try - { // load the factory class and create an instance of the factory - SideBoxFactory factory = (SideBoxFactory)(Class.forName(cname).newInstance()); - factory.setConfiguration(cfg); - return factory; - - } // end try - catch (ClassNotFoundException cnfe) - { // sidebox could not be configured - logger.fatal(" config not valid!",cnfe); - throw new ConfigException(" in is not a valid class!",cfg); - - } // end catch - catch (IllegalAccessException iae) - { // could not access class and/or constructor - logger.fatal(" is not accessible!",iae); - throw new ConfigException(" in is not accessible!",cfg); - - } // end catch - catch (InstantiationException ie) - { // unable to create the class - logger.fatal(" could not be instantiated!",ie); - throw new ConfigException(" in could not be created!",cfg); - - } // end catch - catch (ClassCastException cce) - { // the class is not a SideBoxFactory implementor - cannot create - logger.fatal(" is not a SideBoxFactory!",cce); - throw new ConfigException(" in is not the correct type!",cfg); - - } // end catch - - } // end createSideBoxFactory - - /*-------------------------------------------------------------------------------- - * External operations usable only by RenderData - *-------------------------------------------------------------------------------- - */ - - boolean useHTMLComments() - { - return want_comments; - - } // end useHTMLComments - - boolean isGZIPAllowed() - { - return allow_gzip; - - } // end isGZIPAllowed - - boolean noSmartTags() - { - return no_smart_tags; - - } // end noSmartTags - - String getFullImagePath(String name) - { - StringBuffer buf = new StringBuffer(); - buf.append(image_url).append(name); - return buf.toString(); - - } // end getFullImagePath - - String getStaticFilePath(String name) - { - StringBuffer buf = new StringBuffer(); - buf.append(static_url).append(name); - return buf.toString(); - - } // end getStaticFilePath - - String getTitleTag(String specific) - { - StringBuffer buf = new StringBuffer(); - buf.append("").append(specific).append(" - ").append(site_title).append(""); - return buf.toString(); - - } // end getTitleTag - - String getSiteImageTag(int hspace, int vspace) - { - StringBuffer buf = new StringBuffer(); - if (site_logo_linkURL!=null) - buf.append(""); - buf.append("\"").append(site_title);0) - buf.append(" HSPACE=").append(hspace); - if (vspace>0) - buf.append(" VSPACE=").append(vspace); - buf.append('>'); - if (site_logo_linkURL!=null) - buf.append(""); - return buf.toString(); - - } // end getSiteImageTag - - String getStdFontTag(String color, int size) - { - StringBuffer buf = new StringBuffer("'); - return buf.toString(); - - } // end getStdFontTag - - String getStdFontTag(int selector, int size) - { - if ((selector<0) || (selector>=colors_array.length)) - throw new IndexOutOfBoundsException("getStdColor(): invalid color selector value"); - return getStdFontTag(colors_array[selector],size); - - } // end getStdFontTag - - String getStdBaseFontTag(int size) - { - StringBuffer buf = new StringBuffer("*"); - return buf.toString(); - - } // end getRequiredBullet - - void writeContentHeader(Writer out, String primary, String secondary) throws IOException - { - out.write("" + getStdFontTag(colors_array[CONTENT_HEADER],5) + "" - + StringUtil.encodeHTML(primary) + ""); - if (secondary!=null) - out.write("  " + getStdFontTag(colors_array[CONTENT_HEADER],3) + "" - + StringUtil.encodeHTML(secondary) + ""); - out.write("


\n"); - - } // end writeContentHeader - - String getStockMessage(String identifier) - { - return (String)(stock_messages.get(identifier)); - - } // end getStockMessage - - void writeStockMessage(Writer out, String identifier) throws IOException - { - String text = (String)(stock_messages.get(identifier)); - out.write(StringUtil.encodeHTML(text)); - - } // end writeStockMessage - - String getStdColor(int selector) - { - if ((selector<0) || (selector>=colors_array.length)) - throw new IndexOutOfBoundsException("getStdColor(): invalid color selector value"); - return colors_array[selector]; - - } // end getStdColor - - int scaleFooterLogo(int param) - { - return (param * footer_logo_scale) / 100; - - } // end scaleFooterLogo - - public LeftMenu getLeftMenu(String identifier) - { - return (LeftMenu)(menus.get(identifier)); - - } // end getLeftMenu - - synchronized String loadStyleSheetData() throws IOException - { - if (stylesheet==null) - return null; - - // Load the stylesheet data. - StringBuffer raw_data = IOUtil.loadText(stylesheet); - stylesheet_time = stylesheet.lastModified(); - - // Set up the replacements map to replace the various parameters. - HashMap vars = new HashMap(); - vars.put("font",font_face); - vars.put("color.frame",colors_array[FRAME_BACKGROUND]); - vars.put("color.top.background",colors_array[TITLE_BACKGROUND]); - vars.put("color.top.foreground",colors_array[TITLE_FOREGROUND]); - vars.put("color.top.link",colors_array[TITLE_LINK]); - vars.put("color.left.background",colors_array[LEFT_BACKGROUND]); - vars.put("color.left.foreground",colors_array[LEFT_FOREGROUND]); - vars.put("color.left.link",colors_array[LEFT_LINK]); - vars.put("color.content.background",colors_array[CONTENT_BACKGROUND]); - vars.put("color.content.foreground",colors_array[CONTENT_FOREGROUND]); - vars.put("color.content.header",colors_array[CONTENT_HEADER]); - vars.put("color.disabled",colors_array[CONTENT_DISABLED]); - vars.put("color.error",colors_array[CONTENT_ERROR]); - vars.put("color.sidebox.top.background",colors_array[SIDEBOX_TITLE_BACKGROUND]); - vars.put("color.sidebox.top.foreground",colors_array[SIDEBOX_TITLE_FOREGROUND]); - vars.put("color.sidebox.background",colors_array[SIDEBOX_CONTENT_BACKGROUND]); - vars.put("color.sidebox.foreground",colors_array[SIDEBOX_CONTENT_FOREGROUND]); - vars.put("color.sidebox.link",colors_array[SIDEBOX_CONTENT_LINK]); - vars.put("color.dlg.confirm.title.background",colors_array[CONFIRM_TITLE_BACKGROUND]); - vars.put("color.dlg.confirm.title.foreground",colors_array[CONFIRM_TITLE_FOREGROUND]); - vars.put("color.dlg.error.title.background",colors_array[ERROR_TITLE_BACKGROUND]); - vars.put("color.dlg.error.title.foreground",colors_array[ERROR_TITLE_FOREGROUND]); - return StringUtil.replaceAllVariables(raw_data.toString(),vars); - - } // end loadStyleSheet - - boolean hasStyleSheetChanged() - { - if (stylesheet==null) - return false; - return (stylesheet_time!=stylesheet.lastModified()); - - } // end hasStyleSheetChanged - - boolean useStyleSheet() - { - return (stylesheet!=null); - - } // end useStyleSheet - - VeniceContent createSideBox(int id, VeniceEngine engine, UserContext uc) throws AccessError, DataException - { - SideBoxFactory fact = (SideBoxFactory)(sidebox_factories.get(new Integer(id))); - if (fact==null) - throw new DataException("invalid sidebox ID!"); - return fact.create(engine,uc); - - } // end createSideBox - - String getPhotoNotAvail() - { - return photo_not_avail; - - } // end getPhotoNotAvail - - boolean getPhotoNotAvailFixup() - { - return photo_not_avail_fixup; - - } // end getPhotoNotAvailFixup - - public CommunityLeftMenu createCommunityMenu(CommunityContext comm) - { - return comm_menu_fact.createMenu(comm); - - } // end createCommunityMenu - - String getDefaultServletAddress(RenderData rdat, CommunityContext comm) - { - return comm_menu_fact.getDefaultServletAddress(rdat,comm); - - } // end getDefaultServletAddress - - /*-------------------------------------------------------------------------------- - * Static operations for use by VeniceServlet - *-------------------------------------------------------------------------------- - */ - - public static RenderConfig getRenderConfig(ServletContext ctxt) throws ServletException - { - // Look in the servlet attributes first. - Object obj = ctxt.getAttribute(ATTR_NAME); - if (obj!=null) - return (RenderConfig)obj; - - // Get the root file path. - String root_file_path = ctxt.getRealPath("/"); - if (!(root_file_path.endsWith("/"))) - root_file_path += "/"; - - // Get the parameter for the renderer's config file. - String cfgfile = ctxt.getInitParameter(CONFIG_FILE_PARAM); - if (!(cfgfile.startsWith("/"))) - cfgfile = root_file_path + cfgfile; - logger.info("Initializing Venice rendering using config file: " + cfgfile); - - try - { // create the RenderConfig object and save it to attributes. - RenderConfig rconf = new RenderConfig(cfgfile,root_file_path); - ctxt.setAttribute(ATTR_NAME,rconf); - return rconf; - - } // end try - catch (ConfigException e) - { // configuration failed! post an error message - logger.fatal("Rendering configuration failed: " + e.getMessage(),e); - throw new ServletException("Venice rendering configuration failed: " + e.getMessage(),e); - - } // end catch - - } // end getRenderConfig - - public static RenderData createRenderData(ServletContext ctxt, HttpServletRequest request, - HttpServletResponse response) throws ServletException - { - UserContext uc = Variables.getUserContext(ctxt,request,request.getSession(true)); - return new RenderData(getRenderConfig(ctxt),uc,ctxt,request,response); - - } // end createRenderData - - public static RenderData createRenderData(ServletContext ctxt, UserContext uc, HttpServletRequest request, - HttpServletResponse response) throws ServletException - { - return new RenderData(getRenderConfig(ctxt),uc,ctxt,request,response); - - } // end createRenderData - - /*-------------------------------------------------------------------------------- - * Static initializer - *-------------------------------------------------------------------------------- - */ - - static - { // Initialize the mapping of color names from render-config.xml to color selector IDs. - HashMap m = new HashMap(); - m.put("frame-bg",new Integer(FRAME_BACKGROUND)); - m.put("title-bg",new Integer(TITLE_BACKGROUND)); - m.put("title-fg",new Integer(TITLE_FOREGROUND)); - m.put("title-link",new Integer(TITLE_LINK)); - m.put("left-bg",new Integer(LEFT_BACKGROUND)); - m.put("left-fg",new Integer(LEFT_FOREGROUND)); - m.put("left-link",new Integer(LEFT_LINK)); - m.put("content-bg",new Integer(CONTENT_BACKGROUND)); - m.put("content-fg",new Integer(CONTENT_FOREGROUND)); - m.put("content-hdr",new Integer(CONTENT_HEADER)); - m.put("content-disabled",new Integer(CONTENT_DISABLED)); - m.put("content-error",new Integer(CONTENT_ERROR)); - m.put("sidebox-title-bg",new Integer(SIDEBOX_TITLE_BACKGROUND)); - m.put("sidebox-title-fg",new Integer(SIDEBOX_TITLE_FOREGROUND)); - m.put("sidebox-content-bg",new Integer(SIDEBOX_CONTENT_BACKGROUND)); - m.put("sidebox-content-fg",new Integer(SIDEBOX_CONTENT_FOREGROUND)); - m.put("sidebox-content-link",new Integer(SIDEBOX_CONTENT_LINK)); - m.put("confirm-title-bg",new Integer(CONFIRM_TITLE_BACKGROUND)); - m.put("confirm-title-fg",new Integer(CONFIRM_TITLE_FOREGROUND)); - m.put("error-title-bg",new Integer(ERROR_TITLE_BACKGROUND)); - m.put("error-title-fg",new Integer(ERROR_TITLE_FOREGROUND)); - colornames_map = Collections.unmodifiableMap(m); - - } // end static initializer - -} // end class RenderConfig diff --git a/src/com/silverwrist/venice/servlets/format/RenderData.java b/src/com/silverwrist/venice/servlets/format/RenderData.java deleted file mode 100644 index d4d565c..0000000 --- a/src/com/silverwrist/venice/servlets/format/RenderData.java +++ /dev/null @@ -1,597 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import java.io.*; -import java.text.DateFormat; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.IOUtil; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.CommunityContext; -import com.silverwrist.venice.core.UserContext; -import com.silverwrist.venice.core.VeniceEngine; -import com.silverwrist.venice.db.PostLinkRewriter; -import com.silverwrist.venice.db.UserNameRewriter; -import com.silverwrist.venice.except.DataException; -import com.silverwrist.venice.servlets.format.menus.LeftMenu; -import com.silverwrist.venice.util.IDUtils; - -public class RenderData implements ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - private static final String ATTR_NAME = "com.silverwrist.venice.RenderData"; - - private static Category logger = Category.getInstance(RenderData.class.getName()); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private RenderConfig rconf; - private ServletContext ctxt; - private HttpServletRequest request; - private HttpServletResponse response; - private boolean can_gzip = false; - private Locale my_locale; - private TimeZone my_timezone; - private DateFormat activity_time = null; - private DateFormat display_date = null; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - RenderData(RenderConfig rconf, UserContext uc, ServletContext ctxt, HttpServletRequest request, - HttpServletResponse response) - { - this.rconf = rconf; - this.ctxt = ctxt; - this.request = request; - this.response = response; - - // determine whether this browser can accept GZIP-encoded content - String encodings = request.getHeader("Accept-Encoding"); - if ((encodings!=null) && (encodings.indexOf("gzip")>=0)) - can_gzip = true; - - // read the user's preferred locale - try - { // get the user default locale - my_locale = uc.getLocale(); - - } // end try - catch (DataException de) - { // locale problems... - my_locale = Locale.getDefault(); - - } // end catch - - // read the user's preferred time zone - try - { // get the user default timezone - my_timezone = uc.getTimeZone(); - - } // end try - catch (DataException de) - { // time zone problems... - my_timezone = TimeZone.getDefault(); - - } // end catch - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static operations - *-------------------------------------------------------------------------------- - */ - - public static RenderData retrieve(ServletRequest request) - { - return (RenderData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public boolean useHTMLComments() - { - return rconf.useHTMLComments(); - - } // end useHTMLComments - - public boolean canGZIPEncode() - { - return rconf.isGZIPAllowed() && can_gzip; - - } // end canGZIPEncode - - public boolean noSmartTags() - { - return rconf.noSmartTags(); - - } // end noSmartTags - - public String getSiteImageTag(int hspace, int vspace) - { - return rconf.getSiteImageTag(hspace,vspace); - - } // end getSiteImageTag - - public String getFullServletPath(String name) - { - StringBuffer buf = new StringBuffer(request.getContextPath()); - buf.append('/').append(name); - return buf.toString(); - - } // end getFullServletPath - - public String getCompleteServletPath(String name) - { - StringBuffer buf = new StringBuffer("http://"); - buf.append(request.getServerName()); - if (request.getServerPort()!=80) - buf.append(':').append(request.getServerPort()); - buf.append(request.getContextPath()).append('/').append(name); - return buf.toString(); - - } // end getCompleteServletPath - - public String getEncodedServletPath(String name) - { - return response.encodeURL(this.getFullServletPath(name)); - - } // end getEncodedServletPath - - public String getFullImagePath(String name) - { - return rconf.getFullImagePath(name); - - } // end getFullImagePath - - public String getStaticFilePath(String name) - { - return rconf.getStaticFilePath(name); - - } // end getStaticFilePath - - public String getFormatJSPPath(String name) - { - return "/format/" + name; - - } // end getFormatJSPPath - - public String getStaticIncludePath(String name) - { - return "/static/" + name; - - } // end getStaticIncludePath - - public String getContextRelativePath(String name) - { - StringBuffer buf = new StringBuffer(request.getContextPath()); - if (name.charAt(0)!='/') - buf.append('/'); - return buf.append(name).toString(); - - } // end getContextRelativePath - - public String getStdFontTag(String color, int size) - { - return rconf.getStdFontTag(color,size); - - } // end getStdFontTag - - public String getStdFontTag(int selector, int size) - { - return rconf.getStdFontTag(selector,size); - - } // end getStdFontTag - - public String getStdBaseFontTag(int size) - { - return rconf.getStdBaseFontTag(size); - - } // end getStdBaseFontTag - - public String getTitleTag(String specific) - { - return rconf.getTitleTag(specific); - - } // end getTitleTag - - public String getRequiredBullet() - { - return rconf.getRequiredBullet(); - - } // end getRequiredBullet - - public void writeContentHeader(Writer out, String primary, String secondary) throws IOException - { - rconf.writeContentHeader(out,primary,secondary); - - } // end writeContentHeader - - public void writeContentSelectorHeader(Writer out, String caption, List choices, - List urls, int selected) throws IOException - { - int nchoice = choices.size(); - if (urls.size()" + rconf.getStdFontTag(CONTENT_HEADER,5) + "" - + StringUtil.encodeHTML(caption) + "  " - + rconf.getStdFontTag(CONTENT_HEADER,3)); - for (int i=0; i"); - else - out.write(""); - out.write(StringUtil.encodeHTML((String)(choices.get(i)))); - if (i==selected) - out.write(""); - else - out.write(""); - out.write(" "); - - } // end for - - out.write("]
\n"); - - } // end writeContentSelectorHeader - - public String getStockMessage(String identifier) - { - return rconf.getStockMessage(identifier); - - } // end getStockMessage - - public void writeStockMessage(Writer out, String identifier) throws IOException - { - rconf.writeStockMessage(out,identifier); - - } // end writeStockMessage - - public String getStdColor(int selector) - { - return rconf.getStdColor(selector); - - } // end getStdColor - - public int scaleFooterLogo(int param) - { - return rconf.scaleFooterLogo(param); - - } // end scaleFooterLogo - - public LeftMenu getLeftMenu(String identifier) - { - return rconf.getLeftMenu(identifier); - - } // end getLeftMenu - - public String loadStyleSheetData() throws IOException - { - return rconf.loadStyleSheetData(); - - } // end loadStyleSheetData - - public boolean hasStyleSheetChanged() - { - return rconf.hasStyleSheetChanged(); - - } // end hasStyleSheetChanged - - public boolean useStyleSheet() - { - return rconf.useStyleSheet(); - - } // end useStyleSheet - - public String getPhotoNotAvailURL() - { - if (rconf.getPhotoNotAvailFixup()) - return rconf.getFullImagePath(rconf.getPhotoNotAvail()); - else - return rconf.getPhotoNotAvail(); - - } // end getPhotoNotAvailURL - - public String getDefaultServletAddress(CommunityContext comm) - { - return rconf.getDefaultServletAddress(this,comm); - - } // end getDefaultServletAddress - - public String formatDateForDisplay(Date date) - { - if (display_date==null) - { // create the display date formatter - display_date = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,my_locale); - display_date.setTimeZone(my_timezone); - - } // end if - - return display_date.format(date); - - } // end formatDateForDisplay - - public Calendar createCalendar() - { - return new GregorianCalendar(my_timezone,my_locale); - - } // end createCalendar - - public Calendar createCalendar(Date date) - { - Calendar rc = new GregorianCalendar(my_timezone,my_locale); - rc.setTime(date); - return rc; - - } // end createCalendar - - public void flushOutput() throws IOException - { - response.flushBuffer(); - - } // end flushOutput - - public String encodeURL(String url) - { - return response.encodeURL(url); - - } // end encodeURL - - public void storeBaseJSPData(BaseJSPData data) - { - data.store(request); - - } // end storeBaseJSPData - - public void storeJSPRender(JSPRender jr) - { - jr.store(request); - - } // end storeJSPRender - - public void setRequestAttribute(String name, Object value) - { - request.setAttribute(name,value); - - } // end setRequestAttribute - - public void forwardDispatch(RequestDispatcher dispatcher) throws IOException, ServletException - { - dispatcher.forward(request,response); - - } // end forwardDispatch - - public void includeDispatch(RequestDispatcher dispatcher) throws IOException, ServletException - { - dispatcher.include(request,response); - - } // end forwardDispatch - - public void redirectTo(String servlet) throws IOException - { - String url = response.encodeRedirectURL(this.getFullServletPath(servlet)); - response.sendRedirect(url); - - } // end redirectTo - - public void redirectAbsolute(String url) throws IOException - { - response.sendRedirect(url); - - } // end redirectAbsolute - - public String getActivityString(Date date) - { - if (date==null) - return "Never"; // safeguard - - Calendar c_last = createCalendar(date); - Calendar c_now = createCalendar(new Date()); - int delta_days = 0; - while ( (c_last.get(Calendar.YEAR)!=c_now.get(Calendar.YEAR)) - || (c_last.get(Calendar.DAY_OF_YEAR)!=c_now.get(Calendar.DAY_OF_YEAR))) - { // advance until we're pointing at the same year and the same day of the year - delta_days++; - c_last.add(Calendar.DAY_OF_YEAR,1); - - } // end while - - switch (delta_days) - { // now return a string based on the difference in days - case 0: - if (activity_time==null) - { // get the "activity" time formatter - activity_time = DateFormat.getTimeInstance(DateFormat.MEDIUM,my_locale); - activity_time.setTimeZone(my_timezone); - - } // end if - return "Today, " + activity_time.format(date); - - case 1: - if (activity_time==null) - { // get the "activity" time formatter - activity_time = DateFormat.getTimeInstance(DateFormat.MEDIUM,my_locale); - activity_time.setTimeZone(my_timezone); - - } // end if - return "Yesterday, " + activity_time.format(date); - - default: - return String.valueOf(delta_days) + " days ago"; - - } // end switch - - } // end getActivityString - - public void nullResponse() - { - response.setStatus(response.SC_NO_CONTENT); - - } // end nullResponse - - public void errorResponse(int code) throws IOException - { - response.sendError(code); - - } // end errorResponse - - public void errorResponse(int code, String msg) throws IOException - { - response.sendError(code,msg); - - } // end errorResponse - - public void sendBinaryData(String type, String filename, int length, InputStream data) throws IOException - { - response.setContentType(type); - response.setContentLength(length); - if (filename!=null) // make sure we pass the filename along, too - response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\";"); - - // Copy the contents of the "data" stream to the output. - IOUtil.copy(data,response.getOutputStream()); - - } // end sendBinaryData - - public String rewritePostData(String data) - { - if ((data.indexOf(PostLinkRewriter.URI_PREFIX)<0) && (data.indexOf(UserNameRewriter.URI_PREFIX)<0)) - return data; - - StringBuffer buf = new StringBuffer(); - String interm; - - if (data.indexOf(PostLinkRewriter.URI_PREFIX)>=0) - { // begin replacing everything with post links - String t = data; - int p = t.indexOf(PostLinkRewriter.URI_PREFIX); - while (p>=0) - { // break off the start of the string - if (p>0) - buf.append(t.substring(0,p)); - t = t.substring(p + PostLinkRewriter.URI_PREFIX.length()); - - // find the end of the post link... - p = 0; - while (IDUtils.isValidPostLinkChar(t.charAt(p))) - p++; - - if (p>0) - { // append the post link to the "go" servlet path, and encode the lot - buf.append(getEncodedServletPath("go/" + t.substring(0,p))); - t = t.substring(p); - - } // end if - else // false alarm - buf.append(PostLinkRewriter.URI_PREFIX); - - // and now look again... - p = t.indexOf(PostLinkRewriter.URI_PREFIX); - - } // end while - - buf.append(t); - interm = buf.toString(); - buf.setLength(0); - - } // end if - else // no post link strings, this is the intermediate form - interm = data; - - if (interm.indexOf(UserNameRewriter.URI_PREFIX)>=0) - { // begin replacing everything with user links - String t = interm; - int p = t.indexOf(UserNameRewriter.URI_PREFIX); - while (p>=0) - { // break off the start of the string - if (p>0) - buf.append(t.substring(0,p)); - t = t.substring(p + UserNameRewriter.URI_PREFIX.length()); - - // find the end of the user link... - p = 0; - while (IDUtils.isValidVeniceIDChar(t.charAt(p))) - p++; - - if (p>0) - { // append the post link to the "user" servlet path, and encode the lot - buf.append(getEncodedServletPath("user/" + t.substring(0,p))); - t = t.substring(p); - - } // end if - else // false alarm - buf.append(UserNameRewriter.URI_PREFIX); - - // and now look again... - p = t.indexOf(UserNameRewriter.URI_PREFIX); - - } // end while - - buf.append(t); - return buf.toString(); - - } // end if - else // no more to find - just return this - return interm; - - } // end rewritePostData - - public String mapToPath(String path) - { - return ctxt.getRealPath(path); - - } // end mapToPath - - public Cookie createCookie(String name, String value, int age) - { - Cookie rc = new Cookie(name,value); - rc.setMaxAge(age); - rc.setPath(request.getContextPath()); - return rc; - - } // end createCookie - -} // end class RenderData diff --git a/src/com/silverwrist/venice/servlets/format/ReportConferenceMenu.java b/src/com/silverwrist/venice/servlets/format/ReportConferenceMenu.java deleted file mode 100644 index 2ebd690..0000000 --- a/src/com/silverwrist/venice/servlets/format/ReportConferenceMenu.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class ReportConferenceMenu implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ReportConferenceMenu"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private List topics; // the topics in this conference - private String locator = null; // the locator - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ReportConferenceMenu(CommunityContext comm, ConferenceContext conf) throws DataException, AccessError - { - this.comm = comm; - this.conf = conf; - this.topics = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ReportConferenceMenu retrieve(ServletRequest request) - { - return (ReportConferenceMenu)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Conference Reports: " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return "confops?cmd=QR&" + getLocator(); - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "report_conf.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public String getConfName() - { - return conf.getName(); - - } // end getConfName - - public String getLocator() - { - if (locator==null) - locator = "sig=" + comm.getCommunityID() + "&conf=" + conf.getConfID(); - return locator; - - } // end getLocator - - public Iterator getTopics() - { - return topics.iterator(); - - } // end getTopics - -} // end class ReportConferenceMenu diff --git a/src/com/silverwrist/venice/servlets/format/SideBoxList.java b/src/com/silverwrist/venice/servlets/format/SideBoxList.java deleted file mode 100644 index e070750..0000000 --- a/src/com/silverwrist/venice/servlets/format/SideBoxList.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class SideBoxList implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.SideBoxList"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private UserContext uc; // user context - private List in_list; // sideboxes that are "in" - private List out_list; // sideboxes that are "out" - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public SideBoxList(VeniceEngine engine, UserContext uc) throws DataException - { - this.uc = uc; - this.in_list = uc.getSideBoxList(); - HashSet ids = new HashSet(in_list.size()); - Iterator it = in_list.iterator(); - while (it.hasNext()) - { // add the IDs of all the sideboxes to the set - SideBoxDescriptor d = (SideBoxDescriptor)(it.next()); - ids.add(new Integer(d.getID())); - - } // end while - - List all_list = engine.getMasterSideBoxList(); - if (all_list.size()>in_list.size()) - { // allocate an ArrayList to hold the sideboxes - out_list = new ArrayList(all_list.size()-in_list.size()); - it = all_list.iterator(); - while (it.hasNext()) - { // get all sideboxes not in the "in" list and put them in the "out" list - SideBoxDescriptor d = (SideBoxDescriptor)(it.next()); - if (!(ids.contains(new Integer(d.getID())))) - out_list.add(d); - - } // end while - - } // end if - else // all sideboxes are "in"... - out_list = Collections.EMPTY_LIST; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static SideBoxList retrieve(ServletRequest request) - { - return (SideBoxList)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Your Front Page Configuration"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "sideboxlist.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public int getInListSize() - { - return in_list.size(); - - } // end getInListSize - - public SideBoxDescriptor getInListItem(int index) - { - return (SideBoxDescriptor)(in_list.get(index)); - - } // end getInListItem - - public int getOutListSize() - { - return out_list.size(); - - } // end getOutListSize - - public SideBoxDescriptor getOutListItem(int index) - { - return (SideBoxDescriptor)(out_list.get(index)); - - } // end getInListItem - -} // end class SideBoxList - diff --git a/src/com/silverwrist/venice/servlets/format/StaticRender.java b/src/com/silverwrist/venice/servlets/format/StaticRender.java deleted file mode 100644 index 519ca08..0000000 --- a/src/com/silverwrist/venice/servlets/format/StaticRender.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import com.silverwrist.util.IOUtil; -import com.silverwrist.util.cache.CacheMap; - -public class StaticRender implements ContentRender -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - private static CacheMap cache = new CacheMap(15,25); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String name; - private boolean processed = false; - private String title = null; - private String content = null; - - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - protected StaticRender(String name) - { - this.name = name; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static String searchBetweenTags(StringBuffer data, String search, String tagname) - { - tagname = tagname.toUpperCase(); - String start = "<" + tagname; - String end = ""; - - int startpos = search.indexOf(start); - if (startpos<0) - return null; - startpos += start.length(); - - int bkt_pos = search.indexOf('>',startpos); - if (bkt_pos<0) - return null; - - int end_pos = search.indexOf(end,++bkt_pos); - if (end_pos<0) - return data.substring(bkt_pos); - else - return data.substring(bkt_pos,end_pos); - - } // end searchBetweenTags - - private synchronized void process(RenderData rdat) - { - if (processed) - return; // check and set flag - - // Map the content path to a real filename. - String real_path = rdat.mapToPath(rdat.getStaticIncludePath(name)); - if (real_path==null) - { // not found! - title = name; - content = "File not mappable: " + name; - return; - - } // end if - - // Read in the whole thing. - StringBuffer raw_file; - try - { // read in from the file - raw_file = IOUtil.loadText(new File(real_path)); - - } // end try - catch (IOException ioe) - { // I/O exception - just discard - title = name; - content = "I/O error reading " + name + ": " + ioe.getMessage(); - return; - - } // end catch - - // make the upper-case search page and use that to locate the page title and body - String search_page = raw_file.toString().toUpperCase(); - title = searchBetweenTags(raw_file,search_page,"TITLE"); - content = searchBetweenTags(raw_file,search_page,"BODY"); - if (content==null) - { // no content? - content = "No content seen on " + name; - processed = false; - - } // end if - - processed = true; // set the flag to indicate we've got everything - - } // end process - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - process(rdat); - if (title==null) - return name; - else - return title; - - } // end getPageTitle - - public String getPageQID() - { - return "static/" + name; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - process(rdat); - if (content!=null) - out.write(content); - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * External static operations - *-------------------------------------------------------------------------------- - */ - - public static StaticRender getStaticRender(String name) - { - StaticRender rc = (StaticRender)(cache.get(name)); - if (rc==null) - { // create a new object and cache it - rc = new StaticRender(name); - cache.put(name,rc); - - } // end if - - return rc; - - } // end getStaticRender - -} // end class StaticRender diff --git a/src/com/silverwrist/venice/servlets/format/TextMessageDialog.java b/src/com/silverwrist/venice/servlets/format/TextMessageDialog.java deleted file mode 100644 index 39dba3f..0000000 --- a/src/com/silverwrist/venice/servlets/format/TextMessageDialog.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.htmlcheck.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class TextMessageDialog implements ContentRender, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Dialog types - public static final int TYPE_ACCEPT_DECLINE = 0; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private int type; - private String title; - private String subtitle; - private String text; - private String[] choices; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public TextMessageDialog(int type, String title, String text, String[] choices) - { - this.type = type; - this.title = title; - this.subtitle = null; - this.text = text; - this.choices = choices; - - int nbutton = getNumButtons(type); - if (choices.length

\n

\n"); - - int nbutton = getNumButtons(type); - for (int i=0; i0) - out.write(" \n"); - out.write("\"");\n"); - - } // end for - - out.write("
\n"); - - } // end renderHere - -} // end class TextMessageDialog diff --git a/src/com/silverwrist/venice/servlets/format/TopDisplay.java b/src/com/silverwrist/venice/servlets/format/TopDisplay.java deleted file mode 100644 index 99ceb65..0000000 --- a/src/com/silverwrist/venice/servlets/format/TopDisplay.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class TopDisplay implements ContentRender, ColorSelectors -{ - /*-------------------------------------------------------------------------------- - * Static data values - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(TopDisplay.class); - - private static final String ATTR_NAME = "com.silverwrist.venice.TopDisplay"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private ServletContext ctxt; - private VeniceEngine engine; - private UserContext uc; - private List top_posts; - private List descrs; - private VeniceContent[] sideboxes; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public TopDisplay(ServletContext ctxt, VeniceEngine engine, UserContext uc) - throws ServletException, DataException, AccessError - { - // Stash some basic information. - this.ctxt = ctxt; - this.engine = engine; - this.uc = uc; - this.top_posts = engine.getPublishedMessages(false); - this.descrs = uc.getSideBoxList(); - - // Create the sideboxes. - sideboxes = new VeniceContent[descrs.size()]; - RenderConfig rconf = RenderConfig.getRenderConfig(ctxt); - for (int i=0; i\n"); - out.write("\n"); - - // The top content is a JSP page, so include it here. - rdat.setRequestAttribute(ATTR_NAME,this); - RequestDispatcher dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath("top_content.jsp")); - out.flush(); - rdat.flushOutput(); // make sure the stuff to be output first is output - try - { // include me! - rdat.includeDispatch(dispatcher); - - } // end try - catch (ServletException se) - { // since we can't throw ServletException, we throw IOException - logger.error("top_content.jsp failure",se); - throw new IOException("Failure including top_content.jsp"); - - } // end catch - - rdat.flushOutput(); // now make sure the included page is properly flushed - - out.write("\n\n"); // break to the sidebox column - - for (int i=0; i" - + "\n" - + rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + "" + sideboxes[i].getPageTitle(rdat) - + "\n\n"); - - // Fill in the sidebox by calling down to the base. - if (sideboxes[i] instanceof ContentRender) - { // we have a direct-rendering component here - do it - ContentRender cr = (ContentRender)(sideboxes[i]); - cr.renderHere(out,rdat); - - } // end if - else if (sideboxes[i] instanceof JSPRender) - { // we have a JSP rendering component here - bounce to the appropriate JSP file - JSPRender jr = (JSPRender)(sideboxes[i]); - rdat.storeJSPRender(jr); - dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath(jr.getTargetJSPName())); - out.flush(); - rdat.flushOutput(); // make sure the stuff to be output first is output - try - { // include me! - rdat.includeDispatch(dispatcher); - - } // end try - catch (ServletException se) - { // since we can't throw ServletException, we write an error message - logger.error("sidebox #" + i + " failure",se); - out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "failure rendering class " - + sideboxes[i].getClass().getName() + ": " + StringUtil.encodeHTML(se.getMessage()) - + "\n"); - out.flush(); - - } // end catch - - rdat.flushOutput(); // now make sure the included page is properly flushed - - } // end else if - else - { // this is bogus - just display a little error here - logger.error("sidebox #" + i + " class " + sideboxes[i].getClass().getName() + " cannot be rendered"); - out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "cannot display sidebox of class: " - + sideboxes[i].getClass().getName() + "\n"); - - } // end else - - // close up the framework of this sidebox - out.write("

\n"); - - } // end for - - if (uc.isLoggedIn()) - { // write the Configure button below the sideboxes - out.write("\"Configure\"\n"); - - } // end if - - // Finish up. - out.write("\n"); - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public static String getPosterName(TopicMessageContext msg) - { - try - { // have to guard agains a DataException here - return msg.getCreatorName(); - - } // end try - catch (DataException de) - { // just return "unknown" on failure - return "(unknown)"; - - } // end catch - - } // end getPosterName - - public static String getTopicPostLink(RenderData rdat, TopicMessageContext msg) - { - try - { // retrieve the topic post link and name, and combine them - TopicContext topic = msg.getEnclosingTopic(); - String plink = topic.getPostLink(); - return "" + topic.getName() + ""; - - } // end try - catch (DataException de) - { // just return null on failure - return null; - - } // end catch - catch (Exception e) - { // temporary guard point here - logger.error("Caught in getTopicPostLink:",e); - return null; - - } // end catch - - } // end getTopicPostLink - - public static String getMessageBodyText(TopicMessageContext msg) - { - try - { // have to guard against a DataException here - return msg.getBodyText(); - - } // end try - catch (DataException de) - { // just return an error message - return "(Unable to retrieve message data: " + StringUtil.encodeHTML(de.getMessage()) + ")"; - - } // end catch - - } // end getMessageBodyText - - public int getNumTopPosts() - { - return top_posts.size(); - - } // end getNumTopPosts - - public TopicMessageContext getTopPost(int index) - { - return (TopicMessageContext)(top_posts.get(index)); - - } // end getTopPost - - public boolean displayWelcome() - { - return !(uc.isLoggedIn()); - - } // end displayWelcome - -} // end class TopDisplay diff --git a/src/com/silverwrist/venice/servlets/format/TopicListing.java b/src/com/silverwrist/venice/servlets/format/TopicListing.java deleted file mode 100644 index babcba6..0000000 --- a/src/com/silverwrist/venice/servlets/format/TopicListing.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.IOException; -import java.io.Writer; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class TopicListing implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.TopicListing"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private CommunityContext comm; // the community we're in - private ConferenceContext conf; // the conference being listed - private int view_opt; // the view option used - private int sort_opt; // the sort option used - private List topic_list; // the topic list - private TopicVisitOrder visit_order; // indicates order in which topics are visited - private String qid; // "quick ID" for this page - private String top_custom; // top custom HTML block - private String bottom_custom; // bottom custom HTML block - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public TopicListing(HttpServletRequest request, CommunityContext comm, ConferenceContext conf, int view_opt, - int sort_opt) throws DataException, AccessError - { - this.comm = comm; - this.conf = conf; - this.view_opt = view_opt; - this.sort_opt = sort_opt; - this.topic_list = conf.getTopicList(view_opt,sort_opt); - this.visit_order = TopicVisitOrder.initialize(request.getSession(true),conf.getConfID(),this.topic_list); - List aliases = conf.getAliases(); - this.qid = "go/" + comm.getAlias() + "!" + (String)(aliases.get(0)); - this.top_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); - this.bottom_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static TopicListing retrieve(ServletRequest request) - { - return (TopicListing)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Topics in " + conf.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return qid; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "topics.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public final String getLocator() - { - StringBuffer buf = new StringBuffer("sig="); - buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID()); - return buf.toString(); - - } // end getLocator - - public final String getConfName() - { - return conf.getName(); - - } // end getConfName - - public final boolean canDoReadNew() - { - return visit_order.isNext(); - - } // end canDoReadNew - - public final String getNextLocator() - { - StringBuffer buf = new StringBuffer("sig="); - buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID()).append("&top="); - buf.append(visit_order.getNext()); - return buf.toString(); - - } // end getNextLocator - - public final boolean canCreateTopic() - { - return conf.canCreateTopic(); - - } // end canCreateTopic - - public final boolean canAddToHotlist() - { - return conf.canAddToHotlist(); - - } // end canAddToHotlist - - public final boolean anyTopics() - { - return (topic_list.size()>0); - - } // end anyTopics - - public final int getViewOption() - { - return view_opt; - - } // end getViewOption - - public final boolean isView(int value) - { - return (view_opt==value); - - } // end isSort - - public final boolean isSort(int value) - { - return (sort_opt==value); - - } // end isSort - - public final Iterator getTopicIterator() - { - return topic_list.iterator(); - - } // end getTopicIterator - - public final void writeTopCustom(Writer out) throws IOException - { - if (top_custom!=null) - out.write(top_custom); - - } // end writeTopCustom - - public final void writeBottomCustom(Writer out) throws IOException - { - if (bottom_custom!=null) - out.write(bottom_custom); - - } // end writeBottomCustom - -} // end class TopicListing diff --git a/src/com/silverwrist/venice/servlets/format/TopicPosts.java b/src/com/silverwrist/venice/servlets/format/TopicPosts.java deleted file mode 100644 index e49bfef..0000000 --- a/src/com/silverwrist/venice/servlets/format/TopicPosts.java +++ /dev/null @@ -1,544 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.awt.Dimension; -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import org.apache.log4j.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class TopicPosts implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(TopicPosts.class); - - private static int SCALING_NUM = 1; - private static int SCALING_DENOM = 2; - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.TopicPosts"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - private CommunityContext comm; - private ConferenceContext conf; - private TopicContext topic; - private int first; - private int last; - private boolean show_advanced; - private boolean no_bozos; - private int unread; - private List messages; - private TopicVisitOrder visit_order; - private String topic_stem; - private String topic_qid; - private String top_custom; - private String bottom_custom; - private String cache_locator = null; - private HashSet bozo_uids = new HashSet(); - private Dimension photo_size = null; - private HashMap uid_photos = null; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public TopicPosts(HttpServletRequest request, VeniceEngine engine, UserContext user, CommunityContext comm, - ConferenceContext conf, TopicContext topic, int first, int last, boolean read_new, - boolean show_advanced, boolean no_bozos) throws DataException, AccessError - { - if (logger.isDebugEnabled()) - logger.debug("TopicPosts: comm=" + comm.getCommunityID() + ", conf=" + conf.getConfID() + ", topic=" - + topic.getTopicNumber() + ", range=[" + first + ", " + last + "], rnm=" + read_new - + ", shac=" + show_advanced + ", nbz=" + no_bozos); - this.engine = engine; - this.comm = comm; - this.conf = conf; - this.topic = topic; - this.first = first; - this.last = last; - this.show_advanced = show_advanced; - this.no_bozos = no_bozos; - this.unread = topic.getUnreadMessages(); - if (read_new) - topic.setUnreadMessages(0); - if (logger.isDebugEnabled()) - logger.debug(this.unread + " unread messages"); - this.messages = topic.getMessages(first,last); - this.visit_order = TopicVisitOrder.retrieve(request.getSession(true),conf.getConfID()); - if (visit_order!=null) - visit_order.visit(topic.getTopicNumber()); - List aliases = conf.getAliases(); - topic_stem = (String)(aliases.get(0)) + "." + topic.getTopicNumber() + "."; - topic_qid = "go/" + comm.getAlias() + "!" + (String)(aliases.get(0)) + "." + topic.getTopicNumber(); - top_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP); - bottom_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM); - - // build up the list of users IN THIS VIEW that are bozo-filtered - HashSet saw_users = new HashSet(); - if (conf.displayPostPictures() && user.displayPostPictures()) - { // build up the mapping of UIDs to photo URLs - Dimension psz = engine.getUserPhotoSize(); - photo_size = new Dimension((psz.width * SCALING_NUM) / SCALING_DENOM, - (psz.height * SCALING_NUM) / SCALING_DENOM); - uid_photos = new HashMap(); - - } // end if - - Iterator it = messages.iterator(); - while (it.hasNext()) - { // get the user IDs of all messages on this page - TopicMessageContext msg = (TopicMessageContext)(it.next()); - Integer the_uid = new Integer(msg.getCreatorUID()); - boolean get_photo; - if (!(saw_users.contains(the_uid))) - { // only check user IDs once per display operation - saw_users.add(the_uid); - get_photo = true; - if (topic.isBozo(the_uid.intValue())) - { // shall we get the user photo? - bozo_uids.add(the_uid); - get_photo = no_bozos; - - } // end if - - if (conf.displayPostPictures() && user.displayPostPictures() && get_photo) - { // look up the user photo URL - UserProfile prof = user.getProfile(the_uid.intValue()); - String url = prof.getPhotoURL(); - if (url!=null) - uid_photos.put(the_uid,url); - - } // end else if - - } // end if - - } // end while - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static TopicPosts retrieve(ServletRequest request) - { - return (TopicPosts)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return topic.getName() + ": " + topic.getTotalMessages() + " Total; " + unread + " New; Last: " - + rdat.formatDateForDisplay(topic.getLastUpdateDate()); - - } // end getPageTitle - - public String getPageQID() - { - return topic_qid; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "posts.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public static final String getPosterName(TopicMessageContext msg) - { - try - { // have to guard agains a DataException here - return msg.getCreatorName(); - - } // end try - catch (DataException de) - { // just return "unknown" on failure - return "(unknown)"; - - } // end catch - - } // end getPosterName - - public static final String getMessageBodyText(TopicMessageContext msg) - { - try - { // have to guard against a DataException here - return msg.getBodyText(); - - } // end try - catch (DataException de) - { // just return an error message - return "(Unable to retrieve message data: " + StringUtil.encodeHTML(de.getMessage()) + ")"; - - } // end catch - - } // end getMessageBodyText - - public final int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public final int getConfID() - { - return conf.getConfID(); - - } // end getConfID - - public final int getTopicNumber() - { - return topic.getTopicNumber(); - - } // end getTopicNumber - - public final int getNextTopicNumber() - { - if (visit_order!=null) - return visit_order.getNext(); - else - return -1; - - } // end getNextTopicNumber - - public final String getConfLocator() - { - StringBuffer buf = new StringBuffer("sig="); - buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID()); - return buf.toString(); - - } // end getConfLocator - - public final String getLocator() - { - if (cache_locator==null) - { // build up the standard locator - StringBuffer buf = new StringBuffer("sig="); - buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID()).append("&top="); - buf.append(topic.getTopicNumber()); - cache_locator = buf.toString(); - - } // end if - - return cache_locator; - - } // end getLocator - - public final String getNextLocator() - { - StringBuffer buf = new StringBuffer("sig="); - buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID()); - if (visit_order!=null) - buf.append("&top=").append(visit_order.getNext()); - return buf.toString(); - - } // end getNextLocator - - public final String getRestoreLocator() - { - StringBuffer buf = new StringBuffer("rtop="); - buf.append(topic.getTopicNumber()).append("&rct=").append(unread); - return buf.toString(); - - } // end getRestoreLocator - - public final String getIdentifyingData() - { - StringBuffer buf = new StringBuffer("Posts "); - buf.append(first).append(" through ").append(last).append(" in topic #").append(topic.getTopicID()); - return buf.toString(); - - } // end getIdentifyingData - - public final String getTopicName() - { - return topic.getName(); - - } // end getTopicName - - public final int getTotalMessages() - { - return topic.getTotalMessages(); - - } // end getTotalMessages - - public final int getNewMessages() - { - return unread; - - } // end getNewMessages - - public final Date getLastUpdate() - { - return topic.getLastUpdateDate(); - - } // end getLastUpdate - - public final boolean isTopicHidden() - { - return topic.isHidden(); - - } // end isTopicHidden - - public final boolean canDoNextTopic() - { - if (visit_order!=null) - return visit_order.isNext(); - else - return false; - - } // end canDoNextTopic - - public final boolean canFreezeTopic() - { - return topic.canFreeze(); - - } // end canFreezeTopic - - public final boolean isTopicFrozen() - { - return topic.isFrozen(); - - } // end isTopicFrozen - - public final boolean canArchiveTopic() - { - return topic.canArchive(); - - } // end canArchiveTopic - - public final boolean isTopicArchived() - { - return topic.isArchived(); - - } // end isTopicArchived - - public final boolean canDeleteTopic() - { - return topic.canDelete(); - - } // end canDeleteTopic - - public final boolean canScrollUp() - { - return (first>0); - - } // end canScrollUp - - public final String getScrollUpLocator() - { - int new_first = first - engine.getNumPostsPerPage(); - int new_last = first - 1; - if (new_first<0) - { // normalize so we start at 0 - new_last += (-new_first); - new_first = 0; - - } // end if - - StringBuffer buf = new StringBuffer("p1="); - buf.append(new_first).append("&p2=").append(new_last); - return buf.toString(); - - } // end getScrollUpLocator - - public final boolean canScrollDown() - { - return ((topic.getTotalMessages() - (1 + last))>0); - - } // end canScrollDown - - public final String getScrollDownLocator() - { - int new_last = last + engine.getNumPostsPerPage(); - int my_last = topic.getTotalMessages() - 1; - if (new_last>my_last) - new_last = my_last; // normalize so we end at the last post - StringBuffer buf = new StringBuffer("p1="); - buf.append(last+1).append("&p2=").append(new_last); - return buf.toString(); - - } // end getScrollDownLocator - - public final boolean canScrollToEnd() - { - return ((topic.getTotalMessages() - (1 + last))>0); - - } // end canScrollToEnd - - public final String getScrollToEndLocator() - { - int my_last = topic.getTotalMessages(); - StringBuffer buf = new StringBuffer("p1="); - buf.append(my_last-engine.getNumPostsPerPage()).append("&p2=").append(my_last-1); - return buf.toString(); - - } // end getScrollToEndLocator - - public final Iterator getMessageIterator() - { - return messages.iterator(); - - } // end getMessageIterator() - - public final boolean emitBreakLinePoint(int msg) - { - return (msg==(topic.getTotalMessages()-unread)); - - } // end emitBreakLinePoint - - public final boolean showAdvanced() - { - return show_advanced && (last==first); - - } // end showAdvanced - - public final boolean displayPostBox() - { - boolean flag1 = conf.canPostToConference(); - boolean flag2 = (topic.isFrozen() ? topic.canFreeze() : true); - boolean flag3 = (topic.isArchived() ? topic.canArchive() : true); - return flag1 && flag2 && flag3; - - } // end displayPostBox - - public final String getDefaultPseud() - { - return conf.getDefaultPseud(); - - } // end getDefaultPseud - - public final String getMessageReference(TopicMessageContext msg) - { - return topic_stem + msg.getPostNumber(); - - } // end getMessageReference - - public final int getNumPostsPerPage() - { - return engine.getNumPostsPerPage(); - - } // end getNumPostsPerPage - - public final boolean displayAttachmentInNewWindow(TopicMessageContext msg) - { - if (!(msg.hasAttachment())) - return false; - String type = msg.getAttachmentType(); - return (type.startsWith("text/") || type.startsWith("image/")); - - } // end displayAttachmentInNewWindow - - public final boolean bozoFilterUser(int uid) - { - if (no_bozos) - return false; - else - return bozo_uids.contains(new Integer(uid)); - - } // end bozoFilterUser - - public final boolean showBozoFilteredIndicator(int uid) - { - if (no_bozos) - return bozo_uids.contains(new Integer(uid)); - else - return false; - - } // end showBozoFilteredIndicator - - public final boolean showFilterButton(int uid) - { - return !(bozo_uids.contains(new Integer(uid))) && topic.canSetBozo(uid); - - } // end showFilterButton - - public final String getUserPhotoTag(int uid, RenderData rdat) - { - if (photo_size==null) - return ""; // user photos not enabled - StringBuffer buf = new StringBuffer("\"\""); - return buf.toString(); - - } // end getUserPhotoTag - - public final boolean displayPostPictures() - { - return (photo_size!=null); - - } // end displayPostPictures - - public final void writeTopCustom(Writer out) throws IOException - { - if (top_custom!=null) - out.write(top_custom); - - } // end writeTopCustom - - public final void writeBottomCustom(Writer out) throws IOException - { - if (bottom_custom!=null) - out.write(bottom_custom); - - } // end writeBottomCustom - -} // end class TopicPosts diff --git a/src/com/silverwrist/venice/servlets/format/UserPhotoData.java b/src/com/silverwrist/venice/servlets/format/UserPhotoData.java deleted file mode 100644 index 9d1810d..0000000 --- a/src/com/silverwrist/venice/servlets/format/UserPhotoData.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.awt.Dimension; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; - -public class UserPhotoData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.UserPhotoData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private Dimension photo_dims; - private String photo_url; - private String target; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public UserPhotoData(VeniceEngine engine, UserContext user, RenderData rdat, String target) - throws DataException - { - photo_dims = engine.getUserPhotoSize(); - photo_url = user.getContactInfo().getPhotoURL(); - if (StringUtil.isStringEmpty(photo_url)) - photo_url = rdat.getPhotoNotAvailURL(); - this.target = target; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static UserPhotoData retrieve(ServletRequest request) - { - return (UserPhotoData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Set User Photo"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "user_photo.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getTarget() - { - return target; - - } // end getTarget - - public String getPhotoTag(RenderData rdat) - { - StringBuffer buf = new StringBuffer("\"\""); - return buf.toString(); - - } // end getPhotoTag - -} // end class UserPhotoData diff --git a/src/com/silverwrist/venice/servlets/format/UserProfileData.java b/src/com/silverwrist/venice/servlets/format/UserProfileData.java deleted file mode 100644 index eeb072b..0000000 --- a/src/com/silverwrist/venice/servlets/format/UserProfileData.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Community System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.awt.Dimension; -import javax.servlet.ServletRequest; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.core.VeniceEngine; -import com.silverwrist.venice.core.UserProfile; - -public class UserProfileData implements JSPRender -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.UserProfileData"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; - private UserProfile prof; - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public UserProfileData(VeniceEngine engine, UserProfile prof) - { - this.engine = engine; - this.prof = prof; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static UserProfileData retrieve(ServletRequest request) - { - return (UserProfileData)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "User Profile - " + prof.getUserName(); - - } // end getPageTitle - - public String getPageQID() - { - return "user/" + prof.getUserName(); - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "userprofile.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public UserProfile getUserProfile() - { - return prof; - - } // end getUserProfile - - public String getAddressLastLine() - { - String tmp_c = prof.getLocality(); - String tmp_s = prof.getRegion(); - StringBuffer buf = new StringBuffer(); - if (!(StringUtil.isStringEmpty(tmp_c)) && !(StringUtil.isStringEmpty(tmp_s))) - buf.append(tmp_c).append(", ").append(tmp_s); - else if (!(StringUtil.isStringEmpty(tmp_c))) - buf.append(tmp_c); - else if (!(StringUtil.isStringEmpty(tmp_s))) - buf.append(tmp_s); - tmp_s = prof.getPostalCode(); - if (!(StringUtil.isStringEmpty(tmp_s))) - buf.append(' ').append(tmp_s); - return buf.toString(); - - } // end getAddressLastLine - - public String getFullName() - { - StringBuffer buf = new StringBuffer(prof.getGivenName()); - String tmp = prof.getNamePrefix(); - if (!(StringUtil.isStringEmpty(tmp))) - { // insert prefix at beginning - buf.insert(0,' '); - buf.insert(0,tmp); - - } // end if - if (prof.getMiddleInitial()!=' ') - buf.append(' ').append(prof.getMiddleInitial()).append('.'); - buf.append(' ').append(prof.getFamilyName()); - tmp = prof.getNameSuffix(); - if (!(StringUtil.isStringEmpty(tmp))) - buf.append(' ').append(tmp); - return buf.toString(); - - } // end getFullName - - public String getPhotoTag(RenderData rdat) - { - Dimension dim = engine.getUserPhotoSize(); - StringBuffer buf = new StringBuffer("\"\""); - return buf.toString(); - - } // end getPhotoTag - -} // end class UserProfileData diff --git a/src/com/silverwrist/venice/servlets/format/VerifyEmailDialog.java b/src/com/silverwrist/venice/servlets/format/VerifyEmailDialog.java deleted file mode 100644 index 82b1ede..0000000 --- a/src/com/silverwrist/venice/servlets/format/VerifyEmailDialog.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.util.IDUtils; - -public class VerifyEmailDialog extends ContentDialog -{ - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - int confirm_num = 0; - - /*-------------------------------------------------------------------------------- - * Constructors - *-------------------------------------------------------------------------------- - */ - - public VerifyEmailDialog() - { - super("Verify E-mail Address",null,"verifyform","account"); - setInstructions("Check your e-mail, then enter the confirmation number that was e-mailed to you " - + "in the field below. Once you do so, your account will be fully validated. " - + "If you have not received your confirmation, click on the 'Send Again' button " - + "below."); - setHiddenField("cmd","V"); - setHiddenField("tgt",""); - addFormField(new CDTextFormField("num","Confirmation number",null,false,7,7)); - addCommandButton(new CDImageButton("ok","bn_ok.gif","OK",80,24)); - addCommandButton(new CDImageButton("again","bn_send_again.gif","Send Again",80,24)); - addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); - - } // end constructor - - protected VerifyEmailDialog(VerifyEmailDialog other) - { - super(other); - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Overrides from class ContentDialog - *-------------------------------------------------------------------------------- - */ - - protected void validateWholeForm() throws ValidationException - { - try - { // convert to a number and check its range - int num = Integer.parseInt(getFieldValue("num")); - - if (!IDUtils.isValidConfirmationNumber(num)) - throw new ValidationException("The value you have entered is not a valid confirmation number."); - - confirm_num = num; // save off for later - - } // end try - catch (NumberFormatException e) - { // conversion error! - throw new ValidationException("The value you have entered is not a valid number."); - - } // end catch - - } // end validateWholeForm - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void setTarget(String target) - { - setHiddenField("tgt",target); - - } // end setTarget - - public int getConfirmationNumber() - { - return confirm_num; - - } // end getConfirmationNumber - - public void resetOnError(String message) - { - setErrorMessage(message); - setFieldValue("num",null); - - } // end resetOnError - - public Object clone() - { - return new VerifyEmailDialog(this); - - } // end clone - -} // end class VerifyEmailDialog - - - - diff --git a/src/com/silverwrist/venice/servlets/format/ViewCommunityMembers.java b/src/com/silverwrist/venice/servlets/format/ViewCommunityMembers.java deleted file mode 100644 index dbcb679..0000000 --- a/src/com/silverwrist/venice/servlets/format/ViewCommunityMembers.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; -import com.silverwrist.venice.security.Role; - -public class ViewCommunityMembers implements JSPRender, SearchMode -{ - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.ViewCommunityMembers"; - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private VeniceEngine engine; // engine context - private CommunityContext comm; // community context - private List display_list = null; // list of members to display - private boolean simple_list = false; // simple list? - private int field = -1; // search field - private int mode = -1; // search mode - private String term = null; // search term - private int offset = 0; // search result offset - private int find_count = -1; // search results count - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public ViewCommunityMembers(VeniceEngine engine, CommunityContext comm) - { - this.engine = engine; - this.comm = comm; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Internal functions - *-------------------------------------------------------------------------------- - */ - - private static int getParamInt(ServletRequest request, String name, int default_val) - { - String str = request.getParameter(name); - if (str==null) - return -1; - - try - { // parse the integer value - return Integer.parseInt(str); - - } // end try - catch (NumberFormatException nfe) - { // in case of conversion error, return default - return default_val; - - } // end catch - - } // end getParamInt - - private static boolean isImageButtonClicked(ServletRequest request, String name) - { - String val = request.getParameter(name + ".x"); - return (val!=null); - - } // end isImageButtonClicked - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static ViewCommunityMembers retrieve(ServletRequest request) - { - return (ViewCommunityMembers)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Members of Community " + comm.getName(); - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "view_member.jsp"; - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public void doInitialList() throws DataException - { - display_list = comm.getMemberList(); - simple_list = true; - term = ""; - offset = 0; - find_count = display_list.size(); - - } // end doInitialList - - public void doSearch(ServletRequest request) throws ValidationException, DataException - { - // Get the "simple list" parameter. - int slp = getParamInt(request,"sl",1); - simple_list = (slp==1); - - if (simple_list) - { // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - throw new ValidationException("Invalid button click."); // this can't happen - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Get the member list and offset it if necessary. - List tmp = comm.getMemberList(); - if (find_count<0) - find_count = tmp.size(); - if (offset>0) - display_list = tmp.subList(offset,tmp.size()); - else - display_list = tmp; - - term = ""; // null out the search term - - } // end if - else - { // Validate the search field parameter. - field = getParamInt(request,"field",FIELD_USER_NAME); - if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME) - && (field!=FIELD_USER_FAMILY_NAME)) - throw new ValidationException("The field search parameter is not valid."); - - // Validate the search mode parameter. - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); - - // Retrieve the search term parameter. - term = request.getParameter("term"); - if (term==null) - term = ""; - - // Retrieve the offset and find count parameters. - offset = getParamInt(request,"ofs",0); - find_count = getParamInt(request,"fcount",-1); - - // Adjust the search return offset based on the command button click. - int count = getNumResultsDisplayed(); - if (isImageButtonClicked(request,"search")) - offset = 0; - else if (isImageButtonClicked(request,"previous")) - { // adjust the offset in the reverse direction - offset -= count; - if (offset<0) - offset = 0; - - } // end else if - else if (isImageButtonClicked(request,"next")) - offset += count; // go forwards instead - else - throw new ValidationException("Unable to determine what action triggered the form."); - - // Perform the search! - display_list = comm.searchForMembers(field,mode,term,offset,count); - if (find_count<0) - find_count = comm.getSearchMemberCount(field,mode,term); - - } // end else - - } // end doSearch - - public int getNumResultsDisplayed() - { - return engine.getStdNumSearchResults(); - - } // end getNumResultsDisplayed - - public String getCommunityName() - { - return comm.getName(); - - } // end getCommunityName - - public int getCommunityID() - { - return comm.getCommunityID(); - - } // end getCommunityID - - public boolean getSimpleList() - { - return simple_list; - - } // end getSimpleList - - public int getSimpleListParam() - { - return (simple_list ? 1 : 0); - - } // end getSimpleListParam - - public int getSearchField() - { - return field; - - } // end getSearchField - - public int getSearchMode() - { - return mode; - - } // end getSearchMode - - public boolean searchFieldIs(int value) - { - return (field==value); - - } // end searchFieldIs - - public boolean searchModeIs(int value) - { - return (mode==value); - - } // end searchModeIs - - public String getSearchTerm() - { - return term; - - } // end getSearchTerm - - public int getFindCount() - { - return find_count; - - } // end getFindCount - - public int getOffset() - { - return offset; - - } // end getOffset - - public int getSize() - { - return display_list.size(); - - } // end getSize - - public boolean displayList() - { - if ((display_list==null) || (display_list.size()==0)) - return false; - return true; - - } // end displayList - - public UserFound getItem(int ndx) - { - return (UserFound)(display_list.get(ndx)); - - } // end getItem - - public boolean isCommunityAdmin(UserFound uf) - { - SecurityInfo sinf = comm.getSecurityInfo(); - Role r = sinf.getRole("Community.Host"); - return r.isSatisfiedBy(uf.getLevel()); - - } // end isCommunityAdmin - -} // end class ViewCommunityMembers diff --git a/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java b/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java deleted file mode 100644 index dacb2b5..0000000 --- a/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License Version 1.1 - * (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at . - * - * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - * WARRANTY OF ANY KIND, either express or implied. See the License for the specific - * language governing rights and limitations under the License. - * - * The Original Code is the Venice Web Communities System. - * - * The Initial Developer of the Original Code is Eric J. Bowersox , - * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - * - * Contributor(s): - */ -package com.silverwrist.venice.servlets.format.menus; - -import java.io.Writer; -import java.io.IOException; -import java.util.*; -import org.apache.log4j.*; -import org.w3c.dom.*; -import com.silverwrist.util.*; -import com.silverwrist.venice.except.ConfigException; -import com.silverwrist.venice.servlets.format.ComponentRender; -import com.silverwrist.venice.servlets.format.RenderData; - -public class LeftMenu implements ComponentRender -{ - /*-------------------------------------------------------------------------------- - * Internal class representing a header component - *-------------------------------------------------------------------------------- - */ - - static class Header implements ComponentRender - { - private TextItem item; - - Header(Element elt) - { - DOMElementHelper h = new DOMElementHelper(elt); - item = new TextItem(h.getElementText()); - - } // end constructor - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - out.write(""); - item.renderHere(out,rdat); - out.write("
\n"); - - } // end renderHere - - } // end class Header - - /*-------------------------------------------------------------------------------- - * Internal class representing a separator component - *-------------------------------------------------------------------------------- - */ - - static class Separator implements ComponentRender - { - private ComponentRender cr; - - Separator() - { - this.cr = null; - - } // end constructor - - Separator(ComponentRender cr) - { - this.cr = cr; - - } // end constructor - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - if (cr!=null) - cr.renderHere(out,rdat); - out.write("
\n"); - - } // end renderHere - - } // end class Separator - - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(LeftMenu.class); - private static final Separator separator_singleton = new Separator(null); - - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String identifier; - private ArrayList menu_items = new ArrayList(); - - /*-------------------------------------------------------------------------------- - * Constructor - *-------------------------------------------------------------------------------- - */ - - public LeftMenu(Element elt, String identifier) throws ConfigException - { - if (!(elt.getNodeName().equals("menudef"))) - { // just some shorts-checking here to make sure the element is OK - logger.fatal("huh?!? this should have been a if it got here!"); - throw new ConfigException("not a element"); - - } // end if - - NodeList items = elt.getChildNodes(); - for (int i=0; i inside "); - throw new ConfigException("unknown element <" + n.getNodeName() + "/> inside ",n); - - } // end else - - } // end if (an element node) - - } // end for (each child node) - - this.identifier = identifier; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender - *-------------------------------------------------------------------------------- - */ - - public void renderHere(Writer out, RenderData rdat) throws IOException - { - Iterator it = menu_items.iterator(); - while (it.hasNext()) - { // render each menu item in turn - ComponentRender cr = (ComponentRender)(it.next()); - cr.renderHere(out,rdat); - - } // end while - - } // end renderHere - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public String getIdentifier() - { - return identifier; - - } // end getIdentifier - -} // end class LeftMenu - diff --git a/src/com/silverwrist/venice/ui/AutoCleanup.java b/src/com/silverwrist/venice/ui/AutoCleanup.java new file mode 100644 index 0000000..ad350bc --- /dev/null +++ b/src/com/silverwrist/venice/ui/AutoCleanup.java @@ -0,0 +1,24 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +public interface AutoCleanup +{ + public abstract void cleanup(); + +} // end interface AutoCleanup diff --git a/src/com/silverwrist/venice/servlets/format/ColorSelectors.java b/src/com/silverwrist/venice/ui/ColorSelectors.java similarity index 97% rename from src/com/silverwrist/venice/servlets/format/ColorSelectors.java rename to src/com/silverwrist/venice/ui/ColorSelectors.java index 9798b77..1d24262 100644 --- a/src/com/silverwrist/venice/servlets/format/ColorSelectors.java +++ b/src/com/silverwrist/venice/ui/ColorSelectors.java @@ -15,7 +15,7 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui; public interface ColorSelectors { diff --git a/src/com/silverwrist/venice/ui/Content.java b/src/com/silverwrist/venice/ui/Content.java new file mode 100644 index 0000000..0f4dabb --- /dev/null +++ b/src/com/silverwrist/venice/ui/Content.java @@ -0,0 +1,34 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +public interface Content +{ + public static final int MENU_SELECTOR_NOCHANGE = -1; + public static final int MENU_SELECTOR_TOP = 0; + public static final int MENU_SELECTOR_COMMUNITY = 1; + + public abstract boolean needFrame(); + + public abstract int getMenuSelector(); + + public abstract String getPageTitle(RequestOutput ro); + + public abstract String getPageQID(); + +} // end interface Content diff --git a/src/com/silverwrist/venice/servlets/format/ComponentRender.java b/src/com/silverwrist/venice/ui/ContentDirect.java similarity index 79% rename from src/com/silverwrist/venice/servlets/format/ComponentRender.java rename to src/com/silverwrist/venice/ui/ContentDirect.java index de61378..2701a49 100644 --- a/src/com/silverwrist/venice/servlets/format/ComponentRender.java +++ b/src/com/silverwrist/venice/ui/ContentDirect.java @@ -15,13 +15,12 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui; -import java.io.Writer; import java.io.IOException; -public interface ComponentRender +public interface ContentDirect extends Content { - public abstract void renderHere(Writer out, RenderData rdat) throws IOException; + public abstract void render(RequestOutput out) throws IOException; -} // end interface ComponentRender +} // end interface ContentDirect diff --git a/src/com/silverwrist/venice/servlets/format/VeniceContent.java b/src/com/silverwrist/venice/ui/ContentExecute.java similarity index 80% rename from src/com/silverwrist/venice/servlets/format/VeniceContent.java rename to src/com/silverwrist/venice/ui/ContentExecute.java index 4b03729..1f9ac08 100644 --- a/src/com/silverwrist/venice/servlets/format/VeniceContent.java +++ b/src/com/silverwrist/venice/ui/ContentExecute.java @@ -15,12 +15,12 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui; -public interface VeniceContent +import java.io.IOException; + +public interface ContentExecute { - public abstract String getPageTitle(RenderData rdat); + public abstract void execute(RequestExec req) throws IOException; - public abstract String getPageQID(); - -} // end interface VeniceContent +} // end interface ContentExecute diff --git a/src/com/silverwrist/venice/servlets/format/JSPRender.java b/src/com/silverwrist/venice/ui/ContentJSP.java similarity index 76% rename from src/com/silverwrist/venice/servlets/format/JSPRender.java rename to src/com/silverwrist/venice/ui/ContentJSP.java index 2415a17..89bc6e2 100644 --- a/src/com/silverwrist/venice/servlets/format/JSPRender.java +++ b/src/com/silverwrist/venice/ui/ContentJSP.java @@ -15,14 +15,14 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui; -import javax.servlet.ServletRequest; - -public interface JSPRender extends VeniceContent +public interface ContentJSP extends Content { - public abstract void store(ServletRequest request); + public abstract String getJSPName(); - public abstract String getTargetJSPName(); + public abstract void initialize(RequestInput req); -} // end interface JSPRender + public abstract void terminate(RequestInput req); + +} // end interface ContentJSP diff --git a/src/com/silverwrist/venice/ui/LinkTypes.java b/src/com/silverwrist/venice/ui/LinkTypes.java new file mode 100644 index 0000000..3348cae --- /dev/null +++ b/src/com/silverwrist/venice/ui/LinkTypes.java @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +public interface LinkTypes +{ + public static final int ABSOLUTE = 0; + + public static final int SERVLET = 1; + + public static final int FRAME = 2; + +} // end interface LinkTypes diff --git a/src/com/silverwrist/venice/servlets/format/ContentRender.java b/src/com/silverwrist/venice/ui/RenderDirect.java similarity index 78% rename from src/com/silverwrist/venice/servlets/format/ContentRender.java rename to src/com/silverwrist/venice/ui/RenderDirect.java index 267c03c..0983efc 100644 --- a/src/com/silverwrist/venice/servlets/format/ContentRender.java +++ b/src/com/silverwrist/venice/ui/RenderDirect.java @@ -15,13 +15,12 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui; -import java.io.Writer; import java.io.IOException; -public interface ContentRender extends VeniceContent +public interface RenderDirect { - public abstract void renderHere(Writer out, RenderData rdat) throws IOException; + public abstract void render(RequestOutput out) throws IOException; -} // end interface ContentRender +} // end interface RenderDirect diff --git a/src/com/silverwrist/venice/ui/RequestExec.java b/src/com/silverwrist/venice/ui/RequestExec.java new file mode 100644 index 0000000..9a92344 --- /dev/null +++ b/src/com/silverwrist/venice/ui/RequestExec.java @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +import java.io.InputStream; +import java.io.IOException; +import java.sql.Blob; +import java.sql.SQLException; + +public interface RequestExec extends LinkTypes +{ + public abstract void error(int code) throws IOException; + + public abstract void error(int code, String message) throws IOException; + + public abstract void redirect(String where, int type) throws IOException; + + public abstract void noContent(); + + public abstract void sendBinary(String type, String filename, int length, InputStream data) + throws IOException; + + public abstract void sendBinary(String type, int length, InputStream data) throws IOException; + + public abstract void sendBinary(String type, String filename, Blob data) throws IOException, SQLException; + + public abstract void sendBinary(String type, Blob data) throws IOException, SQLException; + + public abstract void sendBinary(String type, String filename, byte[] data) throws IOException; + + public abstract void sendBinary(String type, byte[] data) throws IOException; + + public abstract void sendText(String type, String data) throws IOException; + + public abstract void sendText(String type, char[] data) throws IOException; + +} // end interface RequestExec diff --git a/src/com/silverwrist/venice/ui/RequestInput.java b/src/com/silverwrist/venice/ui/RequestInput.java new file mode 100644 index 0000000..3c8ec2f --- /dev/null +++ b/src/com/silverwrist/venice/ui/RequestInput.java @@ -0,0 +1,180 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +import java.awt.Dimension; +import java.io.InputStream; +import java.io.IOException; +import java.util.Date; +import java.util.Enumeration; +import java.util.Map; +import com.silverwrist.util.ServletMultipartException; +import com.silverwrist.venice.core.CommunityContext; +import com.silverwrist.venice.core.UserContext; +import com.silverwrist.venice.core.VeniceEngine; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.dlg.Dialog; +import com.silverwrist.venice.ui.helpers.ErrorBox; +import com.silverwrist.venice.ui.menus.MenuComponent; +import com.silverwrist.venice.ui.script.ScriptManager; + +public interface RequestInput extends LinkTypes +{ + public static final String LOGIN_COOKIE = "VeniceAuth"; + public static final int LOGIN_COOKIE_AGE = 60*60*24*365; // one year + public static final String LEFT_MENU_SESSION_ATTR = "LeftMenu"; + + public abstract String mapPath(String s); + + public abstract String getContextPath(); + + public abstract String getServletPath(); + + public abstract String getPathInfo(); + + public abstract String getQueryString(); + + public abstract String getVerb(); + + public abstract String getSourceAddress(); + + public abstract boolean hasParameter(String name); + + public abstract String getParameter(String name); + + public abstract int getParameterInt(String name, int default_value); + + public abstract short getParameterShort(String name, short default_value); + + public abstract long getParameterLong(String name, long default_value); + + public abstract Enumeration getParameterNames(); + + public abstract String[] getParameterValues(String name); + + public abstract boolean isFileParam(String name); + + public abstract String getParameterType(String name); + + public abstract int getParameterSize(String name); + + public abstract InputStream getParameterDataStream(String name) throws ServletMultipartException; + + public abstract boolean isImageButtonClicked(String name); + + public abstract Object getAppAttribute(String name); + + public abstract void setAppAttribute(String name, Object o); + + public abstract Object getSessionAttribute(String name); + + public abstract void setSessionAttribute(String name, Object o); + + public abstract Object getRequestAttribute(String name); + + public abstract void setRequestAttribute(String name, Object o); + + public abstract void savePersistentCookie(String name, String value, int max_age); + + public abstract void saveTemporaryCookie(String name, String value); + + public abstract void deleteCookie(String name); + + public abstract VeniceEngine getEngine(); + + public abstract UserContext getUser(); + + public abstract void replaceUser(UserContext new_user); + + public abstract ScriptManager getScriptManager(); + + public abstract String getStyleSheetData() throws IOException; + + public abstract String getColor(int selector); + + public abstract String getColor(String name); + + public abstract boolean useHTMLComments(); + + public abstract String formatURL(String url, int type); + + public abstract String formatDate(Date date); + + public abstract String getFontTag(int colorsel, int size); + + public abstract String getFontTag(String color, int size); + + public abstract String getFontTag(int colorsel, String size); + + public abstract String getFontTag(String color, String size); + + public abstract int convertLinkType(String str); + + public abstract String getLocation(); + + public abstract void setLocation(String str); + + public abstract boolean getDisplayLogin(); + + public abstract void setDisplayLogin(boolean val); + + public abstract String getStockMessage(String key); + + public abstract String getStockMessage(String key, Map vars); + + public abstract String getStaticPath(String s); + + public abstract String getExternalStaticPath(String s); + + public abstract String getImagePath(String s); + + public abstract MenuComponent getMenu(String name); + + public abstract MenuComponent getMenu(String name, Map vars); + + public abstract String getScriptName(String raw_name); + + public abstract String getScriptName(boolean strip_ext); + + public abstract String getScriptLoggerName(String raw_name); + + public abstract String getScriptLoggerName(); + + public abstract Dialog getDialog(String name); + + public abstract Content[] getSideBoxes() throws AccessError, DataException; + + public abstract String getUserPhotoTag(String url); + + public abstract String getUserPhotoTag(String url, Dimension size); + + public abstract CommunityContext getCommunity(); + + public abstract CommunityContext getCommunity(boolean required, String on_error) throws ErrorBox; + + public abstract String getActivityString(Date date); + + public abstract String getDefaultServletAddress(CommunityContext comm); + + public abstract String getCommunityLogoTag(String url); + + public abstract String expandServletPath(String spath); + + public abstract void registerCleanup(AutoCleanup ac); + +} // end interface RequestInput diff --git a/src/com/silverwrist/venice/ui/RequestOutput.java b/src/com/silverwrist/venice/ui/RequestOutput.java new file mode 100644 index 0000000..ee2a1ad --- /dev/null +++ b/src/com/silverwrist/venice/ui/RequestOutput.java @@ -0,0 +1,95 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui; + +import java.awt.Dimension; +import java.io.IOException; +import java.io.Writer; +import java.util.Date; +import java.util.Map; +import javax.servlet.ServletException; + +public interface RequestOutput extends LinkTypes +{ + public abstract Writer getWriter() throws IOException; + + public abstract void write(String s) throws IOException; + + public abstract void writeStackTrace(Throwable t) throws IOException; + + public abstract void flush() throws IOException; + + public abstract void output(Content c) throws IOException, ServletException; + + public abstract void output(Writer out, Content c) throws IOException, ServletException; + + public abstract void writeFrameHead(Writer out, Content c) throws IOException; + + public abstract void writeFrameHead(Content c) throws IOException; + + public abstract void writeSiteImageTag(Writer out) throws IOException; + + public abstract void writeSiteImageTag() throws IOException; + + public abstract void writeVeniceLogo(Writer out) throws IOException; + + public abstract void writeVeniceLogo() throws IOException; + + public abstract void writeContentHeader(Writer out, String primary, String secondary) throws IOException; + + public abstract void writeContentHeader(String primary, String secondary) throws IOException; + + public abstract String formatURL(String url, int type); + + public abstract String formatDate(Date date); + + public abstract String getColor(int selector); + + public abstract String getColor(String name); + + public abstract String getFontTag(int colorsel, int size); + + public abstract String getFontTag(String color, int size); + + public abstract String getFontTag(int colorsel, String size); + + public abstract String getFontTag(String color, String size); + + public abstract String getStockMessage(String key); + + public abstract String getStockMessage(String key, Map vars); + + public abstract String getStaticPath(String s); + + public abstract String getExternalStaticPath(String s); + + public abstract String getImagePath(String s); + + public abstract String getButtonVisual(String id); + + public abstract String getButtonInput(String id); + + public abstract String getUserPhotoTag(String url); + + public abstract String getUserPhotoTag(String url, Dimension size); + + public abstract String getActivityString(Date date); + + public abstract String getCommunityLogoTag(String url); + +} // end interface RequestOutput diff --git a/src/com/silverwrist/venice/ui/conf/AttachmentContent.java b/src/com/silverwrist/venice/ui/conf/AttachmentContent.java new file mode 100644 index 0000000..db7054f --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/AttachmentContent.java @@ -0,0 +1,68 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.helpers; + +import java.io.InputStream; +import java.io.IOException; +import com.silverwrist.venice.core.TopicMessageContext; +import com.silverwrist.venice.except.AccessError; +import com.silverwrist.venice.except.DataException; +import com.silverwrist.venice.ui.ContentExecute; +import com.silverwrist.venice.ui.LinkTypes; +import com.silverwrist.venice.ui.RequestExec; +import com.silverwrist.venice.ui.helpers.ThrowableContent; + +public class AttachmentContent extends ThrowableContent implements ContentExecute +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String type; + private String filename; + private int length; + private InputStream stm; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public AttachmentContent(TopicMessageContext msg) throws AccessError, DataException + { + super(); + this.type = msg.getAttachmentType(); + this.filename = msg.getAttachmentFilename(); + this.length = msg.getAttachmentLength(); + this.stm = msg.getAttachmentData(); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentExecute + *-------------------------------------------------------------------------------- + */ + + public void execute(RequestExec req) throws IOException + { + req.sendBinary(type,filename,length,stm); + + } // end execute + +} // end class BinaryDataContent diff --git a/src/com/silverwrist/venice/ui/conf/CurrentConference.java b/src/com/silverwrist/venice/ui/conf/CurrentConference.java new file mode 100644 index 0000000..18ea589 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/CurrentConference.java @@ -0,0 +1,631 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf; + +import java.util.*; +import javax.servlet.*; +import org.apache.log4j.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class CurrentConference implements AutoCleanup +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(CurrentConference.class); + + private static final String ATTR_NAME = "HELPER.CurrentConference"; + private static final String TOPIC_SORT_HOLDER_ATTR = "conference.topic.TopicSortHolder"; + private static final String TOPIC_VISIT_ORDER_ATTR = "conference.topic.TopicVisitOrder"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private RequestInput rinput; + private ConferenceContext conf = null; + private TopicContext topic = null; + private TopicSortHolder topic_sort = null; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public CurrentConference(RequestInput rinput) + { + this.rinput = rinput; + rinput.setRequestAttribute(ATTR_NAME,this); + rinput.registerCleanup(this); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private final synchronized void getTopicSortHolder() + { + if (topic_sort==null) + { // look in the session variables first + topic_sort = (TopicSortHolder)(rinput.getSessionAttribute(TOPIC_SORT_HOLDER_ATTR)); + if (topic_sort==null) + { // create a new one and save it off + topic_sort = new TopicSortHolder(); + rinput.setSessionAttribute(TOPIC_SORT_HOLDER_ATTR,topic_sort); + + } // end if + + } // end if + + } // end getTopicSortHolder + + /*-------------------------------------------------------------------------------- + * Implementations from interface AutoCleanup + *-------------------------------------------------------------------------------- + */ + + public void cleanup() + { + rinput.setRequestAttribute(ATTR_NAME,null); + rinput = null; + conf = null; + topic_sort = null; + + } // end cleanup + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final ConferenceContext getConferenceParam(String param_name, boolean required, String on_error) + throws ErrorBox, LogInOrCreate + { + CommunityContext comm = rinput.getCommunity(required,on_error); + ConferenceContext rc = null; + + if (rinput.hasParameter(param_name)) + { // get the conference ID + int conf_id = rinput.getParameterInt(param_name,-1); + if (conf_id<0) + { // the ID parameter is not valid! + logger.error("Cannot convert conference parameter '" + rinput.getParameter(param_name) + "'!"); + throw new ErrorBox(null,"Invalid conference parameter.",on_error); + + } // end if + + if (comm==null) + throw new ErrorBox(null,"Community context for conference not specified.",on_error); + + try + { // get the conference context + rc = comm.getConferenceContext(conf_id); + if (rc==null) + { // couldn't find the conference + logger.error("community #" + comm.getCommunityID() + " does not contain conference #" + conf_id); + throw new ErrorBox(null,"The conference #" + conf_id + " could not be found in the '" + + comm.getName() + "' community.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("found conf #" + rc.getConfID()); + + } // end try + catch (AccessError ae) + { // these all get handled in pretty much the same way + if (rinput.getUser().isLoggedIn()) + throw new ErrorBox("Access Error",ae.getMessage(),on_error); + else + throw new LogInOrCreate(); + + } // end catch + catch (DataException de) + { // error looking up the conference + throw new ErrorBox("Database Error","Database error finding conference: " + de.getMessage(),on_error); + + } // end catch + + } // end if + else + { // there's no conference parameter + if (required) + { // no conference parameter - bail out now! + logger.error("Conference parameter not specified!"); + throw new ErrorBox(null,"No conference specified.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("no conference specified"); + + } // end else + + return rc; + + } // end getConferenceParam + + public final ConferenceContext getConference() + { + return conf; + + } // end getConference + + public final ConferenceContext getConference(boolean required, String on_error) + throws ErrorBox, LogInOrCreate + { + if (conf!=null) + return conf; + + // call down to our sub-function + conf = getConferenceParam("conf",required,on_error); + return conf; + + } // end getConference + + public final TopicContext getTopicParam(String param_name, boolean required, String on_error) + throws ErrorBox, LogInOrCreate + { + ConferenceContext conf = getConference(required,on_error); + TopicContext rc = null; + + if (logger.isDebugEnabled()) + logger.debug("getTopicParam(\"" + param_name + "\"," + required + ",...) entry - param is " + + rinput.getParameter(param_name)); + + if (rinput.hasParameter(param_name)) + { // get the topic ID + short topic_id = rinput.getParameterShort(param_name,(short)(-1)); + if (topic_id<0) + { // the ID parameter is not valid! + logger.error("Cannot convert topic parameter '" + rinput.getParameter(param_name) + "'!"); + throw new ErrorBox(null,"Invalid topic parameter.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("translated topic parameter: #" + topic_id); + + if (conf==null) + throw new ErrorBox(null,"Conference context for topic not specified.",on_error); + + try + { // get the topic context + rc = conf.getTopic(topic_id); + if (rc==null) + { // couldn't find the topic + logger.error("conference #" + conf.getConfID() + " does not contain topic #" + topic_id); + throw new ErrorBox(null,"The topic #" + topic_id + " could not be found in the '" + + conf.getName() + "' conference.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("found topic #" + rc.getTopicNumber() + " (" + rc.getTopicID() + ")"); + + } // end try + catch (AccessError ae) + { // these all get handled in pretty much the same way + logger.error("caught AccessError: " + ae.getMessage()); + if (rinput.getUser().isLoggedIn()) + throw new ErrorBox("Access Error",ae.getMessage(),on_error); + else + throw new LogInOrCreate(); + + } // end catch + catch (DataException de) + { // error looking up the conference + logger.error("caught DataException: " + de.getMessage()); + throw new ErrorBox("Database Error","Database error finding topic: " + de.getMessage(),on_error); + + } // end catch + + } // end if + else + { // there's no topic parameter + if (required) + { // no topic parameter - bail out now! + logger.error("Topic parameter not specified!"); + throw new ErrorBox(null,"No topic specified.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("no topic specified"); + + } // end else + + return rc; + + } // end getTopicParam + + public final TopicContext getOptionalTopic(String param_name) + { + if (conf==null) + { // no conference context + logger.warn("getOptionalTopic(): no conference context"); + return null; + + } // end if + + short topic_id = rinput.getParameterShort(param_name,(short)0); + if (topic_id<=0) + { // the topic parameter is not real valid + logger.warn("getOptionalTopic(): invalid topic number"); + return null; + + } // end if + + TopicContext rc = null; + try + { // get a topic + rc = conf.getTopic(topic_id); + if (rc==null) + logger.warn("getOptionalTopic(): topic # " + topic_id + " not found"); + + } // end try + catch (DataException de) + { // ignore DataException + logger.warn("getOptionalTopic(): DataException getting topic",de); + return null; + + } // end catch + catch (AccessError ae) + { // ignore AccessError + logger.warn("getOptionalTopic(): AccessError getting topic",ae); + return null; + + } // end catch + + return rc; + + } // end getOptionalTopic + + public final TopicContext getTopic() + { + return topic; + + } // end getTopic + + public final TopicContext getTopic(boolean required, String on_error) throws ErrorBox, LogInOrCreate + { + if (topic!=null) + return topic; + + // call down to our sub-function + topic = getTopicParam("top",required,on_error); + return topic; + + } // end getTopic + + public final TopicMessageContext getMessageParam(String param_name, boolean required, String on_error) + throws ErrorBox, LogInOrCreate + { + ConferenceContext conf = getConference(required,on_error); + TopicMessageContext rc = null; + + if (rinput.hasParameter(param_name)) + { // get the message ID + long message_id = rinput.getParameterLong(param_name,(long)(-1)); + if (message_id<0) + { // the ID parameter is not valid! + logger.error("Cannot convert message parameter '" + rinput.getParameter(param_name) + "'!"); + throw new ErrorBox(null,"Invalid message parameter.",on_error); + + } // end if + + if (conf==null) + throw new ErrorBox(null,"Conference context for message not specified.",on_error); + + try + { // get the message by its post ID + rc = conf.getMessageByPostID(message_id); + if (rc==null) + { // couldn't find the topic + logger.error("conference #" + conf.getConfID() + " does not contain message #" + message_id); + throw new ErrorBox(null,"The message #" + message_id + " could not be found in the '" + + conf.getName() + "' conference.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("found message #" + rc.getPostNumber() + " (" + rc.getPostID() + ")"); + + } // end try + catch (AccessError ae) + { // these all get handled in pretty much the same way + if (rinput.getUser().isLoggedIn()) + throw new ErrorBox("Access Error",ae.getMessage(),on_error); + else + throw new LogInOrCreate(); + + } // end catch + catch (DataException de) + { // error looking up the conference + throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error); + + } // end catch + + } // end if + else + { // there's no message parameter + if (required) + { // no message parameter - bail out now! + logger.error("Message parameter not specified!"); + throw new ErrorBox(null,"No message specified.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("no message specified"); + + } // end else + + return rc; + + } // end getMessageParam + + public final TopicMessageContext getTopicMessageParam(String param_name, boolean required, String on_error) + throws ErrorBox, LogInOrCreate + { + TopicContext topic = getTopic(required,on_error); + TopicMessageContext rc = null; + + if (rinput.hasParameter(param_name)) + { // get the post number + int post_num = rinput.getParameterInt(param_name,-1); + if (post_num<0) + { // the post number parameter is not valid! + logger.error("Cannot convert message parameter '" + rinput.getParameter(param_name) + "'!"); + throw new ErrorBox(null,"Invalid message parameter.",on_error); + + } // end if + + if (topic==null) + throw new ErrorBox(null,"Topic context for message not specified.",on_error); + + try + { // get the appropriate message + rc = topic.getMessage(post_num); + if (rc==null) + { // couldn't find the topic + logger.error("topic #" + topic.getTopicID() + " does not contain message #" + post_num); + throw new ErrorBox(null,"The message #" + post_num + " could not be found in the '" + + topic.getName() + "' topic.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("found message #" + rc.getPostNumber() + " (" + rc.getPostID() + ")"); + + } // end try + catch (AccessError ae) + { // these all get handled in pretty much the same way + if (rinput.getUser().isLoggedIn()) + throw new ErrorBox("Access Error",ae.getMessage(),on_error); + else + throw new LogInOrCreate(); + + } // end catch + catch (DataException de) + { // error looking up the conference + throw new ErrorBox("Database Error","Database error finding message: " + de.getMessage(),on_error); + + } // end catch + + } // end if + else + { // there's no message parameter + if (required) + { // no message parameter - bail out now! + logger.error("Message parameter not specified!"); + throw new ErrorBox(null,"No message specified.",on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("no message specified"); + + } // end else + + return rc; + + } // end getTopicMessageParam + + public final int getViewOption() + { + if (conf==null) + return -1; + getTopicSortHolder(); + return topic_sort.getViewOption(conf.getConfID()); + + } // end getViewOption + + public final void setViewOption(int opt) + { + if (conf==null) + return; + getTopicSortHolder(); + topic_sort.setViewOption(conf.getConfID(),opt); + + } // end setViewOption + + public final int getSortOption() + { + if (conf==null) + return -1; + getTopicSortHolder(); + return topic_sort.getSortOption(conf.getConfID()); + + } // end getSortOption + + public final void setSortOption(int opt) + { + if (conf==null) + return; + getTopicSortHolder(); + topic_sort.setSortOption(conf.getConfID(),opt); + + } // end setSortOption + + public final TopicVisitOrder getTopicVisitOrder() + { + if (conf==null) + return null; + Map map = (Map)(rinput.getSessionAttribute(TOPIC_VISIT_ORDER_ATTR)); + if (map==null) + return null; + return (TopicVisitOrder)(map.get(new Integer(conf.getConfID()))); + + } // end getTopicVisitOrder + + public final TopicVisitOrder newTopicVisitOrder(List topiclist) + { + if (conf==null) + return null; + TopicVisitOrder tvo = new TopicVisitOrder(topiclist); + Map map = null; + synchronized (this) + { // get the map in the session attribute + map = (Map)(rinput.getSessionAttribute(TOPIC_VISIT_ORDER_ATTR)); + if (map==null) + { // create new map and save it off + map = Collections.synchronizedMap(new HashMap()); + rinput.setSessionAttribute(TOPIC_VISIT_ORDER_ATTR,map); + + } // end if + + } // end synchronized block + + map.put(new Integer(conf.getConfID()),tvo); + return tvo; + + } // end newTopicVisitOrder + + public final PostInterval getPostInterval(String on_error) throws ErrorBox + { + if (topic==null) + return null; + + int first, last; + + if (rinput.hasParameter("pxg")) + { // we have a Go box parameter - decode it + String foo = rinput.getParameter("pxg"); + int p = foo.indexOf('-'); // range specifier + try + { // attempt to parse out two post numbers from here + if (p<0) + { // only one number specified - make them both equal + first = Integer.parseInt(foo.trim()); + last = first; + + } // end if + else if (p==0) + { // "-number" is the same as "0-number" + last = Integer.parseInt(foo.substring(1).trim()); + first = 0; + + } // end else if + else if (p==(foo.length()-1)) + { // "number-" is the same as "number-" + first = Integer.parseInt(foo.substring(0,p).trim()); + last = topic.getTotalMessages() - 1; + + } // end else if + else + { // decode both numbers + first = Integer.parseInt(foo.substring(0,p).trim()); + last = Integer.parseInt(foo.substring(p+1).trim()); + + } // end else + + return new PostInterval(first,last); // this will sort them out + + } // end try + catch (NumberFormatException nfe) + { // if numeric conversion fails, just fall out and try to redisplay the other way + } // end catch + + } // end if + + if (rinput.hasParameter("p1")) + { // convert the first message parameter and range-test it + first = rinput.getParameterInt("p1",-1); + if (first<0) + first = 0; + else if (first>=topic.getTotalMessages()) + first = topic.getTotalMessages() - 1; + + // get and range-check the second parameter (if it's there) + last = rinput.getParameterInt("p2",first); + if ((last<0) || (last>=topic.getTotalMessages())) + last = topic.getTotalMessages() - 1; + + } // end if + else + { // no range specified - cook up a default + last = topic.getTotalMessages(); + int unread = topic.getUnreadMessages(); + if ((unread==0) || (unread>=rinput.getEngine().getNumPostsPerPage())) + first = last - rinput.getEngine().getNumPostsPerPage(); + else + first = last - (unread + rinput.getEngine().getNumOldPostsBeforeNew()); + last--; + + } // end else + + return new PostInterval(first,last); // all done! + + } // end getPostInterval + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final CurrentConference get(RequestInput ri) + { + CurrentConference cc = (CurrentConference)(ri.getRequestAttribute(ATTR_NAME)); + if (cc==null) + cc = new CurrentConference(ri); + return cc; + + } // end get + + public static final CurrentConference get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_ATTRIBUTE_STEM + ATTR_NAME); + if (obj==null) + throw new ServletException("CurrentConference.get: unable to get request content"); + if (obj instanceof CurrentConference) + return (CurrentConference)obj; + throw new ServletException("CurrentConference.get: request content is not a CurrentConference object"); + + } // end get + +} // end class CurrentConference diff --git a/src/com/silverwrist/venice/ui/conf/PostInterval.java b/src/com/silverwrist/venice/ui/conf/PostInterval.java new file mode 100644 index 0000000..8184e6a --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/PostInterval.java @@ -0,0 +1,59 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf; + +public class PostInterval +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int first; + private int last; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + PostInterval(int a, int b) + { + first = (a=0) return unread[ndx_next]; @@ -144,14 +79,15 @@ public class TopicVisitOrder } // end isNext - public void visit(short topnum) + public final void visit(short topnum) { if (ndx_next<0) return; + int i; if (topics[ndx_next]!=topnum) { // go searching for the matching topic number - for (int i=0; i. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; + +public class ConferenceCanAddToHotlistTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + return (conf.canAddToHotlist() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanAddToHotlistTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanCreateTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanCreateTag.java new file mode 100644 index 0000000..69f3bd5 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanCreateTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceCanCreateTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException(" tag - community not defined!"); + + return (comm.canCreateConference() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanCreateTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanManageTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanManageTag.java new file mode 100644 index 0000000..4a1cb5e --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanManageTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceCanManageTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException(" tag - community not defined!"); + + return (comm.canManageConferences() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanManageTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanPostTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanPostTag.java new file mode 100644 index 0000000..7d01327 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanPostTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceCanPostTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + return (conf.canPostToConference() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanPostTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanReadNewTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanReadNewTag.java new file mode 100644 index 0000000..8a638ea --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanReadNewTag.java @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; + +public class ConferenceCanReadNewTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CurrentConference currc = getCC(); + if (currc==null) + throw new JspTagException(" tag - conference not defined!"); + TopicVisitOrder tvo = currc.getTopicVisitOrder(); + if (tvo==null) + return SKIP_BODY; + + return (tvo.isNext() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanReadNewTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanSendInviteTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanSendInviteTag.java new file mode 100644 index 0000000..62e2f11 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceCanSendInviteTag.java @@ -0,0 +1,43 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; + +public class ConferenceCanSendInviteTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + return (conf.canSendInvitation() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class ConferenceCanSendInviteTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceDefaultPseudTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceDefaultPseudTag.java new file mode 100644 index 0000000..5d2d1fd --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceDefaultPseudTag.java @@ -0,0 +1,56 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceDefaultPseudTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(conf.getDefaultPseud()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing conference default pseud - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class ConferenceDefaultPseudTag + diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceIDTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceIDTag.java new file mode 100644 index 0000000..4e055df --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceIDTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceIDTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(String.valueOf(conf.getConfID())); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing conference ID - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class ConferenceIDTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/ConferenceNameTag.java b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceNameTag.java new file mode 100644 index 0000000..592c081 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/ConferenceNameTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class ConferenceNameTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(conf.getName()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing conference name - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class ConferenceNameTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostAttachTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostAttachTag.java new file mode 100644 index 0000000..1ba682a --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostAttachTag.java @@ -0,0 +1,77 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostAttachTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + private String value = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException(" name= attribute not specified!"); + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.setAttach(name,(value!=null)); + return SKIP_BODY; + + } // end doStartTag + + public void release() + { + super.release(); + name = null; + value = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String v) + { + name = v; + + } // end setName + + public void setValue(String v) + { + value = v; + + } // end setValue + +} // end class PostAttachTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java new file mode 100644 index 0000000..cdf53c4 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java @@ -0,0 +1,248 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import java.util.*; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String action = null; + private String type = "servlet"; + private int real_type = -1; + private HashMap params = new HashMap(); + private String newtopic_name = null; + private String newtopic_value = null; + private String pseud_name = null; + private String pseud_value = null; + private String attach_name = null; + private boolean attach_value = false; + private String text_name = null; + private String text_value = null; + private ArrayList buttons = new ArrayList(); + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (action==null) + throw new JspTagException(" action= attribute not specified!"); + real_type = getRequestInput().convertLinkType(type); + if (real_type<0) + throw new JspTagException(" type= attribute not a valid link type"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() + { + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspException + { + if (pseud_name==null) + throw new JspTagException(" tag has no tag inside it!"); + if (attach_name==null) + throw new JspTagException(" tag has no tag inside it!"); + if (text_name==null) + throw new JspTagException(" tag has no tag inside it!"); + if (buttons.isEmpty()) + throw new JspTagException(" tag has no tags inside it!"); + RequestOutput ro = getRequestOutput(); + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("

\n"); + Iterator it = params.entrySet().iterator(); + while (it.hasNext()) + { // write the hidden parameters + Map.Entry ntry = (Map.Entry)(it.next()); + out.write("\n"); + + } // end while + + String my_font = ro.getFontTag(CONTENT_FOREGROUND,"content"); + out.write("\n"); + if (newtopic_name!=null) + { // write the "new topic name" field + out.write("\n"); + + } // end if + + out.write("\n\n\n\n\n" + + "\n\n
\n" + + my_font + "New topic name:
\n" + + "\n
\n" + + my_font + "Your name/header:
\n" + + "\n" + my_font + " Attach a file\n
\n" + + my_font + "Message:\n" + my_font + + "\nHTML Guide\n
\n\n
\n"); + boolean first = true; + it = buttons.iterator(); + while (it.hasNext()) + { // write out all the buttons + String id = (String)(it.next()); + if (first) + first = false; + else + out.write(" "); + out.write(ro.getButtonInput(id) + "\n"); + + } // end while + + out.write("
\n
\n"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing post box - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + action = null; + type = "servlet"; + real_type = -1; + params.clear(); + pseud_name = null; + pseud_value = null; + attach_name = null; + attach_value = false; + text_name = null; + text_value = null; + buttons.clear(); + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setAction(String v) + { + action = v; + + } // end setAction + + public void setType(String v) + { + type = v; + + } // end setType + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + final void addParam(String name, String value) + { + params.put(name,value); + + } // end addParam + + final void setNewTopic(String param_name, String value) throws JspException + { + if (newtopic_name!=null) + throw new JspTagException(" may only appear once inside a !"); + if (param_name==null) + throw new JspTagException(" parameter name not specified!"); + newtopic_name = param_name; + newtopic_value = value; + + } // end setNewTopic + + final void setPseud(String param_name, String value) throws JspException + { + if (pseud_name!=null) + throw new JspTagException(" may only appear once inside a !"); + if (param_name==null) + throw new JspTagException(" parameter name not specified!"); + pseud_name = param_name; + pseud_value = value; + + } // end setPseud + + final void setAttach(String param_name, boolean value) throws JspException + { + if (attach_name!=null) + throw new JspTagException(" may only appear once inside a !"); + if (param_name==null) + throw new JspTagException(" parameter name not specified!"); + attach_name = param_name; + attach_value = value; + + } // end setAttach + + final void setText(String param_name, String value) throws JspException + { + if (text_name!=null) + throw new JspTagException(" may only appear once inside a !"); + if (param_name==null) + throw new JspTagException(" parameter name not specified!"); + text_name = param_name; + text_value = value; + + } // end setText + + final void addButton(String id) + { + buttons.add(id); + + } // end addButton + +} // end class PostBoxTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostButtonTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostButtonTag.java new file mode 100644 index 0000000..0c6b454 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostButtonTag.java @@ -0,0 +1,69 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostButtonTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String id = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (id==null) + throw new JspTagException(" id= attribute not specified!"); + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.addButton(id); + return SKIP_BODY; + + } // end doStartTag + + public void release() + { + super.release(); + id = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setId(String v) + { + id = v; + + } // end setName + +} // end class PostPseudTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostNewTopicTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostNewTopicTag.java new file mode 100644 index 0000000..cc45a25 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostNewTopicTag.java @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostNewTopicTag extends VeniceConfBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException(" name= attribute not specified!"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() throws JspException + { + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.setNewTopic(name,getBodyContent().getString()); + return SKIP_BODY; + + } // end doAfterBody + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String v) + { + name = v; + + } // end setName + +} // end class PostNewTopicTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostParamTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostParamTag.java new file mode 100644 index 0000000..3453dcb --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostParamTag.java @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostParamTag extends VeniceConfBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException(" name= attribute not specified!"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() throws JspException + { + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.addParam(name,getBodyContent().getString()); + return SKIP_BODY; + + } // end doAfterBody + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String v) + { + name = v; + + } // end setName + +} // end class PostParamTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostPseudTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostPseudTag.java new file mode 100644 index 0000000..7f0552e --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostPseudTag.java @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostPseudTag extends VeniceConfBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException(" name= attribute not specified!"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() throws JspException + { + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.setPseud(name,getBodyContent().getString()); + return SKIP_BODY; + + } // end doAfterBody + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String v) + { + name = v; + + } // end setName + +} // end class PostPseudTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostRewriteTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostRewriteTag.java new file mode 100644 index 0000000..fdac45a --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostRewriteTag.java @@ -0,0 +1,153 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.db.PostLinkRewriter; +import com.silverwrist.venice.db.UserNameRewriter; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.IDUtils; + +public class PostRewriteTag extends VeniceConfBodyTagSupport implements LinkTypes +{ + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private static void output(BodyContent body, String data) throws JspException + { + try + { // write the escaped information + JspWriter out = body.getEnclosingWriter(); + out.write(data); + + } // end try + catch (IOException e) + { // translate output exception + throw new JspTagException("IO error writing rewritten post data: " + e.getMessage()); + + } // end catch + + } // end output + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + BodyContent body = getBodyContent(); + String data = body.getString(); + + if ((data.indexOf(PostLinkRewriter.URI_PREFIX)<0) && (data.indexOf(UserNameRewriter.URI_PREFIX)<0)) + { // no post links or user links in here - output what we've got and call it + output(body,data); + return SKIP_BODY; + + } // end if + + StringBuffer buf = new StringBuffer(); + RequestInput ri = getRequestInput(); + String t; + int p; + + if (data.indexOf(PostLinkRewriter.URI_PREFIX)>=0) + { // begin replacing the post links with real post links + t = data; + p = t.indexOf(PostLinkRewriter.URI_PREFIX); + while (p>=0) + { // break off the start of the string and append it + if (p>0) + buf.append(t.substring(0,p)); + t = t.substring(p + PostLinkRewriter.URI_PREFIX.length()); + + // find the end of the post link... + p = 0; + while (IDUtils.isValidPostLinkChar(t.charAt(p))) + p++; + + if (p>0) + { // append the post link to the "go" servlet path, and encode the lot + buf.append(ri.formatURL("go/" + t.substring(0,p),SERVLET)); + t = t.substring(p); + + } // end if + else // false alarm + buf.append(PostLinkRewriter.URI_PREFIX); + + // and now look again... + p = t.indexOf(PostLinkRewriter.URI_PREFIX); + + } // end while + + // append the rest of the string and clean up + buf.append(t); + data = buf.toString(); + buf.setLength(0); + + } // end if + // else there were no post links, just leave "data" the way it is + + if (data.indexOf(PostLinkRewriter.URI_PREFIX)<0) + { // no user links in here - output what we've got and call it + output(body,data); + return SKIP_BODY; + + } // end if + + // begin replacing the user links with real user links + t = data; + p = t.indexOf(PostLinkRewriter.URI_PREFIX); + while (p>=0) + { // break off the start of the string and append it + if (p>0) + buf.append(t.substring(0,p)); + t = t.substring(p + UserNameRewriter.URI_PREFIX.length()); + + // find the end of the user link... + p = 0; + while (IDUtils.isValidVeniceIDChar(t.charAt(p))) + p++; + + if (p>0) + { // append the post link to the "user" servlet path, and encode the lot + buf.append(ri.formatURL("user/" + t.substring(0,p),SERVLET)); + t = t.substring(p); + + } // end if + else // false alarm + buf.append(UserNameRewriter.URI_PREFIX); + + // and now look again... + p = t.indexOf(UserNameRewriter.URI_PREFIX); + + } // end while + + // Clean up and return the resulting output. + buf.append(t); + output(body,buf.toString()); + return SKIP_BODY; + + } // end doAfterBody + +} // end class PostRewriteTag + diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostTextTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostTextTag.java new file mode 100644 index 0000000..7dc9293 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostTextTag.java @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class PostTextTag extends VeniceConfBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException(" name= attribute not specified!"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() throws JspException + { + PostBoxTag postbox = (PostBoxTag)findAncestorWithClass(this,PostBoxTag.class); + if (postbox==null) + throw new JspTagException(" tag must be within a tag!"); + postbox.setText(name,getBodyContent().getString()); + return SKIP_BODY; + + } // end doAfterBody + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String v) + { + name = v; + + } // end setName + +} // end class PostTextTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanArchiveTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanArchiveTag.java new file mode 100644 index 0000000..f609011 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanArchiveTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanArchiveTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.canArchive() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanArchiveTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanCreateTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanCreateTag.java new file mode 100644 index 0000000..986516f --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanCreateTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanCreateTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + ConferenceContext conf = getConference(); + if (conf==null) + throw new JspTagException(" tag - conference not defined!"); + + return (conf.canCreateTopic() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanCreateTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanDeleteTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanDeleteTag.java new file mode 100644 index 0000000..149d8f6 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanDeleteTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanDeleteTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.canDelete() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanDeleteTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanFreezeTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanFreezeTag.java new file mode 100644 index 0000000..a714983 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanFreezeTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanFreezeTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.canFreeze() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanFreezeTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanPostTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanPostTag.java new file mode 100644 index 0000000..3bae6ac --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanPostTag.java @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanPostTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + ConferenceContext conf = getConference(); // if topic is non-null, conference is, too + + boolean flag1 = conf.canPostToConference(); + boolean flag2 = (topic.isFrozen() ? topic.canFreeze() : true); + boolean flag3 = (topic.isArchived() ? topic.canArchive() : true); + + return ((flag1 && flag2 && flag3) ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanPostTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicCanSendInvitationTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanSendInvitationTag.java new file mode 100644 index 0000000..b89bef4 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicCanSendInvitationTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicCanSendInvitationTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.canSendInvitation() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicCanSendInvitationTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIDTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIDTag.java new file mode 100644 index 0000000..6255213 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIDTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIDTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(String.valueOf(topic.getTopicID())); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing topic ID - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class TopicIDTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsArchivedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsArchivedTag.java new file mode 100644 index 0000000..eec08d7 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsArchivedTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsArchivedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isArchived() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicIsArchivedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsFrozenTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsFrozenTag.java new file mode 100644 index 0000000..a79224b --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsFrozenTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsFrozenTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isFrozen() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicIsFrozenTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsHiddenTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsHiddenTag.java new file mode 100644 index 0000000..83ccedd --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsHiddenTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsHiddenTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isHidden() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicIsHiddenTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotArchivedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotArchivedTag.java new file mode 100644 index 0000000..fe31192 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotArchivedTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsNotArchivedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isArchived() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class TopicIsNotArchivedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotFrozenTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotFrozenTag.java new file mode 100644 index 0000000..83ab9af --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotFrozenTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsNotFrozenTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isFrozen() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class TopicIsNotFrozenTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotHiddenTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotHiddenTag.java new file mode 100644 index 0000000..7527143 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicIsNotHiddenTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicIsNotHiddenTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isHidden() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class TopicIsNotHiddenTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicLastMessageTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicLastMessageTag.java new file mode 100644 index 0000000..547f712 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicLastMessageTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicLastMessageTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(String.valueOf(topic.getTotalMessages() - 1)); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing topic message index - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class TopicLastMessageTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicNameTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicNameTag.java new file mode 100644 index 0000000..9404fec --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicNameTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicNameTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(topic.getName()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing topic name - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class TopicNameTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSpecifiedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSpecifiedTag.java new file mode 100644 index 0000000..7dad274 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSpecifiedTag.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicNotSpecifiedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + return ((topic==null) ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicNotSpecifiedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSubscribedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSubscribedTag.java new file mode 100644 index 0000000..cd2c81f --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicNotSubscribedTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicNotSubscribedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isSubscribed() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class TopicNotSubscribedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicNumberTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicNumberTag.java new file mode 100644 index 0000000..5177d97 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicNumberTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicNumberTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(String.valueOf(topic.getTopicNumber())); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing topic number - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class TopicNumberTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicSpecifiedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicSpecifiedTag.java new file mode 100644 index 0000000..945d1e4 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicSpecifiedTag.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicSpecifiedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + return ((topic!=null) ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicSpecifiedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/TopicSubscribedTag.java b/src/com/silverwrist/venice/ui/conf/jsp/TopicSubscribedTag.java new file mode 100644 index 0000000..c248efc --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/TopicSubscribedTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class TopicSubscribedTag extends VeniceConfTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + TopicContext topic = getTopic(); + if (topic==null) + throw new JspTagException(" tag - topic not defined!"); + + return (topic.isSubscribed() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class TopicSubscribedTag diff --git a/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfBodyTagSupport.java b/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfBodyTagSupport.java new file mode 100644 index 0000000..8444a8f --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfBodyTagSupport.java @@ -0,0 +1,62 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.*; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; +import com.silverwrist.venice.ui.jsp.VeniceBodyTagSupport; + +public class VeniceConfBodyTagSupport extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + protected final CurrentConference getCC() throws JspException + { + try + { // call through and get it + return CurrentConference.get(pageContext.getRequest()); + + } // end try + catch (ServletException e) + { // convert the exception type + throw new JspTagException(e.getMessage()); + + } // end catch + + } // end getCC + + protected final ConferenceContext getConference() throws JspException + { + return getCC().getConference(); + + } // end getConference + + protected final TopicContext getTopic() throws JspException + { + return getCC().getTopic(); + + } // end getTopic + +} // end class VeniceConfBodyTagSupport diff --git a/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfTagSupport.java b/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfTagSupport.java new file mode 100644 index 0000000..d927e26 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/jsp/VeniceConfTagSupport.java @@ -0,0 +1,62 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.jsp; + +import javax.servlet.*; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; +import com.silverwrist.venice.ui.jsp.VeniceTagSupport; + +public class VeniceConfTagSupport extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + protected final CurrentConference getCC() throws JspException + { + try + { // call through and get it + return CurrentConference.get(pageContext.getRequest()); + + } // end try + catch (ServletException e) + { // convert the exception type + throw new JspTagException(e.getMessage()); + + } // end catch + + } // end getCC + + protected final ConferenceContext getConference() throws JspException + { + return getCC().getConference(); + + } // end getConference + + protected final TopicContext getTopic() throws JspException + { + return getCC().getTopic(); + + } // end getTopic + +} // end class VeniceConfTagSupport diff --git a/src/com/silverwrist/venice/ui/conf/view/ConfMemberView.java b/src/com/silverwrist/venice/ui/conf/view/ConfMemberView.java new file mode 100644 index 0000000..7b3dd21 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/view/ConfMemberView.java @@ -0,0 +1,248 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.security.Role; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class ConfMemberView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int max_results; // the maximum number of results displayed + private List role_list; // the list of possible roles + private String conference_name; // the current conference name + private boolean simple = true; // is this a simple listing or not? + private RequestInput rinput = null; // the RequestInput (during execution) + private int field = -1; // search field indicator + private int mode = -1; // search mode indicator + private String term = ""; // current search term + private List results = null; // the search results + private int offset = 0; // offset in list of results + private int find_count = -1; // total count of things found + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public ConfMemberView(int max_results, ConferenceContext conf) + { + this.max_results = max_results; + this.conference_name = conf.getName(); + SecurityInfo sinf = conf.getSecurityInfo(); + this.role_list = sinf.getRoleList("Conference.UserLevels"); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_COMMUNITY; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "Membership in Conference " + conference_name; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "conf/membership.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final List getRoleList() + { + return role_list; + + } // end getRoleList + + public final String getConferenceName() + { + return conference_name; + + } // end getConferenceName + + public final boolean getSimple() + { + return simple; + + } // end getSimple + + public final void setSimple(boolean b) + { + simple = b; + + } // end setSimple + + public final int getField() + { + return field; + + } // end getField + + public final void setField(int v) + { + field = v; + + } // end setField + + public final boolean testField(int v) + { + return (field==v); + + } // end testField + + public final int getMode() + { + return mode; + + } // end getMode + + public final void setMode(int v) + { + mode = v; + + } // end setMode + + public final boolean testMode(int v) + { + return (mode==v); + + } // end testMode + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String v) + { + term = v; + + } // end setTerm + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List v) + { + results = v; + + } // end setResults + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int v) + { + find_count = v; + + } // end setFindCount + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final ConfMemberView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("ConfMemberView.get: unable to get request content"); + if (obj instanceof ConfMemberView) + return (ConfMemberView)obj; + throw new ServletException("ConfMemberView.get: request content is not a ConfMemberView object"); + + } // end get + +} // end class ConfMemberView diff --git a/src/com/silverwrist/venice/ui/conf/view/FindPostView.java b/src/com/silverwrist/venice/ui/conf/view/FindPostView.java new file mode 100644 index 0000000..07e29e7 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/view/FindPostView.java @@ -0,0 +1,199 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.view; + +import java.util.*; +import javax.servlet.*; +import org.apache.log4j.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class FindPostView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private RequestInput rinput = null; + private CommunityContext comm; + private ConferenceContext conf; + private TopicContext topic; + private String term = ""; + private int offset = 0; + private int find_count = 0; + private List results = null; + private int max_results = 0; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public FindPostView(CommunityContext comm, ConferenceContext conf, TopicContext topic) + { + this.comm = comm; + this.conf = conf; + this.topic = topic; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_COMMUNITY; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "Find Posts"; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "conf/find.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String s) + { + term = s; + + } // end setTerm + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int v) + { + find_count = v; + + } // end setFindCount + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List l) + { + results = l; + + } // end setResults + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final void setMaxResults(int v) + { + max_results = v; + + } // end setMaxResults + + public final String formatDate(Date date) + { + return ((rinput==null) ? null : rinput.formatDate(date)); + + } // end formatDate + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final FindPostView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("FindPostView.get: unable to get request content"); + if (obj instanceof FindPostView) + return (FindPostView)obj; + throw new ServletException("FindPostView.get: request content is not a FindPostView object"); + + } // end get + +} // end class FindPostView diff --git a/src/com/silverwrist/venice/ui/conf/view/PostsView.java b/src/com/silverwrist/venice/ui/conf/view/PostsView.java new file mode 100644 index 0000000..655b919 --- /dev/null +++ b/src/com/silverwrist/venice/ui/conf/view/PostsView.java @@ -0,0 +1,503 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.conf.view; + +import java.awt.Dimension; +import java.util.*; +import javax.servlet.*; +import org.apache.log4j.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.conf.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class PostsView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(PostsView.class); + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private CommunityContext comm; + private ConferenceContext conf; + private TopicContext topic; + private String qid = null; + private int first = 0; + private int last; + private int unread; + private boolean show_advanced = false; + private boolean no_bozos = false; + private RequestInput rinput = null; + private List messages = Collections.EMPTY_LIST; + private TopicVisitOrder tvo = null; + private String topic_stem = ""; + private String top_custom = ""; + private String bottom_custom = ""; + private Dimension photo_dims = null; + private Map photo_map = null; + private Set bozo_uids = new HashSet(); + private String title = ""; + private String subtitle = ""; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public PostsView(CommunityContext comm, CurrentConference currc) + { + this.comm = comm; + this.conf = currc.getConference(); + this.topic = currc.getTopic(); + this.last = this.topic.getTotalMessages() - 1; + this.unread = this.topic.getUnreadMessages(); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_COMMUNITY; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return title + ": " + subtitle; + + } // end getPageTitle + + public String getPageQID() + { + return qid; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "conf/posts.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final CommunityContext getCommunity() + { + return comm; + + } // end getCommunity + + public final ConferenceContext getConference() + { + return conf; + + } // end getConference + + public final TopicContext getTopic() + { + return topic; + + } // end getTopic + + public final void setPageQID(String v) + { + if (rinput==null) + qid = v; + + } // end setPageQID + + public final int getFirst() + { + return first; + + } // end getFirst + + public final void setFirst(int v) + { + if (rinput==null) + first = v; + + } // end setFirst + + public final int getLast() + { + return last; + + } // end getLast + + public final void setLast(int v) + { + if (rinput==null) + last = v; + + } // end setLast + + public final int getUnread() + { + return unread; + + } // end getUnread + + public final void setUnread(int v) + { + if (rinput==null) + unread = v; + + } // end setUnread + + public final boolean getShowAdvanced() + { + return show_advanced; + + } // end getShowAdvanced + + public final void setShowAdvanced(boolean v) + { + if (rinput==null) + show_advanced = v; + + } // end setShowAdvanced + + public final boolean getNoBozos() + { + return no_bozos; + + } // end getNoBozos + + public final void setNoBozos(boolean v) + { + if (rinput==null) + no_bozos = v; + + } // end setNoBozos + + public final List getMessages() + { + return messages; + + } // end getMessages + + public final void setMessages(List v) + { + if (rinput==null) + messages = v; + + } // end setMessages + + public final TopicVisitOrder getTopicVisitOrder() + { + return tvo; + + } // end getTopicVisitOrder + + public final void setTopicVisitOrder(TopicVisitOrder v) + { + if (rinput==null) + tvo = v; + + } // end setTopicVisitOrder + + public final String getTopicStem() + { + return topic_stem; + + } // end getTopicStem + + public final void setTopicStem(String v) + { + if (rinput==null) + topic_stem = v; + + } // end setTopicStem + + public final String getTopCustom() + { + return top_custom; + + } // end getTopCustom + + public final void setTopCustom(String v) + { + if (rinput==null) + top_custom = ((v==null) ? "" : v); + + } // end setTopCustom + + public final String getBottomCustom() + { + return bottom_custom; + + } // end getBottomCustom + + public final void setBottomCustom(String v) + { + if (rinput==null) + bottom_custom = ((v==null) ? "" : v); + + } // end setBottomCustom + + public final Dimension getPhotoDims() + { + return photo_dims; + + } // end getPhotoDims + + public final void setPhotoDims(Dimension v) + { + if (rinput==null) + photo_dims = v; + + } // end setPhotoDims + + public final Map getPhotoMap() + { + return photo_map; + + } // end getPhotoMap + + public final Set getBozoUIDs() + { + return bozo_uids; + + } // end getBozoUIDs + + public final String getTitle() + { + return title; + + } // end getTitle + + public final void setTitle(String v) + { + if (rinput==null) + title = ((v==null) ? "" : v); + + } // end setTitle + + public final String getSubtitle() + { + return subtitle; + + } // end getSubtitle + + public final void setSubtitle(String v) + { + if (rinput==null) + subtitle = ((v==null) ? "" : v); + + } // end setSubtitle + + public final void buildInternals(UserContext user) throws DataException + { + if (rinput!=null) + return; + + if (photo_dims!=null) + photo_map = new HashMap(); + + HashSet saw_users = new HashSet(); + Iterator it = messages.iterator(); + boolean get_photo = true; + while (it.hasNext()) + { // get the user names of all users on the page + TopicMessageContext msg = (TopicMessageContext)(it.next()); + Integer the_uid = new Integer(msg.getCreatorUID()); + if (!(saw_users.contains(the_uid))) + { // only check a UID once + saw_users.add(the_uid); + get_photo = true; + if (topic.isBozo(the_uid.intValue())) + { // this user is filtered + bozo_uids.add(the_uid); + get_photo = no_bozos; // get photo if bozo filter overridden + + } // end if + + if (get_photo && (photo_dims!=null)) + { // store the user photo URL + String url = user.getProfile(the_uid.intValue()).getPhotoURL(); + if (url!=null) + photo_map.put(the_uid,url); + + } // end if + + } // end if + // else ignore the uID + + } // end while + + } // end buildInternals + + public final boolean canDoNextTopic() + { + if (tvo!=null) + return tvo.isNext(); + else + return false; + + } // end canDoNextTopic + + public final short getNextTopic() + { + if (tvo!=null) + return tvo.getNext(); + else + return -1; + + } // else getNextTopic + + public final int getPageSize() + { + return ((rinput==null) ? 0 : rinput.getEngine().getNumPostsPerPage()); + + } // end getPageSize + + public final boolean bozoFilterUser(int uid) + { + if (no_bozos) + return false; + else + return bozo_uids.contains(new Integer(uid)); + + } // end bozoFilterUser + + public final boolean showBozoFilteredIndicator(int uid) + { + if (no_bozos) + return bozo_uids.contains(new Integer(uid)); + else + return false; + + } // end showBozoFilteredIndicator + + public final String getUserPhotoTag(RequestOutput ro, int uid) + { + if ((photo_dims==null) || (photo_map==null)) + return ""; // user photos not enabled + return ro.getUserPhotoTag((String)(photo_map.get(new Integer(uid))),photo_dims); + + } // end getUserPhotoTag + + public final String formatDate(Date date) + { + return ((rinput==null) ? null : rinput.formatDate(date)); + + } // end formatDate + + public final boolean showFilterButton(int uid) + { + return !(bozo_uids.contains(new Integer(uid))) && topic.canSetBozo(uid); + + } // end showFilterButton + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final PostsView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("PostsView.get: unable to get request content"); + if (obj instanceof PostsView) + return (PostsView)obj; + throw new ServletException("PostsView.get: request content is not a PostsView object"); + + } // end get + + public static final String getPosterName(TopicMessageContext msg) + { + try + { // have to guard agains a DataException here + return msg.getCreatorName(); + + } // end try + catch (DataException de) + { // just return "unknown" on failure + return "(unknown)"; + + } // end catch + + } // end getPosterName + + public static final String getMessageBodyText(TopicMessageContext msg) + { + try + { // have to guard against a DataException here + return msg.getBodyText(); + + } // end try + catch (DataException de) + { // just return an error message + return "(Unable to retrieve message data: " + StringUtil.encodeHTML(de.getMessage()) + ")"; + + } // end catch + + } // end getMessageBodyText + + public static final boolean displayAttachmentInNewWindow(TopicMessageContext msg) + { + if (!(msg.hasAttachment())) + return false; + String type = msg.getAttachmentType(); + return (type.startsWith("text/") || type.startsWith("image/")); + + } // end displayAttachmentInNewWindow + +} // end class PostView + diff --git a/src/com/silverwrist/venice/ui/config/ButtonHolder.java b/src/com/silverwrist/venice/ui/config/ButtonHolder.java new file mode 100644 index 0000000..95e4e6e --- /dev/null +++ b/src/com/silverwrist/venice/ui/config/ButtonHolder.java @@ -0,0 +1,127 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.DOMElementHelper; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.util.XMLLoader; + +class ButtonHolder +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int width; + private int height; + private Map id_to_caption; + private Map id_to_image; + private String tail_tag; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + ButtonHolder(Element cfg, String image_path) throws ConfigException + { + // get the initial header information + XMLLoader loader = XMLLoader.get(); + loader.configVerifyNodeName(cfg,"buttons"); + width = loader.configGetAttributeInt(cfg,"width"); + height = loader.configGetAttributeInt(cfg,"height"); + tail_tag = "\" WIDTH=" + width + " HEIGHT=" + height + " BORDER=0>"; + + // load the individual button descriptors + HashMap tmp_caption = new HashMap(); + HashMap tmp_image = new HashMap(); + NodeList nl = cfg.getChildNodes(); + for (int i=0; i + buf.append("[ ").append(caption).append(" ]"); + buf.append(tail_tag); + return buf.toString(); + + } // end getButtonVisual + + final String getButtonInput(String id) + { + // Look up the caption and image. + String img = (String)(id_to_image.get(id)); + if (img==null) + return ""; + String caption = (String)(id_to_caption.get(id)); + + // Build the returned tag. + StringBuffer buf = new StringBuffer(". + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; + +public class ColorPalette implements ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final Map config_map; // mapping from configuration names to color indexes + private static final Map streetname_map; // mapping from "street names" to color indexes + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String[] colors_array; // the actual colors + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + ColorPalette(Element colors) throws ConfigException + { + colors_array = new String[config_map.size()]; + int i; + NodeList nl = colors.getChildNodes(); + for (i=0; i=colors_array.length)) + throw new IndexOutOfBoundsException("invalid color selector"); + return colors_array[selector]; + + } // end getColor + + public final String getColor(String name) + { + Integer sel = (Integer)(streetname_map.get(name)); + if (sel==null) + return name; + else + return colors_array[sel.intValue()]; + + } // end getColor + + public final void fillParameterMap(String prefix, Map the_map) + { + Iterator it = streetname_map.entrySet().iterator(); + while (it.hasNext()) + { // read each entry, translate it, and add it to the new map + Map.Entry ntry = (Map.Entry)(it.next()); + String new_name = prefix + ntry.getKey().toString(); + Integer sel = (Integer)(ntry.getValue()); + the_map.put(new_name,colors_array[sel.intValue()]); + + } // end while + + } // end fillParameterMap + + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { // Initialize the mapping of color names from render-config.xml to color selector IDs, + // and the mapping from "street names" for the colors to the color selector IDs. + HashMap m1 = new HashMap(); + HashMap m2 = new HashMap(); + Integer x; + + x = new Integer(FRAME_BACKGROUND); + m1.put("frame-bg",x); + m2.put("frame",x); + x = new Integer(TITLE_BACKGROUND); + m1.put("title-bg",x); + m2.put("top.background",x); + m2.put("top.bg",x); + x = new Integer(TITLE_FOREGROUND); + m1.put("title-fg",x); + m2.put("top.foreground",x); + m2.put("top.fg",x); + x = new Integer(TITLE_LINK); + m1.put("title-link",x); + m2.put("top.link",x); + x = new Integer(LEFT_BACKGROUND); + m1.put("left-bg",x); + m2.put("left.background",x); + m2.put("left.bg",x); + x = new Integer(LEFT_FOREGROUND); + m1.put("left-fg",x); + m2.put("left.foreground",x); + m2.put("left.fg",x); + x = new Integer(LEFT_LINK); + m1.put("left-link",x); + m2.put("left.link",x); + x = new Integer(CONTENT_BACKGROUND); + m1.put("content-bg",x); + m2.put("content.background",x); + m2.put("content.bg",x); + x = new Integer(CONTENT_FOREGROUND); + m1.put("content-fg",x); + m2.put("content.foreground",x); + m2.put("content.fg",x); + x = new Integer(CONTENT_HEADER); + m1.put("content-hdr",x); + m2.put("content.header",x); + x = new Integer(CONTENT_DISABLED); + m1.put("content-disabled",x); + m2.put("disabled",x); + x = new Integer(CONTENT_ERROR); + m1.put("content-error",x); + m2.put("error",x); + x = new Integer(SIDEBOX_TITLE_BACKGROUND); + m1.put("sidebox-title-bg",x); + m2.put("sidebox.top.background",x); + m2.put("sidebox.top.bg",x); + x = new Integer(SIDEBOX_TITLE_FOREGROUND); + m1.put("sidebox-title-fg",x); + m2.put("sidebox.top.foreground",x); + m2.put("sidebox.top.fg",x); + x = new Integer(SIDEBOX_CONTENT_BACKGROUND); + m1.put("sidebox-content-bg",x); + m2.put("sidebox.background",x); + m2.put("sidebox.bg",x); + x = new Integer(SIDEBOX_CONTENT_FOREGROUND); + m1.put("sidebox-content-fg",x); + m2.put("sidebox.foreground",x); + m2.put("sidebox.fg",x); + x = new Integer(SIDEBOX_CONTENT_LINK); + m1.put("sidebox-content-link",x); + m2.put("sidebox.link",x); + x = new Integer(CONFIRM_TITLE_BACKGROUND); + m1.put("confirm-title-bg",x); + m2.put("dlg.confirm.title.background",x); + m2.put("dlg.confirm.title.bg",x); + x = new Integer(CONFIRM_TITLE_FOREGROUND); + m1.put("confirm-title-fg",x); + m2.put("dlg.confirm.title.foreground",x); + m2.put("dlg.confirm.title.fg",x); + x = new Integer(ERROR_TITLE_BACKGROUND); + m1.put("error-title-bg",x); + m2.put("dlg.error.title.background",x); + m2.put("dlg.error.title.bg",x); + x = new Integer(ERROR_TITLE_FOREGROUND); + m1.put("error-title-fg",x); + m2.put("dlg.error.title.foreground",x); + m2.put("dlg.error.title.fg",x); + + config_map = Collections.unmodifiableMap(m1); + streetname_map = Collections.unmodifiableMap(m2); + + } // end static initializer + +} // end class ColorPalette diff --git a/src/com/silverwrist/venice/ui/config/DialogManager.java b/src/com/silverwrist/venice/ui/config/DialogManager.java new file mode 100644 index 0000000..5c85e69 --- /dev/null +++ b/src/com/silverwrist/venice/ui/config/DialogManager.java @@ -0,0 +1,184 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.lang.reflect.*; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.dlg.Dialog; + +class DialogManager +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String default_package; + private static final Class[] default_ctor_args = { RootConfig.class, Element.class }; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private Map dialog_instance_map; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + DialogManager(RootConfig cfg, Element elt) throws ConfigException + { + HashMap tmp_map = new HashMap(); + NodeList nl = elt.getChildNodes(); + Object[] args = null; + for (int i=0; i. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.util.*; +import javax.servlet.http.HttpServletResponse; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.util.*; + +public class Remapper +{ + /*-------------------------------------------------------------------------------- + * Remap entries class + *-------------------------------------------------------------------------------- + */ + + class RemapEntry implements LinkTypes + { + class RemapParameter + { + private String name; + private String default_value; + + RemapParameter(Element cfg) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + name = loader.configGetAttribute(cfg,"name"); + DOMElementHelper h = new DOMElementHelper(cfg); + default_value = h.getElementText(); + if (default_value==null) + default_value = ""; + + } // end constructor + + final void fillParameter(RequestInput req, Map vars) + { + String val = req.getParameter(name); + if (val==null) + val = default_value; + vars.put(name,val); + + } // end fillParameter + + } // end class RemapParameter + + private String source_path; // source path to be matched + private String target_url; // target URL with replaceable parameters + private int target_type; // target URL type + private List params; // the parameters + + RemapEntry(Element cfg, RootConfig root) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + source_path = loader.configGetAttribute(cfg,"path"); + Element tsect = loader.configGetSubSection(cfg,"target"); + DOMElementHelper tsect_h = new DOMElementHelper(tsect); + target_url = loader.configGetText(tsect_h); + if (tsect_h.hasAttribute("type")) + { // get and convert the target type + target_type = root.convertLinkType(loader.configGetAttribute(tsect,"type")); + if (target_type==-1) + throw new ConfigException(" has invalid type= attribute"); + + } // end if + else // the target type is not specified - default it + target_type = SERVLET; + + NodeList nl = cfg.getChildNodes(); + ArrayList tmp_params = new ArrayList(nl.getLength()); + for (int i=0; i. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.io.*; +import java.util.*; +import org.apache.log4j.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.core.CommunityContext; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.dlg.Dialog; +import com.silverwrist.venice.ui.menus.CommunityMenu; +import com.silverwrist.venice.ui.menus.CommunityMenuFactory; +import com.silverwrist.venice.ui.menus.Menu; +import com.silverwrist.venice.ui.menus.MenuComponent; +import com.silverwrist.venice.util.*; + +public class RootConfig implements LinkTypes, ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String VENICE_URL = "http://venice.sourceforge.net"; + private static final String VENICE_IMAGE = "powered-by-venice.gif"; + private static final int VENICE_IMAGE_WIDTH = 129; + private static final int VENICE_IMAGE_HEIGHT = 103; + private static final String VENICE_ALT = "Powered By Venice"; + + private static Category logger = Category.getInstance(RootConfig.class); + + private static final Map link_types; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String script_directory; // the scripts directory + private String temp_directory; // the temporary directory + private String image_path; // the images path + private String static_path; // the static files path + private String external_static_path; // the external static files path + private String format_path; // the JSP formatter path + private String blank_photo_path; // the "photo not available" path + private String frame_jsp_name; // the name of the frame JSP + private String site_title; // the title for the site + private File stylesheet; // the stylesheet file reference + private long stylesheet_lastchange; // when was the stylesheet last changed? + private boolean smart_tags; // do we want to allow M$ IE6 Smart Tags? + private String site_logo_img_tag; // the tag containing the site logo + private String site_logo_href = null; // the HREF to surround the site logo with + private int site_logo_href_type = -1; // the type of the above href + private String venice_logo_tag; // the HTML snippet containing the Venice logo + private String page_icon_tags = null; // the HTML snippet containing the page icons + private String font_face; // the default font face name + private String base_font; // the default tag + private Map font_sizes; // the stock font sizes + private ColorPalette colors; // all the colors + private boolean html_comments; // do we want to embed HTML comments? + private ButtonHolder buttons; // the button definitions + private String[] content_hdr; // the content header parts + private Remapper remapper; // the URL remapper + private StockMessages stock_messages; // the stock messages + private Map menus; // the menus + private DialogManager dialogs; // the dialog manager + private SideBoxManager sideboxes; // the sidebox manager + private CommunityMenuFactory comm_menu_fact; // the community menu factory + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public RootConfig(String config_file, String root_file_path) throws ConfigException + { + // Load the configuration file. + XMLLoader loader = XMLLoader.get(); + Document doc = loader.loadConfigDocument(config_file); + Element root = loader.configGetRootElement(doc,"ui-config"); + DOMElementHelper root_h = new DOMElementHelper(root); + + // Get the section. + Element sect = loader.configGetSubSection(root_h,"file-paths"); + DOMElementHelper sect_h = new DOMElementHelper(sect); + + // Get the full pathname of the sidebox configuration file. + String sidebox_config = loader.configGetSubElementText(sect_h,"sidebox-config"); + if (!(sidebox_config.startsWith("/"))) + sidebox_config = root_file_path + sidebox_config; + + // Get the full pathname of the services configuration file. + String services_config = loader.configGetSubElementText(sect_h,"services-config"); + if (!(services_config.startsWith("/"))) + services_config = root_file_path + services_config; + + // Get the full pathname of the script directory. + script_directory = loader.configGetSubElementText(sect_h,"script-dir"); + if (!(script_directory.startsWith("/"))) + script_directory = root_file_path + script_directory; + if (!(script_directory.endsWith("/"))) + script_directory = script_directory + "/"; + + // Test to make sure the script directory exists. + File t_file = new File(script_directory); + if (!(t_file.isDirectory())) + { // script directory does not exist - throw exception + logger.fatal(" directory \"" + script_directory + "\" is not a directory"); + throw new ConfigException("specified is not a directory", + sect_h.getSubElement("script-dir")); + + } // end if + + // Get the full pathname of the temporary directory. + temp_directory = loader.configGetSubElementText(sect_h,"temp-dir"); + if (!(temp_directory.startsWith("/"))) + temp_directory = root_file_path + temp_directory; + + // Test to make sure the temporary directory exists. + t_file = new File(temp_directory); + if (!(t_file.isDirectory())) + { // temporary directory does not exist - throw exception + logger.fatal(" directory \"" + temp_directory + "\" is not a directory"); + throw new ConfigException("specified is not a directory", + sect_h.getSubElement("temp-dir")); + + } // end if + + // Get the section. + sect = loader.configGetSubSection(root_h,"uri-paths"); + sect_h = new DOMElementHelper(sect); + + // Get the images path. + image_path = loader.configGetSubElementText(sect_h,"image"); + if (!(image_path.endsWith("/"))) + image_path = image_path + "/"; + + // Get the static path. + static_path = loader.configGetSubElementText(sect_h,"static"); + if (!(static_path.endsWith("/"))) + static_path = static_path + "/"; + + // Get the external static path. + external_static_path = loader.configGetSubElementText(sect_h,"external-static"); + if (!(external_static_path.endsWith("/"))) + external_static_path = external_static_path + "/"; + + // Get the format JSP path. + format_path = loader.configGetSubElementText(sect_h,"format-jsp"); + if (!(format_path.endsWith("/"))) + format_path = format_path + "/"; + + // Get the pathname of the "photo not available" image. + blank_photo_path = loader.configGetSubElementText(sect_h,"photo-not-avail"); + Element sect1 = sect_h.getSubElement("photo-not-avail"); + DOMElementHelper sect1_h = new DOMElementHelper(sect1); + if (sect1_h.hasAttribute("fixup")) + blank_photo_path = image_path + blank_photo_path; + + // Get the section. + sect = loader.configGetSubSection(root_h,"frame"); + sect_h = new DOMElementHelper(sect); + + // Get the name of the frame JSP. + String tmp = loader.configGetSubElementText(sect_h,"jsp-name"); + frame_jsp_name = format_path + tmp; + + // Get the site title. + site_title = sect_h.getSubElementText("site-title"); + + // Get the base font size. + Integer bf_size = sect_h.getSubElementInt("basefont-size"); + if (bf_size==null) + bf_size = new Integer(3); + + // Get the default stylesheet location. + tmp = sect_h.getSubElementText("stylesheet"); + if ((tmp!=null) && !(tmp.startsWith("/"))) + tmp = root_file_path + tmp; + if (tmp!=null) + { // set up stylesheet file name and stylesheet change data + stylesheet = new File(tmp); + if (stylesheet.canRead()) + stylesheet_lastchange = stylesheet.lastModified(); + else + { // the stylesheet file does not exist + logger.fatal("specified file \"" + tmp + "\" does not exist"); + throw new ConfigException("specified file does not exist", + sect_h.getSubElement("stylesheet")); + + } // end else + + } // end if + else + { // just null these values out + stylesheet = null; + stylesheet_lastchange = 0; + + } // end else + + // Get the "Smart Tags" flag. + smart_tags = sect_h.hasChildElement("ms-copyright-violations"); + + // Retrieve the site logo. + sect1 = loader.configGetSubSection(sect_h,"site-logo"); + sect1_h = new DOMElementHelper(sect1); + StringBuffer tmpbuf = new StringBuffer("\"").append(site_title).append("\""); + site_logo_img_tag = tmpbuf.toString(); + + // Get the link URL of the logo. + tmp = sect1.getAttribute("href"); + if (!(StringUtil.isStringEmpty(tmp))) + { // save off the HREF, get the type of the link + site_logo_href = tmp; + tmp = loader.configGetAttribute(sect1,"type"); + itmp = (Integer)(link_types.get(tmp)); + if (itmp==null) + { // this is not good! + logger.fatal(" type=\"" + tmp + "\" is not a valid value"); + throw new ConfigException("invalid link type for ",sect1); + + } // end if + + site_logo_href_type = itmp.intValue(); + + } // end if + + // Get the footer logo scale and build the HTML snippet that contains the Venice logo. + itmp = sect_h.getSubElementInt("footer-logo-scale"); + if (itmp==null) + itmp = new Integer(100); + int tmp_width = (VENICE_IMAGE_WIDTH * itmp.intValue()) / 100; + int tmp_height = (VENICE_IMAGE_HEIGHT * itmp.intValue()) / 100; + venice_logo_tag = "\"""; + + // Get the page icon and icon type, and the "favorites icon" (MS-specific). + String page_icon_1 = null, page_icon_2 = null; + sect1 = sect_h.getSubElement("favicon"); + if (sect1!=null) + { // get the URL and create the "shortcut icon" tag + String url = loader.configGetText(sect1); + page_icon_2 = "\n"; + + } // end if + + sect1 = sect_h.getSubElement("page-icon"); + if (sect1!=null) + { // get the URL and type, and create the page icon tag + String url = loader.configGetText(sect1); + String type = loader.configGetAttribute(sect1,"type"); + page_icon_1 = "\n"; + if (page_icon_2==null) // fill this in for the "shortcut icon" as well + page_icon_2 = "\n"; + + } // end if + + if (page_icon_1==null) + page_icon_tags = page_icon_2; // just use "shortcut icon" + else + page_icon_tags = page_icon_1 + page_icon_2; // use both tags + + // Get the section. + sect = loader.configGetSubSection(root_h,"rendering"); + sect_h = new DOMElementHelper(sect); + + // Get the default font face name. + font_face = loader.configGetSubElementText(sect_h,"font"); + base_font = ""; + + // Load the stock font sizes. + sect1 = sect_h.getSubElement("font-sizes"); + HashMap tmap; + NodeList nl; + int i; + if (sect1!=null) + { // scan through this subsection to find the stock font sizes + tmap = new HashMap(); + nl = sect1.getChildNodes(); + for (i=0; i" + getFontTag(CONTENT_HEADER,"header") + ""; + content_hdr[1] = ""; + content_hdr[2] = "  " + getFontTag(CONTENT_HEADER,"subhead") + ""; + content_hdr[3] = ""; + content_hdr[4] = "
\n"; + + // Get the "HTML Comments" flag. + html_comments = sect_h.hasChildElement("html-comments"); + + // Get the "Buttons" section and initialize it. + sect1 = loader.configGetSubSection(sect_h,"buttons"); + buttons = new ButtonHolder(sect1,image_path); + + // Get the section. + sect = loader.configGetSubSection(root_h,"remapper"); + + // Initialize the remapper object. + remapper = new Remapper(sect,this); + + // Get the section. + sect = loader.configGetSubSection(root_h,"messages"); + + // Initialize the stock messages list. + stock_messages = new StockMessages(sect); + + // Get the section. + sect = loader.configGetSubSection(root_h,"menu-definitions"); + + tmap = new HashMap(); + nl = sect.getChildNodes(); + for (i=0; i subnodes and use them to initialize menus + Node n = nl.item(i); + if (n.getNodeType()==Node.ELEMENT_NODE) + { // verify that it's a menu definition, then get its ID and build a menu + loader.configVerifyNodeName(n,"menudef"); + String menuid = loader.configGetAttribute((Element)n,"id"); + Menu m = new Menu((Element)n,this,menuid); + tmap.put(menuid,m); + + } // end if + // else just ignore it + + } // end for + + if (tmap.isEmpty()) + menus = Collections.EMPTY_MAP; + else + menus = Collections.unmodifiableMap(tmap); + + // Get the section. + sect = loader.configGetSubSection(root_h,"dialog-definitions"); + + // Initialize the dialog manager. + dialogs = new DialogManager(this,sect); + + // done with the ui-config.xml file + // Load up the sidebox-config.xml file. + doc = loader.loadConfigDocument(sidebox_config); + root = loader.configGetRootElement(doc,"sidebox-config"); + + // Create the sidebox manager. + sideboxes = new SideBoxManager(root); + + // done with the sidebox-config.xml file + // Load up the services-config.xml file. + doc = loader.loadConfigDocument(services_config); + root = loader.configGetRootElement(doc,"services-config"); + root_h = new DOMElementHelper(root); + + // Get the community section and pass it to the CommunityMenuFactory. + comm_menu_fact = new CommunityMenuFactory(root_h.getSubElement("community"),this); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private final String mapFontSize(String sz) + { + String rc = (String)(font_sizes.get(sz)); + return ((rc==null) ? sz : rc); + + } // end mapFontSize + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getTemporaryPath() + { + return temp_directory; + + } // end getTemporaryPath + + public final String getImagePath(String img) + { + return image_path + img; + + } // end getImagePath + + public final String getStaticPath(String s) + { + return static_path + s; + + } // end getImagePath + + public final String getExternalStaticPath(String s) + { + return external_static_path + s; + + } // end getExternalStaticPath + + public final String getFormatJSPPath(String jsp) + { + return format_path + jsp; + + } // end getFormatJSPPath + + public final String getScriptPath(String sname) + { + return script_directory + sname; + + } // end script_directory + + public final String getFrameJSPName() + { + return frame_jsp_name; + + } // end getFrameJSPName + + public final String getPageTitle(String t) + { + if (site_title==null) + return t; + else + return t + " - " + site_title; + + } // end getPageTitle + + public final String getBaseFontTag() + { + return base_font; + + } // end getBaseFontTag + + public final boolean usingStyleSheet() + { + return (stylesheet!=null); + + } // end usingStyleSheet + + public final boolean hasStyleSheetChanged() + { + if (stylesheet==null) + return false; + return (stylesheet.lastModified()!=stylesheet_lastchange); + + } // end hasStyleSheetChanged + + public final String loadStyleSheetData() throws IOException + { + StringBuffer raw_data; + synchronized (this) + { // If there's no stylesheet, don't bother. + if (stylesheet==null) + return null; + + // Load the stylesheet data. + raw_data = IOUtil.loadText(stylesheet); + stylesheet_lastchange = stylesheet.lastModified(); + + } // end synchronized block + + // Set up the replacements map to replace the various parameters. + HashMap vars = new HashMap(); + vars.put("font",font_face); + colors.fillParameterMap("color.",vars); + return StringUtil.replaceAllVariables(raw_data.toString(),vars); + + } // end loadStyleSheetData + + public final String getColor(int selector) + { + return colors.getColor(selector); + + } // end getColor + + public final String getColor(String name) + { + return colors.getColor(name); + + } // end getColor + + public final String getFontTag(int colorsel, int size) + { + return ""; + + } // end getFontTag + + public final String getFontTag(String color, int size) + { + StringBuffer rc = new StringBuffer("'); + return rc.toString(); + + } // end getFontTag + + public final String getFontTag(int colorsel, String size) + { + StringBuffer rc = new StringBuffer("'); + return rc.toString(); + + } // end getFontTag + + public final String getFontTag(String color, String size) + { + StringBuffer rc = new StringBuffer("'); + return rc.toString(); + + } // end getFontTag + + public final boolean useSmartTags() + { + return smart_tags; + + } // end useSmartTags + + public final boolean useHTMLComments() + { + return html_comments; + + } // end useHTMLComments + + public final String getSiteLogoImageTag() + { + return site_logo_img_tag; + + } // end getSiteLogoImageTag + + public final String getSiteLogoLink() + { + return site_logo_href; + + } // end getSiteLogoLink + + public final int getSiteLogoLinkType() + { + return site_logo_href_type; + + } // end getSiteLogoLinkType + + public final int convertLinkType(String str) + { + Integer tmp = (Integer)(link_types.get(str.trim().toLowerCase())); + return (tmp==null) ? -1 : tmp.intValue(); + + } // end convertLinkType + + public final String getStockMessage(String key) + { + return stock_messages.get(key); + + } // end getStockMessage + + public final String getStockMessage(String key, Map vars) + { + return stock_messages.getReplace(key,vars); + + } // end getStockMessage + + public final Remapper getRemapper() + { + return remapper; + + } // end getRemapper + + public final String getVeniceLogoTag() + { + return venice_logo_tag; + + } // end getVeniceLogoTag + + public final String getPageIconTags() + { + return page_icon_tags; + + } // end getPageIconTags + + public final String getContentHeader(String primary, String secondary) + { + StringBuffer buf = new StringBuffer(content_hdr[0]); + buf.append(StringUtil.encodeHTML(primary)).append(content_hdr[1]); + if (secondary!=null) + buf.append(content_hdr[2]).append(StringUtil.encodeHTML(secondary)).append(content_hdr[3]); + buf.append(content_hdr[4]); + return buf.toString(); + + } // end getContentHeader + + public final MenuComponent getMenu(String name) + { + return (MenuComponent)(menus.get(name)); + + } // end getMenu + + public final MenuComponent getMenu(String name, Map vars) + { + return new Menu((Menu)(menus.get(name)),vars); + + } // end getMenu + + public final String getButtonVisual(String id) + { + return buttons.getButtonVisual(id); + + } // end getButtonVisual + + public final String getButtonInput(String id) + { + return buttons.getButtonInput(id); + + } // end getButtonInput + + public final Dialog getDialog(String name) + { + return dialogs.getDialog(name); + + } // end getDialog + + public final SideBoxManager getSideBoxManager() + { + return sideboxes; + + } // end getSideBoxManager + + public final String getBlankPhoto() + { + return blank_photo_path; + + } // end getBlankPhoto + + public final CommunityMenu getCommunityMenu(CommunityContext comm) + { + return comm_menu_fact.createMenu(comm); + + } // end getCommunityMenu + + public final String getDefaultServletAddress(RequestInput inp, CommunityContext comm) + { + return comm_menu_fact.getDefaultServletAddress(inp,comm); + + } // end getDefaultServletAddress + + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { + HashMap m = new HashMap(); + m.put("absolute",new Integer(ABSOLUTE)); + m.put("servlet",new Integer(SERVLET)); + m.put("frame",new Integer(FRAME)); + link_types = Collections.unmodifiableMap(m); + + } // end static initializer + +} // end class RootConfig diff --git a/src/com/silverwrist/venice/ui/config/SideBoxManager.java b/src/com/silverwrist/venice/ui/config/SideBoxManager.java new file mode 100644 index 0000000..5aedb9b --- /dev/null +++ b/src/com/silverwrist/venice/ui/config/SideBoxManager.java @@ -0,0 +1,128 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.config; + +import java.util.*; +import org.apache.log4j.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.core.VeniceEngine; +import com.silverwrist.venice.core.UserContext; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.Content; +import com.silverwrist.venice.ui.sidebox.SideBoxFactory; +import com.silverwrist.venice.util.XMLLoader; + +public class SideBoxManager +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(SideBoxManager.class); + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private Map factories; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + SideBoxManager(Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + + // Examine the child nodes for sidebox configuration data. + HashMap tmp_factories = new HashMap(); + NodeList nl = elt.getChildNodes(); + for (int i=0; i config not valid!",cnfe); + throw new ConfigException(" in is not a valid class!",(Element)n); + + } // end catch + catch (IllegalAccessException iae) + { // could not access class and/or constructor + logger.fatal(" is not accessible!",iae); + throw new ConfigException(" in is not accessible!",(Element)n); + + } // end catch + catch (InstantiationException ie) + { // unable to create the class + logger.fatal(" could not be instantiated!",ie); + throw new ConfigException(" in could not be created!",(Element)n); + + } // end catch + catch (ClassCastException cce) + { // the class is not a SideBoxFactory implementor - cannot create + logger.fatal(" is not a SideBoxFactory!",cce); + throw new ConfigException(" in is not the correct type!",(Element)n); + + } // end catch + + tmp_factories.put(new Integer(my_id),factory); // save it off + + } // end if + // else just ignore node + + } // end for + + if (tmp_factories.isEmpty()) + factories = Collections.EMPTY_MAP; + else + factories = Collections.unmodifiableMap(tmp_factories); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final Content createSideBox(int id, VeniceEngine engine, UserContext uc) + throws AccessError, DataException + { + SideBoxFactory fact = (SideBoxFactory)(factories.get(new Integer(id))); + if (fact==null) + throw new DataException("invalid sidebox ID!"); + return fact.create(engine,uc); + + } // end createSideBox + +} // end class SideBoxManager diff --git a/src/com/silverwrist/venice/servlets/format/CDBaseFormField.java b/src/com/silverwrist/venice/ui/dlg/BaseDialogField.java similarity index 54% rename from src/com/silverwrist/venice/servlets/format/CDBaseFormField.java rename to src/com/silverwrist/venice/ui/dlg/BaseDialogField.java index d79f860..5bcaac8 100644 --- a/src/com/silverwrist/venice/servlets/format/CDBaseFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/BaseDialogField.java @@ -15,34 +15,38 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; -public abstract class CDBaseFormField implements CDFormField, ColorSelectors +public abstract class BaseDialogField implements DialogField, ColorSelectors { /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private String name; - private String caption; - private String caption2; - private boolean required; - private String value = null; - private boolean enabled; + private boolean reverse; // if true, field is on left, false = right + private String name; // field name (parameter name) + private String caption; // primary caption + private String caption2; // secondary caption + private boolean required; // is this field required? + private String value = null; // string representation of value + private boolean enabled; // are we enabled? /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - protected CDBaseFormField(String name, String caption, String caption2, boolean required) + protected BaseDialogField(boolean reverse, String name, String caption, String caption2, boolean required) { + this.reverse = reverse; this.name = name; this.caption = caption; this.caption2 = caption2; @@ -51,13 +55,34 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors } // end constructor - protected CDBaseFormField(CDBaseFormField other) + protected BaseDialogField(boolean reverse, Element elt, boolean get_caption2, boolean get_required) + throws ConfigException { + XMLLoader loader = XMLLoader.get(); + this.reverse = reverse; + this.name = loader.configGetAttribute(elt,"name"); + this.caption = loader.configGetAttribute(elt,"capt"); + if (get_caption2) + this.caption2 = elt.getAttribute("capt2"); + else + this.caption2 = null; + DOMElementHelper h = new DOMElementHelper(elt); + if (get_required) + this.required = h.hasAttribute("required"); + else + this.required = false; + this.enabled = !(h.hasAttribute("disabled")); + + } // end constructor + + protected BaseDialogField(BaseDialogField other) + { + this.reverse = other.reverse; this.name = other.name; this.caption = other.caption; this.caption2 = other.caption2; this.required = other.required; - this.enabled = true; + this.enabled = other.enabled; // N.B.: do NOT copy value! } // end constructor @@ -67,19 +92,44 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors *-------------------------------------------------------------------------------- */ - protected final String getCaption() + private final void renderCaption(RequestOutput out) throws IOException + { + out.write(out.getFontTag(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED,"content") + + StringUtil.encodeHTML(caption)); + if (!(StringUtil.isStringEmpty(caption2))) + out.write(" " + StringUtil.encodeHTML(caption2)); + if (!reverse) + out.write(":"); + out.write(""); + if (required) + out.write(out.getFontTag("red","content") + "*"); + + } // end renderCaption + + protected String getCaption() { return caption; } // end getCaption + protected String getStringValue() + { + return value; + + } // end getStringValue + + protected void setCaption2(String s) + { + caption2 = s; + + } // end setCaption2 + /*-------------------------------------------------------------------------------- * Abstract functions which MUST be overriden *-------------------------------------------------------------------------------- */ - protected abstract void renderActualField(Writer out, RenderData rdat) - throws IOException; + protected abstract void renderField(RequestOutput out) throws IOException; /*-------------------------------------------------------------------------------- * Overridable operations @@ -91,28 +141,28 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors } // end validateContents /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface RenderDirect *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - out.write("\n" - + StringUtil.encodeHTML(caption)); - if (caption2!=null) - out.write(" " + StringUtil.encodeHTML(caption2)); - out.write(":"); - if (required) - out.write(rdat.getRequiredBullet()); + out.write("\n"); + if (reverse) + renderField(out); + else + renderCaption(out); out.write("\n"); - renderActualField(out,rdat); + if (reverse) + renderCaption(out); + else + renderField(out); out.write("\n\n"); - } // end renderHere + } // end render /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ @@ -122,29 +172,23 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors } // end getName - public String getValue() + public Object getValue() { return value; } // end getValue - public void setValue(String value) + public void setValue(Object o) { - this.value = value; + value = (o==null) ? null : o.toString(); } // end setValue - public Object getObjValue() + public void setValueFrom(RequestInput ri) { - return value; + value = ri.getParameter(name); - } // end getObjValue - - public void setObjValue(Object obj) - { - this.value = obj.toString(); - - } // end setObjValue + } // end setValueFrom public boolean isRequired() { @@ -152,17 +196,24 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors } // end isRequired - public CDCommandButton findButton(String name) + public boolean isFile() { - return null; + return false; - } // end findButton + } // end isFile + + public boolean isHidden() + { + return false; + + } // end isHidden public void validate() throws ValidationException { if (required && enabled && StringUtil.isStringEmpty(value)) throw new ValidationException("The '" + caption + "' field is required."); - validateContents(value); + if (enabled) + validateContents(value); } // end validate @@ -178,4 +229,10 @@ public abstract class CDBaseFormField implements CDFormField, ColorSelectors } // end setEnabled -} // end CDBaseFormField + public Object sendMessage(String msg, Object data) + { + return null; + + } // end sendMessage + +} // end class BaseDialogField diff --git a/src/com/silverwrist/venice/servlets/format/CDFormCategoryHeader.java b/src/com/silverwrist/venice/ui/dlg/CategoryHeader.java similarity index 56% rename from src/com/silverwrist/venice/servlets/format/CDFormCategoryHeader.java rename to src/com/silverwrist/venice/ui/dlg/CategoryHeader.java index 12e056d..836f859 100644 --- a/src/com/silverwrist/venice/servlets/format/CDFormCategoryHeader.java +++ b/src/com/silverwrist/venice/ui/dlg/CategoryHeader.java @@ -15,31 +15,39 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.io.Writer; import java.io.IOException; -import javax.servlet.ServletRequest; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; -public class CDFormCategoryHeader implements CDFormField, ColorSelectors +public class CategoryHeader implements DialogField, ColorSelectors { + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "header"; + /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private String caption; - private String rtext; - private boolean enabled; + private String caption; // caption to display + private String rtext; // text to display on right + private boolean enabled; // enabled or not? /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDFormCategoryHeader(String caption) + public CategoryHeader(String caption) { this.caption = caption; this.rtext = null; @@ -47,7 +55,7 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors } // end constructor - public CDFormCategoryHeader(String caption, String rtext) + public CategoryHeader(String caption, String rtext) { this.caption = caption; this.rtext = rtext; @@ -55,35 +63,44 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors } // end constructor - protected CDFormCategoryHeader(CDFormCategoryHeader other) + public CategoryHeader(Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + this.caption = loader.configGetAttribute(elt,"capt"); + DOMElementHelper h = new DOMElementHelper(elt); + this.rtext = h.getElementText(); + this.enabled = !(h.hasAttribute("disabled")); + + } // end constructor + + protected CategoryHeader(CategoryHeader other) { this.caption = other.caption; this.rtext = other.rtext; - this.enabled = true; + this.enabled = other.enabled; } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface RenderDirect *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - out.write("" + String open_font = out.getFontTag(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED,"content"); + out.write("" + open_font + "" + StringUtil.encodeHTML(caption) + ":"); if (rtext==null) out.write(" "); - else // display in the correct state - out.write("" - + StringUtil.encodeHTML(rtext) + ""); + else + out.write(open_font + StringUtil.encodeHTML(rtext) + ""); out.write("\n"); - } // end renderHere + } // end render /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ @@ -93,25 +110,19 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors } // end getName - public String getValue() + public Object getValue() { return null; } // end getValue - public void setValue(String value) + public void setValue(Object o) { // do nothing } // end setValue - public Object getObjValue() - { - return null; - - } // end getObjValue - - public void setObjValue(Object obj) + public void setValueFrom(RequestInput ri) { // do nothing - } // end setObjValue + } // end setValueFrom public boolean isRequired() { @@ -119,16 +130,22 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors } // end isRequired + public boolean isFile() + { + return false; + + } // end isFile + + public boolean isHidden() + { + return false; + + } // end isHidden + public void validate() { // do nothing } // end validate - public CDCommandButton findButton(String name) - { - return null; - - } // end findButton - public boolean isEnabled() { return enabled; @@ -141,11 +158,16 @@ public class CDFormCategoryHeader implements CDFormField, ColorSelectors } // end setEnabled - public CDFormField duplicate() + public Object sendMessage(String msg, Object data) { - return new CDFormCategoryHeader(this); + return null; - } // end clone + } // end sendMessage -} // end class CDFormCategoryHeader + public DialogField duplicate() + { + return new CategoryHeader(this); + } // end duplicate + +} // end class CategoryHeader diff --git a/src/com/silverwrist/venice/ui/dlg/CheckBoxField.java b/src/com/silverwrist/venice/ui/dlg/CheckBoxField.java new file mode 100644 index 0000000..3b3d787 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/CheckBoxField.java @@ -0,0 +1,140 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; + +public class CheckBoxField extends BaseDialogField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String YES = "Y"; + private static final String NO = ""; + + public static final String TAGNAME = "checkbox"; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public CheckBoxField(String name, String caption, String caption2) + { + super(true,name,caption,caption2,false); + + } // end constructor + + public CheckBoxField(Element elt) throws ConfigException + { + super(true,elt,true,false); + + } // end constructor + + protected CheckBoxField(CheckBoxField other) + { + super(other); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + out.write(""); + + } // end renderField + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public Object getValue() + { + return YES.equals(super.getValue().toString()) ? Boolean.TRUE : Boolean.FALSE; + + } // end getValue + + public void setValue(Object o) + { + boolean state = false; + if (o!=null) + { // determine what kind of object it is + if (o instanceof Boolean) + { // it's a Boolean - map it accordingly + Boolean b = (Boolean)o; + state = b.booleanValue(); + + } // end if + else if (o instanceof Number) + { // it's a number - use false==0, true==nonzero + Number n = (Number)o; + state = (n.intValue()!=0); + + } // end else if + else + { // it's something else - parse a string equivalent + String s = o.toString().trim().toLowerCase(); + try + { // decode it into a number and set state that way + int tmp = Integer.parseInt(s); + state = (tmp!=0); + + } // end try + catch (NumberFormatException nfe) + { // try some string equivalents + state = (s.equals("true") || s.equals("on") || s.equals("y") || s.equals("yes")); + + } // end catch + + } // end else + + } // end if + + super.setValue(state ? YES : NO); + + } // end setValue + + public void setValueFrom(RequestInput ri) + { + this.setValue(ri.getParameter(getName())); + + } // end setValueFrom + + public DialogField duplicate() + { + return new CheckBoxField(this); + + } // end duplicate + +} // end class CheckBoxField diff --git a/src/com/silverwrist/venice/ui/dlg/CommunityLogoField.java b/src/com/silverwrist/venice/ui/dlg/CommunityLogoField.java new file mode 100644 index 0000000..f21f382 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/CommunityLogoField.java @@ -0,0 +1,133 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class CommunityLogoField extends BaseDialogField implements LinkTypes +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "communitylogo"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String link_url; + private int link_type; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public CommunityLogoField(String name, String caption, String link_url, int link_type) + { + super(false,name,caption,"(click to change)",false); + this.link_url = link_url; + this.link_type = link_type; + + } // end constructor + + public CommunityLogoField(Element elt) throws ConfigException + { + super(false,elt,false,false); + XMLLoader loader = XMLLoader.get(); + this.link_url = loader.configGetAttribute(elt,"link"); + String stype = loader.configGetAttribute(elt,"type").trim().toLowerCase(); + if (stype.equals("absolute")) + link_type = ABSOLUTE; + else if (stype.equals("servlet")) + link_type = SERVLET; + else if (stype.equals("frame")) + link_type = FRAME; + else + throw new ConfigException("invalid link type= attribute"); + setCaption2("(click to change)"); + + } // end constructor + + protected CommunityLogoField(CommunityLogoField other) + { + super(other); + this.link_url = other.link_url; + this.link_type = other.link_type; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + if (isEnabled()) + out.write(""); + out.write(out.getCommunityLogoTag(getStringValue())); + if (isEnabled()) + out.write(""); + + } // end renderField + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public DialogField duplicate() + { + return new CommunityLogoField(this); + + } // end duplicate + + public Object sendMessage(String msg, Object data) + { + if (msg.equals("setLinkURL")) + { // the link URL + link_url = data.toString(); + return null; + + } // end if + + return null; + + } // end sendMessage + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setLinkURL(String url, int type) + { + link_url = url; + link_type = type; + + } // end setLinkURL + +} // end class CommunityLogoField diff --git a/src/com/silverwrist/venice/servlets/format/CDLocaleListFormField.java b/src/com/silverwrist/venice/ui/dlg/CountryListField.java similarity index 53% rename from src/com/silverwrist/venice/servlets/format/CDLocaleListFormField.java rename to src/com/silverwrist/venice/ui/dlg/CountryListField.java index 17dd8d2..e18f35a 100644 --- a/src/com/silverwrist/venice/servlets/format/CDLocaleListFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/CountryListField.java @@ -15,92 +15,82 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.util.*; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; -public class CDLocaleListFormField extends CDPickListFormField +public class CountryListField extends PickListField { /*-------------------------------------------------------------------------------- - * Private list implementation + * Static data members *-------------------------------------------------------------------------------- */ - static class LocaleList extends AbstractList - { - private Locale[] array; // local array - - LocaleList() - { - array = Locale.getAvailableLocales(); - - } // end constructor - - protected void finalize() throws Throwable - { - array = null; - super.finalize(); - - } // end finalize - - public Object get(int index) - { - return array[index]; - - } // end get - - public int size() - { - return array.length; - - } // end size - - } // end class LocaleList + public static final String TAGNAME = "countrylist"; /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDLocaleListFormField(String name, String caption, String caption2, boolean required) + public CountryListField(String name, String caption, String caption2, boolean required) { - super(name,caption,caption2,required,new LocaleList()); + super(name,caption,caption2,required,International.get().getCountryList()); } // end constructor - protected CDLocaleListFormField(CDLocaleListFormField other) + public CountryListField(Element elt) throws ConfigException + { + super(elt,International.get().getCountryList()); + + } // end constructor + + protected CountryListField(CountryListField other) { super(other); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDPickListFormField + * Overrides from class PickListField *-------------------------------------------------------------------------------- */ - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException + protected String getChoiceName(Object o) { - Locale l = (Locale)obj; - out.write("\n"); + return ((Country)o).getCode(); - } // end renderChoice + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return ((Country)o).getName(); + + } // end getChoiceValue /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ - public CDFormField duplicate() + public void setValue(Object o) { - return new CDLocaleListFormField(this); + if ((o!=null) && (o instanceof Country)) + super.setValue(((Country)o).getCode()); + else + super.setValue(o); + + } // end setValue + + public DialogField duplicate() + { + return new CountryListField(this); } // end duplicate -} // end class CDLocaleListFormField +} // end class CountryListField diff --git a/src/com/silverwrist/venice/ui/dlg/Dialog.java b/src/com/silverwrist/venice/ui/dlg/Dialog.java new file mode 100644 index 0000000..6ea2b9d --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/Dialog.java @@ -0,0 +1,669 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.RootConfig; +import com.silverwrist.venice.util.XMLLoader; + +public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTypes +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int menu_sel = MENU_SELECTOR_NOCHANGE; // menu selector + private String name; // name of the dialog + private String title; // dialog title + private String subtitle = null; // dialog subtitle + private String formname; // name of the built-in form + private boolean file_form = false; // is this a file form? + private String action; // action URL + private int action_type = SERVLET; // action URL type + private String error_message = null; // error message + private String instructions = null; // instructions + private Map command_buttons; // the command buttons + private List command_order; // the command buttons in declaration order + private Map form_fields; // the form fields + private List form_order; // the form fields in declaration order + private boolean any_required = false; // are any fields marked required? + private boolean writeable = true; // is this copy of the form writeable? + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public Dialog(String name, String title, String subtitle, String formname, String action, int type) + { + this.name = name; + this.title = title; + this.subtitle = subtitle; + this.formname = formname; + this.action = action; + this.action_type = type; + command_buttons = new HashMap(); + command_order = new ArrayList(); + form_fields = new HashMap(); + form_order = new ArrayList(); + + } // end constructor + + public Dialog(RootConfig cfg, Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + loader.configVerifyNodeName(elt,"dialog"); + this.name = loader.configGetAttribute(elt,"name"); + this.formname = loader.configGetAttribute(elt,"formname"); + DOMElementHelper h = new DOMElementHelper(elt); + if (h.hasAttribute("menusel")) + { // get the menu selector attribute + String s = elt.getAttribute("menusel").trim().toLowerCase(); + if (s.equals("nochange")) + menu_sel = MENU_SELECTOR_NOCHANGE; + else if (s.equals("top")) + menu_sel = MENU_SELECTOR_TOP; + else if (s.equals("community")) + menu_sel = MENU_SELECTOR_COMMUNITY; + else // no valid value + throw new ConfigException("invalid menusel= attribute"); + + } // end if + + // Initialize the remaining dialog fields. + this.title = null; + this.subtitle = null; + this.action = null; + HashMap tmp_cmd = new HashMap(); + ArrayList tmp_cmd_order = new ArrayList(); + HashMap tmp_fld = new HashMap(); + ArrayList tmp_fld_order = new ArrayList(); + + NodeList nl = elt.getChildNodes(); + DialogElementLoader dlg_loader = DialogElementLoader.get(); + for (int i=0; i element specified twice"); + this.title = loader.configGetText(h); + + } // end if + else if (tname.equals("subtitle")) + { // fill in the subtitle + if (this.subtitle!=null) + throw new ConfigException(" element specified twice"); + this.subtitle = loader.configGetText(h); + + } // end else if + else if (tname.equals("action")) + { // fill in the action + if (this.action!=null) + throw new ConfigException(" element specified twice"); + this.action = loader.configGetText(h); + String stype = h.getElement().getAttribute("type"); + if (!(StringUtil.isStringEmpty(stype))) + { // get the action type element + this.action_type = cfg.convertLinkType(stype); + if (this.action_type<0) + throw new ConfigException(" type= attribute not defined"); + + } // end if + + } // end else if + else if (tname.equals("instructions")) + { // fill in the instructions + if (this.instructions!=null) + throw new ConfigException(" element specified twice"); + this.instructions = loader.configGetText(h); + + } // end else if + else + { // create a dialog element + RenderDirect component = dlg_loader.createElement(h.getElement()); + if (component instanceof DialogField) + { // add to the fields list + DialogField fld = (DialogField)component; + tmp_fld.put(fld.getName(),fld); + tmp_fld_order.add(fld); + if (fld.isFile()) + this.file_form = true; + if (fld.isRequired()) + this.any_required = true; + + } // end if + else if (component instanceof DialogCommandButton) + { // add to the command buttons list + DialogCommandButton bn = (DialogCommandButton)component; + tmp_cmd.put(bn.getName(),bn); + tmp_cmd_order.add(bn); + + } // end else if + else // not a valid thingy + throw new ConfigException("<" + tname + "/> element not a proper dialog element"); + + } // end else + + } // end if + // else ignore it + + } // end for + + // check the title and action attributes + if (this.title==null) + throw new ConfigException(" element not specified"); + if (this.action==null) + throw new ConfigException("<action/> element not specified"); + + if (tmp_cmd.isEmpty()) + { // null out the command lists + command_buttons = Collections.EMPTY_MAP; + command_order = Collections.EMPTY_LIST; + + } // end if + else + { // freeze the lists + tmp_cmd_order.trimToSize(); + command_buttons = Collections.unmodifiableMap(tmp_cmd); + command_order = Collections.unmodifiableList(tmp_cmd_order); + + } // end else + + if (tmp_fld.isEmpty()) + { // null out the command lists + form_fields = Collections.EMPTY_MAP; + form_order = Collections.EMPTY_LIST; + + } // end if + else + { // freeze the command lists + tmp_fld_order.trimToSize(); + form_fields = Collections.unmodifiableMap(tmp_fld); + form_order = Collections.unmodifiableList(tmp_fld_order); + + } // end else + + writeable = false; // not writeable + + } // end constructor + + protected Dialog(Dialog other) + { + this.menu_sel = other.menu_sel; + this.name = other.name; + this.title = other.title; + this.subtitle = other.subtitle; + this.formname = other.formname; + this.file_form = other.file_form; + this.action = other.action; + this.action_type = other.action_type; + this.instructions = other.instructions; + + Iterator it; + if (other.writeable) + { // need to make the arrays un-writeable + if (other.command_buttons.isEmpty()) + { // make the copied elements empty + this.command_buttons = Collections.EMPTY_MAP; + this.command_order = Collections.EMPTY_LIST; + + } // end if + else + { // copy the contents of the data structures + HashMap tmp_cmd = new HashMap(); + ArrayList tmp_cmd_order = new ArrayList(); + it = other.command_order.iterator(); + while (it.hasNext()) + { // copy all elements across + DialogCommandButton bn = (DialogCommandButton)(it.next()); + tmp_cmd.put(bn.getName(),bn); + tmp_cmd_order.add(bn); + + } // end while + + tmp_cmd_order.trimToSize(); + this.command_buttons = Collections.unmodifiableMap(tmp_cmd); + this.command_order = Collections.unmodifiableList(tmp_cmd_order); + + } // end else + + } // end if + else + { // just reference the data structures directly + this.command_buttons = other.command_buttons; + this.command_order = other.command_order; + + } // end else + + // duplicate the fields + HashMap tmp_fld = new HashMap(); + ArrayList tmp_fld_order = new ArrayList(); + it = other.form_order.iterator(); + while (it.hasNext()) + { // duplicate the fields and copy them over + DialogField fld_old = (DialogField)(it.next()); + DialogField fld = fld_old.duplicate(); + tmp_fld.put(fld.getName(),fld); + tmp_fld_order.add(fld); + + } // end while + + tmp_fld_order.trimToSize(); + this.form_fields = Collections.unmodifiableMap(tmp_fld); + this.form_order = Collections.unmodifiableList(tmp_fld_order); + + this.any_required = other.any_required; + this.writeable = false; // no write on this copy + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + protected DialogField getFieldRef(String name) + { + return (DialogField)(form_fields.get(name)); + + } // end getFieldRef + + /*-------------------------------------------------------------------------------- + * Overrideable operations + *-------------------------------------------------------------------------------- + */ + + protected void validateWholeForm() throws ValidationException + { // do nothing at this level + } // end validateWholeForm + + /*-------------------------------------------------------------------------------- + * Overrides from class Object + *-------------------------------------------------------------------------------- + */ + + public Object clone() + { + return new Dialog(this); + + } // end clone + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return menu_sel; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + if (subtitle!=null) + return title + " " + subtitle; + else + return title; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentDirect + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out) throws IOException + { + out.writeContentHeader(title,subtitle); + + // write the error message + if (error_message!=null) + out.write("<DIV ALIGN=\"center\" CLASS=\"content\">\n" + out.getFontTag(CONTENT_ERROR,"dlg-error") + + "<B>" + StringUtil.encodeHTML(error_message) + "</B></FONT>\n</DIV><P>\n"); + + // Output the start of the form. + out.write("<FORM NAME=\"" + formname + "\""); + if (file_form) + out.write(" ENCTYPE=\"multipart/form-data\""); + out.write(" METHOD=POST ACTION=\"" + out.formatURL(action,action_type) + "\"><DIV CLASS=\"content\">" + + out.getFontTag(CONTENT_FOREGROUND,"content") + "\n"); + + // Render the hidden fields. + Iterator it = form_order.iterator(); + while (it.hasNext()) + { // render all the hidden fields first + DialogField fld = (DialogField)(it.next()); + if (fld.isHidden()) + fld.render(out); + + } // end while + + if (instructions!=null) + out.write(instructions); + if (any_required) + { // write out the "required" instructions + if (instructions!=null) + out.write("<P>"); + out.write("Required fields are marked with a " + out.getFontTag("red","content") + "*</FONT>.<BR>\n"); + + } // end if + else if (instructions!=null) + out.write("<BR>\n"); + + out.write("<TABLE BORDER=0 ALIGN=CENTER CELLPADDING=6 CELLSPACING=0>\n"); + it = form_order.iterator(); + while (it.hasNext()) + { // render all the non-hidden fields + DialogField fld = (DialogField)(it.next()); + if (!(fld.isHidden())) + fld.render(out); + + } // end while + + out.write("</TABLE>\n"); + + if (!(command_order.isEmpty())) + { // render the command buttons at the bottom + boolean is_first = true; + out.write("<DIV ALIGN=CENTER CLASS=\"content\">"); + it = command_order.iterator(); + while (it.hasNext()) + { // render each of the command buttons in the list + DialogCommandButton bn = (DialogCommandButton)(it.next()); + if (is_first) + is_first = false; + else + out.write("  "); + bn.render(out); + + } // end while + + out.write("</DIV>\n"); + + } // end if + + out.write("</FONT></DIV></FORM>\n"); + + } // end render + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getName() + { + return name; + + } // end getName + + public final synchronized void setMenuSelector(int sel_type) + { + if (writeable) + menu_sel = sel_type; + + } // end setMenuSelector + + public final synchronized void setTitle(String title) + { + this.title = title; + + } // end setTitle + + public final synchronized void setSubtitle(String subtitle) + { + this.subtitle = subtitle; + + } // end setSubtitle + + public final synchronized void setFormName(String s) + { + formname = s; + + } // end setFormName + + public final synchronized void setAction(String action, int type) + { + if (writeable) + { // set the action + this.action = action; + this.action_type = type; + + } // end if + + } // end setAction + + public final void setAction(String action) + { + this.setAction(action,SERVLET); + + } // end setAction + + public final synchronized void setErrorMessage(String message) + { + this.error_message = message; + + } // end setErrorMessage + + public final synchronized void setInstructions(String instructions) + { + if (writeable) + this.instructions = instructions; + + } // end setInstructions + + public final synchronized void addButton(DialogCommandButton bn, int position) + { + if (!writeable) + return; + command_buttons.put(bn.getName(),bn); + if ((position<0) || (position>command_order.size())) + command_order.add(bn); + else + command_order.add(position,bn); + + } // end addButton + + public final void addButton(DialogCommandButton bn) + { + this.addButton(bn,-1); + + } // end addButton + + public final synchronized void addField(DialogField fld, int position) + { + if (!writeable) + return; + form_fields.put(fld.getName(),fld); + if ((position<0) || (position>form_order.size())) + form_order.add(fld); + else + form_order.add(position,fld); + if (fld.isFile()) + file_form = true; + if (fld.isRequired()) + any_required = true; + + } // end addField + + public final void addField(DialogField fld) + { + this.addField(fld,-1); + + } // end addField + + public final synchronized void freeze() + { + if (!writeable) + return; + if (command_buttons.isEmpty()) + { // null out the lists + command_buttons = Collections.EMPTY_MAP; + command_order = Collections.EMPTY_LIST; + + } // end if + else + { // freeze the lists + command_buttons = Collections.unmodifiableMap(command_buttons); + command_order = Collections.unmodifiableList(command_order); + + } // end else + + if (form_fields.isEmpty()) + { // null out the lists + form_fields = Collections.EMPTY_MAP; + form_order = Collections.EMPTY_LIST; + + } // end if + else + { // freeze the lists + form_fields = Collections.unmodifiableMap(form_fields); + form_order = Collections.unmodifiableList(form_order); + + } // end else + + writeable = false; + + } // end freeze + + public final String whichButton(RequestInput ri) + { + Iterator it = command_order.iterator(); + while (it.hasNext()) + { // check each button in turn + DialogCommandButton bn = (DialogCommandButton)(it.next()); + if (bn.isClicked(ri)) + return bn.getName(); + + } // end while + + return null; + + } // end whichButton + + public final boolean isButtonClicked(RequestInput ri, String name) + { + DialogCommandButton bn = (DialogCommandButton)(command_buttons.get(name)); + return ((bn==null) ? false : bn.isClicked(ri)); + + } // end isButtonClicked + + public final void load(RequestInput ri) + { + Iterator it = form_order.iterator(); + while (it.hasNext()) + { // set the field values + DialogField fld = (DialogField)(it.next()); + fld.setValueFrom(ri); + + } // end while + + } // end load + + public final void clear() + { + Iterator it = form_order.iterator(); + while (it.hasNext()) + { // set the field values + DialogField fld = (DialogField)(it.next()); + fld.setValue(null); + + } // end while + + } // end clear + + public final Object getValue(String fieldname) + { + DialogField fld = (DialogField)(form_fields.get(fieldname)); + return ((fld==null) ? null : fld.getValue()); + + } // end getValue + + public final synchronized void setValue(String fieldname, Object value) + { + DialogField fld = (DialogField)(form_fields.get(fieldname)); + if (fld!=null) + fld.setValue(value); + + } // end setValue + + public final boolean isEnabled(String fieldname) + { + DialogField fld = (DialogField)(form_fields.get(fieldname)); + return ((fld==null) ? false : fld.isEnabled()); + + } // end isEnabled + + public final synchronized void setEnabled(String fieldname, boolean flag) + { + DialogField fld = (DialogField)(form_fields.get(fieldname)); + if (fld!=null) + fld.setEnabled(flag); + + } // end setEnabled + + public final synchronized void sendMessage(String fieldname, String message, Object data) + { + DialogField fld = (DialogField)(form_fields.get(fieldname)); + if (fld!=null) + fld.sendMessage(message,data); + + } // end sendMessage + + public final void validate() throws ValidationException + { + // validate each field in isolation + Iterator it = form_order.iterator(); + while (it.hasNext()) + { // set the field values + DialogField fld = (DialogField)(it.next()); + fld.validate(); + + } // end while + + // now validate the form in toto + validateWholeForm(); + + } // end validate + +} // end class Dialog diff --git a/src/com/silverwrist/venice/ui/dlg/DialogCommandButton.java b/src/com/silverwrist/venice/ui/dlg/DialogCommandButton.java new file mode 100644 index 0000000..2b2ed8a --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/DialogCommandButton.java @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import com.silverwrist.venice.ui.RenderDirect; +import com.silverwrist.venice.ui.RequestInput; + +public interface DialogCommandButton extends RenderDirect +{ + public abstract String getName(); + + public abstract boolean isClicked(RequestInput ri); + +} // end interface DialogCommandButton diff --git a/src/com/silverwrist/venice/ui/dlg/DialogElementLoader.java b/src/com/silverwrist/venice/ui/dlg/DialogElementLoader.java new file mode 100644 index 0000000..8a2f399 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/DialogElementLoader.java @@ -0,0 +1,206 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.lang.reflect.*; +import java.util.*; +import org.apache.log4j.*; +import org.w3c.dom.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.RenderDirect; + +public class DialogElementLoader +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(DialogElementLoader.class); + + private static DialogElementLoader self = null; + + private static final Class[] init_classes = { + CategoryHeader.class, CheckBoxField.class, CommunityLogoField.class, CountryListField.class, + EMailAddressField.class, HiddenField.class, ImageButton.class, IntegerField.class, + LanguageListField.class, LocaleListField.class, PasswordField.class, RoleListField.class, + StaticPickListField.class, TextField.class, TimeZoneListField.class, UserPhotoField.class, + VeniceIDField.class + }; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private Map factories; // mapping from tag name to factories + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + private DialogElementLoader() + { + final Class[] ctor_params = { Element.class }; + HashMap tmp_factories = new HashMap(); + for (int i=0; i<init_classes.length; i++) + { // do a quick sanity check + int xmod = init_classes[i].getModifiers(); + if (Modifier.isAbstract(xmod) || Modifier.isInterface(xmod)) + continue; + if (!(RenderDirect.class.isAssignableFrom(init_classes[i]))) + continue; + + // retrieve the tag name + String tagname = null; + try + { // retrieve the TAGNAME static field value from the class + Field tname_fld = init_classes[i].getField("TAGNAME"); + if (!(Modifier.isStatic(tname_fld.getModifiers()))) + continue; + tagname = tname_fld.get(null).toString(); + + } // end try + catch (NoSuchFieldException nsfe) + { // the TAGNAME field doesn't exist + continue; + + } // end catch + catch (SecurityException se) + { // cannot get the field + continue; + + } // end catch + catch (IllegalAccessException iae) + { // cannot get the field + continue; + + } // end catch + + Constructor ctor = null; + try + { // pull the specified constructor out of the class + ctor = init_classes[i].getConstructor(ctor_params); + + } // end try + catch (NoSuchMethodException nsme) + { // the constructor doesn't exist + continue; + + } // end catch + catch (SecurityException se) + { // cannot get the constructor + continue; + + } // end catch + + // save off the retrieved information + tmp_factories.put(tagname,ctor); + + } // end for + + if (logger.isDebugEnabled()) + logger.debug("Defined " + tmp_factories.size() + " out of " + init_classes.length + " dialog classes"); + if (tmp_factories.isEmpty()) + factories = Collections.EMPTY_MAP; + else + factories = Collections.unmodifiableMap(tmp_factories); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public RenderDirect createElement(Element elt) throws ConfigException + { + Constructor ctor = (Constructor)(factories.get(elt.getTagName())); + if (ctor==null) + { // don't know this tag name + logger.fatal("DialogElementLoader: unknown element type \"" + elt.getTagName() + "\""); + throw new ConfigException("unknown dialog element <" + elt.getTagName() + "/>"); + + } // end if + + RenderDirect rc = null; + try + { // create the resulting element + Object[] parms = new Object[1]; + parms[0] = elt; + rc = (RenderDirect)(ctor.newInstance(parms)); + + } // end try + catch (InstantiationException ie) + { // this shouldn't happen + throw new InternalStateError("class " + ctor.getDeclaringClass().getName() + + " is abstract, shouldn't be"); + + } // end catch + catch (IllegalAccessException iae) + { // shouldn't happen + throw new InternalStateError("constructor of class " + ctor.getDeclaringClass().getName() + + " is not accessible"); + + } // end catch + catch (IllegalArgumentException ae) + { // this shouldn't happen + throw new InternalStateError("args for constructor of class " + ctor.getDeclaringClass().getName() + + " aren't what they should be"); + + } // end catch + catch (InvocationTargetException ite) + { // this is where we catch ConfigExceptions + Throwable t = ite.getTargetException(); + if (t instanceof ConfigException) + throw (ConfigException)t; + throw new InternalStateError("unknown exception thrown by constructor of class " + + ctor.getDeclaringClass().getName() + ": " + t.getClass().getName()); + + } // end catch + catch (ClassCastException cce) + { // this shouldn't happen + throw new InternalStateError("class " + ctor.getDeclaringClass().getName() + + " is not a RenderDirect, should be"); + + } // end catch + + return rc; + + } // end createElement + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final DialogElementLoader get() + { + synchronized (DialogElementLoader.class) + { // initialize the dialog element loader + if (self==null) + self = new DialogElementLoader(); + + } // end synchronized block + + return self; + + } // end get + +} // end class DialogElementLoader diff --git a/src/com/silverwrist/venice/servlets/format/CDFormField.java b/src/com/silverwrist/venice/ui/dlg/DialogField.java similarity index 68% rename from src/com/silverwrist/venice/servlets/format/CDFormField.java rename to src/com/silverwrist/venice/ui/dlg/DialogField.java index 23075f5..1e2afaf 100644 --- a/src/com/silverwrist/venice/servlets/format/CDFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/DialogField.java @@ -15,32 +15,36 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; import com.silverwrist.venice.except.ValidationException; +import com.silverwrist.venice.ui.RenderDirect; +import com.silverwrist.venice.ui.RequestInput; -public interface CDFormField extends ComponentRender +public interface DialogField extends RenderDirect { public abstract String getName(); - public abstract String getValue(); + public abstract Object getValue(); - public abstract void setValue(String value); + public abstract void setValue(Object o); - public abstract Object getObjValue(); - - public abstract void setObjValue(Object obj); + public abstract void setValueFrom(RequestInput ri); public abstract boolean isRequired(); - public abstract void validate() throws ValidationException; + public abstract boolean isFile(); - public abstract CDCommandButton findButton(String name); + public abstract boolean isHidden(); + + public abstract void validate() throws ValidationException; public abstract boolean isEnabled(); public abstract void setEnabled(boolean flag); - public abstract CDFormField duplicate(); + public abstract Object sendMessage(String msg, Object data); -} // end interface CDFormField + public abstract DialogField duplicate(); + +} // end interface DialogField diff --git a/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java b/src/com/silverwrist/venice/ui/dlg/EMailAddressField.java similarity index 60% rename from src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java rename to src/com/silverwrist/venice/ui/dlg/EMailAddressField.java index 4ab51d7..73d1c9e 100644 --- a/src/com/silverwrist/venice/servlets/format/CDEmailAddressFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/EMailAddressField.java @@ -15,33 +15,56 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import com.silverwrist.venice.except.ValidationException; +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; import com.silverwrist.venice.util.IDUtils; -public class CDEmailAddressFormField extends CDTextFormField +public class EMailAddressField extends TextField { + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "email"; + /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDEmailAddressFormField(String name, String caption, String caption2, boolean required, - int size, int maxlength) + public EMailAddressField(String name, String caption, String caption2, boolean required, int size, + int maxlength) { super(name,caption,caption2,required,size,maxlength); } // end constructor - protected CDEmailAddressFormField(CDEmailAddressFormField other) + public EMailAddressField(String name, String caption, String caption2, boolean required, int size) + { + super(name,caption,caption2,required,size); + + } // end constructor + + public EMailAddressField(Element elt) throws ConfigException + { + super(elt); + + } // end constructor + + protected EMailAddressField(EMailAddressField other) { super(other); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDTextFormField + * Overrides from class TextField *-------------------------------------------------------------------------------- */ @@ -49,19 +72,21 @@ public class CDEmailAddressFormField extends CDTextFormField { super.validateContents(value); if (!IDUtils.isValidEmailAddress(value)) - throw new ValidationException("The value of '" + getCaption() + "' must be a correct Internet address."); + throw new ValidationException("The value of '" + getCaption() + + "' must be a correct Internet E-mail address."); } // end validateContents /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ - public CDFormField duplicate() + public DialogField duplicate() { - return new CDEmailAddressFormField(this); + return new EMailAddressField(this); } // end duplicate -} // end class CDEmailAddressFormField +} // end class EMailAddressField + diff --git a/src/com/silverwrist/venice/ui/dlg/HiddenField.java b/src/com/silverwrist/venice/ui/dlg/HiddenField.java new file mode 100644 index 0000000..248177a --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/HiddenField.java @@ -0,0 +1,165 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class HiddenField implements DialogField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "hidden"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name; + private String value = null; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public HiddenField(String name, String value) + { + this.name = name; + this.value = value; + + } // end constructor + + public HiddenField(String name) + { + this.name = name; + this.value = null; + + } // end constructor + + public HiddenField(Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + name = loader.configGetAttribute(elt,"name"); + value = elt.getAttribute("value"); + + } // end constructor + + protected HiddenField(HiddenField other) + { + this.name = other.name; + this.value = other.value; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface RenderDirect + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out) throws IOException + { + out.write("<INPUT TYPE=\"HIDDEN\" NAME=\"" + name + "\" VALUE=\""); + if (value!=null) + out.write(value); + out.write("\">\n"); + + } // end render + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public String getName() + { + return name; + + } // end getName + + public Object getValue() + { + return value; + + } // end getValue + + public void setValue(Object o) + { + value = (o==null) ? null : o.toString(); + + } // end setValue + + public void setValueFrom(RequestInput ri) + { + value = ri.getParameter(name); + + } // end setValueFrom + + public boolean isRequired() + { + return false; + + } // end isRequired + + public boolean isFile() + { + return false; + + } // end isFile + + public boolean isHidden() + { + return true; + + } // end isHidden + + public void validate() throws ValidationException + { // do nothing + } // end validate + + public boolean isEnabled() + { + return true; + + } // end isEnabled + + public void setEnabled(boolean flag) + { // do nothing + } // end setEnabled + + public Object sendMessage(String msg, Object data) + { + return null; + + } // end sendMessage + + public DialogField duplicate() + { + return new HiddenField(this); + + } // end duplicate + +} // end class HiddenField diff --git a/src/com/silverwrist/venice/servlets/RedirectResult.java b/src/com/silverwrist/venice/ui/dlg/ImageButton.java similarity index 58% rename from src/com/silverwrist/venice/servlets/RedirectResult.java rename to src/com/silverwrist/venice/ui/dlg/ImageButton.java index d09eccc..13926bf 100644 --- a/src/com/silverwrist/venice/servlets/RedirectResult.java +++ b/src/com/silverwrist/venice/ui/dlg/ImageButton.java @@ -15,73 +15,75 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.dlg; import java.io.IOException; -import com.silverwrist.venice.servlets.format.RenderData; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; -public class RedirectResult extends ExecuteResult +public class ImageButton implements DialogCommandButton { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static final String[] absolute_prefixes = { "http://", "ftp://" }; + public static final String TAGNAME = "imagebutton"; /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private String target; - private boolean absolute; + private String buttonid; /*-------------------------------------------------------------------------------- - * Constructor + * Constructors *-------------------------------------------------------------------------------- */ - public RedirectResult(String target) + public ImageButton(String id) { - super(); - this.target = target; - this.absolute = false; + buttonid = id; } // end constructor - public RedirectResult(String target, boolean absolute) + public ImageButton(Element elt) throws ConfigException { - super(); - this.target = target; - this.absolute = absolute; + XMLLoader loader = XMLLoader.get(); + buttonid = loader.configGetAttribute(elt,"id"); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class ExecuteResult + * Implementations from interface RenderDirect *-------------------------------------------------------------------------------- */ - public void execute(RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - if (absolute) - { // allow us to explicitly specify absolute redirection - rdat.redirectAbsolute(target); - return; + out.write(out.getButtonInput(buttonid)); - } // end if + } // end render - for (int i=0; i<absolute_prefixes.length; i++) - if (target.startsWith(absolute_prefixes[i])) - { // this is an absolute redirection...do it! - rdat.redirectAbsolute(target); - return; + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogCommandButton + *-------------------------------------------------------------------------------- + */ - } // end if and for + public String getName() + { + return buttonid; - rdat.redirectTo(target); + } // end getName - } // end doRedirect + public boolean isClicked(RequestInput ri) + { + return ri.isImageButtonClicked(buttonid); -} // end class RedirectResult + } // end isClicked + +} // end class ImageButton diff --git a/src/com/silverwrist/venice/ui/dlg/IntegerField.java b/src/com/silverwrist/venice/ui/dlg/IntegerField.java new file mode 100644 index 0000000..775d85c --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/IntegerField.java @@ -0,0 +1,239 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class IntegerField extends TextField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final double LN10 = Math.log(10.0); + + public static final String TAGNAME = "int"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int min_value; // minimum value for this field + private int max_value; // maximum value for this field + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public IntegerField(String name, String caption, String caption2, int min, int max) + { + super(name,caption,caption2,true,numDigits(min,max)); + if (min<max) + { // assign the min and max values normally + this.min_value = min; + this.max_value = max; + + } // end if + else + { // swap the values round so they're ordered right + this.min_value = max; + this.max_value = min; + + } // end else + + } // end constructor + + public IntegerField(Element elt) throws ConfigException + { + super(elt,numDigits(elt)); + XMLLoader loader = XMLLoader.get(); + DOMElementHelper h = new DOMElementHelper(elt); + if (h.hasAttribute("min")) + min_value = loader.configGetAttributeInt(elt,"min"); + else + min_value = Integer.MIN_VALUE; + if (h.hasAttribute("max")) + max_value = loader.configGetAttributeInt(elt,"max"); + else + max_value = Integer.MAX_VALUE; + if (max_value<min_value) + { // swap round the two values to put them in the right order + int t = min_value; + min_value = max_value; + max_value = t; + + } // end if + + } // end constructor + + protected IntegerField(IntegerField other) + { + super(other); + this.min_value = other.min_value; + this.max_value = other.max_value; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private static final int numDigits(int v) + { + if (v==0) + return 1; + else if (v>0) + return 1 + (int)(Math.floor(Math.log((double)v) / LN10)); + else + return 2 + (int)(Math.floor(Math.log((double)(-v)) / LN10)); + + } // end numDigits + + private static final int numDigits(int min, int max) + { + return Math.max(numDigits(min),numDigits(max)); + + } // end numDigits + + private static final int numDigits(Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + DOMElementHelper h = new DOMElementHelper(elt); + int min, max; + if (h.hasAttribute("min")) + min = loader.configGetAttributeInt(elt,"min"); + else + min = Integer.MIN_VALUE; + if (h.hasAttribute("max")) + max = loader.configGetAttributeInt(elt,"max"); + else + max = Integer.MAX_VALUE; + return numDigits(min,max); + + } // end numDigits + + /*-------------------------------------------------------------------------------- + * Overrides from class TextField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + super.renderField(out); + out.write(" (" + min_value + " - " + max_value + ")"); + + } // end renderField + + protected void validateContents(String value) throws ValidationException + { + super.validateContents(value); + try + { // convert to an integer and check against range + int x = Integer.parseInt(value); + if ((min_value>Integer.MIN_VALUE) && (x<min_value)) + throw new ValidationException("The value of the '" + getCaption() + + "' field must be greater than or equal to " + min_value + "."); + if ((max_value<Integer.MAX_VALUE) && (x>max_value)) + throw new ValidationException("The value of the '" + getCaption() + + "' field must be less than or equal to " + max_value + "."); + + } // end try + catch (NumberFormatException nfe) + { // integer conversion failed + throw new ValidationException("Invalid non-numeric character in the '" + getCaption() + "' field."); + + } // end catch + + } // end validateContents + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public Object getValue() + { + try + { // map the return value into an Integer + return new Integer(super.getValue().toString()); + + } // end try + catch (NumberFormatException nfe) + { // we should have validated the input already... + throw new InternalStateError("IntegerField.getValue(): this was not supposed to happen!"); + + } // end catch + + } // end getValue + + public void setValue(Object o) + { + if (o==null) + { // blank out the field + super.setValue(null); + return; + + } // end if + + int real_val; + if (o instanceof Number) + { // we have a number! + Number n = (Number)o; + real_val = n.intValue(); + + } // end if + else + { // parse the string equivalent + try + { // get the integer equivalent + real_val = Integer.parseInt(o.toString()); + + } // end try + catch (NumberFormatException nfe) + { // just use a sensible default + real_val = min_value; + + } // end catch + + } // end else + + // Constrain the input value and set it. + if (real_val<min_value) + real_val = min_value; + else if (real_val>max_value) + real_val = max_value; + super.setValue(String.valueOf(real_val)); + + } // end setValue + + public DialogField duplicate() + { + return new IntegerField(this); + + } // end duplicate + +} // end class IntegerField diff --git a/src/com/silverwrist/venice/ui/dlg/LanguageListField.java b/src/com/silverwrist/venice/ui/dlg/LanguageListField.java new file mode 100644 index 0000000..eaffe8e --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/LanguageListField.java @@ -0,0 +1,96 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; + +public class LanguageListField extends PickListField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "languagelist"; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public LanguageListField(String name, String caption, String caption2, boolean required) + { + super(name,caption,caption2,required,International.get().getLanguageList()); + + } // end constructor + + public LanguageListField(Element elt) throws ConfigException + { + super(elt,International.get().getLanguageList()); + + } // end constructor + + protected LanguageListField(LanguageListField other) + { + super(other); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class PickListField + *-------------------------------------------------------------------------------- + */ + + protected String getChoiceName(Object o) + { + return ((Language)o).getCode(); + + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return ((Language)o).getName(); + + } // end getChoiceValue + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public void setValue(Object o) + { + if ((o!=null) && (o instanceof Language)) + super.setValue(((Language)o).getCode()); + else + super.setValue(o); + + } // end setValue + + public DialogField duplicate() + { + return new LanguageListField(this); + + } // end duplicate + +} // end class LanguageListField diff --git a/src/com/silverwrist/venice/servlets/format/CDTimeZoneListFormField.java b/src/com/silverwrist/venice/ui/dlg/LocaleListField.java similarity index 53% rename from src/com/silverwrist/venice/servlets/format/CDTimeZoneListFormField.java rename to src/com/silverwrist/venice/ui/dlg/LocaleListField.java index b2786a8..3ef56ff 100644 --- a/src/com/silverwrist/venice/servlets/format/CDTimeZoneListFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/LocaleListField.java @@ -15,93 +15,79 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.util.*; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; -public class CDTimeZoneListFormField extends CDPickListFormField +public class LocaleListField extends PickListField { /*-------------------------------------------------------------------------------- - * Private list implementation + * Static data members *-------------------------------------------------------------------------------- */ - static class TimeZoneList extends AbstractList - { - private String[] array; // local array - - TimeZoneList() - { - array = TimeZone.getAvailableIDs(); - Arrays.sort(array); - - } // end constructor - - protected void finalize() throws Throwable - { - array = null; - super.finalize(); - - } // end finalize - - public Object get(int index) - { - return array[index]; - - } // end get - - public int size() - { - return array.length; - - } // end size - - } // end class TimeZoneList + public static final String TAGNAME = "localelist"; /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDTimeZoneListFormField(String name, String caption, String caption2, boolean required) + public LocaleListField(String name, String caption, String caption2, boolean required) { - super(name,caption,caption2,required,new TimeZoneList()); + super(name,caption,caption2,required,Arrays.asList(Locale.getAvailableLocales())); } // end constructor - protected CDTimeZoneListFormField(CDTimeZoneListFormField other) + public LocaleListField(Element elt) throws ConfigException + { + super(elt,Arrays.asList(Locale.getAvailableLocales())); + + } // end constructor + + protected LocaleListField(LocaleListField other) { super(other); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDPickListFormField + * Overrides from class PickListField *-------------------------------------------------------------------------------- */ - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException + protected String getChoiceName(Object o) { - String id = (String)obj; - out.write("<OPTION VALUE=\"" + id + "\""); - if (id.equals(my_value)) - out.write(" SELECTED"); - out.write(">" + StringUtil.encodeHTML(id) + "</OPTION>\n"); + return o.toString(); - } // end renderChoice + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return ((Locale)o).getDisplayName(); + + } // end getChoiceValue /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ - public CDFormField duplicate() + public Object getValue() { - return new CDTimeZoneListFormField(this); + return International.get().createLocale(super.getValue().toString()); + + } // end getValue + + public DialogField duplicate() + { + return new LocaleListField(this); } // end duplicate -} // end class CDTimeZoneListFormField +} // end class LocaleListField diff --git a/src/com/silverwrist/venice/ui/dlg/PasswordField.java b/src/com/silverwrist/venice/ui/dlg/PasswordField.java new file mode 100644 index 0000000..49b9ce1 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/PasswordField.java @@ -0,0 +1,138 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class PasswordField extends BaseDialogField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final int MINSIZE = 2; + + public static final String TAGNAME = "password"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int size; // the SIZE of the field + private int maxlength; // the MAXLENGTH of the field + private int real_maxlength; // the actual maximum length + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public PasswordField(String name, String caption, String caption2, boolean required, int size, int maxlength) + { + super(false,name,caption,caption2,required); + this.size = Math.max(size,MINSIZE); + this.maxlength = Math.max(maxlength,MINSIZE); + this.real_maxlength = maxlength; + + } // end constructor + + public PasswordField(String name, String caption, String caption2, boolean required, int size) + { + super(false,name,caption,caption2,required); + this.size = Math.max(size,MINSIZE); + this.maxlength = Math.max(size,MINSIZE); + this.real_maxlength = size; + + } // end constructor + + public PasswordField(Element elt) throws ConfigException + { + super(false,elt,true,true); + XMLLoader loader = XMLLoader.get(); + int my_size = loader.configGetAttributeInt(elt,"size"); + DOMElementHelper h = new DOMElementHelper(elt); + if (h.hasAttribute("maxlength")) + { // read the maxlength attribute and fill in the fields + this.real_maxlength = loader.configGetAttributeInt(elt,"maxlength"); + this.size = Math.max(my_size,MINSIZE); + this.maxlength = Math.max(this.real_maxlength,MINSIZE); + + } // end if + else + { // fill in the fields + this.real_maxlength = my_size; + this.size = this.maxlength = Math.max(my_size,MINSIZE); + + } // end else + + } // end constructor + + protected PasswordField(PasswordField other) + { + super(other); + this.size = other.size; + this.maxlength = other.maxlength; + this.real_maxlength = other.real_maxlength; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + out.write("<SPAN CLASS=\"cinput\"><INPUT TYPE=PASSWORD CLASS=\"cinput\" NAME=\"" + getName() + "\" SIZE=" + + size + " MAXLENGTH=" + maxlength); + if (!isEnabled()) + out.write(" DISABLED"); + out.write(" VALUE=\""); + if (getStringValue()!=null) + out.write(getStringValue()); + out.write("\"></SPAN>"); + + } // end renderField + + protected void validateContents(String value) throws ValidationException + { + if (value.length()>real_maxlength) + throw new ValidationException("The value of the '" + getCaption() + "' field must be no longer than " + + real_maxlength + " characters."); + + } // end validateContents + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public DialogField duplicate() + { + return new PasswordField(this); + + } // end duplicate + +} // end class PasswordField diff --git a/src/com/silverwrist/venice/servlets/format/CDPickListFormField.java b/src/com/silverwrist/venice/ui/dlg/PickListField.java similarity index 65% rename from src/com/silverwrist/venice/servlets/format/CDPickListFormField.java rename to src/com/silverwrist/venice/ui/dlg/PickListField.java index 76f1580..12d5980 100644 --- a/src/com/silverwrist/venice/servlets/format/CDPickListFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/PickListField.java @@ -15,15 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.util.Iterator; -import java.util.List; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; -public abstract class CDPickListFormField extends CDBaseFormField +public abstract class PickListField extends BaseDialogField { /*-------------------------------------------------------------------------------- * Attributes @@ -37,15 +38,21 @@ public abstract class CDPickListFormField extends CDBaseFormField *-------------------------------------------------------------------------------- */ - protected CDPickListFormField(String name, String caption, String caption2, boolean required, - List choices) + protected PickListField(String name, String caption, String caption2, boolean required, List choices) { - super(name,caption,caption2,required); + super(false,name,caption,caption2,required); this.choices = choices; } // end constructor - protected CDPickListFormField(CDPickListFormField other) + protected PickListField(Element elt, List choices) throws ConfigException + { + super(false,elt,true,true); + this.choices = choices; + + } // end constructor + + protected PickListField(PickListField other) { super(other); this.choices = other.choices; @@ -53,35 +60,41 @@ public abstract class CDPickListFormField extends CDBaseFormField } // end constructor /*-------------------------------------------------------------------------------- - * Abstract method declarations + * Abstract functions which MUST be overriden *-------------------------------------------------------------------------------- */ - protected abstract void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) - throws IOException; + protected abstract String getChoiceName(Object o); + + protected abstract String getChoiceValue(Object o); /*-------------------------------------------------------------------------------- - * Overrides from class CDBaseFormField + * Overrides from class BaseDialogField *-------------------------------------------------------------------------------- */ - protected void renderActualField(Writer out, RenderData rdat) throws IOException + protected void renderField(RequestOutput out) throws IOException { out.write("<SELECT CLASS=\"content\" NAME=\"" + getName() + "\" SIZE=1"); if (!isEnabled()) out.write(" DISABLED"); out.write(">\n"); Iterator it = choices.iterator(); + String val = getStringValue(); while (it.hasNext()) - { // render each of the choices in turn - Object c = it.next(); - renderChoice(out,rdat,c,getValue()); + { // loop through the list and render the choices + Object ch = it.next(); + String ch_name = getChoiceName(ch); + out.write("<OPTION VALUE=\"" + ch_name + "\""); + if (ch_name.equals(val)) + out.write(" SELECTED"); + out.write(">" + StringUtil.encodeHTML(getChoiceValue(ch)) + "</OPTION>\n"); } // end while out.write("</SELECT>\n"); // all done - } // end renderActualField + } // end render /*-------------------------------------------------------------------------------- * External operations @@ -100,4 +113,4 @@ public abstract class CDPickListFormField extends CDBaseFormField } // end setChoicesList -} // end class CDPickListFormField +} // end class PickListField diff --git a/src/com/silverwrist/venice/ui/dlg/RoleListField.java b/src/com/silverwrist/venice/ui/dlg/RoleListField.java new file mode 100644 index 0000000..a742ed5 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/RoleListField.java @@ -0,0 +1,124 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.security.Role; +import com.silverwrist.venice.ui.*; + +public class RoleListField extends PickListField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "rolelist"; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public RoleListField(String name, String caption, String caption2, boolean required, List role_list) + { + super(name,caption,caption2,required,role_list); + + } // end constructor + + public RoleListField(Element elt) throws ConfigException + { + super(elt,null); + + } // end constructor + + protected RoleListField(RoleListField other) + { + super(other); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class PickListField + *-------------------------------------------------------------------------------- + */ + + protected String getChoiceName(Object o) + { + return String.valueOf(((Role)o).getLevel()); + + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return ((Role)o).getName(); + + } // end getChoiceValue + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public Object getValue() + { + return new Integer(super.getValue().toString()); + + } // end getValue + + public void setValue(Object o) + { + if (o!=null) + { // set an object value + if (o instanceof Role) + super.setValue(String.valueOf(((Role)o).getLevel())); + else if (o instanceof Number) + super.setValue(String.valueOf(((Number)o).intValue())); + else + super.setValue(o); + + } // end if + else + super.setValue(null); + + } // end setValue + + public DialogField duplicate() + { + return new RoleListField(this); + + } // end duplicate + + public Object sendMessage(String msg, Object data) + { + if (msg.equals("setRoleList")) + { // the role list + this.setChoicesList((List)data); + return null; + + } // end if + + return super.sendMessage(msg,data); + + } // end sendMessage + +} // end class RoleListField diff --git a/src/com/silverwrist/venice/ui/dlg/StaticPickListField.java b/src/com/silverwrist/venice/ui/dlg/StaticPickListField.java new file mode 100644 index 0000000..b7a4f5a --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/StaticPickListField.java @@ -0,0 +1,193 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class StaticPickListField extends PickListField +{ + /*-------------------------------------------------------------------------------- + * Internal class holding choices + *-------------------------------------------------------------------------------- + */ + + static class PickListChoice + { + private String name; + private String value; + + PickListChoice(String name, String value) + { + this.name = name; + this.value = value; + + } // end constructor + + final String getName() + { + return name; + + } // end getName + + final String getValue() + { + return value; + + } // end getValue + + } // end class PickListChoice + + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "list"; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public StaticPickListField(String name, String caption, String caption2, boolean required, String clist) + { + super(name,caption,caption2,required,createChoiceListFromString(clist)); + + } // end constructor + + public StaticPickListField(Element elt) throws ConfigException + { + super(elt,createChoiceListFromXML(elt)); + + } // end constructor + + public StaticPickListField(PickListField other) + { + super(other); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private static final List createChoiceListFromString(String s) + { + char separator = s.charAt(0); + String work = s.substring(1); + ArrayList tmp = new ArrayList(); + while (work!=null) + { // split up the "choice list" string into name/value pairs + int p = work.indexOf(separator); + if (p<0) + break; + String n1 = work.substring(0,p); + work = work.substring(p+1); + p = work.indexOf(separator); + String v1; + if (p<0) + { // take the rest of the string + v1 = work; + work = null; + + } // end if + else + { // chop the string off the end + v1 = work.substring(0,p); + work = work.substring(p+1); + if (work.length()==0) + work = null; + + } // end else + + tmp.add(new PickListChoice(n1,v1)); + + } // end while + + tmp.trimToSize(); + if (tmp.isEmpty()) + return Collections.EMPTY_LIST; + else + return Collections.unmodifiableList(tmp); + + } // end createChoiceListFromString + + private static final List createChoiceListFromXML(Element elt) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + NodeList nl = elt.getChildNodes(); + ArrayList tmp = new ArrayList(); + for (int i=0; i<nl.getLength(); i++) + { // look for associated elements + Node n = nl.item(i); + if (n.getNodeType()==Node.ELEMENT_NODE) + { // make sure we have a <choice/> element here + loader.configVerifyNodeName(n,"choice",elt); + String n1 = loader.configGetAttribute((Element)n,"id"); + String v1 = loader.configGetText((Element)n); + tmp.add(new PickListChoice(n1,v1)); + + } // end if + // else just ignore that + + } // end for + + tmp.trimToSize(); + if (tmp.isEmpty()) + return Collections.EMPTY_LIST; + else + return Collections.unmodifiableList(tmp); + + } // end createChoiceListFromXML + + /*-------------------------------------------------------------------------------- + * Overrides from class PickListField + *-------------------------------------------------------------------------------- + */ + + protected String getChoiceName(Object o) + { + return ((PickListChoice)o).getName(); + + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return ((PickListChoice)o).getValue(); + + } // end getChoiceValue + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public DialogField duplicate() + { + return new StaticPickListField(this); + + } // end duplicate + +} // end class StaticPickListField diff --git a/src/com/silverwrist/venice/ui/dlg/TextField.java b/src/com/silverwrist/venice/ui/dlg/TextField.java new file mode 100644 index 0000000..75adeb4 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/TextField.java @@ -0,0 +1,155 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class TextField extends BaseDialogField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final int MINSIZE = 2; + + public static final String TAGNAME = "text"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int size; // the SIZE of the field + private int maxlength; // the MAXLENGTH of the field + private int real_maxlength; // the actual maximum length + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public TextField(String name, String caption, String caption2, boolean required, int size, int maxlength) + { + super(false,name,caption,caption2,required); + this.size = Math.max(size,MINSIZE); + this.maxlength = Math.max(maxlength,MINSIZE); + this.real_maxlength = maxlength; + + } // end constructor + + public TextField(String name, String caption, String caption2, boolean required, int size) + { + super(false,name,caption,caption2,required); + this.size = Math.max(size,MINSIZE); + this.maxlength = Math.max(size,MINSIZE); + this.real_maxlength = size; + + } // end constructor + + public TextField(Element elt) throws ConfigException + { + super(false,elt,true,true); + XMLLoader loader = XMLLoader.get(); + int my_size = loader.configGetAttributeInt(elt,"size"); + DOMElementHelper h = new DOMElementHelper(elt); + if (h.hasAttribute("maxlength")) + { // read the maxlength attribute and fill in the fields + this.real_maxlength = loader.configGetAttributeInt(elt,"maxlength"); + this.size = Math.max(my_size,MINSIZE); + this.maxlength = Math.max(this.real_maxlength,MINSIZE); + + } // end if + else + { // fill in the fields + this.real_maxlength = my_size; + this.size = this.maxlength = Math.max(my_size,MINSIZE); + + } // end else + + } // end constructor + + protected TextField(Element elt, int size) throws ConfigException + { + super(false,elt,true,true); + this.size = this.maxlength = Math.max(size,MINSIZE); + this.real_maxlength = size; + + } // end constructor + + protected TextField(Element elt, int size, int maxlength) throws ConfigException + { + super(false,elt,true,true); + this.size = Math.max(size,MINSIZE); + this.maxlength = Math.max(maxlength,MINSIZE); + this.real_maxlength = maxlength; + + } // end constructor + + protected TextField(TextField other) + { + super(other); + this.size = other.size; + this.maxlength = other.maxlength; + this.real_maxlength = other.real_maxlength; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + out.write("<SPAN CLASS=\"cinput\"><INPUT TYPE=TEXT CLASS=\"cinput\" NAME=\"" + getName() + "\" SIZE=" + + size + " MAXLENGTH=" + maxlength); + if (!isEnabled()) + out.write(" DISABLED"); + out.write(" VALUE=\""); + if (getStringValue()!=null) + out.write(getStringValue()); + out.write("\"></SPAN>"); + + } // end renderField + + protected void validateContents(String value) throws ValidationException + { + if (value.length()>real_maxlength) + throw new ValidationException("The value of the '" + getCaption() + "' field must be no longer than " + + real_maxlength + " characters."); + + } // end validateContents + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public DialogField duplicate() + { + return new TextField(this); + + } // end duplicate + +} // end class TextField diff --git a/src/com/silverwrist/venice/servlets/format/CDCheckBoxFormField.java b/src/com/silverwrist/venice/ui/dlg/TimeZoneListField.java similarity index 55% rename from src/com/silverwrist/venice/servlets/format/CDCheckBoxFormField.java rename to src/com/silverwrist/venice/ui/dlg/TimeZoneListField.java index 21dc7f3..61e7150 100644 --- a/src/com/silverwrist/venice/servlets/format/CDCheckBoxFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/TimeZoneListField.java @@ -15,95 +15,103 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.except.ValidationException; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; -public class CDCheckBoxFormField extends CDBaseFormFieldReverse +public class TimeZoneListField extends PickListField { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static final String YES = "Y"; + public static final String TAGNAME = "tzlist"; - /*-------------------------------------------------------------------------------- - * Attributes - *-------------------------------------------------------------------------------- - */ - - private String on_value; + private static final List tz_list; /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDCheckBoxFormField(String name, String caption, String caption2, String on_value) + public TimeZoneListField(String name, String caption, String caption2, boolean required) { - super(name,caption,caption2,false); - this.on_value = on_value; + super(name,caption,caption2,required,tz_list); } // end constructor - public CDCheckBoxFormField(String name, String caption, String caption2) + public TimeZoneListField(Element elt) throws ConfigException { - super(name,caption,caption2,false); - this.on_value = YES; + super(elt,tz_list); } // end constructor - protected CDCheckBoxFormField(CDCheckBoxFormField other) + protected TimeZoneListField(TimeZoneListField other) { super(other); - this.on_value = other.on_value; } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDBaseFormFieldReverse + * Overrides from class PickListField *-------------------------------------------------------------------------------- */ - protected void renderActualField(Writer out, RenderData rdat) throws IOException + protected String getChoiceName(Object o) { - out.write("<INPUT TYPE=CHECKBOX NAME=\"" + getName() + "\" VALUE=\"" + on_value + "\""); - if (!isEnabled()) - out.write(" DISABLED"); - if (on_value.equals(getValue())) - out.write(" CHECKED"); - out.write(">"); + return o.toString(); - } // end renderActualField + } // end getChoiceName + + protected String getChoiceValue(Object o) + { + return o.toString(); + + } // end getChoiceValue /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ - public Object getObjValue() + public Object getValue() { - return new Boolean(on_value.equals(getValue())); + return TimeZone.getTimeZone(super.getValue().toString()); - } // end getObjValue + } // end getValue - public void setObjValue(Object obj) + public void setValue(Object o) { - if (obj instanceof Boolean) - super.setValue(((Boolean)obj).booleanValue() ? on_value : ""); + if ((o!=null) && (o instanceof TimeZone)) + super.setValue(((TimeZone)o).getID()); else - super.setObjValue(obj); + super.setValue(o); - } // end setObjValue + } // end setValue - public CDFormField duplicate() + public DialogField duplicate() { - return new CDCheckBoxFormField(this); + return new TimeZoneListField(this); - } // end clone + } // end duplicate -} // end class CDCheckBoxFormField + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { // get the list of IDs, sort them, and save them + String ids[] = TimeZone.getAvailableIDs(); + Arrays.sort(ids); + tz_list = Collections.unmodifiableList(Arrays.asList(ids)); + + } // end static initializer + +} // end class TimeZoneListField diff --git a/src/com/silverwrist/venice/ui/dlg/UserPhotoField.java b/src/com/silverwrist/venice/ui/dlg/UserPhotoField.java new file mode 100644 index 0000000..6cd1bb0 --- /dev/null +++ b/src/com/silverwrist/venice/ui/dlg/UserPhotoField.java @@ -0,0 +1,133 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.dlg; + +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.util.XMLLoader; + +public class UserPhotoField extends BaseDialogField implements LinkTypes +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "userphoto"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String link_url; + private int link_type; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public UserPhotoField(String name, String caption, String link_url, int link_type) + { + super(false,name,caption,"(click to change)",false); + this.link_url = link_url; + this.link_type = link_type; + + } // end constructor + + public UserPhotoField(Element elt) throws ConfigException + { + super(false,elt,false,false); + XMLLoader loader = XMLLoader.get(); + this.link_url = loader.configGetAttribute(elt,"link"); + String stype = loader.configGetAttribute(elt,"type").trim().toLowerCase(); + if (stype.equals("absolute")) + link_type = ABSOLUTE; + else if (stype.equals("servlet")) + link_type = SERVLET; + else if (stype.equals("frame")) + link_type = FRAME; + else + throw new ConfigException("invalid link type= attribute"); + setCaption2("(click to change)"); + + } // end constructor + + protected UserPhotoField(UserPhotoField other) + { + super(other); + this.link_url = other.link_url; + this.link_type = other.link_type; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(RequestOutput out) throws IOException + { + if (isEnabled()) + out.write("<A HREF=\"" + out.formatURL(link_url,link_type) + "\">"); + out.write(out.getUserPhotoTag(getStringValue())); + if (isEnabled()) + out.write("</A>"); + + } // end renderField + + /*-------------------------------------------------------------------------------- + * Implementations from interface DialogField + *-------------------------------------------------------------------------------- + */ + + public DialogField duplicate() + { + return new UserPhotoField(this); + + } // end duplicate + + public Object sendMessage(String msg, Object data) + { + if (msg.equals("setLinkURL")) + { // the link URL + link_url = data.toString(); + return null; + + } // end if + + return null; + + } // end sendMessage + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setLinkURL(String url, int type) + { + link_url = url; + link_type = type; + + } // end setLinkURL + +} // end class UserPhotoField diff --git a/src/com/silverwrist/venice/servlets/format/CDVeniceIDFormField.java b/src/com/silverwrist/venice/ui/dlg/VeniceIDField.java similarity index 60% rename from src/com/silverwrist/venice/servlets/format/CDVeniceIDFormField.java rename to src/com/silverwrist/venice/ui/dlg/VeniceIDField.java index 1d324f7..b28ff21 100644 --- a/src/com/silverwrist/venice/servlets/format/CDVeniceIDFormField.java +++ b/src/com/silverwrist/venice/ui/dlg/VeniceIDField.java @@ -7,7 +7,7 @@ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * - * The Original Code is the Venice Web Community System. + * The Original Code is the Venice Web Communities System. * * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -15,33 +15,56 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.dlg; -import com.silverwrist.venice.except.ValidationException; +import java.io.IOException; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; import com.silverwrist.venice.util.IDUtils; -public class CDVeniceIDFormField extends CDTextFormField +public class VeniceIDField extends TextField { + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final String TAGNAME = "veniceid"; + /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public CDVeniceIDFormField(String name, String caption, String caption2, boolean required, - int size, int maxlength) + public VeniceIDField(String name, String caption, String caption2, boolean required, int size, + int maxlength) { super(name,caption,caption2,required,size,maxlength); } // end constructor - protected CDVeniceIDFormField(CDVeniceIDFormField other) + public VeniceIDField(String name, String caption, String caption2, boolean required, int size) + { + super(name,caption,caption2,required,size); + + } // end constructor + + public VeniceIDField(Element elt) throws ConfigException + { + super(elt); + + } // end constructor + + protected VeniceIDField(VeniceIDField other) { super(other); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDTextFormField + * Overrides from class TextField *-------------------------------------------------------------------------------- */ @@ -55,14 +78,14 @@ public class CDVeniceIDFormField extends CDTextFormField } // end validateContents /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Implementations from interface DialogField *-------------------------------------------------------------------------------- */ - public CDFormField duplicate() + public DialogField duplicate() { - return new CDVeniceIDFormField(this); + return new VeniceIDField(this); - } // end clone + } // end duplicate -} // end class CDVeniceIDFormField +} // end class VeniceIDField diff --git a/src/com/silverwrist/venice/ui/helpers/BinaryDataContent.java b/src/com/silverwrist/venice/ui/helpers/BinaryDataContent.java new file mode 100644 index 0000000..35a3873 --- /dev/null +++ b/src/com/silverwrist/venice/ui/helpers/BinaryDataContent.java @@ -0,0 +1,63 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.helpers; + +import java.io.InputStream; +import java.io.IOException; +import com.silverwrist.venice.core.BinaryData; +import com.silverwrist.venice.except.DataException; +import com.silverwrist.venice.ui.ContentExecute; +import com.silverwrist.venice.ui.LinkTypes; +import com.silverwrist.venice.ui.RequestExec; + +public class BinaryDataContent extends ThrowableContent implements ContentExecute +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private BinaryData data; + private InputStream stm; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public BinaryDataContent(BinaryData data) throws DataException + { + super(); + this.data = data; + this.stm = data.getData(); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentExecute + *-------------------------------------------------------------------------------- + */ + + public void execute(RequestExec req) throws IOException + { + req.sendBinary(data.getMIMEType(),data.getFilename(),data.getLength(),stm); + + } // end execute + +} // end class BinaryDataContent + diff --git a/src/com/silverwrist/venice/servlets/format/ConfirmBox.java b/src/com/silverwrist/venice/ui/helpers/ConfirmBox.java similarity index 62% rename from src/com/silverwrist/venice/servlets/format/ConfirmBox.java rename to src/com/silverwrist/venice/ui/helpers/ConfirmBox.java index b0a33d7..c8318aa 100644 --- a/src/com/silverwrist/venice/servlets/format/ConfirmBox.java +++ b/src/com/silverwrist/venice/ui/helpers/ConfirmBox.java @@ -15,16 +15,14 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.helpers; import java.util.*; -import java.io.Writer; import java.io.IOException; -import javax.servlet.*; -import javax.servlet.http.*; import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; -public class ConfirmBox implements ContentRender, ColorSelectors +public class ConfirmBox implements ContentDirect, ColorSelectors, LinkTypes { /*-------------------------------------------------------------------------------- * Static data members @@ -33,7 +31,7 @@ public class ConfirmBox implements ContentRender, ColorSelectors private static final long TIMEOUT = 60000; // 1 minute - private static Random rng = null; + private static Random rng; /*-------------------------------------------------------------------------------- * Attributes @@ -44,7 +42,9 @@ public class ConfirmBox implements ContentRender, ColorSelectors private String title; private String message; private String confirm_url; + private int confirm_url_type; private String deny_url; + private int deny_url_type; private Date created; /*-------------------------------------------------------------------------------- @@ -52,26 +52,21 @@ public class ConfirmBox implements ContentRender, ColorSelectors *-------------------------------------------------------------------------------- */ - public ConfirmBox(HttpServletRequest request, String attr_name, String param_name, String title, - String message, String confirm_url, String deny_url) + public ConfirmBox(RequestInput ri, String attr_name, String param_name, String title, + String message, String confirm_url, int confirm_url_type, String deny_url, + int deny_url_type) { - if (rng==null) - { // initialize the random number gnerator - Date now = new Date(); - rng = new Random(now.getTime()); - - } // end if - // Fill in all the parameters except created. this.conf_num = rng.nextInt(0x1000000); this.title = title; this.message = message; this.confirm_url = confirm_url + "&" + param_name + "=" + this.conf_num; + this.confirm_url_type = confirm_url_type; this.deny_url = deny_url; + this.deny_url_type = deny_url_type; - // Stash this object in the HTTP session. - HttpSession session = request.getSession(true); - session.setAttribute(attr_name,this); + // Stash this object in a session variable. + ri.setSessionAttribute(attr_name,this); // Now start the timer ticking... this.created = new Date(); @@ -93,11 +88,23 @@ public class ConfirmBox implements ContentRender, ColorSelectors } // end doConfirm /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent + * Implementations from interface Content *-------------------------------------------------------------------------------- */ - public String getPageTitle(RenderData rdat) + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) { return title; @@ -110,45 +117,40 @@ public class ConfirmBox implements ContentRender, ColorSelectors } // end getPageQID /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender + * Implementations from interface ContentDirect *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1>"); - out.write("<TR VALIGN=MIDDLE><TD ALIGN=CENTER BGCOLOR=\"" + rdat.getStdColor(CONFIRM_TITLE_BACKGROUND) - + "\">\n"); - out.write(rdat.getStdFontTag(CONFIRM_TITLE_FOREGROUND,3) + StringUtil.encodeHTML(title) + "</FONT>\n"); - out.write("</TD></TR><TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n"); - out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,3) + "<P>" + StringUtil.encodeHTML(message) + "<P>\n"); - out.write("<A HREF=\"" + rdat.getEncodedServletPath(confirm_url) + "\">"); - out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_yes.gif") - + "\" ALT=\"Yes\" WIDTH=80 HEIGHT=24 BORDER=0></A>  \n"); - out.write("<A HREF=\"" + rdat.getEncodedServletPath(deny_url) + "\">"); - out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_no.gif") - + "\" ALT=\"No\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n"); - out.write("</FONT></TD></TR></TABLE><P>\n"); - - } // end renderHere + out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1><TR VALIGN=MIDDLE>" + + "<TD ALIGN=CENTER BGCOLOR=\"" + out.getColor(CONFIRM_TITLE_BACKGROUND) + "\">\n" + + out.getFontTag(CONFIRM_TITLE_FOREGROUND,"confirmbox") + StringUtil.encodeHTML(title) + + "</FONT>\n</TD></TR><TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n" + + out.getFontTag(CONTENT_FOREGROUND,"confirmbox") + "<P>" + StringUtil.encodeHTML(message) + + "<P>\n<A HREF=\"" + out.formatURL(confirm_url,confirm_url_type) + "\">" + + out.getButtonVisual("yes") + "</A>  \n<A HREF=\"" + + out.formatURL(deny_url,deny_url_type) + "\">" + out.getButtonVisual("no") + + "</A>\n</FONT></TD></TR></TABLE><P>\n"); + + } // end render /*-------------------------------------------------------------------------------- * External static operations *-------------------------------------------------------------------------------- */ - public static boolean isConfirmed(HttpServletRequest request, String attr_name, String param_name) + public static final boolean isConfirmed(RequestInput ri, String attr_name, String param_name) { // First, get the ConfirmBox out of the session data - HttpSession session = request.getSession(true); - Object obj = session.getAttribute(attr_name); - session.removeAttribute(attr_name); // we can only get it out once! + Object obj = ri.getSessionAttribute(attr_name); + ri.setSessionAttribute(attr_name,null); // we can only get it out once! if ((obj==null) || !(obj instanceof ConfirmBox)) // this is not a valid ConfirmBox! return false; ConfirmBox cb = (ConfirmBox)obj; // Now get the confirmation number out of the URL parameters. - String test_num_str = request.getParameter(param_name); + String test_num_str = ri.getParameter(param_name); if (test_num_str==null) return false; // no confirmation! @@ -168,4 +170,16 @@ public class ConfirmBox implements ContentRender, ColorSelectors } // end isConfirmed + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { // initialize the random number generator + Date now = new Date(); + rng = new Random(now.getTime()); + + } // end static initializer + } // end class ConfirmBox diff --git a/src/com/silverwrist/venice/ui/helpers/ErrorBox.java b/src/com/silverwrist/venice/ui/helpers/ErrorBox.java new file mode 100644 index 0000000..c492b6e --- /dev/null +++ b/src/com/silverwrist/venice/ui/helpers/ErrorBox.java @@ -0,0 +1,158 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.helpers; + +import java.io.IOException; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSelectors, LinkTypes +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String DEFAULT_TITLE = "Error!"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String title; + private String back; + private int back_linktype; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public ErrorBox(String title, String message, String back, int back_linktype) + { + super(message); + this.title = title; + this.back = back; + this.back_linktype = back_linktype; + + if (this.title==null) + this.title = DEFAULT_TITLE; + + } // end constructor + + public ErrorBox(String title, String message, String back) + { + this(title,message,back,SERVLET); + + } // end constructor + + public ErrorBox(String title, Throwable t, String back, int back_linktype) + { + super(t); + this.title = title; + this.back = back; + this.back_linktype = back_linktype; + + if (this.title==null) + this.title = DEFAULT_TITLE; + + } // end constructor + + public ErrorBox(String title, Throwable t, String back) + { + this(title,t,back,SERVLET); + + } // end constructor + + public ErrorBox(String title, String message, Throwable t, String back, int back_linktype) + { + super(message,t); + this.title = title; + this.back = back; + this.back_linktype = back_linktype; + + if (this.title==null) + this.title = DEFAULT_TITLE; + + } // end constructor + + public ErrorBox(String title, String message, Throwable t, String back) + { + this(title,message,t,back,SERVLET); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return title; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentDirect + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out) throws IOException + { + out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1><TR VALIGN=MIDDLE>" + + "<TD ALIGN=CENTER BGCOLOR=\"" + out.getColor(ERROR_TITLE_BACKGROUND) + "\">\n" + + out.getFontTag(ERROR_TITLE_FOREGROUND,"errorbox") + StringUtil.encodeHTML(title) + + "</FONT>\n</TD></TR>" + "<TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n" + + out.getFontTag(CONTENT_FOREGROUND,"errorbox") + "<P>" + StringUtil.encodeHTML(getMessage()) + + "<P>\n"); + if (back==null) + out.write("Use your browser's <B>Back</B> button to go back.\n"); + else + out.write("<A HREF=\"" + out.formatURL(back,back_linktype) + "\">Go back.</A>\n"); + out.write("<P></FONT></TD></TR></TABLE><P>\n"); + if (canPrintStackTrace()) + { // put the stack trace in an HTML comment so we can see what may be going on... + out.write("<!--\n"); + out.writeStackTrace(this); + out.write("\n-->\n"); + + } // end if + + } // end render + +} // end class ErrorBox diff --git a/src/com/silverwrist/venice/servlets/ErrorResult.java b/src/com/silverwrist/venice/ui/helpers/HTTPError.java similarity index 71% rename from src/com/silverwrist/venice/servlets/ErrorResult.java rename to src/com/silverwrist/venice/ui/helpers/HTTPError.java index 57c402f..23e2a1f 100644 --- a/src/com/silverwrist/venice/servlets/ErrorResult.java +++ b/src/com/silverwrist/venice/ui/helpers/HTTPError.java @@ -15,12 +15,14 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.helpers; import java.io.IOException; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.ContentExecute; +import com.silverwrist.venice.ui.LinkTypes; +import com.silverwrist.venice.ui.RequestExec; -public class ErrorResult extends ExecuteResult +public class HTTPError extends ThrowableContent implements ContentExecute { /*-------------------------------------------------------------------------------- * Attributes @@ -28,39 +30,42 @@ public class ErrorResult extends ExecuteResult */ private int code; - private String msg; /*-------------------------------------------------------------------------------- * Constructors *-------------------------------------------------------------------------------- */ - public ErrorResult(int code) + public HTTPError(int code) { + super(); this.code = code; - this.msg = null; } // end constructor - public ErrorResult(int code, String msg) + public HTTPError(int code, String message) { + super(message); + this.code = code; + + } // end constructor + + public HTTPError(int code, Throwable t) + { + super(t); this.code = code; - this.msg = msg; } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class ExecuteResult + * Implementations from interface ContentExecute *-------------------------------------------------------------------------------- */ - public void execute(RenderData rdat) throws IOException + public void execute(RequestExec req) throws IOException { - if (msg!=null) - rdat.errorResponse(code,msg); - else - rdat.errorResponse(code); + req.error(code,getMessage()); } // end execute -} // end class ErrorResult +} // end class HTTPError diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/ImageHandler.java b/src/com/silverwrist/venice/ui/helpers/ImageHandler.java similarity index 88% rename from src/com/silverwrist/venice/servlets/format/sideboxes/ImageHandler.java rename to src/com/silverwrist/venice/ui/helpers/ImageHandler.java index 6af27c9..f221bb5 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/ImageHandler.java +++ b/src/com/silverwrist/venice/ui/helpers/ImageHandler.java @@ -15,15 +15,14 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.helpers; -import java.io.*; +import java.io.IOException; import org.w3c.dom.*; -import com.silverwrist.util.DOMElementHelper; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.ui.*; -public class ImageHandler implements ComponentRender +public class ImageHandler implements RenderDirect { /*-------------------------------------------------------------------------------- * Attributes @@ -126,41 +125,41 @@ public class ImageHandler implements ComponentRender } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface RenderDirect *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { if (url!=null) - out.write(getRendering(rdat)); + out.write(getRendering(out)); - } // end renderHere + } // end render /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - public boolean isDefined() + public final boolean isDefined() { return (url!=null); } // end if - public int getWidth() + public final int getWidth() { return width; } // end getWidth - public int getHeight() + public final int getHeight() { return height; } // end getHeight - public String getRendering(RenderData rdat) + public final String getRendering(RequestOutput out) { if (url==null) return ""; @@ -169,7 +168,7 @@ public class ImageHandler implements ComponentRender { // this may be called by more than one class, so protect this part if (fixup) { // fix up the host tag URL - url = rdat.getFullImagePath(url); + url = out.getImagePath(url); fixup = false; } // end if diff --git a/src/com/silverwrist/venice/servlets/format/AdminImportUser.java b/src/com/silverwrist/venice/ui/helpers/ImportHelper.java similarity index 79% rename from src/com/silverwrist/venice/servlets/format/AdminImportUser.java rename to src/com/silverwrist/venice/ui/helpers/ImportHelper.java index c3de9ab..1fd2910 100644 --- a/src/com/silverwrist/venice/servlets/format/AdminImportUser.java +++ b/src/com/silverwrist/venice/ui/helpers/ImportHelper.java @@ -15,39 +15,32 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.helpers; import java.io.*; import java.util.*; -import javax.servlet.*; import org.apache.log4j.*; import org.w3c.dom.*; -import com.silverwrist.util.StringUtil; -import com.silverwrist.util.DOMElementHelper; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; import com.silverwrist.venice.security.*; import com.silverwrist.venice.util.*; -public class AdminImportUser implements JSPRender +public class ImportHelper { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(AdminImportUser.class); - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.AdminFindUser"; + private static Category logger = Category.getInstance(ImportHelper.class); /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private AdminOperations adm; - private boolean doing_it; private int processed = 0; private int errors = 0; private String message = null; @@ -57,64 +50,7 @@ public class AdminImportUser implements JSPRender *-------------------------------------------------------------------------------- */ - public AdminImportUser(AdminOperations adm, boolean doing_it) - { - this.adm = adm; - this.doing_it = doing_it; - - } // end constructor - - /*-------------------------------------------------------------------------------- - * External static functions - *-------------------------------------------------------------------------------- - */ - - public static AdminImportUser retrieve(ServletRequest request) - { - return (AdminImportUser)(request.getAttribute(ATTR_NAME)); - - } // end retrieve - - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Import User Accounts"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return (doing_it ? "import_results.jsp" : "import_form.jsp"); - - } // end getTargetJSPName - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - public final void execute(InputStream xml_data) + public ImportHelper(AdminOperations adm, InputStream xml_data) { XMLLoader loader = XMLLoader.get(); Document xmldoc; @@ -292,19 +228,24 @@ public class AdminImportUser implements JSPRender // Gather the scroll items together to form the message. message = StringUtil.join(scroll,"<BR>\n"); - } // end execute + } // end constructor - public final int getNumProcessed() + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final int getProcessed() { return processed; - } // end getNumProcessed + } // end getProcessed - public final int getNumErrors() + public final int getErrors() { return errors; - } // end getNumErrors + } // end getErrors public final String getMessage() { @@ -312,4 +253,4 @@ public class AdminImportUser implements JSPRender } // end getMessage -} // end class AdminImportUser +} // end class ImportHelper diff --git a/src/com/silverwrist/venice/servlets/format/LogInOrCreate.java b/src/com/silverwrist/venice/ui/helpers/LogInOrCreate.java similarity index 61% rename from src/com/silverwrist/venice/servlets/format/LogInOrCreate.java rename to src/com/silverwrist/venice/ui/helpers/LogInOrCreate.java index dee8524..996722b 100644 --- a/src/com/silverwrist/venice/servlets/format/LogInOrCreate.java +++ b/src/com/silverwrist/venice/ui/helpers/LogInOrCreate.java @@ -15,61 +15,53 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.helpers; -import java.net.URLEncoder; -import java.io.Writer; import java.io.IOException; +import java.net.URLEncoder; import javax.servlet.*; import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.servlets.VeniceServletResult; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; -public class LogInOrCreate extends VeniceServletResult implements JSPRender, ColorSelectors +public class LogInOrCreate extends ThrowableContent implements ContentJSP { - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.LogInOrCreate"; - /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private String target; + private RequestInput rinput = null; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public LogInOrCreate(String target) + public LogInOrCreate() { super(); - this.target = target; - + } // end constructor /*-------------------------------------------------------------------------------- - * External static functions + * Implementations from interface Content *-------------------------------------------------------------------------------- */ - public static LogInOrCreate retrieve(ServletRequest request) + public boolean needFrame() { - return (LogInOrCreate)(request.getAttribute(ATTR_NAME)); + return true; - } // end retrieve + } // end needFrame - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; - public String getPageTitle(RenderData rdat) + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) { return "Log In or Create Account"; @@ -82,31 +74,53 @@ public class LogInOrCreate extends VeniceServletResult implements JSPRender, Col } // end getPageQID /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender + * Implementations from interface ContentJSP *-------------------------------------------------------------------------------- */ - public void store(ServletRequest request) + public String getJSPName() { - request.setAttribute(ATTR_NAME,this); + return "helpers/login_or_create.jsp"; - } // end store + } // end getJSPName - public String getTargetJSPName() + public void initialize(RequestInput req) { - return "login_or_create.jsp"; + rinput = req; - } // end getTargetJSPName + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - public String getTargetURL(RenderData rdat, String base_URL) + public final String getTargetParam() { - return rdat.getEncodedServletPath(base_URL + URLEncoder.encode(target)); + return (rinput!=null) ? URLEncoder.encode(rinput.getLocation()) : null; - } // end getTargetURL + } // end getTargetParam + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final LogInOrCreate get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("LogInOrCreate.get: unable to get request content"); + if (obj instanceof LogInOrCreate) + return (LogInOrCreate)obj; + throw new ServletException("LogInOrCreate.get: request content is not a LogInOrCreate object"); + + } // end get } // end class LogInOrCreate diff --git a/src/com/silverwrist/venice/servlets/ExecuteResult.java b/src/com/silverwrist/venice/ui/helpers/NullResponse.java similarity index 72% rename from src/com/silverwrist/venice/servlets/ExecuteResult.java rename to src/com/silverwrist/venice/ui/helpers/NullResponse.java index 40dccb9..cc429a4 100644 --- a/src/com/silverwrist/venice/servlets/ExecuteResult.java +++ b/src/com/silverwrist/venice/ui/helpers/NullResponse.java @@ -15,30 +15,31 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.helpers; -import java.io.IOException; -import javax.servlet.ServletException; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.ContentExecute; +import com.silverwrist.venice.ui.RequestExec; -public abstract class ExecuteResult extends VeniceServletResult +public class NullResponse extends ThrowableContent implements ContentExecute { /*-------------------------------------------------------------------------------- - * Constructor + * Constructors *-------------------------------------------------------------------------------- */ - protected ExecuteResult() + public NullResponse() { - super(); - } // end constructor /*-------------------------------------------------------------------------------- - * Abstract operations which must be overridden + * Implementations from interface ContentExecute *-------------------------------------------------------------------------------- */ - public abstract void execute(RenderData rdat) throws IOException, ServletException; + public void execute(RequestExec req) + { + req.noContent(); -} // end class ExecuteResult + } // end execute + +} // end class NullResponse diff --git a/src/com/silverwrist/venice/servlets/SendFileResult.java b/src/com/silverwrist/venice/ui/helpers/Redirect.java similarity index 68% rename from src/com/silverwrist/venice/servlets/SendFileResult.java rename to src/com/silverwrist/venice/ui/helpers/Redirect.java index 5d826e7..0811d85 100644 --- a/src/com/silverwrist/venice/servlets/SendFileResult.java +++ b/src/com/silverwrist/venice/ui/helpers/Redirect.java @@ -15,47 +15,53 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.helpers; import java.io.IOException; -import java.io.InputStream; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.ContentExecute; +import com.silverwrist.venice.ui.LinkTypes; +import com.silverwrist.venice.ui.RequestExec; -public class SendFileResult extends ExecuteResult +public class Redirect extends ThrowableContent implements ContentExecute, LinkTypes { /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private String type; - private String filename; - private int length; - private InputStream data; + private String url; + private int type; /*-------------------------------------------------------------------------------- - * Constructor + * Constructors *-------------------------------------------------------------------------------- */ - public SendFileResult(String type, String filename, int length, InputStream data) + public Redirect(String url) { + super(); + this.url = url; + this.type = ABSOLUTE; + + } // end constructor + + public Redirect(String url, int type) + { + super(); + this.url = url; this.type = type; - this.filename = filename; - this.length = length; - this.data = data; } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class ExecuteResult + * Implementations from interface ContentExecute *-------------------------------------------------------------------------------- */ - public void execute(RenderData rdat) throws IOException + public void execute(RequestExec req) throws IOException { - rdat.sendBinaryData(type,filename,length,data); + req.redirect(url,type); } // end execute -} // end class SendFileResult +} // end class Redirect diff --git a/src/com/silverwrist/venice/ui/helpers/ThrowableContent.java b/src/com/silverwrist/venice/ui/helpers/ThrowableContent.java new file mode 100644 index 0000000..c148ad7 --- /dev/null +++ b/src/com/silverwrist/venice/ui/helpers/ThrowableContent.java @@ -0,0 +1,161 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.helpers; + +import java.io.PrintStream; +import java.io.PrintWriter; + +public abstract class ThrowableContent extends Throwable +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private Throwable inner; + private boolean have_stack_trace = false; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public ThrowableContent() + { + super(); + inner = null; + + } // end constructor + + public ThrowableContent(String msg) + { + super(msg); + inner = null; + + } // end constructor + + public ThrowableContent(Throwable t) + { + super(t.getMessage()); + inner = t; + + } // end constructor + + public ThrowableContent(String msg, Throwable t) + { + super(msg); + inner = t; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class Object + *-------------------------------------------------------------------------------- + */ + + public String toString() + { + return getMessage(); + + } // end toString + + /*-------------------------------------------------------------------------------- + * Overrides from class Throwable + *-------------------------------------------------------------------------------- + */ + + public Throwable fillInStackTrace() + { + have_stack_trace = true; + return super.fillInStackTrace(); + + } // end fillInStackTrace + + /** + * Prints this exception and its backtrace to the standard error stream. Also prints the backtrace + * of any "wrapped" exception. + * + * @see java.lang.System#err + */ + public void printStackTrace() + { + this.printStackTrace(System.err); + + } // end printStackTrace + + /** + * Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the + * backtrace of any "wrapped" exception. + * + * @param s <CODE>PrintStream</CODE> to use for output. + */ + public void printStackTrace(PrintStream s) + { + if (have_stack_trace) + super.printStackTrace(s); + if (inner!=null) + { // print the inner stack trace + s.print("Root cause: "); + inner.printStackTrace(s); + + } // end if + + } // end printStackTrace + + /** + * Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the + * backtrace of any "wrapped" exception. + * + * @param s <CODE>PrintWriter</CODE> to use for output. + */ + public void printStackTrace(PrintWriter s) + { + if (have_stack_trace) + super.printStackTrace(s); + if (inner!=null) + { // print the inner stack trace + s.print("Root cause: "); + inner.printStackTrace(s); + + } // end if + + } // end printStackTrace + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + /** + * Returns the exception wrapped by this exception, or <CODE>null</CODE> if there is none. + * + * @return See above. + */ + public Throwable getException() + { + return inner; + + } // end getException + + public boolean canPrintStackTrace() + { + return (have_stack_trace || (inner!=null)); + + } // end canPrintStackTrace + +} // end class ThrowableContent diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityAliasTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityAliasTag.java new file mode 100644 index 0000000..2f12b60 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityAliasTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityAliasTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:alias/> tag - community not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(comm.getAlias()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing community alias - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class CommunityAliasTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityCanJoinTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityCanJoinTag.java new file mode 100644 index 0000000..737f139 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityCanJoinTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityCanJoinTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:can_join/> tag - community not defined!"); + + return (comm.canJoin() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class CommunityCanJoinTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityCanSendInvitationTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityCanSendInvitationTag.java new file mode 100644 index 0000000..b741140 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityCanSendInvitationTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityCanSendInvitationTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:can_send_invite/> tag - community not defined!"); + + return (comm.canSendInvitation() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class CommunityCanSendInvitationTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityCannotJoinTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityCannotJoinTag.java new file mode 100644 index 0000000..45be615 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityCannotJoinTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityCannotJoinTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:cannot_join/> tag - community not defined!"); + + return (comm.canJoin() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class CommunityCannotJoinTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityIDTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityIDTag.java new file mode 100644 index 0000000..e19650b --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityIDTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityIDTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:ID/> tag - community not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(String.valueOf(comm.getCommunityID())); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing community ID - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class CommunityIDTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityIsPrivateTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityIsPrivateTag.java new file mode 100644 index 0000000..1399a52 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityIsPrivateTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityIsPrivateTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:is_private/> tag - community not defined!"); + + return (comm.isPublicCommunity() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class CommunityIsPrivateTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityIsPublicTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityIsPublicTag.java new file mode 100644 index 0000000..1acf4a0 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityIsPublicTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityIsPublicTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:is_public/> tag - community not defined!"); + + return (comm.isPublicCommunity() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class CommunityIsPublicTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunityNameTag.java b/src/com/silverwrist/venice/ui/jsp/CommunityNameTag.java new file mode 100644 index 0000000..9f75b02 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunityNameTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunityNameTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:name/> tag - community not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(comm.getName()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing community name - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class CommunityNameTag diff --git a/src/com/silverwrist/venice/ui/jsp/CommunitySynopsisTag.java b/src/com/silverwrist/venice/ui/jsp/CommunitySynopsisTag.java new file mode 100644 index 0000000..600cce7 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/CommunitySynopsisTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class CommunitySynopsisTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + CommunityContext comm = getRequestInput().getCommunity(); + if (comm==null) + throw new JspTagException("<comm:synopsis/> tag - community not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(comm.getSynopsis()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing community synopsis - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class CommunitySynopsisTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameBannerAdTag.java b/src/com/silverwrist/venice/ui/jsp/FrameBannerAdTag.java new file mode 100644 index 0000000..82d159c --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameBannerAdTag.java @@ -0,0 +1,97 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class FrameBannerAdTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + StringBuffer write_data = new StringBuffer(); + Advertisement advert; + RequestInput ri = getRequestInput(); + + // Find an ad. + UserContext user = ri.getUser(); + if (user.isLoggedIn()) + advert = user.selectAd(); + else + advert = ri.getEngine().selectAd(); + if (advert!=null) + { // we have an advertisement - figure out how to render it + String tmp = advert.getImagePath(); + String full_image_path; + if (advert.getImagePathStyle()==Advertisement.CONTEXT_RELATIVE) + { // compute a context-relative path for the <IMG SRC> + if (tmp.startsWith("/")) + full_image_path = ri.getContextPath() + tmp; + else + full_image_path = ri.getContextPath() + "/" + tmp; + + } // end if + else // can't figure it out + full_image_path = null; + + if (full_image_path!=null) + { // compose the HTML fragment + tmp = advert.getLinkURL(); + if (tmp!=null) + write_data.append("<A HREF=\"").append(tmp).append("\">"); + write_data.append("<IMG SRC=\"").append(full_image_path).append("\" ALT=\""); + String tmp2 = advert.getCaption(); + if (tmp2!=null) + write_data.append(tmp2); + write_data.append("\" ALIGN=RIGHT WIDTH=468 HEIGHT=60 HSPACE=2 VSPACE=2 BORDER=0>"); + if (tmp!=null) + write_data.append("</A>"); + + } // end if + else // path not computable - just write some junk + write_data.append(" "); + + } // end if + else // no ad found - just write some junk + write_data.append(" "); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(write_data.toString()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing advertisement info - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameBannerAdTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameBodyTag.java b/src/com/silverwrist/venice/ui/jsp/FrameBodyTag.java new file mode 100644 index 0000000..5964264 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameBodyTag.java @@ -0,0 +1,68 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameBodyTag extends VeniceTagSupport implements ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<BODY BGCOLOR=\"" + getRequestInput().getColor(FRAME_BACKGROUND) + "\">"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <BODY> tag - " + e.getMessage()); + + } // end catch + + return EVAL_BODY_INCLUDE; + + } // end doStartTag + + public int doEndTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("</BODY>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing </BODY> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + +} // end class FrameBodyTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameContentHereTag.java b/src/com/silverwrist/venice/ui/jsp/FrameContentHereTag.java new file mode 100644 index 0000000..c050023 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameContentHereTag.java @@ -0,0 +1,57 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameContentHereTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.flush(); + getRequestOutput().output(out,getContent()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("IO error writing frame content - " + e.getMessage()); + + } // end catch + catch (ServletException se) + { // convert the servlet exception into something we can deal with, too + throw new JspException("Servlet error writing frame content - " + se.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameContentHereTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameCurrentMenuTag.java b/src/com/silverwrist/venice/ui/jsp/FrameCurrentMenuTag.java new file mode 100644 index 0000000..a724439 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameCurrentMenuTag.java @@ -0,0 +1,56 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.menus.MenuComponent; + +public class FrameCurrentMenuTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + MenuComponent mc = + (MenuComponent)(getRequestInput().getSessionAttribute(RequestInput.LEFT_MENU_SESSION_ATTR)); + if (mc==null) + throw new JspTagException("<frame:currentmenu/> menu not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + mc.renderOnLeft(getRequestOutput(),out); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing left menu - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameCurrentMenuTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameDisplayLoginTag.java b/src/com/silverwrist/venice/ui/jsp/FrameDisplayLoginTag.java new file mode 100644 index 0000000..e4c7481 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameDisplayLoginTag.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class FrameDisplayLoginTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return (getRequestInput().getDisplayLogin() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class FrameDisplayLoginTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameHeadTag.java b/src/com/silverwrist/venice/ui/jsp/FrameHeadTag.java new file mode 100644 index 0000000..22b4d07 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameHeadTag.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameHeadTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + getRequestOutput().writeFrameHead(out,getContent()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <HEAD> tag info - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameHeadTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameIfQIDTag.java b/src/com/silverwrist/venice/ui/jsp/FrameIfQIDTag.java new file mode 100644 index 0000000..1d55938 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameIfQIDTag.java @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameIfQIDTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return ((getContent().getPageQID()!=null) ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class FrameIfQIDTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameLeftMenuTag.java b/src/com/silverwrist/venice/ui/jsp/FrameLeftMenuTag.java new file mode 100644 index 0000000..4d0dc6e --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameLeftMenuTag.java @@ -0,0 +1,82 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.menus.MenuComponent; + +public class FrameLeftMenuTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException("<frame:leftmenu/> tag without name= attribute!"); + MenuComponent mc = getRequestInput().getMenu(name); + if (mc==null) + throw new JspTagException("<frame:leftmenu/> menu name= not defined!"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + mc.renderOnLeft(getRequestOutput(),out); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing left menu - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String s) + { + name = s; + + } // end setName + +} // end class FrameLeftMenuTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameQIDTag.java b/src/com/silverwrist/venice/ui/jsp/FrameQIDTag.java new file mode 100644 index 0000000..8377b3f --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameQIDTag.java @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameQIDTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + String qid = getContent().getPageQID(); + if (qid!=null) + { // we can write out the QID + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(qid); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing QID info - " + e.getMessage()); + + } // end catch + + } // end if + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameQIDTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameSiteLogoTag.java b/src/com/silverwrist/venice/ui/jsp/FrameSiteLogoTag.java new file mode 100644 index 0000000..b4ca1e8 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameSiteLogoTag.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameSiteLogoTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + getRequestOutput().writeSiteImageTag(out); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing site logo info - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameSiteLogoTag diff --git a/src/com/silverwrist/venice/ui/jsp/FrameVeniceLogoTag.java b/src/com/silverwrist/venice/ui/jsp/FrameVeniceLogoTag.java new file mode 100644 index 0000000..1c0475f --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/FrameVeniceLogoTag.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class FrameVeniceLogoTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + getRequestOutput().writeVeniceLogo(out); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing Venice logo - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class FrameVeniceLogoTag diff --git a/src/com/silverwrist/venice/ui/jsp/UserIsLoggedInTag.java b/src/com/silverwrist/venice/ui/jsp/UserIsLoggedInTag.java new file mode 100644 index 0000000..2796148 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UserIsLoggedInTag.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class UserIsLoggedInTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return (getRequestInput().getUser().isLoggedIn() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class UserIsLoggedInTag diff --git a/src/com/silverwrist/venice/ui/jsp/UserIsNotLoggedInTag.java b/src/com/silverwrist/venice/ui/jsp/UserIsNotLoggedInTag.java new file mode 100644 index 0000000..6bdb3d5 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UserIsNotLoggedInTag.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class UserIsNotLoggedInTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return (getRequestInput().getUser().isLoggedIn() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class UserIsNotLoggedInTag diff --git a/src/com/silverwrist/venice/ui/jsp/UserIsNotVerifiedTag.java b/src/com/silverwrist/venice/ui/jsp/UserIsNotVerifiedTag.java new file mode 100644 index 0000000..212d3a1 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UserIsNotVerifiedTag.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class UserIsNotVerifiedTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return (getRequestInput().getUser().isEmailVerified() ? SKIP_BODY : EVAL_BODY_INCLUDE); + + } // end doStartTag + +} // end class UserIsNotVerifiedTag diff --git a/src/com/silverwrist/venice/ui/jsp/UserIsVerifiedTag.java b/src/com/silverwrist/venice/ui/jsp/UserIsVerifiedTag.java new file mode 100644 index 0000000..8f2dc40 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UserIsVerifiedTag.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class UserIsVerifiedTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return (getRequestInput().getUser().isEmailVerified() ? EVAL_BODY_INCLUDE : SKIP_BODY); + + } // end doStartTag + +} // end class UserIsVerifiedTag diff --git a/src/com/silverwrist/venice/ui/jsp/UserNameTag.java b/src/com/silverwrist/venice/ui/jsp/UserNameTag.java new file mode 100644 index 0000000..8c8c77d --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UserNameTag.java @@ -0,0 +1,51 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; + +public class UserNameTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(getRequestInput().getUser().getUserName()); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing user name - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class UserNameTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilAltTag.java b/src/com/silverwrist/venice/ui/jsp/UtilAltTag.java new file mode 100644 index 0000000..c5f5d38 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilAltTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilAltTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + UtilImageTag image = (UtilImageTag)findAncestorWithClass(this,UtilImageTag.class); + if (image==null) + throw new JspTagException("<util:alt/> tag not nested inside a <util:image/> tag!"); + + image.setOtherAlt(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end doAfterBody + +} // end class UtilTextTag diff --git a/src/com/silverwrist/venice/servlets/format/CDRoleListFormField.java b/src/com/silverwrist/venice/ui/jsp/UtilButtonTag.java similarity index 51% rename from src/com/silverwrist/venice/servlets/format/CDRoleListFormField.java rename to src/com/silverwrist/venice/ui/jsp/UtilButtonTag.java index bb18404..e7b2164 100644 --- a/src/com/silverwrist/venice/servlets/format/CDRoleListFormField.java +++ b/src/com/silverwrist/venice/ui/jsp/UtilButtonTag.java @@ -15,74 +15,80 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.jsp; -import java.util.List; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.security.Role; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; -public class CDRoleListFormField extends CDPickListFormField +public class UtilButtonTag extends VeniceTagSupport { /*-------------------------------------------------------------------------------- - * Constructors + * Attributes *-------------------------------------------------------------------------------- */ - public CDRoleListFormField(String name, String caption, String caption2, boolean required, - List role_list) - { - super(name,caption,caption2,required,role_list); - - } // end constructor - - protected CDRoleListFormField(CDRoleListFormField other) - { - super(other); - - } // end constructor + private String type = "img"; + private String id = null; /*-------------------------------------------------------------------------------- - * Overrides from class CDPickListFormField + * Overrides from class TagSupport *-------------------------------------------------------------------------------- */ - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException + public int doStartTag() throws JspException { - Role r = (Role)obj; - out.write("<OPTION VALUE=\"" + String.valueOf(r.getLevel()) + "\""); - if ((my_value!=null) && my_value.equals(String.valueOf(r.getLevel()))) - out.write(" SELECTED"); - out.write(">" + StringUtil.encodeHTML(r.getName()) + "</OPTION>\n"); + if (id==null) + throw new JspTagException("<util:button/> ID not specified!"); + if (!(type.equals("img") || type.equals("input"))) + throw new JspTagException("<util:button/> type not valid!"); - } // end renderChoice + String data; + if (type.equals("img")) + data = getRequestOutput().getButtonVisual(id); + else + data = getRequestOutput().getButtonInput(id); - /*-------------------------------------------------------------------------------- - * Implementations from class CDFormField - *-------------------------------------------------------------------------------- - */ - - public Object getObjValue() - { try - { // return value as Integer, for now - return new Integer(super.getValue()); + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(data); } // end try - catch (NumberFormatException nfe) - { - return null; + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing button - " + e.getMessage()); } // end catch - } // end getObjValue + return SKIP_BODY; - public CDFormField duplicate() + } // end doStartTag + + public void release() { - return new CDRoleListFormField(this); + super.release(); + type = "img"; + id = null; - } // end clone + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ -} // end class CDRoleListFormField + public void setType(String s) + { + type = s.trim().toLowerCase(); + } // end setType + + public void setId(String s) + { + id = s; + + } // end setId + +} // end class UtilButtonTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilColorTag.java b/src/com/silverwrist/venice/ui/jsp/UtilColorTag.java new file mode 100644 index 0000000..6ce4187 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilColorTag.java @@ -0,0 +1,78 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilColorTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String name = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (name==null) + throw new JspTagException("<color/> tag specified without a color name"); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(getRequestInput().getColor(name)); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing comment start - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + + public void release() + { + super.release(); + name = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setName(String s) + { + name = s; + + } // end setName + +} // end class UtilColorTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilCommentTag.java b/src/com/silverwrist/venice/ui/jsp/UtilCommentTag.java new file mode 100644 index 0000000..830d8c9 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilCommentTag.java @@ -0,0 +1,83 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilCommentTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private boolean enable; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + enable = getRequestInput().useHTMLComments(); + if (!enable) + return SKIP_BODY; + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<!-- "); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing comment start - " + e.getMessage()); + + } // end catch + + return EVAL_BODY_INCLUDE; + + } // end doStartTag + + public int doEndTag() throws JspException + { + if (enable) + { // write the end of the comment + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(" -->"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <TITLE> tag - " + e.getMessage()); + + } // end catch + + } // end if + + return EVAL_PAGE; + + } // end doEndTag + +} // end class UtilCommentTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilEscapeTag.java b/src/com/silverwrist/venice/ui/jsp/UtilEscapeTag.java new file mode 100644 index 0000000..c4b24ba --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilEscapeTag.java @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilEscapeTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + BodyContent body = getBodyContent(); + try + { // write the escaped information + JspWriter out = body.getEnclosingWriter(); + out.write(StringUtil.encodeHTML(body.getString())); + + } // end try + catch (IOException e) + { // translate output exception + throw new JspTagException("IO error writing escaped tag info: " + e.getMessage()); + + } // end catch + + return SKIP_BODY; // done with this body information + + } // end doAfterBody + +} // end class UtilEscapeTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilExpandServletTag.java b/src/com/silverwrist/venice/ui/jsp/UtilExpandServletTag.java new file mode 100644 index 0000000..2d007f9 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilExpandServletTag.java @@ -0,0 +1,51 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilExpandServletTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + BodyContent body = getBodyContent(); + try + { // write the escaped information + JspWriter out = body.getEnclosingWriter(); + out.write(getRequestInput().expandServletPath(body.getString())); + + } // end try + catch (IOException e) + { // translate output exception + throw new JspTagException("IO error writing tag info: " + e.getMessage()); + + } // end catch + + return SKIP_BODY; // done with this body information + + } // end doAfterBody + +} // end class UtilExpandServletTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilFontTag.java b/src/com/silverwrist/venice/ui/jsp/UtilFontTag.java new file mode 100644 index 0000000..017ba1e --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilFontTag.java @@ -0,0 +1,101 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilFontTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String color = null; + private String size_str = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(getRequestInput().getFontTag(color,size_str)); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <FONT> tag - " + e.getMessage()); + + } // end catch + + return EVAL_BODY_INCLUDE; + + } // end doStartTag + + public int doEndTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("</FONT>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing </FONT> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + color = null; + size_str = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setColor(String s) + { + color = s; + + } // end setColor + + public void setSize(String s) + { + size_str = s; + + } // end setSize + +} // end class UtilfontTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilFormTag.java b/src/com/silverwrist/venice/ui/jsp/UtilFormTag.java new file mode 100644 index 0000000..0dddb2f --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilFormTag.java @@ -0,0 +1,156 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.net.URLEncoder; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilFormTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String LOCATION_PARAM = "${location}"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String verb = null; + private String action = null; + private String type = null; + private String cls = null; + private String isfile = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + // Check the parameters! + if (verb==null) + verb = "POST"; + if (action==null) + throw new JspTagException("<util:form/> action not specified!"); + if (type==null) + throw new JspTagException("<util:form/> type not specified!"); + RequestInput ri = getRequestInput(); + int ityp = ri.convertLinkType(type); + if (ityp==-1) + throw new JspTagException("<util:form/> invalid action type!"); + + // Do parameter replacement on the ACTION string if necessary. + if (action.indexOf(LOCATION_PARAM)>=0) + action = StringUtil.replaceAllInstances(action,LOCATION_PARAM,URLEncoder.encode(ri.getLocation())); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<FORM METHOD=\"" + verb + "\" "); + if (cls!=null) + out.write("CLASS=\"" + cls + "\" "); + if ((isfile!=null) && isfile.equals("true")) + out.write("ENCTYPE=\"multipart/form-data\" "); + out.write("ACTION=\"" + ri.formatURL(action,ityp) + "\">"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <FORM> tag - " + e.getMessage()); + + } // end catch + + return EVAL_BODY_INCLUDE; + + } // end doStartTag + + public int doEndTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("</FORM>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing </FORM> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + verb = null; + action = null; + type = null; + cls = null; + isfile = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setVerb(String s) + { + verb = s; + + } // end setVerb + + public void setAction(String s) + { + action = s; + + } // end setAction + + public void setType(String s) + { + type = s; + + } // setType + + public void setAclass(String s) + { + cls = s; + + } // end setAclass + + public void setIsfile(String s) + { + isfile = s; + + } // end setIsfile + +} // end class UtilFormTag + diff --git a/src/com/silverwrist/venice/ui/jsp/UtilHeaderTag.java b/src/com/silverwrist/venice/ui/jsp/UtilHeaderTag.java new file mode 100644 index 0000000..602b5da --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilHeaderTag.java @@ -0,0 +1,131 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.net.URLEncoder; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilHeaderTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String title = null; + private String stocktitle = null; + private String subtitle = null; + private String stocksubtitle = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return EVAL_BODY_TAG; + + } // end UtilHeaderTag + + public int doAfterBody() + { + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspException + { + RequestOutput ro = getRequestOutput(); + + // find the real title string + String real_title = null; + if (title!=null) + real_title = title; + else if (stocktitle!=null) + real_title = ro.getStockMessage(stocktitle); + if (real_title==null) + throw new JspTagException("<util:header/> contains no title= or stocktitle= attributes!"); + + // find the real subtitle string + String real_subtitle = null; + if (subtitle!=null) + real_subtitle = subtitle; + else if (stocksubtitle!=null) + real_subtitle = ro.getStockMessage(stocksubtitle); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + ro.writeContentHeader(out,real_title,real_subtitle); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing content header - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + title = null; + stocktitle = null; + subtitle = null; + stocksubtitle = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setTitle(String s) + { + title = s; + + } // end setTitle + + public void setStocktitle(String s) + { + stocktitle = s; + + } // end setStocktitle + + public void setSubtitle(String s) + { + subtitle = s; + + } // end setSubtitle + + public void setStocksubtitle(String s) + { + stocksubtitle = s; + + } // end setStocksubtitle + +} // end class UtilHeaderTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilHrefTag.java b/src/com/silverwrist/venice/ui/jsp/UtilHrefTag.java new file mode 100644 index 0000000..d5642ed --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilHrefTag.java @@ -0,0 +1,92 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilHrefTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String type = null; + private int real_type = -1; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (type==null) + throw new JspTagException("<util:href/> type= attribute not specified"); + real_type = getRequestInput().convertLinkType(type); + if (real_type<0) + throw new JspTagException("<util:href/> type= attribute not a valid link type"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() throws JspException + { + UtilMenuHeaderItemTag menu_hdr = + (UtilMenuHeaderItemTag)findAncestorWithClass(this,UtilMenuHeaderItemTag.class); + if (menu_hdr!=null) + { // set the link data + menu_hdr.setLink(getBodyContent().getString().trim(),real_type); + return SKIP_BODY; + + } // end if + + UtilXLinkTag xlink = (UtilXLinkTag)findAncestorWithClass(this,UtilXLinkTag.class); + if (xlink!=null) + { // set the link data + xlink.setLink(getBodyContent().getString().trim(),real_type); + return SKIP_BODY; + + } // end if + + throw new JspTagException("<util:href/> tag not nested inside a compatible tag!"); + + } // end doAfterBody + + public void release() + { + super.release(); + type = null; + real_type = -1; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setType(String s) + { + this.type = s; + + } // end setType + +} // end class UtilHrefTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilImageTag.java b/src/com/silverwrist/venice/ui/jsp/UtilImageTag.java new file mode 100644 index 0000000..4161019 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilImageTag.java @@ -0,0 +1,184 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilImageTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String src = null; + private String fixup = null; + private String alt = ""; + private String width = null; + private String height = null; + private String border = "0"; + private String other_alt = null; + + /*-------------------------------------------------------------------------------- + * Internal functions + *-------------------------------------------------------------------------------- + */ + + private static int convertParam(String param, String name) throws JspTagException + { + if (param==null) + throw new JspTagException("<util:image/> " + name + "= attribute not specified"); + + try + { // convert the parameter to an integer + int rc = Integer.parseInt(param); + if (rc<0) + throw new JspTagException("<util:image/> " + name + "= attribute out of range"); + return rc; + + } // end try + catch (NumberFormatException nfe) + { // there's a problem + throw new JspTagException("<util:image/> " + name + "= attribute not a proper integer"); + + } // end catch + + } // end convertParam + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (src==null) + throw new JspTagException("<util:image/> src= attribute not specified"); + + return EVAL_BODY_TAG;; + + } // end doStartTag + + public int doAfterBody() + { + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspException + { + int real_width = convertParam(width,"width"); + int real_height = convertParam(height,"height"); + int real_border = convertParam(border,"border"); + + String real_src; + if (fixup!=null) + real_src = getRequestOutput().getImagePath(src); + else + real_src = src; + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<IMG SRC=\"" + real_src + "\" ALT=\""); + if (other_alt==null) + out.write(alt); + else + out.write(other_alt); + out.write("\" WIDTH=" + real_width + " HEIGHT=" + real_height + " BORDER=" + real_border + ">"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <IMG> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + src = null; + fixup = null; + alt = ""; + width = null; + height = null; + border = "0"; + other_alt = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setSrc(String s) + { + src = s; + + } // end setSrc + + public void setFixup(String s) + { + fixup = s; + + } // end setFixup + + public void setAlt(String s) + { + alt = s; + + } // end setAlt + + public void setWidth(String s) + { + width = s; + + } // end setWidth + + public void setHeight(String s) + { + height = s; + + } // end setHeight + + public void setBorder(String s) + { + border = s; + + } // end setBorder + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + final void setOtherAlt(String s) + { + other_alt = s; + + } // end setOtherAlt + +} // end class UtilImageTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java b/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java new file mode 100644 index 0000000..da9b186 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java @@ -0,0 +1,156 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.net.URLEncoder; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilLinkTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String LOCATION_PARAM = "${location}"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String href = null; + private String type = null; + private String cls = null; + private String target = null; + private String title = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + // Check the parameters! + if (href==null) + throw new JspTagException("<util:link/> href not specified!"); + if (type==null) + throw new JspTagException("<util:link/> type not specified!"); + RequestInput ri = getRequestInput(); + int ityp = ri.convertLinkType(type); + if (ityp==-1) + throw new JspTagException("<util:link/> invalid link type!"); + + // Do parameter replacement on the HREF string if necessary. + if (href.indexOf(LOCATION_PARAM)>=0) + href = StringUtil.replaceAllInstances(href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation())); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<A "); + if (cls!=null) + out.write("CLASS=\"" + cls + "\" "); + out.write("HREF=\"" + ri.formatURL(href,ityp) + "\""); + if (title!=null) + out.write(" TITLE=\"" + title + "\""); + if (target!=null) + out.write(" TARGET=\"" + target + "\""); + out.write(">"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <A> tag - " + e.getMessage()); + + } // end catch + + return EVAL_BODY_INCLUDE; + + } // end doStartTag + + public int doEndTag() throws JspException + { + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("</A>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing </A> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + href = null; + type = null; + cls = null; + target = null; + title = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setHref(String s) + { + href = s; + + } // end setHref + + public void setType(String s) + { + type = s; + + } // end setType + + public void setAclass(String s) + { + cls = s; + + } // end setAclass + + public void setTarget(String s) + { + target = s; + + } // end setTarget + + public void setTitle(String s) + { + title = s; + + } // end setTitle + +} // end class UtilLinkTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilLinkTitleTag.java b/src/com/silverwrist/venice/ui/jsp/UtilLinkTitleTag.java new file mode 100644 index 0000000..accc6b4 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilLinkTitleTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilLinkTitleTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + UtilXLinkTag parent = (UtilXLinkTag)findAncestorWithClass(this,UtilXLinkTag.class); + if (parent==null) + throw new JspTagException("<util:linktitle/> tag must be inside a <util:xlink/> tag!"); + parent.setTitle(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end doAfterBody + +} // end class UtilLinkTitleTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderItemTag.java b/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderItemTag.java new file mode 100644 index 0000000..ce40121 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderItemTag.java @@ -0,0 +1,119 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilMenuHeaderItemTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String href = null; + private String selected = null; + private int real_type = -1; + private boolean is_selected = false; + private String text = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + if ((selected!=null) && selected.equals("true")) + is_selected = true; + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() + { + // throw away the actual body contents + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspTagException + { + // Do some shorts-checking on our stored data. + if (href==null) + throw new JspTagException("<util:menuheaderitem/> does not have a <util:href/>!"); + if (real_type<0) + throw new JspTagException("<util:menuheaderitem/> type= attribute not a valid link type"); + if (text==null) + throw new JspTagException("<util:menuheaderitem/> does not have a <util:text/>!"); + + // Save off the completed menu item. + UtilMenuHeaderTag parent = (UtilMenuHeaderTag)findAncestorWithClass(this,UtilMenuHeaderTag.class); + if (parent==null) + throw new JspTagException("<util:menuheaderitem/> must be inside a <util:menuheader/>"); + parent.pushItem(href,real_type,text,is_selected); + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + href = null; + selected = null; + real_type = -1; + is_selected = false; + text = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setSelected(String s) + { + selected = s; + + } // end setSelected + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + final void setLink(String href, int type) + { + this.href = href; + this.real_type = type; + + } // end setLink + + final void setText(String text) + { + this.text = text; + + } // end setText + +} // end class UtilMenuHeaderItemTag + diff --git a/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderTag.java b/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderTag.java new file mode 100644 index 0000000..91de520 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilMenuHeaderTag.java @@ -0,0 +1,179 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.util.*; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilMenuHeaderTag extends VeniceBodyTagSupport implements ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Internal class for holding the menu links + *-------------------------------------------------------------------------------- + */ + + class MenuItem + { + private String href; + private int type; + private String text; + + MenuItem(String href, int type, String text) + { + this.href = href; + this.type = type; + this.text = text; + + } // end constructor + + final void write(JspWriter out, RequestOutput ro, boolean selected) throws IOException + { + if (selected) + out.write("<B>"); + else + out.write("<A HREF=\"" + ro.formatURL(href,type) + "\">"); + out.write(text); + if (selected) + out.write("</B>"); + else + out.write("</A>"); + + } // end write + + } // end class MenuItem + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String caption = null; + private ArrayList items = new ArrayList(); + private MenuItem selected_item = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + if (caption==null) + throw new JspTagException("<util:menuheader/> caption= attribute not specified"); + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() + { + // just throw out the body content that's been collected + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspException + { + if (items.isEmpty()) + throw new JspTagException("<util:menuheader/> has no menu header items!"); + + RequestOutput ro = getRequestOutput(); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<SPAN CLASS=\"chead1\">" + ro.getFontTag(CONTENT_HEADER,"header") + "<B>" + + StringUtil.encodeHTML(caption) + "</B></FONT></SPAN>  <SPAN CLASS=\"chead2\">" + + ro.getFontTag(CONTENT_HEADER,"subhead")); + boolean first = true; + Iterator it = items.iterator(); + while (it.hasNext()) + { // extract and write each menu item + MenuItem mi = (MenuItem)(it.next()); + if (first) + { // write the first item out differently + out.write("["); + first = false; + + } // end if + else // write the separator + out.write("|"); + out.write(" "); + mi.write(out,ro,(mi==selected_item)); + out.write(" "); + + } // end while + + // write the closure and finish up + out.write("]</FONT></SPAN><HR ALIGN=LEFT SIZE=2 WIDTH=\"90%\" NOSHADE>\n"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing content header - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + caption = null; + items.clear(); + selected_item = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setCaption(String s) + { + caption = s; + + } // end setCaption + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + final void pushItem(String href, int type, String text, boolean selected) throws JspTagException + { + MenuItem mi = new MenuItem(href,type,text); + items.add(mi); + if (selected) + { // this item is selected - push it on the list + if (selected_item==null) + selected_item = mi; + else + throw new JspTagException("<util:menuheader/> has two selected items"); + + } // end if + + } // end pushItem + +} // end class UtilMenuHeaderTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java b/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java new file mode 100644 index 0000000..7a81777 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java @@ -0,0 +1,53 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilStdBulletTag extends VeniceTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class TagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() throws JspException + { + RequestOutput ro = getRequestOutput(); + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + // TODO: make this configurable + out.write("<IMG SRC=\"" + ro.getImagePath("purple-ball.gif") + + "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing button - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + +} // end class UtilStdBulletTag diff --git a/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java b/src/com/silverwrist/venice/ui/jsp/UtilStockMessageTag.java similarity index 55% rename from src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java rename to src/com/silverwrist/venice/ui/jsp/UtilStockMessageTag.java index f681946..093190f 100644 --- a/src/com/silverwrist/venice/servlets/format/CDLanguageListFormField.java +++ b/src/com/silverwrist/venice/ui/jsp/UtilStockMessageTag.java @@ -15,56 +15,68 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.jsp; -import java.util.List; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.*; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; -public class CDLanguageListFormField extends CDPickListFormField +public class UtilStockMessageTag extends VeniceTagSupport { /*-------------------------------------------------------------------------------- - * Constructors + * Attributes *-------------------------------------------------------------------------------- */ - public CDLanguageListFormField(String name, String caption, String caption2, boolean required) - { - super(name,caption,caption2,required,International.get().getLanguageList()); - - } // end constructor - - protected CDLanguageListFormField(CDLanguageListFormField other) - { - super(other); - - } // end constructor + private String key = null; /*-------------------------------------------------------------------------------- - * Overrides from class CDPickListFormField + * Overrides from class TagSupport *-------------------------------------------------------------------------------- */ - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException + public int doStartTag() throws JspException { - Language l = (Language)obj; - out.write("<OPTION VALUE=\"" + l.getCode() + "\""); - if (l.getCode().equals(my_value)) - out.write(" SELECTED"); - out.write(">" + StringUtil.encodeHTML(l.getName()) + "</OPTION>\n"); + if (key==null) + throw new JspTagException("<util:stock-message/> key not specified!"); + String msg = getRequestInput().getStockMessage(key); + if (msg==null) + return SKIP_BODY; - } // end renderChoice + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write(msg); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing stock message - " + e.getMessage()); + + } // end catch + + return SKIP_BODY; + + } // end doStartTag + + public void release() + { + super.release(); + key = null; + + } // end release /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField + * Attribute set functions *-------------------------------------------------------------------------------- */ - public CDFormField duplicate() + public void setKey(String s) { - return new CDLanguageListFormField(this); + key = s; - } // end clone + } // end setKey + +} // end class UtilStockMessageTag -} // end class CDLanguageListFormField diff --git a/src/com/silverwrist/venice/ui/jsp/UtilSubtitleTag.java b/src/com/silverwrist/venice/ui/jsp/UtilSubtitleTag.java new file mode 100644 index 0000000..e90b3ae --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilSubtitleTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilSubtitleTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + UtilHeaderTag parent = (UtilHeaderTag)findAncestorWithClass(this,UtilHeaderTag.class); + if (parent==null) + throw new JspTagException("<util:subtitle/> tag must be inside a <util:header/> tag!"); + parent.setSubtitle(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end doAfterBody + +} // end class UtilSubtitleTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilTextTag.java b/src/com/silverwrist/venice/ui/jsp/UtilTextTag.java new file mode 100644 index 0000000..53cc69f --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilTextTag.java @@ -0,0 +1,60 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilTextTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + Tag tag = this.getParent(); + while (tag!=null) + { // see if the closest ancestor is any tag we recognize + if (tag instanceof UtilMenuHeaderItemTag) + { // found a UtilMenuHeaderItemTag + UtilMenuHeaderItemTag menu_hdr = (UtilMenuHeaderItemTag)tag; + menu_hdr.setText(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end if + + if (tag instanceof UtilXLinkTag) + { // found a UtilXLinkTag + UtilXLinkTag xlink = (UtilXLinkTag)tag; + xlink.setText(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end if + + tag = tag.getParent(); // move to next ancestor and try again + + } // end while + + throw new JspTagException("<util:text/> tag not nested inside a compatible tag!"); + + } // end doAfterBody + +} // end class UtilTextTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilTitleTag.java b/src/com/silverwrist/venice/ui/jsp/UtilTitleTag.java new file mode 100644 index 0000000..af64be9 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilTitleTag.java @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilTitleTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + UtilHeaderTag parent = (UtilHeaderTag)findAncestorWithClass(this,UtilHeaderTag.class); + if (parent==null) + throw new JspTagException("<util:title/> tag must be inside a <util:header/> tag!"); + parent.setTitle(getBodyContent().getString().trim()); + return SKIP_BODY; + + } // end doAfterBody + +} // end class UtilTitleTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilURLEncodeTag.java b/src/com/silverwrist/venice/ui/jsp/UtilURLEncodeTag.java new file mode 100644 index 0000000..6ff1cb3 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilURLEncodeTag.java @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.net.URLEncoder; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; + +public class UtilURLEncodeTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doAfterBody() throws JspException + { + BodyContent body = getBodyContent(); + try + { // write the escaped information + JspWriter out = body.getEnclosingWriter(); + out.write(URLEncoder.encode(body.getString())); + + } // end try + catch (IOException e) + { // translate output exception + throw new JspTagException("IO error writing encoded tag info: " + e.getMessage()); + + } // end catch + + return SKIP_BODY; // done with this body information + + } // end doAfterBody + +} // end class UtilURLEncodeTag diff --git a/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java b/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java new file mode 100644 index 0000000..a1fd948 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java @@ -0,0 +1,157 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import java.io.IOException; +import java.net.URLEncoder; +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class UtilXLinkTag extends VeniceBodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String LOCATION_PARAM = "${location}"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String href = null; + private int type = -1; + private String cls = null; + private String target = null; + private String text = null; + private String title = null; + + /*-------------------------------------------------------------------------------- + * Overrides from class BodyTagSupport + *-------------------------------------------------------------------------------- + */ + + public int doStartTag() + { + return EVAL_BODY_TAG; + + } // end doStartTag + + public int doAfterBody() + { + return SKIP_BODY; + + } // end doAfterBody + + public int doEndTag() throws JspException + { + // Do some shorts-checking on our stored data. + if (href==null) + throw new JspTagException("<util:xlink/> does not have a <util:href/>!"); + if (type<0) + throw new JspTagException("<util:xlink/> does not have a <util:href/>!"); + if (text==null) + throw new JspTagException("<util:xlink/> does not have a <util:text/>!"); + + // Do parameter replacement on the HREF string if necessary. + RequestInput ri = getRequestInput(); + if (href.indexOf(LOCATION_PARAM)>=0) + href = StringUtil.replaceAllInstances(href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation())); + + try + { // write out what we came here to accomplish + JspWriter out = pageContext.getOut(); + out.write("<A "); + if (cls!=null) + out.write("CLASS=\"" + cls + "\" "); + out.write("HREF=\"" + ri.formatURL(href,type) + "\""); + if (title!=null) + out.write(" TITLE=\"" + title + "\""); + if (target!=null) + out.write(" TARGET=\"" + target + "\""); + out.write(">" + text + "</A>"); + + } // end try + catch (IOException e) + { // convert the I/O error into something the servlet engine can deal with + throw new JspTagException("error writing <A> tag - " + e.getMessage()); + + } // end catch + + return EVAL_PAGE; + + } // end doEndTag + + public void release() + { + super.release(); + href = null; + type = -1; + cls = null; + target = null; + text = null; + title = null; + + } // end release + + /*-------------------------------------------------------------------------------- + * Attribute set functions + *-------------------------------------------------------------------------------- + */ + + public void setAclass(String s) + { + cls = s; + + } // end setAclass + + public void setTarget(String s) + { + target = s; + + } // end setTarget + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + final void setLink(String href, int type) + { + this.href = href; + this.type = type; + + } // end setLink + + final void setText(String text) + { + this.text = text; + + } // end setText + + final void setTitle(String title) + { + this.title = title; + + } // end setTitle + +} // end class UtilXLinkTag diff --git a/src/com/silverwrist/venice/ui/jsp/VeniceBodyTagSupport.java b/src/com/silverwrist/venice/ui/jsp/VeniceBodyTagSupport.java new file mode 100644 index 0000000..e477c73 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/VeniceBodyTagSupport.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class VeniceBodyTagSupport extends BodyTagSupport +{ + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + protected final ContentJSP getContent() + { + return (ContentJSP)(pageContext.getAttribute(RequestImpl.REQUEST_CONTENT,PageContext.REQUEST_SCOPE)); + + } // end getContent + + protected final RequestInput getRequestInput() + { + return (RequestInput)(pageContext.getAttribute(RequestImpl.REQUEST_INPUT,PageContext.REQUEST_SCOPE)); + + } // end getRequestInput + + protected final RequestOutput getRequestOutput() + { + return (RequestOutput)(pageContext.getAttribute(RequestImpl.REQUEST_OUTPUT,PageContext.REQUEST_SCOPE)); + + } // end getRequestOutput + +} // end class VeniceBodyTagSupport diff --git a/src/com/silverwrist/venice/ui/jsp/VeniceTagSupport.java b/src/com/silverwrist/venice/ui/jsp/VeniceTagSupport.java new file mode 100644 index 0000000..923da57 --- /dev/null +++ b/src/com/silverwrist/venice/ui/jsp/VeniceTagSupport.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.jsp; + +import javax.servlet.jsp.*; +import javax.servlet.jsp.tagext.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class VeniceTagSupport extends TagSupport +{ + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + protected final Content getContent() + { + return (Content)(pageContext.getAttribute(RequestImpl.REQUEST_CONTENT,PageContext.REQUEST_SCOPE)); + + } // end getContent + + protected final RequestInput getRequestInput() + { + return (RequestInput)(pageContext.getAttribute(RequestImpl.REQUEST_INPUT,PageContext.REQUEST_SCOPE)); + + } // end getRequestInput + + protected final RequestOutput getRequestOutput() + { + return (RequestOutput)(pageContext.getAttribute(RequestImpl.REQUEST_OUTPUT,PageContext.REQUEST_SCOPE)); + + } // end getRequestOutput + +} // end class VeniceTagSupport diff --git a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenu.java b/src/com/silverwrist/venice/ui/menus/CommunityMenu.java similarity index 58% rename from src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenu.java rename to src/com/silverwrist/venice/ui/menus/CommunityMenu.java index d05a934..d8b14b8 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenu.java +++ b/src/com/silverwrist/venice/ui/menus/CommunityMenu.java @@ -15,7 +15,7 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; import java.io.Writer; import java.io.IOException; @@ -23,9 +23,9 @@ import java.util.*; import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; -public class CommunityLeftMenu implements ComponentRender, ColorSelectors +public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes { /*-------------------------------------------------------------------------------- * Attributes @@ -33,7 +33,6 @@ public class CommunityLeftMenu implements ComponentRender, ColorSelectors */ private String image_url; // path to actual image - private boolean image_url_needs_fixup = false; // do we need to fix image path up? private String title; // title for menu private List items_list; // list of menu items private int cid; // community ID @@ -44,18 +43,12 @@ public class CommunityLeftMenu implements ComponentRender, ColorSelectors *-------------------------------------------------------------------------------- */ - CommunityLeftMenu(CommunityContext ctxt, List items) + CommunityMenu(CommunityContext ctxt, List items) { try { // retrieve the contact info for this puppy ContactInfo ci = ctxt.getContactInfo(); image_url = ci.getPhotoURL(); - if (StringUtil.isStringEmpty(image_url)) - { // just hit the default - image_url = "sig_other.jpg"; - image_url_needs_fixup = true; - - } // end if } // end try catch (DataException e) @@ -72,56 +65,82 @@ public class CommunityLeftMenu implements ComponentRender, ColorSelectors } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out, Writer wr) throws IOException { - String hilite = "<FONT COLOR=\"" + rdat.getStdColor(LEFT_LINK) + "\">"; - if (image_url!=null) - { // display the image by URL - if (image_url_needs_fixup) - { // fix up the URL... - image_url = rdat.getFullImagePath(image_url); - image_url_needs_fixup = false; + if (wr==null) + wr = out.getWriter(); - } // end if - - out.write("<DIV ALIGN=\"LEFT\"><IMG SRC=\"" + image_url + "\" WIDTH=110 HEIGHT=65 BORDER=0></DIV>\n"); - - } // end if + wr.write("<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=BOTTOM>\n<TD ALIGN=LEFT WIDTH=110>" + + out.getCommunityLogoTag(image_url) + "</TD>\n<TD ALIGN=LEFT>\n"); // display the title - out.write("<B>" + StringUtil.encodeHTML(title) + "</B><BR>"); + out.writeContentHeader(wr,title,null); + wr.write("</TD>\n</TR></TABLE><BR>\n"); // display the menu items Iterator it = items_list.iterator(); while (it.hasNext()) { // display each menu item in turn - ComponentRender cr = (ComponentRender)(it.next()); - cr.renderHere(out,rdat); + MenuComponent mc = (MenuComponent)(it.next()); + mc.render(out,wr); + + } // end while + + if (show_unjoin) // display the "Unjoin" link + wr.write("<P><IMG SRC=\"" + out.getImagePath("purple-ball.gif") + + "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0><A HREF=\"" + + out.formatURL("comm/unjoin.js.vs?cc=" + cid,SERVLET) + "\">Unjoin</A><BR>\n"); + + wr.write("\n"); // all done... + + } // end render + + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException + { + if (wr==null) + wr = out.getWriter(); + String hilite = out.getFontTag(LEFT_LINK,null); + + // display the image URL and title + wr.write("<DIV ALIGN=\"LEFT\">" + out.getCommunityLogoTag(image_url) + "</DIV>\n<B>" + + StringUtil.encodeHTML(title) + "</B><BR>\n"); + + // display the menu items + Iterator it = items_list.iterator(); + while (it.hasNext()) + { // display each menu item in turn + MenuComponent mc = (MenuComponent)(it.next()); + mc.renderOnLeft(out,wr); } // end while if (show_unjoin) - out.write("<BR>\n<A CLASS=\"lbar\" HREF=\"" - + rdat.getEncodedServletPath("sigops?cmd=U&sig=" + cid) + "\">" + hilite - + "Unjoin</FONT></A>\n"); + wr.write("<BR>\n<A CLASS=\"lbar\" HREF=\"" + out.formatURL("comm/unjoin.js.vs?cc=" + cid,SERVLET) + + "\">" + hilite + "Unjoin</FONT></A>\n"); - out.write("\n"); // all done... + wr.write("\n"); // all done... + + } // end renderOnLeft + + public String getTitle(RequestOutput out) + { + return title; + + } // end getTitle - } // end renderHere - /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - public int getID() + public final int getID() { return cid; } // end getID -} // end class CommunityLeftMenu +} // end class CommunityMenu diff --git a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuEntry.java b/src/com/silverwrist/venice/ui/menus/CommunityMenuEntry.java similarity index 80% rename from src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuEntry.java rename to src/com/silverwrist/venice/ui/menus/CommunityMenuEntry.java index 751b7f9..d62a83c 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuEntry.java +++ b/src/com/silverwrist/venice/ui/menus/CommunityMenuEntry.java @@ -15,15 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; import java.util.Map; import org.w3c.dom.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.RootConfig; import com.silverwrist.venice.util.XMLLoader; -class CommunityLeftMenuEntry implements Comparable +class CommunityMenuEntry implements Comparable { /*-------------------------------------------------------------------------------- * Attributes @@ -40,7 +41,7 @@ class CommunityLeftMenuEntry implements Comparable *-------------------------------------------------------------------------------- */ - CommunityLeftMenuEntry(Element svc) throws ConfigException + CommunityMenuEntry(Element svc, RootConfig conf) throws ConfigException { XMLLoader loader = XMLLoader.get(); symbol = loader.configGetAttribute(svc,"id"); @@ -48,7 +49,7 @@ class CommunityLeftMenuEntry implements Comparable Element link_elt = loader.configGetSubSection(svc,"link"); sequence = loader.configGetAttributeInt(link_elt,"sequence"); - item = new LinkItem(link_elt); + item = new LinkItem(link_elt,conf); } // end constructor @@ -59,9 +60,9 @@ class CommunityLeftMenuEntry implements Comparable public boolean equals(Object o) { - if ((o==null) || !(o instanceof CommunityLeftMenuEntry)) + if ((o==null) || !(o instanceof CommunityMenuEntry)) return false; - CommunityLeftMenuEntry other = (CommunityLeftMenuEntry)o; + CommunityMenuEntry other = (CommunityMenuEntry)o; return (sequence==other.sequence); } // end equals @@ -81,7 +82,7 @@ class CommunityLeftMenuEntry implements Comparable { if (o==null) throw new NullPointerException("compareTo null object!"); - CommunityLeftMenuEntry other = (CommunityLeftMenuEntry)o; // may throw ClassCastException + CommunityMenuEntry other = (CommunityMenuEntry)o; // may throw ClassCastException return sequence - other.sequence; } // end compareTo @@ -115,10 +116,16 @@ class CommunityLeftMenuEntry implements Comparable } // end resolveItem - final String getServletAddress(RenderData rdat, Map vars) + final String getServletAddress(RequestOutput ro, Map vars) { - return item.getAddress(rdat,vars); + return item.getAddress(ro,vars); } // end getServletAddress -} // end class CommunityLeftMenuEntry + final String getServletAddress(RequestInput ri, Map vars) + { + return item.getAddress(ri,vars); + + } // end getServletAddress + +} // end class CommunityMenuEntry diff --git a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuFactory.java b/src/com/silverwrist/venice/ui/menus/CommunityMenuFactory.java similarity index 77% rename from src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuFactory.java rename to src/com/silverwrist/venice/ui/menus/CommunityMenuFactory.java index ba0a1fe..57fe8fe 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/CommunityLeftMenuFactory.java +++ b/src/com/silverwrist/venice/ui/menus/CommunityMenuFactory.java @@ -15,15 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; import java.util.*; import org.w3c.dom.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.RootConfig; -public class CommunityLeftMenuFactory +public class CommunityMenuFactory { /*-------------------------------------------------------------------------------- * Attributes @@ -38,7 +39,7 @@ public class CommunityLeftMenuFactory *-------------------------------------------------------------------------------- */ - public CommunityLeftMenuFactory(Element comm_sect) throws ConfigException + public CommunityMenuFactory(Element comm_sect, RootConfig rconf) throws ConfigException { if (comm_sect!=null) { // look for community services @@ -50,7 +51,7 @@ public class CommunityLeftMenuFactory Node n = nl.item(i); if ((n.getNodeType()==Node.ELEMENT_NODE) && (n.getNodeName().equals("service"))) { // create a template LeftMenuEntry and add it - CommunityLeftMenuEntry ent = new CommunityLeftMenuEntry((Element)n); + CommunityMenuEntry ent = new CommunityMenuEntry((Element)n,rconf); tmp_entries.add(ent); tmp_map.put(ent.getSymbol(),ent); @@ -89,7 +90,7 @@ public class CommunityLeftMenuFactory *-------------------------------------------------------------------------------- */ - public CommunityLeftMenu createMenu(CommunityContext comm) + public final CommunityMenu createMenu(CommunityContext comm) { List items; if (entries.size()>0) @@ -112,7 +113,7 @@ public class CommunityLeftMenuFactory it = entries.iterator(); while (it.hasNext()) { // get this entry and see if there's a match in the set - CommunityLeftMenuEntry ntry = (CommunityLeftMenuEntry)(it.next()); + CommunityMenuEntry ntry = (CommunityMenuEntry)(it.next()); if (defined.contains(ntry.getSymbol())) tmp_items.add(ntry.resolveItem(vars)); @@ -132,16 +133,16 @@ public class CommunityLeftMenuFactory items = Collections.EMPTY_LIST; // the constructor will handle the rest of the initialization - return new CommunityLeftMenu(comm,items); + return new CommunityMenu(comm,items); } // end createMenu - public String getDefaultServletAddress(RenderData rdat, CommunityContext comm) + public final String getDefaultServletAddress(RequestOutput out, CommunityContext comm) { ServiceToken token = comm.getDefaultService(); if (token==null) return null; - CommunityLeftMenuEntry ent = (CommunityLeftMenuEntry)(map_symbol.get(token.getSymbol())); + CommunityMenuEntry ent = (CommunityMenuEntry)(map_symbol.get(token.getSymbol())); if (ent==null) return null; @@ -149,8 +150,25 @@ public class CommunityLeftMenuFactory HashMap vars = new HashMap(); vars.put("cid",String.valueOf(comm.getCommunityID())); - return ent.getServletAddress(rdat,vars); + return ent.getServletAddress(out,vars); } // end getDefaultServletAddress -} // end class CommunityLeftMenuFactory + public final String getDefaultServletAddress(RequestInput inp, CommunityContext comm) + { + ServiceToken token = comm.getDefaultService(); + if (token==null) + return null; + CommunityMenuEntry ent = (CommunityMenuEntry)(map_symbol.get(token.getSymbol())); + if (ent==null) + return null; + + // Create the map used to replace the variables in the servlet address. + HashMap vars = new HashMap(); + vars.put("cid",String.valueOf(comm.getCommunityID())); + + return ent.getServletAddress(inp,vars); + + } // end getDefaultServletAddress + +} // end class CommunityMenuFactory diff --git a/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java b/src/com/silverwrist/venice/ui/menus/HeaderItem.java similarity index 58% rename from src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java rename to src/com/silverwrist/venice/ui/menus/HeaderItem.java index 678d4ab..1920723 100644 --- a/src/com/silverwrist/venice/servlets/format/CDCountryListFormField.java +++ b/src/com/silverwrist/venice/ui/menus/HeaderItem.java @@ -15,56 +15,64 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.menus; -import java.util.List; -import java.io.Writer; import java.io.IOException; -import com.silverwrist.util.*; +import java.io.Writer; +import org.w3c.dom.*; +import com.silverwrist.util.DOMElementHelper; +import com.silverwrist.venice.ui.RequestOutput; -public class CDCountryListFormField extends CDPickListFormField +class HeaderItem implements MenuComponent { /*-------------------------------------------------------------------------------- - * Constructors + * Attributes *-------------------------------------------------------------------------------- */ - public CDCountryListFormField(String name, String caption, String caption2, boolean required) - { - super(name,caption,caption2,required,International.get().getCountryList()); + private TextItem subitem; - } // end constructor + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ - protected CDCountryListFormField(CDCountryListFormField other) + HeaderItem(Element elt) { - super(other); + DOMElementHelper h = new DOMElementHelper(elt); + subitem = new TextItem(h.getElementText()); } // end constructor /*-------------------------------------------------------------------------------- - * Overrides from class CDPickListFormField + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException + public void render(RequestOutput out, Writer wr) throws IOException { - Country c = (Country)obj; - out.write("<OPTION VALUE=\"" + c.getCode() + "\""); - if (c.getCode().equals(my_value)) - out.write(" SELECTED"); - out.write(">" + StringUtil.encodeHTML(c.getName()) + "</OPTION>\n"); + if (wr==null) + wr = out.getWriter(); + wr.write("<FONT SIZE=+1><B>"); + subitem.render(out,wr); + wr.write("</B></FONT><BR>\n"); - } // end renderChoice + } // end render - /*-------------------------------------------------------------------------------- - * Implementations from interface CDFormField - *-------------------------------------------------------------------------------- - */ - - public CDFormField duplicate() + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException { - return new CDCountryListFormField(this); + if (wr==null) + wr = out.getWriter(); + wr.write("<B>"); + subitem.renderOnLeft(out,wr); + wr.write("</B><BR>\n"); - } // end duplicate + } // end renderOnLeft -} // end class CDCountryListFormField + public String getTitle(RequestOutput out) + { + return null; + + } // end getTitle + +} // end class HeaderItem diff --git a/src/com/silverwrist/venice/servlets/format/menus/ImageItem.java b/src/com/silverwrist/venice/ui/menus/ImageItem.java similarity index 57% rename from src/com/silverwrist/venice/servlets/format/menus/ImageItem.java rename to src/com/silverwrist/venice/ui/menus/ImageItem.java index 10b65f6..c8cf01c 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/ImageItem.java +++ b/src/com/silverwrist/venice/ui/menus/ImageItem.java @@ -15,26 +15,18 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; -import java.io.Writer; import java.io.IOException; -import org.apache.log4j.*; +import java.io.Writer; import org.w3c.dom.*; -import com.silverwrist.util.*; +import com.silverwrist.util.DOMElementHelper; import com.silverwrist.venice.except.ConfigException; -import com.silverwrist.venice.servlets.format.ComponentRender; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.RequestOutput; +import com.silverwrist.venice.util.XMLLoader; -class ImageItem implements ComponentRender +class ImageItem implements MenuComponent { - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - private static Category logger = Category.getInstance(LinkItem.class); - /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- @@ -54,35 +46,17 @@ class ImageItem implements ComponentRender ImageItem(Element elt) throws ConfigException { - if (!(elt.getNodeName().equals("image"))) - { // just some shorts-checking here to make sure the element is OK - logger.fatal("huh?!? this should have been a <image/> if it got here!"); - throw new ConfigException("not a <image/> element"); + XMLLoader loader = XMLLoader.get(); - } // end if + loader.configVerifyNodeName(elt,"image"); - // get image source - DOMElementHelper h = new DOMElementHelper(elt); - if (h.hasAttribute("src")) - src = elt.getAttribute("src"); - else - throw new ConfigException("src= attribute of <image/> element not specified"); - - // get the image width - Integer tmp = h.getAttributeInt("width"); - if (tmp!=null) - width = tmp.intValue(); - else - throw new ConfigException("width= attribute of <image/> element not specified or invalid"); - - // get the image height - tmp = h.getAttributeInt("height"); - if (tmp!=null) - height = tmp.intValue(); - else - throw new ConfigException("height= attribute of <image/> element not specified or invalid"); + // get image source & dimensions + src = loader.configGetAttribute(elt,"src"); + width = loader.configGetAttributeInt(elt,"width"); + height = loader.configGetAttributeInt(elt,"height"); // get the rest of the attributes + DOMElementHelper h = new DOMElementHelper(elt); if (h.hasAttribute("alt")) alt = elt.getAttribute("alt"); if (h.hasAttribute("name")) @@ -93,27 +67,41 @@ class ImageItem implements ComponentRender } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out, Writer wr) throws IOException { - out.write("<IMG SRC=\""); + if (wr==null) + wr = out.getWriter(); + wr.write("<IMG SRC=\""); if (fixup) { // fix up the image path - src = rdat.getFullImagePath(src); + src = out.getImagePath(src); fixup = false; } // end if - out.write(src + "\" WIDTH=" + width + " HEIGHT=" + height); + wr.write(src + "\" WIDTH=" + width + " HEIGHT=" + height); if (alt!=null) - out.write(" ALT=\"" + alt + "\""); + wr.write(" ALT=\"" + alt + "\""); if (name!=null) - out.write(" NAME=\"" + name + "\""); - out.write(" BORDER=0>"); + wr.write(" NAME=\"" + name + "\""); + wr.write(" BORDER=0>"); - } // end renderHere + } // end render + + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException + { + this.render(out,wr); + + } // end renderOnLeft + + public String getTitle(RequestOutput out) + { + return null; + + } // end getTitle } // end class ImageItem diff --git a/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java b/src/com/silverwrist/venice/ui/menus/LinkItem.java similarity index 61% rename from src/com/silverwrist/venice/servlets/format/menus/LinkItem.java rename to src/com/silverwrist/venice/ui/menus/LinkItem.java index e2f4b15..4030642 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java +++ b/src/com/silverwrist/venice/ui/menus/LinkItem.java @@ -15,32 +15,26 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; -import java.io.Writer; import java.io.IOException; +import java.io.Writer; import java.util.Map; import org.apache.log4j.*; import org.w3c.dom.*; import com.silverwrist.util.*; import com.silverwrist.venice.except.ConfigException; -import com.silverwrist.venice.servlets.format.ColorSelectors; -import com.silverwrist.venice.servlets.format.ComponentRender; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.RootConfig; import com.silverwrist.venice.util.XMLLoader; -class LinkItem implements ComponentRender, ColorSelectors +class LinkItem implements MenuComponent, ColorSelectors, LinkTypes { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static final String ABSOLUTE = "absolute"; - private static final String SERVLET = "servlet"; - private static final String FRAME = "frame"; - private static final String[] valid_types = { ABSOLUTE, SERVLET, FRAME }; - private static Category logger = Category.getInstance(LinkItem.class); /*-------------------------------------------------------------------------------- @@ -49,47 +43,46 @@ class LinkItem implements ComponentRender, ColorSelectors */ private String href; // what we actually link to - private String type; // the type of item we specify + private int type; // the type of item we specify private boolean enabled = true; // is this item enabled? private String target = null; // target window for the link + private String title = null; // title (tooltip) for the link private String on_click = null; // onClick JavaScript for the link private int indent = 0; // how many spaces do we indent this link? - private ComponentRender contents; // what does this link contain? (image vs. text) + private MenuComponent contents; // what does this link contain? (image vs. text) /*-------------------------------------------------------------------------------- - * Constructors + * Constructor *-------------------------------------------------------------------------------- */ - LinkItem(Element elt) throws ConfigException + LinkItem(Element elt, RootConfig rconf) throws ConfigException { XMLLoader loader = XMLLoader.get(); + loader.configVerifyNodeName(elt,"link"); href = loader.configGetAttribute(elt,"href"); + DOMElementHelper h = new DOMElementHelper(elt); if (h.hasAttribute("type")) - { // get the "type" and check it - type = elt.getAttribute("type").trim().toLowerCase(); - boolean err = true; - for (int i=0; err && (i<valid_types.length); i++) - if (type.equals(valid_types[i])) - err = false; // found it! - if (err) - { // type value is not valid - logger.fatal("type=\"" + type + "\" is not a valid value"); + { // convert link type to an index + type = rconf.convertLinkType(elt.getAttribute("type")); + if (type<0) // the type is not valid throw new ConfigException("invalid type= attribute of <link/>"); - } // end if - } // end if - else // default to "absolute" + else // default to "absolute" type = ABSOLUTE; // load the "target" if (h.hasAttribute("target")) target = elt.getAttribute("target"); + // load the "title" + if (h.hasAttribute("title")) + title = elt.getAttribute("title"); + // load the "onClick" script code if (h.hasAttribute("onClick")) on_click = elt.getAttribute("onClick"); @@ -125,6 +118,7 @@ class LinkItem implements ComponentRender, ColorSelectors this.type = other.type; this.enabled = other.enabled; this.target = other.target; + this.title = other.title; this.on_click = StringUtil.replaceAllVariables(other.on_click,vars); this.indent = other.indent; this.contents = other.contents; @@ -132,56 +126,91 @@ class LinkItem implements ComponentRender, ColorSelectors } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out, Writer wr) throws IOException { + if (wr==null) + wr = out.getWriter(); for (int i=0; i<indent; i++) - out.write(" "); // do indent + wr.write("    "); // do indent + wr.write("<IMG SRC=\"" + out.getImagePath("purple-ball.gif") + + "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0> "); + if (enabled) + { // render the URL as an <A> tag + wr.write("<A HREF=\"" + out.formatURL(href,type) + "\""); + if (target!=null) + wr.write(" TARGET=\"" + target + "\""); + if (title!=null) + wr.write(" TITLE=\"" + title + "\""); + if (on_click!=null) + wr.write(" onClick=\"" + on_click + "\""); + wr.write(">"); + + } // end if + else // just disable the color + wr.write(out.getFontTag(CONTENT_DISABLED,null)); + contents.render(out,wr); + if (enabled) + wr.write("</A>"); + else + wr.write("</FONT>"); + wr.write("<BR>\n"); + + } // end render + + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException + { + if (wr==null) + wr = out.getWriter(); + for (int i=0; i<indent; i++) + wr.write(" "); // do indent if (enabled) { // write the opening <A> and <FONT> tags - out.write("<A HREF=\""); - if (type.equals(ABSOLUTE)) - out.write(href); - else if (type.equals(SERVLET)) - out.write(rdat.getEncodedServletPath(href)); - else if (type.equals(FRAME)) - out.write(rdat.getEncodedServletPath("frame/" + href)); - out.write("\" CLASS=\"lbar\""); + wr.write("<A HREF=\"" + out.formatURL(href,type) + "\" CLASS=\"lbar\""); if (target!=null) - out.write(" TARGET=\"" + target + "\""); + wr.write(" TARGET=\"" + target + "\""); + if (title!=null) + wr.write(" TITLE=\"" + title + "\""); if (on_click!=null) - out.write(" onClick=\"" + on_click + "\""); - out.write("><FONT COLOR=\"" + rdat.getStdColor(LEFT_LINK) + "\">"); + wr.write(" onClick=\"" + on_click + "\""); + wr.write(">" + out.getFontTag(LEFT_LINK,null)); + } // end if - else // write the "disabled" indicator - out.write("<FONT COLOR=\"" + rdat.getStdColor(CONTENT_DISABLED) + "\">"); - contents.renderHere(out,rdat); - out.write("</FONT>"); + else + wr.write(out.getFontTag(CONTENT_DISABLED,null)); + contents.renderOnLeft(out,wr); + wr.write("</FONT>"); if (enabled) - out.write("</A>"); - out.write("<BR>\n"); + wr.write("</A>"); + wr.write("<BR>\n"); - } // end renderHere + } // end renderOnLeft + + public String getTitle(RequestOutput out) + { + return null; // we don't have a "title" in this sense + + } // end getTitle /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - final String getAddress(RenderData rdat, Map vars) + final String getAddress(RequestOutput out, Map vars) { String s = StringUtil.replaceAllVariables(href,vars); - if (type.equals(ABSOLUTE)) - return s; - else if (type.equals(SERVLET)) - return rdat.getEncodedServletPath(s); - else if (type.equals(FRAME)) - return rdat.getEncodedServletPath("frame/" + s); - else - return null; + return out.formatURL(s,type); + + } // end getAddress + + final String getAddress(RequestInput inp, Map vars) + { + String s = StringUtil.replaceAllVariables(href,vars); + return inp.formatURL(s,type); } // end getAddress diff --git a/src/com/silverwrist/venice/ui/menus/Menu.java b/src/com/silverwrist/venice/ui/menus/Menu.java new file mode 100644 index 0000000..cc5f3da --- /dev/null +++ b/src/com/silverwrist/venice/ui/menus/Menu.java @@ -0,0 +1,223 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.menus; + +import java.io.IOException; +import java.io.Writer; +import java.util.*; +import org.apache.log4j.*; +import org.w3c.dom.*; +import com.silverwrist.util.DOMElementHelper; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.RootConfig; +import com.silverwrist.venice.util.XMLLoader; + +public class Menu implements MenuComponent, ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + private String identifier; + private List menu_items; + private String title = null; + private String subtitle = null; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public Menu(Element elt, RootConfig rconf, String identifier) throws ConfigException + { + XMLLoader loader = XMLLoader.get(); + + loader.configVerifyNodeName(elt,"menudef"); // verify the name of the root node + + ArrayList tmp_items = new ArrayList(); + NodeList nl = elt.getChildNodes(); + for (int i=0; i<nl.getLength(); i++) + { // loop through to find node items + Node n = nl.item(i); + if (n.getNodeType()==Node.ELEMENT_NODE) + { // figure out what kind of element this is... + if (n.getNodeName().equals("title")) + { // save off the title + DOMElementHelper h = new DOMElementHelper((Element)n); + title = h.getElementText(); + + } // end if (title specified) + else if (n.getNodeName().equals("subtitle")) + { // save off the title + DOMElementHelper h = new DOMElementHelper((Element)n); + subtitle = h.getElementText(); + + } // end else if (subtitle specified) + else if (n.getNodeName().equals("header")) + tmp_items.add(new HeaderItem((Element)n)); + else if (n.getNodeName().equals("separator")) + tmp_items.add(SeparatorItem.getBlank()); + else if (n.getNodeName().equals("text")) + { // add a text item + DOMElementHelper h = new DOMElementHelper((Element)n); + tmp_items.add(new SeparatorItem(new TextItem(h.getElementText()))); + + } // end else if + else if (n.getNodeName().equals("image")) + tmp_items.add(new SeparatorItem(new ImageItem((Element)n))); + else if (n.getNodeName().equals("link")) + tmp_items.add(new LinkItem((Element)n,rconf)); + else // unknown menu item + throw new ConfigException("unknown element <" + n.getNodeName() + "/> inside <menudef/>", + (Element)n); + + } // end if (element found) + // else just ignore it + + } // end for + + if (tmp_items.isEmpty()) + menu_items = Collections.EMPTY_LIST; + else + menu_items = Collections.unmodifiableList(tmp_items); + + this.identifier = identifier; + + } // end constructor + + public Menu(Menu other, Map vars) + { + this.identifier = other.identifier; + this.title = StringUtil.replaceAllVariables(other.title,vars); + this.subtitle = StringUtil.replaceAllVariables(other.subtitle,vars); + + if (other.menu_items.isEmpty()) + this.menu_items = Collections.EMPTY_LIST; + else + { // copy the menu items, + ArrayList tmp_items = new ArrayList(other.menu_items.size()); + Iterator it = other.menu_items.iterator(); + while (it.hasNext()) + { // copy the menu items + MenuComponent mc = (MenuComponent)(it.next()); + if (mc instanceof LinkItem) + tmp_items.add(new LinkItem((LinkItem)mc,vars)); + else + tmp_items.add(mc); + + } // end while + + menu_items = Collections.unmodifiableList(tmp_items); + + } // end else + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface MenuComponent + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out, Writer wr) throws IOException + { + if (title!=null) + { // write the header + if (wr==null) + out.writeContentHeader(title,subtitle); + else + out.writeContentHeader(wr,title,subtitle); + + } // end if + + if (wr!=null) + { // write using specified writer + wr.write(out.getFontTag(CONTENT_FOREGROUND,"content") + "\n"); + wr.flush(); + + } // end if + else + out.write(out.getFontTag(CONTENT_FOREGROUND,"content") + "\n"); + + Iterator it = menu_items.iterator(); + while (it.hasNext()) + { // render each menu item in turn + MenuComponent mc = (MenuComponent)(it.next()); + mc.render(out,wr); + + } // end while + + if (wr!=null) + { // write using specified writer + wr.write("</FONT>\n"); + wr.flush(); + + } // end if + else + out.write("</FONT>\n"); + + } // end render + + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException + { + if (wr==null) + wr = out.getWriter(); + if (title!=null) + { // write the title and subtitle + wr.write("<B>" + StringUtil.encodeHTML(title) + "</B><BR>\n"); + if (subtitle!=null) + wr.write(StringUtil.encodeHTML(subtitle) + "<BR>\n"); + + } // end if + + Iterator it = menu_items.iterator(); + while (it.hasNext()) + { // render each menu item in turn + MenuComponent mc = (MenuComponent)(it.next()); + mc.renderOnLeft(out,wr); + + } // end while + + } // end renderOnLeft + + public String getTitle(RequestOutput out) + { + return title; + + } // end getTitle + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getIdentifier() + { + return identifier; + + } // end getIdentifier + + public final String getTitle() + { + return title; + + } // end getTitle + +} // end class Menu diff --git a/src/com/silverwrist/venice/ui/menus/MenuComponent.java b/src/com/silverwrist/venice/ui/menus/MenuComponent.java new file mode 100644 index 0000000..bf35ffa --- /dev/null +++ b/src/com/silverwrist/venice/ui/menus/MenuComponent.java @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.menus; + +import java.io.IOException; +import java.io.Writer; +import com.silverwrist.venice.ui.RequestOutput; + +public interface MenuComponent +{ + public abstract void render(RequestOutput out, Writer wr) throws IOException; + + public abstract void renderOnLeft(RequestOutput out, Writer wr) throws IOException; + + public abstract String getTitle(RequestOutput out); + +} // end interface MenuComponent diff --git a/src/com/silverwrist/venice/servlets/format/PasswordChanged.java b/src/com/silverwrist/venice/ui/menus/SeparatorItem.java similarity index 63% rename from src/com/silverwrist/venice/servlets/format/PasswordChanged.java rename to src/com/silverwrist/venice/ui/menus/SeparatorItem.java index 234c4b4..3927c89 100644 --- a/src/com/silverwrist/venice/servlets/format/PasswordChanged.java +++ b/src/com/silverwrist/venice/ui/menus/SeparatorItem.java @@ -15,73 +15,79 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.menus; -import javax.servlet.ServletRequest; -import com.silverwrist.venice.core.CommunityContext; +import java.io.IOException; +import java.io.Writer; +import com.silverwrist.venice.ui.RequestOutput; -public class PasswordChanged implements JSPRender +class SeparatorItem implements MenuComponent { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.PasswordChanged"; + private static SeparatorItem the_blank = new SeparatorItem(null); + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private MenuComponent subitem; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public PasswordChanged() - { // do nothing + SeparatorItem(MenuComponent subitem) + { + this.subitem = subitem; + } // end constructor /*-------------------------------------------------------------------------------- - * External static functions + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - public static PasswordChanged retrieve(ServletRequest request) + public void render(RequestOutput out, Writer wr) throws IOException { - return (PasswordChanged)(request.getAttribute(ATTR_NAME)); + if (subitem!=null) + subitem.render(out,wr); + if (wr==null) + wr = out.getWriter(); + wr.write("<BR>\n"); - } // end retrieve + } // end render - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException { - return "Your Password Has been Changed"; + if (subitem!=null) + subitem.renderOnLeft(out,wr); + if (wr==null) + wr = out.getWriter(); + wr.write("<BR>\n"); - } // end getPageTitle + } // end renderHere - public String getPageQID() + public String getTitle(RequestOutput out) { return null; - } // end getPageQID + } // end getTitle /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender + * External static operations *-------------------------------------------------------------------------------- */ - public void store(ServletRequest request) + static SeparatorItem getBlank() { - request.setAttribute(ATTR_NAME,this); + return the_blank; - } // end store + } // end getBlank - public String getTargetJSPName() - { - return "password_changed.jsp"; - - } // end getTargetJSPName - -} // end class PasswordChanged +} // end class SeparatorItem diff --git a/src/com/silverwrist/venice/servlets/format/menus/TextItem.java b/src/com/silverwrist/venice/ui/menus/TextItem.java similarity index 72% rename from src/com/silverwrist/venice/servlets/format/menus/TextItem.java rename to src/com/silverwrist/venice/ui/menus/TextItem.java index 287f195..21c983a 100644 --- a/src/com/silverwrist/venice/servlets/format/menus/TextItem.java +++ b/src/com/silverwrist/venice/ui/menus/TextItem.java @@ -15,15 +15,14 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.menus; +package com.silverwrist.venice.ui.menus; -import java.io.Writer; import java.io.IOException; +import java.io.Writer; import com.silverwrist.util.StringUtil; -import com.silverwrist.venice.servlets.format.ComponentRender; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.RequestOutput; -class TextItem implements ComponentRender +class TextItem implements MenuComponent { /*-------------------------------------------------------------------------------- * Attributes @@ -44,14 +43,32 @@ class TextItem implements ComponentRender } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface ComponentRender + * Implementations from interface MenuComponent *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out, Writer wr) throws IOException { - out.write(contents); + if (wr==null) + out.write(contents); + else + wr.write(contents); - } // end renderHere + } // end render + + public void renderOnLeft(RequestOutput out, Writer wr) throws IOException + { + if (wr==null) + out.write(contents); + else + wr.write(contents); + + } // end renderOnLeft + + public String getTitle(RequestOutput out) + { + return null; + + } // end getTitle } // end class TextItem diff --git a/src/com/silverwrist/venice/ui/script/ScriptExit.java b/src/com/silverwrist/venice/ui/script/ScriptExit.java new file mode 100644 index 0000000..7c69595 --- /dev/null +++ b/src/com/silverwrist/venice/ui/script/ScriptExit.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.script; + +public class ScriptExit extends Exception +{ + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public ScriptExit() + { // do nothing + } // end constructor + +} // end class ScriptExit diff --git a/src/com/silverwrist/venice/ui/script/ScriptLibrary.java b/src/com/silverwrist/venice/ui/script/ScriptLibrary.java new file mode 100644 index 0000000..baaf82a --- /dev/null +++ b/src/com/silverwrist/venice/ui/script/ScriptLibrary.java @@ -0,0 +1,147 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.script; + +import java.net.URLEncoder; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.util.*; + +public class ScriptLibrary +{ + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public ConferenceContext castConferenceContext(Object o) + { + if (o instanceof ConferenceContext) + return (ConferenceContext)o; + throw new ClassCastException("ScriptLibrary.castConferenceContext: invalid cast"); + + } // end castConferenceContext + + public ConferenceHotlistEntry castConferenceHotlistEntry(Object o) + { + if (o instanceof ConferenceHotlistEntry) + return (ConferenceHotlistEntry)o; + throw new ClassCastException("ScriptLibrary.castConferenceHotlistEntry: invalid cast"); + + } // end castConferenceHotlistEntry + + public SideBoxDescriptor castSideBoxDescriptor(Object o) + { + if (o instanceof SideBoxDescriptor) + return (SideBoxDescriptor)o; + throw new ClassCastException("ScriptLibrary.castSideBoxDescriptor: invalid cast"); + + } // end castSideBoxDescriptor + + public TopicMessageContext castTopicMessageContext(Object o) + { + if (o instanceof TopicMessageContext) + return (TopicMessageContext)o; + throw new ClassCastException("ScriptLibrary.castTopicMessageContext: invalid cast"); + + } // end castTopicMessageContext + + public UserFound castUserFound(Object o) + { + if (o instanceof UserFound) + return (UserFound)o; + throw new ClassCastException("ScriptLibrary.castUserFound: invalid cast"); + + } // end castUserSideBoxDescriptor + + public UserSideBoxDescriptor castUserSideBoxDescriptor(Object o) + { + if (o instanceof UserSideBoxDescriptor) + return (UserSideBoxDescriptor)o; + throw new ClassCastException("ScriptLibrary.castUserSideBoxDescriptor: invalid cast"); + + } // end castUserSideBoxDescriptor + + public boolean[] createBooleanArray(int len) + { + return new boolean[len]; + + } // end createBooleanArray + + public int[] createIntArray(int len) + { + return new int[len]; + + } // end createIntArray + + public void done() throws ScriptExit + { + throw new ScriptExit(); + + } // end done + + public boolean emptyString(String s) + { + return StringUtil.isStringEmpty(s); + + } // end emptyString + + public String encodeHTML(String s) + { + return StringUtil.encodeHTML(s); + + } // end encodeHTML + + public String encodeURL(String s) + { + return URLEncoder.encode(s); + + } // end encodeURL + + public String exceptionType(Object o) throws ScriptExit + { + if (o instanceof ScriptExit) + throw (ScriptExit)o; // rethrow ScriptExit exceptions + if (o instanceof Throwable) + return o.getClass().getName(); + else + return null; + + } // end exceptionType + + public String join(List l, String separator) + { + return StringUtil.join(l,separator); + + } // end join + + public List splitList(String data, String delims) + { + return StringUtil.splitList(data,delims); + + } // end splitList + + public boolean validVeniceID(String s) + { + return IDUtils.isValidVeniceID(s); + + } // end validVeniceID + +} // end class ScriptLibrary diff --git a/src/com/silverwrist/venice/ui/script/ScriptManager.java b/src/com/silverwrist/venice/ui/script/ScriptManager.java new file mode 100644 index 0000000..d03fde7 --- /dev/null +++ b/src/com/silverwrist/venice/ui/script/ScriptManager.java @@ -0,0 +1,374 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.script; + +import java.lang.reflect.*; +import java.io.*; +import java.util.*; +import com.ibm.bsf.*; +import org.apache.log4j.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.ThrowableContent; + +public class ScriptManager +{ + /*-------------------------------------------------------------------------------- + * Internal class for script utility + *-------------------------------------------------------------------------------- + */ + + public class MyScriptLibrary extends ScriptLibrary + { + public Object exec(String script) throws ScriptingException, ThrowableContent + { + RequestInput ri = (RequestInput)(ScriptManager.this.lookupObject("request")); + String script_file = ri.getScriptName(script); + String logger_name = ri.getScriptLoggerName(script); + if (logger.isDebugEnabled()) + logger.debug("EXECUTING " + script_file); + ScriptReturn sro = new ScriptReturn(); + ScriptManager.this.exec(new File(script_file),logger_name,sro); + return sro.get(); + + } // end exec + + public void output(Object o) + { + if (return_stack.size()>0) + { // set the return value + ScriptReturn sro = (ScriptReturn)(return_stack.getFirst()); + sro.set(o); + + } // end if + + } // end output + + } // end class MyScriptLibrary + + /*-------------------------------------------------------------------------------- + * Internal class for doing logging + *-------------------------------------------------------------------------------- + */ + + public class ScriptLogger + { + public void fatal(Object message) + { + if (logger_stack.size()>0) + ((Category)(logger_stack.getFirst())).fatal(message); + + } // end fatal + + public void error(Object message) + { + if (logger_stack.size()>0) + ((Category)(logger_stack.getFirst())).error(message); + + } // end error + + public void warn(Object message) + { + if (logger_stack.size()>0) + ((Category)(logger_stack.getFirst())).warn(message); + + } // end warn + + public void info(Object message) + { + if (logger_stack.size()>0) + { // check to make sure info is enabled first + Category cat = (Category)(logger_stack.getFirst()); + if (cat.isInfoEnabled()) + cat.info(message); + + } // end if + + } // end info + + public void debug(Object message) + { + if (logger_stack.size()>0) + { // check to make sure debug is enabled first + Category cat = (Category)(logger_stack.getFirst()); + if (cat.isDebugEnabled()) + cat.debug(message); + + } // end if + + } // end debug + + } // end class ScriptLogger + + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(ScriptManager.class); + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private BSFManager mgr; // Bean Scripting Framework manager + private LinkedList registered_names; // stack of lists of registered names + private LinkedList logger_stack; // stack of loggers for nested evaluation + private LinkedList return_stack; // stack of return values + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public ScriptManager(String temp_dir) throws ScriptingException + { + // initialize the BSFManager + mgr = new BSFManager(); + mgr.setTempDir(temp_dir); + + if (BSFManager.isLanguageRegistered("javascript")) + { // we need to so some fixing up to make Rhino work + try + { // ensure the engine is loaded, and do our fixup routine + mgr.loadScriptingEngine("javascript"); + fixupRhino(); + + } // end if + catch (BSFException e) + { // do nothing - we don't have JavaScript loaded + } // end catch + + } // end if + + try + { // declare beans used by the scripting engines + mgr.declareBean("vlib",new MyScriptLibrary(),MyScriptLibrary.class); + mgr.declareBean("logger",new ScriptLogger(),ScriptLogger.class); + + } // end try + catch (BSFException e) + { // translate the exception + logger.error("bean declarations threw a BSFException",e); + throw new ScriptingException("initialization error in ScriptManager",e); + + } // end catch + + // initialize the rest of the object + registered_names = new LinkedList(); + registered_names.addFirst(new HashSet()); + logger_stack = new LinkedList(); + return_stack = new LinkedList(); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private static void fixupRhino() + { + // What fixupRhino does is to turn off the fancy caching in the JavaScript engine. This is because + // caching involves dynamic creation of classes on the fly, and, for some reason (probably because + // of differing ClassLoader implementations), that doesn't work, whether Rhino is loaded in the + // Web application or in the JRE extensions. When caching is turned off, Rhino can be loaded as + // part of the web application, and it can see all the standard classes and all the Web application + // classes. But we have to turn it off by manipulating it via the Reflection API, as, for all we know, + // Rhino isn't even being loaded right now. (Though we have BSF load Rhino right away if it can, + // to try and get this straightened out.) + if (logger.isDebugEnabled()) + logger.debug("Entered fixupRhino"); + + try + { // get a pointer to the Context class + Class klass = Class.forName("org.mozilla.javascript.Context"); + + // get a pointer to its setCachingEnabled method + final Class[] parmtypes = { Boolean.TYPE }; + Method m = klass.getMethod("setCachingEnabled",parmtypes); + + // invoke it to turn caching off! + final Object[] parms = { Boolean.FALSE }; + m.invoke(null,parms); + + // all done! + if (logger.isDebugEnabled()) + logger.debug("fixupRhino COMPLETED SUCCESSFULLY"); + + } // end try + catch (Exception e) + { // just log the exception and proceed + if (logger.isDebugEnabled()) + logger.debug("fixupRhino NOT COMPLETED",e); + + } // end catch + + } // end fixupRhino + + private void translateScriptException(String source, String lang, BSFException e) + throws ScriptingException, ThrowableContent + { + if (logger.isDebugEnabled()) + logger.debug("translateScriptException for " + source + " [" + lang + "]"); + + Throwable t = e.getTargetException(); + if (t instanceof ScriptExit) + { // that was a deliberate exit from the script - discard it and continue + if (logger.isDebugEnabled()) + logger.debug("ScriptExit - normal condition"); + return; + + } // end if + + if (t instanceof ThrowableContent) + { // treat ThrowableContent specially + if (logger.isDebugEnabled()) + logger.debug("ThrowableContent (" + t.getClass().getName() + ") - no need to process"); + throw (ThrowableContent)t; + + } // end if + + if (e.getReason()==BSFException.REASON_EXECUTION_ERROR) + { // throw a ScriptingException + logger.error("Execution exception while running script",t); + if (t!=null) + throw new ScriptingException(source,lang,e.getMessage(),t); + else + throw new ScriptingException(source,lang,e.getMessage(),e); + + } // end if + else if (e.getReason()==BSFException.REASON_OTHER_ERROR) + { // usually indicates a compiler error in the scripting engine + logger.error("Script compilation error",e); + if (t!=null) + logger.error("Root cause:",t); + throw new ScriptingException(source,lang,e.getMessage()); + + } // end else if + else + { // unknown exception type here! + logger.error("Unknown BSFException in script execution (reason " + e.getReason() + ")",e); + if (t!=null) + logger.error("Root cause:",t); + throw new ScriptingException("unexpected exception while executing " + source + " [" + lang + "]",e); + + } // end else + + } // end translateScriptException + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public void shutdown() + { + mgr.terminate(); + registered_names.clear(); + logger_stack.clear(); + + } // end shutdown + + public void exec(File file, String logger_name, ScriptReturn sro) throws ScriptingException, ThrowableContent + { + String filename = file.getAbsolutePath(); + String lang; + StringBuffer code; + + if (logger.isDebugEnabled()) + logger.debug("Exec'ing " + filename + ", logger " + logger_name); + + try + { // look up the scripting language for this file + lang = mgr.getLangFromFilename(filename); + code = IOUtil.loadText(file); + if (logger.isDebugEnabled()) + logger.debug("Code language is " + lang); + + } // end try + catch (BSFException e) + { // this may be thrown by getLangFromFilename + throw new ScriptingException("unknown scripting language: file " + filename); + + } // end catch + catch (IOException ie) + { // this may be thrown by IOUtil.load + throw new ScriptingException("unable to load script file: " + filename,ie); + + } // end catch + + if (logger_name!=null) // push a new logger onto the stack + logger_stack.addFirst(Category.getInstance(logger_name)); + if (sro!=null) + return_stack.addFirst(sro); + + try + { // execute the script! + mgr.exec(lang,filename,1,1,code); + + } // end try + catch (BSFException e) + { // translate the exception thrown by the script + translateScriptException(filename,lang,e); + + } // end catch + finally + { // pop the logger stack if necessary + if (logger_name!=null) + logger_stack.removeFirst(); + if (sro!=null) + return_stack.removeFirst(); + + } // end finally + + } // end exec + + public void register(String name, Object obj) + { + mgr.registerBean(name,obj); + HashSet tbl = (HashSet)(registered_names.getFirst()); + tbl.add(name); + + } // end register + + public void pushContext() + { + registered_names.addFirst(new HashSet()); + + } // end pushContext + + public void popContext() + { + HashSet tbl = (HashSet)(registered_names.removeFirst()); + Iterator it = tbl.iterator(); + while (it.hasNext()) + mgr.unregisterBean((String)(it.next())); + if (registered_names.isEmpty()) + registered_names.addFirst(new HashSet()); + + } // end popContext + + public Object lookupObject(String name) + { + return mgr.lookupBean(name); + + } // end lookupObject + +} // end class ScriptManager diff --git a/src/com/silverwrist/venice/servlets/format/UserCommunityList.java b/src/com/silverwrist/venice/ui/script/ScriptManagerContainer.java similarity index 51% rename from src/com/silverwrist/venice/servlets/format/UserCommunityList.java rename to src/com/silverwrist/venice/ui/script/ScriptManagerContainer.java index 3f16177..dd354d1 100644 --- a/src/com/silverwrist/venice/servlets/format/UserCommunityList.java +++ b/src/com/silverwrist/venice/ui/script/ScriptManagerContainer.java @@ -15,104 +15,110 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.script; +import java.lang.ref.*; import java.util.*; import javax.servlet.*; -import javax.servlet.http.*; -import com.silverwrist.venice.core.*; -import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.config.RootConfig; -public class UserCommunityList implements JSPRender +public class ScriptManagerContainer { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.UserCommunityList"; + private static final String ATTR_NAME = "com.silverwrist.venice.ui.script.ScriptManagerContainer"; /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private UserContext uc; - private List comm_list; + private String temp_directory; + private LinkedList cached_engines; + private ReferenceQueue rq_engines; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public UserCommunityList(UserContext uc) throws DataException + private ScriptManagerContainer(String tmpdir) { - this.uc = uc; - this.comm_list = uc.getMemberCommunities(); + temp_directory = tmpdir; + cached_engines = new LinkedList(); + rq_engines = new ReferenceQueue(); } // end constructor /*-------------------------------------------------------------------------------- - * External static functions + * Internal operations *-------------------------------------------------------------------------------- */ - public static UserCommunityList retrieve(ServletRequest request) + private synchronized void sweep() { - return (UserCommunityList)(request.getAttribute(ATTR_NAME)); + Reference r = rq_engines.poll(); + while (r!=null) + { // remove discarded engines + cached_engines.remove(r); + r.clear(); + r = rq_engines.poll(); - } // end retrieve + } // end while - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) - { - return "Your Communities"; - - } // end getPageTitle - - public String getPageQID() - { - return null; - - } // end getPageQID - - /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender - *-------------------------------------------------------------------------------- - */ - - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() - { - return "communitylist.jsp"; - - } // end getTargetJSPName + } // end sweep /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - public int getNumCommunities() + public synchronized ScriptManager getScriptManager() throws ScriptingException { - return comm_list.size(); + sweep(); + ScriptManager rc = null; + while ((rc==null) && (cached_engines.size()>0)) + { // look for a reference that contains a valid ScriptManager + SoftReference r = (SoftReference)(cached_engines.removeFirst()); + rc = (ScriptManager)(r.get()); + r.clear(); - } // end getNumCommunities + } // end while - public CommunityContext getCommunity(int ndx) + return ((rc==null) ? new ScriptManager(temp_directory) : rc); + + } // end getScriptManager + + public synchronized void releaseScriptManager(ScriptManager mgr) { - return (CommunityContext)(comm_list.get(ndx)); + sweep(); + cached_engines.addFirst(new SoftReference(mgr,rq_engines)); - } // end getCommunity + } // end releaseScriptManager -} // end class UserCommunityList + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final ScriptManagerContainer get(ServletContext ctxt) + { + return (ScriptManagerContainer)(ctxt.getAttribute(ATTR_NAME)); + + } // end get + + public static final void initialize(RootConfig config, ServletContext ctxt) + { + if (ctxt.getAttribute(ATTR_NAME)==null) + { // create new container... + ScriptManagerContainer c = new ScriptManagerContainer(config.getTemporaryPath()); + ctxt.setAttribute(ATTR_NAME,c); + + } // end if + + } // end initialize + +} // end ScriptManagerContainer diff --git a/src/com/silverwrist/venice/servlets/ContentResult.java b/src/com/silverwrist/venice/ui/script/ScriptReturn.java similarity index 79% rename from src/com/silverwrist/venice/servlets/ContentResult.java rename to src/com/silverwrist/venice/ui/script/ScriptReturn.java index b0f544b..8d2567a 100644 --- a/src/com/silverwrist/venice/servlets/ContentResult.java +++ b/src/com/silverwrist/venice/ui/script/ScriptReturn.java @@ -15,29 +15,24 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.script; -import com.silverwrist.venice.servlets.format.VeniceContent; - -public class ContentResult extends VeniceServletResult +public class ScriptReturn { /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - private VeniceContent content; + Object rc = null; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public ContentResult(VeniceContent content) - { - super(); - this.content = content; - + public ScriptReturn() + { // do nothing } // end constructor /*-------------------------------------------------------------------------------- @@ -45,10 +40,16 @@ public class ContentResult extends VeniceServletResult *-------------------------------------------------------------------------------- */ - public VeniceContent getContent() + public Object get() { - return content; + return rc; - } // end getContent + } // end get -} // end class ContentResult + void set(Object o) + { + rc = o; + + } // end class + +} // end class ScriptReturn diff --git a/src/com/silverwrist/venice/ui/script/ScriptingException.java b/src/com/silverwrist/venice/ui/script/ScriptingException.java new file mode 100644 index 0000000..c792749 --- /dev/null +++ b/src/com/silverwrist/venice/ui/script/ScriptingException.java @@ -0,0 +1,129 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.script; + +import com.silverwrist.venice.except.VeniceException; + +public class ScriptingException extends VeniceException +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String source = null; + private String language = null; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + /** + * Constructs a new <CODE>ScriptingException</CODE>. + */ + public ScriptingException() + { + super(); + + } // end constructor + + /** + * Constructs a new <CODE>ScriptingException</CODE> with a text message. + * + * @param msg The message to set in this exception. + */ + public ScriptingException(String msg) + { + super(msg); + + } // end constructor + + /** + * Constructs a new <CODE>ScriptingException</CODE> wrapping another exception. + * + * @param inner The exception wrapped by this one. + */ + public ScriptingException(Throwable inner) + { + super(inner); + + } // end constructor + + /** + * Constructs a new <CODE>ScriptingException</CODE> wrapping another exception. + * + * @param msg The message to set in this exception. + * @param inner The exception wrapped by this one. + */ + public ScriptingException(String msg, Throwable inner) + { + super(msg,inner); + + } // end constructor + + public ScriptingException(String source, String language, String msg) + { + super(msg); + this.source = source; + this.language = language; + + } // end constructor + + public ScriptingException(String source, String language, String msg, Throwable inner) + { + super(msg,inner); + this.source = source; + this.language = language; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class Object + *-------------------------------------------------------------------------------- + */ + + public String toString() + { + if ((source==null) || (language==null)) + return super.toString(); + StringBuffer buf = new StringBuffer(getClass().getName()); + buf.append(": error executing ").append(source).append(" [").append(language).append("]:\n"); + buf.append(getMessage()); + return buf.toString(); + + } // end toString + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getSource() + { + return source; + + } // end getSource + + public final String getLanguage() + { + return language; + + } // end getLanguage + +} // end class ScriptingException diff --git a/src/com/silverwrist/venice/ui/servlet/BaseServlet.java b/src/com/silverwrist/venice/ui/servlet/BaseServlet.java new file mode 100644 index 0000000..1d00e7c --- /dev/null +++ b/src/com/silverwrist/venice/ui/servlet/BaseServlet.java @@ -0,0 +1,315 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.servlet; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.log4j.*; +import org.apache.log4j.xml.DOMConfigurator; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.*; +import com.silverwrist.venice.ui.helpers.ErrorBox; +import com.silverwrist.venice.ui.helpers.ThrowableContent; +import com.silverwrist.venice.ui.script.ScriptingException; +import com.silverwrist.venice.ui.script.ScriptManagerContainer; + +public abstract class BaseServlet extends HttpServlet +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String LOGGING_ATTRIBUTE = "com.silverwrist.venice.util.LoggingStarted"; + private static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine"; + private static final String UICONFIG_ATTRIBUTE = "com.silverwrist.venice.ui.Config"; + + private static final String LOGGING_INIT_PARAM = "logging.config"; + private static final String ENGINE_INIT_PARAM = "venice.config"; + private static final String UICONFIG_INIT_PARAM = "ui.config"; + + private static Category logger = Category.getInstance(BaseServlet.class); + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private Object translateException(RequestInput req, Exception e) + { + logger.info("BaseServlet.translateException translating exception",e); + if (e instanceof ScriptingException) + return new ErrorBox("Scripting Error",e,null); + + // Last-ditch effort: get the specific servlet to translate the exception. + Object rc = translateServletException(req,e); + if (rc!=null) + return rc; + return new ErrorBox("Unhandled Exception Detected!",e.toString(),e,null); + + } // end translateException + + private void commonProcess(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException + { + // log remote address with all log messages + NDC.push(request.getRemoteAddr()); + + try + { // create the actual request implementation + ServletContext ctxt = getServletContext(); + RequestImpl the_request = + new RequestImpl(ctxt,request,response,(VeniceEngine)(ctxt.getAttribute(ENGINE_ATTRIBUTE)), + (RootConfig)(ctxt.getAttribute(UICONFIG_ATTRIBUTE))); + String default_location = the_request.getLocation(); + + // log the username with all log messages, if the user is logged in + boolean record_user = the_request.getUser().isLoggedIn(); + if (record_user) + NDC.push(the_request.getUser().getUserName()); + + try + { // run the actual operation! + Object my_output; // the output we get from the user + + try + { // process this request! + my_output = process(the_request); + if (my_output==null) // this shouldn't happen + my_output = new ErrorBox("Internal Error!", + "No content returned for request: " + the_request.getVerb() + ": /" + + default_location,null); + + } // end try + catch (ThrowableContent tc) + { // special escape for ThrowableContent + my_output = tc; + + } // end catch + catch (Exception e) + { // if an exception is thrown, translate it + if (e instanceof RuntimeException) + { // filter out RuntimeExceptions and rethrow them + logger.error("BaseServlet caught runtime exception" + e.getClass().getName() + + " in commonProcess",e); + throw (RuntimeException)e; + + } // end if + + my_output = translateException(the_request,e); + + } // end catch + + if (logger.isDebugEnabled()) + logger.debug("Outputting an object of type " + my_output.getClass().getName()); + + // if the output object needs automatic cleanup, register it + if (my_output instanceof AutoCleanup) + the_request.registerCleanup((AutoCleanup)my_output); + + try + { // Output the resulting object. + if (my_output instanceof ContentExecute) + the_request.execute((ContentExecute)my_output); + else if (my_output instanceof Content) + the_request.output((Content)my_output); + else + the_request.outputRaw(my_output.toString()); + + } // end try + finally + { // end the request + the_request.end(); + + } // end finally + + } // end try + finally + { // make sure and pop the diagnostic context, if it was pushed + if (record_user) + NDC.pop(); + + } // end finally + + } // end try + finally + { // make sure and pop the diagnostic context before we go + NDC.pop(); + + } // end finally + + } // end commonProcess + + /*-------------------------------------------------------------------------------- + * Abstract operations which MUST be overridden! + *-------------------------------------------------------------------------------- + */ + + public abstract Object process(RequestInput req) throws Exception, ThrowableContent; + + /*-------------------------------------------------------------------------------- + * Overrideable operations + *-------------------------------------------------------------------------------- + */ + + protected void init(ServletConfig config, ServletContext ctxt, VeniceEngine engine, RootConfig root, + String root_file_path) + { // default does nothing + } // end init + + protected Object translateServletException(RequestInput ri, Exception e) + { + return null; // does nothing by default + + } // end translateServletException + + /*-------------------------------------------------------------------------------- + * Overrides from class GenericServlet + *-------------------------------------------------------------------------------- + */ + + public void init(ServletConfig config) throws ServletException + { + super.init(config); + ServletContext ctxt = config.getServletContext(); + String root_file_path = ctxt.getRealPath("/"); + if (!(root_file_path.endsWith("/"))) + root_file_path += "/"; + + synchronized (BaseServlet.class) + { // initialize the logging + if (ctxt.getAttribute(LOGGING_ATTRIBUTE)==null) + { // get logging config file and initialize + String log_cfg = ctxt.getInitParameter(LOGGING_INIT_PARAM); + if (!(log_cfg.startsWith("/"))) + log_cfg = root_file_path + log_cfg; + + DOMConfigurator.configure(log_cfg); + logger.info("Initialized logging with config file: " + log_cfg); + + ctxt.setAttribute(LOGGING_ATTRIBUTE,Boolean.TRUE); + + } // end if + + } // end synchronized block + + NDC.push("[-servlet-init-]"); + + VeniceEngine engine = null; + RootConfig rootconf = null; + try + { // check and initialize the Venice engine + synchronized (BaseServlet.class) + { // initialize the engine + engine = (VeniceEngine)(ctxt.getAttribute(ENGINE_ATTRIBUTE)); + if (engine==null) + { // initialize the engine + String engine_cfg = ctxt.getInitParameter(ENGINE_INIT_PARAM); + if (!(engine_cfg.startsWith("/"))) + engine_cfg = root_file_path + engine_cfg; + logger.info("Initializing Venice engine using config file: " + engine_cfg); + + try + { // extract the configuration file name and create the engine + engine = Startup.createEngine(engine_cfg,root_file_path); + ctxt.setAttribute(ENGINE_ATTRIBUTE,engine); + + } // end try + catch (ConfigException e) + { // configuration failed! post an error message + logger.fatal("Engine configuration failed: " + e.getMessage(),e); + throw new ServletException("Venice engine configuration failed: " + e.getMessage(),e); + + } // end catch + catch (DataException e2) + { // configuration failed! post an error message + logger.fatal("Engine data load failed: " + e2.getMessage(),e2); + throw new ServletException("Venice engine data load failed: " + e2.getMessage(),e2); + + } // end catch + + } // end if + + // check and initialize the root configuration for the UI + rootconf = (RootConfig)(ctxt.getAttribute(UICONFIG_ATTRIBUTE)); + if (rootconf==null) + { // load the root configuration + String ui_cfg = ctxt.getInitParameter(UICONFIG_INIT_PARAM); + if (!(ui_cfg.startsWith("/"))) + ui_cfg = root_file_path + ui_cfg; + logger.info("Initializing Venice user interface using config file: " + ui_cfg); + + try + { // create a root configuration + rootconf = new RootConfig(ui_cfg,root_file_path); + ctxt.setAttribute(UICONFIG_ATTRIBUTE,rootconf); + + } // end try + catch (ConfigException e) + { // user interface configuration failed... + logger.fatal("User interface configuration failed: " + e.getMessage(),e); + throw new ServletException("Venice user interface configuration failed: " + e.getMessage(),e); + + } // end catch + + } // end if + + ScriptManagerContainer.initialize(rootconf,ctxt); // make sure container initialized + + } // end synchronized block + + // now do per-servlet initialization + init(config,ctxt,engine,rootconf,root_file_path); + + } // end try + finally + { // make sure and pop the diagnostic context before we go + NDC.pop(); + + } // end finally + + } // end init + + public void destroy() + { + super.destroy(); + + } // end destroy + + /*-------------------------------------------------------------------------------- + * Overrides from class HttpServlet + *-------------------------------------------------------------------------------- + */ + + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + commonProcess(req,resp); + + } // end doGet + + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + commonProcess(req,resp); + + } // end doPost + +} // end class BaseServlet diff --git a/src/com/silverwrist/venice/servlets/CommunityFrontEnd.java b/src/com/silverwrist/venice/ui/servlet/CommunityDispatchServlet.java similarity index 54% rename from src/com/silverwrist/venice/servlets/CommunityFrontEnd.java rename to src/com/silverwrist/venice/ui/servlet/CommunityDispatchServlet.java index 76b08ed..0cd79ac 100644 --- a/src/com/silverwrist/venice/servlets/CommunityFrontEnd.java +++ b/src/com/silverwrist/venice/ui/servlet/CommunityDispatchServlet.java @@ -15,76 +15,54 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; import org.apache.log4j.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; -public class CommunityFrontEnd extends VeniceServlet +public class CommunityDispatchServlet extends BaseServlet { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(CommunityFrontEnd.class); + private static Category logger = Category.getInstance(CommunityDispatchServlet.class); /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public String getServletInfo() - { - String rc = "CommunityFrontEnd servlet - Redirects to the \"default feature\" of a community\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult + public Object process(RequestInput req) { // get the community alias name from the request path info - String alias = request.getPathInfo().substring(1); + String alias = req.getPathInfo().substring(1); try { // get the community's context from the alias name - CommunityContext comm = user.getCommunityContext(alias); + CommunityContext comm = req.getUser().getCommunityContext(alias); // get the default servlet from the community context - String def_servlet = rdat.getDefaultServletAddress(comm); + String def_servlet = req.getDefaultServletAddress(comm); if (logger.isDebugEnabled()) - logger.debug("CommunityFrontEnd bouncing to: " + def_servlet); + logger.debug("CommunityDispatchServlet bouncing to: " + def_servlet); if (def_servlet==null) - { // return the default servlet - changeMenuTop(request); - return new ErrorBox("Internal Error","unable to get community default servlet","top"); + return new ErrorBox("Internal Error","Unable to get community default servlet.","top.js.vs"); - } // end if - - // and go there - throw new RedirectResult(def_servlet,true); + // now go there + return new Redirect(def_servlet,LinkTypes.ABSOLUTE); } // end try catch (DataException de) { // set up to display an ErrorBox - changeMenuTop(request); - return new ErrorBox("Database Error","Database error finding community: " + de.getMessage(),"top"); + return new ErrorBox("Database Error","Database error finding community: " + de.getMessage(),"top.js.vs"); } // end catch - } // end doVeniceGet + } // end process -} // end class CommunityFrontEnd +} // end class CommunityDispatchServlet diff --git a/src/com/silverwrist/venice/ui/servlet/FrameServlet.java b/src/com/silverwrist/venice/ui/servlet/FrameServlet.java new file mode 100644 index 0000000..dedf174 --- /dev/null +++ b/src/com/silverwrist/venice/ui/servlet/FrameServlet.java @@ -0,0 +1,219 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.servlet; + +import java.io.*; +import org.apache.log4j.*; +import com.silverwrist.util.IOUtil; +import com.silverwrist.util.cache.CacheMap; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; + +public class FrameServlet extends BaseServlet +{ + /*-------------------------------------------------------------------------------- + * Internal class for returning the framed data. + *-------------------------------------------------------------------------------- + */ + + static class FramedData implements ContentDirect + { + private String locator; // static locator identity + private File file; // the actual file we're retrieving + private long last_update; // when was file last updated? + private boolean processed = false; // have we processed this file? + private String title = null; // the actual title + private String content = null; // the actual content + + FramedData(String locator, String filename) throws ErrorBox + { + this.locator = locator; + this.file = new File(filename); + if (!(file.canRead())) + { // the file does not exist! + logger.error("FramedData: file \"" + filename + "\" not accessible"); + throw new ErrorBox(null,"The static document \"" + locator + "\" was not found on the disk.",null); + + } // end if + + this.last_update = file.lastModified(); + + } // end constructor + + private synchronized void process() + { + if (processed) + { // check to see if the file's been modified + long new_last_update = file.lastModified(); + if (last_update!=new_last_update) + { // been updated - need to reprocess! + last_update = new_last_update; + title = null; + content = null; + processed = false; + + } // end if + + } // end if + + if (processed) + return; // don't need to re-process + + // Read in the whole thing. + StringBuffer raw_data; + try + { // read in from the file + raw_data = IOUtil.loadText(file); + + } // end try + catch (IOException ioe) + { // I/O exception - just discard + title = locator; + content = "I/O error reading " + locator + ": " + ioe.getMessage(); + return; + + } // end catch + + // make the upper-case search page and use that to locate the page title and body + String search_page = raw_data.toString().toUpperCase(); + title = searchBetweenTags(raw_data,search_page,"TITLE"); + content = searchBetweenTags(raw_data,search_page,"BODY"); + if (content==null) + { // no content? + content = "No content seen on " + locator; + processed = false; + + } // end if + + processed = true; // set the flag to indicate we've got everything + + } // end process + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + process(); + return title; + + } // end getPageTitle + + public String getPageQID() + { + return locator; + + } // end getPageQID + + public void render(RequestOutput out) throws IOException + { + process(); + out.write(content); + out.flush(); + + } // end render + + } // end class FramedData + + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(FrameServlet.class); + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private CacheMap cache = new CacheMap(15,25); + + /*-------------------------------------------------------------------------------- + * Internal operations + *-------------------------------------------------------------------------------- + */ + + private static String searchBetweenTags(StringBuffer data, String search, String tagname) + { + tagname = tagname.toUpperCase(); + String start = "<" + tagname; + String end = "</" + tagname + ">"; + + int startpos = search.indexOf(start); + if (startpos<0) + return null; + startpos += start.length(); + + int bkt_pos = search.indexOf('>',startpos); + if (bkt_pos<0) + return null; + + int end_pos = search.indexOf(end,++bkt_pos); + if (end_pos<0) + return data.substring(bkt_pos); + else + return data.substring(bkt_pos,end_pos); + + } // end searchBetweenTags + + /*-------------------------------------------------------------------------------- + * Implementations from class BaseServlet + *-------------------------------------------------------------------------------- + */ + + public Object process(RequestInput req) throws ThrowableContent + { + String page_name = req.getPathInfo().substring(1); + FramedData rc = null; + synchronized (cache) + { // look up and see if we already have the page data cached + rc = (FramedData)(cache.get(page_name)); + if (rc==null) + { // we have to map the name to a static path and thence to a real filename + String locator = req.getStaticPath(page_name); + String real_path = req.mapPath(locator); + if (real_path==null) + { // the mapper doesn't work! + logger.error("FrameServlet: locator \"" + locator + "\" does not map"); + return new ErrorBox(null,"The static document \"" + locator + "\" was not found.",null); + + } // end if + + // create new FramedData object and add it to the cache + rc = new FramedData(locator,real_path); // may throw an ErrorBox + cache.put(page_name,rc); + + } // end if + + } // end synchronized block + + return rc; + + } // end process + +} // end class FrameServlet diff --git a/src/com/silverwrist/venice/servlets/FrameStatic.java b/src/com/silverwrist/venice/ui/servlet/GatewayServlet.java similarity index 53% rename from src/com/silverwrist/venice/servlets/FrameStatic.java rename to src/com/silverwrist/venice/ui/servlet/GatewayServlet.java index 88675db..97f5b04 100644 --- a/src/com/silverwrist/venice/servlets/FrameStatic.java +++ b/src/com/silverwrist/venice/ui/servlet/GatewayServlet.java @@ -15,49 +15,44 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; +import java.net.URLEncoder; +import javax.servlet.http.HttpServletResponse; import org.apache.log4j.*; import com.silverwrist.venice.core.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.view.*; -public class FrameStatic extends VeniceServlet +public class GatewayServlet extends BaseServlet { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(FrameStatic.class); + private static Category logger = Category.getInstance(GatewayServlet.class); /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public String getServletInfo() + public Object process(RequestInput req) { - String rc = "FrameStatic servlet - Displays a static page inside the Venice \"frame\"\n" - + "Part of the Venice Web Communities System\n"; - return rc; + String target = req.getQueryString(); + if (target==null) + return new HTTPError(HttpServletResponse.SC_BAD_REQUEST,"no parameter specified"); + if (logger.isDebugEnabled()) + logger.debug("they want to redirect to: " + target); + if (req.getUser().isLoggedIn()) + return new Redirect(target,LinkTypes.ABSOLUTE); + else + return new Redirect("login.js.vs?tgt=" + URLEncoder.encode(target),LinkTypes.SERVLET); - } // end getServletInfo + } // end process - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult - { - setMyLocation(request,"frame" + request.getPathInfo()); - return StaticRender.getStaticRender(request.getPathInfo().substring(1)); - - } // end doVeniceGet - -} // end class FrameStatic +} // end class GatewayServlet diff --git a/src/com/silverwrist/venice/servlets/CommunityProfile.java b/src/com/silverwrist/venice/ui/servlet/GetImageServlet.java similarity index 52% rename from src/com/silverwrist/venice/servlets/CommunityProfile.java rename to src/com/silverwrist/venice/ui/servlet/GetImageServlet.java index 674e3fd..811317b 100644 --- a/src/com/silverwrist/venice/servlets/CommunityProfile.java +++ b/src/com/silverwrist/venice/ui/servlet/GetImageServlet.java @@ -15,55 +15,49 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; -import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.http.HttpServletResponse; +import org.apache.log4j.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; -public class CommunityProfile extends VeniceServlet +public class GetImageServlet extends BaseServlet { /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet + * Static data members *-------------------------------------------------------------------------------- */ - public String getServletInfo() - { - String rc = "CommunityProfile servlet - Displays the profile of a community\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo + private static Category logger = Category.getInstance(GetImageServlet.class); /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult + public Object process(RequestInput req) throws Exception, ThrowableContent { - // get the community - CommunityContext comm = getCommunityParameter(request,user,true,"top"); - setMyLocation(request,"sigprofile?sig=" + comm.getCommunityID()); - try - { // create the profile display - changeMenuCommunity(request,comm); - return new CommunityProfileData(engine,user,comm); + { // parse the image ID, get the data, and return it + int imgid = Integer.parseInt(req.getPathInfo().substring(1)); + BinaryData image = req.getEngine().loadImage(imgid); + return new BinaryDataContent(image); } // end try + catch (NumberFormatException nfe) + { // invalid image URL + return new HTTPError(HttpServletResponse.SC_BAD_REQUEST,nfe); + + } // end catch catch (DataException de) - { // in this case, we had database trouble - return new ErrorBox("Database Error","Database error accessing community: " + de.getMessage(),"top"); + { // unable to get the user name + return new HTTPError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,de); } // end catch - } // end doVeniceGet + } // end process -} // end class CommunityProfile +} // end class GetImageServlet diff --git a/src/com/silverwrist/venice/servlets/PasswordRecovery.java b/src/com/silverwrist/venice/ui/servlet/PasswordRecoveryServlet.java similarity index 66% rename from src/com/silverwrist/venice/servlets/PasswordRecovery.java rename to src/com/silverwrist/venice/ui/servlet/PasswordRecoveryServlet.java index b7fe414..f59d479 100644 --- a/src/com/silverwrist/venice/servlets/PasswordRecovery.java +++ b/src/com/silverwrist/venice/ui/servlet/PasswordRecoveryServlet.java @@ -15,90 +15,76 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; import org.apache.log4j.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.view.*; -public class PasswordRecovery extends VeniceServlet +public class PasswordRecoveryServlet extends BaseServlet { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(PasswordRecovery.class); + private static Category logger = Category.getInstance(PasswordRecoveryServlet.class); /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public String getServletInfo() - { - String rc = "PasswordRecovery servlet - Chnages passwords for users that forgot them\n" - + "Part of the Venice Web Communities System\n"; - return rc; - - } // end getServletInfo - - /*-------------------------------------------------------------------------------- - * Overrides from class VeniceServlet - *-------------------------------------------------------------------------------- - */ - - protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, - UserContext user, RenderData rdat) - throws ServletException, IOException, VeniceServletResult + public Object process(RequestInput req) { int uid, auth; try { // retrieve UID and authentication strings from URL - String foo = request.getPathInfo().substring(1); + String foo = req.getPathInfo().substring(1); int n = foo.indexOf('.'); if (n<0) - return new ErrorBox(null,"Invalid parameters to password recovery.","top"); + return new ErrorBox(null,"Invalid parameters to password recovery.","top.js.vs"); uid = Integer.parseInt(foo.substring(0,n)); auth = Integer.parseInt(foo.substring(n+1)); } // end try catch (NumberFormatException nfe) { // invalid parameters passed... - return new ErrorBox(null,"Invalid parameters to password recovery.","top"); + return new ErrorBox(null,"Invalid parameters to password recovery.","top.js.vs"); } // end catch try { // complete the password change - engine.completePasswordChange(uid,auth); + req.getEngine().completePasswordChange(uid,auth); // now return a "password changed" page - changeMenuTop(request); - setMyLocation(request,"top"); // lie so that we get the "Log In" link up top - return new PasswordChanged(); + req.setLocation("top.js.vs"); // lie so that we get the "Log In" link up top + JSPView view = new JSPView("Your Password Has Been Changed","password_changed.jsp"); + view.setMenuSelector(Content.MENU_SELECTOR_TOP); + return view; } // end try catch (DataException de) { // there was a database error changing your password - return new ErrorBox("Database Error","Database error changing password: " + de.getMessage(),"top"); + return new ErrorBox("Database Error","Database error changing password: " + de.getMessage(),"top.js.vs"); } // end catch catch (AccessError ae) { // this indicates a problem with the request ID or authentication - return new ErrorBox("Invalid Request",ae.getMessage(),"top"); + return new ErrorBox("Invalid Request",ae.getMessage(),"top.js.vs"); } // end catch catch (EmailException ee) { // error sending the confirmation email - return new ErrorBox("E-mail Error","E-mail error sending update: " + ee.getMessage(),"top"); + return new ErrorBox("E-mail Error","E-mail error sending update: " + ee.getMessage(),"top.js.vs"); } // end catch - } // end doVeniceGet + } // end process -} // end class PasswordRecovery +} // end class PasswordRecoveryServlet diff --git a/src/com/silverwrist/venice/servlets/format/SystemAdminTop.java b/src/com/silverwrist/venice/ui/servlet/RemapperServlet.java similarity index 56% rename from src/com/silverwrist/venice/servlets/format/SystemAdminTop.java rename to src/com/silverwrist/venice/ui/servlet/RemapperServlet.java index e0ef1af..6035b1a 100644 --- a/src/com/silverwrist/venice/servlets/format/SystemAdminTop.java +++ b/src/com/silverwrist/venice/ui/servlet/RemapperServlet.java @@ -15,45 +15,43 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.servlet; -import java.util.*; -import java.io.Writer; -import java.io.IOException; +import javax.servlet.*; +import org.apache.log4j.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.*; -public class SystemAdminTop extends ContentMenuPanel +public class RemapperServlet extends BaseServlet { /*-------------------------------------------------------------------------------- - * Constructors + * Static data members *-------------------------------------------------------------------------------- */ - public SystemAdminTop() - { - super("System Administration",null); - addChoice("Edit Global Properties","sysadmin?cmd=G"); - addChoice("View/Edit Banned Users","TODO"); - addChoice("User Account Management","sysadmin?cmd=UF"); - addChoice("System Audit Logs","sysadmin?cmd=A"); - addChoice("Import User Accounts","sysadmin?cmd=IMP"); + private static Category logger = Category.getInstance(RemapperServlet.class); - } // end constructor - - protected SystemAdminTop(SystemAdminTop other) - { - super(other); - - } // end constructor + private static final String REMAPPER_ATTR = "servlets.remapper.Remapper"; /*-------------------------------------------------------------------------------- - * External operations + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public Object clone() + protected void init(ServletConfig config, ServletContext ctxt, VeniceEngine engine, RootConfig root, + String root_file_path) { - return new SystemAdminTop(this); + Remapper r = root.getRemapper(); + RequestImpl.setAppAttribute(ctxt,REMAPPER_ATTR,r); - } // end clone + } // end init -} // end class SystemAdminTop + public Object process(RequestInput req) + { + Remapper r = (Remapper)(req.getAppAttribute(REMAPPER_ATTR)); + return r.remapRequest(req); + + } // end process + +} // end class RemapperServlet diff --git a/src/com/silverwrist/venice/ui/servlet/RequestImpl.java b/src/com/silverwrist/venice/ui/servlet/RequestImpl.java new file mode 100644 index 0000000..d91b179 --- /dev/null +++ b/src/com/silverwrist/venice/ui/servlet/RequestImpl.java @@ -0,0 +1,1718 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>. + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.servlet; + +import java.awt.Dimension; +import java.io.*; +import java.lang.ref.*; +import java.sql.Blob; +import java.sql.SQLException; +import java.text.DateFormat; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.log4j.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.config.*; +import com.silverwrist.venice.ui.dlg.Dialog; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.menus.CommunityMenu; +import com.silverwrist.venice.ui.menus.Menu; +import com.silverwrist.venice.ui.menus.MenuComponent; +import com.silverwrist.venice.ui.script.*; + +public class RequestImpl implements RequestInput +{ + /*-------------------------------------------------------------------------------- + * Internal class which implements the output. + *-------------------------------------------------------------------------------- + */ + + class OutputImpl implements RequestOutput + { + private Writer wr = null; + + OutputImpl() + { // do nothing + } // end constructor + + public Writer getWriter() throws IOException + { + if (wr==null) + wr = response.getWriter(); + return wr; + + } // end getWriter + + public void write(String s) throws IOException + { + if (wr==null) + wr = response.getWriter(); + wr.write(s); + + } // end write + + public void writeStackTrace(Throwable t) throws IOException + { + if (wr==null) + wr = response.getWriter(); + PrintWriter tmp; + if (wr instanceof PrintWriter) + tmp = (PrintWriter)wr; + else + tmp = new PrintWriter(wr); + t.printStackTrace(tmp); + if (!(wr instanceof PrintWriter)) + tmp.flush(); + + } // end writeStackTrace + + public void flush() throws IOException + { + if (wr!=null) + wr.flush(); + response.flushBuffer(); + + } // end flush + + public void output(Content c) throws IOException, ServletException + { + if (c instanceof ContentDirect) + { // render the content object here + ContentDirect cd = (ContentDirect)c; + if (wr!=null) + { // attempt to flush the writer + try + { // flush the output + wr.flush(); + + } // end try + catch (IOException e) + { // do nothing + } // end catch + + } // end if + + response.flushBuffer(); // flush the previous stuff to disk + cd.render(this); + response.flushBuffer(); // flush the included page properly + return; + + } // end if + + if (c instanceof ContentJSP) + { // include the JSP page here + ContentJSP cj = (ContentJSP)c; + RequestDispatcher disp = ctxt.getRequestDispatcher(config.getFormatJSPPath(cj.getJSPName())); + + // Configure the request attributes. + request.setAttribute(REQUEST_INPUT,(RequestInput)(RequestImpl.this)); + request.setAttribute(REQUEST_OUTPUT,(RequestOutput)this); + Object stack = request.getAttribute(REQUEST_CONTENT); + request.setAttribute(REQUEST_CONTENT,c); + + // Configure the writer, if it's present. + if (wr!=null) + { // attempt to flush the writer + try + { // flush the output + wr.flush(); + + } // end try + catch (IOException e) + { // do nothing + } // end catch + + } // end if + + Writer wr_stack = wr; + wr = null; + + cj.initialize(RequestImpl.this); + try + { // Include the content now! + response.flushBuffer(); // flush the previous stuff to disk + disp.include(request,response); // include the JSP + if (wr!=null) + wr.flush(); + response.flushBuffer(); // flush the included page properly + + } // end try + finally + { // Clean up the stacked objects. + cj.terminate(RequestImpl.this); + wr = wr_stack; + if (stack==null) + request.removeAttribute(REQUEST_CONTENT); + else + request.setAttribute(REQUEST_CONTENT,stack); + + } // end finally + + return; + + } // end if + + // if nothing else... + this.write(c.toString()); + + } // end output + + public void output(Writer out, Content c) throws IOException, ServletException + { + if (c instanceof ContentDirect) + { // do a ContentDirect render, but replace the internal Writer with the specified one + // before we do so + ContentDirect cd = (ContentDirect)c; + if (wr!=null) + { // attempt to flush the writer + try + { // flush the output + wr.flush(); + + } // end try + catch (IOException e) + { // do nothing + } // end catch + + } // end if + + Writer wr_stack = wr; + wr = out; + try + { // do the actual output + cd.render(this); + wr.flush(); + + } // end try + finally + { // restore the stacked stuff before we go + wr = wr_stack; + + } // end finally + + return; + + } // end if + + this.output(c); // fall back in ContentJSP case + + } // end output + + public void writeFrameHead(Writer out, Content c) throws IOException + { + out.write("<HEAD>\n<TITLE>" + config.getPageTitle(c.getPageTitle(this)) + "\n" + + config.getBaseFontTag() + "\n"); + if (config.usingStyleSheet()) + out.write("\n"); + String tmp = config.getPageIconTags(); + if (tmp!=null) + out.write(tmp); + if (!(config.useSmartTags())) + out.write("\n"); + out.write("\n"); + + } // end writeFrameHead + + public void writeFrameHead(Content c) throws IOException + { + if (wr==null) + wr = response.getWriter(); + this.writeFrameHead(wr,c); + + } // end writeFrameHead + + public void writeSiteImageTag(Writer out) throws IOException + { + String href = config.getSiteLogoLink(); + if (href!=null) + out.write(""); + out.write(config.getSiteLogoImageTag()); + if (href!=null) + out.write(""); + + } // end writeSiteImageTag + + public void writeSiteImageTag() throws IOException + { + if (wr==null) + wr = response.getWriter(); + this.writeSiteImageTag(wr); + + } // end writeSiteImageTag + + public void writeVeniceLogo(Writer out) throws IOException + { + out.write(config.getVeniceLogoTag()); + + } // end writeVeniceLogo + + public void writeVeniceLogo() throws IOException + { + if (wr==null) + wr = response.getWriter(); + this.writeVeniceLogo(wr); + + } // end writeVeniceLogo + + public void writeContentHeader(Writer out, String primary, String secondary) throws IOException + { + out.write(config.getContentHeader(primary,secondary)); + + } // end writeContentHeader + + public void writeContentHeader(String primary, String secondary) throws IOException + { + if (wr==null) + wr = response.getWriter(); + wr.write(config.getContentHeader(primary,secondary)); + + } // end writeContentHeader + + public String formatURL(String url, int type) + { + return RequestImpl.this.formatURL(url,type); + + } // end formatURL + + public String formatDate(Date date) + { + return RequestImpl.this.formatDate(date); + + } // end formatDate + + public String getColor(int selector) + { + return config.getColor(selector); + + } // end getColor + + public String getColor(String name) + { + return config.getColor(name); + + } // end getColor + + public String getFontTag(int colorsel, int size) + { + return config.getFontTag(colorsel,size); + + } // end getFontTag + + public String getFontTag(String color, int size) + { + return config.getFontTag(color,size); + + } // end getFontTag + + public String getFontTag(int colorsel, String size) + { + return config.getFontTag(colorsel,size); + + } // end getFontTag + + public String getFontTag(String color, String size) + { + return config.getFontTag(color,size); + + } // end getFontTag + + public String getStockMessage(String key) + { + return config.getStockMessage(key); + + } // end getStockMessage + + public String getStockMessage(String key, Map vars) + { + return config.getStockMessage(key,vars); + + } // end getStockMessage + + public String getStaticPath(String s) + { + return config.getStaticPath(s); + + } // end getStaticPath + + public String getExternalStaticPath(String s) + { + return config.getExternalStaticPath(s); + + } // end getExternalStaticPath + + public String getImagePath(String s) + { + return config.getImagePath(s); + + } // end getImagePath + + public String getButtonVisual(String id) + { + return config.getButtonVisual(id); + + } // end getButtonVisual + + public String getButtonInput(String id) + { + return config.getButtonInput(id); + + } // end getButtonInput + + public String getUserPhotoTag(String url) + { + return RequestImpl.this.getUserPhotoTag(url,engine.getUserPhotoSize()); + + } // end getUserPhotoTag + + public String getUserPhotoTag(String url, Dimension size) + { + return RequestImpl.this.getUserPhotoTag(url,size); + + } // end getUserPhotoTag + + public String getActivityString(Date date) + { + return RequestImpl.this.getActivityString(date); + + } // end getActivityString + + public String getCommunityLogoTag(String url) + { + return RequestImpl.this.getCommunityLogoTag(url); + + } // end getCommunityLogoTag + + } // end class OutputImpl + + /*-------------------------------------------------------------------------------- + * Internal class which implements the execution output. + *-------------------------------------------------------------------------------- + */ + + class ExecImpl implements RequestExec + { + ExecImpl() + { // do nothing + } // end constructor + + public void error(int code) throws IOException + { + flushCookies(); + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.error(): code " + code); + response.sendError(code); + + } // end sendError + + public void error(int code, String message) throws IOException + { + flushCookies(); + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.error(): code " + code + ", msg: " + message); + if (message==null) + response.sendError(code); + else + response.sendError(code,message); + + } // end sendError + + public void redirect(String where, int type) throws IOException + { + flushCookies(); + String fmt_url; + if (type==ABSOLUTE) + fmt_url = where; + else if (type==SERVLET) + fmt_url = response.encodeRedirectURL(request.getContextPath() + "/" + where); + else if (type==FRAME) + fmt_url = response.encodeRedirectURL(request.getContextPath() + "/frame/" + where); + else + throw new IndexOutOfBoundsException("invalid format type index for redirect"); + + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.redirect(): going to \"" + fmt_url + "\""); + response.sendRedirect(fmt_url); + + } // end redirect + + public void noContent() + { + flushCookies(); + response.setStatus(HttpServletResponse.SC_NO_CONTENT); + + } // end noContent + + public void sendBinary(String type, String filename, int length, InputStream data) throws IOException + { + flushCookies(); + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.sendBinary(): MIME " + type + ", filename \"" + filename + + "\", length " + length); + response.setContentType(type); + response.setContentLength(length); + addDynamicHeaders(); + if (filename!=null) // make sure we pass the filename along, too + response.setHeader("Content-Disposition","attachment; filename=\"" + filename + "\";"); + + // Copy the contents of the "data" stream to the output. + IOUtil.copy(data,response.getOutputStream()); + response.flushBuffer(); + + } // end sendBinary + + public void sendBinary(String type, int length, InputStream data) throws IOException + { + this.sendBinary(type,null,length,data); + + } // end sendBinary + + public void sendBinary(String type, String filename, Blob data) throws IOException, SQLException + { + this.sendBinary(type,filename,(int)(data.length()),data.getBinaryStream()); + + } // end sendBinary + + public void sendBinary(String type, Blob data) throws IOException, SQLException + { + this.sendBinary(type,null,(int)(data.length()),data.getBinaryStream()); + + } // end sendBinary + + public void sendBinary(String type, String filename, byte[] data) throws IOException + { + this.sendBinary(type,filename,data.length,new ByteArrayInputStream(data)); + + } // end sendBinary + + public void sendBinary(String type, byte[] data) throws IOException + { + this.sendBinary(type,null,data.length,new ByteArrayInputStream(data)); + + } // end sendBinary + + public void sendText(String type, String data) throws IOException + { + flushCookies(); + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.sendText(): MIME " + type + ", length " + data.length()); + response.setContentType(type); + response.setContentLength(data.length()); + addDynamicHeaders(); + Writer wr = response.getWriter(); + wr.write(data); + wr.flush(); + response.flushBuffer(); + + } // end sendText + + public void sendText(String type, char[] data) throws IOException + { + flushCookies(); + if (logger.isDebugEnabled()) + logger.debug("ExecImpl.sendText(): MIME " + type + ", length " + data.length); + response.setContentType(type); + response.setContentLength(data.length); + addDynamicHeaders(); + Writer wr = response.getWriter(); + wr.write(data); + wr.flush(); + response.flushBuffer(); + + } // end sendText + + } // end class ExecImpl + + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(RequestImpl.class); + + private static final String STYLESHEET_ATTRIBUTE = "com.silverwrist.venice.rendering.StyleSheet"; + private static final String APP_ATTRIBUTE_STEM = "com.silverwrist.venice.ui.variables."; + + private static final String USERCTXT_ATTRIBUTE = "user.context"; + private static final String SESSION_ATTRIBUTE_STEM = "venice.vars."; + + public static final String REQUEST_CONTENT = "com.silverwrist.venice.ui.Content"; + public static final String REQUEST_INPUT = "com.silverwrist.venice.ui.RequestInput"; + public static final String REQUEST_OUTPUT = "com.silverwrist.venice.ui.RequestOutput"; + public static final String REQUEST_ATTRIBUTE_STEM = "com.silverwrist.venice.ui.variables."; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private ServletContext ctxt; // the servlet context + private HttpServletRequest request; // the servlet request data + private HttpServletResponse response; // the servlet response data + private HttpSession session; // the current HTTP session + private VeniceEngine engine; // the Venice engine context + private RootConfig config; // the UI configuration data + private UserContext user; // the current user context + private ServletMultipartHandler mphandler = null; // if this is a multipart/form-data POST + private ArrayList new_cookies = null; // cookies to be added to the response + private boolean end_response = true; // do we need to properly end the response? + private Locale my_locale; // user's current locale + private TimeZone my_timezone; // user's current time zone + private String location; // current servlet location + private boolean show_login = true; // do we show the login links? + private ScriptManager script_mgr; // the script manager to use for executing script + private DateFormat display_date = null; // format to use for displaying dates + private DateFormat activity_time = null; // format to use for activity string times + private CommunityContext community = null; // the current community + private LinkedList auto_cleanup = null; // auto-cleanup callbacks + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + RequestImpl(ServletContext ctxt, HttpServletRequest request, HttpServletResponse response, + VeniceEngine engine, RootConfig config) throws ServletException + { + // Set up the basic variables. + this.ctxt = ctxt; + this.request = request; + this.response = response; + this.session = request.getSession(true); + this.engine = engine; + this.config = config; + + // Create or retrieve the user context. + user = (UserContext)(session.getAttribute(USERCTXT_ATTRIBUTE)); + if (user==null) + { // the user context isn't present yet + try + { // tell the engine to create us a user context + user = engine.createUserContext(request.getRemoteAddr()); + + // Did the user send a Venice authentication cookie? If so, try to use it. + Cookie[] cookies = request.getCookies(); + Cookie venice_cookie = null; + for (int i=0; (venice_cookie==null) && (ilimit) + script = script.substring(0,x); + + } // end if + + return config.getScriptPath(script); + + } // end getScriptName + + public String getScriptLoggerName(String raw_name) + { + // Strip all extensions from the end of the file. + int limit = raw_name.lastIndexOf('/'); + int x = raw_name.lastIndexOf('.'); + while (x>limit) + { // remove all extensions from the end + raw_name = raw_name.substring(0,x); + x = raw_name.lastIndexOf('.'); + + } // end while + + // convert the name to a logger name + StringBuffer rc = new StringBuffer("SCRIPT."); + for (x=0; x"); + return buf.toString(); + + } // end getUserPhotoTag + + public CommunityContext getCommunity() + { + return community; + + } // end getCommunity + + public CommunityContext getCommunity(boolean required, String on_error) throws ErrorBox + { + if (community!=null) + return community; + + String parm = this.getParameter("cc"); // try the new parameter first + if (StringUtil.isStringEmpty(parm)) + parm = this.getParameter("sig"); // try the old parameter + if (StringUtil.isStringEmpty(parm)) + { // the parameter is not specified... + if (required) + { // no community parameter - bail out now! + logger.error("community parameter not specified!"); + throw new ErrorBox(null,"No community specified.",on_error); + + } // end if + else + { // a null CommunityContext is permitted + logger.debug("no community specified"); + return null; + + } // end else + + } // end if + + try + { // turn the string into a community ID, and thence to a CommunityContext + int tmp_id = Integer.parseInt(parm); + community = user.getCommunityContext(tmp_id); + if (community==null) + { // trap any null results (may not be possible with communities, but you never know) + logger.error("Community #" + tmp_id + " was not found!"); + throw new ErrorBox(null,"The specified community (#" + tmp_id + ") was not found in the database.", + on_error); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("found community #" + community.getCommunityID()); + + } // end try + catch (NumberFormatException nfe) + { // error in Integer.parseInt + logger.error("Cannot convert community parameter '" + parm + "'!"); + throw new ErrorBox(null,"Invalid community parameter.",on_error); + + } // end catch + catch (DataException de) + { // error looking up the community + throw new ErrorBox("Database Error","Database error finding community: " + de.getMessage(),on_error); + + } // end catch + + return community; + + } // end getCommunity + + public String getActivityString(Date date) + { + if (date==null) + return "Never"; // safeguard + + // Set up the two calendars we'll use for comparison. + Calendar c_last = new GregorianCalendar(my_timezone,my_locale); + c_last.setTime(date); + Calendar c_now = new GregorianCalendar(my_timezone,my_locale); + + // Determine the exact number of days in the delta. + int delta_days = 0; + while ( (c_last.get(Calendar.YEAR)!=c_now.get(Calendar.YEAR)) + || (c_last.get(Calendar.DAY_OF_YEAR)!=c_now.get(Calendar.DAY_OF_YEAR))) + { // advance until we're pointing at the same year and the same day of the year + delta_days++; + c_last.add(Calendar.DAY_OF_YEAR,1); + + } // end while + + // For today or yesterday, we want to paste the time in as well. + String s = null; + if (delta_days<=1) + { // set up to convert the time into a string + if (activity_time==null) + { // get the "activity" time formatter + activity_time = DateFormat.getTimeInstance(DateFormat.MEDIUM,my_locale); + activity_time.setTimeZone(my_timezone); + + } // end if + + s = activity_time.format(date); + + } // end if + + // Return the actual activity string. + if (delta_days==0) + return "Today, " + s; + else if (delta_days==1) + return "Yesterday, " + s; + else + return String.valueOf(delta_days) + " days ago"; + + } // end getActivityString + + public String getDefaultServletAddress(CommunityContext comm) + { + return config.getDefaultServletAddress(this,comm); + + } // end getDefaultServletAddress + + public String getCommunityLogoTag(String url) + { + StringBuffer buf = new StringBuffer("\"\""); + return buf.toString(); + + } // end getCommunityLogoTag + + public String expandServletPath(String spath) + { + StringBuffer buf = new StringBuffer("http://"); + buf.append(request.getServerName()); + if (request.getServerPort()!=80) + buf.append(':').append(request.getServerPort()); + buf.append(request.getContextPath()).append('/').append(spath); + return buf.toString(); + + } // end expandServletPath + + public void registerCleanup(AutoCleanup ac) + { + if (auto_cleanup==null) + auto_cleanup = new LinkedList(); + auto_cleanup.addFirst(ac); + + } // end registerCleanup + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public final static Object getAppAttribute(ServletContext ctxt, String name) + { + return ctxt.getAttribute(APP_ATTRIBUTE_STEM + name); + + } // end getAppAttribute + + public final static void setAppAttribute(ServletContext ctxt, String name, Object o) + { + if (o==null) + ctxt.removeAttribute(APP_ATTRIBUTE_STEM + name); + else + ctxt.setAttribute(APP_ATTRIBUTE_STEM + name,o); + + } // end setAppAttribute + + public final static Object getSessionAttribute(HttpSession session, String name) + { + return session.getAttribute(SESSION_ATTRIBUTE_STEM + name); + + } // end getSessionAttribute + + public final static void setSessionAttribute(HttpSession session, String name, Object o) + { + if (o==null) + session.removeAttribute(SESSION_ATTRIBUTE_STEM + name); + else + session.setAttribute(SESSION_ATTRIBUTE_STEM + name,o); + + } // end setSessionAttribute + + public final static Object getSessionAttribute(HttpServletRequest request, String name) + { + HttpSession session = request.getSession(true); + return ((session!=null) ? getSessionAttribute(session,name) : null); + + } // end getSessionAttribute + + public final static void setSessionAttribute(HttpServletRequest request, String name, Object o) + { + HttpSession session = request.getSession(true); + if (session!=null) + setSessionAttribute(session,name,o); + + } // end setSessionAttribute + + public final static Object getRequestAttribute(ServletRequest request, String name) + { + return request.getAttribute(REQUEST_ATTRIBUTE_STEM + name); + + } // end getRequestAttribute + + public final static void setRequestAttribute(ServletRequest request, String name, Object o) + { + if (o==null) + request.removeAttribute(REQUEST_ATTRIBUTE_STEM + name); + else + request.setAttribute(REQUEST_ATTRIBUTE_STEM + name,o); + + } // end setRequestAttribute + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + void output(Content content) throws ServletException, IOException + { + if (content.needFrame()) + { // get the frame JSP and pass it along + RequestDispatcher disp = ctxt.getRequestDispatcher(config.getFrameJSPName()); + request.setAttribute(REQUEST_INPUT,(RequestInput)this); + request.setAttribute(REQUEST_OUTPUT,(RequestOutput)(new OutputImpl())); + request.setAttribute(REQUEST_CONTENT,content); + updateMenus(content); + addDynamicHeaders(); + flushCookies(); + try + { // forward it! + disp.forward(request,response); + + } // end try + finally + { // make sure we end the response properly + end_response = false; + + } // end finally + + } // end if + else if (content instanceof ContentJSP) + { // transfer straight to the top-level JSP + ContentJSP cj = (ContentJSP)content; + RequestDispatcher disp = ctxt.getRequestDispatcher(config.getFormatJSPPath(cj.getJSPName())); + request.setAttribute(REQUEST_INPUT,(RequestInput)this); + request.setAttribute(REQUEST_OUTPUT,(RequestOutput)(new OutputImpl())); + request.setAttribute(REQUEST_CONTENT,content); + updateMenus(content); + addDynamicHeaders(); + flushCookies(); + cj.initialize(this); + try + { // forward the response + disp.forward(request,response); + + } // end try + finally + { // make sure we terminate, even on error + cj.terminate(this); + end_response = false; + + } // end finally + + } // end else if + else + { // use OutputImpl to handle the rest + OutputImpl oi = new OutputImpl(); + response.setContentType("text/html"); + updateMenus(content); + addDynamicHeaders(); + flushCookies(); + oi.output(content); + + } // end else + + } // end output + + void outputRaw(String data) throws ServletException, IOException + { + OutputImpl oi = new OutputImpl(); + response.setContentType("text/html"); + updateMenus(Content.MENU_SELECTOR_NOCHANGE); + addDynamicHeaders(); + flushCookies(); + oi.write(data); + oi.flush(); + + } // end data + + void execute(ContentExecute content) throws IOException + { + try + { // perform the execute + content.execute(new ExecImpl()); + + } // end try + finally + { // still set the flag on error + end_response = false; + + } // end finally + + } // end execute + + void end() + { + if (end_response) + { // we can touch the response object when we end... + try + { // flush the response buffer + response.flushBuffer(); + + } // end try + catch (IOException e) + { // just print a warning message + logger.warn("IOException flushing buffer in end()",e); + + } // end catch + + } // end if + + // perform automatic cleanups + if (auto_cleanup!=null) + while (auto_cleanup.size()>0) + { // pop items off and clean them up + AutoCleanup ac = (AutoCleanup)(auto_cleanup.removeFirst()); + ac.cleanup(); + + } // end while and if + + // blow a bunch of our object fields to hell (this might make garbage collection easier) + auto_cleanup = null; + community = null; + activity_time = null; + display_date = null; + my_locale = null; + my_timezone = null; + mphandler = null; + request = null; + response = null; + session = null; + + // release the script manager + script_mgr.popContext(); + ScriptManagerContainer cnr = ScriptManagerContainer.get(ctxt); + cnr.releaseScriptManager(script_mgr); + script_mgr = null; + + } // end end + +} // end class RequestImpl diff --git a/src/com/silverwrist/venice/servlets/VeniceServletResult.java b/src/com/silverwrist/venice/ui/servlet/ScriptExecServlet.java similarity index 57% rename from src/com/silverwrist/venice/servlets/VeniceServletResult.java rename to src/com/silverwrist/venice/ui/servlet/ScriptExecServlet.java index 5736cca..a5bdad9 100644 --- a/src/com/silverwrist/venice/servlets/VeniceServletResult.java +++ b/src/com/silverwrist/venice/ui/servlet/ScriptExecServlet.java @@ -15,45 +15,39 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; -import java.io.PrintWriter; -import java.io.PrintStream; +import java.io.*; +import org.apache.log4j.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.script.*; -public class VeniceServletResult extends Throwable +public class ScriptExecServlet extends BaseServlet { /*-------------------------------------------------------------------------------- - * Constructor + * Static data members *-------------------------------------------------------------------------------- */ - public VeniceServletResult() - { - super(); - - } // end constructor + private static Category logger = Category.getInstance(ScriptExecServlet.class); /*-------------------------------------------------------------------------------- - * Overrides from class Throwable + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public final void printStackTrace() - { // do nothing - this isn't really an error - } // end printStackTrace + public Object process(RequestInput req) throws Exception, ThrowableContent + { + String script_file = req.getScriptName(true); + String logger_name = req.getScriptLoggerName(); + if (logger.isDebugEnabled()) + logger.debug("EXECUTING " + script_file); + ScriptManager smgr = req.getScriptManager(); + ScriptReturn sro = new ScriptReturn(); + smgr.exec(new File(script_file),logger_name,sro); + return sro.get(); - public final void printStackTrace(PrintStream s) - { // do nothing - this isn't really an error - } // end printStackTrace + } // end process - public final void printStackTrace(PrintWriter s) - { // do nothing - this isn't really an error - } // end printStackTrace - - public final Throwable fillInStackTrace() - { // do nothing - this isn't really an error - return this; - - } // end fillInStackTrace - -} // end class VeniceServletResult +} // end class ScriptExecServlet diff --git a/src/com/silverwrist/venice/ui/servlet/StyleSheetServlet.java b/src/com/silverwrist/venice/ui/servlet/StyleSheetServlet.java new file mode 100644 index 0000000..876f619 --- /dev/null +++ b/src/com/silverwrist/venice/ui/servlet/StyleSheetServlet.java @@ -0,0 +1,75 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.servlet; + +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.silverwrist.venice.ui.*; + +public class StyleSheetServlet extends BaseServlet +{ + /*-------------------------------------------------------------------------------- + * Internal class for returning the stylesheet data. + *-------------------------------------------------------------------------------- + */ + + static class StyleSheetOutput implements ContentExecute + { + private String data; // the data to output + + StyleSheetOutput(String data) + { + this.data = data; + + } // end constructor + + public void execute(RequestExec req) throws IOException + { + if (data!=null) // send the data + req.sendText("text/css",data); + else // No stylesheet present - send back an error + req.error(HttpServletResponse.SC_NOT_FOUND,"stylesheets not enabled"); + + } // end execute + + } // end class StyleSheetOutput + + /*-------------------------------------------------------------------------------- + * Implementations from class BaseServlet + *-------------------------------------------------------------------------------- + */ + + public Object process(RequestInput req) + { + String data; + try + { // get the data from the request object + data = req.getStyleSheetData(); + + } // end try + catch (IOException e) + { // we can't load it + data = null; + + } // end catch + + return new StyleSheetOutput(data); + + } // end process + +} // end class StyleSheetServlet diff --git a/src/com/silverwrist/venice/servlets/MemberRedirect.java b/src/com/silverwrist/venice/ui/servlet/UserServlet.java similarity index 53% rename from src/com/silverwrist/venice/servlets/MemberRedirect.java rename to src/com/silverwrist/venice/ui/servlet/UserServlet.java index c5a2752..ad37d9a 100644 --- a/src/com/silverwrist/venice/servlets/MemberRedirect.java +++ b/src/com/silverwrist/venice/ui/servlet/UserServlet.java @@ -15,49 +15,45 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets; +package com.silverwrist.venice.ui.servlet; import java.io.*; -import javax.servlet.*; -import javax.servlet.http.*; import org.apache.log4j.*; -import com.silverwrist.venice.servlets.format.RenderConfig; -import com.silverwrist.venice.servlets.format.RenderData; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.*; +import com.silverwrist.venice.ui.script.*; -public class MemberRedirect extends HttpServlet +public class UserServlet extends BaseServlet { /*-------------------------------------------------------------------------------- * Static data members *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(MemberRedirect.class); + private static Category logger = Category.getInstance(UserServlet.class); + + private static final String SCRIPT_EXEC = "showuser.js"; /*-------------------------------------------------------------------------------- - * Overrides from class HttpServlet + * Implementations from class BaseServlet *-------------------------------------------------------------------------------- */ - public String getServletInfo() + public Object process(RequestInput req) throws Exception, ThrowableContent { - String rc = "MemberRedirect servlet - Generates the member list for the community\n" - + "Part of the Venice Web Communities System\n"; - return rc; + String uname = req.getPathInfo().substring(1); // the username we're looking at + req.setRequestAttribute("username",uname); - } // end getServletInfo - - public void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { + // Set up to execute a script to handle this request. + String script_file = req.getScriptName(SCRIPT_EXEC); + String logger_name = req.getScriptLoggerName(SCRIPT_EXEC); if (logger.isDebugEnabled()) - logger.debug("Hit MemberRedirect"); - ServletContext ctxt = getServletContext(); - RenderData rdat = RenderConfig.createRenderData(ctxt,request,response); - String url = "sigops?cmd=M&sig=" + request.getParameter("sig"); - if (logger.isDebugEnabled()) - logger.debug("Bouncing to URL: " + url); - rdat.redirectTo(url); + logger.debug("EXECUTING " + script_file); + ScriptManager smgr = req.getScriptManager(); + ScriptReturn sro = new ScriptReturn(); + smgr.exec(new File(script_file),logger_name,sro); + return sro.get(); - } // end doGet + } // end process -} // end class MemberRedirect +} // end class UserServlet diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/CommunityBox.java b/src/com/silverwrist/venice/ui/sidebox/CommunityBox.java similarity index 79% rename from src/com/silverwrist/venice/servlets/format/sideboxes/CommunityBox.java rename to src/com/silverwrist/venice/ui/sidebox/CommunityBox.java index 61d898e..0848d71 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/CommunityBox.java +++ b/src/com/silverwrist/venice/ui/sidebox/CommunityBox.java @@ -15,16 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.sidebox; -import java.io.*; +import java.io.IOException; import java.util.*; import org.w3c.dom.*; -import com.silverwrist.util.DOMElementHelper; -import com.silverwrist.util.StringUtil; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.ImageHandler; public class CommunityBox implements SideBoxFactory { @@ -33,7 +33,7 @@ public class CommunityBox implements SideBoxFactory *-------------------------------------------------------------------------------- */ - class CommunityBoxImpl implements ContentRender, ColorSelectors + class CommunityBoxImpl implements ContentDirect, ColorSelectors, LinkTypes { private UserContext uc; private List comm_list; @@ -45,12 +45,24 @@ public class CommunityBox implements SideBoxFactory } // end constructor - public String getPageTitle(RenderData rdat) + public boolean needFrame() + { + return false; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) { if (title_image!=null) { // return an image rendering ImageHandler ih = (uc.isLoggedIn() ? title_image : anon_title_image); - return ih.getRendering(rdat); + return ih.getRendering(ro); } // end if else @@ -68,25 +80,26 @@ public class CommunityBox implements SideBoxFactory } // end getPageQID - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { if (comm_list.size()>0) { // load up the rendering data and render the contents of the list - String link_font = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2); + String link_font = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox"); out.write("\n"); Iterator it = comm_list.iterator(); while (it.hasNext()) { // write each community out in turn CommunityContext comm = (CommunityContext)(it.next()); out.write("\n\n
"); - bullet.renderHere(out,rdat); + bullet.render(out); out.write("\n" + link_font + "" + + out.formatURL("community/" + comm.getAlias(),SERVLET) + "\">" + link_font + "" + StringUtil.encodeHTML(comm.getName()) + "\n"); + if (comm.isAdmin()) { // write the host tag at the end out.write(" "); - host.renderHere(out,rdat); + host.render(out); } // end if @@ -98,22 +111,23 @@ public class CommunityBox implements SideBoxFactory } // end if else // write the "no communities" message - out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "" + null_message + "\n"); + out.write(out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox") + "" + + StringUtil.encodeHTML(null_message) + "\n"); if (uc.isLoggedIn()) { // write the links at the end - String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1); - out.write("

" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) - + "[ " + hilite + manage_link + " "); + String hilite = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox-footer"); + out.write("

" + out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer") + + "[ " + hilite + StringUtil.encodeHTML(manage_link) + " "); if (uc.canCreateCommunity()) - out.write("| " - + hilite + create_new_link + " "); + out.write("| " + + hilite + StringUtil.encodeHTML(create_new_link) + " "); out.write("]"); } // end if - } // end renderHere + } // end render } // end class CommunityBoxImpl @@ -190,7 +204,7 @@ public class CommunityBox implements SideBoxFactory } // end setConfiguration - public VeniceContent create(VeniceEngine engine, UserContext uc) throws DataException + public Content create(VeniceEngine engine, UserContext uc) throws DataException { return new CommunityBoxImpl(uc); diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java b/src/com/silverwrist/venice/ui/sidebox/ConferenceBox.java similarity index 77% rename from src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java rename to src/com/silverwrist/venice/ui/sidebox/ConferenceBox.java index 316aa51..bc03767 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java +++ b/src/com/silverwrist/venice/ui/sidebox/ConferenceBox.java @@ -15,16 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.sidebox; -import java.io.*; +import java.io.IOException; import java.util.*; import org.w3c.dom.*; -import com.silverwrist.util.DOMElementHelper; -import com.silverwrist.util.StringUtil; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.ImageHandler; public class ConferenceBox implements SideBoxFactory { @@ -33,7 +33,7 @@ public class ConferenceBox implements SideBoxFactory *-------------------------------------------------------------------------------- */ - class ConferenceBoxImpl implements ContentRender, ColorSelectors + class ConferenceBoxImpl implements ContentDirect, ColorSelectors, LinkTypes { private UserContext uc; // current user context private List hotlist; // current conference hotlist @@ -45,12 +45,24 @@ public class ConferenceBox implements SideBoxFactory } // end constructor - public String getPageTitle(RenderData rdat) + public boolean needFrame() + { + return false; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) { if (title_image!=null) { // return an image rendering ImageHandler ih = (uc.isLoggedIn() ? title_image : anon_title_image); - return ih.getRendering(rdat); + return ih.getRendering(ro); } // end if else @@ -68,30 +80,32 @@ public class ConferenceBox implements SideBoxFactory } // end getPageQID - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - String norm_font = rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2); + String norm_font = out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox"); if (hotlist.size()>0) { // write out the hotlist.... - String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2); + String hilite = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox"); out.write("\n"); Iterator it = hotlist.iterator(); while (it.hasNext()) { // get the next hotlist entry and add it to the display ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next()); ConferenceContext conf = hle.getConference(); - String href = "confdisp?sig=" + conf.getEnclosingCommunity().getCommunityID() + "&conf=" + String href = "conf/topics.js.vs?sig=" + conf.getEnclosingCommunity().getCommunityID() + "&conf=" + conf.getConfID(); out.write("\n\n\n
"); - bullet.renderHere(out,rdat); + bullet.render(out); out.write("\n" + norm_font - + "" + hilite + + "" + hilite + StringUtil.encodeHTML(conf.getName()) + " (" + StringUtil.encodeHTML(conf.getEnclosingCommunity().getName()) + ")\n"); if (conf.anyUnread()) { // write out the new-messages tag and its enclosing link - out.write(" "); - newmsg.renderHere(out,rdat); + href = "conf/read_new.js.vs?sig=" + conf.getEnclosingCommunity().getCommunityID() + "&conf=" + + conf.getConfID(); + out.write(" "); + newmsg.render(out); out.write("\n"); } // end if @@ -104,17 +118,18 @@ public class ConferenceBox implements SideBoxFactory } // end if else // write the "null" message - out.write(norm_font + "" + null_message + "\n"); + out.write(norm_font + "" + StringUtil.encodeHTML(null_message) + "\n"); if (uc.isLoggedIn()) { // write the link at the end - out.write("

" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) - + "[ " - + rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1) + manage_link + " ]"); + out.write("

" + out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer") + + "[ " + + out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox-footer") + StringUtil.encodeHTML(manage_link) + + " ]"); } // end if - } // end renderHere + } // end render } // end class ConferenceBoxImpl @@ -186,7 +201,7 @@ public class ConferenceBox implements SideBoxFactory } // end setConfiguration - public VeniceContent create(VeniceEngine engine, UserContext uc) throws DataException + public Content create(VeniceEngine engine, UserContext uc) throws DataException { return new ConferenceBoxImpl(uc); diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java b/src/com/silverwrist/venice/ui/sidebox/JSPSideBox.java similarity index 64% rename from src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java rename to src/com/silverwrist/venice/ui/sidebox/JSPSideBox.java index 7c0f29b..aeb361a 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java +++ b/src/com/silverwrist/venice/ui/sidebox/JSPSideBox.java @@ -15,25 +15,18 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.sidebox; -import java.io.*; +import java.io.IOException; import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; -public class JSPSideBox implements JSPRender +public class JSPSideBox implements ContentJSP { - /*-------------------------------------------------------------------------------- - * Static data members - *-------------------------------------------------------------------------------- - */ - - // Attribute name for request attribute - protected static final String ATTR_NAME = "com.silverwrist.venice.content.sidebox.JSP"; - /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- @@ -57,24 +50,25 @@ public class JSPSideBox implements JSPRender } // end constructor /*-------------------------------------------------------------------------------- - * External static functions + * Implementations from interface Content *-------------------------------------------------------------------------------- */ - public static JSPSideBox retrieve(ServletRequest request) + public boolean needFrame() { - return (JSPSideBox)(request.getAttribute(ATTR_NAME)); + return false; - } // end retrieve + } // end needFrame - /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent - *-------------------------------------------------------------------------------- - */ - - public String getPageTitle(RenderData rdat) + public int getMenuSelector() { - return factory.getTitle(uc.isLoggedIn(),rdat); + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return factory.getTitle(uc.isLoggedIn(),ro); } // end getPageTitle @@ -85,46 +79,48 @@ public class JSPSideBox implements JSPRender } // end getPageQID /*-------------------------------------------------------------------------------- - * Implementations from interface JSPRender + * Implementations from interface ContentJSP *-------------------------------------------------------------------------------- */ - public void store(ServletRequest request) - { - request.setAttribute(ATTR_NAME,this); - - } // end store - - public String getTargetJSPName() + public String getJSPName() { return factory.getTargetJSPName(); - } // end getTargetJSPName + } // end getJSPName + + public void initialize(RequestInput req) + { // do nothing + } // end initialize + + public void terminate(RequestInput req) + { // do nothing + } // end terminate /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- */ - public VeniceEngine getEngine() + public final VeniceEngine getEngine() { return engine; } // end getEngine - public UserContext getUser() + public final UserContext getUser() { return uc; } // end getUser - public String getString(String key) + public final String getString(String key) { return factory.getString(key); } // end getString - public String replaceStrings(String base) + public final String replaceStrings(String base) { return factory.replaceStrings(base); diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java b/src/com/silverwrist/venice/ui/sidebox/JSPSideBoxFactory.java similarity index 89% rename from src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java rename to src/com/silverwrist/venice/ui/sidebox/JSPSideBoxFactory.java index 4298efe..1f18dfc 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java +++ b/src/com/silverwrist/venice/ui/sidebox/JSPSideBoxFactory.java @@ -15,16 +15,16 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.sidebox; -import java.io.*; +import java.io.IOException; import java.util.*; import org.w3c.dom.*; -import com.silverwrist.util.DOMElementHelper; -import com.silverwrist.util.StringUtil; +import com.silverwrist.util.*; import com.silverwrist.venice.core.*; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.ImageHandler; public class JSPSideBoxFactory implements SideBoxFactory { @@ -54,12 +54,12 @@ public class JSPSideBoxFactory implements SideBoxFactory *-------------------------------------------------------------------------------- */ - String getTitle(boolean logged_in, RenderData rdat) + final String getTitle(boolean logged_in, RequestOutput ro) { if (title_image!=null) { // return an image rendering ImageHandler ih = (logged_in ? title_image : anon_title_image); - return ih.getRendering(rdat); + return ih.getRendering(ro); } // end if else @@ -71,19 +71,19 @@ public class JSPSideBoxFactory implements SideBoxFactory } // end getTitle - String getTargetJSPName() + final String getTargetJSPName() { return format_jsp; } // end getTargetJSPName - String getString(String key) + final String getString(String key) { return (String)(strings.get(key)); } // end getString - String replaceStrings(String base) + final String replaceStrings(String base) { return StringUtil.replaceAllVariables(base,strings); @@ -142,7 +142,10 @@ public class JSPSideBoxFactory implements SideBoxFactory } // end for - strings = Collections.unmodifiableMap(tmp); + if (tmp.isEmpty()) + strings = Collections.EMPTY_MAP; + else + strings = Collections.unmodifiableMap(tmp); } // end if else // no replacement strings @@ -150,7 +153,7 @@ public class JSPSideBoxFactory implements SideBoxFactory } // end setConfiguration - public VeniceContent create(VeniceEngine engine, UserContext uc) + public Content create(VeniceEngine engine, UserContext uc) { return new JSPSideBox(this,engine,uc); diff --git a/src/com/silverwrist/venice/ui/sidebox/SideBox.java b/src/com/silverwrist/venice/ui/sidebox/SideBox.java new file mode 100644 index 0000000..ca3739e --- /dev/null +++ b/src/com/silverwrist/venice/ui/sidebox/SideBox.java @@ -0,0 +1,27 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.sidebox; + +import com.silverwrist.venice.ui.RenderDirect; +import com.silverwrist.venice.ui.RequestOutput; + +public interface SideBox extends RenderDirect +{ + public abstract String getTitle(RequestOutput ro); + +} // end interface SideBox diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java b/src/com/silverwrist/venice/ui/sidebox/SideBoxFactory.java similarity index 80% rename from src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java rename to src/com/silverwrist/venice/ui/sidebox/SideBoxFactory.java index e654cac..73b9b13 100644 --- a/src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java +++ b/src/com/silverwrist/venice/ui/sidebox/SideBoxFactory.java @@ -15,19 +15,18 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format.sideboxes; +package com.silverwrist.venice.ui.sidebox; import org.w3c.dom.*; -import com.silverwrist.venice.core.SideBoxDescriptor; -import com.silverwrist.venice.core.UserContext; import com.silverwrist.venice.core.VeniceEngine; +import com.silverwrist.venice.core.UserContext; import com.silverwrist.venice.except.*; -import com.silverwrist.venice.servlets.format.VeniceContent; +import com.silverwrist.venice.ui.Content; public interface SideBoxFactory { public abstract void setConfiguration(Element cfg) throws ConfigException; - public abstract VeniceContent create(VeniceEngine engine, UserContext uc) throws AccessError, DataException; + public abstract Content create(VeniceEngine engine, UserContext uc) throws AccessError, DataException; } // end interface SideBoxFactory diff --git a/src/com/silverwrist/venice/ui/view/AdminFindUserView.java b/src/com/silverwrist/venice/ui/view/AdminFindUserView.java new file mode 100644 index 0000000..d236729 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/AdminFindUserView.java @@ -0,0 +1,223 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class AdminFindUserView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int max_results; // the maximum number of results displayed + private RequestInput rinput = null; // the RequestInput (during execution) + private int field = -1; // search field indicator + private int mode = -1; // search mode indicator + private String term = null; // current search term + private List results = null; // the search results + private int offset = 0; // offset in list of results + private int find_count = 0; // total count of things found + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public AdminFindUserView(int max_results) + { + this.max_results = max_results; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "User Account Management"; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "sysadmin/find_user.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final int getField() + { + return field; + + } // end getField + + public final void setField(int f) + { + if (rinput==null) + this.field = f; + + } // end setField + + public final boolean testField(int val) + { + return (field==val); + + } // end testField + + public final int getMode() + { + return mode; + + } // end getMode + + public final void setMode(int m) + { + if (rinput==null) + this.mode = m; + + } // end setMode + + public final boolean testMode(int val) + { + return (mode==val); + + } // end testMode + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String s) + { + if (rinput==null) + this.term = s; + + } // end setTerm + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List l) + { + if (rinput==null) + this.results = l; + + } // end setResults + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + if (rinput==null) + this.offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int c) + { + if (rinput==null) + this.find_count = c; + + } // end setFindCount + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final AdminFindUserView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("AdminFindUserView.get: unable to get request content"); + if (obj instanceof AdminFindUserView) + return (AdminFindUserView)obj; + throw new ServletException("AdminFindUserView.get: request content is not a AdminFindUserView object"); + + } // end get + +} // end class AdminFindUserView diff --git a/src/com/silverwrist/venice/servlets/format/AuditDataViewer.java b/src/com/silverwrist/venice/ui/view/AuditView.java similarity index 62% rename from src/com/silverwrist/venice/servlets/format/AuditDataViewer.java rename to src/com/silverwrist/venice/ui/view/AuditView.java index 4785dca..d4fa742 100644 --- a/src/com/silverwrist/venice/servlets/format/AuditDataViewer.java +++ b/src/com/silverwrist/venice/ui/view/AuditView.java @@ -15,20 +15,31 @@ * * Contributor(s): */ -package com.silverwrist.venice.servlets.format; +package com.silverwrist.venice.ui.view; -import java.io.*; +import java.io.IOException; import java.util.*; +import javax.servlet.*; import com.silverwrist.util.StringUtil; import com.silverwrist.venice.core.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; -public class AuditDataViewer implements ContentRender, ColorSelectors +public class AuditView implements ContentDirect, ColorSelectors, LinkTypes { + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static final String REPLACE_TOKEN = "${offset}"; + /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ + private int menu_sel = MENU_SELECTOR_NOCHANGE; private List audit_list; private int offset; private int total_count; @@ -36,40 +47,55 @@ public class AuditDataViewer implements ContentRender, ColorSelectors private String title; private String next_url; private String prev_url; + private String return_url; + private String return_text; /*-------------------------------------------------------------------------------- * Constructor *-------------------------------------------------------------------------------- */ - public AuditDataViewer(VeniceEngine engine, List audit_list, int offset, int total_count, String title, - String template_url) + public AuditView(VeniceEngine engine, List audit_list, int offset, int total_count, String title, + String template_url, String return_url, String return_text) { this.audit_list = audit_list; this.offset = offset; this.total_count = total_count; int npage = engine.getNumAuditRecordsPerPage(); - this.last_index = offset + npage; - if (this.last_index>total_count) - this.last_index = total_count; + this.last_index = Math.min(offset + npage,total_count); this.title = title; if (this.last_index0) - this.prev_url = StringUtil.replaceAllInstances(template_url,"%",String.valueOf(offset-npage)); + this.prev_url = StringUtil.replaceAllInstances(template_url,REPLACE_TOKEN, + String.valueOf(Math.max(offset-npage,0))); else this.prev_url = null; + this.return_url = return_url; + this.return_text = return_text; } // end constructor /*-------------------------------------------------------------------------------- - * Implementations from interface VeniceContent + * Implementations from interface Content *-------------------------------------------------------------------------------- */ - public String getPageTitle(RenderData rdat) + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return menu_sel; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) { return title; @@ -82,38 +108,39 @@ public class AuditDataViewer implements ContentRender, ColorSelectors } // end getPageQID /*-------------------------------------------------------------------------------- - * Implementations from interface ContentRender + * Implementations from interface ContentDirect *-------------------------------------------------------------------------------- */ - public void renderHere(Writer out, RenderData rdat) throws IOException + public void render(RequestOutput out) throws IOException { - rdat.writeContentHeader(out,title,null); - + out.writeContentHeader(title,null); + + // Write the return URL + out.write("

" + out.getFontTag(CONTENT_FOREGROUND,"content") + "" + StringUtil.encodeHTML(return_text) + + "
\n"); + // Write the informational and navigational table out.write("
" - + rdat.getStdFontTag(CONTENT_FOREGROUND,2) + "\nDisplaying records " + (offset+1) + + out.getFontTag(CONTENT_FOREGROUND,"content") + "\nDisplaying records " + (offset+1) + " to " + last_index + " of " + total_count + "\n" + "\n"); + if (prev_url==null) - out.write("\"\"\n"); + out.write(out.getButtonVisual("_null_")); else - out.write("\"Previous\""); + out.write("" + out.getButtonVisual("previous") + + ""); out.write(" "); if (next_url==null) - out.write("\"\"\n"); + out.write(out.getButtonVisual("_null_")); else - out.write("\"Next\""); + out.write("" + out.getButtonVisual("next") + ""); out.write("\n
\n"); // Start writing the table containing the actual audit records. - String tb_font = rdat.getStdFontTag(CONTENT_FOREGROUND,2); + String tb_font = out.getFontTag(CONTENT_FOREGROUND,"content"); out.write("\n\n\n\n\n\n\n\n\n
" + tb_font + "Date/Time" + tb_font + "Description" @@ -125,9 +152,8 @@ public class AuditDataViewer implements ContentRender, ColorSelectors while (it.hasNext()) { // display each record in turn AuditData dat = (AuditData)(it.next()); - out.write("
" + tb_font - + rdat.formatDateForDisplay(dat.getDateTime()) - + "" + tb_font + out.write("
" + tb_font + out.formatDate(dat.getDateTime()) + + "" + tb_font + StringUtil.encodeHTML(dat.getDescription()) + "" + tb_font + StringUtil.encodeHTML(dat.getUserName()) @@ -152,6 +178,17 @@ public class AuditDataViewer implements ContentRender, ColorSelectors out.write("
\n"); - } // end renderHere + } // end render -} // end class AuditDataViewer + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setMenuSelector(int sel) + { + menu_sel = sel; + + } // end setMenuSelector + +} // end class AuditView diff --git a/src/com/silverwrist/venice/ui/view/FindView.java b/src/com/silverwrist/venice/ui/view/FindView.java new file mode 100644 index 0000000..e11496c --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/FindView.java @@ -0,0 +1,318 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class FindView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + // The attribute that the current display category gets stored as. + public static final String DISPLAY_PARAM_ATTRIBUTE = "Find.display"; + + // The various display categories + public static final int FD_COMMUNITIES = 0; + public static final int FD_USERS = 1; + public static final int FD_CATEGORIES = 2; + public static final int FD_POSTS = 3; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int display; // which display are we doing? + private int max_results; // the maximum number of results displayed + private RequestInput rinput = null; // the RequestInput (during execution) + private int field = -1; // search field indicator + private int mode = -1; // search mode indicator + private String term = null; // current search term + private CategoryDescriptor cat = null; // current category descriptor + private List subcats = null; // list of subcategories + private List results = null; // the search results + private int offset = 0; // offset in list of results + private int find_count = 0; // total count of things found + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public FindView(int display, int max_results) + { + this.display = display; + this.max_results = max_results; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_TOP; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "Find"; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "find.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String formatDate(Date date) + { + return ((rinput==null) ? null : rinput.formatDate(date)); + + } // end formatDate + + public final String getActivityString(Date date) + { + return (rinput==null) ? null : rinput.getActivityString(date); + + } // end getActivityString + + public final int getDisplayMode() + { + return display; + + } // end getDisplayMode + + public final boolean testDisplayMode(int val) + { + return (display==val); + + } // end testDisplayMode + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final int getField() + { + return field; + + } // end getField + + public final void setField(int f) + { + if (rinput==null) + this.field = f; + + } // end setField + + public final boolean testField(int val) + { + return (field==val); + + } // end testField + + public final int getMode() + { + return mode; + + } // end getMode + + public final void setMode(int m) + { + if (rinput==null) + this.mode = m; + + } // end setMode + + public final boolean testMode(int val) + { + return (mode==val); + + } // end testMode + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String s) + { + if (rinput==null) + this.term = s; + + } // end setTerm + + public final CategoryDescriptor getCategory() + { + return cat; + + } // end getCategory + + public final void setCategory(CategoryDescriptor cat) throws DataException + { + if (rinput!=null) + return; + + this.cat = cat; + this.subcats = cat.getSubCategories(); + + } // end setCategory + + public final List getSubCategories() + { + return subcats; + + } // end getSubCategories + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List l) + { + if (rinput==null) + this.results = l; + + } // end setResults + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + if (rinput==null) + this.offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int c) + { + if (rinput==null) + this.find_count = c; + + } // end setFindCount + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final FindView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("FindView.get: unable to get request content"); + if (obj instanceof FindView) + return (FindView)obj; + throw new ServletException("FindView.get: request content is not a FindView object"); + + } // end get + + public static String getCommunityHostName(CommunityContext comm) + { + try + { // get the host name for the specified community + UserProfile prof = comm.getHostProfile(); + return prof.getUserName(); + + } // end try + catch (DataException e) + { // just return NULL if an exception strikes + return null; + + } // end catch + + } // end getCommunityHostName + + public static int getCommunityMemberCount(CommunityContext comm) + { + try + { // get the member count for the specified community + return comm.getMemberCount(); + + } // end try + catch (DataException e) + { // just return -1 if an exception strikes + return -1; + + } // end catch + + } // end getCommunityMemberCount + +} // end class FindView diff --git a/src/com/silverwrist/venice/ui/view/JSPView.java b/src/com/silverwrist/venice/ui/view/JSPView.java new file mode 100644 index 0000000..9ee39c3 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/JSPView.java @@ -0,0 +1,174 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.Date; +import java.util.HashMap; +import javax.servlet.*; +import com.silverwrist.venice.core.CommunityContext; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class JSPView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int menu_sel = MENU_SELECTOR_NOCHANGE; + private String title; + private String qid = null; + private String jsp_name; + private RequestInput rinput = null; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public JSPView(String title, String jsp_name) + { + this.title = title; + this.jsp_name = jsp_name; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return menu_sel; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return title; + + } // end getPageTitle + + public String getPageQID() + { + return qid; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return jsp_name; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setMenuSelector(int sel) + { + if (rinput==null) + menu_sel = sel; + + } // end setMenuSelector + + public final void setPageQID(String s) + { + if (rinput==null) + qid = s; + + } // end setPageQID + + public final Object getRequestAttribute(String s) + { + return ((rinput==null) ? null : rinput.getRequestAttribute(s)); + + } // end getRequestAttribute + + public final String formatDate(Date date) + { + return ((rinput==null) ? null : rinput.formatDate(date)); + + } // end formatDate + + public final CommunityContext getCommunity() + { + return ((rinput==null) ? null : rinput.getCommunity()); + + } // end getCommunity + + public final String getActivityString(Date date) + { + return ((rinput==null) ? null : rinput.getActivityString(date)); + + } // end getActivityString + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final JSPView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("JSPView.get: unable to get request content"); + if (obj instanceof JSPView) + return (JSPView)obj; + throw new ServletException("JSPView.get: request content is not a JSPView object"); + + } // end get + + public static final RequestOutput getRequestOutput(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_OUTPUT); + if (obj==null) + throw new ServletException("JSPView.getRequestOutput: unable to get request object"); + if (obj instanceof RequestOutput) + return (RequestOutput)obj; + throw new ServletException("JSPView.getRequestOutput: request object is not a RequestOutput object"); + + } // end getRequestOutput + +} // end class JSPView diff --git a/src/com/silverwrist/venice/ui/view/MembersView.java b/src/com/silverwrist/venice/ui/view/MembersView.java new file mode 100644 index 0000000..8a32fc8 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/MembersView.java @@ -0,0 +1,249 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.security.Role; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class MembersView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int max_results; // the maximum number of results displayed + private String community_name; // the current community name + private boolean simple = true; // is this a simple listing or not? + private RequestInput rinput = null; // the RequestInput (during execution) + private int field = -1; // search field indicator + private int mode = -1; // search mode indicator + private String term = ""; // current search term + private List results = null; // the search results + private int offset = 0; // offset in list of results + private int find_count = -1; // total count of things found + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public MembersView(int max_results, String community_name) + { + this.max_results = max_results; + this.community_name = community_name; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_COMMUNITY; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "Members of Community " + community_name; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "comm/members.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final String getCommunityName() + { + return community_name; + + } // end getCommunityName + + public final boolean getSimple() + { + return simple; + + } // end getSimple + + public final void setSimple(boolean b) + { + simple = b; + + } // end setSimple + + public final int getField() + { + return field; + + } // end getField + + public final void setField(int v) + { + field = v; + + } // end setField + + public final boolean testField(int v) + { + return (field==v); + + } // end testField + + public final int getMode() + { + return mode; + + } // end getMode + + public final void setMode(int v) + { + mode = v; + + } // end setMode + + public final boolean testMode(int v) + { + return (mode==v); + + } // end testMode + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String v) + { + term = v; + + } // end setTerm + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List v) + { + results = v; + + } // end setResults + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int v) + { + find_count = v; + + } // end setFindCount + + public boolean isCommunityAdmin(UserFound uf) + { + if (rinput==null) + return false; + SecurityInfo sinf = rinput.getCommunity().getSecurityInfo(); + Role r = sinf.getRole("Community.Host"); + return r.isSatisfiedBy(uf.getLevel()); + + } // end isCommunityAdmin + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final MembersView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("MembersView.get: unable to get request content"); + if (obj instanceof MembersView) + return (MembersView)obj; + throw new ServletException("MembersView.get: request content is not a MembersView object"); + + } // end get + +} // end class MembersView diff --git a/src/com/silverwrist/venice/ui/view/MenuView.java b/src/com/silverwrist/venice/ui/view/MenuView.java new file mode 100644 index 0000000..87601b1 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/MenuView.java @@ -0,0 +1,105 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.io.IOException; +import java.util.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.menus.MenuComponent; + +public class MenuView implements ContentDirect +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int menu_selector = MENU_SELECTOR_NOCHANGE; + private String qid = null; + private MenuComponent component; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public MenuView(MenuComponent component) + { + this.component = component; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return menu_selector; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return component.getTitle(ro); + + } // end getPageTitle + + public String getPageQID() + { + return qid; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentDirect + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out) throws IOException + { + component.render(out,null); + + } // end render + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setMenuSelector(int sel) + { + menu_selector = sel; + + } // end setMenuSelector + + public final void setPageQID(String s) + { + qid = s; + + } // end setPageQID + +} // end class MenuView diff --git a/src/com/silverwrist/venice/ui/view/PhotoUploader.java b/src/com/silverwrist/venice/ui/view/PhotoUploader.java new file mode 100644 index 0000000..a828fd5 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/PhotoUploader.java @@ -0,0 +1,187 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class PhotoUploader implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String title; + private String action; + private int action_type; + private RequestInput rinput = null; + private HashMap hidden_parms = new HashMap(); + private String photo_tag; + private String label; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + public PhotoUploader(String title, String action, int action_type) + { + this.title = title; + this.action = action; + this.action_type = action_type; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_NOCHANGE; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return title; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "photo_upload.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final String getPageTitle() + { + return title; + + } // end getPageTitle + + public final String getAction() + { + return ((rinput==null) ? action : rinput.formatURL(action,action_type)); + + } // end getAction + + public final void addHiddenParameter(String name, String value) + { + if (rinput==null) + hidden_parms.put(name,value); + + } // end addHiddenParameter + + public final String getHiddenParams() + { + StringBuffer buf = new StringBuffer(); + Iterator it = hidden_parms.entrySet().iterator(); + while (it.hasNext()) + { // build the hidden parameters list + Map.Entry ntry = (Map.Entry)(it.next()); + buf.append("\n"); + + } // end while + + return buf.toString(); + + } // end getHiddenParams + + public final String getPhotoTag() + { + return photo_tag; + + } // end getPhotoTag + + public final void setPhotoTag(String s) + { + if (rinput==null) + photo_tag = s; + + } // end setPhotoTag + + public final String getLabel() + { + return label; + + } // end getLabel + + public final void setLabel(String s) + { + if (rinput==null) + label = s; + + } // end setLabel + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final PhotoUploader get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("PhotoUploader.get: unable to get request content"); + if (obj instanceof PhotoUploader) + return (PhotoUploader)obj; + throw new ServletException("PhotoUploader.get: request content is not a PhotoUploader object"); + + } // end get + +} // end class PhotoUploader diff --git a/src/com/silverwrist/venice/ui/view/SetMemberView.java b/src/com/silverwrist/venice/ui/view/SetMemberView.java new file mode 100644 index 0000000..f23b883 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/SetMemberView.java @@ -0,0 +1,256 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.util.*; +import javax.servlet.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.security.Role; +import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.servlet.RequestImpl; + +public class SetMemberView implements ContentJSP +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int max_results; // the maximum number of results displayed + private List role_list; // the list of possible roles + private Role host_role; // the community host role + private String community_name; // the current community name + private boolean simple = true; // is this a simple listing or not? + private RequestInput rinput = null; // the RequestInput (during execution) + private int field = -1; // search field indicator + private int mode = -1; // search mode indicator + private String term = ""; // current search term + private List results = null; // the search results + private int offset = 0; // offset in list of results + private int find_count = -1; // total count of things found + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public SetMemberView(int max_results, CommunityContext comm) + { + this.max_results = max_results; + this.community_name = comm.getName(); + SecurityInfo sinf = comm.getSecurityInfo(); + this.role_list = sinf.getRoleList("Community.UserLevels"); + this.host_role = sinf.getRole("Community.Host"); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return MENU_SELECTOR_COMMUNITY; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return "Membership in Community " + community_name; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentJSP + *-------------------------------------------------------------------------------- + */ + + public String getJSPName() + { + return "comm/set_member.jsp"; + + } // end getJSPName + + public void initialize(RequestInput req) + { + rinput = req; + + } // end initialize + + public void terminate(RequestInput req) + { + rinput = null; + + } // end terminate + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + + public final List getRoleList() + { + return role_list; + + } // end getRoleList + + public final Role getHostRole() + { + return host_role; + + } // end getHostRole + + public final String getCommunityName() + { + return community_name; + + } // end getCommunityName + + public final boolean getSimple() + { + return simple; + + } // end getSimple + + public final void setSimple(boolean b) + { + simple = b; + + } // end setSimple + + public final int getField() + { + return field; + + } // end getField + + public final void setField(int v) + { + field = v; + + } // end setField + + public final boolean testField(int v) + { + return (field==v); + + } // end testField + + public final int getMode() + { + return mode; + + } // end getMode + + public final void setMode(int v) + { + mode = v; + + } // end setMode + + public final boolean testMode(int v) + { + return (mode==v); + + } // end testMode + + public final String getTerm() + { + return term; + + } // end getTerm + + public final void setTerm(String v) + { + term = v; + + } // end setTerm + + public final List getResults() + { + return results; + + } // end getResults + + public final void setResults(List v) + { + results = v; + + } // end setResults + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final void setOffset(int v) + { + offset = v; + + } // end setOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final void setFindCount(int v) + { + find_count = v; + + } // end setFindCount + + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static final SetMemberView get(ServletRequest sreq) throws ServletException + { + Object obj = sreq.getAttribute(RequestImpl.REQUEST_CONTENT); + if (obj==null) + throw new ServletException("SetMemberView.get: unable to get request content"); + if (obj instanceof SetMemberView) + return (SetMemberView)obj; + throw new ServletException("SetMemberView.get: request content is not a SetMemberView object"); + + } // end get + +} // end class SetMemberView diff --git a/src/com/silverwrist/venice/ui/view/SideBoxNestedView.java b/src/com/silverwrist/venice/ui/view/SideBoxNestedView.java new file mode 100644 index 0000000..ca6c64a --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/SideBoxNestedView.java @@ -0,0 +1,108 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.io.IOException; +import javax.servlet.ServletException; +import com.silverwrist.venice.core.UserContext; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.ui.*; + +public class SideBoxNestedView implements ContentDirect, ColorSelectors, LinkTypes +{ + private Content inner; + private Content[] sideboxes; + private boolean do_configure; + + public SideBoxNestedView(RequestInput ri, Content inner) throws AccessError, DataException + { + this.inner = inner; + this.sideboxes = ri.getSideBoxes(); + this.do_configure = ri.getUser().isLoggedIn(); + + } // end constructor + + public boolean needFrame() + { + return inner.needFrame(); + + } // end needFrame + + public int getMenuSelector() + { + return inner.getMenuSelector(); + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return inner.getPageTitle(ro); + + } // end getPageTitle + + public String getPageQID() + { + return inner.getPageQID(); + + } // end getPageQID + + public void render(RequestOutput out) throws IOException + { + try + { // Write out the start of the content structure. + out.write("\n" + + "\n
\n"); + + // Write out the inner content. + out.output(inner); + + out.write("\n"); // break to the sidebox column + + for (int i=0; i
\n" + + out.getFontTag(SIDEBOX_TITLE_FOREGROUND,"sidebox-title") + "" + + sideboxes[i].getPageTitle(out) + "\n
\n"); + + out.output(sideboxes[i]); // output the sidebox content + + // close up the framework of this sidebox + out.write("

\n"); + + } // end for + + if (do_configure) // write the Configure button below the sideboxes + out.write("" + + out.getButtonVisual("configure") + "\n"); + + // Finish up. + out.write("

"); + + } // end try + catch (ServletException se) + { // have to remap ServletException 'cos it can't be thrown + throw new IOException("Error rendering page component: " + se.getMessage()); + + } // end catch + + } // end render + +} // end class SideBoxNestedView diff --git a/src/com/silverwrist/venice/ui/view/TextMessage.java b/src/com/silverwrist/venice/ui/view/TextMessage.java new file mode 100644 index 0000000..fb3d510 --- /dev/null +++ b/src/com/silverwrist/venice/ui/view/TextMessage.java @@ -0,0 +1,202 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.ui.view; + +import java.io.IOException; +import java.util.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.ui.*; + +public class TextMessage implements ContentDirect, ColorSelectors +{ + /*-------------------------------------------------------------------------------- + * Internal class that holds button details + *-------------------------------------------------------------------------------- + */ + + class Button + { + private int linktype; + private String link; + private String id; + + Button(int linktype, String link, String id) + { + this.linktype = linktype; + this.link = link; + this.id = id; + + } // end constructor + + public final String getEquivalent(RequestOutput ro) + { + return "" + ro.getButtonVisual(id) + ""; + + } // end getEquivalent + + } // end class Button + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private int menu_selector = Content.MENU_SELECTOR_NOCHANGE; + private String title; + private String subtitle; + private String text = null; + private ArrayList buttons = new ArrayList(); + private String[] render_buttons = null; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public TextMessage(String title) + { + this.title = title; + this.subtitle = null; + + } // end constructor + + public TextMessage(String title, String subtitle) + { + this.title = title; + this.subtitle = subtitle; + + } // end constructor + + public TextMessage(int msel, String title, String subtitle) + { + this.menu_selector = msel; + this.title = title; + this.subtitle = subtitle; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface Content + *-------------------------------------------------------------------------------- + */ + + public boolean needFrame() + { + return true; + + } // end needFrame + + public int getMenuSelector() + { + return menu_selector; + + } // end getMenuSelector + + public String getPageTitle(RequestOutput ro) + { + return title; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface ContentDirect + *-------------------------------------------------------------------------------- + */ + + public void render(RequestOutput out) throws IOException + { + if (render_buttons==null) + { // pre-render the buttons + render_buttons = new String[buttons.size()]; + for (int i=0; i

\n

\n" + StringUtil.join((Object[])render_buttons," \n") + + "
\n"); + + } // end render + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void setMenuSelector(int sel) + { + menu_selector = sel; + + } // end setMenuSelector + + public final String getTitle() + { + return title; + + } // end getTitle + + public final void setTitle(String s) + { + title = s; + + } // end setTitle + + public final String getSubTitle() + { + return subtitle; + + } // end getSubTitle + + public final void setSubTitle(String s) + { + subtitle = s; + + } // end setSubTitle + + public final String getText() + { + return text; + + } // end getText + + public final void setText(String s) + { + text = s; + + } // end setText + + public final void addButton(int linktype, String link, String id) + { + buttons.add(new Button(linktype,link,id)); + render_buttons = null; + + } // end addButton + +} // end class TextMessage diff --git a/tlds/community-taglib.tld b/tlds/community-taglib.tld new file mode 100644 index 0000000..c603f4b --- /dev/null +++ b/tlds/community-taglib.tld @@ -0,0 +1,97 @@ + + + + + + + + 0.1 + 1.1 + comm + + Tag library used to access various community elements. + + + name + com.silverwrist.venice.ui.jsp.CommunityNameTag + Substitutes the community name. + EMPTY + + + + ID + com.silverwrist.venice.ui.jsp.CommunityIDTag + Substitutes the community ID. + EMPTY + + + + can_join + com.silverwrist.venice.ui.jsp.CommunityCanJoinTag + Includes its content if the user can join the community. + JSP + + + + cannot_join + com.silverwrist.venice.ui.jsp.CommunityCannotJoinTag + Includes its content if the user cannot join the community. + JSP + + + + can_send_invite + com.silverwrist.venice.ui.jsp.CommunityCanSendInvitationTag + Includes its content if the user can send an invitation to join the community. + JSP + + + + is_public + com.silverwrist.venice.ui.jsp.CommunityIsPublicTag + Includes its content if the community is a public community. + JSP + + + + is_private + com.silverwrist.venice.ui.jsp.CommunityIsPrivateTag + Includes its content if the community is a private community. + JSP + + + + synopsis + com.silverwrist.venice.ui.jsp.CommunitySynopsisTag + Substitutes the community synopsis. + EMPTY + + + + alias + com.silverwrist.venice.ui.jsp.CommunityAliasTag + Substitutes the community alias. + EMPTY + + + + + diff --git a/tlds/conference-taglib.tld b/tlds/conference-taglib.tld new file mode 100644 index 0000000..dcd65b2 --- /dev/null +++ b/tlds/conference-taglib.tld @@ -0,0 +1,95 @@ + + + + + + + + 0.1 + 1.1 + conf + + Tag library used to access various conference elements. + + + can_manage + com.silverwrist.venice.ui.conf.jsp.ConferenceCanManageTag + Includes its content if the user can manage conferences in the current community. + JSP + + + + can_create + com.silverwrist.venice.ui.conf.jsp.ConferenceCanCreateTag + Includes its content if the user can create conferences in the current community. + JSP + + + + name + com.silverwrist.venice.ui.conf.jsp.ConferenceNameTag + Substitutes the conference name. + EMPTY + + + + ID + com.silverwrist.venice.ui.conf.jsp.ConferenceIDTag + Substitutes the conference ID. + EMPTY + + + + can_read_new + com.silverwrist.venice.ui.conf.jsp.ConferenceCanReadNewTag + Includes its content if the user can read new messages in the current conference. + JSP + + + + can_add_to_hotlist + com.silverwrist.venice.ui.conf.jsp.ConferenceCanAddToHotlistTag + Includes its content if the user can add the current conference to the hotlist. + JSP + + + + default_pseud + com.silverwrist.venice.ui.conf.jsp.ConferenceDefaultPseudTag + Substitutes the user's default pseud for the conference. + EMPTY + + + + can_send_invite + com.silverwrist.venice.ui.conf.jsp.ConferenceCanSendInviteTag + Includes its content if the user can send an invitation for the current conference. + JSP + + + + can_post + com.silverwrist.venice.ui.conf.jsp.ConferenceCanPostTag + Includes its content if the user can post to the current conference. + JSP + + + diff --git a/tlds/frame-taglib.tld b/tlds/frame-taglib.tld new file mode 100644 index 0000000..5c5b789 --- /dev/null +++ b/tlds/frame-taglib.tld @@ -0,0 +1,114 @@ + + + + + + + + 0.1 + 1.1 + frame + + Tag library used by the frame JSP page to render portions of the UI. + + + head + com.silverwrist.venice.ui.jsp.FrameHeadTag + Inserts the information inside the HEAD tag for the frame page. + EMPTY + + + + body + com.silverwrist.venice.ui.jsp.FrameBodyTag + Replaces the standard BODY tags on the frame page. + JSP + + + + sitelogo + com.silverwrist.venice.ui.jsp.FrameSiteLogoTag + Inserts the defined site logo and any link that goes around it. + EMPTY + + + + banner_ad + com.silverwrist.venice.ui.jsp.FrameBannerAdTag + Inserts a banner advertisement into the page. + EMPTY + + + + display_login + com.silverwrist.venice.ui.jsp.FrameDisplayLoginTag + Includes the enclosed JSP text if the "displayLogin" flag is set on the request. + JSP + + + + QID + com.silverwrist.venice.ui.jsp.FrameQIDTag + Inserts the QID of this page into the page. + EMPTY + + + + if_QID + com.silverwrist.venice.ui.jsp.FrameIfQIDTag + Includes the enclosed JSP text if the current page has a QID. + JSP + + + + venice_logo + com.silverwrist.venice.ui.jsp.FrameVeniceLogoTag + Inserts the Venice logo into the page. + EMPTY + + + + content_here + com.silverwrist.venice.ui.jsp.FrameContentHereTag + Marks the point where the frame content gets inserted. + EMPTY + + + + leftmenu + com.silverwrist.venice.ui.jsp.FrameLeftMenuTag + Inserts a left menu bar menu. + EMPTY + + name + true + false + + + + + currentmenu + com.silverwrist.venice.ui.jsp.FrameCurrentMenuTag + Inserts the current "top" menu on the left menu bar. + EMPTY + + + diff --git a/tlds/post-taglib.tld b/tlds/post-taglib.tld new file mode 100644 index 0000000..a46e80a --- /dev/null +++ b/tlds/post-taglib.tld @@ -0,0 +1,133 @@ + + + + + + + + 0.1 + 1.1 + post + + Tag library relating to Venice post data. + + + rewrite + com.silverwrist.venice.ui.conf.jsp.PostRewriteTag + Rewrites post data for display, resolving postlink: and userlink: URIs. + JSP + + + + box + com.silverwrist.venice.ui.conf.jsp.PostBoxTag + Template for the post box. + JSP + + action + true + true + + + type + false + false + + + + + param + com.silverwrist.venice.ui.conf.jsp.PostParamTag + Specifies a hidden parameter for the post box. + JSP + + name + true + false + + + + + newtopic + com.silverwrist.venice.ui.conf.jsp.PostNewTopicTag + Specifies the name of the optional "new topic name" field of the post box, and its contents. + JSP + + name + true + false + + + + + pseud + com.silverwrist.venice.ui.conf.jsp.PostPseudTag + Specifies the name of the pseud field of the post box, and its contents. + JSP + + name + true + false + + + + + attach + com.silverwrist.venice.ui.conf.jsp.PostAttachTag + Specifies the name of the attach checkbox of the post box, and whether it is checked. + EMPTY + + name + true + false + + + value + false + false + + + + + text + com.silverwrist.venice.ui.conf.jsp.PostTextTag + Specifies the name of the TEXTAREA of the post box, and its contents. + JSP + + name + true + false + + + + + button + com.silverwrist.venice.ui.conf.jsp.PostButtonTag + Inserts a standard button into the post box command buttons area. + EMPTY + + id + true + false + + + + diff --git a/tlds/topic-taglib.tld b/tlds/topic-taglib.tld new file mode 100644 index 0000000..966fc12 --- /dev/null +++ b/tlds/topic-taglib.tld @@ -0,0 +1,172 @@ + + + + + + + + 0.1 + 1.1 + topic + + Tag library used to access various topic elements. + + + can_create + com.silverwrist.venice.ui.conf.jsp.TopicCanCreateTag + Includes its content if the user can create topics in the current conference. + JSP + + + + can_freeze + com.silverwrist.venice.ui.conf.jsp.TopicCanFreezeTag + Includes its content if the user can freeze or unfreeze the current topic. + JSP + + + + can_archive + com.silverwrist.venice.ui.conf.jsp.TopicCanArchiveTag + Includes its content if the user can archive or unarchive the current topic. + JSP + + + + can_delete + com.silverwrist.venice.ui.conf.jsp.TopicCanDeleteTag + Includes its content if the user can delete the current topic. + JSP + + + + ID + com.silverwrist.venice.ui.conf.jsp.TopicIDTag + Substitutes the topic ID. + EMPTY + + + + number + com.silverwrist.venice.ui.conf.jsp.TopicNumberTag + Substitutes the topic number. + EMPTY + + + + name + com.silverwrist.venice.ui.conf.jsp.TopicNameTag + Substitutes the topic name. + EMPTY + + + + is_archived + com.silverwrist.venice.ui.conf.jsp.TopicIsArchivedTag + Includes its content if the topic is archived. + JSP + + + + is_not_archived + com.silverwrist.venice.ui.conf.jsp.TopicIsNotArchivedTag + Includes its content if the topic is not archived. + JSP + + + + is_frozen + com.silverwrist.venice.ui.conf.jsp.TopicIsFrozenTag + Includes its content if the topic is frozen. + JSP + + + + is_not_frozen + com.silverwrist.venice.ui.conf.jsp.TopicIsNotFrozenTag + Includes its content if the topic is not frozen. + JSP + + + + is_hidden + com.silverwrist.venice.ui.conf.jsp.TopicIsHiddenTag + Includes its content if the topic is hidden. + JSP + + + + is_not_hidden + com.silverwrist.venice.ui.conf.jsp.TopicIsNotHiddenTag + Includes its content if the topic is not hidden. + JSP + + + + last_message + com.silverwrist.venice.ui.conf.jsp.TopicLastMessageTag + Substitutes the index of the last message in the topic. + EMPTY + + + + subscribed + com.silverwrist.venice.ui.conf.jsp.TopicSubscribedTag + Includes its content if the user is subscribed to this topic. + JSP + + + + not_subscribed + com.silverwrist.venice.ui.conf.jsp.TopicNotSubscribedTag + Includes its content if the user is not subscribed to this topic. + JSP + + + + can_send_invite + com.silverwrist.venice.ui.conf.jsp.TopicCanSendInvitationTag + Includes its content if the user can send an invitation to the current topic. + JSP + + + + specified + com.silverwrist.venice.ui.conf.jsp.TopicSpecifiedTag + Includes its content if the topic was specified. + JSP + + + + not_specified + com.silverwrist.venice.ui.conf.jsp.TopicNotSpecifiedTag + Includes its content if the topic was not specified. + JSP + + + + can_post + com.silverwrist.venice.ui.conf.jsp.TopicCanPostTag + Includes its content if the user can post to the current topic. + JSP + + + diff --git a/tlds/user-taglib.tld b/tlds/user-taglib.tld new file mode 100644 index 0000000..e121ac1 --- /dev/null +++ b/tlds/user-taglib.tld @@ -0,0 +1,67 @@ + + + + + + + + 0.1 + 1.1 + user + + Tag library used to access various user elements. + + + is_logged_in + com.silverwrist.venice.ui.jsp.UserIsLoggedInTag + Includes its content if the user is logged in. + JSP + + + + is_not_logged_in + com.silverwrist.venice.ui.jsp.UserIsNotLoggedInTag + Includes its content if the user is not logged in. + JSP + + + + name + com.silverwrist.venice.ui.jsp.UserNameTag + Substitutes the user name. + EMPTY + + + + is_verified + com.silverwrist.venice.ui.jsp.UserIsVerifiedTag + Includes its content if the user's E-mail address has been verified. + JSP + + + + is_not_verified + com.silverwrist.venice.ui.jsp.UserIsNotVerifiedTag + Includes its content if the user's E-mail address has not been verified. + JSP + + + diff --git a/tlds/utils-taglib.tld b/tlds/utils-taglib.tld new file mode 100644 index 0000000..ff1f79e --- /dev/null +++ b/tlds/utils-taglib.tld @@ -0,0 +1,341 @@ + + + + + + + + 0.1 + 1.1 + util + + Utility tag library for JSP renderings. + + + comment + com.silverwrist.venice.ui.jsp.UtilCommentTag + Conditionally includes HTML comments. + JSP + + + + color + com.silverwrist.venice.ui.jsp.UtilColorTag + References a standard color from the configuration. + EMPTY + + name + true + true + + + + + font + com.silverwrist.venice.ui.jsp.UtilFontTag + Includes a standard FONT tag pair. + JSP + + color + false + true + + + size + false + true + + + + + link + com.silverwrist.venice.ui.jsp.UtilLinkTag + Includes an A tag with the URL possibly modified by the system. + JSP + + href + true + true + + + type + true + false + + + aclass + false + false + + + target + false + false + + + title + false + true + + + + + escape + com.silverwrist.venice.ui.jsp.UtilEscapeTag + Escapes its content so that it's not interpreted as HTML. + JSP + + + + urlencode + com.silverwrist.venice.ui.jsp.UtilURLEncodeTag + URL-encodes its content. + JSP + + + + stock_message + com.silverwrist.venice.ui.jsp.UtilStockMessageTag + References a stock message from the configuration file. + EMPTY + + key + true + false + + + + + button + com.silverwrist.venice.ui.jsp.UtilButtonTag + Inserts a standard button graphic. + EMPTY + + id + true + false + + + type + false + false + + + + + header + com.silverwrist.venice.ui.jsp.UtilHeaderTag + Inserts a standard content header. + JSP + + title + false + true + + + stocktitle + false + false + + + subtitle + false + true + + + stocksubtitle + false + false + + + + + title + com.silverwrist.venice.ui.jsp.UtilTitleTag + Supplies a title for the content header. + JSP + + + + subtitle + com.silverwrist.venice.ui.jsp.UtilSubtitleTag + Supplies a subtitle for the content header. + JSP + + + + menuheader + com.silverwrist.venice.ui.jsp.UtilMenuHeaderTag + Demarcates a block that becomes a "menu" header. Contains util:menuheaderitem tags. + JSP + + caption + true + true + + + + + menuheaderitem + com.silverwrist.venice.ui.jsp.UtilMenuHeaderItemTag + Denotes an item for a menu header. Must be contained within a util:menuheader tag. + JSP + + selected + false + false + + + + + href + com.silverwrist.venice.ui.jsp.UtilHrefTag + Supplies a HREF link and type for the util:menuheaderitem and util:xlink tags. + JSP + + type + true + false + + + + + text + com.silverwrist.venice.ui.jsp.UtilTextTag + Supplies the text for the util:menuheaderitem and util:xlink tags. + JSP + + + + form + com.silverwrist.venice.ui.jsp.UtilFormTag + Includes a FORM tag with the URL possibly modified by the system. + JSP + + verb + false + false + + + action + true + true + + + type + true + false + + + aclass + false + false + + + isfile + false + false + + + + + stdbullet + com.silverwrist.venice.ui.jsp.UtilStdBulletTag + Inserts the standard "bullet" graphic. + EMPTY + + + + xlink + com.silverwrist.venice.ui.jsp.UtilXLinkTag + Includes an A tag built up piecemeal with util:text and util:href. + JSP + + aclass + false + false + + + target + false + false + + + + + expand_servlet + com.silverwrist.venice.ui.jsp.UtilExpandServletTag + Expands the servlet address in its body into a full URL. + JSP + + + + image + com.silverwrist.venice.ui.jsp.UtilImageTag + Inserts an IMG tag with its URL optionally fixed up. + JSP + + src + true + false + + + fixup + false + false + + + alt + false + false + + + width + true + false + + + height + true + false + + + border + false + false + + + + + alt + com.silverwrist.venice.ui.jsp.UtilAltTag + Supplies the ALT text for the util:image tag. + JSP + + + + linktitle + com.silverwrist.venice.ui.jsp.UtilLinkTitleTag + Supplies a title for the xlink tag. + JSP + + + diff --git a/web/default.jsp b/web/default.jsp index aced927..b987b82 100644 --- a/web/default.jsp +++ b/web/default.jsp @@ -17,6 +17,6 @@ --%> <% ServletContext ctxt = getServletConfig().getServletContext(); -RequestDispatcher disp = ctxt.getNamedDispatcher("top"); +RequestDispatcher disp = ctxt.getRequestDispatcher("/top.js.vs"); disp.forward(request,response); %> \ No newline at end of file diff --git a/web/format/admin_find.jsp b/web/format/admin_find.jsp deleted file mode 100644 index 6195832..0000000 --- a/web/format/admin_find.jsp +++ /dev/null @@ -1,148 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - AdminFindUser data = AdminFindUser.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); -%> -<% rdat.writeContentHeader(out,"User Account Management",null); %> -<%= stdfont %>">Return to -System Administration Menu

- -<%-- Display the search form --%> -<% if (rdat.useHTMLComments()) { %><% } %> -

">
- - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Users:
- <%= stdfont %> - Display all users whose   -
- - -    -
- " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
- -
- -<% List results = data.getResultsList(); %> -<% if (results!=null) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% - // Determine the number of results to display and whether to display a "next" button - int dcount = results.size(); - boolean go_next = false; - if (dcount>data.getNumResultsDisplayed()) - { // there's a "next" - dcount = data.getNumResultsDisplayed(); - go_next = true; - - } // end if - %> -
- - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - <%-- The initial search results --%> - Search Results - <% if (data.getFindCount()>0) { %> - (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of - <%= data.getFindCount() %>) - <% } else { %>(None)<% } %> - - <% if (go_next || (data.getOffset()>0)) { %> - <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- - - - - - - <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -    - <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> - -
- <% } else { %> <% } %> -

- - <%-- Display the results of the search --%> - - <% for (int i=0; i - - - - - <% } // end for %> - -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= stdfont %> - <% UserFound uf = (UserFound)(results.get(i)); %> - "><%= uf.getName() %>
- <%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>, - from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %> - <%= uf.getCountry() %> - <% if (!StringUtil.isStringEmpty(uf.getDescription())) { %> -
<%= StringUtil.encodeHTML(uf.getDescription()) %> - <% } // end if %> -
- ">[Modify User] -

-<% } // end if (results found) %> - diff --git a/web/format/admin_user_photo.jsp b/web/format/admin_user_photo.jsp deleted file mode 100644 index 1d6db45..0000000 --- a/web/format/admin_user_photo.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - AdminUserPhotoData data = AdminUserPhotoData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Change User Photo","User: " + data.getUserName()); %> - -
"> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - - <%= data.getPhotoTag(rdat) %> - New user photo:
-

- " NAME="upload" ALT="Upload" - WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" ALT="Cancel" - WIDTH=80 HEIGHT=24 BORDER=0>

- ">Click - here to clear user's photo -

-
diff --git a/web/format/base.jsp b/web/format/base.jsp deleted file mode 100644 index cbea91c..0000000 --- a/web/format/base.jsp +++ /dev/null @@ -1,163 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.net.URLEncoder" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - BaseJSPData basedat = BaseJSPData.retrieve(request); - Variables.failIfNull(basedat); - UserContext user = Variables.getUserContext(application,request,session); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String header_font = rdat.getStdFontTag(ColorSelectors.TITLE_FOREGROUND,3); - String header_link_hilite = rdat.getStdFontTag(ColorSelectors.TITLE_LINK,3); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); - String leftfont = rdat.getStdFontTag(ColorSelectors.LEFT_FOREGROUND,2); - String smallfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,1); - String partial_tgt, foo; -%> - - - - <%= rdat.getTitleTag(basedat.getTitle(rdat)) %> - <%= rdat.getStdBaseFontTag(3) %> - <% if (rdat.useStyleSheet()) { %> - " TYPE="text/css"> - <% } // end if %> - <% if (rdat.noSmartTags()) { %> - - <% } // end if %> - - - - <% if (rdat.useHTMLComments()) { %><% } %> - - - - - - - - - - <% if (rdat.useHTMLComments()) { %><% } %> - - -
- <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getSiteImageTag(2,2) %> - <%= header_font %> - <% if (rdat.useHTMLComments()) { %><% } %> - "><%= header_link_hilite %>Front Page

- <%= header_link_hilite %>Help |  - "><%= header_link_hilite %>Find -

- <% if (rdat.useHTMLComments()) { %><% } %> - <% basedat.renderBannerAd(out,rdat); %> -
<%= header_font %> - <% if (user.isLoggedIn()) { %> - You are logged in as <%= StringUtil.encodeHTML(user.getUserName()) %> - <% if (basedat.displayLoginLinks()) { %> - <% - partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd="; - foo = rdat.getEncodedServletPath(partial_tgt + "L"); - %> -  - <%= header_link_hilite %>Log Out - <% foo = rdat.getEncodedServletPath(partial_tgt + "P"); %> -  | <%= header_link_hilite %>Profile - <% } // end if %> - <% } else { %> - You are not logged in - <% if (basedat.displayLoginLinks()) { %> - <% - partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd="; - foo = rdat.getEncodedServletPath(partial_tgt + "L"); - %> -  - <%= header_link_hilite %>Log In - <% foo = rdat.getEncodedServletPath(partial_tgt + "C"); %> -  | <%= header_link_hilite %>Create Account - <% } // end if %> - <% } // end if %> -
- <% if (rdat.useHTMLComments()) { %><% } %> - - - - - - - - - - - - - -
- - <% if (rdat.useHTMLComments()) { %><% } %> - - - - - - <% if (rdat.useHTMLComments()) { %><% } %> - -
<%= leftfont %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% basedat.renderMenu(session,out,rdat); %> -
 
<%= leftfont %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% basedat.renderFixedMenu(out,rdat); %> -
-
- <% if (rdat.useHTMLComments()) { %><% } %> - <% basedat.renderContent(application,out,rdat); %> - <% if (rdat.useHTMLComments()) { %><% } %> -
 
- - - diff --git a/web/format/comm/category.jsp b/web/format/comm/category.jsp new file mode 100644 index 0000000..8ae0cbe --- /dev/null +++ b/web/format/comm/category.jsp @@ -0,0 +1,87 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<% + JSPView view = JSPView.get(request); +%> +Category browser for community "" + + + + +
+ comm/admin_menu.js.vs?cc= + +
+ + + <% CategoryDescriptor prev_cat = (CategoryDescriptor)(view.getRequestAttribute("category.previous")); %> + Previous community Category: <%= prev_cat.toString() %>

+ Current category:
+ <% CategoryDescriptor curr_cat = (CategoryDescriptor)(view.getRequestAttribute("category.current")); %> + <% if (curr_cat.getCategoryID()>=0) { %> + comm/category.js.vs?cc=&go=-1 + Top + <% } else { %>Top<% } // end if %>: + <% for (int i=0; i + <% int tmpid = curr_cat.getIDAtLevel(i); %> + <% if (tmpid!=curr_cat.getCategoryID()) { %> + comm/category.js.vs?cc=&go=<%= tmpid %> + <%= curr_cat.getTitleAtLevel(i) %> + : <% } else { %><%= curr_cat.getTitleAtLevel(i) %><% } %> + <% } // end for %> + <% if (curr_cat.getCategoryID()>=0) { %>    [ + comm/category.js.vs?cc=&set=<%= curr_cat.getCategoryID() %> + set + ]<% } // end if %> + +

Subcategories:
+ <% List subcats = (List)(view.getRequestAttribute("category.subcats")); %> + <% if (subcats.size()>0) { %> + + <% Iterator it = subcats.iterator(); %> + <% while (it.hasNext()) { %> + <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %> + <% int subid = c.getLinkedCategoryID(); %> + + + + + <% } // end while %> +
+ + comm/category.js.vs?cc=&go=<%= subid %> + <%= c.getTitleAtLevel(c.getNumLevels()-1) %> + + <% if (c.isSymbolicLink()) { %>@<% } %> +     [ + comm/category.js.vs?cc=&set=<%= subid %> + set + ] +
+ <% } else { %>(None)<% } // end if (subcategory display) %>

+ + Click on a subcategory name to make that category the currently displayed one.

+ Click on a [set] link to set that category as the community's new category and return to the + Community Administration menu.

+ + diff --git a/web/format/comm/email.jsp b/web/format/comm/email.jsp new file mode 100644 index 0000000..14bcf13 --- /dev/null +++ b/web/format/comm/email.jsp @@ -0,0 +1,45 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +E-Mail to Community "" + + + + +

+ + + + + + + + + + + + + +
+ Send E-mail to all members of the community: +
Subject:
+   +
+
diff --git a/web/format/comm/invite.jsp b/web/format/comm/invite.jsp new file mode 100644 index 0000000..4d302a3 --- /dev/null +++ b/web/format/comm/invite.jsp @@ -0,0 +1,52 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + JSPView view = JSPView.get(request); +%> +Invitation form + + <%= view.getRequestAttribute("invitation.title").toString() %> + <%= view.getRequestAttribute("invitation.subtitle").toString() %> + +
"> +
+ <%= view.getRequestAttribute("invitation.params").toString() %> + + + + + + + + + + + + +
+ Send to:  +
+ Personal message to be added to invitation: +
+   +
+
+
diff --git a/web/format/comm/members.jsp b/web/format/comm/members.jsp new file mode 100644 index 0000000..6d701ea --- /dev/null +++ b/web/format/comm/members.jsp @@ -0,0 +1,141 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.Iterator" %> +<%@ page import = "java.util.List" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.MembersView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<% + MembersView view = MembersView.get(request); +%> +Members view for community + + + +Find members of community "":

+

+ + + + + Display all community members whose   +
+ + + +
+ +
+
+ +<% List results = view.getResults(); %> +<% if (results!=null) { %> +
+ <% + int dcount = results.size(); + // Determine the number of results to display and whether to display a "next" button + boolean go_next = false; + if (dcount>view.getMaxResults()) + { // there's a "next" + dcount = view.getMaxResults(); + go_next = true; + + } // end if + %> + + + + +
+ <%-- The community members/search results header --%> + + <% if (view.getSimple()) { %>Community Members:<% } else { %>Search Results:<% } %> + + (Displaying <%= view.getOffset() + 1 %>-<%= view.getOffset() + dcount %> of + <%= view.getFindCount() %>) + + <% if (go_next || (view.getOffset()>0)) { %> + <%-- The navigational form that allows us to page through the results --%> + Navigational Form +
+ + + + + + + + <% if (view.getOffset()>0) { %> + + <% } else { %> + + <% } // end if %> +   + <% if (go_next) { %> + + <% } else { %> + + <% } // end if %> +
+ <% } else { %> <% } %> +

+ + <%-- Display the results of the search --%> + + <% for (int i=0; i + + + + + <% } // end for %> +
+ <% UserFound uf = (UserFound)(results.get(i)); %> + + user/<%= uf.getName() %> + <%= uf.getName() %> +
+ <%= uf.getGivenName() %> <%= uf.getFamilyName() %>, + from <%= uf.getLocality() %>, <%= uf.getRegion() %> + <%= uf.getCountry() %> + <% if (view.isCommunityAdmin(uf)) { %> +   + <% } // end if %> + <% if (uf.getDescription()!=null) { %> +
<%= uf.getDescription() %> + <% } // end if %> +

+<% } // end if %> diff --git a/web/format/newcommwelcome.jsp b/web/format/comm/new.jsp similarity index 53% rename from web/format/newcommwelcome.jsp rename to web/format/comm/new.jsp index 0d849d9..5d23363 100644 --- a/web/format/newcommwelcome.jsp +++ b/web/format/comm/new.jsp @@ -7,7 +7,7 @@ WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - The Original Code is the Venice Web Community System. + The Original Code is the Venice Web Communities System. The Initial Developer of the Original Code is Eric J. Bowersox , for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -15,28 +15,35 @@ Contributor(s): --%> -<%@ page import = "java.util.*" %> <%@ page import = "com.silverwrist.util.StringUtil" %> <%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> <% - NewCommunityWelcome data = NewCommunityWelcome.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); + JSPView view = JSPView.get(request); + CommunityContext comm = (CommunityContext)(view.getRequestAttribute("new.community")); %> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Welcome!",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Your new community "<%= StringUtil.encodeHTML(data.getCommunityName()) %>" has been +Welcome to new community <%= comm.getName() %> + + + Your new community "<%= comm.getName() %>" has been created, and you are its host. You may now wish to send out invitations to other people to join your new community. You will also want to enter your community's administration page and set its category and/or additional security options, if desired.

Your new community's URL is: -

<%= StringUtil.encodeHTML(data.getDisplayURL(rdat)) %>
+
+ community/<%= comm.getAlias() %> +

Enjoy your new community on our system!
- Enter Community |  - Invite Users + + community/<%= comm.getAlias() %> + Enter Community + +  |  + + comm/invite.js.vs?cc=<%= comm.getCommunityID() %> + Invite Users +
- +
diff --git a/web/format/comm/profile.jsp b/web/format/comm/profile.jsp new file mode 100644 index 0000000..79d4ecc --- /dev/null +++ b/web/format/comm/profile.jsp @@ -0,0 +1,114 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "com.silverwrist.util.StringUtil" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.FindView" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/user" prefix="user" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<% + JSPView view = JSPView.get(request); + CommunityContext comm = view.getCommunity(); + String tmp; +%> +Profile for community # + + + + + +
+ <%= view.getRequestAttribute("community.logo").toString() %>
+ <% java.util.Date tmpd = comm.getCreationDate(); %> + <% if (tmpd!=null) { %> + Community created:
<%= view.formatDate(tmpd) %>
+ <% } // end if %> + <% tmpd = comm.getLastAccessDate(); %> + <% if (tmpd!=null) { %> + Last accessed:
<%= view.formatDate(tmpd) %>
+ <% } // end if %> + <% tmpd = comm.getLastUpdateDate(); %> + <% if (tmpd!=null) { %> + Profile last updated:
<%= view.formatDate(tmpd) %>
+ <% } // end if %> + + +
+ + + comm/join.js.vs?cc= + + + + + + + comm/invite.js.vs?cc= + + + + +
+
+
+ Public Community
+ Private Community
+ Category: + <% CategoryDescriptor cat = (CategoryDescriptor)(view.getRequestAttribute("category")); %> + <% for (int i=0; i + <% if (i>0) { %>: <% } %> + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %> + <%= cat.getTitleAtLevel(i) %> + + <% } // end for %>

+ +

+ <% UserProfile prof = (UserProfile)(view.getRequestAttribute("host.profile")); %> + Host: + + user/<%= prof.getUserName() %> + <%= prof.getUserName() %> +
+ + <% ContactInfo ci = (ContactInfo)(view.getRequestAttribute("contact.info")); %> + Location:
+ <% tmp = ci.getCompany(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = ci.getAddressLine1(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = ci.getAddressLine2(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = view.getRequestAttribute("address.lastline").toString(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = view.getRequestAttribute("address.country").toString(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> +
+ + <% tmp = comm.getLanguageFullName(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Primary Language: + <%= tmp %>
<% } %> + <% tmp = comm.getRules(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Standards of Conduct: + <%= tmp %>
<% } %> + <% tmp = ci.getURL(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Homepage: + <%= tmp %>
<% } %> + +

diff --git a/web/format/comm/sb_list.jsp b/web/format/comm/sb_list.jsp new file mode 100644 index 0000000..bb48b5e --- /dev/null +++ b/web/format/comm/sb_list.jsp @@ -0,0 +1,67 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + JSPView view = JSPView.get(request); + List community_list = (List)(view.getRequestAttribute("communities.list")); +%> +User community hotlist + + + Return to Front Page +

+<% if (community_list.size()>0) { %> + + <% for (int i=0; i + <% CommunityContext comm = (CommunityContext)(community_list.get(i)); %> + + + + + <% } // end for %> +
+ <% if (comm.canUnjoin()) { %> + + comm/sb_unjoin.js.vs?cc=<%= comm.getCommunityID() %> + + + <% } else { %> <% } %> + + + community/<%= comm.getAlias() %> + <%= comm.getName() %> + +

+ + + + + + +
+ + + Click this symbol to unjoin the specified community. +
+<% } else { %> + You are not a member of any communities. +<% } // end if %> diff --git a/web/format/comm/set_member.jsp b/web/format/comm/set_member.jsp new file mode 100644 index 0000000..21fea94 --- /dev/null +++ b/web/format/comm/set_member.jsp @@ -0,0 +1,173 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.Iterator" %> +<%@ page import = "java.util.List" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.security.Role" %> +<%@ page import = "com.silverwrist.venice.ui.view.SetMemberView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<% + SetMemberView view = SetMemberView.get(request); +%> +Set membership view for community + + + + + + comm/set_member.js.vs?cc= + Redisplay Member List + |  + comm/admin_menu.js.vs?cc= + Return to Community Administration Menu +

+ +Find Users:

+

+ + + + + Display all users whose   +
+ + + +
+ +
+
+ +<% List results = view.getResults(); %> +<% if (results!=null) { %> +
+ <% + int dcount = results.size(); + // Determine the number of results to display and whether to display a "next" button + boolean go_next = false; + if (dcount>view.getMaxResults()) + { // there's a "next" + dcount = view.getMaxResults(); + go_next = true; + + } // end if + %> + + + + +
+ <%-- The community members/search results header --%> + + <% if (view.getSimple()) { %>Community Members:<% } else { %>Search Results:<% } %> + + (Displaying <%= view.getOffset() + 1 %>-<%= view.getOffset() + dcount %> of + <%= view.getFindCount() %>) + + <% if (go_next || (view.getOffset()>0)) { %> + <%-- The navigational form that allows us to page through the results --%> + Navigational Form +
+ + + + + + + + <% if (view.getOffset()>0) { %> + + <% } else { %> + + <% } // end if %> +   + <% if (go_next) { %> + + <% } else { %> + + <% } // end if %> +
+ <% } else { %> <% } %> +

+ + <%-- Display the results of the search --%> + <% if (results.size()>0) { %> + Update Form +
+ + + + + + + + <% StringBuffer buf = new StringBuffer(":"); %> + + <% for (int i=0; i + + <% UserFound uf = (UserFound)(results.get(i)); %> + <% buf.append(uf.getUID()).append(":"); %> + + + + + + <% } // end for %> +
+ + user/<%= uf.getName() %> + <%= uf.getName() %> + +    + + +

+ + +
+ <% } // end if %> +<% } // end if %> diff --git a/web/format/commwelcome.jsp b/web/format/comm/welcome.jsp similarity index 53% rename from web/format/commwelcome.jsp rename to web/format/comm/welcome.jsp index b8bf74d..f073af2 100644 --- a/web/format/commwelcome.jsp +++ b/web/format/comm/welcome.jsp @@ -15,21 +15,16 @@ Contributor(s): --%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityWelcome data = CommunityWelcome.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Welcome!",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Welcome to the "<%= StringUtil.encodeHTML(data.getCommunityName()) %>" community! +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +Welcome to + + + Welcome to the "" community! As a community member, you now have access to the various resources which your community's host has elected to provide. Enjoy your membership!

-

- +
+ community/ + Enter Community +
+
diff --git a/web/format/comm_email.jsp b/web/format/comm_email.jsp deleted file mode 100644 index 0051be2..0000000 --- a/web/format/comm_email.jsp +++ /dev/null @@ -1,57 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityEMail data = CommunityEMail.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Community E-Mail:",data.getCommunityName()); %> - -
">
- - - - - - - - - - - - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Send E-mail to all members of the community: -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Subject: -
- " NAME="send" - ALT="Send E-Mail" WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" - ALT="Cancel" WIDTH=80 HEIGHT=24 BORDER=0> -
-
diff --git a/web/format/comm_logo.jsp b/web/format/comm_logo.jsp deleted file mode 100644 index a5e73fc..0000000 --- a/web/format/comm_logo.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityLogoData data = CommunityLogoData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Change Community Logo",null); %> - -
"> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - - <%= data.getLogoTag(rdat) %> - New community logo:
-

- " NAME="upload" ALT="Upload" - WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" ALT="Cancel" - WIDTH=80 HEIGHT=24 BORDER=0>
-

-
diff --git a/web/format/comm_member.jsp b/web/format/comm_member.jsp deleted file mode 100644 index f280206..0000000 --- a/web/format/comm_member.jsp +++ /dev/null @@ -1,151 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityMembership data = CommunityMembership.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Set Community Membership:",data.getCommunityName()); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Return to Community - Administration Menu -

- -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Find Users:

-

">
- - - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Display all users whose   -
- - -
- " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
- -
- -<% if (data.displayList()) { %> - <% int dcount = data.getSize(); %> -
- <% if (data.isCommunityMemberList()) { %> - <%-- The community list header --%> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - Members of community "<%= StringUtil.encodeHTML(data.getCommunityName()) %>": -
- <% } else { %> - <% - // Determine the number of results to display and whether to display a "next" button - boolean go_next = false; - if (dcount>data.getNumResultsDisplayed()) - { // there's a "next" - dcount = data.getNumResultsDisplayed(); - go_next = true; - - } // end if - %> - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%-- The search results header --%> - Search Results: - <% if (data.getFindCount()>0) { %> - (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of - <%= data.getFindCount() %>) - <% } else { %>(None)<% } %> - - <% if (go_next || (data.getOffset()>0)) { %> - <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- - - - - - - - <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> - -
- <% } else { %> <% } %> -

- <% } // end if %> - - <%-- Display the results of the search --%> -
">
- - - - <% for (int i=0; i - <% UserFound uf = data.getItem(i); %> - - - - - - <% } // end for %> -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= uf.getName() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% data.outputDropDown(out,uf.getUID(),uf.getLevel()); %> -

- " NAME="update" ALT="Update" - WIDTH=80 HEIGHT=24 BORDER=0> -

-<% } // end if %> diff --git a/web/format/commcatbrowser.jsp b/web/format/commcatbrowser.jsp deleted file mode 100644 index 287140e..0000000 --- a/web/format/commcatbrowser.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Community System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityCategoryBrowseData data = CommunityCategoryBrowseData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - CategoryDescriptor cat = data.getCurrentCategory(); - int catid = cat.getCategoryID(); -%> -<% rdat.writeContentHeader(out,"Set Community Category:",data.getCommunityName()); %> - -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Previous community Category: <%= StringUtil.encodeHTML(data.getPreviousCategory()) %>

- Current category:
- <% if (catid>=0) { %><% } %>Top<% if (catid>=0) { %><% } %>: - <% for (int i=0; i - <% int tmpid = cat.getIDAtLevel(i); %> - <% if (catid!=tmpid) { %><% } %><%= StringUtil.encodeHTML(cat.getTitleAtLevel(i)) %><% if (catid!=tmpid) { %>: <% } %> - <% } // end for %> - - <% if (catid>=0) { %>    [set]<% } %> - -

Subcategories:
- <% if (data.hasSubcategories()) { %> - - <% Iterator it = data.getSubcategoryIterator(); %> - <% while (it.hasNext()) { %> - <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %> - <% int subid = c.getLinkedCategoryID(); %> - - - - - <% } // end while %> -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(c.getTitleAtLevel(c.getNumLevels()-1)) %> - <% if (c.isSymbolicLink()) { %>@<% } %> -     [set] -
- <% } else { %>(None)<% } // end if (subcategory display) %>

- - Click on a subcategory name to make that category the currently displayed one.

- Click on a [set] link to set that category as the community's new category and return to the - Community Administration menu.

- - diff --git a/web/format/commprofile.jsp b/web/format/commprofile.jsp deleted file mode 100644 index d765966..0000000 --- a/web/format/commprofile.jsp +++ /dev/null @@ -1,102 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - CommunityProfileData data = CommunityProfileData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - CommunityContext comm = data.getCommunityContext(); - ContactInfo ci = data.getCommunityContactInfo(); - CategoryDescriptor cat = data.getCategory(); - String tmp; -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Community Profile:",comm.getName()); %> - - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,1) %> -

- - <% Date tmpd = comm.getCreationDate(); %> - <% if (tmpd!=null) { %> - Community created:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> - <% tmpd = comm.getLastAccessDate(); %> - <% if (tmpd!=null) { %> - Last accessed:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> - <% tmpd = comm.getLastUpdateDate(); %> - <% if (tmpd!=null) { %> - Profile last updated:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> - - <% if (data.isUserLoggedIn()) { %> -
- <%-- EJB 4/4/2001 - reverse these tests, put canJoin FIRST --%> - <% if (comm.canJoin()) { %> - ">" ALT="Join Now" - WIDTH=80 HEIGHT=24 BORDER=0> - <% } else if (comm.canSendInvitation()) { %> - ">" ALT="Invite" WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -
- <% } // end if (user is logged in) %> - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (comm.isPublicCommunity()) { %>Public<% } else { %>Private<% } %> Community
- Category: - <% for (int i=0; i - <% if (i>0) { %>: <% } %> - <%= StringUtil.encodeHTML(cat.getTitleAtLevel(i)) %> - <% } // end for %>

- <%= StringUtil.encodeHTML(comm.getSynopsis()) %>

- - <% tmp = data.getHostUserName(); %> - Host: "><%= tmp %>
- - Location:
- <% tmp = ci.getCompany(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = ci.getAddressLine1(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = ci.getAddressLine2(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = data.getAddressLastLine(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = data.getFullCountry(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> -
- - <% tmp = comm.getLanguageFullName(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Primary Language: <%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = comm.getRules(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Standards of Conduct: <%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = ci.getURL(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %> - Homepage: <%= StringUtil.encodeHTML(tmp) %>
- <% } %> - -

diff --git a/web/format/communitylist.jsp b/web/format/communitylist.jsp deleted file mode 100644 index 287cd1c..0000000 --- a/web/format/communitylist.jsp +++ /dev/null @@ -1,65 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - UserCommunityList data = UserCommunityList.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Your Communities",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to Front Page -

-<% if (data.getNumCommunities()>0) { %> - - <% for (int i=0; i - <% CommunityContext comm = data.getCommunity(i); %> - - - - - <% } // end for %> -
- <% if (comm.canUnjoin()) { %> - ">" ALT="Unjoin" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } else { %> <% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= StringUtil.encodeHTML(comm.getName()) %> -

- - - - - - -
- " ALT="Unjoin" BORDER=0 WIDTH=16 HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Click this symbol to unjoin the specified community. -
-<% } else { %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>You are not a member of - any communities. -<% } // end if %> diff --git a/web/format/conf/activity_report.jsp b/web/format/conf/activity_report.jsp new file mode 100644 index 0000000..244987c --- /dev/null +++ b/web/format/conf/activity_report.jsp @@ -0,0 +1,106 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/topic" prefix="conf" %> +<% + JSPView view = JSPView.get(request); + final List data = (List)(view.getRequestAttribute("conference.activity.list")); + final boolean poster_report = + ((Boolean)(view.getRequestAttribute("conference.activity.posters"))).booleanValue(); +%> + + <%= view.getRequestAttribute("conference.activity.title").toString() %> + <%= view.getRequestAttribute("conference.activity.subtitle").toString() %> + + + + conf/conf_reports.js.vs?cc=&conf= + Return to Conference Reports Menu +

+ +<% if (data.size()>0) { %> + + + + <% if (poster_report) { %> + + + <% } else { %> + + + <% } // end if %> + + + <% Iterator it = data.iterator(); %> + <% while (it.hasNext()) { %> + <% ActiveUser usr = (ActiveUser)(it.next()); %> + + + + <% if (poster_report) { %> + + + <% } else { %> + + + <% } // end if %> + + <% } // end while %> +
+ User Name + + Last Posted + + Last Read + + Last Read + + Last Posted +
+ + user/<%= usr.getName() %> + <%= usr.getName() %> + + + <%= view.formatDate(usr.getLastWrite()) %> + + <% if (usr.getLastRead()==null) { %> + Never + <% } else { %> + <%= view.formatDate(usr.getLastRead()) %> + <% } // end if %> + + <%= view.formatDate(usr.getLastRead()) %> + <% if (usr.getLastWrite()==null) { %> + Never + <% } else { %> + <%= view.formatDate(usr.getLastWrite()) %> + <% } // end if %> +
+<% } else { %> + + <%= view.getRequestAttribute("conference.activity.nullmessage").toString() %> + +<% } // end if %> diff --git a/web/format/conf/aliases.jsp b/web/format/conf/aliases.jsp new file mode 100644 index 0000000..f524ee5 --- /dev/null +++ b/web/format/conf/aliases.jsp @@ -0,0 +1,78 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.menus.MenuComponent" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); + List aliases = (List)(view.getRequestAttribute("conference.aliases.list")); +%> +Managing aliases for conference "" + + + + + + + conf/manage_conf.js.vs?cc=&conf= + Return to Manage Conference Menu + + + <% Object errmsg = view.getRequestAttribute("conference.aliases.error_message"); %> + <% if (errmsg!=null) { %> +<%= errmsg.toString() %> +

+ <% } // end if %> + + Current Aliases:

+ + <% Iterator it = aliases.iterator(); %> + <% while (it.hasNext()) { %> + <% String name = (String)(it.next()); %> + + + + + + + <% } // end while %> +
+ <%= name %> +      + <% if (aliases.size()>1) { %> + + conf/alias_remove.js.vs?cc=&conf=&alias=<%= name %> + + + <% } else { %> <% } %> +

+ + Add New Alias:

+

+ + +   + +
+
\ No newline at end of file diff --git a/web/format/attach_form.jsp b/web/format/conf/attachment.jsp similarity index 50% rename from web/format/attach_form.jsp rename to web/format/conf/attachment.jsp index 8f2b9f4..750c0e7 100644 --- a/web/format/attach_form.jsp +++ b/web/format/conf/attachment.jsp @@ -16,34 +16,27 @@ Contributor(s): --%> <%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> <%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> <% - AttachmentForm data = AttachmentForm.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); + JSPView view = JSPView.get(request); + CurrentConference currc = CurrentConference.get(request); %> -<% rdat.writeContentHeader(out,"Upload Your Attachment",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + + Your attachment may be no more than 1 megabyte in size.

-

"> +
- - - - + + + "> + "> File to attach:
- " NAME="upload" ALT="Upload" - WIDTH=80 HEIGHT=24 BORDER=0> +
-

- - - - - - - - +

+ diff --git a/web/format/conf/conferences.jsp b/web/format/conf/conferences.jsp new file mode 100644 index 0000000..35bd0d8 --- /dev/null +++ b/web/format/conf/conferences.jsp @@ -0,0 +1,93 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); + List confs = (List)(view.getRequestAttribute("conferences.list")); + List hosts = (List)(view.getRequestAttribute("conferences.hosts.list")); +%> +Conference list for community "" + + + +<% if (confs.size()>0) { %> + + <% for (int i=0; i + + + + + <% } // end for %> +
+ <% ConferenceContext conf = (ConferenceContext)(confs.get(i)); %> + + conf/topics.js.vs?cc=&conf=<%= conf.getConfID() %> + <%= conf.getName() %> + - + Latest activity: <%= view.getActivityString(conf.getLastUpdateDate()) %> + <% if (conf.anyUnread()) { %> + + conf/read_new.js.vs?cc=&conf=<%= conf.getConfID() %> + + + <% } // end if %> +
+ <% List hosts1 = (List)(hosts.get(i)); %> + <% if (hosts1.size()>0) { %> + <% if (hosts1.size()>1) { %>Hosts:<% } else { %>Host:<% } %> + <% for (int j=0; j + <% UserFound uf = (UserFound)(hosts1.get(j)); %> + <% if (j>0) { %>, <% } %> + + user/<%= uf.getName() %> + <%= uf.getName() %> + + <% } // end for %> + <% } else { %> + Hosts: (none) + <% } // end if (hosts present in the conterence) %> +
+ <%= conf.getDescription() %> +

+<% } else { %> + No conferences found in this community.
+<% } // end if %> +

+

+ + conf/find.js.vs?cc= + +   + + + conf/manage.js.vs?cc= + +   + + + + conf/create.js.vs?cc= + +   + +
diff --git a/web/format/conf/custom.jsp b/web/format/conf/custom.jsp new file mode 100644 index 0000000..55eb361 --- /dev/null +++ b/web/format/conf/custom.jsp @@ -0,0 +1,67 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); +%> +Custom blocks for conference "" + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ Custom HTML block to appear at top of Topic List/Posts pages: +
+ +
+ Custom HTML block to appear at bottom of Topic List/Posts pages: +
+ +
+   + + conf/custom_remove.js.vs?cc=&conf= + +
+
diff --git a/web/format/conf_email.jsp b/web/format/conf/email.jsp similarity index 52% rename from web/format/conf_email.jsp rename to web/format/conf/email.jsp index 7d09b62..3825ac9 100644 --- a/web/format/conf_email.jsp +++ b/web/format/conf/email.jsp @@ -16,58 +16,67 @@ Contributor(s): --%> <%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> <%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> <% - ConferenceEMail data = ConferenceEMail.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); + JSPView view = JSPView.get(request); %> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Conference E-Mail:",data.getConferenceName()); %> +E-mail to conference "" + + + -
">
- - - +
+ + - + + - + + +
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + Send E-mail to all   topic:  -
 <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + Within the last day(s) -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Subject: + Subject:
- " NAME="send" - ALT="Send E-Mail" WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" - ALT="Cancel" WIDTH=80 HEIGHT=24 BORDER=0> +  
-
+
\ No newline at end of file diff --git a/web/format/conf/find.jsp b/web/format/conf/find.jsp new file mode 100644 index 0000000..2f4f1e0 --- /dev/null +++ b/web/format/conf/find.jsp @@ -0,0 +1,165 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.conf.view.FindPostView" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + FindPostView view = FindPostView.get(request); +%> +Find Posts + + <% if (view.getTopic()!=null) { %> + in Topic: <%= view.getTopic().getName() %> + <% } else if (view.getConference()!=null) { %> + in Conference: <%= view.getConference().getName() %> + <% } else { %> + in Community: <%= view.getCommunity().getName() %> + <% } // end if %> + + + <% if (view.getTopic()!=null) { %> + conf/posts.jsp?cc=<%= view.getCommunity().getCommunityID() %>&conf=<%= view.getConference().getConfID() %>&top=<%= view.getTopic().getTopicNumber() %> + Return to Topic + <% } else if (view.getConference()!=null) { %> + conf/topics.jsp?cc=<%= view.getCommunity().getCommunityID() %>&conf=<%= view.getConference().getConfID() %> + Return to Topic List + <% } else { %> + conf/conferences.jsp?cc=<%= view.getCommunity().getCommunityID() %> + Return to Conference List + <% } // end if %> +

+ +

+ + <% if (view.getConference()!=null) { %> + + <% if (view.getTopic()!=null) { %> + + <% } // end if %> + <% } // end if %> + + + + Keywords: +
+ +

+ + +<% List results = view.getResults(); %> +<% if (results!=null) { %> + Display Search Results + <% + // Determine the number of results to display and whether to display a "next" button + int dcount = results.size(); + boolean go_next = false; + if (dcount>view.getMaxResults()) + { // there's a "next" + dcount = view.getMaxResults(); + go_next = true; + + } // end if + %> +


+ + + + + +
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> + <%-- The initial search results --%> + Search Results + <% if (view.getFindCount()>0) { %> + (Displaying <%= view.getOffset() + 1 %>-<%= view.getOffset() + dcount %> of + <%= view.getFindCount() %>) + <% } else { %>(None)<% } %> + + <% if (go_next || (data.getOffset()>0)) { %> + <%-- The navigational form that allows us to page through the results --%> + Navigational form +
+ + <% if (view.getConference()!=null) { %> + + <% if (view.getTopic()!=null) { %> + + <% } // end if %> + <% } // end if %> + + + + <% if (view.getOffset()>0) { %> + + <% } else { %> + + <% } // end if %> +    + <% if (go_next) { %> + + <% } else { %> + + <% } // end if %> +
+ <% } else { %> <% } %> +

+ + <%-- Display the results of the search --%> + + + + + + + + + <% for (int i=0; i + + <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> + + + + + + + <% } // end for %> +
+ Post Link + + Author + + Post Date + + Lines +  
+ go/<%= post.getIdentifier() %> + <%= post.getIdentifier() %> + + user/<%= post.getAuthor() %> + <%= post.getAuthor() %> + + <%= view.formatDate(post.getPostDate()) %> + + <%= post.getLineCount() %> + + <%= post.getText() %> +

+<% } // end if %> diff --git a/web/format/conf/hotlist.jsp b/web/format/conf/hotlist.jsp new file mode 100644 index 0000000..56e1028 --- /dev/null +++ b/web/format/conf/hotlist.jsp @@ -0,0 +1,100 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + JSPView view = JSPView.get(request); + List hotlist = (List)(view.getRequestAttribute("user.conf.hotlist")); +%> +User conference hotlist + + + Return to Front Page +

+ +<% if (hotlist.size()>0) { %> + + <% for (int i=0; i + <% ConferenceContext conf = ((ConferenceHotlistEntry)(hotlist.get(i))).getConference(); %> + <% CommunityContext comm = conf.getEnclosingCommunity(); %> + + + + + + + <% } // end for %> +
+ <% if (i==(hotlist.size()-1)) { %> <% } else { %> + + conf/hotlist_move.js.vs?ndx=<%= i %>&ndx2=<%= i+1 %> + + + <% } // end if %> + + <% if (i==0) { %> <% } else { %> + + conf/hotlist_move.js.vs?ndx=<%= i %>&ndx2=<%= i-1 %> + + + <% } // end if %> + + conf/hotlist_delete.js.vs?ndx=<%= i %> + + + <%= conf.getName() %> + (<%= comm.getName() %>) +

+ + + + + + + + + + + + + + +
+ + + Click this symbol to move the specified conference down in your hotlist. +
+ + + Click this symbol to move the specified conference up in your hotlist. +
+ + + Click this symbol to remove the specified conference from your hotlist. +
+<% } else { %> + + You have no conferences in your conference hotlist. You can add conferences to your hotlist + by visiting the conferences and pressing the "Add to Hotlist" button. + +<% } // end if %> \ No newline at end of file diff --git a/web/format/conf/manage_conf.jsp b/web/format/conf/manage_conf.jsp new file mode 100644 index 0000000..38451e2 --- /dev/null +++ b/web/format/conf/manage_conf.jsp @@ -0,0 +1,74 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.menus.MenuComponent" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); +%> +Managing conference "" + + + + + + conf/topics.js.vs?cc=&conf= + Return to Topic List +

+ +Set Default Pseud Form +

+ + + + Set default pseud for conference: +   + + +

+ +Fixseen Link + + conf/fixseen.js.vs?cc=&conf= + Mark entire conference as read (fixseen) +

 

+ + + Invitation Section + + + You may send an invitation via E-mail to outside individuals to join this community and + read this conference.

+ + conf/invite_conf.js.vs?cc=&conf= + Click here to send an invitation + +

 

+ + +<% MenuComponent mc = (MenuComponent)(view.getRequestAttribute("conference.host.tools.menu")); %> +<% if (mc!=null) { %> + Host Tools Section + <% mc.render(JSPView.getRequestOutput(request),out); %> +<% } // end if %> diff --git a/web/format/conf/manage_list.jsp b/web/format/conf/manage_list.jsp new file mode 100644 index 0000000..46302dd --- /dev/null +++ b/web/format/conf/manage_list.jsp @@ -0,0 +1,140 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); + List confs = (List)(view.getRequestAttribute("conference.list")); + final int[] a_prev = (int[])(view.getRequestAttribute("conference.prev.array")); + final int[] a_next = (int[])(view.getRequestAttribute("conference.next.array")); + final boolean[] a_hidden = (boolean[])(view.getRequestAttribute("conference.hidden.array")); +%> +Manage conference list for community "" + + Community: + + + + + conf/conferences.js.vs?cc= + Return to Conference List + +

+ +<% if (confs.size()>0) { %> + + <% for (int i=0; i + <% ConferenceContext conf = (ConferenceContext)(confs.get(i)); %> + + + + + + + + <% } // end for %> +
+ + <% if (a_hidden[i]) { %> + conf/manage_list_sethide.js.vs?cc=&conf=<%= conf.getConfID() %>&flag=0 + + <% } else { %> + conf/manage_list_sethide.js.vs?cc=&conf=<%= conf.getConfID() %>&flag=1 + + <% } // end if %> + + + <% if (i==(confs.size()-1)) { %> <% } else { %> + + conf/manage_list_swap.js.vs?cc=&conf=<%= conf.getConfID() %>&other=<%= a_next[i] %> + + + <% } // end if %> + + <% if (i==0) { %> <% } else { %> + + conf/manage_list_swap.js.vs?cc=&conf=<%= conf.getConfID() %>&other=<%= a_prev[i] %> + + + <% } // end if %> + + + conf/manage_list_delete.js.vs?cc=&conf=<%= conf.getConfID() %> + + + + <%= conf.getName() %> +

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + This indicates that the conference is displayed in the community's conference list. Click the symbol + to hide it. +
+ + + This indicates that the conference is hidden in the community's conference list. Click the symbol + to display it. +
+ + + Click this symbol to move the specified conference down in the community's conference list. +
+ + + Click this symbol to move the specified conference up in the community's conference list. +
+ + + Click this symbol to delete the specified conference. You will be prompted to confirm this + action. +
+<% } else { %> + There are no conferences in this community. +<% } // end if %> diff --git a/web/format/conf/manage_topic.jsp b/web/format/conf/manage_topic.jsp new file mode 100644 index 0000000..98163d3 --- /dev/null +++ b/web/format/conf/manage_topic.jsp @@ -0,0 +1,109 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.menus.MenuComponent" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/topic" prefix="topic" %> +<% + JSPView view = JSPView.get(request); +%> +Managing topic # in conference "" + + + + + + conf/posts.js.vs?cc=&conf=&top= + Return to Topic +

+ + +

Topic Subscription:
+ + You are currently subscribed to this topic, and will receive all new posts to it via E-mail.

+ + conf/subscribe_topic.js.vs?cc=&conf=&top=&flag=0 + Click Here to Stop Subscribing To This Topic + + + + You are not currently subscribed to this topic. When you subscribe to a topic, you will receive all new + posts to that topic via E-mail.

+ + conf/subscribe_topic.js.vs?cc=&conf=&top=&flag=1 + Click Here to Start Subscribing To This Topic + + +

 

+ + + Invitation Section + + + You may send an invitation via E-mail to outside individuals to join this community and + read this topic in the conference.

+ + conf/invite_topic.js.vs?cc=&conf=&top= + Click Here to send an invitation + +

 

+ + + Filtered Users Section + + <% List bozos = (List)(view.getRequestAttribute("topic.bozos.list")); %> + <% if (bozos.size()>0) { %> + + <% Iterator it = bozos.iterator(); %> + <% while (it.hasNext()) { %> + <% UserProfile prof = (UserProfile)(it.next()); %> + + + + + <% } // end while %> +
+ conf/remove_bozo.js.vs?cc=&conf=&top=&u=<%= prof.getUID() %> + + + < + user/<%= prof.getUserName() %> + <%= prof.getUserName() %> + > + (<%= prof.getGivenName() %> <%= prof.getFamilyName() %>) +

+ + + + + + +
+ + + Click this symbol to cease filtering this user in this topic. +
+ <% } else { %> +

No users currently filtered.
+ <% } // end if %> +
diff --git a/web/format/conf/membership.jsp b/web/format/conf/membership.jsp new file mode 100644 index 0000000..d23b4dc --- /dev/null +++ b/web/format/conf/membership.jsp @@ -0,0 +1,173 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.Iterator" %> +<%@ page import = "java.util.List" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.security.Role" %> +<%@ page import = "com.silverwrist.venice.ui.conf.view.ConfMemberView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + ConfMemberView view = ConfMemberView.get(request); +%> +Set membership view for conference + + + + + + conf/membership.js.vs?cc=&conf= + Redisplay Member List + |  + conf/manage_conf.js.vs?cc=&conf= + Return to Manage Conference Menu +

+ +Find Members of Community "":

+

+ + + + + + Display all community members whose   +
+ + + +
+ +
+
+ +<% List results = view.getResults(); %> +<% if (results!=null) { %> +
+ <% + int dcount = results.size(); + // Determine the number of results to display and whether to display a "next" button + boolean go_next = false; + if (dcount>view.getMaxResults()) + { // there's a "next" + dcount = view.getMaxResults(); + go_next = true; + + } // end if + %> + + + + +
+ <%-- The conference members/search results header --%> + + <% if (view.getSimple()) { %>Conference Members:<% } else { %>Search Results:<% } %> + + (Displaying <%= view.getOffset() + 1 %>-<%= view.getOffset() + dcount %> of + <%= view.getFindCount() %>) + + <% if (go_next || (view.getOffset()>0)) { %> + <%-- The navigational form that allows us to page through the results --%> + Navigational Form +
+ + + + + + + + + <% if (view.getOffset()>0) { %> + + <% } else { %> + + <% } // end if %> +   + <% if (go_next) { %> + + <% } else { %> + + <% } // end if %> +
+ <% } else { %> <% } %> +

+ + <%-- Display the results of the search --%> + <% if (results.size()>0) { %> + Update Form +
+ + + + + + + + + <% StringBuffer buf = new StringBuffer(":"); %> + + <% for (int i=0; i + + <% UserFound uf = (UserFound)(results.get(i)); %> + <% buf.append(uf.getUID()).append(":"); %> + + + + + + <% } // end for %> +
+ + user/<%= uf.getName() %> + <%= uf.getName() %> + +    + + +

+ + +
+ <% } // end if %> +<% } // end if %> diff --git a/web/format/conf/new_topic.jsp b/web/format/conf/new_topic.jsp new file mode 100644 index 0000000..bab222e --- /dev/null +++ b/web/format/conf/new_topic.jsp @@ -0,0 +1,67 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/post" prefix="post" %> +<% + JSPView view = JSPView.get(request); + CurrentConference currc = CurrentConference.get(request); + final String preview_text = (String)(view.getRequestAttribute("preview.text")); +%> +New topic in conference "" + + <% if (preview_text==null) { %> + Create New Topic + <% } else { %> + Preview New Topic + <% } // end if %> + in: + + +<% if (preview_text!=null) { %> + + <% final int num_errors = ((Integer)(view.getRequestAttribute("preview.num_errors"))).intValue(); %> + <% if (num_errors==0) { %> + Your post did not contain any spelling errors. + <% } else if (num_errors==1) { %> + There was 1 spelling error in your post. + <% } else { %> + There were <%= num_errors %> spelling errors in your post. + <% } // end if %> + +

<%= preview_text %>

+<% } // end if %> + + + + + <%= view.getRequestAttribute("postbox.newtopic") %> + <%= view.getRequestAttribute("postbox.pseud") %> + <% if (view.getRequestAttribute("postbox.attach")!=null) { %> + + <% } else { %> + + <% } // end if %> + <%= view.getRequestAttribute("postbox.data") %> + + diff --git a/web/format/conf/posts.jsp b/web/format/conf/posts.jsp new file mode 100644 index 0000000..0a28f49 --- /dev/null +++ b/web/format/conf/posts.jsp @@ -0,0 +1,546 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.conf.view.PostsView" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/post" prefix="post" %> +<% + PostsView view = PostsView.get(request); + final CommunityContext my_comm = view.getCommunity(); + final ConferenceContext my_conf = view.getConference(); + final TopicContext my_topic = view.getTopic(); + final short my_topicnum = my_topic.getTopicNumber(); + final short my_next = view.getNextTopic(); + final int my_total_msg = my_topic.getTotalMessages(); + final int my_unread = view.getUnread(); + final int my_first = view.getFirst(); + final int my_last = view.getLast(); + final int my_pagesize = view.getPageSize(); + final String base_locator = "cc=" + my_comm.getCommunityID() + "&conf=" + my_conf.getConfID(); + final String topic_locator = base_locator + "&top=" + my_topicnum; + final String next_locator = base_locator + "&top=" + my_next; + final String restorer = "rtop=" + my_topicnum + "&rct=" + my_unread; +%> + + Posts <%= my_first %> through <%= my_last %> in topic #<%= my_topic.getTopicID() %> + + + <%= view.getTitle() %> + + <% if (my_topic.isArchived()) { %> + (Archived) + <% } else if (my_topic.isFrozen()) { %> + (Frozen) + <% } // end if %> + <%= view.getSubtitle() %> + + + +<%= view.getTopCustom() %> + + + + + <% out.flush(); response.flushBuffer(); %> + + + + + + <% out.flush(); response.flushBuffer(); %> + + + + + +
+ Topic user controls section + + conf/topics.js.vs?<%= base_locator %> + + +   + <% if (my_topic.isHidden()) { %> + + conf/hide_topic.js.vs?<%= topic_locator %>&flag=0 + + + <% } else { %> + + conf/hide_topic.js.vs?<%= topic_locator %>&flag=1 + + + <% } // end if %> +   + <% if (view.canDoNextTopic()) { %> + + conf/posts.js.vs?<%= next_locator %>&rnm=1 + + +   + <% if (my_unread>0) { %> + + conf/posts.js.vs?<%= next_locator %>&rnm=1&<%= restorer %> + + +   +<% + } // end if + } // end if +%> + + conf/find.js.vs?<%= topic_locator %> + + +   + + conf/manage_topic.js.vs?<%= topic_locator %> + + +
  + Topic admin controls section + <% if (my_topic.canFreeze()) { %> +   + <% if (my_topic.isFrozen()) { %> + + conf/freeze_topic.js.vs?<%= topic_locator %>&flag=0 + + + <% } else { %> + + conf/freeze_topic.js.vs?<%= topic_locator %>&flag=1 + + +<% + } // end if + } // end if + if (my_topic.canArchive()) { +%> +   + <% if (my_topic.isArchived()) { %> + + conf/archive_topic.js.vs?<%= topic_locator %>&flag=0 + + + <% } else { %> + + conf/archive_topic.js.vs?<%= topic_locator %>&flag=1 + + +<% + } // end if + } // end if + if (my_topic.canDelete()) { +%> +   + + conf/delete_topic.js.vs?<%= topic_locator %> + + + <% } // end if %> +
+ Go box +
+ + + +   + +
+
+ Upper navigation linkset + [  + + conf/posts.js.vs?<%= topic_locator %>&p1=0&p2=-1 + View All + + <% if (my_first>0) { %> +  |  + + +conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) %>&p2=<%= my_first - 1 - Math.min(my_first - my_pagesize,0) %> + + Scroll Up <%= my_pagesize %> + +<% + } // end if + if ((my_total_msg - (my_last + 1))>0) { +%> +  |  + + +conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_last + my_pagesize,my_total_msg - 1) %> + + Scroll Down <%= my_pagesize %> + +  |  + + + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_total_msg - my_pagesize %>&p2=<%= my_total_msg - 1 %> + + Scroll To End + + <% } // end if %> +  |  + Bottom +  ] +
+<% out.flush(); response.flushBuffer(); %> + +Begin Actual Messages +<% + Iterator it = view.getMessages().iterator(); + String last_post = "shac=1&p1=" + String.valueOf(my_total_msg - 1); + boolean can_line = false; + while (it.hasNext()) { + TopicMessageContext msg = (TopicMessageContext)(it.next()); + String poster = view.getPosterName(msg); + if (can_line && (msg.getPostNumber()==(my_total_msg-my_unread))) { + out.write("
\n"); + } // end if + + if (view.getShowAdvanced() && (view.getMessages().size()==1)) { +%> +
+
+ <% } // end if %> + +<% + if (!(view.bozoFilterUser(msg.getCreatorUID()))) { + out.write(view.getUserPhotoTag(JSPView.getRequestOutput(request),msg.getCreatorUID())); + } // end if +%> + + + conf/posts.js.vs?<%= topic_locator %>&shac=1&p1=<%= msg.getPostNumber() %> + + <%= msg.getPostNumber() %> + of + + conf/posts.js.vs?<%= topic_locator %>&<%= last_post %> + <%= my_total_msg - 1 %> + + + <<%= view.getTopicStem() %><%= msg.getPostNumber() %>> + + +<% + if (view.getShowAdvanced() && (view.getMessages().size()==1)) { + if (msg.isHidden()) { + out.write("(Hidden)\n"); + } // end if + if (view.showBozoFilteredIndicator(msg.getCreatorUID())) { +%> + (User filtered; + + + conf/message_bozo.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>&flag=0 + + remove filter + ) + +<% + } // end if + } // end if + if (!(view.bozoFilterUser(msg.getCreatorUID()))) { +%> +
+ <%= msg.getPseud() %> + ( + + user/<%= poster %> + <%= poster %> + , + <%= view.formatDate(msg.getPostDate()) %> + ) +<% + if (msg.hasAttachment()) { + if (view.displayAttachmentInNewWindow(msg)) { +%> + + + conf/view_attachment.js.vs?<%= base_locator %>&msg=<%= msg.getPostID() %> + + + + + (Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes) + + + + + (Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes) + + + <% } else { %> + + +<% + } // end if + } // end if + } // end if +%> +
+

+ <% if (msg.isScribbled()) { %> + + (Scribbled by <%= view.getMessageBodyText(msg) %> on + <%= view.formatDate(msg.getScribbleDate()) %>) + + <% if (view.getPhotoDims()!=null) { %>
<% } %>

+ <% } else if (view.bozoFilterUser(msg.getCreatorUID())) { %> + + + + conf/posts.js.vs?<%= topic_locator %>&shac=1&nbz=1&p1=<%= msg.getPostNumber() %> + + + (Message from Filtered User: + <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>) + + +

+ <% } else if (msg.isHidden() && (!(view.getShowAdvanced()) || (view.getMessages().size()!=1))) { %> + + + + conf/posts.js.vs?<%= topic_locator %>&shac=1&p1=<%= msg.getPostNumber() %> + + + (Hidden Message: + <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>) + + + + <% if (view.getPhotoDims()!=null) { %>
<% } %>

+ <% } else { %> +

<%= view.getMessageBodyText(msg) %>
+ <% if (view.getPhotoDims()!=null) { %>
<% } %>

+<% + } // end if + if (view.getShowAdvanced() && (view.getMessages().size()==1)) { +%> +

+<% + if (!(msg.isScribbled())) { + if (msg.canHide()) { + if (msg.isHidden()) { +%> + + + conf/hide_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>&flag=0 + + +

+ <% } else { %> + + + conf/hide_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>&flag=1 + + +

+<% + } // end if + } // end if (can hide) + if (msg.canScribble()) { +%> + + + conf/scribble_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %> + + +

+<% + } // end if (can scribble) + } // end if (not already scribbled) + if (view.showFilterButton(msg.getCreatorUID())) { +%> + + + conf/message_bozo.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>&flag=1 + + +

+<% + } // end if (can bozo filter) + if (msg.canNuke()) { +%> + + + conf/nuke_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %> + + +

+<% + } // end if (can nuke) + if (msg.canPublish()) { +%> + + + conf/publish_message.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %> + + +

+ <% } // end if (can publish) %> +


+<% + } // end if (showing advanced controls) + can_line = true; + out.flush(); + response.flushBuffer(); +} // end while +%> +End Actual Messages + + + + + + + <% out.flush(); response.flushBuffer(); %> + + + + +
  + Lower navigation linkset + [  + + conf/posts.js.vs?<%= topic_locator %>&p1=0&p2=-1 + View All + + <% if (my_first>0) { %> +  |  + + +conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) %>&p2=<%= my_first - 1 - Math.min(my_first - my_pagesize,0) %> + + Scroll Up <%= my_pagesize %> + + <% } // end if %> + <% if ((my_total_msg - (my_last + 1))>0) { %> +  |  + + +conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_last + my_pagesize,my_total_msg - 1) %> + + Scroll Down <%= my_pagesize %> + +  |  + + + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_total_msg - my_pagesize %>&p2=<%= my_total_msg - 1 %> + + Scroll To End + + <% } // end if %> +  |  + Top +  ] +
+ Topic user controls section + + conf/topics.js.vs?<%= base_locator %> + + +   + <% if (my_topic.isHidden()) { %> + + conf/hide_topic.js.vs?<%= topic_locator %>&flag=0 + + + <% } else { %> + + conf/hide_topic.js.vs?<%= topic_locator %>&flag=1 + + + <% } // end if %> +   + <% if (view.canDoNextTopic()) { %> + + conf/posts.js.vs?<%= next_locator %>&rnm=1 + + +   + <% if (my_unread>0) { %> + + conf/posts.js.vs?<%= next_locator %>&rnm=1&<%= restorer %> + + +   +<% + } // end if + } // end if +%> + + conf/find.js.vs?<%= topic_locator %> + + +   + + conf/manage_topic.js.vs?<%= topic_locator %> + + +
+<% out.flush(); response.flushBuffer(); %> + +<% + final boolean flag1 = my_conf.canPostToConference(); + final boolean flag2 = (my_topic.isFrozen() ? my_topic.canFreeze() : true); + final boolean flag3 = (my_topic.isArchived() ? my_topic.canArchive() : true); + if (flag1 && flag2 && flag3) { +%> +
+ Post Message in "<%= my_topic.getName() %>": +
+ + <%= my_comm.getCommunityID() %> + <%= my_conf.getConfID() %> + <%= my_topicnum %> + <% if (view.canDoNextTopic()) { %> + <%= my_next %> + <% } // end if %> + <%= my_total_msg %> + <%= my_conf.getDefaultPseud() %> + + + + <% if (view.canDoNextTopic()) { %> + + <% } // end if %> + + +<% + } else if (my_conf.canPostToConference()) { + if (my_topic.isArchived()) { +%> +
This is an + Archived Topic
+ <% } else if (my_topic.isFrozen()) { %> +
This is a + Frozen Topic
+<% + } // end if + } // end if +%> +<%= view.getBottomCustom() %> +<% out.flush(); response.flushBuffer(); %> diff --git a/web/format/conf/preview.jsp b/web/format/conf/preview.jsp new file mode 100644 index 0000000..6a5d0d3 --- /dev/null +++ b/web/format/conf/preview.jsp @@ -0,0 +1,69 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/topic" prefix="topic" %> +<%@ taglib uri="/tlds/post" prefix="post" %> +<% + JSPView view = JSPView.get(request); + CurrentConference currc = CurrentConference.get(request); +%> + + + <% final int num_errors = ((Integer)(view.getRequestAttribute("preview.num_errors"))).intValue(); %> + <% if (num_errors==0) { %> + Your post did not contain any spelling errors. + <% } else if (num_errors==1) { %> + There was 1 spelling error in your post. + <% } else { %> + There were <%= num_errors %> spelling errors in your post. + <% } // end if %> + +<% String tmp = view.getRequestAttribute("preview.text").toString(); %> +

<%= tmp %>

+ +<% final String next = (String)(view.getRequestAttribute("postbox.hidden.next")); %> + + + + + <% if (next!=null) { %> + <%= next %> + <% } // end if %> + <%= view.getRequestAttribute("postbox.hidden.sd") %> + <% if (view.getRequestAttribute("postbox.hidden.slip")!=null) { %> + Y + <% } // end if %> + <%= view.getRequestAttribute("postbox.pseud") %> + <% if (view.getRequestAttribute("postbox.attach")!=null) { %> + + <% } else { %> + + <% } // end if %> + <%= view.getRequestAttribute("postbox.data") %> + + <% if (next!=null) { %> + + <% } // end if %> + + diff --git a/web/format/conf/report_menu.jsp b/web/format/conf/report_menu.jsp new file mode 100644 index 0000000..768012a --- /dev/null +++ b/web/format/conf/report_menu.jsp @@ -0,0 +1,76 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<% + JSPView view = JSPView.get(request); +%> +Reports for conference "" + + + + + + conf/manage_conf.js.vs?cc=&conf= + Return to Manage Conference Menu +

+ + + + + + + + + + + + + + + <% + List list = (List)(view.getRequestAttribute("conference.reports.topiclist")); + Iterator it = list.iterator(); + %> + <% while (it.hasNext()) { %> + <% TopicContext topic = (TopicContext)(it.next()); %> + + + + + + + <% } // end while %> +
#Topic NameReports
 (Entire conference) + conf/poster_report.js.vs?cc=&conf= + Posters + + conf/lurker_report.js.vs?cc=&conf= + Readers/Lurkers +
<%= topic.getTopicNumber() %><%= topic.getName() %> + conf/poster_report.js.vs?cc=&conf=&top=<%= topic.getTopicNumber() %> + Posters + + conf/lurker_report.js.vs?cc=&conf=&top=<%= topic.getTopicNumber() %> + Readers/Lurkers +

diff --git a/web/format/conf/slippage.jsp b/web/format/conf/slippage.jsp new file mode 100644 index 0000000..5c4164d --- /dev/null +++ b/web/format/conf/slippage.jsp @@ -0,0 +1,99 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.conf.view.PostsView" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/topic" prefix="topic" %> +<%@ taglib uri="/tlds/post" prefix="post" %> +<% + JSPView view = JSPView.get(request); + CurrentConference currc = CurrentConference.get(request); +%> +Slippage detected in topic ID + + + The following posts slipped in while you were typing. You may choose to edit your message and + re-post, just post it as is, or cancel your posting altogether. +

+<% out.flush(); response.flushBuffer(); %> + +Begin Slipped Messages +<% + final List messages = (List)(view.getRequestAttribute("slippage.messages")); + final String stem = view.getRequestAttribute("slippage.topic_stem").toString(); + Iterator it = messages.iterator(); + while (it.hasNext()) { + TopicMessageContext msg = (TopicMessageContext)(it.next()); + String poster = PostsView.getPosterName(msg); + %> + + <%= msg.getPostNumber() %> of + <<%= stem %><%= msg.getPostNumber() %>>
+ <%= msg.getPseud() %> + ( + user/<%= poster %> + <%= poster %> + ) + <%= view.formatDate(msg.getPostDate()) %> +

+ <% if (msg.isScribbled()) { %> + + (Scribbled by <%= PostsView.getMessageBodyText(msg) %> on <%= view.formatDate(msg.getScribbleDate()) %>) + + <% } else { %> +

<%= PostsView.getMessageBodyText(msg) %>
+<% + } // end if + out.flush(); + response.flushBuffer(); + } // end while +%> +End Slipped Messages + +
+ Post Message in "": +
+ +<% final String next = (String)(view.getRequestAttribute("postbox.hidden.next")); %> + + + + + <% if (next!=null) { %> + <%= next %> + <% } // end if %> + <%= view.getRequestAttribute("postbox.hidden.sd") %> + Y + <%= view.getRequestAttribute("postbox.pseud") %> + <% if (view.getRequestAttribute("postbox.attach")!=null) { %> + + <% } else { %> + + <% } // end if %> + <%= view.getRequestAttribute("postbox.data") %> + + <% if (next!=null) { %> + + <% } // end if %> + + diff --git a/web/format/conf/topics.jsp b/web/format/conf/topics.jsp new file mode 100644 index 0000000..b00bb44 --- /dev/null +++ b/web/format/conf/topics.jsp @@ -0,0 +1,252 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.conf.CurrentConference" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/community" prefix="comm" %> +<%@ taglib uri="/tlds/conference" prefix="conf" %> +<%@ taglib uri="/tlds/topic" prefix="topic" %> +<%! + // since these values are used frequently in this page, redeclare them from ConferenceContext + // to help minimize the clutter + private static final int DISPLAY_NEW = ConferenceContext.DISPLAY_NEW; + private static final int DISPLAY_ACTIVE = ConferenceContext.DISPLAY_ACTIVE; + private static final int DISPLAY_ALL = ConferenceContext.DISPLAY_ALL; + private static final int DISPLAY_HIDDEN = ConferenceContext.DISPLAY_HIDDEN; + private static final int DISPLAY_ARCHIVED = ConferenceContext.DISPLAY_ARCHIVED; + + private static final int SORT_NUMBER = ConferenceContext.SORT_NUMBER; + private static final int SORT_NAME = ConferenceContext.SORT_NAME; + private static final int SORT_UNREAD = ConferenceContext.SORT_UNREAD; + private static final int SORT_TOTAL = ConferenceContext.SORT_TOTAL; + private static final int SORT_DATE = ConferenceContext.SORT_DATE; +%> +<% + JSPView view = JSPView.get(request); + CurrentConference currc = CurrentConference.get(request); + final int view_opt = currc.getViewOption(); + final int sort_opt = currc.getSortOption(); + final String base_locator = "cc=" + view.getCommunity().getCommunityID() + "&conf=" + + currc.getConference().getConfID(); +%> +Topic list for conference "" +Topics in + +<%= view.getRequestAttribute("conference.custom.top").toString() %> + +
+ + conf/conferences.js.vs?<%= base_locator %> + +   + + + conf/new_topic.js.vs?<%= base_locator %> + +   + + <% final String rnew = (String)(view.getRequestAttribute("conference.readnew")); %> + <% if (rnew!=null) { %> + + <%= rnew %> + +   + <% } // end if %> + + conf/find.js.vs?<%= base_locator %> + +   + + conf/manage_conf.js.vs?<%= base_locator %> + +   + + + conf/add_to_hotlist.js.vs?<%= base_locator %> + +   + +
+ <% out.flush(); response.flushBuffer(); %> + + <% final List topics = (List)(view.getRequestAttribute("topics.list")); %> + <% if (topics.size()>0) { %> + + + + + + + + + <% out.flush(); response.flushBuffer(); %> + + +<% + Iterator it = topics.iterator(); + while (it.hasNext()) { + TopicContext topic = (TopicContext)(it.next()); + short num = topic.getTopicNumber(); + String my_locator = base_locator + "&top=" + num; +%> + + + + + + + +<% + out.flush(); + response.flushBuffer(); + } // end while (more topics in enumeration) +%> +
+ + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_NUMBER) ? -SORT_NUMBER : SORT_NUMBER) %> + # +    + + + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_NAME) ? -SORT_NAME : SORT_NAME) %> + Topic Name + + + + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_UNREAD) ? -SORT_UNREAD : SORT_UNREAD) %> + New + + + + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_TOTAL) ? -SORT_TOTAL : SORT_TOTAL) %> + Total + + + + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_DATE) ? -SORT_DATE : SORT_DATE) %> + Last Response + +
 
+ + conf/posts.js.vs?<%= my_locator %>&rnm=1 + <%= num %> +    + + + conf/posts.js.vs?<%= my_locator %>&rnm=1 + <%= topic.getName() %> + + <% if (topic.isArchived() && (view_opt!=DISPLAY_ARCHIVED)) { %> + (archived) + <% } else if (topic.isFrozen()) { %> + (frozen) + <% } // end if %> + + + conf/posts.js.vs?<%= my_locator %>&rnm=1 + <%= topic.getUnreadMessages() %> + + + + conf/posts.js.vs?<%= my_locator %>&p1=0&p2=-1 + <%= topic.getTotalMessages() %> + + + + conf/posts.js.vs?<%= my_locator %>&rnm=1 + <%= view.formatDate(topic.getLastUpdateDate()) %> + +

+ <% } else { %> + <% + switch (view_opt) + { + case DISPLAY_NEW: + out.write("No topics with unread messages found."); + break; + case DISPLAY_ACTIVE: + case DISPLAY_ALL: + out.write("No active topics found."); + break; + case DISPLAY_HIDDEN: + out.write("No hidden topics found."); + break; + case DISPLAY_ARCHIVED: + out.write("No archived topics found."); + break; + default: + out.write("Invalid display option selected."); + break; + } // end switch + %> +

+ <% } // end if %> + <% out.flush(); response.flushBuffer(); %> + +

+ [ + <% if (view_opt==DISPLAY_NEW) { %> + New + <% } else { %> + + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_NEW %> + New + + <% } // end if %> + | + <% if (view_opt==DISPLAY_ACTIVE) { %> + Active + <% } else { %> + + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ACTIVE %> + Active + + <% } // end if %> + | + <% if (view_opt==DISPLAY_ALL) { %> + All + <% } else { %> + + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ALL %> + All + + <% } // end if %> + | + <% if (view_opt==DISPLAY_HIDDEN) { %> + Hidden + <% } else { %> + + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_HIDDEN %> + Hidden + + <% } // end if %> + | + <% if (view_opt==DISPLAY_ARCHIVED) { %> + Archived + <% } else { %> + + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ARCHIVED %> + Archived + + <% } // end if %> + ] +
+
+<%= view.getRequestAttribute("conference.custom.bottom").toString() %> diff --git a/web/format/conf_activity.jsp b/web/format/conf_activity.jsp deleted file mode 100644 index ac29521..0000000 --- a/web/format/conf_activity.jsp +++ /dev/null @@ -1,113 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ConferenceActivity data = ConferenceActivity.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% - if (data.isTopicReport()) - rdat.writeContentHeader(out,(data.isPosterReport() ? "Posters in Topic:" - : "Readers in Topic:"), - data.getTopicName() + " in " + data.getConfName()); - else - rdat.writeContentHeader(out,(data.isPosterReport() ? "Posters in Conference:" - : "Readers in Conference:"),data.getConfName()); -%> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to - Conference Reports Menu -

- -<% if (data.anyElements()) { %> - - - - <% if (data.isPosterReport()) { %> - - - <% } else { %> - - - <% } // end if %> - - <% Iterator it = data.getRecordsIterator(); %> - <% while (it.hasNext()) { %> - <% ActiveUser usr = (ActiveUser)(it.next()); %> - - - <% if (data.isPosterReport()) { %> - - - <% } else { %> - - - <% } // end if %> - - <% } // end while %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - User Name - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Last Posted - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Last Read - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Last Read - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Last Posted -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - " TARGET="_blank"><%= usr.getName() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(rdat.formatDateForDisplay(usr.getLastWrite())) %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (usr.getLastRead()==null) { %> - Never - <% } else { %> - <%= StringUtil.encodeHTML(rdat.formatDateForDisplay(usr.getLastRead())) %> - <% } // end if %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(rdat.formatDateForDisplay(usr.getLastRead())) %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (usr.getLastWrite()==null) { %> - Never - <% } else { %> - <%= StringUtil.encodeHTML(rdat.formatDateForDisplay(usr.getLastWrite())) %> - <% } // end if %> -
-<% } else { %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (data.isTopicReport()) { %> - <% if (data.isPosterReport()) { %> - No posters to topic "<%= data.getTopicName() %>" found. - <% } else { %> - No readers of topic "<%= data.getTopicName() %>" found. - <% } // end if %> - <% } else { %> - <% if (data.isPosterReport()) { %> - No posters to conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found. - <% } else { %> - No readers of conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found. - <% } // end if %> - <% } // end if %> - -<% } // end if %> diff --git a/web/format/conf_custom.jsp b/web/format/conf_custom.jsp deleted file mode 100644 index ca481f9..0000000 --- a/web/format/conf_custom.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ConferenceCustomBlocks data = ConferenceCustomBlocks.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Customize Conference:",data.getConferenceName()); %> - -

">
- - - - - - - - - - - - - - - - - - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Custom HTML block to appear at top of Topic List/Posts pages: -
- -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Custom HTML block to appear at bottom of Topic List/Posts pages: -
- -
- " NAME="update" - ALT="Update" WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" - ALT="Cancel" WIDTH=80 HEIGHT=24 BORDER=0> - - ">" ALT="Remove" WIDTH=80 HEIGHT=24 BORDER=0> -
-
\ No newline at end of file diff --git a/web/format/conf_member.jsp b/web/format/conf_member.jsp deleted file mode 100644 index 3fa3650..0000000 --- a/web/format/conf_member.jsp +++ /dev/null @@ -1,155 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ConferenceMembership data = ConferenceMembership.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Set Conference Membership:",data.getConfName()); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to - Manage Conference Menu -

- -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Find users in community -"<%= data.getCommunityName() %>":

-

">
- - - - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Display all community members whose   -
- - -
- " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
- -
- -<% if (data.displayList()) { %> - <% int dcount = data.getSize(); %> -
- <% if (data.conferenceMemberList()) { %> - <%-- The conference list header --%> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - Members of Conference "<%= StringUtil.encodeHTML(data.getConfName()) %>": -
- <% } else { %> - <% - // Determine the number of results to display and whether to display a "next" button - boolean go_next = false; - if (dcount>data.getNumResultsDisplayed()) - { // there's a "next" - dcount = data.getNumResultsDisplayed(); - go_next = true; - - } // end if - %> - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%-- The search results header --%> - Search Results: - <% if (data.getFindCount()>0) { %> - (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of - <%= data.getFindCount() %>) - <% } else { %>(None)<% } %> - - <% if (go_next || (data.getOffset()>0)) { %> - <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- - - - - - - - - <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> - -
- <% } else { %> <% } %> -

- <% } // end if %> - - <%-- Display the results of the search --%> -
">
- - - - - <% for (int i=0; i - <% UserFound uf = data.getItem(i); %> - - - - - - <% } // end for %> -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= uf.getName() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% data.outputDropDown(out,uf.getUID(),uf.getLevel()); %> -

- " NAME="update" ALT="Update" - WIDTH=80 HEIGHT=24 BORDER=0> -

-<% } // end if %> diff --git a/web/format/conf_sequence.jsp b/web/format/conf_sequence.jsp deleted file mode 100644 index 0997e4e..0000000 --- a/web/format/conf_sequence.jsp +++ /dev/null @@ -1,140 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ConferenceSequence data = ConferenceSequence.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Manage Conference List",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Return to Conference List -

-<% if (data.getNumConferences()>0) { %> - - <% for (int i=0; i - <% - ConferenceContext conf = data.getConference(i); - String partial = "confops?sig=" + data.getCommunityID() + "&conf=" + conf.getConfID(); - String tail, image, alt; - %> - - - - - - - - <% } // end for %> -
- <% - if (data.isConferenceHidden(conf)) - { // conference is hidden - this command will show it - tail = "&cmd=SH&flag=0"; - image = "icn_off.gif"; - alt = "Hidden (toggle)"; - - } // end if - else - { // conference is non-hidden - this command will hide it - tail = "&cmd=SH&flag=1"; - image = "icn_on.gif"; - alt = "Displayed (toggle)"; - - } // end else - %> - <%= alt %> - - <% if (i==(data.getNumConferences()-1)) { %> <% } else { %> - <% tail = "&cmd=SS&oc=" + data.getNextConfID(conf); %> - " ALT="Move Down" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - <% if (i==0) { %> <% } else { %> - <% tail = "&cmd=SS&oc=" + data.getPrevConfID(conf); %> - " ALT="Move Up" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - ">" ALT="Remove" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(conf.getName()) %> -

- - - - - - - - - - - - - - - - - - - - - - -
- " ALT="Displayed (toggle)" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - This indicates that the conference is displayed in the community's conference list. Click the symbol - to hide it. -
- " ALT="Hidden (toggle)" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - This indicates that the conference is hidden in the community's conference list. Click the symbol - to display it. -
- " ALT="Move Down" BORDER=0 WIDTH=16 HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Click this symbol to move the specified conference down in the community's conference list. -
- " ALT="Move Up" BORDER=0 WIDTH=16 HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Click this symbol to move the specified conference up in the community's conference list. -
- " ALT="Remove" BORDER=0 WIDTH=16 HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Click this symbol to delete the specified conference. You will be prompted to confirm this - action. -
-<% } else { %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>There are no conferences in - this community. -<% } // end if %> diff --git a/web/format/conferences.jsp b/web/format/conferences.jsp deleted file mode 100644 index f839560..0000000 --- a/web/format/conferences.jsp +++ /dev/null @@ -1,78 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ConferenceListing data = ConferenceListing.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Conference List:",data.getCommunityName()); %> -<% if (data.getNumConferences()>0) { %> - - <% for (int i=0; i - - - - - <% } // end for (each conference) %> -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% String path = "confdisp?sig=" + data.getCommunityID() + "&conf=" + data.getConferenceID(i); %> - <%= StringUtil.encodeHTML(data.getConferenceName(i)) %> - - Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %> - <% if (data.anyUnread(i)) { %> - ">" ALT="New!" BORDER=0 WIDTH=40 HEIGHT=20> - <% } // end if %> -
- <% int count = data.getNumHosts(i); %> - <% if (count>0) { %> - <% if (count>1) { %>Hosts<% } else { %>Host<% } %>: - <% for (int j=0; j - "><%= data.getHostName(i,j) %><% if (j<(count-1)) { %>,<% } %> - <% } // end for (each hostname) %> - <% } else { %> - Hosts: (none) - <% } // end if (hosts present in the conference) %>
- <%= StringUtil.encodeHTML(data.getDescription(i)) %> -

-<% } else { %> - No conferences found in this community.
-<% } // end if (conferences present) %> -

-

- " ALT="Find" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% if (data.canManageConferences()) { %> - ">" ALT="Manage" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% } // end if %> - <% if (data.canCreateConference()) { %> - ">" ALT="Create New" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% } // end if %> -
diff --git a/web/format/find.jsp b/web/format/find.jsp index 6e49c0a..cabbc40 100644 --- a/web/format/find.jsp +++ b/web/format/find.jsp @@ -15,286 +15,332 @@ Contributor(s): --%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> +<%@ page import = "java.util.Iterator" %> +<%@ page import = "java.util.List" %> <%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.FindView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> <% - FindData data = FindData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); + FindView data = FindView.get(request); %> -<% data.writeHeader(rdat,out); %> +Find page + + <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> + Communities + + <% } else { %> + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> + Communities + + <% } // end if %> + <% if (data.testDisplayMode(FindView.FD_USERS)) { %> + + find.js.vs?disp=<%= FindView.FD_USERS %> + Users + + <% } else { %> + + find.js.vs?disp=<%= FindView.FD_USERS %> + Users + + <% } // end if %> + <% if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> + + find.js.vs?disp=<%= FindView.FD_CATEGORIES %> + Categories + + <% } else { %> + + find.js.vs?disp=<%= FindView.FD_CATEGORIES %> + Categories + + <% } // end if %> + <% if (data.testDisplayMode(FindView.FD_POSTS)) { %> + + find.js.vs?disp=<%= FindView.FD_POSTS %> + Posts + + <% } else { %> + + find.js.vs?disp=<%= FindView.FD_POSTS %> + Posts + + <% } // end if %> + <%-- Display the search form --%> -<% if (rdat.useHTMLComments()) { %><% } %> -
">
- +Find form +
+ - <% if (data.getDisplayOption()==FindData.FD_POSTS) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Posts:
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Keywords: - -
+ <% if (data.testDisplayMode(FindView.FD_POSTS)) { %> + Find Posts form + Find Posts: + + Keywords: +
<% } else { %> - <% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Communities:
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> + Find Communities form + Find Communities: + Display all communities whose  
- - <% } else if (data.getDisplayOption()==FindData.FD_USERS) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Users:
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> +
+ <% } else if (data.testDisplayMode(FindView.FD_USERS)) { %> + Find Users form + Find Users: + Display all users whose  
- - <% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Categories:
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> +
+ <% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> + Find Categories form + Find Categories: + Display all categories whose name   - + <% } else { %> <%-- shouldn't get here --%>

Display parameter invalid!

<% } // end if %> - + - <% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% } else { %>  <% } %> + <% if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %>
<% } else { %>  <% } %>
- - <% } // end if %> - " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
- -
+ VALUE="<%= data.getTerm() %>">
+ + <% } // end if %> + +
<%-- Display the current category --%> -<% String a_head, a_tail; // used for formatting category display %> <% CategoryDescriptor cat = data.getCategory(); %> <% if (cat!=null) { %> - <% if (rdat.useHTMLComments()) { %><% } %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Category: - <% - a_head = ""; - a_tail = ""; - if (cat.getCategoryID()>=0) - { // assign the anchor tags - a_head = ""; - a_tail = ""; - - } // end if - %> - <%= a_head %>Top<%= a_tail %> - <% if (cat.getCategoryID()>=0) { %> - <% for (int i=0; i - <% - a_head = ": "; - a_tail = ""; - if (i<(cat.getNumLevels()-1)) - { // assign the anchor tags - a_head = ": "; - a_tail = ""; - - } // end if - %> - <%= a_head %><%= StringUtil.encodeHTML(cat.getTitleAtLevel(i)) %><%= a_tail %> - <% } // end for %> - <% } // end if (displaying the entire subcategory tree) %> + Display Category Name +
+ Category: + <% if (cat.getCategoryID()<0) { %> + Top + <% } else { %> + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> + Top + + <% for (int i=0; i + <% if (i<(cat.getNumLevels()-1)) { %> + : + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %> + <%= cat.getTitleAtLevel(i) %> + + <% } else { %> + : <%= cat.getTitleAtLevel(i) %> + <% } // end if %> + <% } // end for %> + <% } // end if (displaying the subcategory tree) %>

<%-- Display the subcategory list --%> - <% List subcats = data.getSubCategoryList(); %> + <% List subcats = data.getSubCategories(); %> <% if ((subcats!=null) && (subcats.size()>0)) { %> - <% if (rdat.useHTMLComments()) { %><% } %> + Display Subcategory List Subcategories:
<% Iterator it = subcats.iterator(); %> <% while (it.hasNext()) { %> - - + + <% } // end while %>
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% - CategoryDescriptor c = (CategoryDescriptor)(it.next()); - a_head = ""; - %> - <%= a_head %><%= StringUtil.encodeHTML(c.getTitleAtLevel(c.getNumLevels()-1)) %> + + <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %> + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= c.getLinkedCategoryID() %> + <%= c.getTitleAtLevel(c.getNumLevels()-1) %> + <% if (c.isSymbolicLink()) { %>@<% } %> -
<% } // end if (displaying subcategory list) %> - + <% } // end if (category specified) %> - -<% List results = data.getResultsList(); %> + +<%-- Display the search results --%> +<% List results = data.getResults(); %> <% if (results!=null) { %> - <% if (rdat.useHTMLComments()) { %><% } %> + Display Search Results <% // Determine the number of results to display and whether to display a "next" button int dcount = results.size(); boolean go_next = false; - if (dcount>data.getNumResultsDisplayed()) + if (dcount>data.getMaxResults()) { // there's a "next" - dcount = data.getNumResultsDisplayed(); + dcount = data.getMaxResults(); go_next = true; } // end if %>


- +
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> + <%-- The initial search results --%> <% if (cat!=null) { %>Communities in Category<% } else { %>Search Results<% } %> <% if (data.getFindCount()>0) { %> (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of <%= data.getFindCount() %>) <% } else { %>(None)<% } %> - <% if (go_next || (data.getOffset()>0)) { %> <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- + Navigational form +
+ <% if (cat!=null) { %><% } %> - - - + + + <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> + <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> + <% } // end if %>    <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> + <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> + <% } // end if %> - -
+
<% } else { %> <% } %>

<%-- Display the results of the search --%> - - <% if ((data.getDisplayOption()==FindData.FD_POSTS) && (results.size()>0)) { %> +
+ <% if (data.testDisplayMode(FindView.FD_POSTS) && (dcount>0)) { %> <% } // end if %> <% for (int i=0; i - <% if (data.getDisplayOption()==FindData.FD_POSTS) { %> + <% if (data.testDisplayMode(FindView.FD_POSTS)) { %> <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> - - - - + + + - + + <% } else { %> - - + + + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cd.getLinkedCategoryID() %> + <%= cd.toString() %> + + <% } // end if %> + <% } // end if %> <% } // end for %> -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Link + Post Link - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Author + Author - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Date + Post Date - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Lines + Lines  
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= post.getIdentifier() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= post.getAuthor() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= rdat.formatDateForDisplay(post.getPostDate()) %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + + + go/<%= post.getIdentifier() %> + <%= post.getIdentifier() %> + + + + user/<%= post.getAuthor() %> + <%= post.getAuthor() %> + + + <%= data.formatDate(post.getPostDate()) %> + <%= post.getLineCount() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(post.getText()) %> - + <%= post.getText() %> + - " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <% Object item = results.get(i); %> - <% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %> + <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> <% CommunityContext comm = (CommunityContext)item; - String host_name = FindData.getCommunityHostName(comm); - int members = FindData.getCommunityMemberCount(comm); + String host_name = FindView.getCommunityHostName(comm); + int members = FindView.getCommunityMemberCount(comm); %> - "><%= StringUtil.encodeHTML(comm.getName()) %>
+ + sig/<%= comm.getAlias() %> + <%= comm.getName() %> +
<% if (host_name!=null) { %> - Host: "><%= host_name %> + Host: + + user/<%= host_name %> + <%= host_name %> + <% } // end if (got host name) %> <% if (members>=0) { %> <% if (host_name!=null) { %> - <% } %> <%= members %> members <% } // end if (got member count) %> <% if ((host_name!=null) || (members>=0)) { %>
<% } %> - Latest activity: <%= FindData.getActivityString(comm,rdat) %>
- <%= StringUtil.encodeHTML(comm.getSynopsis()) %> - - <% } else if (data.getDisplayOption()==FindData.FD_USERS) { %> + Latest activity: <%= data.getActivityString(comm.getLastAccessDate()) %>
+ <%= comm.getSynopsis() %> + <% } else if (data.testDisplayMode(FindView.FD_USERS)) { %> <% UserFound uf = (UserFound)item; %> - "><%= uf.getName() %>
- <%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>, - from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %> - <%= uf.getCountry() %> - <% if (uf.getDescription()!=null) { %>
<%= StringUtil.encodeHTML(uf.getDescription()) %><% } %> - - <% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> + + user/<%= uf.getName() %> + <%= uf.getName() %> +
+ <%= uf.getGivenName() %> + <%= uf.getFamilyName() %>, + from <%= uf.getLocality() %>, + <%= uf.getRegion() %> <%= uf.getCountry() %> + <% if (uf.getDescription()!=null) { %> +
<%= uf.getDescription() %> + <% } // end if %> + <% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> <% CategoryDescriptor cd = (CategoryDescriptor)item; %> - <%= StringUtil.encodeHTML(cd.toString()) %> - - <% } // end if%> -

<% } // end if (results found) %> diff --git a/web/format/findpost.jsp b/web/format/findpost.jsp deleted file mode 100644 index 0955f0a..0000000 --- a/web/format/findpost.jsp +++ /dev/null @@ -1,135 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - FindPostData data = FindPostData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Find Posts",data.getSubtitle()); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><%= data.getReturnLink(rdat) %>

- -

">
- <%= data.getExtraParameters() %> - - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Keywords: - -
- " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0> -

- -<% List results = data.getResults(); %> -<% if (results!=null) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% - // Determine the number of results to display and whether to display a "next" button - int dcount = results.size(); - boolean go_next = false; - if (dcount>data.getMaxResults()) - { // there's a "next" - dcount = data.getMaxResults(); - go_next = true; - - } // end if - %> -


- - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - <%-- The initial search results --%> - Search Results - <% if (data.getFindCount()>0) { %> - (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of - <%= data.getFindCount() %>) - <% } else { %>(None)<% } %> - - <% if (go_next || (data.getOffset()>0)) { %> - <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- <%= data.getExtraParameters() %> - - - - <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -    - <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -
- <% } else { %> <% } %> -

- - <%-- Display the results of the search --%> - - - - - - - - - <% for (int i=0; i - - <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> - - - - - - - <% } // end for %> -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Link - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Author - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Date - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Lines -  
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= post.getIdentifier() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - "><%= post.getAuthor() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= rdat.formatDateForDisplay(post.getPostDate()) %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= post.getLineCount() %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(post.getText()) %> -

-<% } // end if %> diff --git a/web/format/frame.jsp b/web/format/frame.jsp new file mode 100644 index 0000000..a735568 --- /dev/null +++ b/web/format/frame.jsp @@ -0,0 +1,136 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ taglib uri="/tlds/frame" prefix="frame" %> +<%@ taglib uri="/tlds/user" prefix="user" %> +<%@ taglib uri="/tlds/util" prefix="util" %> + + + + + + BEGIN PAGE HEADER + " WIDTH="100%" CELLPADDING=2 CELLSPACING=0> + + + + + + + + Login reminders + +
+ Site logo + + + Links to Front Page, Help, Find + Front Page +

+ Help +  |  + Find +

+ Banner Ad + +
+ + You are logged in as + +  -  + Log Out + +  |  + Verify E-Mail + +  |  + Profile + + + + You are not logged in + +  -  + Log In +  |  + Create Account + + +
+ END PAGE HEADER + + + + + + + + + + + + + +
"> + + BEGIN LEFT SIDEBAR + + + + + + END LEFT SIDEBAR + +
+ variable menu + +
 
+ fixed menu + +
+
" CLASS="content"> + BEGIN PAGE CONTENT + + END PAGE CONTENT +
"> " CLASS="footer"> + PAGE FOOTER +
+ + + + + + + + +
ROWSPAN=2 ALIGN=LEFT CLASS="footer">
+
+
+ diff --git a/web/format/login_or_create.jsp b/web/format/helpers/login_or_create.jsp similarity index 54% rename from web/format/login_or_create.jsp rename to web/format/helpers/login_or_create.jsp index e52ac9e..1a0d995 100644 --- a/web/format/login_or_create.jsp +++ b/web/format/helpers/login_or_create.jsp @@ -15,18 +15,21 @@ Contributor(s): --%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - LogInOrCreate data = LogInOrCreate.retrieve(request); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Log In or Create Account",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> +<%@ page import = "com.silverwrist.venice.ui.helpers.LogInOrCreate" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% LogInOrCreate view = LogInOrCreate.get(request); %> +Log In or Create dialog + + You must log in or create an account before you can view this page.

- Returning users ">log in here.

- New users ">create an account here.

- + Returning users + + login.js.vs?tgt=<%= view.getTargetParam() %> + log in here + .

+ New users + + new_account.js.vs?tgt=<%= view.getTargetParam() %> + create an account here + .

+ \ No newline at end of file diff --git a/web/format/hotlist.jsp b/web/format/hotlist.jsp deleted file mode 100644 index e5e9112..0000000 --- a/web/format/hotlist.jsp +++ /dev/null @@ -1,98 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - Hotlist data = Hotlist.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Your Conference Hotlist",null); %> -<%= stdfont %>">Return to Front Page

-<% if (data.getHotlistSize()>0) { %> - - <% for (int i=0; i - <% - ConferenceContext conf = data.getConference(i); - String partial = "settings?sig=" + conf.getEnclosingCommunity().getCommunityID() + "&conf=" - + conf.getConfID(); - %> - - - - - - - <% } // end for %> -
- <% if (i==(data.getHotlistSize()-1)) { %> <% } else { %> - ">" ALT="[Down]" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - <% if (i==0) { %> <% } else { %> - ">" ALT="[Up]" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - ">" ALT="[Remove]" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= stdfont %> - <%= StringUtil.encodeHTML(conf.getName()) %> - (<%= StringUtil.encodeHTML(conf.getEnclosingCommunity().getName()) %>) -

- - - - - - - - - - - - - -
- " ALT="[Down]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to move the specified conference down in your hotlist. -
- " ALT="[Up]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to move the specified conference up in your hotlist. -
- " ALT="[Remove]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to remove the specified conference from your hotlist. -
-<% } else { %> - <%= stdfont %> - You have no conferences in your conference hotlist. You can add conferences to your hotlist - by visiting the conferences and pressing the "Add to Hotlist" button. - -<% } // end if %> diff --git a/web/format/import_form.jsp b/web/format/import_form.jsp deleted file mode 100644 index caa940d..0000000 --- a/web/format/import_form.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - AdminImportUser data = AdminImportUser.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Import User Accounts",null); %> - -

"> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - - User import data:
-

- " NAME="upload" ALT="Upload" - WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" ALT="Cancel" - WIDTH=80 HEIGHT=24 BORDER=0>


- The user accounts are imported as an XML file. - <%-- TODO: put a description of the contents here, or a link to a DTD --%> -
-
diff --git a/web/format/invitation.jsp b/web/format/invitation.jsp deleted file mode 100644 index ba1adc4..0000000 --- a/web/format/invitation.jsp +++ /dev/null @@ -1,58 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - Invitation data = Invitation.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% data.writeHeader(out,rdat); %> -
">
- <%= data.getParameters() %> - - - - - - - - - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Send to:  -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Personal message to be added to - invitation: -
- " NAME="send" - ALT="Send E-Mail" WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" - ALT="Cancel" WIDTH=80 HEIGHT=24 BORDER=0> -
-
- diff --git a/web/format/manage_aliases.jsp b/web/format/manage_aliases.jsp deleted file mode 100644 index 569bac0..0000000 --- a/web/format/manage_aliases.jsp +++ /dev/null @@ -1,73 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "java.net.URLEncoder" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ManageConferenceAliases data = ManageConferenceAliases.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Managing Conference Aliases:",data.getConfName()); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to - Manage Conference Menu

- - <% if (data.getErrorMessage()!=null) { %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_ERROR,2) %><%= StringUtil.encodeHTML(data.getErrorMessage()) %>

- <% } // end if %> - - Current Aliases:

- - <% Iterator it = data.getAliasIterator(); %> - <% while (it.hasNext()) { %> - <% String name = (String)(it.next()); %> - - - - - - - <% } // end while %> -
" ALT="*" - WIDTH=14 HEIGHT=14 BORDER=0><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(name) %> -      - <% if (data.canRemoveAliases()) { %> - ">" - ALT="Remove" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> <% } %> -

- - Add New Alias:

-

">
- - - -   - " NAME="add" ALT="Add" - WIDTH=80 HEIGHT=24 BORDER=0> -
- - diff --git a/web/format/manage_conf.jsp b/web/format/manage_conf.jsp deleted file mode 100644 index 7bdf130..0000000 --- a/web/format/manage_conf.jsp +++ /dev/null @@ -1,85 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ManageConference data = ManageConference.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Manage Conference:",data.getConfName()); %> - -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to Topic List -

- -<% if (rdat.useHTMLComments()) { %><% } %> -

">
- - - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Set default pseud for conference: -   - " NAME="set" ALT="Set" - WIDTH=80 ALIGN=BOTTOM HEIGHT=24 BORDER=0> - -

- -<% if (rdat.useHTMLComments()) { %><% } %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Mark - entire conference as read (fixseen) -

- -<% if (data.displayInviteSection()) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% rdat.writeContentHeader(out,"Send Invitation",null); %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - You may send an invitation via E-mail to outside individuals to join this community and - read this conference.

- ">Click here to - send an invitation -

-<% } // end if %> - -<% if (data.displayAdminSection()) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% rdat.writeContentHeader(out,"Host Tools",null); %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Change - Conference Information

- ">Manage - Conference Aliases

- ">Manage - Conference Members

- ">Customize - Conference Appearance

- ">Conference - Activity Reports

- ">Conference - E-Mail

- ">Delete - Conference

- -<% } // end if (displaying admin section) %> diff --git a/web/format/manage_topic.jsp b/web/format/manage_topic.jsp deleted file mode 100644 index aac046e..0000000 --- a/web/format/manage_topic.jsp +++ /dev/null @@ -1,95 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ManageTopic data = ManageTopic.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Manage Topic:",data.getTopicName()); %> - -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to Topic -

- -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> -

Topic Subscription:
- <% if (data.isSubscribed()) { %> - You are currently subscribed to this topic, and will receive all new posts to it via E-mail.

- ">Click Here - to Stop Subscribing To This Topic - <% } else { %> - You are not currently subscribed to this topic. When you subscribe to a topic, you will receive all new - posts to that topic via E-mail.

- ">Click Here - to Start Subscribing To This Topic - <% } // end if %>

- - <% if (data.displayInviteSection()) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <% rdat.writeContentHeader(out,"Send Invitation",null); %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - You may send an invitation via E-mail to outside individuals to join this community and - read this topic in the conference.

- ">Click here to - send an invitation -

- <% } // end if %> - - <% if (rdat.useHTMLComments()) { %><% } %> - <% rdat.writeContentHeader(out,"Filtered Users",null); %> - <% if (data.getNumBozos()>0) { %> - - <% Iterator it = data.getBozosIterator(); %> - <% while (it.hasNext()) { %> - <% UserProfile prof = (UserProfile)(it.next()); %> - - - - - <% } // end while %> -
- ">" ALT="Remove" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <"><%= prof.getUserName() %>> - (<%= StringUtil.encodeHTML(prof.getGivenName()) %> - <%= StringUtil.encodeHTML(prof.getFamilyName()) %>) -

- - - - - -
- " ALT="Remove" BORDER=0 WIDTH=16 HEIGHT=16> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Click this symbol to cease filtering this user in this topic. -
- <% } else { %> -

No users currently filtered.
- <% } // end if %> - diff --git a/web/format/newtopic.jsp b/web/format/newtopic.jsp deleted file mode 100644 index ca7f682..0000000 --- a/web/format/newtopic.jsp +++ /dev/null @@ -1,83 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - NewTopicForm data = NewTopicForm.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,data.isPreview() ? "Preview New Topic" : "Create New Topic", - "in: " + data.getConfName()); %> -<% if (data.isPreview()) { %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - <% if (data.getNumSpellingErrors()==0) { %> - Your post did not contain any spelling errors. - <% } else if (data.getNumSpellingErrors()==1) { %> - There was 1 spelling error in your post. - <% } else { %> - There were <%= data.getNumSpellingErrors() %> spelling errors in your post. - <% } // end if %> - -

<%= rdat.rewritePostData(data.getPreviewData()) %>

-<% } // end if %> - -
">
- - - - - - - - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>New topic name:
- -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Your name/header:
- - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>CHECKED<% } %> > Attach a file -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Message: - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - " TARGET="_blank">HTML Guide -
- -
- " ALT="Preview" NAME="preview" - WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Post" NAME="post" - WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Cancel" NAME="cancel" - WIDTH=80 HEIGHT=24 BORDER=0> -
-
diff --git a/web/format/password_changed.jsp b/web/format/password_changed.jsp index 2c4ce64..877dab1 100644 --- a/web/format/password_changed.jsp +++ b/web/format/password_changed.jsp @@ -15,17 +15,21 @@ Contributor(s): --%> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "java.util.List" %> +<%@ page import = "com.silverwrist.venice.core.TopicMessageContext" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/user" prefix="user" %> +<%@ taglib uri="/tlds/util" prefix="util" %> <% - RenderData rdat = RenderConfig.createRenderData(application,request,response); + JSPView view = JSPView.get(request); %> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Your Password Has Been Changed",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> +Password changed + + The password for your account has been changed, and a new password has been E-mailed to you at your account's defined E-mail address. (Check your E-mail again!). After getting the new password, please log in and change your password (yes, again!) as soon as possible.

- ">Return to Front Page + Return to Front Page
- \ No newline at end of file +
diff --git a/web/format/photo_upload.jsp b/web/format/photo_upload.jsp new file mode 100644 index 0000000..45303a0 --- /dev/null +++ b/web/format/photo_upload.jsp @@ -0,0 +1,33 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "com.silverwrist.venice.ui.view.PhotoUploader" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% PhotoUploader view = PhotoUploader.get(request); %> +Photo uploading page + +
+ <%= view.getHiddenParams() %> + + + +
<%= view.getPhotoTag() %> + <%= view.getLabel() %>:
+

+   +

+
diff --git a/web/format/posts.jsp b/web/format/posts.jsp deleted file mode 100644 index c99b748..0000000 --- a/web/format/posts.jsp +++ /dev/null @@ -1,390 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - TopicPosts data = TopicPosts.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_HEADER,5) %> - <%= data.getTopicName() %> - -   -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_HEADER,3) %> - <% if (data.isTopicArchived()) { %>(Archived)<% } else if (data.isTopicFrozen()) { %>(Frozen)<% } %> - <%= data.getTotalMessages() %> Total; <%= data.getNewMessages() %> New; - Last: <%= rdat.formatDateForDisplay(data.getLastUpdate()) %> - -
- -<% data.writeTopCustom(out); %> - - - - - - - - - - - - -
- <% if (rdat.useHTMLComments()) { %><% } %> - ">" ALT="Topic List" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% if (data.isTopicHidden()) { %> - ">" ALT="Show Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } else { %> - ">" ALT="Hide Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } // end if %> -   - <% if (data.canDoNextTopic()) { %> - ">" ALT="Next Topic" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% if (data.getNewMessages()>0) { %> - ">" ALT="Next & Keep New" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% } // end if %> - <% } // end if %> - ">" ALT="Find" WIDTH=80 HEIGHT=24 - BORDER=0>  - ">" ALT="Manage" WIDTH=80 HEIGHT=24 - BORDER=0>  -
  - <% if (rdat.useHTMLComments()) { %><% } %> - <% if (data.canFreezeTopic()) { %> -   - <% if (data.isTopicFrozen()) { %> - ">" ALT="Unfreeze Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } else { %> - ">" ALT="Freeze Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } // end if %> - <% } // end if %> - <% if (data.canArchiveTopic()) { %> -   - <% if (data.isTopicArchived()) { %> - ">" ALT="Unarchive Topic" WIDTH=80 - HEIGHT=24 BORDER=0> - <% } else { %> - ">" ALT="Archive Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } // end if %> - <% } // end if %> - <% if (data.canDeleteTopic()) { %> -   - ">" ALT="Delete Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } // end if %> -
- <% if (rdat.useHTMLComments()) { %><% } %> -
">
- - - -   - " NAME="Go" ALT="Go" - ALIGN=BOTTOM WIDTH=80 HEIGHT=24 BORDER=0> -
-
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (rdat.useHTMLComments()) { %><% } %> - [  - ">View All - <% if (data.canScrollUp()) { %> -  |  - ">Scroll Up <%= data.getNumPostsPerPage() %> - <% } // end if %> - <% if (data.canScrollDown()) { %> -  |  - ">Scroll Down <%= data.getNumPostsPerPage() %> - <% } // end if %> - <% if (data.canScrollDown()) { %> -  |  - ">Scroll To End - <% } // end if %> -  |  - Bottom -  ] -
- -<% if (rdat.useHTMLComments()) { %><% } %> -<% - Iterator it = data.getMessageIterator(); - String last_post = rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1=" - + String.valueOf(data.getTotalMessages() - 1)); - boolean can_line = false; -%> -<% while (it.hasNext()) { %> - <% - TopicMessageContext msg = (TopicMessageContext)(it.next()); - String poster = data.getPosterName(msg); - %> - <% if (can_line && data.emitBreakLinePoint(msg.getPostNumber())) { %>
<% } %> - <% if (data.showAdvanced()) { %> -
-
- <% } // end if (showing advanced controls) %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (!(data.bozoFilterUser(msg.getCreatorUID()))) { %> - <%= data.getUserPhotoTag(msg.getCreatorUID(),rdat) %> - <% } // end if %> - "><%= msg.getPostNumber() %> of - <%= data.getTotalMessages() - 1 %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,1) %><<%= data.getMessageReference(msg) %>> - <% if (data.showAdvanced() && msg.isHidden()) { %> - (Hidden) - <% } // end if %> - <% if (data.showAdvanced() && data.showBozoFilteredIndicator(msg.getCreatorUID())) { %> - (User filtered; - ">remove filter) - - <% } // end if %> - <% if (!(data.bozoFilterUser(msg.getCreatorUID()))) { %> -
- <%= msg.getPseud() %> - ( - " TARGET="_blank"><%= poster %>, - <%= rdat.formatDateForDisplay(msg.getPostDate()) %> - ) - <% if (msg.hasAttachment()) { %> - TARGET="_blank"<% } %> >" - ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)" - WIDTH=16 HEIGHT=16 BORDER=0> - <% } // end if %> - <% } // end if (message not bozo-filtered) %> -

- <% if (msg.isScribbled()) { %> - - (Scribbled by <%= data.getMessageBodyText(msg) %> on - <%= rdat.formatDateForDisplay(msg.getScribbleDate()) %>) - - <% if (data.displayPostPictures()) { %>
<% } %>

- <% } else if (data.bozoFilterUser(msg.getCreatorUID())) { %> - - ">(Message from Filtered User: - <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>) -

- <% } else if (msg.isHidden() && !(data.showAdvanced())) { %> - - ">(Hidden - Message: <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %>) - - <% if (data.displayPostPictures()) { %>
<% } %>

- <% } else { %> -

<%= rdat.rewritePostData(data.getMessageBodyText(msg)) %>
- <% if (data.displayPostPictures()) { %>
<% } %> - <% } // end if %> -
- <% if (data.showAdvanced()) { %> - <% String po_loc = data.getLocator() + "&msg=" + msg.getPostNumber(); %> -
- <% if (!(msg.isScribbled())) { %> - <% if (msg.canHide()) { %> - <% if (msg.isHidden()) { %> - ">" ALT="Show" WIDTH=80 HEIGHT=24 BORDER=0>

- <% } else { %> - ">" ALT="Hide" WIDTH=80 HEIGHT=24 BORDER=0>

- <% } // end if %> - <% } // end if (can hide) %> - <% if (msg.canScribble()) { %> - ">" ALT="Scribble" WIDTH=80 HEIGHT=24 - BORDER=0>

- <% } // end if (can scribble) %> - <% } // end if (not already scribbled) %> - <% if (data.showFilterButton(msg.getCreatorUID())) { %> - ">" ALT="Filter User" WIDTH=80 HEIGHT=24 - BORDER=0>

- <% } // end if (can bozo filter) %> - <% if (msg.canNuke()) { %> - ">" ALT="Nuke" WIDTH=80 HEIGHT=24 - BORDER=0>

- <% } // end if (can nuke) %> - <% if (msg.canPublish()) { %> - ">" ALT="Publish" WIDTH=80 HEIGHT=24 - BORDER=0>

- <% } // end if (can publish) %> -


- <% } // end if (showing advanced controls) %> - <% can_line = true; %> -<% } // end while %> -<% if (rdat.useHTMLComments()) { %><% } %> - - - - - - - - - - -
 <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% if (rdat.useHTMLComments()) { %><% } %> - [  - ">View All - <% if (data.canScrollUp()) { %> -  |  - ">Scroll Up <%= data.getNumPostsPerPage() %> - <% } // end if %> - <% if (data.canScrollDown()) { %> -  |  - ">Scroll Down <%= data.getNumPostsPerPage() %> - <% } // end if %> - <% if (data.canScrollDown()) { %> -  |  - ">Scroll To End - <% } // end if %> -  |  - Top -  ] -
- <% if (rdat.useHTMLComments()) { %><% } %> - ">" ALT="Topic List" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% if (data.isTopicHidden()) { %> - ">" ALT="Show Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } else { %> - ">" ALT="Hide Topic" WIDTH=80 HEIGHT=24 - BORDER=0> - <% } // end if %> -   - <% if (data.canDoNextTopic()) { %> - ">" ALT="Next Topic" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% if (data.getNewMessages()>0) { %> - ">" ALT="Next & Keep New" WIDTH=80 HEIGHT=24 - BORDER=0> -   - <% } // end if %> - <% } // end if %> - ">" ALT="Manage" WIDTH=80 HEIGHT=24 - BORDER=0>  -  
- -<% if (data.displayPostBox()) { %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - Post Message in "<%= data.getTopicName() %>": - -
-
">
- - - - <% if (data.canDoNextTopic()) { %> - - <% } // end if %> - - - - - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Your name/header:
- - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> Attach a file -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Message: - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - " TARGET="_blank">HTML Guide -
- -
- " ALT="Preview" NAME="preview" - WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Post & Reload" - NAME="post" WIDTH=80 HEIGHT=24 BORDER=0> - <% if (data.canDoNextTopic()) { %> -   - " ALT="Post & Go Next" - NAME="postnext" WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - " ALT="Post & Go Topics" - NAME="posttopics" WIDTH=80 HEIGHT=24 BORDER=0> -
-
-<% } else if (data.isTopicArchived()) { %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>This is an - Archived Topic
-<% } else if (data.isTopicFrozen()) { %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>This is a - Frozen Topic
-<% } // end if %> -<% data.writeBottomCustom(out); %> diff --git a/web/format/preview.jsp b/web/format/preview.jsp deleted file mode 100644 index acd309e..0000000 --- a/web/format/preview.jsp +++ /dev/null @@ -1,89 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - PostPreview data = PostPreview.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Previewing Post",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> - <% if (data.getNumSpellingErrors()==0) { %> - Your post did not contain any spelling errors. - <% } else if (data.getNumSpellingErrors()==1) { %> - There was 1 spelling error in your post. - <% } else { %> - There were <%= data.getNumSpellingErrors() %> spelling errors in your post. - <% } // end if %> - -

<%= rdat.rewritePostData(data.getPreviewData()) %>

- -
">
- - - - <% if (!(StringUtil.isStringEmpty(data.getNextVal()))) { %> - - <% } // end if %> - - <% if (data.slippageDetected()) { %> - - <% } // end if %> - - - - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Your name/header:
- - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>CHECKED<% } %> > Attach a file -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Message: - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - " TARGET="_blank">HTML Guide -
- -
- " ALT="Preview" NAME="preview" - WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Post & Reload" - NAME="post" WIDTH=80 HEIGHT=24 BORDER=0> - <% if (!(StringUtil.isStringEmpty(data.getNextVal()))) { %> -   - " ALT="Post & Go Next" - NAME="postnext" WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - " ALT="Post & Go Topics" - NAME="posttopics" WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Cancel" - NAME="cancel" WIDTH=80 HEIGHT=24 BORDER=0> -
-
diff --git a/web/format/report_conf.jsp b/web/format/report_conf.jsp deleted file mode 100644 index 46ae974..0000000 --- a/web/format/report_conf.jsp +++ /dev/null @@ -1,73 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ReportConferenceMenu data = ReportConferenceMenu.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); - String partial; -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Conference Reports:",data.getConfName()); %> - -<%= stdfont %> - ">Return to Manage - Conference Menu -

- - - - - - - - - - - <% partial = "confops?" + data.getLocator() + "&cmd="; %> - - - - - <% Iterator it = data.getTopics(); %> - <% while (it.hasNext()) { %> - <% - TopicContext topic = (TopicContext)(it.next()); - partial = "confops?" + data.getLocator() + "&top=" + topic.getTopicNumber() + "&cmd="; - %> - - - - - - - <% } // end while %> -
<%= stdfont %>#<%= stdfont %>Topic Name<%= stdfont %>Reports
 <%= stdfont %>(Entire conference)<%= stdfont %> - ">Posters - <%= stdfont %> - ">Readers/Lurkers -
<%= stdfont %><%= topic.getTopicNumber() %><%= stdfont %><%= topic.getName() %><%= stdfont %> - ">Posters - <%= stdfont %> - ">Readers/Lurkers -

diff --git a/web/format/sideboxlist.jsp b/web/format/sideboxlist.jsp deleted file mode 100644 index 7113188..0000000 --- a/web/format/sideboxlist.jsp +++ /dev/null @@ -1,109 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - SideBoxList data = SideBoxList.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); - int i; - SideBoxDescriptor d; -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Your Front Page Configuration",null); %> -<%= stdfont %>">Return to Front Page

-<% if (data.getInListSize()>0) { %> - - <% for (i=0; i - <% d = data.getInListItem(i); %> - - - - - - - <% } // end for %> -
- <% if (i==(data.getInListSize()-1)) { %> <% } else { %> - ">" ALT="[Down]" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - <% if (i==0) { %> <% } else { %> - ">" ALT="[Up]" BORDER=0 WIDTH=16 - HEIGHT=16> - <% } // end if %> - - ">" ALT="[Remove]" BORDER=0 WIDTH=16 - HEIGHT=16> - <%= stdfont %> - <%= StringUtil.encodeHTML(d.getTitle(false)) %> -

- - - - - - - - - - - - - -
- " ALT="[Down]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to move the specified sidebox down on your Front Page. -
- " ALT="[Up]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to move the specified sidebox up on your Front Page. -
- " ALT="[Remove]" BORDER=0 WIDTH=16 HEIGHT=16> - <%= stdfont %> - Click this symbol to remove the specified sidebox from your Front Page. -
-<% } else { %> - <%= stdfont %>You have no sideboxes on your Front Page. -<% } // end if %> -<% if (data.getOutListSize()>0) { %> -

-

"> -
<%= stdfont %> - - Add sidebox:   -    - " NAME="add" ALT="Add" - ALIGN=MIDDLE WIDTH=80 HEIGHT=24 BORDER=0> -
-
-<% } // end if %> \ No newline at end of file diff --git a/web/format/slippage.jsp b/web/format/slippage.jsp deleted file mode 100644 index 971d85e..0000000 --- a/web/format/slippage.jsp +++ /dev/null @@ -1,112 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - PostSlippage data = PostSlippage.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Slippage or Double-Click Detected",null); %> -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - The following posts slipped in while you were typing. You may choose to edit your message and - re-post, just post it as is, or cancel your posting altogether. -

- -<% if (rdat.useHTMLComments()) { %><% } %> -<% Iterator it = data.getMessageIterator(); %> -<% while (it.hasNext()) { %> - <% - TopicMessageContext msg = (TopicMessageContext)(it.next()); - String poster = data.getPosterName(msg); - %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= msg.getPostNumber() %> of <%= data.getTotalMessages() - 1 %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,1) %><<%= data.getMessageReference(msg) %>>
- <%= msg.getPseud() %> - ( - " TARGET="_blank"><%= poster %>, - <%= rdat.formatDateForDisplay(msg.getPostDate()) %> - ) -

- <% if (msg.isScribbled()) { %> - - (Scribbled by <%= data.getMessageBodyText(msg) %> on - <%= rdat.formatDateForDisplay(msg.getScribbleDate()) %>) - - <% } else { %> -

<%= rdat.rewritePostData(data.getMessageBodyText(msg)) %>
- <% } // end if %> -<% } // end while %> -<% if (rdat.useHTMLComments()) { %><% } %> - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Post Message in -"<%= data.getTopicName() %>": -
-
">
- - - - <% if (!(StringUtil.isStringEmpty(data.getNextVal()))) { %> - - <% } // end if %> - - - - - - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Your name/header:
- - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>CHECKED<% } %> > Attach a file -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Message: - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - " TARGET="_blank">HTML Guide -
- -
- " ALT="Preview" NAME="preview" - WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Post & Reload" - NAME="post" WIDTH=80 HEIGHT=24 BORDER=0> - <% if (!(StringUtil.isStringEmpty(data.getNextVal()))) { %> -   - " ALT="Post & Go Next" - NAME="postnext" WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - " ALT="Post & Go Topics" - NAME="posttopics" WIDTH=80 HEIGHT=24 BORDER=0> -   - " ALT="Cancel" - NAME="cancel" WIDTH=80 HEIGHT=24 BORDER=0> -
-
\ No newline at end of file diff --git a/web/format/sysadmin/find_user.jsp b/web/format/sysadmin/find_user.jsp new file mode 100644 index 0000000..3be69a4 --- /dev/null +++ b/web/format/sysadmin/find_user.jsp @@ -0,0 +1,138 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.util.StringUtil" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.AdminFindUserView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + AdminFindUserView data = AdminFindUserView.get(request); +%> +Admin Find Users Menu + +Return to +System Administration Menu

+ +<%-- Display the search form --%> +User Search Form +

+ + Find Users:
+ + Display all users whose   +
+ +    +
+
+
+
+ +<% List results = data.getResults(); %> +<% if (results!=null) { %> + Display Search Results + <% + // Determine the number of results to display and whether to display a "next" button + int dcount = results.size(); + boolean go_next = false; + if (dcount>data.getMaxResults()) + { // there's a "next" + dcount = data.getMaxResults(); + go_next = true; + + } // end if + %> +
+ + + +
+ <%-- The initial search results --%> + Search Results + <% if (data.getFindCount()>0) { %> + (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of + <%= data.getFindCount() %>) + <% } else { %>(None)<% } %> + + <% if (go_next || (data.getOffset()>0)) { %> + <%-- The navigational form that allows us to page through the results --%> + Navigational Form +
+ + + + + + <% if (data.getOffset()>0) { %> + + <% } else { %> + + <% } // end if %> +    + <% if (go_next) { %> + + <% } else { %> + + <% } // end if %> +
+ <% } else { %> <% } %> +

+ + <%-- Display the results of the search --%> + + <% for (int i=0; i + + + + + <% } // end for %> +
+ <% UserFound uf = (UserFound)(results.get(i)); %> + + user/<%= uf.getName() %> + <%= uf.getName() %> +
+ <%= uf.getGivenName() %> <%= uf.getFamilyName() %>, + from <%= uf.getLocality() %>, <%= uf.getRegion() %> <%= uf.getCountry() %> + <% if (!StringUtil.isStringEmpty(uf.getDescription())) { %> +
<%= uf.getDescription() %> + <% } // end if %> +
+ sysadmin/modify_user.js.vs?uid=<%= uf.getUID() %> + [Modify User] + +

+<% } // end if (results found) %> diff --git a/web/format/sysadmin/import_form.jsp b/web/format/sysadmin/import_form.jsp new file mode 100644 index 0000000..81d3733 --- /dev/null +++ b/web/format/sysadmin/import_form.jsp @@ -0,0 +1,29 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ taglib uri="/tlds/util" prefix="util" %> +Import Users Form + +
+ + User import data:
+

+  


+ The user accounts are imported as an XML file. + <%-- TODO: put a description of the contents here, or a link to a DTD --%> +
+
diff --git a/web/format/import_results.jsp b/web/format/sysadmin/import_results.jsp similarity index 55% rename from web/format/import_results.jsp rename to web/format/sysadmin/import_results.jsp index 7f7cb32..4ba51d0 100644 --- a/web/format/import_results.jsp +++ b/web/format/sysadmin/import_results.jsp @@ -17,18 +17,18 @@ --%> <%@ page import = "java.util.*" %> <%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "com.silverwrist.venice.ui.helpers.ImportHelper" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> <% - AdminImportUser data = AdminImportUser.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); + JSPView view = JSPView.get(request); + ImportHelper ihelper = (ImportHelper)(view.getRequestAttribute("import.helper")); %> -<% rdat.writeContentHeader(out,"Results From Importing User Accounts",null); %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - ">Return to System Administration Menu

- Processed <%= data.getNumProcessed() %> record(s); <%= data.getNumErrors() %> +Import Users - Results + +

+ Return to System Administration Menu

+ Processed <%= ihelper.getProcessed() %> record(s); <%= ihelper.getErrors() %> error(s) reported.


- <%= data.getMessage() %> -
+ <%= ihelper.getMessage() %> +
diff --git a/web/format/top_content.jsp b/web/format/top_content.jsp index 0da0922..f56dc98 100644 --- a/web/format/top_content.jsp +++ b/web/format/top_content.jsp @@ -15,50 +15,58 @@ Contributor(s): --%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> +<%@ page import = "java.util.List" %> +<%@ page import = "com.silverwrist.venice.core.TopicMessageContext" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/user" prefix="user" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<%@ taglib uri="/tlds/post" prefix="post" %> <% - TopDisplay data = TopDisplay.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% if (data.displayWelcome()) { %> - <% rdat.writeContentHeader(out,rdat.getStockMessage("welcome-top"),null); %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><%= rdat.getStockMessage("welcome") %>

-<% } // end if %> -<% - rdat.writeContentHeader(out,rdat.getStockMessage("currents-top"),null); - int ntp = data.getNumTopPosts(); - if (ntp>0) { - for (int i=0; i + +Top Content Panel + +<%-- If the user is not logged in, write the welcome message. --%> + + +

+ + +<%-- Write the messages that have been published to the front page. --%> + +<% if (post_list.size()>0) { %> + <% for (int i=0; i + <% + TopicMessageContext msg = (TopicMessageContext)(post_list.get(i)); + String pname = poster_names.get(i).toString(); + %> <% if (i>0) { %>


<% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= msg.getPseud() %> ( - " TARGET="_blank"><%= poster %>, - <%= rdat.formatDateForDisplay(msg.getPostDate()) %> + + user/<%= pname %> + <%= pname %> + , + <%= view.formatDate(msg.getPostDate()) %> )

-

<%= rdat.rewritePostData(data.getMessageBodyText(msg)) %>
- <% if (topic_link!=null) { %> -

(From the topic: <%= topic_link %>)
- <% } // end if %> - -<% - } // end for - } else { -%> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>No front page postings found. +

<%= message_text.get(i) %>
+

+ (From the topic: + go/<%= topic_links.get(i) %> + <%= topic_names.get(i) %> + )
+ + <% } // end for %> +<% } else { %> + No front page postings found. <% } // end if %> - - diff --git a/web/format/topics.jsp b/web/format/topics.jsp deleted file mode 100644 index 646a9e9..0000000 --- a/web/format/topics.jsp +++ /dev/null @@ -1,199 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - TopicListing data = TopicListing.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2); - String self = "confdisp?" + data.getLocator(); - String tmp; -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"Topics in " + data.getConfName(),null); %> - -<% data.writeTopCustom(out); %> -<%= stdfont %> -

- " ALT="Conference List" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% if (data.canCreateTopic()) { %> - <% tmp = rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=T"); %> - " ALT="Add Topic" - WIDTH=80 HEIGHT=24 BORDER=0>  - <% } // end if %> - <% if (data.canDoReadNew()) { %> - ">" ALT="Read New" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% } // end if %> - ">" ALT="Find" WIDTH=80 HEIGHT=24 - BORDER=0>  - ">" ALT="Manage" WIDTH=80 HEIGHT=24 - BORDER=0>  - <% if (data.canAddToHotlist()) { %> - ">" ALT="Add to HotList" WIDTH=80 - HEIGHT=24 BORDER=0>  - <% } // end if %> -
- <% if (data.anyTopics()) { %> - - - - - - - - - - <% Iterator it = data.getTopicIterator(); %> - <% while (it.hasNext()) { %> - <% - TopicContext topic = (TopicContext)(it.next()); - tmp = self + "&top=" + topic.getTopicNumber() + "&rnm=1"; - %> - - - - - - - - <% } // end while (more topics in enumeration) %> -
<%= stdfont %> - <% tmp = self + "&sort=" - + (data.isSort(ConferenceContext.SORT_NUMBER) ? -ConferenceContext.SORT_NUMBER - : ConferenceContext.SORT_NUMBER); %> - # - <%= stdfont %> - <% tmp = self + "&sort=" - + (data.isSort(ConferenceContext.SORT_NAME) ? -ConferenceContext.SORT_NAME - : ConferenceContext.SORT_NAME); %> - Topic Name - <%= stdfont %> - <% tmp = self + "&sort=" - + (data.isSort(ConferenceContext.SORT_UNREAD) ? -ConferenceContext.SORT_UNREAD - : ConferenceContext.SORT_UNREAD); %> - New - <%= stdfont %> - <% tmp = self + "&sort=" - + (data.isSort(ConferenceContext.SORT_TOTAL) ? -ConferenceContext.SORT_TOTAL - : ConferenceContext.SORT_TOTAL); %> - Total - <%= stdfont %> - <% tmp = self + "&sort=" - + (data.isSort(ConferenceContext.SORT_DATE) ? -ConferenceContext.SORT_DATE - : ConferenceContext.SORT_DATE); %> - Last Response -
 
<%= stdfont %> - <%= topic.getTopicNumber() %>   - <%= stdfont %> - <%= topic.getName() %> - <% if (topic.isArchived() && !(data.isView(ConferenceContext.DISPLAY_ARCHIVED))) { %> - (archived) - <% } else if (topic.isFrozen()) { %> - (frozen) - <% } // end if %> - <%= stdfont %> - <%= topic.getUnreadMessages() %> - <%= stdfont %> - "><%= topic.getTotalMessages() %> - <%= stdfont %> - <%= rdat.formatDateForDisplay(topic.getLastUpdateDate()) %> -

- <% } else { %> - <% - switch (data.getViewOption()) - { - case ConferenceContext.DISPLAY_NEW: - %> - No topics with unread messages found. - <% - break; - case ConferenceContext.DISPLAY_ACTIVE: - case ConferenceContext.DISPLAY_ALL: - %> - No active topics found. - <% - break; - case ConferenceContext.DISPLAY_HIDDEN: - %> - No hidden topics found. - <% - break; - case ConferenceContext.DISPLAY_ARCHIVED: - %> - No archived topics found. - <% - break; - default: - %> - Invalid display option selected. - <% - break; - } // end switch - %> -

- <% } // end if %> -

- [ - <% if (data.isView(ConferenceContext.DISPLAY_NEW)) { %> - New - <% } else { %> - New - <% } // end if %> - | - <% if (data.isView(ConferenceContext.DISPLAY_ACTIVE)) { %> - Active - <% } else { %> - Active - <% } // end if %> - | - <% if (data.isView(ConferenceContext.DISPLAY_ALL)) { %> - All - <% } else { %> - All - <% } // end if %> - | - <% if (data.isView(ConferenceContext.DISPLAY_HIDDEN)) { %> - Hidden - <% } else { %> - Hidden - <% } // end if %> - | - <% if (data.isView(ConferenceContext.DISPLAY_ARCHIVED)) { %> - Archived - <% } else { %> - Archived - <% } // end if %> - ] -
- -<% data.writeBottomCustom(out); %> diff --git a/web/format/user/sidebox.jsp b/web/format/user/sidebox.jsp new file mode 100644 index 0000000..c06246c --- /dev/null +++ b/web/format/user/sidebox.jsp @@ -0,0 +1,114 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "java.util.*" %> +<%@ page import = "com.silverwrist.util.StringUtil" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + JSPView view = JSPView.get(request); + List in_list = (List)(view.getRequestAttribute("sideboxes.included")); + List out_list = (List)(view.getRequestAttribute("sideboxes.excluded")); +%> +User sidebox list + +Return to +Front Page

+ +<% if (in_list.size()>0) { %> + + <% for (int i=0; i + <% SideBoxDescriptor d = (SideBoxDescriptor)(in_list.get(i)); %> + + + + + + + <% } // end for %> +
+ <% if (i==(in_list.size()-1)) { %> <% } else { %> + + usr/sidebox_down.js.vs?box=<%= d.getID() %> + + + <% } // end if %> + + <% if (i==0) { %> <% } else { %> + + usr/sidebox_up.js.vs?box=<%= d.getID() %> + + + <% } // end if %> + + + usr/sidebox_delete.js.vs?box=<%= d.getID() %> + + + + <%= d.getTitle(false) %> +

+ + + + + + + + + + + + + + +
+ + + Click this symbol to move the specified sidebox down on your Front Page. +
+ + + Click this symbol to move the specified sidebox up on your Front Page. +
+ + + Click this symbol to remove the specified sidebox from your Front Page. +
+<% } else { %> + You have no sideboxes on your Front Page. +<% } // end if %> + +<% if (out_list.size()>0) { %> +

+ +

+ Add sidebox:   +    + +
+ +<% } // end if %> diff --git a/web/format/user_photo.jsp b/web/format/user_photo.jsp deleted file mode 100644 index fc512d3..0000000 --- a/web/format/user_photo.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - UserPhotoData data = UserPhotoData.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Change User Photo",null); %> - -
"> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - - <%= data.getPhotoTag(rdat) %> - New user photo:
-

- " NAME="upload" ALT="Upload" - WIDTH=80 HEIGHT=24 BORDER=0>  - " NAME="cancel" ALT="Cancel" - WIDTH=80 HEIGHT=24 BORDER=0>
-

-
- - - - - diff --git a/web/format/user_profile.jsp b/web/format/user_profile.jsp new file mode 100644 index 0000000..ae6ca17 --- /dev/null +++ b/web/format/user_profile.jsp @@ -0,0 +1,97 @@ +<%-- + The contents of this file are subject to the Mozilla Public License Version 1.1 + (the "License"); you may not use this file except in compliance with the License. + You may obtain a copy of the License at . + + Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + WARRANTY OF ANY KIND, either express or implied. See the License for the specific + language governing rights and limitations under the License. + + The Original Code is the Venice Web Communities System. + + The Initial Developer of the Original Code is Eric J. Bowersox , + for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + + Contributor(s): +--%> +<%@ page import = "com.silverwrist.util.StringUtil" %> +<%@ page import = "com.silverwrist.venice.core.*" %> +<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %> +<%@ taglib uri="/tlds/util" prefix="util" %> +<% + JSPView data = JSPView.get(request); + UserProfile prof = (UserProfile)(data.getRequestAttribute("profile")); + String tmp; +%> +Profile for UID #<%= prof.getUID() %> + + + + + +
+ <%= data.getRequestAttribute("user.photo") %>

+ <% java.util.Date tmpd = prof.getCreateDate(); %> + <% if (tmpd!=null) { %> + Account created:
<%= data.formatDate(tmpd) %>
+ <% } // end if %> + <% tmpd = prof.getLastLoginDate(); %> + <% if (tmpd!=null) { %> + Last login:
<%= data.formatDate(tmpd) %>
+ <% } // end if %> + <% tmpd = prof.getLastUpdate(); %> + <% if (tmpd!=null) { %> + Profile last updated:
<%= data.formatDate(tmpd) %>
+ <% } // end if %> +

+ <%= data.getRequestAttribute("fullname").toString() %>
+ <% tmp = prof.getEmail(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %> + E-mail: <%= tmp %>
+ <% } // end if %> + <% tmp = prof.getURL(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %> + URL: <%= tmp %>
+ <% } // end if %>
+ <% tmp = prof.getCompany(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = prof.getAddressLine1(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = prof.getAddressLine2(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = data.getRequestAttribute("address.lastline").toString(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = prof.getFullCountry(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% tmp = prof.getPhone(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Phone: <%= tmp %>
<% } %> + <% tmp = prof.getFax(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Fax: <%= tmp %>
<% } %> + <% tmp = prof.getMobile(); %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Mobile: <%= tmp %>
<% } %> +

+ +<% tmp = prof.getDescription(); %> +<% if (!(StringUtil.isStringEmpty(tmp))) { %> + <%= tmp %>
+<% } // end if %> + +<% if (prof.canSendQuickEmail()) { %> +
Send Quick E-Mail To + <%= prof.getUserName() %>:
+ + + + + + +
+ Subject: + +
+ +
+
+<% } // end if %> diff --git a/web/format/userprofile.jsp b/web/format/userprofile.jsp deleted file mode 100644 index b1b7907..0000000 --- a/web/format/userprofile.jsp +++ /dev/null @@ -1,114 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Community System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - UserProfileData data = UserProfileData.retrieve(request); - Variables.failIfNull(data); - UserProfile prof = data.getUserProfile(); - RenderData rdat = RenderConfig.createRenderData(application,request,response); - String tmp; -%> -<% if (rdat.useHTMLComments()) { %><% } %> -<% rdat.writeContentHeader(out,"User Profile:",prof.getUserName()); %> - - - - - - - - <% tmp = prof.getDescription(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %> - - <% } // end if %> - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,1) %> - <%= data.getPhotoTag(rdat) %>

- - <% Date tmpd = prof.getCreateDate(); %> - <% if (tmpd!=null) { %> - Account created:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> - <% tmpd = prof.getLastLoginDate(); %> - <% if (tmpd!=null) { %> - Last login:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> - <% tmpd = prof.getLastUpdate(); %> - <% if (tmpd!=null) { %> - Profile last updated:
<%= StringUtil.encodeHTML(rdat.formatDateForDisplay(tmpd)) %>
- <% } // end if %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - - <%= StringUtil.encodeHTML(data.getFullName()) %>
- <% tmp = prof.getEmail(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %> - E-mail: <%= StringUtil.encodeHTML(tmp) %>
- <% } // end if %> - <% tmp = prof.getURL(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %> - URL: <%= StringUtil.encodeHTML(tmp) %>
- <% } // end if %>
- - <% tmp = prof.getCompany(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = prof.getAddressLine1(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = prof.getAddressLine2(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = data.getAddressLastLine(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = prof.getFullCountry(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= StringUtil.encodeHTML(tmp) %>
<% } %> - - <% tmp = prof.getPhone(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Phone: <%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = prof.getFax(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Fax: <%= StringUtil.encodeHTML(tmp) %>
<% } %> - <% tmp = prof.getMobile(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Mobile: <%= StringUtil.encodeHTML(tmp) %>
<% } %> -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%= StringUtil.encodeHTML(tmp) %> - -
- -<% if (prof.canSendQuickEmail()) { %> -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Send Quick E-Mail To - <%= prof.getUserName() %>:
-
"> - - - - - -
- <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Subject: - -
- -
- " NAME="send" - ALT="Send E-Mail" WIDTH=80 HEIGHT=24 BORDER=0> -
-
-<% } // end if %> diff --git a/web/format/view_member.jsp b/web/format/view_member.jsp deleted file mode 100644 index 3dd5289..0000000 --- a/web/format/view_member.jsp +++ /dev/null @@ -1,142 +0,0 @@ -<%-- - The contents of this file are subject to the Mozilla Public License Version 1.1 - (the "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at . - - Software distributed under the License is distributed on an "AS IS" basis, WITHOUT - WARRANTY OF ANY KIND, either express or implied. See the License for the specific - language governing rights and limitations under the License. - - The Original Code is the Venice Web Communities System. - - The Initial Developer of the Original Code is Eric J. Bowersox , - for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. - - Contributor(s): ---%> -<%@ page import = "java.util.*" %> -<%@ page import = "com.silverwrist.util.StringUtil" %> -<%@ page import = "com.silverwrist.venice.core.*" %> -<%@ page import = "com.silverwrist.venice.servlets.Variables" %> -<%@ page import = "com.silverwrist.venice.servlets.format.*" %> -<% - ViewCommunityMembers data = ViewCommunityMembers.retrieve(request); - Variables.failIfNull(data); - RenderData rdat = RenderConfig.createRenderData(application,request,response); -%> -<% rdat.writeContentHeader(out,"Members of Community:",data.getCommunityName()); %> - -<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Find members of community -"<%= data.getCommunityName() %>":

-

">
- - - - - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - Display all community members whose   -
- - -
- " - ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
- -
- -<% if (data.displayList()) { %> -
- <% - int dcount = data.getSize(); - // Determine the number of results to display and whether to display a "next" button - boolean go_next = false; - if (dcount>data.getNumResultsDisplayed()) - { // there's a "next" - dcount = data.getNumResultsDisplayed(); - go_next = true; - - } // end if - %> - - - -
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <%-- The community members/search results header --%> - <% if (data.getSimpleList()) { %>Community Members:<% } else { %>Search Results:<% } %> - (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of - <%= data.getFindCount() %>) - - <% if (go_next || (data.getOffset()>0)) { %> - <%-- The navigational form that allows us to page through the results --%> - <% if (rdat.useHTMLComments()) { %><% } %> -
">
- - - - - - - - - <% if (data.getOffset()>0) { %> - " - ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> -   - <% if (go_next) { %> - " - ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> - <% } else { %> - " WIDTH=80 HEIGHT=24 BORDER=0> - <% } // end if %> - -
- <% } else { %> <% } %> -

- - <%-- Display the results of the search --%> - - <% for (int i=0; i - - - - - <% } // end for %> -
- " ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> - <% UserFound uf = data.getItem(i); %> - "><%= uf.getName() %>
- <%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>, - from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %> - <%= uf.getCountry() %> - <% if (data.isCommunityAdmin(uf)) { %> - " ALT="Host!" HSPACE=2 VSPACE=0 BORDER=0 - WIDTH=40 HEIGHT=20 ALIGN=BOTTOM> - <% } // end if %> - <% if (uf.getDescription()!=null) { %>
<%= StringUtil.encodeHTML(uf.getDescription()) %><% } %> -

-<% } // end if %> - - diff --git a/web/images/gelcap/add.jpg b/web/images/gelcap/add.jpg new file mode 100644 index 0000000..3733aa5 Binary files /dev/null and b/web/images/gelcap/add.jpg differ diff --git a/web/images/gelcap/add_to_hotlist.jpg b/web/images/gelcap/add_to_hotlist.jpg new file mode 100644 index 0000000..01ddc12 Binary files /dev/null and b/web/images/gelcap/add_to_hotlist.jpg differ diff --git a/web/images/gelcap/add_topic.jpg b/web/images/gelcap/add_topic.jpg new file mode 100644 index 0000000..1c11027 Binary files /dev/null and b/web/images/gelcap/add_topic.jpg differ diff --git a/web/images/gelcap/archive_topic.jpg b/web/images/gelcap/archive_topic.jpg new file mode 100644 index 0000000..62a1235 Binary files /dev/null and b/web/images/gelcap/archive_topic.jpg differ diff --git a/web/images/gelcap/arrow_next.jpg b/web/images/gelcap/arrow_next.jpg new file mode 100644 index 0000000..26bf87c Binary files /dev/null and b/web/images/gelcap/arrow_next.jpg differ diff --git a/web/images/gelcap/arrow_previous.jpg b/web/images/gelcap/arrow_previous.jpg new file mode 100644 index 0000000..319b9cf Binary files /dev/null and b/web/images/gelcap/arrow_previous.jpg differ diff --git a/web/images/gelcap/cancel.jpg b/web/images/gelcap/cancel.jpg new file mode 100644 index 0000000..f3fb196 Binary files /dev/null and b/web/images/gelcap/cancel.jpg differ diff --git a/web/images/gelcap/conference_list.jpg b/web/images/gelcap/conference_list.jpg new file mode 100644 index 0000000..2d3c8ec Binary files /dev/null and b/web/images/gelcap/conference_list.jpg differ diff --git a/web/images/gelcap/configure.jpg b/web/images/gelcap/configure.jpg new file mode 100644 index 0000000..de97bdf Binary files /dev/null and b/web/images/gelcap/configure.jpg differ diff --git a/web/images/gelcap/create.jpg b/web/images/gelcap/create.jpg new file mode 100644 index 0000000..c5cece2 Binary files /dev/null and b/web/images/gelcap/create.jpg differ diff --git a/web/images/gelcap/create_new.jpg b/web/images/gelcap/create_new.jpg new file mode 100644 index 0000000..b3dd46d Binary files /dev/null and b/web/images/gelcap/create_new.jpg differ diff --git a/web/images/gelcap/delete_topic.jpg b/web/images/gelcap/delete_topic.jpg new file mode 100644 index 0000000..bcbbff9 Binary files /dev/null and b/web/images/gelcap/delete_topic.jpg differ diff --git a/web/images/gelcap/filter_user.jpg b/web/images/gelcap/filter_user.jpg new file mode 100644 index 0000000..64d3aba Binary files /dev/null and b/web/images/gelcap/filter_user.jpg differ diff --git a/web/images/gelcap/find.jpg b/web/images/gelcap/find.jpg new file mode 100644 index 0000000..ee62f83 Binary files /dev/null and b/web/images/gelcap/find.jpg differ diff --git a/web/images/gelcap/freeze_topic.jpg b/web/images/gelcap/freeze_topic.jpg new file mode 100644 index 0000000..bb0761e Binary files /dev/null and b/web/images/gelcap/freeze_topic.jpg differ diff --git a/web/images/gelcap/go.jpg b/web/images/gelcap/go.jpg new file mode 100644 index 0000000..64dd8de Binary files /dev/null and b/web/images/gelcap/go.jpg differ diff --git a/web/images/gelcap/hide.jpg b/web/images/gelcap/hide.jpg new file mode 100644 index 0000000..c3cbff4 Binary files /dev/null and b/web/images/gelcap/hide.jpg differ diff --git a/web/images/gelcap/hide_topic.jpg b/web/images/gelcap/hide_topic.jpg new file mode 100644 index 0000000..98f3142 Binary files /dev/null and b/web/images/gelcap/hide_topic.jpg differ diff --git a/web/images/gelcap/invite.jpg b/web/images/gelcap/invite.jpg new file mode 100644 index 0000000..e33eb21 Binary files /dev/null and b/web/images/gelcap/invite.jpg differ diff --git a/web/images/gelcap/join_now.jpg b/web/images/gelcap/join_now.jpg new file mode 100644 index 0000000..f32f850 Binary files /dev/null and b/web/images/gelcap/join_now.jpg differ diff --git a/web/images/gelcap/login.jpg b/web/images/gelcap/login.jpg new file mode 100644 index 0000000..13d3641 Binary files /dev/null and b/web/images/gelcap/login.jpg differ diff --git a/web/images/gelcap/manage.jpg b/web/images/gelcap/manage.jpg new file mode 100644 index 0000000..72663f3 Binary files /dev/null and b/web/images/gelcap/manage.jpg differ diff --git a/web/images/gelcap/next_keep_new.jpg b/web/images/gelcap/next_keep_new.jpg new file mode 100644 index 0000000..dd56d6d Binary files /dev/null and b/web/images/gelcap/next_keep_new.jpg differ diff --git a/web/images/gelcap/next_topic.jpg b/web/images/gelcap/next_topic.jpg new file mode 100644 index 0000000..7b14292 Binary files /dev/null and b/web/images/gelcap/next_topic.jpg differ diff --git a/web/images/gelcap/no.jpg b/web/images/gelcap/no.jpg new file mode 100644 index 0000000..8892da7 Binary files /dev/null and b/web/images/gelcap/no.jpg differ diff --git a/web/images/gelcap/nuke.jpg b/web/images/gelcap/nuke.jpg new file mode 100644 index 0000000..b16caba Binary files /dev/null and b/web/images/gelcap/nuke.jpg differ diff --git a/web/images/gelcap/ok.jpg b/web/images/gelcap/ok.jpg new file mode 100644 index 0000000..14196cb Binary files /dev/null and b/web/images/gelcap/ok.jpg differ diff --git a/web/images/gelcap/post.jpg b/web/images/gelcap/post.jpg new file mode 100644 index 0000000..a675bf5 Binary files /dev/null and b/web/images/gelcap/post.jpg differ diff --git a/web/images/gelcap/post_go_next.jpg b/web/images/gelcap/post_go_next.jpg new file mode 100644 index 0000000..2837c57 Binary files /dev/null and b/web/images/gelcap/post_go_next.jpg differ diff --git a/web/images/gelcap/post_go_topics.jpg b/web/images/gelcap/post_go_topics.jpg new file mode 100644 index 0000000..85664be Binary files /dev/null and b/web/images/gelcap/post_go_topics.jpg differ diff --git a/web/images/gelcap/post_reload.jpg b/web/images/gelcap/post_reload.jpg new file mode 100644 index 0000000..24a4716 Binary files /dev/null and b/web/images/gelcap/post_reload.jpg differ diff --git a/web/images/gelcap/preview.jpg b/web/images/gelcap/preview.jpg new file mode 100644 index 0000000..aa9aa72 Binary files /dev/null and b/web/images/gelcap/preview.jpg differ diff --git a/web/images/gelcap/publish.jpg b/web/images/gelcap/publish.jpg new file mode 100644 index 0000000..35b5976 Binary files /dev/null and b/web/images/gelcap/publish.jpg differ diff --git a/web/images/gelcap/read_new.jpg b/web/images/gelcap/read_new.jpg new file mode 100644 index 0000000..500fcef Binary files /dev/null and b/web/images/gelcap/read_new.jpg differ diff --git a/web/images/gelcap/reminder.jpg b/web/images/gelcap/reminder.jpg new file mode 100644 index 0000000..57f19b8 Binary files /dev/null and b/web/images/gelcap/reminder.jpg differ diff --git a/web/images/gelcap/remove.jpg b/web/images/gelcap/remove.jpg new file mode 100644 index 0000000..c0605ae Binary files /dev/null and b/web/images/gelcap/remove.jpg differ diff --git a/web/images/gelcap/scribble.jpg b/web/images/gelcap/scribble.jpg new file mode 100644 index 0000000..16741f1 Binary files /dev/null and b/web/images/gelcap/scribble.jpg differ diff --git a/web/images/gelcap/search.jpg b/web/images/gelcap/search.jpg new file mode 100644 index 0000000..b8d43da Binary files /dev/null and b/web/images/gelcap/search.jpg differ diff --git a/web/images/gelcap/send_again.jpg b/web/images/gelcap/send_again.jpg new file mode 100644 index 0000000..9185d5e Binary files /dev/null and b/web/images/gelcap/send_again.jpg differ diff --git a/web/images/gelcap/send_email.jpg b/web/images/gelcap/send_email.jpg new file mode 100644 index 0000000..c9cb31d Binary files /dev/null and b/web/images/gelcap/send_email.jpg differ diff --git a/web/images/gelcap/set.jpg b/web/images/gelcap/set.jpg new file mode 100644 index 0000000..dfeaefd Binary files /dev/null and b/web/images/gelcap/set.jpg differ diff --git a/web/images/gelcap/show.jpg b/web/images/gelcap/show.jpg new file mode 100644 index 0000000..6cd81d6 Binary files /dev/null and b/web/images/gelcap/show.jpg differ diff --git a/web/images/gelcap/show_topic.jpg b/web/images/gelcap/show_topic.jpg new file mode 100644 index 0000000..04c987d Binary files /dev/null and b/web/images/gelcap/show_topic.jpg differ diff --git a/web/images/gelcap/topic_list.jpg b/web/images/gelcap/topic_list.jpg new file mode 100644 index 0000000..7eb8dd0 Binary files /dev/null and b/web/images/gelcap/topic_list.jpg differ diff --git a/web/images/gelcap/unarchive_topic.jpg b/web/images/gelcap/unarchive_topic.jpg new file mode 100644 index 0000000..3f99b88 Binary files /dev/null and b/web/images/gelcap/unarchive_topic.jpg differ diff --git a/web/images/gelcap/unfreeze_topic.jpg b/web/images/gelcap/unfreeze_topic.jpg new file mode 100644 index 0000000..2487d24 Binary files /dev/null and b/web/images/gelcap/unfreeze_topic.jpg differ diff --git a/web/images/gelcap/update.jpg b/web/images/gelcap/update.jpg new file mode 100644 index 0000000..1142eb4 Binary files /dev/null and b/web/images/gelcap/update.jpg differ diff --git a/web/images/gelcap/upload.jpg b/web/images/gelcap/upload.jpg new file mode 100644 index 0000000..0aef422 Binary files /dev/null and b/web/images/gelcap/upload.jpg differ diff --git a/web/images/gelcap/user_accept.jpg b/web/images/gelcap/user_accept.jpg new file mode 100644 index 0000000..41dafc6 Binary files /dev/null and b/web/images/gelcap/user_accept.jpg differ diff --git a/web/images/gelcap/user_decline.jpg b/web/images/gelcap/user_decline.jpg new file mode 100644 index 0000000..b36b36d Binary files /dev/null and b/web/images/gelcap/user_decline.jpg differ diff --git a/web/images/gelcap/yes.jpg b/web/images/gelcap/yes.jpg new file mode 100644 index 0000000..d6a118d Binary files /dev/null and b/web/images/gelcap/yes.jpg differ diff --git a/web/images/venice-favicon.ico b/web/images/venice-favicon.ico new file mode 100644 index 0000000..36bc93f Binary files /dev/null and b/web/images/venice-favicon.ico differ diff --git a/web/images/venice-icon.png b/web/images/venice-icon.png new file mode 100644 index 0000000..bba035d Binary files /dev/null and b/web/images/venice-icon.png differ