added UI for exporting all the members from a community, and tweaked the
implementation of XML generation and importing
This commit is contained in:
		
							parent
							
								
									7061d88b22
								
							
						
					
					
						commit
						2966ab703a
					
				
							
								
								
									
										55
									
								
								scripts/comm/member_export.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								scripts/comm/member_export.js
									
									
									
									
									
										Normal file
									
								
							@ -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@ricochet.com>,
 | 
				
			||||||
 | 
					// for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
				
			||||||
 | 
					// Copyright (C) 2004 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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// get the request object and the community
 | 
				
			||||||
 | 
					rinput = bsf.lookupBean("request");
 | 
				
			||||||
 | 
					comm = rinput.getCommunity(true,"top.js.vs");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (!(rinput.user.hasAdminAccess()))
 | 
				
			||||||
 | 
					{ // no admin access - we can't do this
 | 
				
			||||||
 | 
					  vlib.output(new ErrorBox("Access Error","You do not have permission to export a community's members",null));
 | 
				
			||||||
 | 
					  vlib.done();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rc = null;
 | 
				
			||||||
 | 
					try
 | 
				
			||||||
 | 
					{ // get the community member list
 | 
				
			||||||
 | 
					  mbr_list = comm.getMemberList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // perform the export and get the results
 | 
				
			||||||
 | 
					  rc = new UserExportHelper(rinput.user.adminInterface,mbr_list);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					} // end try
 | 
				
			||||||
 | 
					catch (e)
 | 
				
			||||||
 | 
					{ // an error of some sort
 | 
				
			||||||
 | 
					  etype = vlib.exceptionType(e) + "";
 | 
				
			||||||
 | 
					  if (etype.match("DataException"))
 | 
				
			||||||
 | 
					    rc = new ErrorBox("Database Error",e.message,"community/" + comm.alias);
 | 
				
			||||||
 | 
					  else if (etype.match("IOException"))
 | 
				
			||||||
 | 
					    rc = new ErrorBox("I/O Error",e.message,"community/" + comm.alias);
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    rc = e;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // end catch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vlib.output(rc);
 | 
				
			||||||
@ -21,8 +21,7 @@ import java.io.*;
 | 
				
			|||||||
import java.sql.*;
 | 
					import java.sql.*;
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
import org.apache.log4j.*;
 | 
					import org.apache.log4j.*;
 | 
				
			||||||
import com.silverwrist.util.International;
 | 
					import com.silverwrist.util.*;
 | 
				
			||||||
import com.silverwrist.util.OptionSet;
 | 
					 | 
				
			||||||
import com.silverwrist.venice.core.*;
 | 
					import com.silverwrist.venice.core.*;
 | 
				
			||||||
import com.silverwrist.venice.core.internals.*;
 | 
					import com.silverwrist.venice.core.internals.*;
 | 
				
			||||||
import com.silverwrist.venice.db.*;
 | 
					import com.silverwrist.venice.db.*;
 | 
				
			||||||
@ -685,11 +684,16 @@ class AdminUserContextImpl implements AdminUserContext
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    } // end finally
 | 
					    } // end finally
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xml.write("<venice-user id=\"" + uid + "\">\n");
 | 
					    xml.write("<venice-user id=\"" + uid + "\">\n<username>" + username
 | 
				
			||||||
    xml.write("<username>" + username + "</username>\n");
 | 
						      + "</username>\n<password prehashed=\"true\">" + hash + "</password>\n");
 | 
				
			||||||
    xml.write("<password prehashed=\"true\">" + hash + "</password>\n");
 | 
					    if (StringUtil.isStringEmpty(reminder))
 | 
				
			||||||
    xml.write("<password-reminder>" + reminder + "</password-reminder>\n");
 | 
					      xml.write("<password-reminder/>\n");
 | 
				
			||||||
    xml.write("<description>" + description + "</description>\n");
 | 
					    else
 | 
				
			||||||
 | 
					      xml.write("<password-reminder>" + reminder + "</password-reminder>\n");
 | 
				
			||||||
 | 
					    if (StringUtil.isStringEmpty(description))
 | 
				
			||||||
 | 
					      xml.write("<description/>\n");
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      xml.write("<description>" + description + "</description>\n");
 | 
				
			||||||
    xml.write("<options confirmed=\"");
 | 
					    xml.write("<options confirmed=\"");
 | 
				
			||||||
    xml.write(email_verified ? "true" : "false");
 | 
					    xml.write(email_verified ? "true" : "false");
 | 
				
			||||||
    xml.write("\" locked=\"");
 | 
					    xml.write("\" locked=\"");
 | 
				
			||||||
 | 
				
			|||||||
