Started deeper integration of GData: we now have a "Google Data" importing source, which lets you sign in and authorize access to your docs. It then lists all the spreadsheets you have access to. It does not yet let you import those spreadsheets.

Minor fixes to the open project action area; fixes to render relative dates properly.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2190 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2011-08-07 23:26:51 +00:00
parent c5078d1887
commit c42382f3ae
29 changed files with 1335 additions and 102 deletions

View File

@ -57,5 +57,13 @@
<classpathentry kind="lib" path="main/webapp/WEB-INF/lib/jsoup-1.4.1.jar"/> <classpathentry kind="lib" path="main/webapp/WEB-INF/lib/jsoup-1.4.1.jar"/>
<classpathentry kind="lib" path="main/tests/server/lib/mockito-all-1.8.4.jar"/> <classpathentry kind="lib" path="main/tests/server/lib/mockito-all-1.8.4.jar"/>
<classpathentry kind="lib" path="main/tests/server/lib/testng-5.12.1.jar"/> <classpathentry kind="lib" path="main/tests/server/lib/testng-5.12.1.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-docs-3.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-docs-meta-3.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-media-1.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-base-1.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-client-1.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-client-meta-1.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/gdata-spreadsheet-meta-3.0.jar"/>
<classpathentry kind="lib" path="extensions/gdata/module/MOD-INF/lib/mail.jar"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

View File

@ -0,0 +1,59 @@
Copyright © 1997-2011, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license
agreement containing restrictions on use and disclosure and are
protected by intellectual property laws. Except as expressly permitted
in your license agreement or allowed by law, you may not use, copy,
reproduce, translate, broadcast, modify, license, transmit, distribute,
exhibit, perform, publish, or display any part, in any form, or by any
means. Reverse engineering, disassembly, or decompilation of this
software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice
and is not warranted to be error-free. If you find any errors, please
report them to us in writing.
If this is software or related software documentation that is delivered
to the U.S. Government or anyone licensing it on behalf of the U.S.
Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related
documentation and technical data delivered to U.S. Government customers
are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and
agency-specific supplemental regulations. As such, the use,
duplication, disclosure, modification, and adaptation shall be subject
to the restrictions and license terms set forth in the applicable
Government contract, and, to the extent applicable by the terms of the
Government contract, the additional rights set forth in FAR 52.227-19,
Commercial Computer Software License (December 2007). Oracle America,
Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software or hardware is developed for general use in a variety of
information management applications. It is not developed or intended
for use in any inherently dangerous applications, including
applications which may create a risk of personal injury. If you use
this software or hardware in dangerous applications, then you shall be
responsible to take all appropriate fail-safe, backup, redundancy, and
other measures to ensure its safe use. Oracle Corporation and its
affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its
affiliates. Other names may be trademarks of their respective owners.
AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or
registered trademarks of Advanced Micro Devices. Intel and Intel Xeon
are trademarks or registered trademarks of Intel Corporation. All SPARC
trademarks are used under license and are trademarks or registered
trademarks of SPARC International, Inc. UNIX is a registered trademark
licensed through X/Open Company, Ltd.
This software or hardware and documentation may provide access to or
information on content, products, and services from third parties.
Oracle Corporation and its affiliates are not responsible for and
expressly disclaim all warranties of any kind with respect to
third-party content, products, and services. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or damages
incurred due to your access to or use of third-party content, products,
or services.

View File

