Return-Path: Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 16243 invoked by uid 1037); 4 Sep 2000 17:32:40 -0000 Date: 4 Sep 2000 17:32:40 -0000 Message-ID: <20000904173240.16233.qmail@locus.apache.org> From: balld@locus.apache.org To: xml-cocoon-cvs@apache.org Subject: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql esql.xsl balld 00/09/04 10:32:39 Modified: src/org/apache/cocoon/processor/xsp/library/sql esql.xsl Added: src/org/apache/cocoon/processor/xsp/library/calendar XSPCalendar.java calendar.xsl src/org/apache/cocoon/processor/xsp/library/mail mail.xsl Log: added calendar and mail logicsheets to the library don't know what i did to esql.xsl - i'll find out... Revision Changes Path 1.1 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/calendar/XSPCalendar.java Index: XSPCalendar.java =================================================================== /** ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) @year@ The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.processor.xsp.library.calendar; import org.w3c.dom.Document; import org.w3c.dom.Element; import java.util.Date; import java.util.Calendar; import java.text.SimpleDateFormat; import java.text.ParseException; /* * a class to generate xml calendar views * * @author Donald A. Ball Jr. * @version 1.0 */ public class XSPCalendar { public static SimpleDateFormat month_number_format = new SimpleDateFormat("M"); public static SimpleDateFormat month_name_format = new SimpleDateFormat("MMMM"); public static SimpleDateFormat month_format = new SimpleDateFormat("yyyy-MM"); /** Generates a calendar of the form:
  		 
  		  
  		   
  		   
  		   
  		   
  		   
  		   
  		   
  		  
  		  
  		   
  		   
  		   
  		   
  		   
  		   
  		   
  		  
  		  ...
  		 
  		
**/ public static Element generateMonth(Document document, String date_format, Date date) { SimpleDateFormat format = null; if (date_format != null) { format = new SimpleDateFormat(date_format); } Calendar calendar = Calendar.getInstance(); calendar.setTime(date); Element month_element = document.createElement("month"); month_element.setAttribute("number",month_number_format.format(date)); month_element.setAttribute("name",month_name_format.format(date)); month_element.setAttribute("year",""+calendar.get(Calendar.YEAR)); Element week_element = document.createElement("week"); int week_number = 1; week_element.setAttribute("number","1"); month_element.appendChild(week_element); calendar.set(Calendar.DAY_OF_MONTH,1); Calendar temp = (Calendar)calendar.clone(); while (temp.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { temp.add(Calendar.DATE,-1); week_element.appendChild(document.createElement("day")); } temp.setTime(calendar.getTime()); while (temp.get(Calendar.MONTH) == calendar.get(Calendar.MONTH)) { if (temp.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { week_number++; week_element = document.createElement("week"); week_element.setAttribute("number",""+week_number); month_element.appendChild(week_element); } Element day_element = document.createElement("day"); day_element.setAttribute("number",""+temp.get(Calendar.DAY_OF_MONTH)); day_element.setAttribute("string",""+format.format(temp.getTime())); week_element.appendChild(day_element); temp.add(Calendar.DATE,1); } while (temp.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { week_element.appendChild(document.createElement("day")); temp.add(Calendar.DATE,1); } return month_element; } public static Element generateMonth(Document document, String date_format, String date) throws ParseException { return generateMonth(document,date_format,month_format.parse(date)); } public static Element generateMonth(Document document, String date_format) { return generateMonth(document,date_format,new Date()); } } 1.1 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/calendar/calendar.xsl Index: calendar.xsl =================================================================== "" "" + + "" "" org.apache.cocoon.contrib.calendar.XSPCalendar { String format = String.valueOf(); String date = String.valueOf(); if (!"".equals(date)) { XSPCalendar.generateMonth(document,format,date) } else { XSPCalendar.generateMonth(document,format) } } 1.1 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/mail/mail.xsl Index: mail.xsl =================================================================== javax.mail.Session javax.mail.Store javax.mail.Folder javax.mail.Message javax.mail.internet.MimeMessage javax.mail.Address void _mail_process_content( HttpServletRequest request, HttpServletResponse response, Document document, Node xspParentNode, Node xspCurrentNode, Stack xspNodeStack, HttpSession session, MimePart part) throws Exception { if (part.isMimeType("text/plain")) { (String)part.getContent() } else if (part.isMimeType("message/rfc822")) { _mail_process_content(request,response,document,xspParentNode,xspCurrentNode,xspNodeStack,session,(Part)part.getContent()); } else if (part.isMimeType("multipart/*")) { Multipart multipart = (Multipart)part.getContent(); int count = multipart.getCount(); for (int i=0; i<count; i++) { _mail_process_content(request,response,document,xspParentNode,xspCurrentNode,xspNodeStack,session,multipart.getBodyPart(i)); } { Properties _mail_properties = new Properties(); Session _mail_session = Session.getDefaultInstance(_mail_properties,null); Store _mail_store = _mail_session.getStore(String.valueOf()); Store _mail_store = _mail_session.getStore(); Integer _mail_port = null; try { _mail_port = new Integer(String.valueOf()); } catch (Exception e) {} _mail_store.connect( String.valueOf(), _mail_port == null ? -1 : _mail_port.intValue(), String.valueOf(), String.valueOf()); Folder _mail_folder = _mail_store.getDefaultFolder(); _mail_folder = _mail_folder.getFolder(String.valueOf()); _mail_folder.open(Folder.READ_ONLY); _mail_folder.close(false); _mail_store.close(); } _mail_folder.getMessageCount() { MimeMessage _mail_message = (MimeMessage)_mail_folder.getMessage(); } _mail_message.getSubject() { Address _mail_from[] = _mail_message.getFrom(); for (int _mail_i=0; _mail_i < _mail_from.length; _mail_i++) {
_mail_from[_mail_i].toString()
} }
{ String _mail_type = ""; RecipientType _mail_recipient_type = null; if ("TO".equals(_mail_type)) { _mail_recipient_Type = RecipientType.TO; } else if ("CC".equals(_mail_type)) { _mail_recipient_Type = RecipientType.CC; } else if ("BCC".equals(_mail_type)) { _mail_recipient_Type = RecipientType.BCC; } Address _mail_to[]; if (null == _mail_recipient_type) { _mail_to = _mail_message.getAllRecipients(); } else { _mail_to = _mail_message.getRecipients(_mail_recipient_type); } for (int _mail_i=0; _mail_i < _mail_to.length; _mail_i++) {
_mail_to[_mail_i].toString()
} }
{ Enumeration _mail_enum = _mail_message.getAllHeaderLines(); while (_mail_enum.hasMoreElements()) {
(String)_mail_enum.nextElement()
} }
_mail_process_content(_mail_message); "" + + "" ""
1.7 +1 -1 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/esql.xsl Index: esql.xsl =================================================================== RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/esql.xsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- esql.xsl 2000/09/01 17:39:34 1.6 +++ esql.xsl 2000/09/04 17:32:37 1.7 @@ -2,7 +2,7 @@