@ -729,7 +729,7 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
    if (vc.getOrganizationName()!=null)
 | 
					    if (vc.getOrganizationName()!=null)
 | 
				
			||||||
      company = vc.getOrganizationName();
 | 
					      company = vc.getOrganizationName();
 | 
				
			||||||
    if (vc.getURL()!=null)
 | 
					    if (vc.getURL()!=null)
 | 
				
			||||||
    url = vc.getURL();
 | 
					      url = vc.getURL();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Look for an address.
 | 
					    // Look for an address.
 | 
				
			||||||
    Boolean hide = null;
 | 
					    Boolean hide = null;
 | 
				
			||||||
@ -1112,7 +1112,7 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
    BuildVCard bvc = new BuildVCard();
 | 
					    BuildVCard bvc = new BuildVCard();
 | 
				
			||||||
    bvc.setFamilyName(family_name);
 | 
					    bvc.setFamilyName(family_name);
 | 
				
			||||||
    bvc.setGivenName(given_name);
 | 
					    bvc.setGivenName(given_name);
 | 
				
			||||||
    bvc.setMiddleName(new String(new char[] { middle_initial }));
 | 
					    bvc.setMiddleName(new String(new char[] { middle_initial }).trim());
 | 
				
			||||||
    bvc.setPrefix(prefix);
 | 
					    bvc.setPrefix(prefix);
 | 
				
			||||||
    bvc.setSuffix(suffix);
 | 
					    bvc.setSuffix(suffix);
 | 
				
			||||||
    bvc.setOrganizationName(company);
 | 
					    bvc.setOrganizationName(company);
 | 
				
			||||||