@ -0,0 +1,337 @@
Oracle Corporation ("ORACLE") ENTITLEMENT for SOFTWARE
Licensee/Company: Entity receiving Software.
Effective Date: Date of delivery of the Software to You.
Software: JavaMail 1.4.4
License Term: Perpetual (subject to termination under the SLA).
Licensed Unit: Software Copy.
Licensed unit Count: Unlimited.
Permitted Uses:
1. You may reproduce and use the Software for Your own Individual,
Commercial and Research and Instructional Use only for the purposes of
designing, developing, testing, and running Your applets and
applications ("Programs").
2. Subject to the terms and conditions of this Agreement and
restrictions and exceptions set forth in the Software's documentation,
You may reproduce and distribute portions of Software identified as a
redistributable in the documentation (each a "Redistributable"),
provided that You comply with the following (note that You may be
entitled to reproduce and distribute other portions of the Software not
defined in the documentation as a Redistributable under certain other
licenses as described in the THIRDPARTYLICENSEREADME, if applicable):
(a) You distribute Redistributable complete and unmodified and only
bundled as part of Your Programs,
(b) Your Programs add significant and primary functionality to the
Redistributable,
(c) You distribute Redistributable for the sole purpose of running Your
Programs,
(d) You do not distribute additional software intended to replace any
component(s) of the Redistributable,
(e) You do not remove or alter any proprietary legends or notices
contained in or on the Redistributable.
(f) You only distribute the Redistributable subject to a license
agreement that protects Oracle's interests consistent with the terms
contained in this Agreement, and
(g) You agree to defend and indemnify Oracle and its licensors from and
against any damages, costs, liabilities, settlement amounts and/or
expenses (including attorneys' fees) incurred in connection with any
claim, lawsuit or action by any third party that arises or results from
the use or distribution of any and all Programs and/or
Redistributable.
3. Java Technology Restrictions. You may not create, modify, or change
the behavior of, or authorize Your licensees to create, modify, or
change the behavior of, classes, interfaces, or subpackages that are in
any way identified as "java", "javax", "sun" or similar convention as
specified by Oracle in any naming convention designation.
4. No Diagnostic, Maintenance, Repair or Technical Support Services.
The scope of Your license does not include any right, express or
implied, (i) to access, copy, distribute, display or use the Software
to provide diagnostic, maintenance, repair or technical support
services for Oracle software or Oracle hardware on behalf of any third party
for Your direct or indirect commercial gain or advantage, without Oracle's
prior written authorization, or (ii) for any third party to access,
copy, distribute, display or use the Software to provide diagnostic,
maintenance, repair or technical support services for Oracle software or
Oracle hardware on Your behalf for such party's direct or indirect
commercial gain or advantage, without Oracle's prior written
authorization. The limitations set forth in this paragraph apply to any
and all error corrections, patches, updates, and upgrades to the
Software You may receive, access, download or otherwise obtain from
Oracle.
5. Records and Documentation. During the term of the SLA and
Entitlement, and for a period of three (3) years thereafter, You agree
to keep proper records and documentation of Your compliance with the
SLA and Entitlement. Upon Oracle's reasonable request, You will provide
copies of such records and documentation to Oracle for the purpose of
confirming Your compliance with the terms and conditions of the SLA and
Entitlement. This section will survive any termination of the SLA and
Entitlement. You may terminate this SLA and Entitlement at any time by
destroying all copies of the Software in which case the obligations set
forth in Section 7 of the SLA shall apply.
Oracle Corporation ("ORACLE")
SOFTWARE LICENSE AGREEMENT
READ THE TERMS OF THIS AGREEMENT ("AGREEMENT") CAREFULLY BEFORE OPENING
SOFTWARE MEDIA PACKAGE. BY OPENING SOFTWARE MEDIA PACKAGE, YOU AGREE TO
THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCESSING SOFTWARE
ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING
THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT. IF YOU DO NOT AGREE
TO ALL OF THE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE
OF PURCHASE FOR A REFUND OR, IF SOFTWARE IS ACCESSED ELECTRONICALLY,
SELECT THE "DECLINE" (OR "EXIT") BUTTON AT THE END OF THIS AGREEMENT.
IF YOU HAVE SEPARATELY AGREED TO LICENSE TERMS ("MASTER TERMS") FOR
YOUR LICENSE TO THIS SOFTWARE, THEN SECTIONS 1-6 OF THIS AGREEMENT
("SUPPLEMENTAL LICENSE TERMS") SHALL SUPPLEMENT AND SUPERSEDE THE
MASTER TERMS IN RELATION TO THIS SOFTWARE.
1. Definitions.
(a) "Entitlement" means the collective set of applicable documents
authorized by Oracle evidencing your obligation to pay associated fees (if
any) for the license, associated Services, and the authorized scope of
use of Software under this Agreement.
(b) "Licensed Unit" means the unit of measure by which your use of
Software and/or Service is licensed, as described in your Entitlement.
(c) "Permitted Use" means the licensed Software use(s) authorized
in this Agreement as specified in your Entitlement. The Permitted Use
for any bundled Oracle software not specified in your Entitlement will be
evaluation use as provided in Section 3.
(d) "Service" means the service(s) that Oracle or its delegate will
provide, if any, as selected in your Entitlement and as further
described in the applicable service listings at
www.sun.com/service/servicelist.
(e) "Software" means the Oracle software described in your
Entitlement. Also, certain software may be included for evaluation use
under Section 3.
(f) "You" and "Your" means the individual or legal entity specified
in the Entitlement, or for evaluation purposes, the entity performing
the evaluation.
2. License Grant and Entitlement.
Subject to the terms of your Entitlement, Oracle grants you a
nonexclusive, nontransferable limited license to use Software for its
Permitted Use for the license term. Your Entitlement will specify (a)
Software licensed, (b) the Permitted Use, (c) the license term, and (d)
the Licensed Units.
Additionally, if your Entitlement includes Services, then it will also
specify the (e) Service and (f) service term.
If your rights to Software or Services are limited in duration and the
date such rights begin is other than the purchase date, your
Entitlement will provide that beginning date(s).
The Entitlement may be delivered to you in various ways depending on
the manner in which you obtain Software and Services, for example, the
Entitlement may be provided in your receipt, invoice or your contract
with Oracle or authorized Oracle reseller. It may also be in electronic
format if you download Software.
3. Permitted Use.
As selected in your Entitlement, one or more of the following Permitted
Uses will apply to your use of Software. Unless you have an Entitlement
that expressly permits it, you may not use Software for any of the
other Permitted Uses. If you don't have an Entitlement, or if your
Entitlement doesn't cover additional software delivered to you, then
such software is for your Evaluation Use.
(a) Evaluation Use. You may evaluate Software internally for a period
of 90 days from your first use.
(b) Research and Instructional Use. You may use Software internally to
design, develop and test, and also to provide instruction on such
uses.
(c) Individual Use. You may use Software internally for personal,
individual use.
(d) Commercial Use. You may use Software internally for your own
commercial purposes.
(e) Service Provider Use. You may make Software functionality
accessible (but not by providing Software itself or through outsourcing
services) to your end users in an extranet deployment, but not to your
affiliated companies or to government agencies.
4. Licensed Units.
Your Permitted Use is limited to the number of Licensed Units stated in
your Entitlement. If you require additional Licensed Units, you will
need additional Entitlement(s).
5. Restrictions.
(a) The copies of Software provided to you under this Agreement are
licensed, not sold, to you by Oracle. Oracle reserves all rights not
expressly granted. (b) You may make a single archival copy of Software,
but otherwise may not copy, modify, or distribute Software. However if
the Oracle documentation accompanying Software lists specific portions of
Software, such as header files, class libraries, reference source code,
and/or redistributable files, that may be handled differently, you may
do so only as provided in the Oracle documentation. (c) You may not rent,
lease, lend or encumber Software. (d) Unless enforcement is prohibited
by applicable law, you may not decompile, or reverse engineer Software.
(e) The terms and conditions of this Agreement will apply to any
Software updates, provided to you at Oracle's discretion, that replace
and/or supplement the original Software, unless such update contains a
separate license. (f) You may not publish or provide the results of any
benchmark or comparison tests run on Software to any third party
without the prior written consent of Oracle. (g) Software is confidential
and copyrighted. (h) Unless otherwise specified, if Software is
delivered with embedded or bundled software that enables functionality
of Software, you may not use such software on a stand-alone basis or
use any portion of such software to interoperate with any program(s)
other than Software. (i) Software may contain programs that perform
automated collection of system data and/or automated software updating
services. System data collected through such programs may be used by
Oracle, its subcontractors, and its service delivery partners for the
purpose of providing you with remote system services and/or improving
Oracle's software and systems. (j) Software is not designed, licensed or
intended for use in the design, construction, operation or maintenance
of any nuclear facility and Oracle and its licensors disclaim any express
or implied warranty of fitness for such uses. (k) No right, title or
interest in or to any trademark, service mark, logo or trade name of
Oracle or its licensors is granted under this Agreement.
6. Java Compatibility and Open Source.
Software may contain Java technology. You may not create additional
classes to, or modifications of, the Java technology, except under
compatibility requirements available under a separate agreement
available at www.java.net.
Oracle supports and benefits from the global community of open source
developers, and thanks the community for its important contributions
and open standards-based technology, which Oracle has adopted into many of
its products.
Please note that portions of Software may be provided with notices and
open source licenses from such communities and third parties that
govern the use of those portions, and any licenses granted hereunder do
not alter any rights and obligations you may have under such open
source licenses, however, the disclaimer of warranty and limitation of
liability provisions in this Agreement will apply to all Software in
this distribution.
7. Term and Termination.
The license and service term are set forth in your Entitlement(s). Your
rights under this Agreement will terminate immediately without notice
from Oracle if you materially breach it or take any action in derogation
of Oracle's and/or its licensors' rights to Software. Oracle may terminate
this Agreement should any Software become, or in Oracle's reasonable
opinion likely to become, the subject of a claim of intellectual
property infringement or trade secret misappropriation. Upon
termination, you will cease use of, and destroy, Software and confirm
compliance in writing to Oracle. Sections 1, 5, 6, 7, and 9-15 will
survive termination of the Agreement.
8. Limited Warranty.
Oracle warrants to you that for a period of 90 days from the date of
purchase, as evidenced by a copy of the receipt, the media on which
Software is furnished (if any) will be free of defects in materials and
workmanship under normal use. Except for the foregoing, Software is
provided "AS IS". Your exclusive remedy and Oracle's entire liability
under this limited warranty will be at Oracle's option to replace Software
media or refund the fee paid for Software. Some states do not allow
limitations on certain implied warranties, so the above may not apply
to you. This limited warranty gives you specific legal rights. You may
have others, which vary from state to state.
9. Disclaimer of Warranty.
UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS,
REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT
ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO
BE LEGALLY INVALID.
10. Limitation of Liability.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ORACLE OR ITS
LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES,
HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR
RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF ORACLE HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Oracle's
liability to you, whether in contract, tort (including negligence), or
otherwise, exceed the amount paid by you for Software under this
Agreement. The foregoing limitations will apply even if the above
stated warranty fails of its essential purpose. Some states do not
allow the exclusion of incidental or consequential damages, so some of
the terms above may not be applicable to you.
11. Export Regulations.
All Software, documents, technical data, and any other materials
delivered under this Agreement are subject to U.S. export control laws
and may be subject to export or import regulations in other countries.
You agree to comply strictly with these laws and regulations and
acknowledge that you have the responsibility to obtain any licenses to
export, re-export, or import as may be required after delivery to you.
12. U.S. Government Restricted Rights.
If Software is being acquired by or on behalf of the U.S. Government or
by a U.S. Government prime contractor or subcontractor (at any tier),
then the Government's rights in Software and accompanying documentation
will be only as set forth in this Agreement; this is in accordance with
48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD)
acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD
acquisitions).
13. Governing Law.
Any action related to this Agreement will be governed by California law
and controlling U.S. federal law. No choice of law rules of any
jurisdiction will apply.
14. Severability.
If any provision of this Agreement is held to be unenforceable, this
Agreement will remain in effect with the provision omitted, unless
omission would frustrate the intent of the parties, in which case this
Agreement will immediately terminate.
15. Integration.
This Agreement, including any terms contained in your Entitlement, is
the entire agreement between you and Oracle relating to its subject
matter. It supersedes all prior or contemporaneous oral or written
communications, proposals, representations and warranties and prevails
over any conflicting or additional terms of any quote, order,
acknowledgment, or other communication between the parties relating to
its subject matter during the term of this Agreement. No modification
of this Agreement will be binding, unless in writing and signed by an
authorized representative of each party.
For inquiries please contact: Oracle Corporation, 500 Oracle Parkway,
Redwood Shores, California 94065, USA.

