mirror of
https://github.com/friendica/friendica
synced 2024-12-08 14:06:26 +01:00
work in progress js_uploader plugin, turn java uploader into plugin - not done yet
This commit is contained in:
parent
abbd498a8b
commit
2fc89deaea
68 changed files with 6768 additions and 0 deletions
24
addon/java_upload/java_upload.php
Normal file
24
addon/java_upload/java_upload.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function java_upload_photo_post_init(&$a,&$b) {
|
||||
|
||||
if($_POST['partitionCount'])
|
||||
$a->data['java_upload'] = true;
|
||||
else
|
||||
$a->data['java_upload'] = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function java_upload_photo_post_end(&$a,&$b) {
|
||||
|
||||
if(x($a->data,'java_upload') && $a->data['java_upload'])
|
||||
killme();
|
||||
|
||||
}
|
38
addon/js_upload/file-uploader/client/demo.htm
Normal file
38
addon/js_upload/file-uploader/client/demo.htm
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="fileuploader.css" rel="stylesheet" type="text/css">
|
||||
<style>
|
||||
body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="http://github.com/valums/file-uploader">Back to project page</a></p>
|
||||
|
||||
<p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p>
|
||||
<p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p>
|
||||
|
||||
<div id="file-uploader-demo1">
|
||||
<noscript>
|
||||
<p>Please enable JavaScript to use file uploader.</p>
|
||||
<!-- or put a simple form for upload here -->
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
<script src="fileuploader.js" type="text/javascript"></script>
|
||||
<script>
|
||||
function createUploader(){
|
||||
var uploader = new qq.FileUploader({
|
||||
element: document.getElementById('file-uploader-demo1'),
|
||||
action: 'do-nothing.htm',
|
||||
debug: true
|
||||
});
|
||||
}
|
||||
|
||||
// in your app create uploader as soon as the DOM is ready
|
||||
// don't wait for the window to load
|
||||
window.onload = createUploader;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1
addon/js_upload/file-uploader/client/do-nothing.htm
Normal file
1
addon/js_upload/file-uploader/client/do-nothing.htm
Normal file
|
@ -0,0 +1 @@
|
|||
{success:true}
|
31
addon/js_upload/file-uploader/client/fileuploader.css
Normal file
31
addon/js_upload/file-uploader/client/fileuploader.css
Normal file
|
@ -0,0 +1,31 @@
|
|||
.qq-uploader { position:relative; width: 100%;}
|
||||
|
||||
.qq-upload-button {
|
||||
display:block; /* or inline-block */
|
||||
width: 105px; padding: 7px 0; text-align:center;
|
||||
background:#880000; border-bottom:1px solid #ddd;color:#fff;
|
||||
}
|
||||
.qq-upload-button-hover {background:#cc0000;}
|
||||
.qq-upload-button-focus {outline:1px dotted black;}
|
||||
|
||||
.qq-upload-drop-area {
|
||||
position:absolute; top:0; left:0; width:100%; height:100%; min-height: 70px; z-index:2;
|
||||
background:#FF9797; text-align:center;
|
||||
}
|
||||
.qq-upload-drop-area span {
|
||||
display:block; position:absolute; top: 50%; width:100%; margin-top:-8px; font-size:16px;
|
||||
}
|
||||
.qq-upload-drop-area-active {background:#FF7171;}
|
||||
|
||||
.qq-upload-list {margin:15px 35px; padding:0; list-style:disc;}
|
||||
.qq-upload-list li { margin:0; padding:0; line-height:15px; font-size:12px;}
|
||||
.qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.qq-upload-file {}
|
||||
.qq-upload-spinner {display:inline-block; background: url("loading.gif"); width:15px; height:15px; vertical-align:text-bottom;}
|
||||
.qq-upload-size,.qq-upload-cancel {font-size:11px;}
|
||||
|
||||
.qq-upload-failed-text {display:none;}
|
||||
.qq-upload-fail .qq-upload-failed-text {display:inline;}
|
1247
addon/js_upload/file-uploader/client/fileuploader.js
Normal file
1247
addon/js_upload/file-uploader/client/fileuploader.js
Normal file
File diff suppressed because it is too large
Load diff
BIN
addon/js_upload/file-uploader/client/loading.gif
Normal file
BIN
addon/js_upload/file-uploader/client/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
339
addon/js_upload/file-uploader/gpl-2.0.txt
Normal file
339
addon/js_upload/file-uploader/gpl-2.0.txt
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
24
addon/js_upload/file-uploader/license.txt
Normal file
24
addon/js_upload/file-uploader/license.txt
Normal file
|
@ -0,0 +1,24 @@
|
|||
File uploader component is licensed under GNU GPL 2 or later, see gpl-2.0.txt.
|
||||
© 2010 Andrew Valums
|
||||
|
||||
This distribution also includes:
|
||||
|
||||
server/OctetStreamReader.java
|
||||
Dual Licensed under the MIT and GPL v.2
|
||||
|
||||
jQuery JavaScript Library
|
||||
http://jquery.com/
|
||||
Copyright 2010, John Resig
|
||||
Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
http://jquery.org/license
|
||||
|
||||
Sizzle.js - CSS selector engine used by jQuery
|
||||
http://sizzlejs.com/
|
||||
Copyright 2010, The Dojo Foundation
|
||||
Released under the MIT, BSD, and GPL Licenses.
|
||||
|
||||
QUnit - A JavaScript Unit Testing Framework
|
||||
http://docs.jquery.com/QUnit
|
||||
Copyright (c) 2009 John Resig, Jörn Zaefferer
|
||||
Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
and GPL (GPL-LICENSE.txt) licenses.
|
152
addon/js_upload/file-uploader/readme.md
Normal file
152
addon/js_upload/file-uploader/readme.md
Normal file
|
@ -0,0 +1,152 @@
|
|||
[donation_link]: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3PMY37SL9L888&lc=US&item_name=JavaScript%20file%20uploader¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
||||
|
||||
This plugin uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+,
|
||||
Chrome and falls back to hidden iframe based upload in other browsers,
|
||||
providing good user experience everywhere.
|
||||
|
||||
### <a href="http://valums.com/files/2010/file-uploader/demo.htm">Demo</a> [Donate][donation_link] ###
|
||||
|
||||
### Features ###
|
||||
* multiple file select, progress-bar in FF, Chrome, Safari
|
||||
* drag-and-drop file select in FF, Chrome
|
||||
* uploads are cancellable
|
||||
* no external dependencies
|
||||
* doesn't use Flash
|
||||
* fully working with https
|
||||
* keyboard support in FF, Chrome, Safari
|
||||
* tested in IE7,8; Firefox 3,3.6,4; Safari4,5; Chrome; Opera10.60;
|
||||
|
||||
### License ###
|
||||
This plugin is open sourced under <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPL 2</a> or later.
|
||||
If this license doesn't suit you mail me at andrew (at) valums.com.
|
||||
|
||||
Please [donate][donation_link] if you are willing to support the further development of file upload plugin.
|
||||
|
||||
### Known Issues ###
|
||||
Plugin breaks back button functionality in Opera.
|
||||
|
||||
### Getting started ###
|
||||
The fileuploader.js contains two classes that are meant to be used directly.
|
||||
If you need a complete upload widget (from demo) to quickly drop
|
||||
into your current design, use qq.FileUploader.
|
||||
|
||||
If you want to customize uploader, by using a different looking file list
|
||||
or change the behaviour or functionality use qq.FileUploaderBasic.
|
||||
|
||||
The difference between them is that qq.FileUploader provides a list of files,
|
||||
drag-and-drop, but qq.FileUploaderBasic only creates button and handles validation.
|
||||
Basic uploader is easier extendable, and doesn't limit possible customization.
|
||||
|
||||
qq.FileUploader extends qq.FileUploaderBasic, so that all the options present
|
||||
in the basic uploader also exist in the full widget.
|
||||
|
||||
### qq.FileUploader - Setting up full upload widget ###
|
||||
|
||||
Include fileuploader.js and fileuploader.css into your page.
|
||||
Create container element.
|
||||
|
||||
<div id="file-uploader">
|
||||
<noscript>
|
||||
<p>Please enable JavaScript to use file uploader.</p>
|
||||
<!-- or put a simple form for upload here -->
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
Initialize uploader when the DOM is ready. Change the action option.
|
||||
For example ../server/php.php for the default folder structure.
|
||||
In the server folder you will find examples for different platforms.
|
||||
If you can't find the one you need, check the readme.txt in the same folder.
|
||||
|
||||
var uploader = new qq.FileUploader({
|
||||
// pass the dom node (ex. $(selector)[0] for jQuery users)
|
||||
element: document.getElementById('file-uploader'),
|
||||
// path to server-side upload script
|
||||
action: '/server/upload'
|
||||
});
|
||||
|
||||
### Options of both classes ###
|
||||
|
||||
// url of the server-side upload script, should be on the same domain
|
||||
action: '/server/upload',
|
||||
// additional data to send, name-value pairs
|
||||
params: {},
|
||||
|
||||
// validation
|
||||
// ex. ['jpg', 'jpeg', 'png', 'gif'] or []
|
||||
allowedExtensions: [],
|
||||
// each file size limit in bytes
|
||||
// this option isn't supported in all browsers
|
||||
sizeLimit: 0, // max size
|
||||
minSizeLimit: 0, // min size
|
||||
|
||||
// set to true to output server response to console
|
||||
debug: false,
|
||||
|
||||
// events
|
||||
// you can return false to abort submit
|
||||
onSubmit: function(id, fileName){},
|
||||
onProgress: function(id, fileName, loaded, total){},
|
||||
onComplete: function(id, fileName, responseJSON){},
|
||||
onCancel: function(id, fileName){},
|
||||
|
||||
messages: {
|
||||
// error messages, see qq.FileUploaderBasic for content
|
||||
},
|
||||
showMessage: function(message){ alert(message); }
|
||||
|
||||
Instance methods
|
||||
|
||||
* setParams(newParams)
|
||||
|
||||
#### Changing alert/messages to something more user friendly ####
|
||||
|
||||
If you limited file types and max size, you will probably want to change the default alert and
|
||||
messages as you see fit, this is possible using showMessage callback and messages option.
|
||||
|
||||
#### Sending additional params ####
|
||||
|
||||
To add a parameter that will be passed as a query string with each upload use params option.
|
||||
|
||||
var uploader = new qq.FileUploader({
|
||||
element: document.getElementById('file-uploader'),
|
||||
action: '/server-side.upload',
|
||||
// additional data to send, name-value pairs
|
||||
params: {
|
||||
param1: 'value1',
|
||||
param2: 'value2'
|
||||
}
|
||||
});
|
||||
|
||||
To change params based on the state of your app, use
|
||||
|
||||
uploader.setParams({
|
||||
anotherParam: 'value'
|
||||
});
|
||||
|
||||
It can be nicely used in onSubmit callback.
|
||||
|
||||
#### Troubleshooting ####
|
||||
|
||||
If you can't get the uploader to work, please try the following steps
|
||||
before asking for help.
|
||||
|
||||
If the upload doesn't complete, saying failed.
|
||||
|
||||
* Set the debug option of the FileUploader to true.
|
||||
* Open the page where you have a FileUploader.
|
||||
* Open developer console in your browser.
|
||||
* Try to upload the file. You should see a server serponse.
|
||||
|
||||
It should be {success:true} for completed requests. If it's not,
|
||||
then you have a problem with your server-side script.
|
||||
|
||||
#### Contributors ####
|
||||
|
||||
Thanks to everybody who contributed, either by sending bug reports or donating. And special thanks to:
|
||||
|
||||
John Yeary
|
||||
Sidney Maestre
|
||||
Patrick Pfeiffer
|
||||
Sean Sandy (SeanJA)
|
||||
Andy Newby
|
||||
Ivan Valles
|
125
addon/js_upload/file-uploader/server/OctetStreamReader.java
Normal file
125
addon/js_upload/file-uploader/server/OctetStreamReader.java
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright 2010 Blue Lotus Software, LLC.
|
||||
* Copyright 2010 John Yeary <jyeary@bluelotussoftware.com>.
|
||||
* Copyright 2010 Allan O'Driscoll
|
||||
*
|
||||
* Dual Licensed MIT and GPL v.2
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* The GNU General Public License (GPL) Version 2, June 1991
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; version 2 of the License.
|
||||
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License along with this program;
|
||||
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
package com.bluelotussoftware.apache.commons.fileupload.example;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
/**
|
||||
* Reads an <code>application/octet-stream</code> and writes it to a file.
|
||||
* @author John Yeary <jyeary@bluelotussoftware.com>
|
||||
* @author Allan O'Driscoll
|
||||
* @version 1.0
|
||||
*/
|
||||
public class OctetStreamReader extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 6748857432950840322L;
|
||||
private static final String DESTINATION_DIR_PATH = "files";
|
||||
private static String realPath;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @param config
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
super.init(config);
|
||||
realPath = getServletContext().getRealPath(DESTINATION_DIR_PATH) + "/";
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException {
|
||||
|
||||
PrintWriter writer = null;
|
||||
InputStream is = null;
|
||||
FileOutputStream fos = null;
|
||||
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
} catch (IOException ex) {
|
||||
log(OctetStreamReader.class.getName() + "has thrown an exception: " + ex.getMessage());
|
||||
}
|
||||
|
||||
String filename = request.getHeader("X-File-Name");
|
||||
try {
|
||||
is = request.getInputStream();
|
||||
fos = new FileOutputStream(new File(realPath + filename));
|
||||
IOUtils.copy(is, fos);
|
||||
response.setStatus(response.SC_OK);
|
||||
writer.print("{success: true}");
|
||||
} catch (FileNotFoundException ex) {
|
||||
response.setStatus(response.SC_INTERNAL_SERVER_ERROR);
|
||||
writer.print("{success: false}");
|
||||
log(OctetStreamReader.class.getName() + "has thrown an exception: " + ex.getMessage());
|
||||
} catch (IOException ex) {
|
||||
response.setStatus(response.SC_INTERNAL_SERVER_ERROR);
|
||||
writer.print("{success: false}");
|
||||
log(OctetStreamReader.class.getName() + "has thrown an exception: " + ex.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
fos.close();
|
||||
is.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<!---
AJAX FileUploader for ColdFusion
version: 1.1.1
feedback: sid.maestre@designovermatter.com
-----------update history----------------
1.1.1 on 9/30/2010 by Martin Webb <martin[at]cubicstate.com>
- Change function for Upload to returnformat equals JSON
- local var scoping.
1.1 on 9/9/2010 by Sid Maestre
- Split Upload function to handle fallback uploads for browsers that don't support XHR data transfer
--->
<cfcomponent hint="I handle AJAX File Uploads from Valum's AJAX file uploader library">
<cffunction name="Upload" access="remote" output="false" returntype="any" returnformat="JSON">
<cfargument name="qqfile" type="string" required="true">
<cfset var local = structNew()>
<cfset local.response = structNew()>
<cfset local.requestData = GetHttpRequestData()>
<!--- check if XHR data exists --->
<cfif len(local.requestData.content) GT 0>
<cfset local.response = UploadFileXhr(arguments.qqfile, local.requestData.content)>
<cfelse>
<!--- no XHR data process as standard form submission --->
<cffile action="upload" fileField="arguments.qqfile" destination="#ExpandPath('.')#" nameConflict="makeunique">
<cfset local.response['success'] = true>
<cfset local.response['type'] = 'form'>
</cfif>
<cfreturn local.response>
</cffunction>
<cffunction name="UploadFileXhr" access="private" output="false" returntype="struct">
<cfargument name="qqfile" type="string" required="true">
<cfargument name="content" type="any" required="true">
<cfset var local = structNew()>
<cfset local.response = structNew()>
<!--- write the contents of the http request to a file.
The filename is passed with the qqfile variable --->
<cffile action="write" file="#ExpandPath('.')#/#arguments.qqfile#" output="#arguments.content#">
<!--- if you want to return some JSON you can do it here.
I'm just passing a success message --->
<cfset local.response['success'] = true>
<cfset local.response['type'] = 'xhr'>
<cfreturn local.response>
</cffunction>
</cfcomponent>
|
1
addon/js_upload/file-uploader/server/coldfusion/demo.cfm
Normal file
1
addon/js_upload/file-uploader/server/coldfusion/demo.cfm
Normal file
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="fileuploader.css" rel="stylesheet" type="text/css">
<style>
body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;}
</style>
</head>
<body >
<h1>ColdFusion File Uploader Demo</h1>
<p><a href="http://github.com/valums/file-uploader">Back to project page</a></p>
<p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p>
<p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p>
<div id="file-uploader-demo1">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
<!-- or put a simple form for upload here -->
</noscript>
</div>
<script src="fileuploader.js" type="text/javascript"></script>
<script>
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'),
action: '/valums/server/coldfusion.cfc',
params: {method: 'Upload'}
});
}
// in your app create uploader as soon as the DOM is ready
// don't wait for the window to load
window.onload = createUploader;
</script>
</body>
</html>
|
|
@ -0,0 +1,9 @@
|
|||
Coldfusion example by Sidney Maestre
|
||||
http://www.designovermatter.com/post.cfm/ajax-file-uploader-for-coldfusion
|
||||
|
||||
1. Unzip Andrew's AJAX Uploader into your web root.
|
||||
2. Replace the demo.htm with demo.cfm in the "client" folder
|
||||
3. Place coldfusion.cfc in the "server" folder
|
||||
4. Browse to the demo.cfm file and try it out. The file should be written to the "server" folder.
|
||||
|
||||
Questions? You can contact Sidney Maestreme by mail (sid.maestre(at)designovermatter.com) or Twitter @SidneyAllen
|
62
addon/js_upload/file-uploader/server/perl.cgi
Normal file
62
addon/js_upload/file-uploader/server/perl.cgi
Normal file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use CGI::Carp qw(fatalsToBrowser);
|
||||
|
||||
use Digest::MD5;
|
||||
|
||||
my $uploaddir = '/folder/to/save/in/ajax_upload/tmp_uploads';
|
||||
|
||||
my $maxFileSize = 0.5 * 1024 * 1024; # 1/2mb max file size...
|
||||
|
||||
use CGI;
|
||||
my $IN = new CGI;
|
||||
|
||||
my $file = $IN->param('POSTDATA');
|
||||
my $temp_id = $IN->param('temp_id');
|
||||
|
||||
# make a random filename, and we guess the file type later on...
|
||||
my $name = Digest::MD5::md5_base64( rand );
|
||||
$name =~ s/\+/_/g;
|
||||
$name =~ s/\//_/g;
|
||||
|
||||
my $type;
|
||||
if ($file =~ /^GIF/) {
|
||||
$type = "gif";
|
||||
} elsif ($file =~ /PNG/) {
|
||||
$type = "png";
|
||||
} elsif ($file =~ /JFIF/) {
|
||||
$type = "jpg";
|
||||
}
|
||||
|
||||
if (!$type) {
|
||||
print qq|{ "success": false, "error": "Invalid file type..." }|;
|
||||
print STDERR "file has been NOT been uploaded... \n";
|
||||
}
|
||||
|
||||
print STDERR "Making dir: $uploaddir/$temp_id \n";
|
||||
|
||||
mkdir("$uploaddir/$temp_id");
|
||||
|
||||
open(WRITEIT, ">$uploaddir/$name.$type") or die "Cant write to $uploaddir/$name.$type. Reason: $!";
|
||||
print WRITEIT $file;
|
||||
close(WRITEIT);
|
||||
|
||||
my $check_size = -s "$uploaddir/$name.$type";
|
||||
|
||||
print STDERR qq|Main filesize: $check_size Max Filesize: $maxFileSize \n\n|;
|
||||
|
||||
print $IN->header();
|
||||
if ($check_size < 1) {
|
||||
print STDERR "ooops, its empty - gonna get rid of it!\n";
|
||||
print qq|{ "success": false, "error": "File is empty..." }|;
|
||||
print STDERR "file has been NOT been uploaded... \n";
|
||||
} elsif ($check_size > $maxFileSize) {
|
||||
print STDERR "ooops, its too large - gonna get rid of it!\n";
|
||||
print qq|{ "success": false, "error": "File is too large..." }|;
|
||||
print STDERR "file has been NOT been uploaded... \n";
|
||||
} else {
|
||||
print qq|{ "success": true }|;
|
||||
|
||||
print STDERR "file has been successfully uploaded... thank you.\n";
|
||||
}
|
162
addon/js_upload/file-uploader/server/php.php
Normal file
162
addon/js_upload/file-uploader/server/php.php
Normal file
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Handle file uploads via XMLHttpRequest
|
||||
*/
|
||||
class qqUploadedFileXhr {
|
||||
/**
|
||||
* Save the file to the specified path
|
||||
* @return boolean TRUE on success
|
||||
*/
|
||||
function save($path) {
|
||||
$input = fopen("php://input", "r");
|
||||
$temp = tmpfile();
|
||||
$realSize = stream_copy_to_stream($input, $temp);
|
||||
fclose($input);
|
||||
|
||||
if ($realSize != $this->getSize()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$target = fopen($path, "w");
|
||||
fseek($temp, 0, SEEK_SET);
|
||||
stream_copy_to_stream($temp, $target);
|
||||
fclose($target);
|
||||
|
||||
return true;
|
||||
}
|
||||
function getName() {
|
||||
return $_GET['qqfile'];
|
||||
}
|
||||
function getSize() {
|
||||
if (isset($_SERVER["CONTENT_LENGTH"])){
|
||||
return (int)$_SERVER["CONTENT_LENGTH"];
|
||||
} else {
|
||||
throw new Exception('Getting content length is not supported.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle file uploads via regular form post (uses the $_FILES array)
|
||||
*/
|
||||
class qqUploadedFileForm {
|
||||
/**
|
||||
* Save the file to the specified path
|
||||
* @return boolean TRUE on success
|
||||
*/
|
||||
function save($path) {
|
||||
if(!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function getName() {
|
||||
return $_FILES['qqfile']['name'];
|
||||
}
|
||||
function getSize() {
|
||||
return $_FILES['qqfile']['size'];
|
||||
}
|
||||
}
|
||||
|
||||
class qqFileUploader {
|
||||
private $allowedExtensions = array();
|
||||
private $sizeLimit = 10485760;
|
||||
private $file;
|
||||
|
||||
function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
|
||||
$allowedExtensions = array_map("strtolower", $allowedExtensions);
|
||||
|
||||
$this->allowedExtensions = $allowedExtensions;
|
||||
$this->sizeLimit = $sizeLimit;
|
||||
|
||||
$this->checkServerSettings();
|
||||
|
||||
if (isset($_GET['qqfile'])) {
|
||||
$this->file = new qqUploadedFileXhr();
|
||||
} elseif (isset($_FILES['qqfile'])) {
|
||||
$this->file = new qqUploadedFileForm();
|
||||
} else {
|
||||
$this->file = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function checkServerSettings(){
|
||||
$postSize = $this->toBytes(ini_get('post_max_size'));
|
||||
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
|
||||
$size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
|
||||
die("{'error':'increase post_max_size and upload_max_filesize to $size'}");
|
||||
}
|
||||
}
|
||||
|
||||
private function toBytes($str){
|
||||
$val = trim($str);
|
||||
$last = strtolower($str[strlen($str)-1]);
|
||||
switch($last) {
|
||||
case 'g': $val *= 1024;
|
||||
case 'm': $val *= 1024;
|
||||
case 'k': $val *= 1024;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array('success'=>true) or array('error'=>'error message')
|
||||
*/
|
||||
function handleUpload($uploadDirectory, $replaceOldFile = FALSE){
|
||||
if (!is_writable($uploadDirectory)){
|
||||
return array('error' => "Server error. Upload directory isn't writable.");
|
||||
}
|
||||
|
||||
if (!$this->file){
|
||||
return array('error' => 'No files were uploaded.');
|
||||
}
|
||||
|
||||
$size = $this->file->getSize();
|
||||
|
||||
if ($size == 0) {
|
||||
return array('error' => 'File is empty');
|
||||
}
|
||||
|
||||
if ($size > $this->sizeLimit) {
|
||||
return array('error' => 'File is too large');
|
||||
}
|
||||
|
||||
$pathinfo = pathinfo($this->file->getName());
|
||||
$filename = $pathinfo['filename'];
|
||||
//$filename = md5(uniqid());
|
||||
$ext = $pathinfo['extension'];
|
||||
|
||||
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
|
||||
$these = implode(', ', $this->allowedExtensions);
|
||||
return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
|
||||
}
|
||||
|
||||
if(!$replaceOldFile){
|
||||
/// don't overwrite previous files that were uploaded
|
||||
while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
|
||||
$filename .= rand(10, 99);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){
|
||||
return array('success'=>true);
|
||||
} else {
|
||||
return array('error'=> 'Could not save uploaded file.' .
|
||||
'The upload was cancelled, or server error encountered');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
|
||||
$allowedExtensions = array();
|
||||
// max file size in bytes
|
||||
$sizeLimit = 10 * 1024 * 1024;
|
||||
|
||||
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
|
||||
$result = $uploader->handleUpload('uploads/');
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
|
18
addon/js_upload/file-uploader/server/readme.txt
Normal file
18
addon/js_upload/file-uploader/server/readme.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
The server-side code should consist of two parts.
|
||||
|
||||
1. For IE6-8, Opera, older versions of other browsers you get the file as
|
||||
you normally do with regular form-base uploads.
|
||||
|
||||
2. For browsers which upload file with progress bar, you will need to get the raw
|
||||
post data and write it to the file.
|
||||
|
||||
## Return values ##
|
||||
|
||||
You should return json as a text/html, and escape all
|
||||
'<' as '<', '>' as '>', and '&' as '&'.
|
||||
|
||||
Return
|
||||
{"success":true} when upload was successful
|
||||
{"error":"error message to display"} in case of error
|
||||
|
||||
Send me a mail to andrew (at) valums.com, if you will have any questions.
|
2
addon/js_upload/file-uploader/server/uploads/.gitignore
vendored
Normal file
2
addon/js_upload/file-uploader/server/uploads/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
46
addon/js_upload/file-uploader/tests/action-acceptance.php
Normal file
46
addon/js_upload/file-uploader/tests/action-acceptance.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
usleep(100000);
|
||||
|
||||
$fileName;
|
||||
$fileSize;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
$fileSize = (int)$headers['Content-Length'];
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
$fileSize = $_FILES['qqfile']['size'];
|
||||
} else {
|
||||
die ('{error: "server-error file not passed"}');
|
||||
}
|
||||
|
||||
if ($fileName == '4text.txt'){
|
||||
die ('jsgkdfgu4eyij');
|
||||
}
|
||||
|
||||
if ($fileSize == 0){
|
||||
die ('{error: "server-error file size is zero"}');
|
||||
}
|
||||
|
||||
if ($fileSize < 10){
|
||||
die ('{error: "server-error file size is smaller than 10 bytes"}');
|
||||
}
|
||||
|
||||
if ($fileSize > 9 * 1024){
|
||||
die ('{error: "server-error file size is bigger than 9kB"}');
|
||||
}
|
||||
|
||||
if (count($_GET)){
|
||||
array_merge($_GET, array('fileName'=>$fileName));
|
||||
|
||||
$response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName));
|
||||
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($response), ENT_NOQUOTES);
|
||||
} else {
|
||||
die ('{error: "server-error query params not passed"}');
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
sleep(4);
|
||||
|
||||
$fileName;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
die ('{error: "content length is zero"}');
|
||||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
}
|
||||
} else {
|
||||
die ('{error: "file not passed"}');
|
||||
}
|
||||
|
||||
if (count($_GET)){
|
||||
$_GET['success'] = true;
|
||||
echo json_encode(array_merge($_GET));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
31
addon/js_upload/file-uploader/tests/action-handler-test.php
Normal file
31
addon/js_upload/file-uploader/tests/action-handler-test.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
usleep(300);
|
||||
|
||||
$fileName;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$fileName = $_GET['qqfile'];
|
||||
|
||||
// xhr request
|
||||
$headers = apache_request_headers();
|
||||
if ((int)$headers['Content-Length'] == 0){
|
||||
die ('{error: "content length is zero"}');
|
||||
}
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$fileName = basename($_FILES['qqfile']['name']);
|
||||
|
||||
// form request
|
||||
if ($_FILES['qqfile']['size'] == 0){
|
||||
die ('{error: "file size is zero"}');
|
||||
}
|
||||
} else {
|
||||
die ('{error: "file not passed"}');
|
||||
}
|
||||
|
||||
if (count($_GET)){
|
||||
//return query params
|
||||
echo json_encode(array_merge($_GET, array('fileName'=>$fileName)));
|
||||
} else {
|
||||
die ('{error: "query params not passed"}');
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
sleep(9);
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<p>Drag multiple files into input field. (Win7)</p>
|
||||
<p>Result: One file is selected multiple times. Expected: Multiple files are selected.</p>
|
||||
<input type="file" multiple></body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
window.addEventListener('load', function(){
|
||||
document.addEventListener('dragenter', function(e){
|
||||
e.preventDefault();
|
||||
},false);
|
||||
document.addEventListener('dragover', function(e){
|
||||
e.preventDefault();
|
||||
// e.dataTransfer.effectAllowed is none
|
||||
e.dataTransfer.dropEffect = 'copy';
|
||||
},false);
|
||||
},false);
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
<?php header('Content-type: application/javascript'); ?>
|
|
@ -0,0 +1 @@
|
|||
<?php header('Content-type: application/json'); ?>
|
|
@ -0,0 +1,2 @@
|
|||
<?php header("HTTP/1.0 404 Not Found"); ?>
|
||||
Not found!
|
|
@ -0,0 +1 @@
|
|||
I'm a page.
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
header('Content-type: text/html');
|
||||
|
||||
$data = str_repeat("a", 5000);
|
||||
|
||||
echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
header('Content-type: text/html');
|
||||
$data = array(
|
||||
'example' => "&a<computer networks>, to download means to receive data to a local system from a remote system, or to initiate such a data transfer. Examples of a remote system from which a download might be performed include a webserver, FTP server, email server, or other similar systems. A download can mean either any file that is offered for downloading or that has been downloaded, or the process of receiving such a file.The inverse operation, uploading, can refer to the sending of data from a local system to a remote system such as a server or another client with the intent that the remote system should store a copy of the data being transferred, or the initiation of such a process. The words first came into popular usage among computer users with the increased popularity of Bulletin Board Systems (BBSs), facilitated by the widespread distribution and implementation of dial-up access the in the 1970s",
|
||||
'sub' => array('arr'=>array(10,20,30), 'boo'=>false)
|
||||
);
|
||||
echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
|
|
@ -0,0 +1 @@
|
|||
<?php header('Content-type: text/javascript'); ?>
|
|
@ -0,0 +1,2 @@
|
|||
<?php header('Content-type: text/plain'); ?>
|
||||
text<p>P tag</p>
|
154
addon/js_upload/file-uploader/tests/jquery-1.4.2.min.js
vendored
Normal file
154
addon/js_upload/file-uploader/tests/jquery-1.4.2.min.js
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*!
|
||||
* jQuery JavaScript Library v1.4.2
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Sat Feb 13 22:33:48 2010 -0500
|
||||
*/
|
||||
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
|
||||
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
|
||||
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
|
||||
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
|
||||
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
|
||||
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
|
||||
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
|
||||
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
|
||||
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
|
||||
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
|
||||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
|
||||
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
|
||||
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
|
||||
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
|
||||
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
|
||||
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
|
||||
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
|
||||
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
||||
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
|
||||
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
|
||||
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
|
||||
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
|
||||
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
|
||||
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
|
||||
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){ |