@ -1120,12 +1120,14 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // add the address to the VCard
 | 
					    // add the address to the VCard
 | 
				
			||||||
    BuildVCardAddress baddr = new BuildVCardAddress();
 | 
					    BuildVCardAddress baddr = new BuildVCardAddress();
 | 
				
			||||||
    baddr.setHomeAddress(true);
 | 
					    if (private_addr)
 | 
				
			||||||
    baddr.setWorkAddress(true);
 | 
					      baddr.setHomeAddress(true);
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      baddr.setWorkAddress(true);
 | 
				
			||||||
    baddr.setPreferred(true);
 | 
					    baddr.setPreferred(true);
 | 
				
			||||||
    if (addr1!=null)
 | 
					    if (!StringUtil.isStringEmpty(addr1))
 | 
				
			||||||
    { // save off address
 | 
					    { // save off address
 | 
				
			||||||
      if (addr2!=null)
 | 
					      if (!StringUtil.isStringEmpty(addr2))
 | 
				
			||||||
      { // set extension, then street
 | 
					      { // set extension, then street
 | 
				
			||||||
	baddr.setExtension(addr1);
 | 
						baddr.setExtension(addr1);
 | 
				
			||||||
	baddr.setStreet(addr2);
 | 
						baddr.setStreet(addr2);
 | 
				
			||||||
@ -1144,10 +1146,12 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Add phone number.
 | 
					    // Add phone number.
 | 
				
			||||||
    BuildVCardPhone bphone = new BuildVCardPhone();
 | 
					    BuildVCardPhone bphone = new BuildVCardPhone();
 | 
				
			||||||
    if (phone!=null)
 | 
					    if (!StringUtil.isStringEmpty(phone))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setHomePhone(true);
 | 
					      if (private_phone)
 | 
				
			||||||
      bphone.setWorkPhone(true);
 | 
						bphone.setHomePhone(true);
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						bphone.setWorkPhone(true);
 | 
				
			||||||
      bphone.setVoicePhone(true);
 | 
					      bphone.setVoicePhone(true);
 | 
				
			||||||
      bphone.setNumber(phone);
 | 
					      bphone.setNumber(phone);
 | 
				
			||||||
      bvc.addPhone(bphone.create());
 | 
					      bvc.addPhone(bphone.create());
 | 
				
			||||||
@ -1156,10 +1160,12 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add fax number.
 | 
					    // Add fax number.
 | 
				
			||||||
    if (fax!=null)
 | 
					    if (!StringUtil.isStringEmpty(fax))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setHomePhone(true);
 | 
					      if (private_fax)
 | 
				
			||||||
      bphone.setWorkPhone(true);
 | 
						bphone.setHomePhone(true);
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						bphone.setWorkPhone(true);
 | 
				
			||||||
      bphone.setFax(true);
 | 
					      bphone.setFax(true);
 | 
				
			||||||
      bphone.setNumber(fax);
 | 
					      bphone.setNumber(fax);
 | 
				
			||||||
      bvc.addPhone(bphone.create());
 | 
					      bvc.addPhone(bphone.create());
 | 
				
			||||||
@ -1168,7 +1174,7 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add mobile number.
 | 
					    // Add mobile number.
 | 
				
			||||||
    if (mobile!=null)
 | 
					    if (!StringUtil.isStringEmpty(mobile))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setCellPhone(true);
 | 
					      bphone.setCellPhone(true);
 | 
				
			||||||
      bphone.setPCSPhone(true);
 | 
					      bphone.setPCSPhone(true);
 | 
				
			||||||
@ -1178,11 +1184,13 @@ class ContactInfoImpl implements ContactInfo, Stashable
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add E-mail address.
 | 
					    // Add E-mail address.
 | 
				
			||||||
    if (email!=null)
 | 
					    if (!StringUtil.isStringEmpty(email))
 | 
				
			||||||
    { // set attributes and address
 | 
					    { // set attributes and address
 | 
				
			||||||
      BuildVCardEmail bemail = new BuildVCardEmail();
 | 
					      BuildVCardEmail bemail = new BuildVCardEmail();
 | 
				
			||||||
      bemail.setHomeEmail(true);
 | 
					      if (private_email)
 | 
				
			||||||
      bemail.setWorkEmail(true);
 | 
						bemail.setHomeEmail(true);
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						bemail.setWorkEmail(true);
 | 
				
			||||||
      bemail.setInternetEmail(true);
 | 
					      bemail.setInternetEmail(true);
 | 
				
			||||||
      bemail.setPreferred(true);
 | 
					      bemail.setPreferred(true);
 | 
				
			||||||
      bemail.setAddress(email);
 | 
					      bemail.setAddress(email);
 | 
				
			||||||
 | 
				
			|||||||
@ -440,7 +440,7 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
    BuildVCard bvc = new BuildVCard();
 | 
					    BuildVCard bvc = new BuildVCard();
 | 
				
			||||||
    bvc.setFamilyName(family_name);
 | 
					    bvc.setFamilyName(family_name);
 | 
				
			||||||
    bvc.setGivenName(given_name);
 | 
					    bvc.setGivenName(given_name);
 | 
				
			||||||
    bvc.setMiddleName(new String(new char[] { middle_initial }));
 | 
					    bvc.setMiddleName(new String(new char[] { middle_initial }).trim());
 | 
				
			||||||
    bvc.setPrefix(prefix);
 | 
					    bvc.setPrefix(prefix);
 | 
				
			||||||
    bvc.setSuffix(suffix);
 | 
					    bvc.setSuffix(suffix);
 | 
				
			||||||
    bvc.setNickname(username);
 | 
					    bvc.setNickname(username);
 | 
				
			||||||
@ -450,12 +450,11 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // add the address to the VCard
 | 
					    // add the address to the VCard
 | 
				
			||||||
    BuildVCardAddress baddr = new BuildVCardAddress();
 | 
					    BuildVCardAddress baddr = new BuildVCardAddress();
 | 
				
			||||||
    baddr.setHomeAddress(true);
 | 
					 | 
				
			||||||
    baddr.setWorkAddress(true);
 | 
					    baddr.setWorkAddress(true);
 | 
				
			||||||
    baddr.setPreferred(true);
 | 
					    baddr.setPreferred(true);
 | 
				
			||||||
    if (addr1!=null)
 | 
					    if (!StringUtil.isStringEmpty(addr1))
 | 
				
			||||||
    { // save off address
 | 
					    { // save off address
 | 
				
			||||||
      if (addr2!=null)
 | 
					      if (!StringUtil.isStringEmpty(addr2))
 | 
				
			||||||
      { // set extension, then street
 | 
					      { // set extension, then street
 | 
				
			||||||
	baddr.setExtension(addr1);
 | 
						baddr.setExtension(addr1);
 | 
				
			||||||
	baddr.setStreet(addr2);
 | 
						baddr.setStreet(addr2);
 | 
				
			||||||
@ -474,9 +473,8 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Add phone number.
 | 
					    // Add phone number.
 | 
				
			||||||
    BuildVCardPhone bphone = new BuildVCardPhone();
 | 
					    BuildVCardPhone bphone = new BuildVCardPhone();
 | 
				
			||||||
    if (phone!=null)
 | 
					    if (!StringUtil.isStringEmpty(phone))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setHomePhone(true);
 | 
					 | 
				
			||||||
      bphone.setWorkPhone(true);
 | 
					      bphone.setWorkPhone(true);
 | 
				
			||||||
      bphone.setVoicePhone(true);
 | 
					      bphone.setVoicePhone(true);
 | 
				
			||||||
      bphone.setNumber(phone);
 | 
					      bphone.setNumber(phone);
 | 
				
			||||||
@ -486,9 +484,8 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add fax number.
 | 
					    // Add fax number.
 | 
				
			||||||
    if (fax!=null)
 | 
					    if (!StringUtil.isStringEmpty(fax))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setHomePhone(true);
 | 
					 | 
				
			||||||
      bphone.setWorkPhone(true);
 | 
					      bphone.setWorkPhone(true);
 | 
				
			||||||
      bphone.setFax(true);
 | 
					      bphone.setFax(true);
 | 
				
			||||||
      bphone.setNumber(fax);
 | 
					      bphone.setNumber(fax);
 | 
				
			||||||
@ -498,7 +495,7 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add mobile number.
 | 
					    // Add mobile number.
 | 
				
			||||||
    if (mobile!=null)
 | 
					    if (!StringUtil.isStringEmpty(mobile))
 | 
				
			||||||
    { // set attributes and number
 | 
					    { // set attributes and number
 | 
				
			||||||
      bphone.setCellPhone(true);
 | 
					      bphone.setCellPhone(true);
 | 
				
			||||||
      bphone.setPCSPhone(true);
 | 
					      bphone.setPCSPhone(true);
 | 
				
			||||||
@ -508,10 +505,9 @@ class UserProfileImpl implements UserProfile
 | 
				
			|||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add E-mail address.
 | 
					    // Add E-mail address.
 | 
				
			||||||
    if (email!=null)
 | 
					    if (!StringUtil.isStringEmpty(email))
 | 
				
			||||||
    { // set attributes and address
 | 
					    { // set attributes and address
 | 
				
			||||||
      BuildVCardEmail bemail = new BuildVCardEmail();
 | 
					      BuildVCardEmail bemail = new BuildVCardEmail();
 | 
				
			||||||
      bemail.setHomeEmail(true);
 | 
					 | 
				
			||||||
      bemail.setWorkEmail(true);
 | 
					      bemail.setWorkEmail(true);
 | 
				
			||||||
      bemail.setInternetEmail(true);
 | 
					      bemail.setInternetEmail(true);
 | 
				
			||||||
      bemail.setPreferred(true);
 | 
					      bemail.setPreferred(true);
 | 
				
			||||||
 | 
				
			|||||||
@ -245,11 +245,13 @@ public class ImportHelper
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	  // set up the contact info
 | 
						  // set up the contact info
 | 
				
			||||||
	  ContactInfo ci = uc.getContactInfo();
 | 
						  ContactInfo ci = uc.getContactInfo();
 | 
				
			||||||
 | 
						  ci.importVCard(vcard);
 | 
				
			||||||
 | 
						  // N.B.: Since the vCard importer uses its own heuristics as to how to set the "hidden"
 | 
				
			||||||
 | 
						  // flags, we need to reset them to the values from the <options/> element afterwards.
 | 
				
			||||||
	  ci.setPrivateAddress(hideaddr);
 | 
						  ci.setPrivateAddress(hideaddr);
 | 
				
			||||||
	  ci.setPrivatePhone(hidephone);
 | 
						  ci.setPrivatePhone(hidephone);
 | 
				
			||||||
	  ci.setPrivateFax(hidefax);
 | 
						  ci.setPrivateFax(hidefax);
 | 
				
			||||||
	  ci.setPrivateEmail(hideemail);
 | 
						  ci.setPrivateEmail(hideemail);
 | 
				
			||||||
	  ci.importVCard(vcard);
 | 
					 | 
				
			||||||
	  uc.putContactInfo(ci);
 | 
						  uc.putContactInfo(ci);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  // set up the locale
 | 
						  // set up the locale
 | 
				
			||||||
 | 
				
			|||||||
@ -56,6 +56,8 @@ public class UserExportHelper implements ContentExecute
 | 
				
			|||||||
	tmp.add(adm.getUserContext(((UserContext)o).getUID()));
 | 
						tmp.add(adm.getUserContext(((UserContext)o).getUID()));
 | 
				
			||||||
      else if (o instanceof UserProfile)
 | 
					      else if (o instanceof UserProfile)
 | 
				
			||||||
	tmp.add(adm.getUserContext(((UserProfile)o).getUID()));
 | 
						tmp.add(adm.getUserContext(((UserProfile)o).getUID()));
 | 
				
			||||||
 | 
					      else if (o instanceof UserFound)
 | 
				
			||||||
 | 
						tmp.add(adm.getUserContext(((UserFound)o).getUID()));
 | 
				
			||||||
      else if (o instanceof Number)
 | 
					      else if (o instanceof Number)
 | 
				
			||||||
	tmp.add(adm.getUserContext(((Number)o).intValue()));
 | 
						tmp.add(adm.getUserContext(((Number)o).intValue()));
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
@ -95,7 +97,7 @@ public class UserExportHelper implements ContentExecute
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  public void execute(RequestExec req) throws IOException
 | 
					  public void execute(RequestExec req) throws IOException
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    req.sendBinary("text/xml","export-data.xml",m_length,m_stm);
 | 
					    req.sendBinary("text/xml","exported-users.xml",m_length,m_stm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  } // end execute
 | 
					  } // end execute
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,9 +9,9 @@
 | 
				
			|||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * The Original Code is the Venice Web Communities System.
 | 
					 * The Original Code is the Venice Web Communities System.
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
					 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
				
			||||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
					 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
				
			||||||
 * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
					 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * Contributor(s): 
 | 
					 * Contributor(s): 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -230,6 +230,14 @@ public class MembersView implements ContentJSP
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  } // end isCommunityAdmin
 | 
					  } // end isCommunityAdmin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public boolean canExportMembers()
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    if (rinput==null)
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					    return rinput.getUser().hasAdminAccess();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  } // end canExportMembers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*--------------------------------------------------------------------------------
 | 
					  /*--------------------------------------------------------------------------------
 | 
				
			||||||
   * External static operations
 | 
					   * External static operations
 | 
				
			||||||
   *--------------------------------------------------------------------------------
 | 
					   *--------------------------------------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,7 @@
 | 
				
			|||||||
package com.silverwrist.venice.util;
 | 
					package com.silverwrist.venice.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import com.silverwrist.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class BuildVCard
 | 
					public class BuildVCard
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -61,28 +62,28 @@ public class BuildVCard
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  private final String realFormattedName()
 | 
					  private final String realFormattedName()
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if (formatted_name!=null)
 | 
					    if (!StringUtil.isStringEmpty(formatted_name))
 | 
				
			||||||
      return formatted_name;
 | 
					      return formatted_name;
 | 
				
			||||||
    StringBuffer buf = new StringBuffer();
 | 
					    StringBuffer buf = new StringBuffer();
 | 
				
			||||||
    if (prefix!=null)
 | 
					    if (!StringUtil.isStringEmpty(prefix))
 | 
				
			||||||
      buf.append(prefix).append(' ');
 | 
					      buf.append(prefix).append(' ');
 | 
				
			||||||
    if (given_name!=null)
 | 
					    if (!StringUtil.isStringEmpty(given_name))
 | 
				
			||||||
      buf.append(given_name);
 | 
					      buf.append(given_name);
 | 
				
			||||||
    if ((middle_name!=null) || (family_name!=null))
 | 
					    if (!StringUtil.isStringEmpty(middle_name) || !StringUtil.isStringEmpty(family_name))
 | 
				
			||||||
      buf.append(' ');
 | 
					      buf.append(' ');
 | 
				
			||||||
    if (middle_name!=null)
 | 
					    if (!StringUtil.isStringEmpty(middle_name))
 | 
				
			||||||
    { // figure out the middle name
 | 
					    { // figure out the middle name
 | 
				
			||||||
      buf.append(middle_name);
 | 
					      buf.append(middle_name);
 | 
				
			||||||
      if (middle_name.length()==1)
 | 
					      if (middle_name.length()==1)
 | 
				
			||||||
	buf.append('.');
 | 
						buf.append('.');
 | 
				
			||||||
      if (family_name!=null)
 | 
					      if (!StringUtil.isStringEmpty(family_name))
 | 
				
			||||||
	buf.append(' ');
 | 
						buf.append(' ');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (family_name!=null)
 | 
					    if (!StringUtil.isStringEmpty(family_name))
 | 
				
			||||||
      buf.append(family_name);
 | 
					      buf.append(family_name);
 | 
				
			||||||
    if (suffix!=null)
 | 
					    if (!StringUtil.isStringEmpty(suffix))
 | 
				
			||||||
      buf.append(' ').append(suffix);
 | 
					      buf.append(' ').append(suffix);
 | 
				
			||||||
    String s = buf.toString();
 | 
					    String s = buf.toString();
 | 
				
			||||||
    if (s.length()==0)
 | 
					    if (s.length()==0)
 | 
				
			||||||
@ -209,6 +210,13 @@ public class BuildVCard
 | 
				
			|||||||
  public final void setTimeZone(TimeZone tz)
 | 
					  public final void setTimeZone(TimeZone tz)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    int ofs = tz.getRawOffset();
 | 
					    int ofs = tz.getRawOffset();
 | 
				
			||||||
 | 
					    if (ofs==0)
 | 
				
			||||||
 | 
					    { // we're dead-bang on Zulu time - recognize that fact
 | 
				
			||||||
 | 
					      timezone = "Z";
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    StringBuffer buf = new StringBuffer();
 | 
					    StringBuffer buf = new StringBuffer();
 | 
				
			||||||
    if (ofs<0)
 | 
					    if (ofs<0)
 | 
				
			||||||
    { // negative offset
 | 
					    { // negative offset
 | 
				
			||||||
 | 
				
			|||||||
@ -588,26 +588,28 @@ public class VCard
 | 
				
			|||||||
  public final void exportXML(Writer xml_writer) throws IOException
 | 
					  public final void exportXML(Writer xml_writer) throws IOException
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    xml_writer.write("<vCard xmlns=\"vcard-temp\">\n<VERSION>2.0</VERSION>\n");
 | 
					    xml_writer.write("<vCard xmlns=\"vcard-temp\">\n<VERSION>2.0</VERSION>\n");
 | 
				
			||||||
    if (formatted_name!=null)
 | 
					    if (!StringUtil.isStringEmpty(formatted_name))
 | 
				
			||||||
      xml_writer.write("<FN>" + formatted_name + "</FN>\n");
 | 
					      xml_writer.write("<FN>" + formatted_name + "</FN>\n");
 | 
				
			||||||
    if ((family_name!=null) || (given_name!=null) || (middle_name!=null) || (prefix!=null) || (suffix!=null))
 | 
					    if (   !StringUtil.isStringEmpty(family_name) || !StringUtil.isStringEmpty(given_name)
 | 
				
			||||||
 | 
					        || !StringUtil.isStringEmpty(middle_name) || !StringUtil.isStringEmpty(prefix)
 | 
				
			||||||
 | 
					        || !StringUtil.isStringEmpty(suffix))
 | 
				
			||||||
    { // write out the "N" block
 | 
					    { // write out the "N" block
 | 
				
			||||||
      xml_writer.write("<N>");
 | 
					      xml_writer.write("<N>");
 | 
				
			||||||
      if (family_name!=null)
 | 
					      if (!StringUtil.isStringEmpty(family_name))
 | 
				
			||||||
	xml_writer.write("<FAMILY>" + family_name + "</FAMILY>");
 | 
						xml_writer.write("<FAMILY>" + family_name + "</FAMILY>");
 | 
				
			||||||
      if (given_name!=null)
 | 
					      if (!StringUtil.isStringEmpty(given_name))
 | 
				
			||||||
	xml_writer.write("<GIVEN>" + given_name + "</GIVEN>");
 | 
						xml_writer.write("<GIVEN>" + given_name + "</GIVEN>");
 | 
				
			||||||
      if (middle_name!=null)
 | 
					      if (!StringUtil.isStringEmpty(middle_name))
 | 
				
			||||||
	xml_writer.write("<MIDDLE>" + middle_name + "</MIDDLE>");
 | 
						xml_writer.write("<MIDDLE>" + middle_name + "</MIDDLE>");
 | 
				
			||||||
      if (prefix!=null)
 | 
					      if (!StringUtil.isStringEmpty(prefix))
 | 
				
			||||||
	xml_writer.write("<PREFIX>" + prefix + "</PREFIX>");
 | 
						xml_writer.write("<PREFIX>" + prefix + "</PREFIX>");
 | 
				
			||||||
      if (suffix!=null)
 | 
					      if (!StringUtil.isStringEmpty(suffix))
 | 
				
			||||||
	xml_writer.write("<SUFFIX>" + suffix + "</SUFFIX>");
 | 
						xml_writer.write("<SUFFIX>" + suffix + "</SUFFIX>");
 | 
				
			||||||
      xml_writer.write("</N>\n");
 | 
					      xml_writer.write("</N>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } // end if
 | 
					    } // end if
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (nickname!=null)
 | 
					    if (!StringUtil.isStringEmpty(nickname))
 | 
				
			||||||
      xml_writer.write("<NICKNAME>" + nickname + "</NICKNAME>\n");
 | 
					      xml_writer.write("<NICKNAME>" + nickname + "</NICKNAME>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Iterator it;
 | 
					    Iterator it;
 | 
				
			||||||
@ -632,21 +634,21 @@ public class VCard
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    } // end for
 | 
					    } // end for
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (mailer!=null)
 | 
					    if (!StringUtil.isStringEmpty(mailer))
 | 
				
			||||||
      xml_writer.write("<MAILER>" + mailer + "</MAILER>\n");
 | 
					      xml_writer.write("<MAILER>" + mailer + "</MAILER>\n");
 | 
				
			||||||
    if (timezone!=null)
 | 
					    if (!StringUtil.isStringEmpty(timezone))
 | 
				
			||||||
      xml_writer.write("<TZ>" + timezone + "</TZ>\n");
 | 
					      xml_writer.write("<TZ>" + timezone + "</TZ>\n");
 | 
				
			||||||
    if (title!=null)
 | 
					    if (!StringUtil.isStringEmpty(title))
 | 
				
			||||||
      xml_writer.write("<TITLE>" + title + "</TITLE>\n");
 | 
					      xml_writer.write("<TITLE>" + title + "</TITLE>\n");
 | 
				
			||||||
    if (role!=null)
 | 
					    if (!StringUtil.isStringEmpty(role))
 | 
				
			||||||
      xml_writer.write("<ROLE>" + role + "</ROLE>\n");
 | 
					      xml_writer.write("<ROLE>" + role + "</ROLE>\n");
 | 
				
			||||||
    if (orgname!=null)
 | 
					    if (!StringUtil.isStringEmpty(orgname))
 | 
				
			||||||
      xml_writer.write("<ORG><ORGNAME>" + orgname + "</ORGNAME></ORG>\n");
 | 
					      xml_writer.write("<ORG><ORGNAME>" + orgname + "</ORGNAME></ORG>\n");
 | 
				
			||||||
    if (note!=null)
 | 
					    if (!StringUtil.isStringEmpty(note))
 | 
				
			||||||
      xml_writer.write("<NOTE>" + note + "</NOTE>\n");
 | 
					      xml_writer.write("<NOTE>" + note + "</NOTE>\n");
 | 
				
			||||||
    if (sort_string!=null)
 | 
					    if (!StringUtil.isStringEmpty(sort_string))
 | 
				
			||||||
      xml_writer.write("<SORTSTR>" + sort_string + "</SORTSTR>\n");
 | 
					      xml_writer.write("<SORTSTR>" + sort_string + "</SORTSTR>\n");
 | 
				
			||||||
    if (url!=null)
 | 
					    if (!StringUtil.isStringEmpty(url))
 | 
				
			||||||
      xml_writer.write("<URL>" + url + "</URL>\n");
 | 
					      xml_writer.write("<URL>" + url + "</URL>\n");
 | 
				
			||||||
    xml_writer.write("</vCard>\n");
 | 
					    xml_writer.write("</vCard>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -126,19 +126,19 @@ public class VCardAddress
 | 
				
			|||||||
    if (preferred)
 | 
					    if (preferred)
 | 
				
			||||||
      xml_writer.write("<PREF/>");
 | 
					      xml_writer.write("<PREF/>");
 | 
				
			||||||
    xml_writer.write("\n");
 | 
					    xml_writer.write("\n");
 | 
				
			||||||
    if (pobox!=null)
 | 
					    if (!StringUtil.isStringEmpty(pobox))
 | 
				
			||||||
      xml_writer.write("<POBOX>" + pobox + "</POBOX>\n");
 | 
					      xml_writer.write("<POBOX>" + pobox + "</POBOX>\n");
 | 
				
			||||||
    if (ext_address!=null)
 | 
					    if (!StringUtil.isStringEmpty(ext_address))
 | 
				
			||||||
      xml_writer.write("<EXTADR>" + ext_address + "</EXTADR>\n");
 | 
					      xml_writer.write("<EXTADR>" + ext_address + "</EXTADR>\n");
 | 
				
			||||||
    if (street!=null)
 | 
					    if (!StringUtil.isStringEmpty(street))
 | 
				
			||||||
      xml_writer.write("<STREET>" + street + "</STREET>\n");
 | 
					      xml_writer.write("<STREET>" + street + "</STREET>\n");
 | 
				
			||||||
    if (locality!=null)
 | 
					    if (!StringUtil.isStringEmpty(locality))
 | 
				
			||||||
      xml_writer.write("<LOCALITY>" + locality + "</LOCALITY>\n");
 | 
					      xml_writer.write("<LOCALITY>" + locality + "</LOCALITY>\n");
 | 
				
			||||||
    if (region!=null)
 | 
					    if (!StringUtil.isStringEmpty(region))
 | 
				
			||||||
      xml_writer.write("<REGION>" + region + "</REGION>\n");
 | 
					      xml_writer.write("<REGION>" + region + "</REGION>\n");
 | 
				
			||||||
    if (postal_code!=null)
 | 
					    if (!StringUtil.isStringEmpty(postal_code))
 | 
				
			||||||
      xml_writer.write("<PCODE>" + postal_code + "</PCODE>\n");
 | 
					      xml_writer.write("<PCODE>" + postal_code + "</PCODE>\n");
 | 
				
			||||||
    if (country!=null)
 | 
					    if (!StringUtil.isStringEmpty(country))
 | 
				
			||||||
      xml_writer.write("<CTRY>" + country + "</CTRY>\n");
 | 
					      xml_writer.write("<CTRY>" + country + "</CTRY>\n");
 | 
				
			||||||
    xml_writer.write("</ADR>\n");
 | 
					    xml_writer.write("</ADR>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -98,7 +98,7 @@ public class VCardEmail
 | 
				
			|||||||
      xml_writer.write("<X400/>");
 | 
					      xml_writer.write("<X400/>");
 | 
				
			||||||
    if (preferred)
 | 
					    if (preferred)
 | 
				
			||||||
      xml_writer.write("<PREF/>");
 | 
					      xml_writer.write("<PREF/>");
 | 
				
			||||||
    if (address!=null)
 | 
					    if (!StringUtil.isStringEmpty(address))
 | 
				
			||||||
      xml_writer.write("<USERID>" + address + "</USERID>");
 | 
					      xml_writer.write("<USERID>" + address + "</USERID>");
 | 
				
			||||||
    xml_writer.write("</EMAIL>\n");
 | 
					    xml_writer.write("</EMAIL>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -137,7 +137,7 @@ public class VCardPhone
 | 
				
			|||||||
      xml_writer.write("<PCS/>");
 | 
					      xml_writer.write("<PCS/>");
 | 
				
			||||||
    if (preferred)
 | 
					    if (preferred)
 | 
				
			||||||
      xml_writer.write("<PREF/>");
 | 
					      xml_writer.write("<PREF/>");
 | 
				
			||||||
    if (number!=null)
 | 
					    if (!StringUtil.isStringEmpty(number))
 | 
				
			||||||
      xml_writer.write("<NUMBER>" + number + "</NUMBER>");
 | 
					      xml_writer.write("<NUMBER>" + number + "</NUMBER>");
 | 
				
			||||||
    xml_writer.write("</TEL>\n");
 | 
					    xml_writer.write("</TEL>\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,9 +9,9 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  The Original Code is the Venice Web Communities System.
 | 
					  The Original Code is the Venice Web Communities System.
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
					  The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
				
			||||||
  for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
					  for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
				
			||||||
  Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
					  Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Contributor(s): 
 | 
					  Contributor(s): 
 | 
				
			||||||
--%>
 | 
					--%>
 | 
				
			||||||
@ -28,6 +28,14 @@
 | 
				
			|||||||
<util:header title="Members of Community:">
 | 
					<util:header title="Members of Community:">
 | 
				
			||||||
  <util:subtitle><util:escape><comm:name/></util:escape></util:subtitle>
 | 
					  <util:subtitle><util:escape><comm:name/></util:escape></util:subtitle>
 | 
				
			||||||
</util:header>
 | 
					</util:header>
 | 
				
			||||||
 | 
					<% if (view.canExportMembers()) { %>
 | 
				
			||||||
 | 
					  <util:font color="content.fg" size="content">[
 | 
				
			||||||
 | 
					    <util:xlink>
 | 
				
			||||||
 | 
					      <util:href type="servlet">comm/member_export.js.vs?cc=<comm:ID/></util:href>
 | 
				
			||||||
 | 
					      <util:text>Export Member List</util:text>
 | 
				
			||||||
 | 
					    </util:xlink>
 | 
				
			||||||
 | 
					  ]</util:font><p>
 | 
				
			||||||
 | 
					<% } // end if %>
 | 
				
			||||||
<util:font color="content.fg" size="subhead"><B>Find members of community "<comm:name/>":</B></util:font><P>
 | 
					<util:font color="content.fg" size="subhead"><B>Find members of community "<comm:name/>":</B></util:font><P>
 | 
				
			||||||
<util:form action="comm/members.js.vs" type="servlet"><DIV CLASS="content">
 | 
					<util:form action="comm/members.js.vs" type="servlet"><DIV CLASS="content">
 | 
				
			||||||
  <INPUT TYPE="HIDDEN" NAME="cc" VALUE="<comm:ID/>">
 | 
					  <INPUT TYPE="HIDDEN" NAME="cc" VALUE="<comm:ID/>">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user