View File

@ -0,0 +1,250 @@
README
======
JavaMail(TM) API 1.4.4 release
------------------------------
Welcome to the JavaMail API 1.4.4 release! This release includes
versions of the JavaMail API implementation, IMAP, SMTP, and POP3
service providers, some examples, and documentation for the JavaMail
API.
Please see the FAQ at http://www.oracle.com/technetwork/java/javamail/faq/
JDK Version notes
-----------------
The JavaMail API supports JDK 1.4 or higher. Note that we have
currently tested this implementation with JDK 1.4, 1.5, and 1.6.
While JavaMail will work with JAF 1.0.2, we recommend the use of JAF 1.1
or newer. JAF 1.1.1 is currently the newest version. Note that JAF 1.1
is included in JDK 1.6 and JAF 1.1.1 is included in JDK 1.6.0_10 and
later.
Protocols supported
-------------------
This release supports the following Internet standard mail protocols:
IMAP - a message Store protocol, for reading messages from a server
POP3 - a message Store protocol, for reading messages from a server
SMTP - a message Transport protocol, for sending messages to a server
The following table lists the names of the supported protocols (as used
in the JavaMail API) and their capabilities:
Protocol Store or Uses Supports
Name Transport? SSL? STARTTLS?
-------------------------------------------------
imap Store No Yes
imaps Store Yes Yes
pop3 Store No No
pop3s Store Yes No
smtp Transport No Yes
smtps Transport Yes Yes
See our web page at http://www.oracle.com/technetwork/java/javamail/
for the latest information on third party protocol providers.
Contents
--------
Included in this release are the following:
README.txt this file
LICENSE.txt Software license
NOTES.txt Notes, issues and known bugs
SSLNOTES.txt Notes on using SSL/TLS with JavaMail
CHANGES.txt Changes since the previous release
COMPAT.txt Important notes about compatibility
mail.jar The JavaMail API and all service providers,
most users need *only* this jar file
lib/mailapi.jar The JavaMail API with no service providers
lib/imap.jar The IMAP service provider
lib/smtp.jar The SMTP service provider
lib/pop3.jar The POP3 service provider
lib/dsn.jar multipart/report DSN message support
docs/JavaMail-1.1-changes.txt
Description of the new APIs that were added in
JavaMail API 1.1
docs/JavaMail-1.2-changes.txt
Description of the new APIs that were added in
JavaMail API 1.2
docs/JavaMail-1.3-changes.txt
Description of the new APIs that were added in
JavaMail API 1.3
docs/JavaMail-1.4-changes.txt
Description of the new APIs that were added in
JavaMail API 1.4
docs/JavaMail-1.2.ps
Postscript version of the JavaMail API 1.2 specification
docs/JavaMail-1.2.pdf
PDF version of the JavaMail API 1.2 specification
docs/Providers.ps
Postscript version of the JavaMail Service Provider
guide.
docs/Providers.pdf
PDF version of the JavaMail Service Provider guide.
docs/javadocs/ The JavaMail API javadocs
demo/README.txt Instructions for running the demo programs
demo/CRLFOutputStream.java
demo OutputStream filter to convert all line terminators
to CRLF
demo/NewlineOutputStream.java
demo OutputStream filter to convert all line terminators
to platform's line terminator
demo/copier.java demo program to copy mail between folders
demo/folderlist.java demo program to list subfolders
demo/monitor.java demo program to monitor for new mail
demo/mover.java demo program to move mail between folders
demo/msgmultisendsample.java
demo program to send a sample multipart message
demo/msgsend.java demo program to send a single part text message
to a specified recipient (ala /bin/mail)
demo/msgsendsample.java
demo program to send a sample single part text message
demo/msgshow.java demo program to read messages from an IMAP store
demo/namespace.java demo program that illustrates use of namespace APIs
demo/populate.java demo program that copies entire folder hierarchies
demo/registry.java demo program that illustrates the registry
demo/search.java demo program to search folders
demo/sendfile.java demo program to send a file as an attachment
demo/sendhtml.java demo program to send html mail
demo/smtpsend.java demo program to illustrate handling SMTP error codes
demo/transport.java demo program to illustrate use of Transport
demo/uidmsgshow.java
demo program to read messages from an IMAP store
demo/client/ source files for cool demo program that implements
a simple mail reader. (Uses Swing)
demo/client/README.txt
README file for running the simple mail-reader demo
demo/servlet/ source for a simple servlet that allows using a
web browser to read and send mail
demo/servlet/README.txt
README file that describes the JavaMailServlet
demo/logging/ source files for demo program showing use of the
com.sun.mail.util.logging.MailHandler class
demo/outlook/ source files for demo classes showing how to handle
old non-MIME messages generated by Outlook
Requirements
------------
Note that the JavaMail API requires the JavaBeans(TM) Activation
Framework package to be installed as well if you're using JDK 1.5
or earlier. Download the latest version of the JavaBeans Activation
Framework from
http://www.oracle.com/technetwork/java/javase/index-jsp-136939.html
and install it in a suitable location.
Installation
------------
UNIX/Linux
----------
1. Unzip the javamail1_4_4.zip archive.
(You may have already done this.)
2. Set your CLASSPATH to include the "mail.jar" file obtained from
the download, as well as the current directory.
Assuming you unzipped javamail1_4_4.zip in /u/me/download/ the
following would work:
export CLASSPATH=$CLASSPATH:/u/me/download/javamail-1.4.4/mail.jar:.
Also, if you're using JDK 1.5 or earlier, include the
"activation.jar" file that you obtained from downloading the
JavaBeans Activation Framework, in your CLASSPATH. For example:
export CLASSPATH=$CLASSPATH:/u/me/download/activation/activation.jar
3. Go to the demo directory
4. Compile any demo using your Java compiler. For example:
javac msgshow.java
5. Run the demo. The '-' option lists the required and optional
command-line options to successfully run any demo. For example:
java msgshow -
lists the available options. And
java msgshow -T imap -H <mailserver> -U <username> -P <passwd> -f INBOX 5
uses the IMAP protocol to display message number 5 from your INBOX.
(Additional instructions on how to run the simple mail reader demo
and servlet demo are provided in demo/client/README.txt and
demo/servlet/README.txt, respectively.)
Windows
-------
1. Unzip the javamail1_4_4.zip archive.
(You may have already done this.)
2. Set your CLASSPATH to include the "mail.jar" file obtained from
the download, as well as the current directory.
Assuming you unzipped javamail1_4_4.zip in c:\download the
following would work:
set CLASSPATH=%CLASSPATH%;c:\download\javamail-1.4.4\mail.jar;.
Also, if you're using JDK 1.5 or earlier, include the
"activation.jar" file that you obtained from downloading the
JavaBeans Activation Framework, in your CLASSPATH.
set CLASSPATH=%CLASSPATH%;c:\download\activation\activation.jar
3. Go to the demo directory
4. Compile any demo using your Java compiler. For example:
javac msgshow.java
5. Run the demo. The '-' option lists the required and optional
command-line options to successfully run any demo. For example:
java msgshow -
lists the available options. And
java msgshow -T imap -H <mailserver> -U <username> -P <passwd> -f INBOX 5
uses the IMAP protocol to display message number 5 from your INBOX.
(Additional instructions on how to run the simple mail reader demo
and servlet demo are provided in demo/client/README.txt and
demo/servlet/README.txt, respectively.)
Problems?
---------
The JavaMail FAQ at http://www.oracle.com/technetwork/java/javamail/faq/
includes information on protocols supported, installation problems,
debugging tips, etc.
See the NOTES.txt file for information on how to report bugs.
Enjoy!
The JavaMail API Team

View File

@ -34,6 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var html = "text/html"; var html = "text/html";
var encoding = "UTF-8"; var encoding = "UTF-8";
var version = "0.2"; var version = "0.2";
var ClientSideResourceManager = Packages.com.google.refine.ClientSideResourceManager;
/* /*
* Function invoked to initialize the extension. * Function invoked to initialize the extension.
@ -55,28 +56,32 @@ function init() {
IM.registerUrlRewriter(new Packages.com.google.refine.extension.gdata.GDataUrlRewriter()) IM.registerUrlRewriter(new Packages.com.google.refine.extension.gdata.GDataUrlRewriter())
IM.registerUrlRewriter(new Packages.com.google.refine.extension.gdata.FusionTablesUrlRewriter()) IM.registerUrlRewriter(new Packages.com.google.refine.extension.gdata.FusionTablesUrlRewriter())
IM.registerController(
module,
"gdata-importing-controller",
new Packages.com.google.refine.extension.gdata.GDataImportingController()
);
//Packages.com.google.refine.exporters.ExporterRegistry.registerExporter( //Packages.com.google.refine.exporters.ExporterRegistry.registerExporter(
//"gdata-exporter", new Packages.com.google.refine.extension.gdata.GDataExporter()); //"gdata-exporter", new Packages.com.google.refine.extension.gdata.GDataExporter());
// Script files to inject into /project page // Script files to inject into /index page
var ClientSideResourceManager = Packages.com.google.refine.ClientSideResourceManager;
ClientSideResourceManager.addPaths( ClientSideResourceManager.addPaths(
"project/scripts", "index/scripts",
module, module,
[ [
"scripts/project-injection.js" "scripts/index/importing-controller.js"
] ]
); );
// Style files to inject into /index page
// Style files to inject into /project page
ClientSideResourceManager.addPaths( ClientSideResourceManager.addPaths(
"project/styles", "index/styles",
module, module,
[ [
"styles/project-injection.less" "styles/importing-controller.less"
] ]
); );
} }
/* /*
@ -84,12 +89,26 @@ function init() {
*/ */
function process(path, request, response) { function process(path, request, response) {
// Analyze path and handle this request yourself. // Analyze path and handle this request yourself.
if (path == "authorized") {
if (path == "/" || path == "") {
var context = {}; var context = {};
// here's how to pass things into the .vt templates var params = new Packages.java.util.Properties();
context.version = version; context.params = params;
send(request, response, "index.vt", context);
var queryString = request.getQueryString();
if (queryString != null) {
var AuthSubUtil = Packages.com.google.gdata.client.http.AuthSubUtil;
// FIXME(SM): can we safely assume UTF-8 encoding here?
var onetimeUseToken = AuthSubUtil.getTokenFromReply(
Packages.java.net.URLDecoder.decode(queryString,"UTF-8"));
var sessionToken = AuthSubUtil.exchangeForSessionToken(onetimeUseToken, null);
Packages.com.google.refine.extension.gdata.TokenCookie.setToken(request, response, sessionToken);
} else {
Packages.com.google.refine.extension.gdata.TokenCookie.deleteToken(request, response);
}
send(request, response, "authorized.vt", context);
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,61 @@
<!doctype html>
<!--
Copyright 2011, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS 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 COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 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.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Google Refine</title>
</head>
<body>
Closing...
<script>
(function() {
var url = document.location.href;
var slash = url.indexOf('/', url.indexOf('//') + 2);
var origin = url.substring(0, slash);
var pairs = document.cookie.split(';');
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].replace(/^\s+/, '').replace(/\s+$/, '').split('=');
if (pair[0] == 'authsub_token' && pair[1].length > 0) {
window.opener.postMessage('gdata:' + pair.join('='), origin);
return;
}
}
window.opener.postMessage('gdata:authsub_token=', origin);
})();
window.setTimeout(function() { window.close(); }, 100);
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<div>
<div bind="signinPage" class="gdata-page">
<p>Please <button class="gdata-signin button button-primary">sign in and authorize</button>
access to your Google data.</p>
</div>
<div bind="progressPage" class="gdata-page">
<p><img src="images/large-spinner.gif" /> Retrieving Google Docs documents ...</p>
</div>
<div bind="listingPage" class="gdata-page grid-layout layout-full layout-normal"><table>
<tr>
<td>Google Docs documents</td>
<td style="text-align: right;"><button class="gdata-signin button">re-sign in</button> with another account</td>
</tr>
<tr><td colspan="2"><div bind="listingContainer" class="grid-layout layout-tight"></div></td></tr>
</table></div>
</div>

View File

@ -0,0 +1,179 @@
/*
Copyright 2011, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS 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 COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 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.
*/
Refine.GDataImportingController = function(createProjectUI) {
this._createProjectUI = createProjectUI;
createProjectUI.addSourceSelectionUI({
label: "Google Data",
id: "gdata-source",
ui: new Refine.GDataSourceUI(this)
});
};
Refine.CreateProjectUI.controllers.push(Refine.GDataImportingController);
Refine.GDataSourceUI = function(controller) {
this._controller = controller;
var self = this;
window.addEventListener(
"message",
function(evt) {
var url = document.location.href;
var slash = url.indexOf('/', url.indexOf('//') + 2);
var origin = url.substring(0, slash);
if (origin == evt.origin) {
var prefix = 'gdata:authsub_token=';
if (evt.data.startsWith(prefix) && evt.data.length > prefix.length) {
self._listDocuments();
} else {
this._body.find('.gdata-page').hide();
this._elmts.signinPage.show();
}
}
},
false);
};
Refine.GDataSourceUI.prototype.attachUI = function(body) {
this._body = body;
this._body.html(DOM.loadHTML("gdata", "scripts/index/import-from-gdata-form.html"));
this._elmts = DOM.bind(this._body);
this._body.find('.gdata-page').hide();
this._elmts.signinPage.show();
this._body.find('.gdata-signin.button').click(function() {
window.open(
"/command/gdata/authorize",
"google-refine-gdata-signin",
"resizable=1,width=600,height=450"
);
});
};
Refine.GDataSourceUI.prototype.focus = function() {
};
Refine.GDataSourceUI.prototype._listDocuments = function() {
this._body.find('.gdata-page').hide();
this._elmts.progressPage.show();
var self = this;
$.post(
"/command/core/importing-controller?" + $.param({
"controller": "gdata/gdata-importing-controller",
"subCommand": "list-documents"
}),
null,
function(o) {
self._renderDocuments(o);
},
"json"
);
};
Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
this._elmts.listingContainer.empty();
var table = $(
'<table><tr>' +
'<th></th>' + // starred
'<th>Title</th>' +
'<th>Authors</th>' +
'<th>Last Edited</th>' +
'<th>Last Viewed</th>' +
'</tr></table>'
).appendTo(this._elmts.listingContainer)[0];
var renderDocument = function(doc) {
var tr = table.insertRow(table.rows.length);
var td = tr.insertCell(tr.cells.length);
if (doc.isStarred) {
$('<img>').attr('src', 'images/star.png').appendTo(td);
}
td = tr.insertCell(tr.cells.length);
var title = $('<a>')
.addClass('gdata-doc-title')
.attr('href', 'javascript:{}')
.text(doc.title)
.appendTo(td);
$('<a>')
.addClass('gdata-doc-preview')
.attr('href', doc.docLink)
.attr('target', '_blank')
.text('preview')
.appendTo(td);
td = tr.insertCell(tr.cells.length);
$('<span>')
.text(doc.authors.join(', '))
.appendTo(td);
td = tr.insertCell(tr.cells.length);
$('<span>')
.addClass('gdata-doc-date')
.text(formatRelativeDate(doc.edited))
.attr('title', doc.edited)
.appendTo(td);
var alreadyViewed = false;
td = tr.insertCell(tr.cells.length);
if (doc.lastViewed) {
if (new Date(doc.lastViewed).getTime() - new Date(doc.edited).getTime() > -60000) {
alreadyViewed = true;
}
$('<span>')
.addClass('gdata-doc-date')
.text(formatRelativeDate(doc.lastViewed))
.attr('title', doc.lastViewed)
.appendTo(td);
}
if (!alreadyViewed) {
title.addClass('gdata-doc-unread');
}
};
for (var i = 0; i < o.documents.length; i++) {
renderDocument(o.documents[i]);
}
this._body.find('.gdata-page').hide();
this._elmts.listingPage.show();
};

View File

@ -0,0 +1,66 @@
/*
Copyright 2011, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS 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 COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 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.
*/
@import-less url("theme.less");
.gdata-extension-signin-iframe {
border: 1px solid #aaa;
width: 100%;
height: 500px;
}
a.gdata-doc-title {
color: @link_primary;
text-decoration: none;
}
a.gdata-doc-title:hover {
text-decoration: underline;
}
a.gdata-doc-title.gdata-doc-unread {
font-weight: bold;
}
a.gdata-doc-preview {
font-size: 80%;
text-decoration: none;
vertical-align: super;
color: @link_secondary;
margin-left: 0.5em;
}
a.gdata-doc-preview:hover {
text-decoration: underline;
}
.gdata-doc-date {
color: @metadata_grey;
}

View File

@ -0,0 +1,34 @@
/*
Copyright 2011, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS 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 COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 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.
*/
@import-less url("../../../../main/webapp/modules/core/styles/theme.less");

View File

@ -1,6 +1,7 @@
package com.google.refine.extension.gdata; package com.google.refine.extension.gdata;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -20,10 +21,21 @@ public class AuthorizeCommand extends Command {
public void doGet(HttpServletRequest request, HttpServletResponse response) public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
String requestUrl = AuthSubUtil.getRequestUrl(request.getRequestURL() char[] mountPointChars = this.servlet.getModule("gdata")
+ "2", // execution continues at authorize2 on redirect .getMountPoint().getMountPoint().toCharArray();
// Scope must be http, not https
"http://spreadsheets.google.com/feeds", false, true); StringBuffer sb = new StringBuffer();
sb.append(mountPointChars, 0, mountPointChars.length);
sb.append("authorized");
URL thisUrl = new URL(request.getRequestURL().toString());
URL authorizedUrl = new URL(thisUrl, sb.toString());
String requestUrl = AuthSubUtil.getRequestUrl(
authorizedUrl.toExternalForm(), // execution continues at authorized on redirect
"http://docs.google.com/feeds", // Scope must be http, not https
false,
true);
response.sendRedirect(requestUrl); response.sendRedirect(requestUrl);
} }

View File

@ -0,0 +1,163 @@
/*
Copyright 2011, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS 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 COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 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.
*/
package com.google.refine.extension.gdata;
import java.io.IOException;
import java.io.Writer;
import java.net.URL;
import java.util.Properties;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONWriter;
import com.google.gdata.client.DocumentQuery;
import com.google.gdata.client.Query;
import com.google.gdata.client.docs.DocsService;
import com.google.gdata.data.Category;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.docs.DocumentListEntry;
import com.google.gdata.data.docs.DocumentListFeed;
import com.google.gdata.util.ServiceException;
import com.google.refine.RefineServlet;
import com.google.refine.commands.HttpUtilities;
import com.google.refine.importing.ImportingController;
import com.google.refine.util.ParsingUtilities;
public class GDataImportingController implements ImportingController {
protected RefineServlet servlet;
@Override
public void init(RefineServlet servlet) {
this.servlet = servlet;
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Properties parameters = ParsingUtilities.parseUrlParameters(request);
String subCommand = parameters.getProperty("subCommand");
if ("list-documents".equals(subCommand)) {
doListDocuments(request, response, parameters);
} else {
HttpUtilities.respond(response, "error", "No such sub command");
}
}
private void doListDocuments(HttpServletRequest request, HttpServletResponse response, Properties parameters)
throws ServletException, IOException {
String token = TokenCookie.getToken(request);
if (token == null) {
HttpUtilities.respond(response, "error", "Not authorized");
return;
}
Writer w = response.getWriter();
JSONWriter writer = new JSONWriter(w);
try {
writer.object();
writer.key("documents");
writer.array();
try {
DocsService service = getDocsService(token);
DocumentQuery query = new DocumentQuery(
new URL("https://docs.google.com/feeds/default/private/full"));
query.addCategoryFilter(new Query.CategoryFilter(new Category(
"http://schemas.google.com/g/2005#kind",
"http://schemas.google.com/docs/2007#spreadsheet")));
query.setMaxResults(100);
DocumentListFeed feed = service.getFeed(query, DocumentListFeed.class);
for (DocumentListEntry entry : feed.getEntries()) {
writer.object();
writer.key("docId"); writer.value(entry.getDocId());
writer.key("docLink"); writer.value(entry.getDocumentLink().getHref());
writer.key("title"); writer.value(entry.getTitle().getPlainText());
writer.key("isViewed"); writer.value(entry.isViewed());
writer.key("isStarred"); writer.value(entry.isStarred());
DateTime edited = entry.getEdited();
if (edited != null) {
writer.key("edited"); writer.value(edited.toStringRfc822());
}
DateTime lastViewed = entry.getLastViewed();
if (lastViewed != null) {
writer.key("lastViewed"); writer.value(lastViewed.toStringRfc822());
}
writer.key("authors"); writer.array();
for (Person person : entry.getAuthors()) {
writer.value(person.getName());
}
writer.endArray();
writer.endObject();
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
writer.endArray();
writer.endObject();
} catch (JSONException e) {
throw new ServletException(e);
} finally {
w.flush();
w.close();
}
}
private DocsService getDocsService(String token) {
DocsService service = new DocsService(GDataExtension.SERVICE_APP_NAME);
service.setAuthSubToken(token);
return service;
}
}

View File

@ -145,9 +145,13 @@ $(function() {
.css("margin-top", rightPanelBodyVPaddings + "px") .css("margin-top", rightPanelBodyVPaddings + "px")
.css("width", ($('#right-panel').width() - rightPanelBodyHPaddings) + "px") .css("width", ($('#right-panel').width() - rightPanelBodyHPaddings) + "px")
.css("height", ($('#right-panel').height() - rightPanelBodyVPaddings) + "px"); .css("height", ($('#right-panel').height() - rightPanelBodyVPaddings) + "px");
for (var i = 0; i < Refine.actionAreas.length; i++) {
Refine.actionAreas[i].ui.resize();
}
}; };
$(window).bind("resize", resize); $(window).bind("resize", resize);
window.setTimeout(resize, 50); // for Chrome, give the window some time to layout first window.setTimeout(resize, 100); // for Chrome, give the window some time to layout first
var renderActionArea = function(actionArea) { var renderActionArea = function(actionArea) {
actionArea.bodyElmt = $('<div>') actionArea.bodyElmt = $('<div>')

View File

@ -3,8 +3,8 @@
<td colspan="2" id="create-project-ui-source-selection-message"> <td colspan="2" id="create-project-ui-source-selection-message">
<h3>Create a project by importing data. What kinds of data files can I import?</h3> <h3>Create a project by importing data. What kinds of data files can I import?</h3>
<div>TSV, CSV, *SV, Excel (.xls and .xlsx), JSON, XML, RDF as XML, and <div>TSV, CSV, *SV, Excel (.xls and .xlsx), JSON, XML, RDF as XML, and
Google Spreadsheets are all supported. Support for other formats can Google Data documents are all supported. Support for other formats can
be added with Refine extensions. be added with Google Refine extensions.
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -39,6 +39,10 @@ Refine.CreateProjectUI = function(elmt) {
this._customPanels = []; this._customPanels = [];
this._controllers = []; this._controllers = [];
this._sourceSelectionElmt =
$(DOM.loadHTML("core", "scripts/index/create-project-ui-source-selection.html")).appendTo(this._elmt);
this._sourceSelectionElmts = DOM.bind(this._sourceSelectionElmt);
$.post( $.post(
"/command/core/get-importing-configuration", "/command/core/get-importing-configuration",
null, null,
@ -52,12 +56,17 @@ Refine.CreateProjectUI = function(elmt) {
Refine.CreateProjectUI.controllers = []; Refine.CreateProjectUI.controllers = [];
Refine.CreateProjectUI.prototype.resize = function() {
var totalHeight = this._elmt.height();
var tabBodyContainer = $('#create-project-ui-source-selection-tab-bodies');
var selectedTabBody = $('.create-project-ui-source-selection-tab-body.selected');
var top = tabBodyContainer.position().top;
var tabBodyHeight = totalHeight - top - DOM.getVPaddings(selectedTabBody);
$('.create-project-ui-source-selection-tab-body').css('height', tabBodyHeight + 'px');
};
Refine.CreateProjectUI.prototype._initializeUI = function() { Refine.CreateProjectUI.prototype._initializeUI = function() {
this._sourceSelectionElmt =
$(DOM.loadHTML("core", "scripts/index/create-project-ui-source-selection.html")).appendTo(this._elmt);
this._sourceSelectionElmts = DOM.bind(this._sourceSelectionElmt);
for (var i = 0; i < Refine.CreateProjectUI.controllers.length; i++) { for (var i = 0; i < Refine.CreateProjectUI.controllers.length; i++) {
this._controllers.push(new Refine.CreateProjectUI.controllers[i](this)); this._controllers.push(new Refine.CreateProjectUI.controllers[i](this));
} }
@ -93,10 +102,10 @@ Refine.CreateProjectUI.prototype.selectImportSource = function(id) {
for (var i = 0; i < this._sourceSelectionUIs.length; i++) { for (var i = 0; i < this._sourceSelectionUIs.length; i++) {
var sourceSelectionUI = this._sourceSelectionUIs[i]; var sourceSelectionUI = this._sourceSelectionUIs[i];
if (sourceSelectionUI.id == id) { if (sourceSelectionUI.id == id) {
$('.create-project-ui-source-selection-tab-body').hide(); $('.create-project-ui-source-selection-tab-body').removeClass('selected').hide();
$('.create-project-ui-source-selection-tab').removeClass('selected'); $('.create-project-ui-source-selection-tab').removeClass('selected');
sourceSelectionUI._divBody.show(); sourceSelectionUI._divBody.addClass('selected').show();
sourceSelectionUI._divHeader.addClass('selected'); sourceSelectionUI._divHeader.addClass('selected');
sourceSelectionUI.ui.focus(); sourceSelectionUI.ui.focus();

View File

@ -88,7 +88,7 @@ Refine.DefaultImportingController.prototype._prepareParsingPanel = function() {
}); });
this._parsingPanelElmts.progressPanel.hide(); this._parsingPanelElmts.progressPanel.hide();
this._parsingPanelResizer = function() {console.log("here"); this._parsingPanelResizer = function() {
var elmts = self._parsingPanelElmts; var elmts = self._parsingPanelElmts;
var width = self._parsingPanel.width(); var width = self._parsingPanel.width();
var height = self._parsingPanel.height(); var height = self._parsingPanel.height();

View File

@ -43,3 +43,7 @@ Refine.actionAreas.push({
label: "Import Project", label: "Import Project",
uiClass: Refine.ImportProjectUI uiClass: Refine.ImportProjectUI
}); });
Refine.ImportProjectUI.prototype.resize = function() {
};

View File

@ -39,19 +39,6 @@ Refine.OpenProjectUI = function(elmt) {
this._elmt = elmt; this._elmt = elmt;
this._elmts = DOM.bind(elmt); this._elmts = DOM.bind(elmt);
var resize = function() {
var height = elmt.height();
var width = elmt.width();
var controlsHeight = self._elmts.workspaceControls.outerHeight();
self._elmts.projectsContainer
.css("height", (height - controlsHeight - DOM.getVPaddings(self._elmts.projectsContainer)) + "px");
self._elmts.workspaceControls
.css("bottom", "0px")
.css("width", (width - DOM.getHPaddings(self._elmts.workspaceControls)) + "px")
};
$(window).resize(resize);
window.setTimeout(resize, 100);
$("#project-file-input").change(function() { $("#project-file-input").change(function() {
if ($("#project-name-input")[0].value.length == 0) { if ($("#project-name-input")[0].value.length == 0) {
var fileName = this.files[0].fileName; var fileName = this.files[0].fileName;
@ -86,6 +73,19 @@ Refine.OpenProjectUI = function(elmt) {
this._fetchProjects(); this._fetchProjects();
}; };
Refine.OpenProjectUI.prototype.resize = function() {
var height = this._elmt.height();
var width = this._elmt.width();
var controlsHeight = this._elmts.workspaceControls.outerHeight();
this._elmts.projectsContainer
.css("height", (height - controlsHeight - DOM.getVPaddings(this._elmts.projectsContainer)) + "px");
this._elmts.workspaceControls
.css("bottom", "0px")
.css("width", (width - DOM.getHPaddings(this._elmts.workspaceControls)) + "px")
};
Refine.OpenProjectUI.prototype._fetchProjects = function() { Refine.OpenProjectUI.prototype._fetchProjects = function() {
var self = this; var self = this;
$.getJSON( $.getJSON(
@ -119,47 +119,41 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
var table = $( var table = $(
'<table class="list-table"><tr>' + '<table class="list-table"><tr>' +
'<th></th>' +
'<th></th>' +
'<th>Name</th>' + '<th>Name</th>' +
'<th></th>' + '<th>Last&nbsp;modified</th>' +
'<th></th>' +
'<th align="right">Last&nbsp;modified</th>' +
'</tr></table>' '</tr></table>'
).appendTo(container)[0]; ).appendTo(container)[0];
var formatDate = function(d) {
var d = new Date(d);
var last_year = Date.today().add({ years: -1 });
var last_month = Date.today().add({ months: -1 });
var last_week = Date.today().add({ days: -7 });
var today = Date.today();
var tomorrow = Date.today().add({ days: 1 });
if (d.between(today, tomorrow)) {
return "today " + d.toString("h:mm tt");
} else if (d.between(last_week, today)) {
var diff = Math.floor(today.getDayOfYear() - d.getDayOfYear());
return (diff <= 1) ? ("yesterday " + d.toString("h:mm tt")) : (diff + " days ago");
} else if (d.between(last_month, today)) {
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
return (diff == 1) ? "a week ago" : diff.toFixed(0) + " weeks ago" ;
} else if (d.between(last_year, today)) {
var diff = Math.floor(today.getMonth() - d.getMonth());
return (diff == 1) ? "a month ago" : diff + " months ago";
} else {
var diff = Math.floor(today.getYear() - d.getYear());
return (diff == 1) ? "a year ago" : diff + " years ago";
}
};
var renderProject = function(project) { var renderProject = function(project) {
var tr = table.insertRow(table.rows.length); var tr = table.insertRow(table.rows.length);
tr.className = "project"; tr.className = "project";
var nameLink = $('<a></a>') var deleteLink = $('<a></a>')
.addClass("list-table-itemname") .addClass("delete-project")
.text(project.name) .attr("title","Delete this project")
.attr("href", "/project?project=" + project.id) .attr("href","")
.appendTo(tr.insertCell(tr.cells.length)); .css("visibility", "hidden")
.html("<img src='/images/close.png' />")
.click(function() {
if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) {
$.ajax({
type: "POST",
url: "/command/core/delete-project",
data: { "project" : project.id },
dataType: "json",
success: function (data) {
if (data && typeof data.code != 'undefined' && data.code == "ok") {
self._fetchProjects();
}
}
});
}
return false;
}).appendTo(
$(tr.insertCell(tr.cells.length)).css('width', '1%')
);
var renameLink = $('<a></a>') var renameLink = $('<a></a>')
.text("rename") .text("rename")
@ -190,34 +184,19 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
} }
} }
}); });
}).appendTo(tr.insertCell(tr.cells.length)); }).appendTo(
$(tr.insertCell(tr.cells.length)).css('width', '1%')
);
var deleteLink = $('<a></a>') var nameLink = $('<a></a>')
.addClass("delete-project") .addClass("list-table-itemname")
.attr("title","Delete this project") .text(project.name)
.attr("href","") .attr("href", "/project?project=" + project.id)
.css("visibility", "hidden") .appendTo(tr.insertCell(tr.cells.length));
.html("<img src='/images/close.png' />")
.click(function() {
if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) {
$.ajax({
type: "POST",
url: "/command/core/delete-project",
data: { "project" : project.id },
dataType: "json",
success: function (data) {
if (data && typeof data.code != 'undefined' && data.code == "ok") {
self._fetchProjects();
}
}
});
}
return false;
}).appendTo(tr.insertCell(tr.cells.length));
$('<div></div>') $('<div></div>')
.html(formatDate(project.date)) .html(formatRelativeDate(project.date))
.addClass("last-modified") .addClass("last-modified")
.attr("title", project.date.toString()) .attr("title", project.date.toString())
.appendTo(tr.insertCell(tr.cells.length)); .appendTo(tr.insertCell(tr.cells.length));

View File

@ -54,3 +54,31 @@ function cloneDeep(o) {
return o; return o;
} }
} }
function formatRelativeDate(d) {
var d = new Date(d);
var almost_last_year = Date.today().add({ months: -11 });
var last_month = Date.today().add({ months: -1 });
var last_week = Date.today().add({ days: -7 });
var today = Date.today();
var tomorrow = Date.today().add({ days: 1 });
if (d.between(today, tomorrow)) {
return "today " + d.toString("h:mm tt");
} else if (d.between(last_week, today)) {
var diff = Math.floor(today.getDayOfYear() - d.getDayOfYear());
return (diff <= 1) ? ("yesterday " + d.toString("h:mm tt")) : (diff + " days ago");
} else if (d.between(last_month, today)) {
var diff = Math.floor((today.getDayOfYear() - d.getDayOfYear()) / 7);
return (diff == 1) ? "a week ago" : diff.toFixed(0) + " weeks ago" ;
} else if (d.between(almost_last_year, today)) {
var diff = today.getMonth() - d.getMonth();
if (diff < 1) {
diff += 12;
}
return (diff == 1) ? "a month ago" : diff + " months ago";
} else {
var diff = Math.floor(today.getYear() - d.getYear());
return (diff == 1) ? "a year ago" : diff + " years ago";
}
};

View File

@ -114,4 +114,5 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
} }

View File

@ -55,6 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
border-collapse: collapse; border-collapse: collapse;
border-bottom: 1px solid @chrome_primary; border-bottom: 1px solid @chrome_primary;
} }
#create-project-ui-source-selection-layout > tbody > tr > td {
vertical-align: top;
}
#create-project-ui-source-selection-tab-bodies { #create-project-ui-source-selection-tab-bodies {
background: white; background: white;
@ -73,6 +76,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.create-project-ui-source-selection-tab-body { .create-project-ui-source-selection-tab-body {
padding: @padding_loose; padding: @padding_loose;
overflow: auto;
} }
.create-project-ui-source-selection-tab { .create-project-ui-source-selection-tab {