Imported Upstream version 3.0.1
|
@ -0,0 +1,82 @@
|
|||
# Set some reasonable defaults for PHP. Most of these cannot be set
|
||||
# inside the script itself. For hosts that don't have .htaccess
|
||||
# support but do support per-dir php.ini files, these settings are
|
||||
# mirrored in php.ini
|
||||
#
|
||||
<IfModule mod_php5.c>
|
||||
php_flag short_open_tag On
|
||||
php_flag magic_quotes_gpc Off
|
||||
php_flag magic_quotes_sybase Off
|
||||
php_flag magic_quotes_runtime Off
|
||||
php_flag register_globals Off
|
||||
php_flag session.auto_start Off
|
||||
php_flag suhosin.session.encrypt Off
|
||||
php_value upload_max_filesize 20M
|
||||
php_value post_max_size 100M
|
||||
</IfModule>
|
||||
|
||||
# Try to disable the parts of mod_security that interfere with the Flash uploader
|
||||
#
|
||||
<IfModule mod_security.c>
|
||||
SecFilterEngine Off
|
||||
SecFilterScanPOST Off
|
||||
</IfModule>
|
||||
|
||||
# Increase security by uncommenting this block. It keeps browsers
|
||||
# from seeing support files that they shouldn't have access to. We
|
||||
# comment this out because Apache2 requires some minor configuration
|
||||
# in order for you to use it. You must specify "AllowOverride Limit"
|
||||
# in your Apache2 config file before you uncomment this block or
|
||||
# you'll get an "Internal Server Error".
|
||||
#
|
||||
# <FilesMatch "(\.(class|fla|gitignore|inc|ini|sql|txt)|(README|LICENSE|.build_number))$">
|
||||
# Order deny,allow
|
||||
# Deny from all
|
||||
# </FilesMatch>
|
||||
# <FilesMatch "robots.txt">
|
||||
# Order allow,deny
|
||||
# Allow from all
|
||||
# </FilesMatch>
|
||||
|
||||
|
||||
# Improve performance by uncommenting this block. It tells the
|
||||
# browser that your images don't change very often so it won't keep
|
||||
# asking for them. If you get an error after uncommenting this, make
|
||||
# sure you specify "AuthConfig Indexes" in your Apache config file.
|
||||
#
|
||||
# <IfModule mod_expires.c>
|
||||
# ExpiresActive On
|
||||
# # Cache all files for a month after access (A).
|
||||
# ExpiresDefault A2678400
|
||||
# # Do not cache dynamically generated pages.
|
||||
# ExpiresByType text/html A1
|
||||
# </IfModule>
|
||||
|
||||
# You can use the mod_rewrite Apache module to get rid of the
|
||||
# "index.php" from your Gallery 3 urls. Uncomment the block below
|
||||
# inside the <IfModule> ... </IfModule> lines and then edit the
|
||||
# RewriteBase line to match your Gallery 3 URL.
|
||||
#
|
||||
# Here are some RewriteBase values:
|
||||
# Gallery 3 URL RewriteBase line
|
||||
# ============= ====================
|
||||
# http://example.com/gallery3 RewriteBase /gallery3
|
||||
# http://example.com/~bob/photos RewriteBase /~bob/photos
|
||||
# http://gallery3.example.com/ RewriteBase /
|
||||
#
|
||||
# Then just use your Gallery 3 without the index.php in the url.
|
||||
#
|
||||
# NOTE: future upgrades of Gallery 3 will overwrite this file! If you
|
||||
# want these changes to be persistent, talk to your system admin about
|
||||
# putting this block into your Apache config files.
|
||||
#
|
||||
# <IfModule mod_rewrite.c>
|
||||
# Options +FollowSymLinks
|
||||
# RewriteEngine On
|
||||
# RewriteBase /
|
||||
# RewriteCond %{REQUEST_FILENAME} !-f
|
||||
# RewriteCond %{REQUEST_FILENAME} !-d
|
||||
# RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
|
||||
# RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
|
||||
# RewriteRule ^index.php/(.*) $1 [QSA,R,L]
|
||||
# </IfModule>
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, 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 Library 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 St, 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 Library General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,74 @@
|
|||
Gallery 3.0.1
|
||||
|
||||
ABOUT:
|
||||
Gallery 3 is a web based software product that lets you manage your
|
||||
photos on your own website. You must have your own website with PHP
|
||||
and database support in order to install and use it. With Gallery you
|
||||
can easily create and share albums of photos via an intuitive
|
||||
interface.
|
||||
|
||||
|
||||
INTENDED AUDIENCE:
|
||||
This version is intended for anybody who has a website. We stand
|
||||
ready to support the product and help you to make the most of it. We
|
||||
welcome theme and module developers to play with this release and
|
||||
start turning out slick new designs for our happy users. If you have
|
||||
questions or problems, you can get help in the Gallery forums:
|
||||
|
||||
http://gallery.menalto.com/forum/96
|
||||
|
||||
|
||||
SECURITY:
|
||||
We've contracted a professional security audit, received their results
|
||||
and resolved all the issues they found.
|
||||
|
||||
Did you find a security flaw? Please email security@gallery.menalto.com
|
||||
with the details and we'll fix it ASAP!
|
||||
|
||||
|
||||
SUPPORTED CONFIGURATION:
|
||||
- Platform: Linux / Unix.
|
||||
- Web server: Apache 2.2 and newer.
|
||||
- PHP 5.2.3 and newer (PHP's safe_mode must be disabled and simplexml,
|
||||
filter, and json must be installed).
|
||||
- Database: MySQL 5 and newer.
|
||||
|
||||
For complete system requirements, please refer to:
|
||||
http://codex.gallery2.org/Gallery3:Requirements
|
||||
|
||||
|
||||
INSTALLING AND UPGRADING INSTRUCTIONS:
|
||||
For comprehensive instructions, The online User Guide is your best resource:
|
||||
http://codex.gallery2.org/Gallery3:User_guide
|
||||
|
||||
There are also simple instructions below. NOTE: You can upgrade from
|
||||
beta 1 and beyond, but not from alpha releases.
|
||||
|
||||
|
||||
INSTALLATION VIA THE WEB:
|
||||
- Point your web browser at gallery3/installer/ and follow the
|
||||
instructions.
|
||||
|
||||
|
||||
INSTALLATION FROM THE COMMAND LINE:
|
||||
- php installer/index.php [-h host] [-u user] [-p pass] [-d dbname]
|
||||
|
||||
Command line parameters:
|
||||
-h Database host (default: localhost)
|
||||
-u Database user (default: root)
|
||||
-p Database user password (default: )
|
||||
-d Database name (default: gallery3)
|
||||
-x Table prefix (default: )
|
||||
|
||||
|
||||
BUGS?
|
||||
Go to http://apps.sourceforge.net/trac/gallery/ click the "login" link
|
||||
and log in with your SourceForge username and password, then click the
|
||||
"new ticket" button.
|
||||
|
||||
|
||||
QUESTIONS, PROBLEMS:
|
||||
- Check out the gallery3 FAQ http://codex.gallery2.org/Gallery3:FAQ
|
||||
- Post to the Gallery 3 forums: http://gallery.menalto.com/forum/96
|
||||
- Email gallery-devel@lists.sourceforge.net
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Kohana benchmarks are prefixed to prevent collisions
|
||||
define('SYSTEM_BENCHMARK', 'system_benchmark');
|
||||
|
||||
// Load benchmarking support
|
||||
require SYSPATH.'core/Benchmark'.EXT;
|
||||
|
||||
// Start total_execution
|
||||
Benchmark::start(SYSTEM_BENCHMARK.'_total_execution');
|
||||
|
||||
// Start kohana_loading
|
||||
Benchmark::start(SYSTEM_BENCHMARK.'_kohana_loading');
|
||||
|
||||
// Load core files
|
||||
require SYSPATH.'core/Event'.EXT;
|
||||
final class Event extends Event_Core {}
|
||||
|
||||
require SYSPATH.'core/Kohana'.EXT;
|
||||
final class Kohana extends Kohana_Core {}
|
||||
|
||||
require SYSPATH.'core/Kohana_Exception'.EXT;
|
||||
require MODPATH.'gallery/libraries/MY_Kohana_Exception'.EXT;
|
||||
|
||||
require SYSPATH.'core/Kohana_Config'.EXT;
|
||||
require SYSPATH.'libraries/drivers/Config'.EXT;
|
||||
require SYSPATH.'libraries/drivers/Config/Array'.EXT;
|
||||
final class Kohana_Config extends Kohana_Config_Core {}
|
||||
|
||||
// Prepare the environment
|
||||
Kohana::setup();
|
||||
|
||||
// End kohana_loading
|
||||
Benchmark::stop(SYSTEM_BENCHMARK.'_kohana_loading');
|
||||
|
||||
// Start system_initialization
|
||||
Benchmark::start(SYSTEM_BENCHMARK.'_system_initialization');
|
||||
|
||||
// Prepare the system
|
||||
Event::run('system.ready');
|
||||
|
||||
// Determine routing
|
||||
Event::run('system.routing');
|
||||
|
||||
// End system_initialization
|
||||
Benchmark::stop(SYSTEM_BENCHMARK.'_system_initialization');
|
||||
|
||||
// Make the magic happen!
|
||||
Event::run('system.execute');
|
|
@ -0,0 +1,153 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base path of the web site. If this includes a domain, eg: localhost/kohana/
|
||||
* then a full URL will be used, eg: http://localhost/kohana/. If it only includes
|
||||
* the path, and a site_protocol is specified, the domain will be auto-detected.
|
||||
*
|
||||
* Here we do our best to autodetect the base path to Gallery. If your url is something like:
|
||||
* http://example.com/gallery3/index.php/album73/photo5.jpg?param=value
|
||||
*
|
||||
* We want the site_domain to be:
|
||||
* /gallery3
|
||||
*
|
||||
* In the above example, $_SERVER["SCRIPT_NAME"] contains "/gallery3/index.php" so
|
||||
* dirname($_SERVER["SCRIPT_NAME"]) is what we need. Except some low end hosts (namely 1and1.com)
|
||||
* break SCRIPT_NAME and it contains the extra path info, so in the above example it'd be:
|
||||
* /gallery3/index.php/album73/photo5.jpg
|
||||
*
|
||||
* So dirname doesn't work. So we do a tricky workaround where we look up the SCRIPT_FILENAME (in
|
||||
* this case it'd be "index.php" and we delete from that part onwards. If you work at 1and1 and
|
||||
* you're reading this, please fix this bug!
|
||||
*/
|
||||
$config["site_domain"] =
|
||||
substr($_SERVER["SCRIPT_NAME"], 0,
|
||||
strpos($_SERVER["SCRIPT_NAME"], basename($_SERVER["SCRIPT_FILENAME"])));
|
||||
|
||||
/**
|
||||
* Force a default protocol to be used by the site. If no site_protocol is
|
||||
* specified, then the current protocol is used, or when possible, only an
|
||||
* absolute path (with no protocol/domain) is used.
|
||||
*/
|
||||
$config["site_protocol"] = "";
|
||||
|
||||
/**
|
||||
* Name of the front controller for this application. Default: index.php
|
||||
*
|
||||
* This can be removed by using URL rewriting.
|
||||
*/
|
||||
$config["index_page"] = isset($_GET["kohana_uri"]) ? "" : "index.php";
|
||||
|
||||
/**
|
||||
* Fake file extension that will be added to all generated URLs. Example: .html
|
||||
*/
|
||||
$config["url_suffix"] = "";
|
||||
|
||||
/**
|
||||
* Length of time of the internal cache in seconds. 0 or FALSE means no caching.
|
||||
* The internal cache stores file paths and config entries across requests and
|
||||
* can give significant speed improvements at the expense of delayed updating.
|
||||
*/
|
||||
$config["internal_cache"] = FALSE;
|
||||
$config["internal_cache_path"] = VARPATH . "tmp/";
|
||||
|
||||
/**
|
||||
* Enable or disable gzip output compression. This can dramatically decrease
|
||||
* server bandwidth usage, at the cost of slightly higher CPU usage. Set to
|
||||
* the compression level (1-9) that you want to use, or FALSE to disable.
|
||||
*
|
||||
* Do not enable this option if you are using output compression in php.ini!
|
||||
*/
|
||||
$config["output_compression"] = FALSE;
|
||||
|
||||
/**
|
||||
* Enable or disable global XSS filtering of GET, POST, and SERVER data. This
|
||||
* option also accepts a string to specify a specific XSS filtering tool.
|
||||
*/
|
||||
$config["global_xss_filtering"] = TRUE;
|
||||
|
||||
/**
|
||||
* Enable or disable hooks. Setting this option to TRUE will enable
|
||||
* all hooks. By using an array of hook filenames, you can control
|
||||
* which hooks are enabled. Setting this option to FALSE disables hooks.
|
||||
*/
|
||||
$config["enable_hooks"] = TRUE;
|
||||
|
||||
/**
|
||||
* Log thresholds:
|
||||
* 0 - Disable logging
|
||||
* 1 - Errors and exceptions
|
||||
* 2 - Warnings
|
||||
* 3 - Notices
|
||||
* 4 - Debugging
|
||||
*/
|
||||
$config["log_threshold"] = 3;
|
||||
|
||||
/**
|
||||
* Message logging directory.
|
||||
*/
|
||||
$config["log_directory"] = VARPATH . "logs";
|
||||
if (@!is_writable($config["log_directory"])) {
|
||||
$config["log_threshold"] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable displaying of Kohana error pages. This will not affect
|
||||
* logging. Turning this off will disable ALL error pages.
|
||||
*/
|
||||
$config["display_errors"] = TRUE;
|
||||
|
||||
/**
|
||||
* Enable or disable statistics in the final output. Stats are replaced via
|
||||
* specific strings, such as {execution_time}.
|
||||
*
|
||||
* @see http://docs.kohanaphp.com/general/configuration
|
||||
*/
|
||||
$config["render_stats"] = TRUE;
|
||||
|
||||
/**
|
||||
* Filename prefixed used to determine extensions. For example, an
|
||||
* extension to the Controller class would be named MY_Controller.php.
|
||||
*/
|
||||
$config["extension_prefix"] = "MY_";
|
||||
|
||||
/**
|
||||
* An optional list of Config Drivers to use, they "fallback" to the one below them if they
|
||||
* dont work so the first driver is tried then so on until it hits the built in "array" driver and fails
|
||||
*/
|
||||
$config['config_drivers'] = array();
|
||||
|
||||
/**
|
||||
* Additional resource paths, or "modules". Each path can either be absolute
|
||||
* or relative to the docroot. Modules can include any resource that can exist
|
||||
* in your application directory, configuration files, controllers, views, etc.
|
||||
*/
|
||||
$config["modules"] = array(
|
||||
MODPATH . "forge",
|
||||
MODPATH . "kohana23_compat",
|
||||
MODPATH . "gallery", // gallery must be *last* in the order
|
||||
);
|
||||
|
||||
if (TEST_MODE) {
|
||||
array_splice($config["modules"], 0, 0,
|
||||
array(MODPATH . "gallery_unit_test",
|
||||
MODPATH . "unit_test"));
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
// Set this to true to disable demo/debugging controllers
|
||||
define("IN_PRODUCTION", true);
|
||||
|
||||
// Gallery requires PHP 5.2+
|
||||
version_compare(PHP_VERSION, "5.2.3", "<") and
|
||||
exit("Gallery requires PHP 5.2.3 or newer (you're using " . PHP_VERSION . ")");
|
||||
|
||||
// Gallery requires short_tags to be on
|
||||
!ini_get("short_open_tag") and exit("Gallery requires short_open_tag to be on.");
|
||||
|
||||
// Suppress errors. For information on how to debug Gallery 3, see:
|
||||
// http://codex.gallery2.org/Gallery3:FAQ#How_do_I_see_debug_information.3F
|
||||
error_reporting(0);
|
||||
|
||||
// Disabling display_errors will effectively disable Kohana error display
|
||||
// and logging. You can turn off Kohana errors in application/config/config.php
|
||||
ini_set("display_errors", false);
|
||||
|
||||
// Turn off session.use_trans_sid -- that feature attempts to inject session ids
|
||||
// into generated URLs and forms, but it doesn't interoperate will with Gallery's
|
||||
// Ajax code.
|
||||
ini_set("session.use_trans_sid", false);
|
||||
|
||||
define("EXT", ".php");
|
||||
define("DOCROOT", getcwd() . "/");
|
||||
define("KOHANA", "index.php");
|
||||
|
||||
// If the front controller is a symlink, change to the real docroot
|
||||
is_link(basename(__FILE__)) and chdir(dirname(realpath(__FILE__)));
|
||||
|
||||
// Define application and system paths
|
||||
define("APPPATH", realpath("application") . "/");
|
||||
define("MODPATH", realpath("modules") . "/");
|
||||
define("THEMEPATH", realpath("themes") . "/");
|
||||
define("SYSPATH", realpath("system") . "/");
|
||||
|
||||
// We only accept a few controllers on the command line
|
||||
if (PHP_SAPI == "cli") {
|
||||
switch ($arg_1 = $_SERVER["argv"][1]) {
|
||||
case "install":
|
||||
include("installer/index.php");
|
||||
exit(0);
|
||||
case "upgrade":
|
||||
case "package":
|
||||
$_SERVER["argv"] = array("index.php", "{$arg_1}r/$arg_1");
|
||||
define("TEST_MODE", 0);
|
||||
define("VARPATH", realpath("var") . "/");
|
||||
break;
|
||||
|
||||
case "test":
|
||||
array_splice($_SERVER["argv"], 1, 1, "gallery_unit_test");
|
||||
define("TEST_MODE", 1);
|
||||
if (!is_dir("test/var")) {
|
||||
@mkdir("test/var", 0777, true);
|
||||
@mkdir("test/var/logs", 0777, true);
|
||||
}
|
||||
@copy("var/database.php", "test/var/database.php");
|
||||
define("VARPATH", realpath("test/var") . "/");
|
||||
break;
|
||||
|
||||
default:
|
||||
print "To install:\n";
|
||||
print " php index.php install -d database -h host -u user -p password -x table_prefix \n\n";
|
||||
print "To upgrade:\n";
|
||||
print " php index.php upgrade\n\n";
|
||||
print "Developer-only features:\n";
|
||||
print " ** CAUTION! THESE FEATURES -WILL- DAMAGE YOUR INSTALL **\n";
|
||||
print " php index.php package # create new installer files\n";
|
||||
print " php index.php test # run unit tests\n";
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
define("TEST_MODE", 0);
|
||||
define("VARPATH", realpath("var") . "/");
|
||||
}
|
||||
define("TMPPATH", VARPATH . "/tmp/");
|
||||
|
||||
if (file_exists("local.php")) {
|
||||
include("local.php");
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
require APPPATH . "Bootstrap" . EXT;
|
|
@ -0,0 +1,117 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* Command line parameters:
|
||||
* -h Database host (default: localhost)
|
||||
* -u Database user (default: root)
|
||||
* -p Database user password (default: )
|
||||
* -d Database name (default: gallery3)
|
||||
* -x Table prefix (default: )
|
||||
*/
|
||||
if (installer::already_installed()) {
|
||||
print "Gallery 3 is already installed.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$errors = installer::check_environment();
|
||||
if ($errors) {
|
||||
oops(implode($errors, "\n"));
|
||||
}
|
||||
|
||||
$config = parse_cli_params();
|
||||
if (!installer::connect($config)) {
|
||||
oops("Unable to connect to the database.\n" . mysql_error() . "\n");
|
||||
} else if (!installer::select_db($config)) {
|
||||
oops("Database {$config['dbname']} doesn't exist and can't be created. " .
|
||||
"Please create the database by hand.");
|
||||
} else if (is_string($count = installer::db_empty($config)) || !$count) {
|
||||
if (is_string($count)) {
|
||||
oops($count);
|
||||
} else {
|
||||
oops("Database {$config['dbname']} already has Gallery 3 tables in it. \n" .
|
||||
" Please remove the Gallery 3 tables, change your prefix,\n" .
|
||||
" or specify an empty database.\n");
|
||||
}
|
||||
} else if (!installer::unpack_var()) {
|
||||
oops("Unable to create files inside the 'var' directory");
|
||||
} else if (!installer::unpack_sql($config)) {
|
||||
oops("Failed to create database tables\n" . mysql_error());
|
||||
} else if (!installer::create_database_config($config)) {
|
||||
oops("Couldn't create var/database.php");
|
||||
} else {
|
||||
system("chmod -R 777 " . VARPATH);
|
||||
try {
|
||||
list ($user, $password) = installer::create_admin($config);
|
||||
print "Your Gallery has been successfully installed!\n";
|
||||
print "We've created an account for you to use:\n";
|
||||
print " username: $user\n";
|
||||
print " password: $password\n";
|
||||
print "\n";
|
||||
|
||||
installer::create_private_key($config);
|
||||
exit(0);
|
||||
} catch (Exception $e) {
|
||||
oops($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function oops($message) {
|
||||
print "Oops! Something went wrong during the installation:\n\n";
|
||||
|
||||
print "==> " . $message;
|
||||
print "\n";
|
||||
print "For help you can try:\n";
|
||||
print " * The Gallery 3 FAQ - http://codex.gallery2.org/Gallery3:FAQ\n";
|
||||
print " * The Gallery Forums - http://gallery.menalto.com/forum\n";
|
||||
print "\n\n** INSTALLATION FAILED **\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function parse_cli_params() {
|
||||
$config = array("host" => "localhost",
|
||||
"user" => "root",
|
||||
"password" => "",
|
||||
"dbname" => "gallery3",
|
||||
"prefix" => "",
|
||||
"type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
|
||||
|
||||
$argv = $_SERVER["argv"];
|
||||
for ($i = 1; $i < count($argv); $i++) {
|
||||
switch (strtolower($argv[$i])) {
|
||||
case "-d":
|
||||
$config["dbname"] = $argv[++$i];
|
||||
break;
|
||||
case "-h":
|
||||
list ($config["host"], $config["port"]) = explode(":", $argv[++$i]);
|
||||
break;
|
||||
case "-u":
|
||||
$config["user"] = $argv[++$i];
|
||||
break;
|
||||
case "-p":
|
||||
$config["password"] = $argv[++$i];
|
||||
break;
|
||||
case "-x":
|
||||
$config["prefix"] = $argv[++$i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?php print "<?php" ?> defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
/**
|
||||
* @package Database
|
||||
*
|
||||
* Database connection settings, defined as arrays, or "groups". If no group
|
||||
* name is used when loading the database library, the group named "default"
|
||||
* will be used.
|
||||
*
|
||||
* Each group can be connected to independently, and multiple groups can be
|
||||
* connected at once.
|
||||
*
|
||||
* Group Options:
|
||||
* benchmark - Enable or disable database benchmarking
|
||||
* persistent - Enable or disable a persistent connection
|
||||
* connection - Array of connection specific parameters; alternatively,
|
||||
* you can use a DSN though it is not as fast and certain
|
||||
* characters could create problems (like an '@' character
|
||||
* in a password):
|
||||
* 'connection' => 'mysql://dbuser:secret@localhost/kohana'
|
||||
* character_set - Database character set
|
||||
* table_prefix - Database table prefix
|
||||
* object - Enable or disable object results
|
||||
* cache - Enable or disable query caching
|
||||
* escape - Enable automatic query builder escaping
|
||||
*/
|
||||
$config['default'] = array(
|
||||
'benchmark' => false,
|
||||
'persistent' => false,
|
||||
'connection' => array(
|
||||
'type' => '<?php print $type ?>',
|
||||
'user' => '<?php print $user ?>',
|
||||
'pass' => '<?php print str_replace("'", "\\'", $password) ?>',
|
||||
'host' => '<?php print $host ?>',
|
||||
'port' => <?php if (!empty($port)): ?>'<?php print $port ?>' <?php else: ?>false<?php endif ?>,
|
||||
'socket' => false,
|
||||
'database' => '<?php print $dbname ?>',
|
||||
'params' => null,
|
||||
),
|
||||
'character_set' => 'utf8',
|
||||
'table_prefix' => '<?php print $prefix ?>',
|
||||
'object' => true,
|
||||
'cache' => false,
|
||||
'escape' => true
|
||||
);
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
define("DOCROOT", dirname(dirname(__FILE__)) . "/");
|
||||
define("VARPATH", DOCROOT . "var/");
|
||||
define("SYSPATH", "DEFINED_TO_SOMETHING_SO_THAT_WE_CAN_KEEP_CONSISTENT_PREAMBLES_IN_THE_INSTALLER");
|
||||
|
||||
if (version_compare(PHP_VERSION, "5.2.3", "<")) {
|
||||
print "Gallery 3 requires PHP 5.2.3 or newer.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Turn off session.use_trans_sid -- that feature attempts to inject session ids
|
||||
// into generated URLs and forms, but it doesn't interoperate will with Gallery's
|
||||
// Ajax code.
|
||||
ini_set("session.use_trans_sid", false);
|
||||
|
||||
require(DOCROOT . "installer/installer.php");
|
||||
if (PHP_SAPI == "cli") {
|
||||
include("cli.php");
|
||||
} else {
|
||||
include("web.php");
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?php
|
||||
!file_exists(VARPATH . "albums") && mkdir(VARPATH . "albums");
|
||||
!file_exists(VARPATH . "logs") && mkdir(VARPATH . "logs");
|
||||
!file_exists(VARPATH . "modules") && mkdir(VARPATH . "modules");
|
||||
!file_exists(VARPATH . "resizes") && mkdir(VARPATH . "resizes");
|
||||
!file_exists(VARPATH . "thumbs") && mkdir(VARPATH . "thumbs");
|
||||
!file_exists(VARPATH . "tmp") && mkdir(VARPATH . "tmp");
|
||||
!file_exists(VARPATH . "uploads") && mkdir(VARPATH . "uploads");
|
||||
file_put_contents(VARPATH . "logs/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
|
||||
file_put_contents(VARPATH . "tmp/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
|
||||
file_put_contents(VARPATH . "uploads/.htaccess", base64_decode("RGlyZWN0b3J5SW5kZXggLmh0YWNjZXNzClNldEhhbmRsZXIgR2FsbGVyeV9TZWN1cml0eV9Eb19Ob3RfUmVtb3ZlCk9wdGlvbnMgTm9uZQo8SWZNb2R1bGUgbW9kX3Jld3JpdGUuYz4KUmV3cml0ZUVuZ2luZSBvZmYKPC9JZk1vZHVsZT4KT3JkZXIgYWxsb3csZGVueQpEZW55IGZyb20gYWxsCg=="));
|
|
@ -0,0 +1,92 @@
|
|||
h1, h2, h3 {
|
||||
margin-bottom: .1em;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #eee;
|
||||
font-family: Trebuchet MS, Verdana;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div#outer {
|
||||
width: 650px;
|
||||
background: white;
|
||||
border: 1px solid #999;
|
||||
margin: 0 auto;
|
||||
padding: -10px;
|
||||
}
|
||||
|
||||
div#inner {
|
||||
padding: 0 1em 0 1em;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
div#footer {
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.error {
|
||||
border: 1px solid red;
|
||||
background: #fcc;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.success {
|
||||
border: 1px solid green;
|
||||
background: #cfc;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: 0px;
|
||||
padding-left: 0px;
|
||||
margin-top: 1em;
|
||||
border: 1px solid #ccc;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
font-weight: bold;
|
||||
margin: 8px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
table#db_info {
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
code {
|
||||
background: #eee;
|
||||
border: 1px solid #bbb;
|
||||
padding: 2px;
|
||||
display: block;
|
||||
width: 200px;
|
||||
margin: 4px 4px 4px 20px;
|
||||
}
|
||||
|
||||
code.location {
|
||||
display: block;
|
||||
margin: 4px;
|
||||
padding: 4px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
span.subtext {
|
||||
font-size: .7em;
|
||||
color: #999;
|
||||
}
|
||||
|
|
@ -0,0 +1,425 @@
|
|||
DROP TABLE IF EXISTS {access_caches};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {access_caches} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`item_id` int(9) DEFAULT NULL,
|
||||
`view_full_1` binary(1) NOT NULL DEFAULT '0',
|
||||
`edit_1` binary(1) NOT NULL DEFAULT '0',
|
||||
`add_1` binary(1) NOT NULL DEFAULT '0',
|
||||
`view_full_2` binary(1) NOT NULL DEFAULT '0',
|
||||
`edit_2` binary(1) NOT NULL DEFAULT '0',
|
||||
`add_2` binary(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `item_id` (`item_id`)
|
||||
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0');
|
||||
DROP TABLE IF EXISTS {access_intents};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {access_intents} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`item_id` int(9) DEFAULT NULL,
|
||||
`view_1` binary(1) DEFAULT NULL,
|
||||
`view_full_1` binary(1) DEFAULT NULL,
|
||||
`edit_1` binary(1) DEFAULT NULL,
|
||||
`add_1` binary(1) DEFAULT NULL,
|
||||
`view_2` binary(1) DEFAULT NULL,
|
||||
`view_full_2` binary(1) DEFAULT NULL,
|
||||
`edit_2` binary(1) DEFAULT NULL,
|
||||
`add_2` binary(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {access_intents} VALUES (1,1,'1','1','0','0','1','1','0','0');
|
||||
DROP TABLE IF EXISTS {caches};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {caches} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`key` varchar(255) NOT NULL,
|
||||
`tags` varchar(255) DEFAULT NULL,
|
||||
`expiration` int(9) NOT NULL,
|
||||
`cache` longblob,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `key` (`key`),
|
||||
KEY `tags` (`tags`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {comments};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {comments} (
|
||||
`author_id` int(9) DEFAULT NULL,
|
||||
`created` int(9) NOT NULL,
|
||||
`guest_email` varchar(128) DEFAULT NULL,
|
||||
`guest_name` varchar(128) DEFAULT NULL,
|
||||
`guest_url` varchar(255) DEFAULT NULL,
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`item_id` int(9) NOT NULL,
|
||||
`server_http_accept_charset` varchar(64) DEFAULT NULL,
|
||||
`server_http_accept_encoding` varchar(64) DEFAULT NULL,
|
||||
`server_http_accept_language` varchar(64) DEFAULT NULL,
|
||||
`server_http_accept` varchar(128) DEFAULT NULL,
|
||||
`server_http_connection` varchar(64) DEFAULT NULL,
|
||||
`server_http_host` varchar(64) DEFAULT NULL,
|
||||
`server_http_referer` varchar(255) DEFAULT NULL,
|
||||
`server_http_user_agent` varchar(128) DEFAULT NULL,
|
||||
`server_query_string` varchar(64) DEFAULT NULL,
|
||||
`server_remote_addr` varchar(32) DEFAULT NULL,
|
||||
`server_remote_host` varchar(64) DEFAULT NULL,
|
||||
`server_remote_port` varchar(16) DEFAULT NULL,
|
||||
`state` varchar(15) DEFAULT 'unpublished',
|
||||
`text` text,
|
||||
`updated` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {failed_auths};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {failed_auths} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`count` int(9) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`time` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {graphics_rules};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {graphics_rules} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`active` tinyint(1) DEFAULT '0',
|
||||
`args` varchar(255) DEFAULT NULL,
|
||||
`module_name` varchar(64) NOT NULL,
|
||||
`operation` varchar(64) NOT NULL,
|
||||
`priority` int(9) NOT NULL,
|
||||
`target` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {graphics_rules} VALUES (1,1,'a:3:{s:5:\"width\";i:200;s:6:\"height\";i:200;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'thumb');
|
||||
INSERT INTO {graphics_rules} VALUES (2,1,'a:3:{s:5:\"width\";i:640;s:6:\"height\";i:640;s:6:\"master\";i:2;}','gallery','gallery_graphics::resize',100,'resize');
|
||||
DROP TABLE IF EXISTS {groups};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {groups} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`name` char(64) DEFAULT NULL,
|
||||
`special` tinyint(1) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {groups} VALUES (1,'Everybody',1);
|
||||
INSERT INTO {groups} VALUES (2,'Registered Users',1);
|
||||
DROP TABLE IF EXISTS {groups_users};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {groups_users} (
|
||||
`group_id` int(9) NOT NULL,
|
||||
`user_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`group_id`,`user_id`),
|
||||
UNIQUE KEY `user_id` (`user_id`,`group_id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {groups_users} VALUES (1,1);
|
||||
INSERT INTO {groups_users} VALUES (1,2);
|
||||
INSERT INTO {groups_users} VALUES (2,2);
|
||||
DROP TABLE IF EXISTS {incoming_translations};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {incoming_translations} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`key` char(32) NOT NULL,
|
||||
`locale` char(10) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`revision` int(9) DEFAULT NULL,
|
||||
`translation` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `key` (`key`,`locale`),
|
||||
KEY `locale_key` (`locale`,`key`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {items};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {items} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`album_cover_item_id` int(9) DEFAULT NULL,
|
||||
`captured` int(9) DEFAULT NULL,
|
||||
`created` int(9) DEFAULT NULL,
|
||||
`description` text,
|
||||
`height` int(9) DEFAULT NULL,
|
||||
`left_ptr` int(9) NOT NULL,
|
||||
`level` int(9) NOT NULL,
|
||||
`mime_type` varchar(64) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`owner_id` int(9) DEFAULT NULL,
|
||||
`parent_id` int(9) NOT NULL,
|
||||
`rand_key` decimal(11,10) DEFAULT NULL,
|
||||
`relative_path_cache` varchar(255) DEFAULT NULL,
|
||||
`relative_url_cache` varchar(255) DEFAULT NULL,
|
||||
`resize_dirty` tinyint(1) DEFAULT '1',
|
||||
`resize_height` int(9) DEFAULT NULL,
|
||||
`resize_width` int(9) DEFAULT NULL,
|
||||
`right_ptr` int(9) NOT NULL,
|
||||
`slug` varchar(255) DEFAULT NULL,
|
||||
`sort_column` varchar(64) DEFAULT NULL,
|
||||
`sort_order` char(4) DEFAULT 'ASC',
|
||||
`thumb_dirty` tinyint(1) DEFAULT '1',
|
||||
`thumb_height` int(9) DEFAULT NULL,
|
||||
`thumb_width` int(9) DEFAULT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`type` varchar(32) NOT NULL,
|
||||
`updated` int(9) DEFAULT NULL,
|
||||
`view_count` int(9) DEFAULT '0',
|
||||
`weight` int(9) NOT NULL DEFAULT '0',
|
||||
`width` int(9) DEFAULT NULL,
|
||||
`view_1` binary(1) DEFAULT '0',
|
||||
`view_2` binary(1) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `parent_id` (`parent_id`),
|
||||
KEY `type` (`type`),
|
||||
KEY `random` (`rand_key`),
|
||||
KEY `weight` (`weight`),
|
||||
KEY `left_ptr` (`left_ptr`)
|
||||
) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1');
|
||||
DROP TABLE IF EXISTS {items_tags};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {items_tags} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`item_id` int(9) NOT NULL,
|
||||
`tag_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `tag_id` (`tag_id`,`id`),
|
||||
KEY `item_id` (`item_id`,`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {logs};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {logs} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`category` varchar(64) DEFAULT NULL,
|
||||
`html` varchar(255) DEFAULT NULL,
|
||||
`message` text,
|
||||
`referer` varchar(255) DEFAULT NULL,
|
||||
`severity` int(9) DEFAULT '0',
|
||||
`timestamp` int(9) DEFAULT '0',
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`user_id` int(9) DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {messages};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {messages} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`key` varchar(255) DEFAULT NULL,
|
||||
`severity` varchar(32) DEFAULT NULL,
|
||||
`value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `key` (`key`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {modules};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {modules} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`active` tinyint(1) DEFAULT '0',
|
||||
`name` varchar(64) DEFAULT NULL,
|
||||
`version` int(9) DEFAULT NULL,
|
||||
`weight` int(9) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`),
|
||||
KEY `weight` (`weight`)
|
||||
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {modules} VALUES (1,1,'gallery',46,1);
|
||||
INSERT INTO {modules} VALUES (2,1,'user',3,2);
|
||||
INSERT INTO {modules} VALUES (3,1,'comment',3,3);
|
||||
INSERT INTO {modules} VALUES (4,1,'organize',4,4);
|
||||
INSERT INTO {modules} VALUES (5,1,'info',2,5);
|
||||
INSERT INTO {modules} VALUES (6,1,'rss',1,6);
|
||||
INSERT INTO {modules} VALUES (7,1,'search',1,7);
|
||||
INSERT INTO {modules} VALUES (8,1,'slideshow',2,8);
|
||||
INSERT INTO {modules} VALUES (9,1,'tag',2,9);
|
||||
DROP TABLE IF EXISTS {outgoing_translations};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {outgoing_translations} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`base_revision` int(9) DEFAULT NULL,
|
||||
`key` char(32) NOT NULL,
|
||||
`locale` char(10) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`translation` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `key` (`key`,`locale`),
|
||||
KEY `locale_key` (`locale`,`key`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {permissions};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {permissions} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`display_name` varchar(64) DEFAULT NULL,
|
||||
`name` varchar(64) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {permissions} VALUES (1,'View','view');
|
||||
INSERT INTO {permissions} VALUES (2,'View full size','view_full');
|
||||
INSERT INTO {permissions} VALUES (3,'Edit','edit');
|
||||
INSERT INTO {permissions} VALUES (4,'Add','add');
|
||||
DROP TABLE IF EXISTS {search_records};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {search_records} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`item_id` int(9) DEFAULT NULL,
|
||||
`dirty` tinyint(1) DEFAULT '1',
|
||||
`data` longtext,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `item_id` (`item_id`),
|
||||
FULLTEXT KEY `data` (`data`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {search_records} VALUES (1,1,0,' Gallery');
|
||||
DROP TABLE IF EXISTS {sessions};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {sessions} (
|
||||
`session_id` varchar(127) NOT NULL,
|
||||
`data` text NOT NULL,
|
||||
`last_activity` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`session_id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {tags};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {tags} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(128) NOT NULL,
|
||||
`count` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {tasks};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {tasks} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`callback` varchar(128) DEFAULT NULL,
|
||||
`context` text NOT NULL,
|
||||
`done` tinyint(1) DEFAULT '0',
|
||||
`name` varchar(128) DEFAULT NULL,
|
||||
`owner_id` int(9) DEFAULT NULL,
|
||||
`percent_complete` int(9) DEFAULT '0',
|
||||
`state` varchar(32) DEFAULT NULL,
|
||||
`status` varchar(255) DEFAULT NULL,
|
||||
`updated` int(9) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `owner_id` (`owner_id`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
DROP TABLE IF EXISTS {themes};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {themes} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) DEFAULT NULL,
|
||||
`version` int(9) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {themes} VALUES (1,'wind',1);
|
||||
INSERT INTO {themes} VALUES (2,'admin_wind',1);
|
||||
DROP TABLE IF EXISTS {users};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {users} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(32) NOT NULL,
|
||||
`full_name` varchar(255) NOT NULL,
|
||||
`password` varchar(64) NOT NULL,
|
||||
`login_count` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`last_login` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`email` varchar(64) DEFAULT NULL,
|
||||
`admin` tinyint(1) DEFAULT '0',
|
||||
`guest` tinyint(1) DEFAULT '0',
|
||||
`hash` char(32) DEFAULT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`locale` char(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`),
|
||||
UNIQUE KEY `hash` (`hash`)
|
||||
) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {users} VALUES (1,'guest','Guest User','',0,0,NULL,0,1,NULL,NULL,NULL);
|
||||
INSERT INTO {users} VALUES (2,'admin','Gallery Administrator','',0,0,'unknown@unknown.com',1,0,NULL,NULL,NULL);
|
||||
DROP TABLE IF EXISTS {vars};
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE {vars} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`module_name` varchar(64) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `module_name` (`module_name`,`name`)
|
||||
) AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','page_size','9');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','thumb_size','200');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','resize_size','640');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','default_locale','en_US');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','image_quality','75');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','image_sharpen','15');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','upgrade_checker_auto_enabled','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:4:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:15:\"upgrade_checker\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','time_format','H:i:s');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','show_credits','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','credits','Powered by <a href=\"%url\">%gallery_version</a>');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','visible_title_length','15');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','favicon_url','lib/images/favicon.ico');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','email_from','unknown@unknown.com');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','email_reply_to','unknown@unknown.com');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','email_header_separator','s:1:\"\n\";');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','show_user_profiles_to','registered_users');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','extra_binary_paths','/usr/local/bin:/opt/local/bin:/opt/bin');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:10;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:11;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:12;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:13;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}');
|
||||
INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user');
|
||||
INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5');
|
||||
INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0');
|
||||
INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody');
|
||||
INSERT INTO {vars} VALUES (NULL,'info','show_title','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'info','show_description','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'info','show_owner','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'info','show_name','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'info','show_captured','1');
|
||||
INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0');
|
|
@ -0,0 +1,262 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class installer {
|
||||
static $mysqli;
|
||||
|
||||
static function already_installed() {
|
||||
return file_exists(VARPATH . "database.php");
|
||||
}
|
||||
|
||||
static function var_writable() {
|
||||
if (is_writable(VARPATH)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (@mkdir(VARPATH)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static function create_database_config($config) {
|
||||
$db_config_file = VARPATH . "database.php";
|
||||
ob_start();
|
||||
extract($config);
|
||||
include(DOCROOT . "installer/database_config.php");
|
||||
$output = ob_get_clean();
|
||||
return file_put_contents($db_config_file, $output) !== false;
|
||||
}
|
||||
|
||||
static function unpack_var() {
|
||||
if (!file_exists(VARPATH)) {
|
||||
mkdir(VARPATH);
|
||||
chmod(VARPATH, 0777);
|
||||
}
|
||||
|
||||
include(DOCROOT . "installer/init_var.php");
|
||||
return true;
|
||||
}
|
||||
|
||||
static function unpack_sql($config) {
|
||||
$prefix = $config["prefix"];
|
||||
$buf = null;
|
||||
foreach (file(DOCROOT . "installer/install.sql") as $line) {
|
||||
$buf .= trim($line);
|
||||
if (preg_match("/;$/", $buf)) {
|
||||
if (!mysql_query(self::prepend_prefix($prefix, $buf))) {
|
||||
return false;
|
||||
}
|
||||
$buf = "";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static function connect($config) {
|
||||
// We know that we have either mysql or mysqli. By default we use mysql functions, so if
|
||||
// they're not defined then do the simplest thing which will work: remap them to their mysqli
|
||||
// counterparts.
|
||||
if (!function_exists("mysql_query")) {
|
||||
function mysql_connect($host, $user, $pass) {
|
||||
list ($host, $port) = explode(":", $host . ":");
|
||||
installer::$mysqli = new mysqli($host, $user, $pass, $port);
|
||||
// http://php.net/manual/en/mysqli.connect.php says to use mysqli_connect_error() instead of
|
||||
// $mysqli->connect_error because of bugs before PHP 5.2.9
|
||||
$error = mysqli_connect_error();
|
||||
return empty($error);
|
||||
}
|
||||
function mysql_query($query) {
|
||||
return installer::$mysqli->query($query);
|
||||
}
|
||||
function mysql_num_rows($result) {
|
||||
return $result->num_rows;
|
||||
}
|
||||
function mysql_error() {
|
||||
return installer::$mysqli->error;
|
||||
}
|
||||
function mysql_select_db($db) {
|
||||
return installer::$mysqli->select_db($db);
|
||||
}
|
||||
}
|
||||
|
||||
$host = empty($config["port"]) ? $config['host'] : "{$config['host']}:{$config['port']}";
|
||||
return @mysql_connect($host, $config["user"], $config["password"]);
|
||||
}
|
||||
|
||||
static function select_db($config) {
|
||||
if (mysql_select_db($config["dbname"])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return mysql_query("CREATE DATABASE `{$config['dbname']}`") &&
|
||||
mysql_select_db($config["dbname"]);
|
||||
}
|
||||
|
||||
static function verify_mysql_version($config) {
|
||||
return version_compare(installer::mysql_version($config), "5.0.0", ">=");
|
||||
}
|
||||
|
||||
static function mysql_version($config) {
|
||||
$result = mysql_query("SHOW VARIABLES WHERE variable_name = \"version\"");
|
||||
$row = mysql_fetch_object($result);
|
||||
return $row->Value;
|
||||
}
|
||||
|
||||
static function db_empty($config) {
|
||||
$query = "SHOW TABLES LIKE '{$config['prefix']}items'";
|
||||
$results = mysql_query($query);
|
||||
if ($results === false) {
|
||||
$msg = mysql_error();
|
||||
return $msg;
|
||||
}
|
||||
return mysql_num_rows($results) === 0;
|
||||
}
|
||||
|
||||
static function create_admin($config) {
|
||||
$salt = "";
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$char = mt_rand(48, 109);
|
||||
$char += ($char > 90) ? 13 : ($char > 57) ? 7 : 0;
|
||||
$salt .= chr($char);
|
||||
}
|
||||
$password = substr(md5(time() . mt_rand()), 0, 6);
|
||||
// Escape backslash in preparation for our UPDATE statement.
|
||||
$hashed_password = str_replace("\\", "\\\\", $salt . md5($salt . $password));
|
||||
$sql = self::prepend_prefix($config["prefix"],
|
||||
"UPDATE {users} SET `password` = '$hashed_password' WHERE `id` = 2");
|
||||
if (mysql_query($sql)) {
|
||||
} else {
|
||||
throw new Exception(mysql_error());
|
||||
}
|
||||
|
||||
return array("admin", $password);
|
||||
}
|
||||
|
||||
static function create_admin_session($config) {
|
||||
$session_id = md5(time() . mt_rand());
|
||||
$user_agent = $_SERVER["HTTP_USER_AGENT"];
|
||||
$user_agent_len = strlen($user_agent);
|
||||
$now = time();
|
||||
$data = "session_id|s:32:\"$session_id\"";
|
||||
$data .= ";user_agent|s:{$user_agent_len}:\"$user_agent\"";
|
||||
$data .= ";user|i:2";
|
||||
$data .= ";after_install|i:1";
|
||||
$data .= ";last_activity|i:$now";
|
||||
$data = base64_encode($data);
|
||||
$sql = "INSERT INTO {sessions}(`session_id`, `last_activity`, `data`) " .
|
||||
"VALUES('$session_id', $now, '$data')";
|
||||
$sql = self::prepend_prefix($config["prefix"], $sql);
|
||||
if (mysql_query($sql)) {
|
||||
setcookie("g3sid", $session_id, 0, "/", "", false, false);
|
||||
} else {
|
||||
throw new Exception(mysql_error());
|
||||
}
|
||||
}
|
||||
|
||||
static function create_private_key($config) {
|
||||
$key = md5(uniqid(mt_rand(), true)) . md5(uniqid(mt_rand(), true));
|
||||
$sql = self::prepend_prefix($config["prefix"],
|
||||
"INSERT INTO {vars} VALUES(NULL, 'gallery', 'private_key', '$key')");
|
||||
if (mysql_query($sql)) {
|
||||
} else {
|
||||
throw new Exception(mysql_error());
|
||||
}
|
||||
}
|
||||
|
||||
static function prepend_prefix($prefix, $sql) {
|
||||
return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql);
|
||||
}
|
||||
|
||||
static function check_environment() {
|
||||
if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) {
|
||||
$errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the <a href=\"http://php.net/mysql\">MySQL</a> or the <a href=\"http://php.net/mysqli\">MySQLi</a> extension.";
|
||||
}
|
||||
|
||||
if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) {
|
||||
$errors[] = "PHP is missing <a href=\"http://php.net/pcre\">Perl-Compatible Regular Expression</a> support.";
|
||||
}
|
||||
|
||||
if (!(function_exists("spl_autoload_register"))) {
|
||||
$errors[] = "PHP is missing <a href=\"http://php.net/spl\">Standard PHP Library (SPL)</a> support";
|
||||
}
|
||||
|
||||
if (!(class_exists("ReflectionClass"))) {
|
||||
$errors[] = "PHP is missing <a href=\"http://php.net/reflection\">reflection</a> support";
|
||||
}
|
||||
|
||||
if (!(function_exists("filter_list"))) {
|
||||
$errors[] = "PHP is missing the <a href=\"http://php.net/filter\">filter extension</a>";
|
||||
}
|
||||
|
||||
if (!(extension_loaded("iconv"))) {
|
||||
$errors[] = "PHP is missing the <a href=\"http://php.net/iconv\">iconv extension</a>";
|
||||
}
|
||||
|
||||
if (!(extension_loaded("simplexml"))) {
|
||||
$errors[] = "PHP is missing the <a href=\"http://php.net/simplexml\">SimpleXML extension</a>";
|
||||
}
|
||||
|
||||
if (!extension_loaded("mbstring")) {
|
||||
$errors[] = "PHP is missing the <a href=\"http://php.net/mbstring\">mbstring extension</a>";
|
||||
} else if (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING) {
|
||||
$errors[] = "The <a href=\"http://php.net/mbstring\">mbstring extension</a> is overloading PHP's native string functions. Please disable it.";
|
||||
}
|
||||
|
||||
if (!function_exists("json_encode")) {
|
||||
$errors[] = "PHP is missing the <a href=\"http://php.net/manual/en/book.json.php\">JavaScript Object Notation (JSON) extension</a>. Please install it.";
|
||||
}
|
||||
|
||||
if (!ini_get("short_open_tag")) {
|
||||
$errors[] = "Gallery requires <a href=\"http://php.net/manual/en/ini.core.php\">short_open_tag</a> to be on. Please enable it in your php.ini.";
|
||||
}
|
||||
|
||||
if (!function_exists("ctype_alpha")) {
|
||||
$errors[] = "Gallery requires the <a href=\"http://php.net/manual/en/book.ctype.php\">PHP Ctype</a> extension. Please install it.";
|
||||
}
|
||||
|
||||
if (self::ini_get_bool("safe_mode")) {
|
||||
$errors[] = "Gallery cannot function when PHP is in <a href=\"http://php.net/manual/en/features.safe-mode.php\">Safe Mode</a>. Please disable safe mode.";
|
||||
}
|
||||
|
||||
return @$errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert any possible boolean ini value to true/false.
|
||||
* On = on = 1 = true
|
||||
* Off = off = 0 = false
|
||||
*/
|
||||
static function ini_get_bool($varname) {
|
||||
$value = ini_get($varname);
|
||||
|
||||
if (!strcasecmp("on", $value) || $value == 1 || $value === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcasecmp("off", $value) || $value == 0 || $value === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<p class="success">
|
||||
Your Gallery 3 install is complete.
|
||||
</p>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Uh oh! </h1>
|
||||
<p class="error">
|
||||
The database you provided already has Gallery 3 tables in it.
|
||||
Continuing with the install would overwrite your existing install.
|
||||
Please either use a different database, delete the old tables,
|
||||
or choose a different table prefix.
|
||||
</p>
|
|
@ -0,0 +1,20 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Whoa there! </h1>
|
||||
|
||||
<p class="error">
|
||||
There are some problems with your web hosting environment
|
||||
that need to be fixed before you can successfully install
|
||||
Gallery 3.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<?php foreach ($errors as $error): ?>
|
||||
<li>
|
||||
<?php print $error ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<a href="index.php">Check again</a>
|
||||
</p>
|
|
@ -0,0 +1,89 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Let's get going! </h1>
|
||||
<p>
|
||||
Installing Gallery is easy. We just need a place to put your photos
|
||||
and info about your MySQL database.
|
||||
</p>
|
||||
|
||||
|
||||
<fieldset class="<?= installer::var_writable() ? 'success' : 'error' ?>">
|
||||
<legend>Photo Storage</legend>
|
||||
<?php if (!installer::var_writable()): ?>
|
||||
<p>
|
||||
We're having trouble creating a place for your photos. Can you
|
||||
help? We need you to create a directory called <em>var</em> in
|
||||
your gallery3 directory. This sample code works for most users.
|
||||
Run it in the gallery3 directory:
|
||||
<code>
|
||||
mkdir var<br>
|
||||
chmod 777 var
|
||||
</code>
|
||||
<a href="index.php">Check again</a>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<p>
|
||||
We've found a place to store your photos:
|
||||
<code class="location"> <?= VARPATH ?> </code>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
</fieldset>
|
||||
|
||||
<?php if (installer::var_writable()): ?>
|
||||
<form method="post" action="index.php?step=save_db_info">
|
||||
<fieldset>
|
||||
<legend>Database</legend>
|
||||
<p>
|
||||
Gallery 3 needs a MySQL database. The values provided work for
|
||||
most setups, so if you're confused try clicking <i>continue</i>.
|
||||
</p>
|
||||
<br/>
|
||||
<table id="db_info">
|
||||
<tr>
|
||||
<td>
|
||||
Database name
|
||||
</td>
|
||||
<td>
|
||||
<input name="dbname" value="gallery3"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
User
|
||||
</td>
|
||||
<td>
|
||||
<input name="dbuser" value="root"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Password
|
||||
</td>
|
||||
<td>
|
||||
<input name="dbpass" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Host
|
||||
</td>
|
||||
<td>
|
||||
<input name="dbhost" value="localhost"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Table prefix <span class="subtext">(optional)</span>
|
||||
</td>
|
||||
<td>
|
||||
<input name="prefix" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" value="Continue"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php endif ?>
|
|
@ -0,0 +1,24 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gallery 3 Installer</title>
|
||||
<link rel="stylesheet" type="text/css" href="install.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="outer">
|
||||
<img src="../modules/gallery/images/gallery.png" />
|
||||
<div id="inner">
|
||||
<?php print $content ?>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>
|
||||
<i>Did something go wrong? Try
|
||||
the <a href="http://codex.gallery2.org/Gallery3:FAQ">FAQ</a>
|
||||
or ask in
|
||||
the <a href="http://gallery.menalto.com/forum">Gallery
|
||||
forums</a>.</i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Uh oh! </h1>
|
||||
<p class="error">
|
||||
We were unable to connect to your MySQL server with the username and
|
||||
password that you provided. Please go back and try again!
|
||||
</p>
|
|
@ -0,0 +1,5 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Uh oh! </h1>
|
||||
<p class="error">
|
||||
Gallery requires at least MySQL version 5.0.0. You're using version <?= installer::mysql_version($config) ?>
|
||||
</p>
|
|
@ -0,0 +1,13 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Can't find that database! </h1>
|
||||
<p class="error">
|
||||
We were able to connect to your MySQL server, yay! But the database
|
||||
name you gave us doesn't exist and we don't have permissions to
|
||||
create it for you. Please create the database manually, then go
|
||||
back and try again.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you're having trouble creating the database, please contact your
|
||||
web host or system administrator for assistance.
|
||||
</p>
|
|
@ -0,0 +1,10 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Oops! </h1>
|
||||
<p>
|
||||
Something unexpected happened and we can't finish your install.
|
||||
We'll try to provide some details about the specific problem below.
|
||||
</p>
|
||||
<p class="error">
|
||||
<?php print $error ?>
|
||||
</p>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h1> Success! </h1>
|
||||
<p class="success">
|
||||
Your Gallery 3 install is complete!
|
||||
</p>
|
||||
|
||||
<?php if (!empty($user)): ?>
|
||||
<h2> Before you start using it... </h2>
|
||||
<p>
|
||||
We've created an account for you to use:
|
||||
<br/>
|
||||
username: <b><?php print $user ?></b>
|
||||
<br/>
|
||||
password: <b><?php print $password ?></b>
|
||||
<br/>
|
||||
<br/>
|
||||
Save this information in a safe place, or change your admin password
|
||||
right away!
|
||||
</p>
|
||||
<?php endif ?>
|
||||
|
||||
<h2> <a href="..">Start using Gallery</a> </h2>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
if (installer::already_installed()) {
|
||||
$content = render("success.html.php");
|
||||
} else {
|
||||
switch (@$_GET["step"]) {
|
||||
default:
|
||||
case "welcome":
|
||||
$errors = installer::check_environment();
|
||||
if ($errors) {
|
||||
$content = render("environment_errors.html.php", array("errors" => $errors));
|
||||
} else {
|
||||
$content = render("get_db_info.html.php");
|
||||
}
|
||||
break;
|
||||
|
||||
case "save_db_info":
|
||||
$config = array("host" => $_POST["dbhost"],
|
||||
"user" => $_POST["dbuser"],
|
||||
"password" => $_POST["dbpass"],
|
||||
"dbname" => $_POST["dbname"],
|
||||
"prefix" => $_POST["prefix"],
|
||||
"type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
|
||||
list ($config["host"], $config["port"]) = explode(":", $config["host"] . ":");
|
||||
|
||||
if (!installer::connect($config)) {
|
||||
$content = render("invalid_db_info.html.php");
|
||||
} else if (!installer::verify_mysql_version($config)) {
|
||||
$content = render("invalid_db_version.html.php");
|
||||
} else if (!installer::select_db($config)) {
|
||||
$content = render("missing_db.html.php");
|
||||
} else if (is_string($count = installer::db_empty($config)) || !$count) {
|
||||
if (is_string($count)) {
|
||||
$content = oops($count);
|
||||
} else {
|
||||
$content = render("db_not_empty.html.php");
|
||||
}
|
||||
} else if (!installer::unpack_var()) {
|
||||
$content = oops("Unable to create files inside the <code>var</code> directory");
|
||||
} else if (!installer::unpack_sql($config)) {
|
||||
$content = oops("Failed to create tables in your database:" . mysql_error());
|
||||
} else if (!installer::create_database_config($config)) {
|
||||
$content = oops("Couldn't create var/database.php");
|
||||
} else {
|
||||
try {
|
||||
list ($user, $password) = installer::create_admin($config);
|
||||
installer::create_admin_session($config);
|
||||
$content = render("success.html.php", array("user" => $user, "password" => $password));
|
||||
|
||||
installer::create_private_key($config);
|
||||
} catch (Exception $e) {
|
||||
$content = oops($e->getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
include("views/install.html.php");
|
||||
|
||||
function render($view, $args=array()) {
|
||||
ob_start();
|
||||
extract($args);
|
||||
include(DOCROOT . "installer/views/" . $view);
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function oops($error) {
|
||||
return render("oops.html.php", array("error" => $error));
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
|
||||
(function(){function log(args){console.log("$f.fireEvent",[].slice.call(args));}
|
||||
function clone(obj){if(!obj||typeof obj!='object'){return obj;}
|
||||
var temp=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key)){temp[key]=clone(obj[key]);}}
|
||||
return temp;}
|
||||
function each(obj,fn){if(!obj){return;}
|
||||
var name,i=0,length=obj.length;if(length===undefined){for(name in obj){if(fn.call(obj[name],name,obj[name])===false){break;}}}else{for(var value=obj[0];i<length&&fn.call(value,i,value)!==false;value=obj[++i]){}}
|
||||
return obj;}
|
||||
function el(id){return document.getElementById(id);}
|
||||
function extend(to,from,skipFuncs){if(typeof from!='object'){return to;}
|
||||
if(to&&from){each(from,function(name,value){if(!skipFuncs||typeof value!='function'){to[name]=value;}});}
|
||||
return to;}
|
||||
function select(query){var index=query.indexOf(".");if(index!=-1){var tag=query.substring(0,index)||"*";var klass=query.substring(index+1,query.length);var els=[];each(document.getElementsByTagName(tag),function(){if(this.className&&this.className.indexOf(klass)!=-1){els.push(this);}});return els;}}
|
||||
function stopEvent(e){e=e||window.event;if(e.preventDefault){e.stopPropagation();e.preventDefault();}else{e.returnValue=false;e.cancelBubble=true;}
|
||||
return false;}
|
||||
function bind(to,evt,fn){to[evt]=to[evt]||[];to[evt].push(fn);}
|
||||
function makeId(){return"_"+(""+Math.random()).substring(2,10);}
|
||||
var Clip=function(json,index,player){var self=this;var cuepoints={};var listeners={};self.index=index;if(typeof json=='string'){json={url:json};}
|
||||
extend(this,json,true);each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var evt="on"+this;if(evt.indexOf("*")!=-1){evt=evt.substring(0,evt.length-1);var before="onBefore"+evt.substring(2);self[before]=function(fn){bind(listeners,before,fn);return self;};}
|
||||
self[evt]=function(fn){bind(listeners,evt,fn);return self;};if(index==-1){if(self[before]){player[before]=self[before];}
|
||||
if(self[evt]){player[evt]=self[evt];}}});extend(this,{onCuepoint:function(points,fn){if(arguments.length==1){cuepoints.embedded=[null,points];return self;}
|
||||
if(typeof points=='number'){points=[points];}
|
||||
var fnId=makeId();cuepoints[fnId]=[points,fn];if(player.isLoaded()){player._api().fp_addCuepoints(points,index,fnId);}
|
||||
return self;},update:function(json){extend(self,json);if(player.isLoaded()){player._api().fp_updateClip(json,index);}
|
||||
var conf=player.getConfig();var clip=(index==-1)?conf.clip:conf.playlist[index];extend(clip,json,true);},_fireEvent:function(evt,arg1,arg2,target){if(evt=='onLoad'){each(cuepoints,function(key,val){if(val[0]){player._api().fp_addCuepoints(val[0],index,key);}});return false;}
|
||||
target=target||self;if(evt=='onCuepoint'){var fn=cuepoints[arg1];if(fn){return fn[1].call(player,target,arg2);}}
|
||||
if(arg1&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(evt)!=-1){extend(target,arg1);if(arg1.metaData){if(!target.duration){target.duration=arg1.metaData.duration;}else{target.fullDuration=arg1.metaData.duration;}}}
|
||||
var ret=true;each(listeners[evt],function(){ret=this.call(player,target,arg1,arg2);});return ret;}});if(json.onCuepoint){var arg=json.onCuepoint;self.onCuepoint.apply(self,typeof arg=='function'?[arg]:arg);delete json.onCuepoint;}
|
||||
each(json,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete json[key];}});if(index==-1){player.onCuepoint=this.onCuepoint;}};var Plugin=function(name,json,player,fn){var listeners={};var self=this;var hasMethods=false;if(fn){extend(listeners,fn);}
|
||||
each(json,function(key,val){if(typeof val=='function'){listeners[key]=val;delete json[key];}});extend(this,{animate:function(props,speed,fn){if(!props){return self;}
|
||||
if(typeof speed=='function'){fn=speed;speed=500;}
|
||||
if(typeof props=='string'){var key=props;props={};props[key]=speed;speed=500;}
|
||||
if(fn){var fnId=makeId();listeners[fnId]=fn;}
|
||||
if(speed===undefined){speed=500;}
|
||||
json=player._api().fp_animate(name,props,speed,fnId);return self;},css:function(props,val){if(val!==undefined){var css={};css[props]=val;props=css;}
|
||||
json=player._api().fp_css(name,props);extend(self,json);return self;},show:function(){this.display='block';player._api().fp_showPlugin(name);return self;},hide:function(){this.display='none';player._api().fp_hidePlugin(name);return self;},toggle:function(){this.display=player._api().fp_togglePlugin(name);return self;},fadeTo:function(o,speed,fn){if(typeof speed=='function'){fn=speed;speed=500;}
|
||||
if(fn){var fnId=makeId();listeners[fnId]=fn;}
|
||||
this.display=player._api().fp_fadeTo(name,o,speed,fnId);this.opacity=o;return self;},fadeIn:function(speed,fn){return self.fadeTo(1,speed,fn);},fadeOut:function(speed,fn){return self.fadeTo(0,speed,fn);},getName:function(){return name;},getPlayer:function(){return player;},_fireEvent:function(evt,arg,arg2){if(evt=='onUpdate'){var json=player._api().fp_getPlugin(name);if(!json){return;}
|
||||
extend(self,json);delete self.methods;if(!hasMethods){each(json.methods,function(){var method=""+this;self[method]=function(){var a=[].slice.call(arguments);var ret=player._api().fp_invoke(name,method,a);return ret==='undefined'||ret===undefined?self:ret;};});hasMethods=true;}}
|
||||
var fn=listeners[evt];if(fn){fn.apply(self,arg);if(evt.substring(0,1)=="_"){delete listeners[evt];}}}});};function Player(wrapper,params,conf){var
|
||||
self=this,api=null,html,commonClip,playlist=[],plugins={},listeners={},playerId,apiId,playerIndex,activeIndex,swfHeight,wrapperHeight;extend(self,{id:function(){return playerId;},isLoaded:function(){return(api!==null);},getParent:function(){return wrapper;},hide:function(all){if(all){wrapper.style.height="0px";}
|
||||
if(api){api.style.height="0px";}
|
||||
return self;},show:function(){wrapper.style.height=wrapperHeight+"px";if(api){api.style.height=swfHeight+"px";}
|
||||
return self;},isHidden:function(){return api&&parseInt(api.style.height,10)===0;},load:function(fn){if(!api&&self._fireEvent("onBeforeLoad")!==false){each(players,function(){this.unload();});html=wrapper.innerHTML;if(html&&!flashembed.isSupported(params.version)){wrapper.innerHTML="";}
|
||||
flashembed(wrapper,params,{config:conf});if(fn){fn.cached=true;bind(listeners,"onLoad",fn);}}
|
||||
return self;},unload:function(){if(html.replace(/\s/g,'')!==''){if(self._fireEvent("onBeforeUnload")===false){return self;}
|
||||
try{if(api){api.fp_close();self._fireEvent("onUnload");}}catch(error){}
|
||||
api=null;wrapper.innerHTML=html;}
|
||||
return self;},getClip:function(index){if(index===undefined){index=activeIndex;}
|
||||
return playlist[index];},getCommonClip:function(){return commonClip;},getPlaylist:function(){return playlist;},getPlugin:function(name){var plugin=plugins[name];if(!plugin&&self.isLoaded()){var json=self._api().fp_getPlugin(name);if(json){plugin=new Plugin(name,json,self);plugins[name]=plugin;}}
|
||||
return plugin;},getScreen:function(){return self.getPlugin("screen");},getControls:function(){return self.getPlugin("controls");},getConfig:function(copy){return copy?clone(conf):conf;},getFlashParams:function(){return params;},loadPlugin:function(name,url,props,fn){if(typeof props=='function'){fn=props;props={};}
|
||||
var fnId=fn?makeId():"_";self._api().fp_loadPlugin(name,url,props,fnId);var arg={};arg[fnId]=fn;var p=new Plugin(name,null,self,arg);plugins[name]=p;return p;},getState:function(){return api?api.fp_getState():-1;},play:function(clip,instream){function play(){if(clip!==undefined){self._api().fp_play(clip,instream);}else{self._api().fp_play();}}
|
||||
if(api){play();}else{self.load(function(){play();});}
|
||||
return self;},getVersion:function(){var js="flowplayer.js 3.1.4";if(api){var ver=api.fp_getVersion();ver.push(js);return ver;}
|
||||
return js;},_api:function(){if(!api){throw"Flowplayer "+self.id()+" not loaded when calling an API method";}
|
||||
return api;},setClip:function(clip){self.setPlaylist([clip]);return self;},getIndex:function(){return playerIndex;}});each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var name="on"+this;if(name.indexOf("*")!=-1){name=name.substring(0,name.length-1);var name2="onBefore"+name.substring(2);self[name2]=function(fn){bind(listeners,name2,fn);return self;};}
|
||||
self[name]=function(fn){bind(listeners,name,fn);return self;};});each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed").split(","),function(){var name=this;self[name]=function(a1,a2){if(!api){return self;}
|
||||
var ret=null;if(a1!==undefined&&a2!==undefined){ret=api["fp_"+name](a1,a2);}else{ret=(a1===undefined)?api["fp_"+name]():api["fp_"+name](a1);}
|
||||
return ret==='undefined'||ret===undefined?self:ret;};});self._fireEvent=function(a){if(typeof a=='string'){a=[a];}
|
||||
var evt=a[0],arg0=a[1],arg1=a[2],arg2=a[3],i=0;if(conf.debug){log(a);}
|
||||
if(!api&&evt=='onLoad'&&arg0=='player'){api=api||el(apiId);swfHeight=api.clientHeight;each(playlist,function(){this._fireEvent("onLoad");});each(plugins,function(name,p){p._fireEvent("onUpdate");});commonClip._fireEvent("onLoad");}
|
||||
if(evt=='onLoad'&&arg0!='player'){return;}
|
||||
if(evt=='onError'){if(typeof arg0=='string'||(typeof arg0=='number'&&typeof arg1=='number')){arg0=arg1;arg1=arg2;}}
|
||||
if(evt=='onContextMenu'){each(conf.contextMenu[arg0],function(key,fn){fn.call(self);});return;}
|
||||
if(evt=='onPluginEvent'){var name=arg0.name||arg0;var p=plugins[name];if(p){p._fireEvent("onUpdate",arg0);p._fireEvent(arg1,a.slice(3));}
|
||||
return;}
|
||||
if(evt=='onPlaylistReplace'){playlist=[];var index=0;each(arg0,function(){playlist.push(new Clip(this,index++,self));});}
|
||||
if(evt=='onClipAdd'){if(arg0.isInStream){return;}
|
||||
arg0=new Clip(arg0,arg1,self);playlist.splice(arg1,0,arg0);for(i=arg1+1;i<playlist.length;i++){playlist[i].index++;}}
|
||||
var ret=true;if(typeof arg0=='number'&&arg0<playlist.length){activeIndex=arg0;var clip=playlist[arg0];if(clip){ret=clip._fireEvent(evt,arg1,arg2);}
|
||||
if(!clip||ret!==false){ret=commonClip._fireEvent(evt,arg1,arg2,clip);}}
|
||||
each(listeners[evt],function(){ret=this.call(self,arg0,arg1);if(this.cached){listeners[evt].splice(i,1);}
|
||||
if(ret===false){return false;}
|
||||
i++;});return ret;};function init(){if($f(wrapper)){$f(wrapper).getParent().innerHTML="";playerIndex=$f(wrapper).getIndex();players[playerIndex]=self;}else{players.push(self);playerIndex=players.length-1;}
|
||||
wrapperHeight=parseInt(wrapper.style.height,10)||wrapper.clientHeight;if(typeof params=='string'){params={src:params};}
|
||||
playerId=wrapper.id||"fp"+makeId();apiId=params.id||playerId+"_api";params.id=apiId;conf.playerId=playerId;if(typeof conf=='string'){conf={clip:{url:conf}};}
|
||||
if(typeof conf.clip=='string'){conf.clip={url:conf.clip};}
|
||||
conf.clip=conf.clip||{};if(wrapper.getAttribute("href",2)&&!conf.clip.url){conf.clip.url=wrapper.getAttribute("href",2);}
|
||||
commonClip=new Clip(conf.clip,-1,self);conf.playlist=conf.playlist||[conf.clip];var index=0;each(conf.playlist,function(){var clip=this;if(typeof clip=='object'&&clip.length){clip={url:""+clip};}
|
||||
each(conf.clip,function(key,val){if(val!==undefined&&clip[key]===undefined&&typeof val!='function'){clip[key]=val;}});conf.playlist[index]=clip;clip=new Clip(clip,index,self);playlist.push(clip);index++;});each(conf,function(key,val){if(typeof val=='function'){if(commonClip[key]){commonClip[key](val);}else{bind(listeners,key,val);}
|
||||
delete conf[key];}});each(conf.plugins,function(name,val){if(val){plugins[name]=new Plugin(name,val,self);}});if(!conf.plugins||conf.plugins.controls===undefined){plugins.controls=new Plugin("controls",null,self);}
|
||||
plugins.canvas=new Plugin("canvas",null,self);params.bgcolor=params.bgcolor||"#000000";params.version=params.version||[9,0];params.expressInstall='http://www.flowplayer.org/swf/expressinstall.swf';function doClick(e){if(!self.isLoaded()&&self._fireEvent("onBeforeClick")!==false){self.load();}
|
||||
return stopEvent(e);}
|
||||
html=wrapper.innerHTML;if(html.replace(/\s/g,'')!==''){if(wrapper.addEventListener){wrapper.addEventListener("click",doClick,false);}else if(wrapper.attachEvent){wrapper.attachEvent("onclick",doClick);}}else{if(wrapper.addEventListener){wrapper.addEventListener("click",stopEvent,false);}
|
||||
self.load();}}
|
||||
if(typeof wrapper=='string'){flashembed.domReady(function(){var node=el(wrapper);if(!node){throw"Flowplayer cannot access element: "+wrapper;}else{wrapper=node;init();}});}else{init();}}
|
||||
var players=[];function Iterator(arr){this.length=arr.length;this.each=function(fn){each(arr,fn);};this.size=function(){return arr.length;};}
|
||||
window.flowplayer=window.$f=function(){var instance=null;var arg=arguments[0];if(!arguments.length){each(players,function(){if(this.isLoaded()){instance=this;return false;}});return instance||players[0];}
|
||||
if(arguments.length==1){if(typeof arg=='number'){return players[arg];}else{if(arg=='*'){return new Iterator(players);}
|
||||
each(players,function(){if(this.id()==arg.id||this.id()==arg||this.getParent()==arg){instance=this;return false;}});return instance;}}
|
||||
if(arguments.length>1){var swf=arguments[1];var conf=(arguments.length==3)?arguments[2]:{};if(typeof arg=='string'){if(arg.indexOf(".")!=-1){var instances=[];each(select(arg),function(){instances.push(new Player(this,clone(swf),clone(conf)));});return new Iterator(instances);}else{var node=el(arg);return new Player(node!==null?node:arg,swf,conf);}}else if(arg){return new Player(arg,swf,conf);}}
|
||||
return null;};extend(window.$f,{fireEvent:function(){var a=[].slice.call(arguments);var p=$f(a[0]);return p?p._fireEvent(a.slice(1)):null;},addPlugin:function(name,fn){Player.prototype[name]=fn;return $f;},each:each,extend:extend});if(typeof jQuery=='function'){jQuery.prototype.flowplayer=function(params,conf){if(!arguments.length||typeof arguments[0]=='number'){var arr=[];this.each(function(){var p=$f(this);if(p){arr.push(p);}});return arguments.length?arr[arguments[0]]:new Iterator(arr);}
|
||||
return this.each(function(){$f(this,clone(params),conf?clone(conf):{});});};}})();(function(){var jQ=typeof jQuery=='function';var options={width:'100%',height:'100%',allowfullscreen:true,allowscriptaccess:'always',quality:'high',version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(jQ){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:'1.0.4',conf:options};}
|
||||
function isDomReady(){if(domReady.done){return false;}
|
||||
var d=document;if(d&&d.getElementsByTagName&&d.getElementById&&d.body){clearInterval(domReady.timer);domReady.timer=null;for(var i=0;i<domReady.ready.length;i++){domReady.ready[i].call();}
|
||||
domReady.ready=null;domReady.done=true;}}
|
||||
var domReady=jQ?jQuery:function(f){if(domReady.done){return f();}
|
||||
if(domReady.timer){domReady.ready.push(f);}else{domReady.ready=[f];domReady.timer=setInterval(isDomReady,13);}};function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}
|
||||
return to;}
|
||||
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function string2JsonString(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
|
||||
function asString(obj){switch(typeOf(obj)){case'string':return string2JsonString(obj);case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}
|
||||
return'{'+str.join(',')+'}';}
|
||||
return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}
|
||||
function typeOf(obj){if(obj===null||obj===undefined){return false;}
|
||||
var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}
|
||||
if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}
|
||||
function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}
|
||||
return newArr;}
|
||||
function getHTML(p,c){var e=extend({},p);var ie=document.all;var html='<object width="'+e.width+'" height="'+e.height+'"';if(ie&&!e.id){e.id="_"+(""+Math.random()).substring(9);}
|
||||
if(e.id){html+=' id="'+e.id+'"';}
|
||||
if(e.cachebusting){e.src+=((e.src.indexOf("?")!=-1?"&":"?")+Math.random());}
|
||||
if(e.w3c||!ie){html+=' data="'+e.src+'" type="application/x-shockwave-flash"';}else{html+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';}
|
||||
html+='>';if(e.w3c||ie){html+='<param name="movie" value="'+e.src+'" />';}
|
||||
e.width=e.height=e.id=e.w3c=e.src=null;for(var k in e){if(e[k]!==null){html+='<param name="'+k+'" value="'+e[k]+'" />';}}
|
||||
var vars="";if(c){for(var key in c){if(c[key]!==null){vars+=encodeURIComponent(key)+'='
|
||||
+encodeURIComponent(typeof c[key]=='object'?asString(c[key]):c[key])
|
||||
+'&';}}
|
||||
vars=vars.substring(0,vars.length-1);html+='<param name="flashvars" value="'+vars+'" />';}
|
||||
html+="</object>";return html;}
|
||||
function Flash(root,opts,flashvars){var version=flashembed.getVersion();extend(this,{getContainer:function(){return root;},getConf:function(){return opts;},getVersion:function(){return version;},getFlashvars:function(){return flashvars;},getApi:function(){return root.firstChild;},getHTML:function(){return getHTML(opts,flashvars);}});var required=opts.version;var express=opts.expressInstall;var ok=!required||flashembed.isSupported(required);if(ok){opts.onFail=opts.version=opts.expressInstall=null;root.innerHTML=getHTML(opts,flashvars);}else if(required&&express&&flashembed.isSupported([6,65])){extend(opts,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML(opts,flashvars);}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+
|
||||
(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+
|
||||
(root.tagName=='A'?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(root.tagName=='A'){root.onclick=function(){location.href='http://www.adobe.com/go/getflashplayer';};}}}
|
||||
if(!ok&&opts.onFail){var ret=opts.onFail.call(this);if(typeof ret=='string'){root.innerHTML=ret;}}
|
||||
if(document.all){window[opts.id]=document.getElementById(opts.id);}}
|
||||
window.flashembed=function(root,conf,flashvars){if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{domReady(function(){flashembed(root,conf,flashvars);});return;}}
|
||||
if(!root){return;}
|
||||
if(typeof conf=='string'){conf={src:conf};}
|
||||
var opts=extend({},options);extend(opts,conf);return new Flash(root,opts,flashvars);};extend(window.flashembed,{getVersion:function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return version;}}
|
||||
try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}
|
||||
if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}
|
||||
return version;},isSupported:function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;},domReady:domReady,asString:asString,getHTML:getHTML});if(jQ){jQuery.fn.flashembed=function(conf,flashvars){var el=null;this.each(function(){el=flashembed(this,conf,flashvars);});return conf.api===false?this:el;};}})();
|
|
@ -0,0 +1,15 @@
|
|||
(function($) {
|
||||
$.widget("ui.gallery_ajax", {
|
||||
_init: function() {
|
||||
this.element.click(function(event) {
|
||||
eval("var ajax_handler = " + $(event.currentTarget).attr("ajax_handler"));
|
||||
$.get($(event.currentTarget).attr("href"), function(data) {
|
||||
eval("var data = " + data);
|
||||
ajax_handler(data);
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,224 @@
|
|||
(function ($) {
|
||||
|
||||
// Fade in action status message background color
|
||||
$.fn.gallery_show_message = function() {
|
||||
return this.each(function(i){
|
||||
$(this).hide().fadeIn(3000)
|
||||
});
|
||||
};
|
||||
|
||||
// Make the height of all items the same as the tallest item within the set
|
||||
$.fn.equal_heights = function() {
|
||||
var tallest_height = 0;
|
||||
$(this).each(function(){
|
||||
if ($(this).height() > tallest_height) {
|
||||
tallest_height = $(this).height();
|
||||
}
|
||||
});
|
||||
return $(this).height(tallest_height);
|
||||
};
|
||||
|
||||
// Vertically align a block element's content
|
||||
$.fn.gallery_valign = function(container) {
|
||||
return this.each(function(i){
|
||||
if (container == null) {
|
||||
container = 'div';
|
||||
}
|
||||
var el = $(this).find(".g-valign");
|
||||
if (!el.length) {
|
||||
$(this).html("<" + container + " class=\"g-valign\">" + $(this).html() +
|
||||
"</" + container + ">");
|
||||
el = $(this).children(container + ".g-valign");
|
||||
}
|
||||
var elh = $(el).height();
|
||||
var ph = $(this).height();
|
||||
var nh = (ph - elh) / 2;
|
||||
$(el).css('margin-top', nh);
|
||||
});
|
||||
};
|
||||
|
||||
// Get the viewport size
|
||||
$.gallery_get_viewport_size = function() {
|
||||
return {
|
||||
width : function() {
|
||||
return $(window).width();
|
||||
},
|
||||
height : function() {
|
||||
return $(window).height();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle the processing indicator, both large and small
|
||||
* @param elementID Target ID, including #, to apply .g-loading-size
|
||||
*/
|
||||
$.fn.gallery_show_loading = function() {
|
||||
return this.each(function(i){
|
||||
var size;
|
||||
switch ($(this).attr("id")) {
|
||||
case "#g-dialog":
|
||||
case "#g-panel":
|
||||
size = "large";
|
||||
break;
|
||||
default:
|
||||
size = "small";
|
||||
break;
|
||||
}
|
||||
$(this).toggleClass("g-loading-" + size);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Reduce the width of an image if it's wider than its parent container
|
||||
* @param elementID The image container's ID
|
||||
*/
|
||||
$.fn.gallery_fit_photo = function() {
|
||||
return this.each(function(i) {
|
||||
var container_width = $(this).width();
|
||||
var photo = $(this).gallery_get_photo();
|
||||
var photo_width = photo.width();
|
||||
if (container_width < photo_width) {
|
||||
var proportion = container_width / photo_width;
|
||||
photo.width(container_width);
|
||||
photo.height(proportion * photo.height());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a thumbnail or resize photo within a container
|
||||
* @param elementID The image container's ID
|
||||
* @return object
|
||||
*/
|
||||
$.fn.gallery_get_photo = function() {
|
||||
var photo = $(this).find("img,object").filter(function() {
|
||||
return this.id.match(/g-(photo|movie)-id-\d+/);
|
||||
});
|
||||
return photo;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the sum of an element's height, margin-top, and margin-bottom
|
||||
* @param elementID the element's ID
|
||||
* @return int
|
||||
*/
|
||||
$.fn.gallery_height = function() {
|
||||
var ht = $(this).height();
|
||||
var mt = parseInt($(this).css("margin-top"));
|
||||
var mb = parseInt($(this).css("margin-bottom"));
|
||||
return ht + parseInt(mt) + parseInt(mb);
|
||||
};
|
||||
|
||||
// Add hover state to buttons
|
||||
$.fn.gallery_hover_init = function() {
|
||||
$(".ui-state-default").hover(
|
||||
function(){
|
||||
$(this).addClass("ui-state-hover");
|
||||
},
|
||||
function(){
|
||||
$(this).removeClass("ui-state-hover");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// Ajax handler for replacing an image, used in Ajax thumbnail rotation
|
||||
$.gallery_replace_image = function(data, img_selector) {
|
||||
$(img_selector).attr({src: data.src, width: data.width, height: data.height});
|
||||
$(img_selector).trigger("gallery.change");
|
||||
};
|
||||
|
||||
// Initialize context menus
|
||||
$.fn.gallery_context_menu = function() {
|
||||
if ($(".g-context-menu li").length) {
|
||||
var hover_target = $(this).find(".g-context-menu");
|
||||
if (hover_target.attr("context_menu_initialized")) {
|
||||
return;
|
||||
}
|
||||
var list = $(hover_target).find("ul");
|
||||
hover_target.find("*").removeAttr('title');
|
||||
list.hide();
|
||||
hover_target.hover(
|
||||
function() {
|
||||
list.stop(true, true).slideDown("fast");
|
||||
$(this).find(".g-dialog-link").gallery_dialog();
|
||||
$(this).find(".g-ajax-link").gallery_ajax();
|
||||
},
|
||||
function() {
|
||||
list.stop(true, true).slideUp("slow");
|
||||
}
|
||||
);
|
||||
hover_target.attr("context_menu_initialized", 1);
|
||||
}
|
||||
};
|
||||
|
||||
// Size a container to fit within the browser window
|
||||
$.gallery_auto_fit_window = function(imageWidth, imageHeight) {
|
||||
var size = $.gallery_get_viewport_size();
|
||||
var width = size.width() - 6,
|
||||
height = size.height() - 6;
|
||||
|
||||
var ratio = width / imageWidth;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
|
||||
/* after scaling the width, check that the height fits */
|
||||
if (imageHeight > height) {
|
||||
ratio = height / imageHeight;
|
||||
imageWidth *= ratio;
|
||||
imageHeight *= ratio;
|
||||
}
|
||||
|
||||
// handle the case where the calculation is almost zero (2.14e-14)
|
||||
return {
|
||||
top: Math.round((height - imageHeight) / 2),
|
||||
left: Math.round((width - imageWidth) / 2),
|
||||
width: Math.round(imageWidth),
|
||||
height: Math.round(imageHeight)
|
||||
};
|
||||
};
|
||||
|
||||
// Initialize a short form. Short forms may contain only one text input.
|
||||
$.fn.gallery_short_form = function() {
|
||||
return this.each(function(i){
|
||||
var label = $(this).find("label:first");
|
||||
var input = $(this).find("input[type=text]:first");
|
||||
var button = $(this).find("input[type=submit]");
|
||||
|
||||
$(".g-short-form").addClass("ui-helper-clearfix");
|
||||
|
||||
// Place button's on the left for RTL languages
|
||||
if ($(".rtl").length) {
|
||||
$(".g-short-form input[type=text]").addClass("ui-corner-right");
|
||||
$(".g-short-form input[type=submit]").addClass("ui-state-default ui-corner-left");
|
||||
} else {
|
||||
$(".g-short-form input[type=text]").addClass("ui-corner-left");
|
||||
$(".g-short-form input[type=submit]").addClass("ui-state-default ui-corner-right");
|
||||
}
|
||||
|
||||
// Set the input value equal to label text
|
||||
if (input.val() == "") {
|
||||
input.val(label.html());
|
||||
button.enable(false);
|
||||
}
|
||||
|
||||
// Attach event listeners to the input
|
||||
input.bind("focus", function(e) {
|
||||
// Empty input value if it equals it's label
|
||||
if ($(this).val() == label.html()) {
|
||||
$(this).val("");
|
||||
}
|
||||
button.enable(true);
|
||||
});
|
||||
|
||||
input.bind("blur", function(e){
|
||||
// Reset the input value if it's empty
|
||||
if ($(this).val() == "") {
|
||||
$(this).val(label.html());
|
||||
button.enable(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -0,0 +1,210 @@
|
|||
|
||||
(function($) {
|
||||
$.widget("ui.gallery_dialog", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
if (!self.options.immediate) {
|
||||
this.element.click(function(event) {
|
||||
event.preventDefault();
|
||||
self._show($(event.currentTarget).attr("href"));
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
self._show(this.element.attr("href"));
|
||||
}
|
||||
},
|
||||
|
||||
_show: function(sHref) {
|
||||
var self = this;
|
||||
var eDialog = '<div id="g-dialog"></div>';
|
||||
|
||||
if ($("#g-dialog").length) {
|
||||
$("#g-dialog").dialog("close");
|
||||
}
|
||||
$("body").append(eDialog);
|
||||
|
||||
if (!self.options.close) {
|
||||
self.options.close = self.close_dialog;
|
||||
}
|
||||
$("#g-dialog").dialog(self.options);
|
||||
|
||||
$("#g-dialog").gallery_show_loading();
|
||||
|
||||
$.ajax({
|
||||
url: sHref,
|
||||
type: "GET",
|
||||
beforeSend: function(xhr) {
|
||||
// Until we convert to jquery 1.4, we need to save the XMLHttpRequest object so that we
|
||||
// can detect the mime type of the reply
|
||||
this.xhrData = xhr;
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
// Pre jquery 1.4, get the saved XMLHttpRequest object
|
||||
if (xhr == undefined) {
|
||||
xhr = this.xhrData;
|
||||
}
|
||||
var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type"));
|
||||
|
||||
var content = "";
|
||||
if (mimeType[1] == "application/json") {
|
||||
data = JSON.parse(data);
|
||||
content = unescape(data.html);
|
||||
} else {
|
||||
content = data;
|
||||
}
|
||||
|
||||
$("#g-dialog").html(content).gallery_show_loading();
|
||||
|
||||
if ($("#g-dialog form").length) {
|
||||
self.form_loaded(null, $("#g-dialog form"));
|
||||
}
|
||||
self._layout();
|
||||
|
||||
$("#g-dialog").dialog("open");
|
||||
self._set_title();
|
||||
|
||||
if ($("#g-dialog form").length) {
|
||||
self._ajaxify_dialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#g-dialog").dialog("option", "self", self);
|
||||
},
|
||||
|
||||
_layout: function() {
|
||||
var dialogWidth;
|
||||
var dialogHeight = $("#g-dialog").height();
|
||||
var cssWidth = new String($("#g-dialog form").css("width"));
|
||||
var childWidth = cssWidth.replace(/[^0-9]/g,"");
|
||||
var size = $.gallery_get_viewport_size();
|
||||
if ($("#g-dialog iframe").length) {
|
||||
dialogWidth = size.width() - 100;
|
||||
// Set the iframe width and height
|
||||
$("#g-dialog iframe").width("100%").height(size.height() - 100);
|
||||
} else if ($("#g-dialog .g-dialog-panel").length) {
|
||||
dialogWidth = size.width() - 100;
|
||||
$("#g-dialog").dialog("option", "height", size.height() - 100);
|
||||
} else if (childWidth == "" || childWidth > 300) {
|
||||
dialogWidth = 500;
|
||||
}
|
||||
$("#g-dialog").dialog('option', 'width', dialogWidth);
|
||||
},
|
||||
|
||||
form_loaded: function(event, ui) {
|
||||
// Should be defined (and localized) in the theme
|
||||
MSG_CANCEL = MSG_CANCEL || 'Cancel';
|
||||
var eCancel = '<a href="#" class="g-cancel g-left">' + MSG_CANCEL + '</a>';
|
||||
if ($("#g-dialog .submit").length) {
|
||||
$("#g-dialog .submit").addClass("ui-state-default ui-corner-all");
|
||||
$.fn.gallery_hover_init();
|
||||
$("#g-dialog .submit").parent().append(eCancel);
|
||||
$("#g-dialog .g-cancel").click(function(event) {
|
||||
$("#g-dialog").dialog("close");
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
$("#g-dialog .ui-state-default").hover(
|
||||
function() {
|
||||
$(this).addClass("ui-state-hover");
|
||||
},
|
||||
function() {
|
||||
$(this).removeClass("ui-state-hover");
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
close_dialog: function(event, ui) {
|
||||
var self = $("#g-dialog").dialog("option", "self");
|
||||
if ($("#g-dialog form").length) {
|
||||
self._trigger("form_closing", null, $("#g-dialog form"));
|
||||
}
|
||||
self._trigger("dialog_closing", null, $("#g-dialog"));
|
||||
$("#g-dialog").dialog("destroy").remove();
|
||||
},
|
||||
|
||||
_ajaxify_dialog: function() {
|
||||
var self = this;
|
||||
$("#g-dialog form").ajaxForm({
|
||||
beforeSubmit: function(formData, form, options) {
|
||||
form.find(":submit")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
return true;
|
||||
},
|
||||
beforeSend: function(xhr) {
|
||||
// Until we convert to jquery 1.4, we need to save the XMLHttpRequest object so that we
|
||||
// can detect the mime type of the reply
|
||||
this.xhrData = xhr;
|
||||
},
|
||||
success: function(data) {
|
||||
// Pre jquery 1.4, get the saved XMLHttpRequest object
|
||||
xhr = this.xhrData;
|
||||
if (xhr) {
|
||||
var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type"));
|
||||
|
||||
var content = "";
|
||||
if (mimeType[1] == "application/json") {
|
||||
data = JSON.parse(data);
|
||||
} else {
|
||||
data = {"html": escape(data)};
|
||||
}
|
||||
} else {
|
||||
// Uploading files (eg: watermark) uses a fake xhr in jquery.form.js so
|
||||
// all we have is in the data field, which should be some very simple JSON.
|
||||
// Weirdly enough in Chrome the result gets wrapped in a <pre> element and
|
||||
// looks like this:
|
||||
// <pre style="word-wrap: break-word; white-space: pre-wrap;">{"result":"success",
|
||||
// "location":"\/~bharat\/gallery3\/index.php\/admin\/watermarks"}</pre>
|
||||
// bizarre. Strip that off before parsing.
|
||||
data = JSON.parse(data.match("({.*})")[0]);
|
||||
}
|
||||
|
||||
if (data.html) {
|
||||
$("#g-dialog").html(unescape(data.html));
|
||||
$("#g-dialog").dialog("option", "position", "center");
|
||||
$("#g-dialog form :submit").removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
self._set_title();
|
||||
self._ajaxify_dialog();
|
||||
self.form_loaded(null, $("#g-dialog form"));
|
||||
if (typeof data.reset == 'function') {
|
||||
eval(data.reset + '()');
|
||||
}
|
||||
}
|
||||
if (data.result == "success") {
|
||||
if (data.location) {
|
||||
window.location = data.location;
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_set_title: function() {
|
||||
// Remove titlebar for progress dialogs or set title
|
||||
if ($("#g-dialog #g-progress").length) {
|
||||
$(".ui-dialog-titlebar").remove();
|
||||
} else if ($("#g-dialog h1").length) {
|
||||
$("#g-dialog").dialog('option', 'title', $("#g-dialog h1:eq(0)").html());
|
||||
$("#g-dialog h1:eq(0)").hide();
|
||||
} else if ($("#g-dialog fieldset legend").length) {
|
||||
$("#g-dialog").dialog('option', 'title', $("#g-dialog fieldset legend:eq(0)").html());
|
||||
}
|
||||
},
|
||||
|
||||
form_closing: function(event, ui) {},
|
||||
dialog_closing: function(event, ui) {}
|
||||
});
|
||||
|
||||
$.extend($.ui.gallery_dialog, {
|
||||
defaults: {
|
||||
autoOpen: false,
|
||||
autoResize: true,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
position: "center"
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,75 @@
|
|||
(function($) {
|
||||
$.widget("ui.gallery_in_place_edit", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
this.element.click(function(event) {
|
||||
event.preventDefault();
|
||||
self._show(event.currentTarget);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
_show: function(target) {
|
||||
if ($(target).data("gallery_in_place_edit") == true) {
|
||||
return;
|
||||
}
|
||||
$(target).data("gallery_in_place_edit", true);
|
||||
var self = this;
|
||||
var tag_width = $(target).width();
|
||||
$(self).data("tag_width", tag_width);
|
||||
|
||||
var form = $("#g-in-place-edit-form");
|
||||
if (form.length > 0) {
|
||||
self._cancel();
|
||||
}
|
||||
|
||||
$.get(self.options.form_url.replace("__ID__", $(target).attr('rel')), function(data) {
|
||||
var parent = $(target).parent();
|
||||
parent.children().hide();
|
||||
parent.append(data);
|
||||
self._setup_form(parent.find("form"));
|
||||
});
|
||||
},
|
||||
|
||||
_setup_form: function(form) {
|
||||
var self = this;
|
||||
var width = $(self).data("tag_width");
|
||||
form.find(":text").width(width).focus();
|
||||
form.find(".g-cancel").click(function(event) {
|
||||
self._cancel();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
$(".g-short-form").gallery_short_form();
|
||||
this._ajaxify_edit();
|
||||
},
|
||||
|
||||
_cancel: function() {
|
||||
var parent = $("#g-in-place-edit-form").parent();
|
||||
$("#g-in-place-edit-form").remove();
|
||||
$(parent).children().show();
|
||||
$(parent).find(".g-editable").data("gallery_in_place_edit", false);
|
||||
},
|
||||
|
||||
_ajaxify_edit: function() {
|
||||
var self = this;
|
||||
var form = $("#g-in-place-edit-form");
|
||||
$(form).ajaxForm({
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.result == "success") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
var parent = $(form).parent();
|
||||
$(form).replaceWith(data.form);
|
||||
self._setup_form(parent.find("form"));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.ui.gallery_in_place_edit, {
|
||||
defaults: {}
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,100 @@
|
|||
(function($) {
|
||||
$.widget("ui.gallery_panel", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
this.element.click(function(event) {
|
||||
event.preventDefault();
|
||||
var element = event.currentTarget;
|
||||
var parent = $(element).parent().parent();
|
||||
var sHref = $(element).attr("href");
|
||||
var parentClass = $(parent).attr("class");
|
||||
var ePanel = "<tr id=\"g-panel\"><td colspan=\"6\"></td></tr>";
|
||||
|
||||
// We keep track of the open vs. closed state by looking to see if there'
|
||||
// an orig_text attr. If that attr is missing, then the panel is closed
|
||||
// and we want to open it
|
||||
var should_open = !$(element).attr("orig_text");
|
||||
|
||||
// Close any open panels and reset their button text
|
||||
if ($("#g-panel").length) {
|
||||
$("#g-panel").slideUp("slow").remove();
|
||||
$.each($(".g-panel-link"),
|
||||
function() {
|
||||
if ($(this).attr("orig_text")) {
|
||||
$(this).children(".g-button-text").text($(this).attr("orig_text"));
|
||||
$(this).attr("orig_text", "");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (should_open) {
|
||||
$(parent).after(ePanel);
|
||||
$("#g-panel td").html(sHref);
|
||||
$.ajax({
|
||||
url: sHref,
|
||||
type: "GET",
|
||||
beforeSend: function(xhr) {
|
||||
// Until we convert to jquery 1.4, we need to save the
|
||||
// XMLHttpRequest object
|
||||
this.xhrData = xhr;
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
// Pre jquery 1.4, get the saved XMLHttpRequest object
|
||||
if (xhr == undefined) {
|
||||
xhr = this.xhrData;
|
||||
}
|
||||
var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type"));
|
||||
var content = "";
|
||||
if (mimeType[1] == "application/json") {
|
||||
data = JSON.parse(data);
|
||||
content = unescape(data.html);
|
||||
} else {
|
||||
content = data;
|
||||
}
|
||||
|
||||
$("#g-panel td").html(content);
|
||||
self._ajaxify_panel();
|
||||
if ($(element).attr("open_text")) {
|
||||
$(element).attr("orig_text", $(element).children(".g-button-text").text());
|
||||
$(element).children(".g-button-text").text($(element).attr("open_text"));
|
||||
}
|
||||
$("#g-panel").addClass(parentClass).show().slideDown("slow");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
_ajaxify_panel: function () {
|
||||
var self = this;
|
||||
$("#g-panel td form").ajaxForm({
|
||||
dataType: "json",
|
||||
beforeSubmit: function(formData, form, options) {
|
||||
form.find(":submit")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
return true;
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.html) {
|
||||
$("#g-panel td").html(data.html);
|
||||
self._ajaxify_panel();
|
||||
}
|
||||
if (data.result == "success") {
|
||||
self._trigger("success", null, {});
|
||||
if (data.location) {
|
||||
window.location = data.location;
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
success: function(event, ui) {}
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,58 @@
|
|||
(function($) {
|
||||
/**
|
||||
* @todo Move inline CSS out to external style sheet (theme style sheet)
|
||||
*/
|
||||
$.gallery_show_full_size = function(image_url, image_width, image_height) {
|
||||
var width = $(document).width();
|
||||
var height = $(document).height();
|
||||
var size = $.gallery_get_viewport_size();
|
||||
|
||||
$("body").append('<div id="g-fullsize-overlay" class="ui-dialog-overlay" ' +
|
||||
'style="border: none; margin: 0; padding: 0; background-color: #000; ' +
|
||||
'position: fixed; top: 0px; left: 0px; ' +
|
||||
'width: 100%; height: 100%; ' +
|
||||
'opacity: 0.7; filter: alpha(opacity=70); ' +
|
||||
'-moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; ' +
|
||||
'-moz-background-inline-policy: -moz-initial; z-index: 1001;"> </div>');
|
||||
|
||||
var image_size;
|
||||
if (image_width >= size.width() - 6 || image_height >= size.height() - 6) {
|
||||
image_size = $.gallery_auto_fit_window(image_width, image_height);
|
||||
} else {
|
||||
image_size = {
|
||||
top: Math.round((height - image_height) / 2),
|
||||
left: Math.round((width - image_width) / 2),
|
||||
width: Math.round(image_width),
|
||||
height: Math.round(image_height)
|
||||
};
|
||||
}
|
||||
|
||||
$("body").append('<div id="g-fullsize" class="ui-dialog ui-widget" ' +
|
||||
'style="overflow: hidden; display: block; ' +
|
||||
'position: absolute; z-index: 1002; outline-color: -moz-use-text-color; ' +
|
||||
'outline-style: none; outline-width: 0px; ' +
|
||||
'height: ' + image_size.height + 'px; ' +
|
||||
'width: ' + image_size.width + 'px; ' +
|
||||
'top: ' + image_size.top + 'px; left: ' + image_size.left + 'px;">' +
|
||||
'<img id="g-fullsize-image" src="' + image_url + '"' +
|
||||
'height="' + image_size.height + '" width="' + image_size.width + '"/></div>');
|
||||
|
||||
$().click(function() {
|
||||
$("#g-fullsize-overlay*").remove();
|
||||
$("#g-fullsize").remove();
|
||||
});
|
||||
$().bind("keypress", function() {
|
||||
$("#g-fullsize-overlay*").remove();
|
||||
$("#g-fullsize").remove();
|
||||
});
|
||||
$(window).resize(function() {
|
||||
$("#g-fullsize-overlay").width($(document).width()).height($(document).height());
|
||||
image_size = $.gallery_auto_fit_window(image_width, image_height);
|
||||
$("#g-fullsize").height(image_size.height)
|
||||
.width(image_size.width)
|
||||
.css("top", image_size.top)
|
||||
.css("left", image_size.left);
|
||||
$("#g-fullsize-image").height(image_size.height).width(image_size.width);
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,328 @@
|
|||
;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.2",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;}
|
||||
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;}
|
||||
var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;}
|
||||
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};}
|
||||
$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});return _remove.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
|
||||
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);}
|
||||
var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));}
|
||||
return($.inArray(method,methods)!=-1);}
|
||||
$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;}
|
||||
if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);}
|
||||
return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace]=$[namespace]||{};$[namespace][name]=function(element,options){var self=this;this.namespace=namespace;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(event,key,value){if(event.target==element){return self._setData(key,value);}}).bind('getData.'+name,function(event,key){if(event.target==element){return self._getData(key);}}).bind('remove',function(){return self.destroy();});};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);}
|
||||
options={};options[key]=value;}
|
||||
$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element
|
||||
[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+
|
||||
this.namespace+'-state-disabled').attr("aria-disabled",value);}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);event=$.Event(event);event.type=eventName;if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}}
|
||||
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};$.widget.defaults={disabled:false};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;event.stopImmediatePropagation();return false;}});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}
|
||||
this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;}
|
||||
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
|
||||
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
|
||||
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
|
||||
this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);}
|
||||
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
|
||||
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
|
||||
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);}
|
||||
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{_init:function(){if(this.options.helper=='original'&&!(/^(?:r|a|f)/).test(this.element.css("position")))
|
||||
this.element[0].style.position='relative';(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable"
|
||||
+" ui-draggable-dragging"
|
||||
+" ui-draggable-disabled");this._mouseDestroy();},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is('.ui-resizable-handle'))
|
||||
return false;this.handle=this._getHandle(event);if(!this.handle)
|
||||
return false;return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager)
|
||||
$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt)
|
||||
this._adjustOffsetFromHelper(o.cursorAt);if(o.containment)
|
||||
this._setContainment();this._trigger("start",event);this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true;},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();this._trigger('drag',event,ui);this.position=ui.position;}
|
||||
if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);return false;},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)
|
||||
dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false;}
|
||||
if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){self._trigger("stop",event);self._clear();});}else{this._trigger("stop",event);this._clear();}
|
||||
return false;},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true;});return handle;},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=='clone'?this.element.clone():this.element);if(!helper.parents('body').length)
|
||||
helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position")))
|
||||
helper.css("position","absolute");return helper;},_adjustOffsetFromHelper:function(obj){if(obj.left!=undefined)this.offset.click.left=obj.left+this.margins.left;if(obj.right!=undefined)this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;if(obj.top!=undefined)this.offset.click.top=obj.top+this.margins.top;if(obj.bottom!=undefined)this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
|
||||
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
|
||||
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else if(o.containment.constructor==Array){this.containment=o.containment;}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
|
||||
+this.offset.relative.top*mod
|
||||
+this.offset.parent.top*mod
|
||||
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
|
||||
+this.offset.relative.left*mod
|
||||
+this.offset.parent.left*mod
|
||||
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
|
||||
var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
|
||||
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
|
||||
return{top:(pageY
|
||||
-this.offset.click.top
|
||||
-this.offset.relative.top
|
||||
-this.offset.parent.top
|
||||
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
|
||||
-this.offset.click.left
|
||||
-this.offset.relative.left
|
||||
-this.offset.parent.left
|
||||
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type=="drag")this.positionAbs=this._convertPositionTo("absolute");return $.widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs};}}));$.extend($.ui.draggable,{version:"1.7.2",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,'sortable');if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable._refreshItems();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper=='original')
|
||||
this.instance.currentItem.css({top:'auto',left:'auto'});}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;var itemHeight=o.height,itemWidth=o.width;var itemTop=o.top,itemLeft=o.left;return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth);};$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst;}
|
||||
if(this.instance.currentItem)this.instance._mouseDrag(event);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger('out',event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst._trigger("fromSortable",event);inst.dropped=false;}};});}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$('body'),o=$(this).data('draggable').options;if(t.css("cursor"))o._cursor=t.css("cursor");t.css("cursor",o.cursor);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._cursor)$('body').css("cursor",o._cursor);}});$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data('draggable').options;$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data('draggable').options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css('opacity',o.opacity);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._opacity)$(ui.helper).css('opacity',o._opacity);}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML')i.overflowOffset=i.scrollParent.offset();},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML'){if(!o.axis||o.axis!='x'){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
|
||||
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity)
|
||||
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed;}
|
||||
if(!o.axis||o.axis!='y'){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
|
||||
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity)
|
||||
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(!o.axis||o.axis!='x'){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
|
||||
if(!o.axis||o.axis!='y'){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}
|
||||
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(i,event);}});$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!=String?(o.snap.items||':data(draggable)'):o.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=i.element[0])i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;var d=o.snapTolerance;var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d))){if(inst.snapElements[i].snapping)(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=false;continue;}
|
||||
if(o.snapMode!='inner'){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;}
|
||||
var first=(ts||bs||ls||rs);if(o.snapMode!='outer'){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;}
|
||||
if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first))
|
||||
(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||o.stack.min)-(parseInt($(b).css("zIndex"),10)||o.stack.min);});$(group).each(function(i){this.style.zIndex=o.stack.min+i;});this[0].style.zIndex=o.stack.min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($){$.widget("ui.droppable",{_init:function(){var o=this.options,accept=o.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&$.isFunction(this.options.accept)?this.options.accept:function(d){return d.is(accept);};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables[this.options.scope]=$.ui.ddmanager.droppables[this.options.scope]||[];$.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"));},destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];for(var i=0;i<drop.length;i++)
|
||||
if(drop[i]==this)
|
||||
drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},_setData:function(key,value){if(key=='accept'){this.options.accept=value&&$.isFunction(value)?value:function(d){return d.is(value);};}else{$.widget.prototype._setData.apply(this,arguments);}},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.addClass(this.options.activeClass);(draggable&&this._trigger('activate',event,this.ui(draggable)));},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass)this.element.removeClass(this.options.activeClass);(draggable&&this._trigger('deactivate',event,this.ui(draggable)));},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass)this.element.addClass(this.options.hoverClass);this._trigger('over',event,this.ui(draggable));}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return;if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger('out',event,this.ui(draggable));}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]==this.element[0])return false;var childrenIntersection=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection)return false;if(this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.activeClass)this.element.removeClass(this.options.activeClass);if(this.options.hoverClass)this.element.removeClass(this.options.hoverClass);this._trigger('drop',event,this.ui(draggable));return this.element;}
|
||||
return false;},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,absolutePosition:c.positionAbs,offset:c.positionAbs};}});$.extend($.ui.droppable,{version:"1.7.2",eventPrefix:'drop',defaults:{accept:'*',activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:'default',tolerance:'intersect'}});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset)return false;var x1=(draggable.positionAbs||draggable.position.absolute).left,x2=x1+draggable.helperProportions.width,y1=(draggable.positionAbs||draggable.position.absolute).top,y2=y1+draggable.helperProportions.height;var l=droppable.offset.left,r=l+droppable.proportions.width,t=droppable.offset.top,b=t+droppable.proportions.height;switch(toleranceMode){case'fit':return(l<x1&&x2<r&&t<y1&&y2<b);break;case'intersect':return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);break;case'pointer':var draggableLeft=((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left),draggableTop=((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top),isOver=$.ui.isOver(draggableTop,draggableLeft,t,l,droppable.proportions.height,droppable.proportions.width);return isOver;break;case'touch':return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:{'default':[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope];var type=event?event.type:null;var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();droppablesLoop:for(var i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].options.accept.call(m[i].element[0],(t.currentItem||t.element))))continue;for(var j=0;j<list.length;j++){if(list[j]==m[i].element[0]){m[i].proportions.height=0;continue droppablesLoop;}};m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};if(type=="mousedown")m[i]._activate.call(m[i],event);}},drop:function(draggable,event){var dropped=false;$.each($.ui.ddmanager.droppables[draggable.options.scope],function(){if(!this.options)return;if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance))
|
||||
dropped=this._drop.call(this,event);if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=1;this.isover=0;this._deactivate.call(this,event);}});return dropped;},drag:function(draggable,event){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,event);$.each($.ui.ddmanager.droppables[draggable.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var intersects=$.ui.intersect(draggable,this,this.options.tolerance);var c=!intersects&&this.isover==1?'isout':(intersects&&this.isover==0?'isover':null);if(!c)return;var parentInstance;if(this.options.greedy){var parent=this.element.parents(':data(droppable):eq(0)');if(parent.length){parentInstance=$.data(parent[0],'droppable');parentInstance.greedyChild=(c=='isover'?1:0);}}
|
||||
if(parentInstance&&c=='isover'){parentInstance['isover']=0;parentInstance['isout']=1;parentInstance._out.call(parentInstance,event);}
|
||||
this[c]=1;this[c=='isout'?'isover':'isout']=0;this[c=="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c=='isout'){parentInstance['isout']=0;parentInstance['isover']=1;parentInstance._over.call(parentInstance,event);}});}};})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{_init:function(){var self=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||'ui-resizable-helper':null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css('position'))&&$.browser.opera)
|
||||
this.element.css({position:'relative',top:'auto',left:'auto'});this.element.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css('position'),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css('top'),left:this.element.css('left')}));this.element=this.element.parent().data("resizable",this.element.data('resizable'));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css('resize');this.originalElement.css('resize','none');this._proportionallyResizeElements.push(this.originalElement.css({position:'static',zoom:1,display:'block'}));this.originalElement.css({margin:this.originalElement.css('margin')});this._proportionallyResize();}
|
||||
this.handles=o.handles||(!$('.ui-resizable-handle',this.element).length?"e,s,se":{n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'});if(this.handles.constructor==String){if(this.handles=='all')this.handles='n,e,s,w,se,sw,ne,nw';var n=this.handles.split(",");this.handles={};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),hname='ui-resizable-'+handle;var axis=$('<div class="ui-resizable-handle '+hname+'"></div>');if(/sw|se|ne|nw/.test(handle))axis.css({zIndex:++o.zIndex});if('se'==handle){axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');};this.handles[handle]='.ui-resizable-'+handle;this.element.append(axis);}}
|
||||
this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String)
|
||||
this.handles[i]=$(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var axis=$(this.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=['padding',/ne|nw|n/.test(i)?'Top':/se|sw|s/.test(i)?'Bottom':/^e$/.test(i)?'Right':'Left'].join("");target.css(padPos,padWrapper);this._proportionallyResize();}
|
||||
if(!$(this.handles[i]).length)
|
||||
continue;}};this._renderAxis(this.element);this._handles=$('.ui-resizable-handle',this.element).disableSelection();this._handles.mouseover(function(){if(!self.resizing){if(this.className)
|
||||
var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=axis&&axis[1]?axis[1]:'se';}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");self._handles.show();},function(){if(!self.resizing){$(this).addClass("ui-resizable-autohide");self._handles.hide();}});}
|
||||
this._mouseInit();},destroy:function(){this._mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();};if(this.elementIsWrapper){_destroy(this.element);var wrapper=this.element;wrapper.parent().append(this.originalElement.css({position:wrapper.css('position'),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css('top'),left:wrapper.css('left')})).end().remove();}
|
||||
this.originalElement.css('resize',this.originalResizeStyle);_destroy(this.originalElement);},_mouseCapture:function(event){var handle=false;for(var i in this.handles){if($(this.handles[i])[0]==event.target)handle=true;}
|
||||
return this.options.disabled||!!handle;},_mouseStart:function(event){var o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;this.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is('.ui-draggable')||(/absolute/).test(el.css('position'))){el.css({position:'absolute',top:iniPos.top,left:iniPos.left});}
|
||||
if($.browser.opera&&(/relative/).test(el.css('position')))
|
||||
el.css({position:'relative',top:'auto',left:'auto'});this._renderProxy();var curleft=num(this.helper.css('left')),curtop=num(this.helper.css('top'));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;}
|
||||
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio=='number')?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var cursor=$('.ui-resizable-'+this.axis).css('cursor');$('body').css('cursor',cursor=='auto'?this.axis+'-resize':cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true;},_mouseDrag:function(event){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[event,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(this._aspectRatio||event.shiftKey)
|
||||
data=this._updateRatio(data,event);data=this._respectSize(data,event);this._propagate("resize",event);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length)
|
||||
this._proportionallyResize();this._updateCache(data);this._trigger('resize',event,this.ui());return false;},_mouseStop:function(event){this.resizing=false;var o=this.options,self=this;if(this._helper){var pr=this._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var s={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;if(!o.animate)
|
||||
this.element.css($.extend(s,{top:top,left:left}));self.helper.height(self.size.height);self.helper.width(self.size.width);if(this._helper&&!o.animate)this._proportionallyResize();}
|
||||
$('body').css('cursor','auto');this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper)this.helper.remove();return false;},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(isNumber(data.left))this.position.left=data.left;if(isNumber(data.top))this.position.top=data.top;if(isNumber(data.height))this.size.height=data.height;if(isNumber(data.width))this.size.width=data.width;},_updateRatio:function(data,event){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=(csize.height*this.aspectRatio);else if(data.width)data.height=(csize.width/this.aspectRatio);if(a=='sw'){data.left=cpos.left+(csize.width-data.width);data.top=null;}
|
||||
if(a=='nw'){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);}
|
||||
return data;},_respectSize:function(data,event){var el=this.helper,o=this.options,pRatio=this._aspectRatio||event.shiftKey,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&(o.maxWidth<data.width),ismaxh=isNumber(data.height)&&o.maxHeight&&(o.maxHeight<data.height),isminw=isNumber(data.width)&&o.minWidth&&(o.minWidth>data.width),isminh=isNumber(data.height)&&o.minHeight&&(o.minHeight>data.height);if(isminw)data.width=o.minWidth;if(isminh)data.height=o.minHeight;if(ismaxw)data.width=o.maxWidth;if(ismaxh)data.height=o.maxHeight;var dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height;var cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw&&cw)data.left=dw-o.minWidth;if(ismaxw&&cw)data.left=dw-o.maxWidth;if(isminh&&ch)data.top=dh-o.minHeight;if(ismaxh&&ch)data.top=dh-o.maxHeight;var isNotwh=!data.width&&!data.height;if(isNotwh&&!data.left&&data.top)data.top=null;else if(isNotwh&&!data.top&&data.left)data.left=null;return data;},_proportionallyResize:function(){var o=this.options;if(!this._proportionallyResizeElements.length)return;var element=this.helper||this.element;for(var i=0;i<this._proportionallyResizeElements.length;i++){var prel=this._proportionallyResizeElements[i];if(!this.borderDif){var b=[prel.css('borderTopWidth'),prel.css('borderRightWidth'),prel.css('borderBottomWidth'),prel.css('borderLeftWidth')],p=[prel.css('paddingTop'),prel.css('paddingRight'),prel.css('paddingBottom'),prel.css('paddingLeft')];this.borderDif=$.map(b,function(v,i){var border=parseInt(v,10)||0,padding=parseInt(p[i],10)||0;return border+padding;});}
|
||||
if($.browser.msie&&!(!($(element).is(':hidden')||$(element).parents(':hidden').length)))
|
||||
continue;prel.css({height:(element.height()-this.borderDif[0]-this.borderDif[2])||0,width:(element.width()-this.borderDif[1]-this.borderDif[3])||0});};},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$('<div style="overflow:hidden;"></div>');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+pxyoffset,height:this.element.outerHeight()+pxyoffset,position:'absolute',left:this.elementOffset.left-ie6offset+'px',top:this.elementOffset.top-ie6offset+'px',zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(event,dx,dy){return{width:this.originalSize.width+dx};},w:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(event,dx,dy){return{height:this.originalSize.height+dy};},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);(n!="resize"&&this._trigger(n,event,this.ui()));},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}}));$.extend($.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});$.ui.plugin.add("resizable","alsoResize",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options;_store=function(exp){$(exp).each(function(){$(this).data("resizable-alsoresize",{width:parseInt($(this).width(),10),height:parseInt($(this).height(),10),left:parseInt($(this).css('left'),10),top:parseInt($(this).css('top'),10)});});};if(typeof(o.alsoResize)=='object'&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize);}
|
||||
else{$.each(o.alsoResize,function(exp,c){_store(exp);});}}else{_store(o.alsoResize);}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,os=self.originalSize,op=self.originalPosition;var delta={height:(self.size.height-os.height)||0,width:(self.size.width-os.width)||0,top:(self.position.top-op.top)||0,left:(self.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("resizable-alsoresize"),style={},css=c&&c.length?c:['width','height','top','left'];$.each(css||['width','height','top','left'],function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0)
|
||||
style[prop]=sum||null;});if(/relative/.test(el.css('position'))&&$.browser.opera){self._revertToRelativePosition=true;el.css({position:'absolute',top:'auto',left:'auto'});}
|
||||
el.css(style);});};if(typeof(o.alsoResize)=='object'&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(event,ui){var self=$(this).data("resizable");if(self._revertToRelativePosition&&$.browser.opera){self._revertToRelativePosition=false;el.css({position:'relative'});}
|
||||
$(this).removeData("resizable-alsoresize-start");}});$.ui.plugin.add("resizable","animate",{stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var pr=self._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?0:self.sizeDiff.height,soffsetw=ista?0:self.sizeDiff.width;var style={width:(self.size.width-soffsetw),height:(self.size.height-soffseth)},left=(parseInt(self.element.css('left'),10)+(self.position.left-self.originalPosition.left))||null,top=(parseInt(self.element.css('top'),10)+(self.position.top-self.originalPosition.top))||null;self.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(self.element.css('width'),10),height:parseInt(self.element.css('height'),10),top:parseInt(self.element.css('top'),10),left:parseInt(self.element.css('left'),10)};if(pr&&pr.length)$(pr[0]).css({width:data.width,height:data.height});self._updateCache(data);self._propagate("resize",event);}});}});$.ui.plugin.add("resizable","containment",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,el=self.element;var oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce)return;self.containerElement=$(ce);if(/document/.test(oc)||oc==document){self.containerOffset={left:0,top:0};self.containerPosition={left:0,top:0};self.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};}
|
||||
else{var element=$(ce),p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name));});self.containerOffset=element.offset();self.containerPosition=element.position();self.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};var co=self.containerOffset,ch=self.containerSize.height,cw=self.containerSize.width,width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw),height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);self.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=self._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&(/static/).test(ce.css('position')))cop=co;if(cp.left<(self._helper?co.left:0)){self.size.width=self.size.width+(self._helper?(self.position.left-co.left):(self.position.left-cop.left));if(pRatio)self.size.height=self.size.width/o.aspectRatio;self.position.left=o.helper?co.left:0;}
|
||||
if(cp.top<(self._helper?co.top:0)){self.size.height=self.size.height+(self._helper?(self.position.top-co.top):self.position.top);if(pRatio)self.size.width=self.size.height*o.aspectRatio;self.position.top=self._helper?co.top:0;}
|
||||
self.offset.left=self.parentData.left+self.position.left;self.offset.top=self.parentData.top+self.position.top;var woset=Math.abs((self._helper?self.offset.left-cop.left:(self.offset.left-cop.left))+self.sizeDiff.width),hoset=Math.abs((self._helper?self.offset.top-cop.top:(self.offset.top-co.top))+self.sizeDiff.height);var isParent=self.containerElement.get(0)==self.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(self.containerElement.css('position'));if(isParent&&isOffsetRelative)woset-=self.parentData.left;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width/self.aspectRatio;}
|
||||
if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height*self.aspectRatio;}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options,cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.outerWidth()-self.sizeDiff.width,h=helper.outerHeight()-self.sizeDiff.height;if(self._helper&&!o.animate&&(/relative/).test(ce.css('position')))
|
||||
$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});if(self._helper&&!o.animate&&(/static/).test(ce.css('position')))
|
||||
$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.clone();self.ghost.css({opacity:.25,display:'block',position:'relative',height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass('ui-resizable-ghost').addClass(typeof o.ghost=='string'?o.ghost:'');self.ghost.appendTo(self.helper);},resize:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.shiftKey;o.grid=typeof o.grid=="number"?[o.grid,o.grid]:o.grid;var ox=Math.round((cs.width-os.width)/(o.grid[0]||1))*(o.grid[0]||1),oy=Math.round((cs.height-os.height)/(o.grid[1]||1))*(o.grid[1]||1);if(/^(se|s|e)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;}
|
||||
else if(/^(ne)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;}
|
||||
else if(/^(sw)$/.test(a)){self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.left=op.left-ox;}
|
||||
else{self.size.width=os.width+ox;self.size.height=os.height+oy;self.position.top=op.top-oy;self.position.left=op.left-ox;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.widget("ui.selectable",$.extend({},$.ui.mouse,{_init:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;var selectees;this.refresh=function(){selectees=$(self.options.filter,self.element[0]);selectees.each(function(){var $this=$(this);var pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass('ui-selected'),selecting:$this.hasClass('ui-selecting'),unselecting:$this.hasClass('ui-unselecting')});});};this.refresh();this.selectees=selectees.addClass("ui-selectee");this._mouseInit();this.helper=$(document.createElement('div')).css({border:'1px dotted black'}).addClass("ui-selectable-helper");this.element.bind("mousedown.selectable",function(event){if(event.pageX>self.element[0].scrollWidth+self.element.offset().left){return;}
|
||||
var selectee=self._targetIsSelectable(event.target);if(!selectee){return;}
|
||||
var test=$(".ui-selected").length;if(!event.ctrlKey&&$(".ui-selected").length>1&&$(selectee).hasClass("ui-selected")){return(self._listenForMouseUp=1);}
|
||||
if(!event.ctrlKey){$(".ui-selected").each(function(){self._removeSelection(this,event);});}
|
||||
self._toggleSelection(selectee,event);event.preventDefault();}).bind("mouseup.selectable",function(event){if(self._listenForMouseUp){self._listenForMouseUp=0;var selectee=self._targetIsSelectable(event.target);if(!selectee){return;}
|
||||
self._addSelection(selectee,event);event.preventDefault();}})},_addSelection:function(selectee,event){$(selectee).addClass("ui-selecting");this._trigger("selecting",event,{selecting:selectee});$(selectee).removeClass('ui-selecting').addClass('ui-selected');this._trigger("selected",event,{selected:selectee});},_removeSelection:function(selected,event){$(selected).removeClass('ui-selected').addClass('ui-unselecting');this._trigger("unselecting",event,{unselecting:selected});$(selected).removeClass('ui-unselecting');this._trigger("unselected",event,{unselected:selected});},_toggleSelection:function(selectee,event){if($(selectee).hasClass("ui-selected")){this._removeSelection(selectee,event);}else{this._addSelection(selectee,event);}},_targetIsSelectable:function(target){var found=$(target).parents().andSelf().filter(".ui-selectee");return found.length&&found;},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();},_mouseStart:function(event){var self=this;if(event.pageX>this.element[0].scrollWidth+this.element.offset().left){this.opos=null;return;}
|
||||
this.opos=[event.pageX,event.pageY];if(this.options.disabled)
|
||||
return;var options=this.options,appendTo=$(options.appendTo),parentOffset=appendTo.css('position')=='static'?appendTo.offsetParent().offset():appendTo.offset();this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);appendTo.append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":event.clientX-parentOffset.left,"top":event.clientY-parentOffset.top,"width":0,"height":0});if(options.autoRefresh){this.refresh();}
|
||||
this.selectees.filter('.ui-selected').each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');selectee.unselecting=false;selectee.selecting=true;selectee.selected=true;self._trigger("selecting",event,{selecting:selectee.element});return false;}});},_mouseDrag:function(event){var self=this;if(!this.opos){return;}
|
||||
this.dragged=true;if(this.options.disabled)
|
||||
return;var options=this.options;var x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY,appendTo=$(options.appendTo),parentOffset=appendTo.css('position')=='static'?appendTo.offsetParent().offset():appendTo.offset();if(x1>x2){var tmp=x2;x2=x1;x1=tmp;}
|
||||
if(y1>y2){var tmp=y2;y2=y1;y1=tmp;}
|
||||
this.helper.css({left:x1-parentOffset.left,top:y1-parentOffset.top,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item");if(!selectee||selectee.element==self.element[0])
|
||||
return;var hit=false;if(options.tolerance=='touch'){hit=(!(selectee.left>x2||selectee.right<x1||selectee.top>y2||selectee.bottom<y1));}else if(options.tolerance=='fit'){hit=(selectee.left>x1&&selectee.right<x2&&selectee.top>y1&&selectee.bottom<y2);}
|
||||
if(hit){if(selectee.selected){selectee.$element.removeClass('ui-selected');selectee.selected=false;}
|
||||
if(selectee.unselecting){selectee.$element.removeClass('ui-unselecting');selectee.unselecting=false;}
|
||||
if(!selectee.selecting){selectee.$element.addClass('ui-selecting');selectee.selecting=true;self._trigger("selecting",event,{selecting:selectee.element});}}else{if(selectee.selecting){if(event.metaKey&&selectee.startselected){selectee.$element.removeClass('ui-selecting');selectee.selecting=false;selectee.$element.addClass('ui-selected');selectee.selected=true;}else{selectee.$element.removeClass('ui-selecting');selectee.selecting=false;if(selectee.startselected){selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;}
|
||||
self._trigger("unselecting",event,{unselecting:selectee.element});}}
|
||||
if(selectee.selected){if(!event.metaKey&&!selectee.startselected){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}}}});return false;},_mouseStop:function(event){var self=this;if(!this.opos){return;}
|
||||
this.dragged=false;var options=this.options;$('.ui-unselecting',this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass('ui-unselecting');selectee.unselecting=false;selectee.startselected=false;self._trigger("unselected",event,{unselected:selectee.element});});$('.ui-selecting',this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass('ui-selecting').addClass('ui-selected');selectee.selecting=false;selectee.selected=true;selectee.startselected=true;self._trigger("selected",event,{selected:selectee.element});});this._trigger("stop",event);this.helper.remove();return false;}}));$.extend($.ui.selectable,{version:"1.7.2",defaults:{appendTo:'body',autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:'*',tolerance:'touch'}});})(jQuery);(function($){$.widget("ui.sortable",$.extend({},$.ui.mouse,{_init:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)
|
||||
this.items[i].item.removeData("sortable-item");},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;}
|
||||
if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;}
|
||||
this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt)
|
||||
this._adjustOffsetFromHelper(o.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();}
|
||||
this._createPlaceholder();if(o.containment)
|
||||
this._setContainment();if(o.cursor){if($('body').css("cursor"))this._storedCursor=$('body').css("cursor");$('body').css("cursor",o.cursor);}
|
||||
if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity);}
|
||||
if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex);}
|
||||
if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML')
|
||||
this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions)
|
||||
this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this));}}
|
||||
if($.ui.ddmanager)
|
||||
$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}
|
||||
if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML'){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity)
|
||||
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
|
||||
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}
|
||||
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
|
||||
$.ui.ddmanager.prepareOffsets(this,event);}
|
||||
this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=='semi-dynamic'?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
|
||||
this._trigger("change",event,this._uiHash());break;}}
|
||||
this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger('sort',event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour)
|
||||
$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event);});}else{this._clear(event,noPropagation);}
|
||||
return false;},cancel:function(){var self=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original")
|
||||
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else
|
||||
this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0;}}}
|
||||
if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}
|
||||
return true;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1]+'[]')+'='+(o.key&&o.expression?res[1]:res[2]));});return str.join('&');},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||'id')||'');});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)<b&&(x1+dxClick)>l&&(x1+dxClick)<r;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var isOverElementHeight=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement)
|
||||
return false;return this.floating?(((horizontalDirection&&horizontalDirection=="right")||verticalDirection=="down")?2:1):(verticalDirection&&(verticalDirection=="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return((horizontalDirection=="right"&&isOverRightHalf)||(horizontalDirection=="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection=="down"&&isOverBottomHalf)||(verticalDirection=="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!=0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper"),inst]);}};};}
|
||||
queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this);});};return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i<this.items.length;i++){for(var j=0;j<list.length;j++){if(list[j]==this.items[i].item[0])
|
||||
this.items.splice(i,1);};};},_refreshItems:function(event){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]];var connectWith=this._connectWith();if(connectWith){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}
|
||||
for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j<queriesLength;j++){var item=$(_queries[j]);item.data('sortable-item',targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});};};},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
|
||||
for(var i=this.items.length-1;i>=0;i--){var item=this.items[i];if(item.instance!=this.currentContainer&&this.currentContainer&&item.item[0]!=this.currentItem[0])
|
||||
continue;var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
|
||||
var p=t.offset();item.left=p.left;item.top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className)
|
||||
el.style.visibility="hidden";return el;},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css('paddingTop')||0,10)-parseInt(self.currentItem.css('paddingBottom')||0,10));};if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css('paddingLeft')||0,10)-parseInt(self.currentItem.css('paddingRight')||0,10));};}};}
|
||||
self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder);},_contactContainers:function(event){for(var i=this.containers.length-1;i>=0;i--){if(this._intersectsWith(this.containers[i].containerCache)){if(!this.containers[i].containerCache.over){if(this.currentContainer!=this.containers[i]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[i].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[i].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[i].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}
|
||||
if(!itemWithLeastDistance&&!this.options.dropOnEmpty)
|
||||
continue;this.currentContainer=this.containers[i];itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[i].element,true);this._trigger("change",event,this._uiHash());this.containers[i]._trigger("change",event,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);}
|
||||
this.containers[i]._trigger("over",event,this._uiHash(this));this.containers[i].containerCache.over=1;}}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}};},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper=='clone'?this.currentItem.clone():this.currentItem);if(!helper.parents('body').length)
|
||||
$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);if(helper[0]==this.currentItem[0])
|
||||
this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(helper[0].style.width==''||o.forceHelperSize)helper.width(this.currentItem.width());if(helper[0].style.height==''||o.forceHelperSize)helper.height(this.currentItem.height());return helper;},_adjustOffsetFromHelper:function(obj){if(obj.left!=undefined)this.offset.click.left=obj.left+this.margins.left;if(obj.right!=undefined)this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;if(obj.top!=undefined)this.offset.click.top=obj.top+this.margins.top;if(obj.bottom!=undefined)this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
|
||||
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
|
||||
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
|
||||
+this.offset.relative.top*mod
|
||||
+this.offset.parent.top*mod
|
||||
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
|
||||
+this.offset.relative.left*mod
|
||||
+this.offset.parent.left*mod
|
||||
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
|
||||
var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
|
||||
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
|
||||
return{top:(pageY
|
||||
-this.offset.click.top
|
||||
-this.offset.relative.top
|
||||
-this.offset.parent.top
|
||||
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
|
||||
-this.offset.click.left
|
||||
-this.offset.relative.left
|
||||
-this.offset.parent.left
|
||||
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);},_clear:function(event,noPropagation){this.reverting=false;var delayedTriggers=[],self=this;if(!this._noFinalSort&&this.currentItem[0].parentNode)this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS){if(this._storedCSS[i]=='auto'||this._storedCSS[i]=='static')this._storedCSS[i]='';}
|
||||
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
|
||||
if(this.fromOutside&&!noPropagation)delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!noPropagation)delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});if(!$.ui.contains(this.element[0],this.currentItem[0])){if(!noPropagation)delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.containers[i]));}};};for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this));};}).call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this));};}).call(this,this.containers[i]));this.containers[i].containerCache.over=0;}}
|
||||
if(this._storedCursor)$('body').css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=='auto'?'':this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
|
||||
return false;}
|
||||
if(!noPropagation)this._trigger("beforeStop",event,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0])this.helper.remove();this.helper=null;if(!noPropagation){for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
|
||||
this.fromOutside=false;return true;},_trigger:function(){if($.widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(inst){var self=inst||this;return{helper:self.helper,placeholder:self.placeholder||$([]),position:self.position,absolutePosition:self.positionAbs,offset:self.positionAbs,item:self.currentItem,sender:inst?inst.element:null};}}));$.extend($.ui.sortable,{getter:"serialize toArray",version:"1.7.2",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:'auto',cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:'> *',opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}});})(jQuery);(function($){$.widget("ui.accordion",{_init:function(){var o=this.options,self=this;this.running=0;if(o.collapsible==$.ui.accordion.defaults.collapsible&&o.alwaysOpen!=$.ui.accordion.defaults.alwaysOpen){o.collapsible=!o.alwaysOpen;}
|
||||
if(o.navigation){var current=this.element.find("a").filter(o.navigationFilter);if(current.length){if(current.filter(o.header).length){this.active=current;}else{this.active=current.parent().parent().prev();current.addClass("ui-accordion-content-active");}}}
|
||||
this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix");}
|
||||
this.headers=this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){$(this).addClass('ui-state-hover');}).bind("mouseleave.accordion",function(){$(this).removeClass('ui-state-hover');}).bind("focus.accordion",function(){$(this).addClass('ui-state-focus');}).bind("blur.accordion",function(){$(this).removeClass('ui-state-focus');});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass('ui-accordion-content-active');$("<span/>").addClass("ui-icon "+o.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);if($.browser.msie){this.element.find('a').css('zoom','1');}
|
||||
this.resize();this.element.attr('role','tablist');this.headers.attr('role','tab').bind('keydown',function(event){return self._keydown(event);}).next().attr('role','tabpanel');this.headers.not(this.active||"").attr('aria-expanded','false').attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr('tabIndex','0');}else{this.active.attr('aria-expanded','true').attr('tabIndex','0');}
|
||||
if(!$.browser.safari)
|
||||
this.headers.find('a').attr('tabIndex','-1');if(o.event){this.headers.bind((o.event)+".accordion",function(event){return self._clickHandler.call(self,event,this);});}},destroy:function(){var o=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind('.accordion').removeData('accordion');this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var contents=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(o.autoHeight||o.fillHeight){contents.css("height","");}},_setData:function(key,value){if(key=='alwaysOpen'){key='collapsible';value=!value;}
|
||||
$.widget.prototype._setData.apply(this,arguments);},_keydown:function(event){var o=this.options,keyCode=$.ui.keyCode;if(o.disabled||event.altKey||event.ctrlKey)
|
||||
return;var length=this.headers.length;var currentIndex=this.headers.index(event.target);var toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:return this._clickHandler({target:event.target},event.target);}
|
||||
if(toFocus){$(event.target).attr('tabIndex','-1');$(toFocus).attr('tabIndex','0');toFocus.focus();return false;}
|
||||
return true;},resize:function(){var o=this.options,maxHeight;if(o.fillSpace){if($.browser.msie){var defOverflow=this.element.parent().css('overflow');this.element.parent().css('overflow','hidden');}
|
||||
maxHeight=this.element.parent().height();if($.browser.msie){this.element.parent().css('overflow',defOverflow);}
|
||||
this.headers.each(function(){maxHeight-=$(this).outerHeight();});var maxPadding=0;this.headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height());}).height(Math.max(0,maxHeight-maxPadding)).css('overflow','auto');}else if(o.autoHeight){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}},activate:function(index){var active=this._findActive(index)[0];this._clickHandler({target:active},active);},_findActive:function(selector){return selector?typeof selector=="number"?this.headers.filter(":eq("+selector+")"):this.headers.not(this.headers.not(selector)):selector===false?$([]):this.headers.filter(":eq(0)");},_clickHandler:function(event,target){var o=this.options;if(o.disabled)return false;if(!event.target&&o.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);this.active.next().addClass('ui-accordion-content-active');var toHide=this.active.next(),data={options:o,newHeader:$([]),oldHeader:o.active,newContent:$([]),oldContent:toHide},toShow=(this.active=$([]));this._toggle(toShow,toHide,data);return false;}
|
||||
var clicked=$(event.currentTarget||target);var clickedIsActive=clicked[0]==this.active[0];if(this.running||(!o.collapsible&&clickedIsActive)){return false;}
|
||||
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);this.active.next().addClass('ui-accordion-content-active');if(!clickedIsActive){clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);clicked.next().addClass('ui-accordion-content-active');}
|
||||
var toShow=clicked.next(),toHide=this.active.next(),data={options:o,newHeader:clickedIsActive&&o.collapsible?$([]):clicked,oldHeader:this.active,newContent:clickedIsActive&&o.collapsible?$([]):toShow.find('> *'),oldContent:toHide.find('> *')},down=this.headers.index(this.active[0])>this.headers.index(clicked[0]);this.active=clickedIsActive?$([]):clicked;this._toggle(toShow,toHide,data,clickedIsActive,down);return false;},_toggle:function(toShow,toHide,data,clickedIsActive,down){var o=this.options,self=this;this.toShow=toShow;this.toHide=toHide;this.data=data;var complete=function(){if(!self)return;return self._completed.apply(self,arguments);};this._trigger("changestart",null,this.data);this.running=toHide.size()===0?toShow.size():toHide.size();if(o.animated){var animOptions={};if(o.collapsible&&clickedIsActive){animOptions={toShow:$([]),toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace};}else{animOptions={toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace};}
|
||||
if(!o.proxied){o.proxied=o.animated;}
|
||||
if(!o.proxiedDuration){o.proxiedDuration=o.duration;}
|
||||
o.animated=$.isFunction(o.proxied)?o.proxied(animOptions):o.proxied;o.duration=$.isFunction(o.proxiedDuration)?o.proxiedDuration(animOptions):o.proxiedDuration;var animations=$.ui.accordion.animations,duration=o.duration,easing=o.animated;if(!animations[easing]){animations[easing]=function(options){this.slide(options,{easing:easing,duration:duration||700});};}
|
||||
animations[easing](animOptions);}else{if(o.collapsible&&clickedIsActive){toShow.toggle();}else{toHide.hide();toShow.show();}
|
||||
complete(true);}
|
||||
toHide.prev().attr('aria-expanded','false').attr("tabIndex","-1").blur();toShow.prev().attr('aria-expanded','true').attr("tabIndex","0").focus();},_completed:function(cancel){var o=this.options;this.running=cancel?0:--this.running;if(this.running)return;if(o.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""});}
|
||||
this._trigger('change',null,this.data);}});$.extend($.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:'slide',autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase();}},animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show"},options);return;}
|
||||
if(!options.toShow.size()){options.toHide.animate({height:"hide"},options);return;}
|
||||
var overflow=options.toShow.css('overflow'),percentDone,showProps={},hideProps={},fxAttrs=["height","paddingTop","paddingBottom"],originalWidth;var s=options.toShow;originalWidth=s[0].style.width;s.width(parseInt(s.parent().width(),10)-parseInt(s.css("paddingLeft"),10)-parseInt(s.css("paddingRight"),10)-(parseInt(s.css("borderLeftWidth"),10)||0)-(parseInt(s.css("borderRightWidth"),10)||0));$.each(fxAttrs,function(i,prop){hideProps[prop]='hide';var parts=(''+$.css(options.toShow[0],prop)).match(/^([\d+-.]+)(.*)$/);showProps[prop]={value:parts[1],unit:parts[2]||'px'};});options.toShow.css({height:0,overflow:'hidden'}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{step:function(now,settings){if(settings.prop=='height'){percentDone=(settings.now-settings.start)/(settings.end-settings.start);}
|
||||
options.toShow[0].style[settings.prop]=(percentDone*showProps[settings.prop].value)+showProps[settings.prop].unit;},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","");}
|
||||
options.toShow.css("width",originalWidth);options.toShow.css({overflow:overflow});options.complete();}});},bounceslide:function(options){this.slide(options,{easing:options.down?"easeOutBounce":"swing",duration:options.down?1000:200});},easeslide:function(options){this.slide(options,{easing:"easeinout",duration:700});}}});})(jQuery);(function($){var setDataSwitch={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr('title');var self=this,options=this.options,title=options.title||this.originalTitle||' ',titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$('<div/>')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:'absolute',overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event));}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=this.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$('<div></div>')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"/>').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).mousedown(function(ev){ev.stopPropagation();}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$('<span/>')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('<span/>').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();(options.draggable&&$.fn.draggable&&this._makeDraggable());(options.resizable&&$.fn.resizable&&this._makeResizable());this._createButtons(options.buttons);this._isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');this.uiDialog.remove();(this.originalTitle&&this.element.attr('title',this.originalTitle));},close:function(event){var self=this;if(false===self._trigger('beforeclose',event)){return;}
|
||||
(self.overlay&&self.overlay.destroy());self.uiDialog.unbind('keypress.ui-dialog');(self.options.hide?self.uiDialog.hide(self.options.hide,function(){self._trigger('close',event);}):self.uiDialog.hide()&&self._trigger('close',event));$.ui.dialog.overlay.resize();self._isOpen=false;if(self.options.modal){var maxZ=0;$('.ui-dialog').each(function(){if(this!=self.uiDialog[0]){maxZ=Math.max(maxZ,$(this).css('z-index'));}});$.ui.dialog.maxZ=maxZ;}},isOpen:function(){return this._isOpen;},moveToTop:function(force,event){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this._trigger('focus',event);}
|
||||
if(this.options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=this.options.zIndex;}
|
||||
(this.overlay&&this.overlay.$el.css('z-index',$.ui.dialog.overlay.maxZ=++$.ui.dialog.maxZ));var saveScroll={scrollTop:this.element.attr('scrollTop'),scrollLeft:this.element.attr('scrollLeft')};this.uiDialog.css('z-index',++$.ui.dialog.maxZ);this.element.attr(saveScroll);this._trigger('focus',event);},open:function(){if(this._isOpen){return;}
|
||||
var options=this.options,uiDialog=this.uiDialog;this.overlay=options.modal?new $.ui.dialog.overlay(this):null;(uiDialog.next().length&&uiDialog.appendTo('body'));this._size();this._position(options.position);uiDialog.show(options.show);this.moveToTop(true);(options.modal&&uiDialog.bind('keypress.ui-dialog',function(event){if(event.keyCode!=$.ui.keyCode.TAB){return;}
|
||||
var tabbables=$(':tabbable',this),first=tabbables.filter(':first')[0],last=tabbables.filter(':last')[0];if(event.target==last&&!event.shiftKey){setTimeout(function(){first.focus();},1);}else if(event.target==first&&event.shiftKey){setTimeout(function(){last.focus();},1);}}));$([]).add(uiDialog.find('.ui-dialog-content :tabbable:first')).add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')).add(uiDialog).filter(':first').focus();this._trigger('open');this._isOpen=true;},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$('<div></div>').addClass('ui-dialog-buttonpane '+'ui-widget-content '+'ui-helper-clearfix');this.uiDialog.find('.ui-dialog-buttonpane').remove();(typeof buttons=='object'&&buttons!==null&&$.each(buttons,function(){return!(hasButtons=true);}));if(hasButtons){$.each(buttons,function(name,fn){$('<button type="button"></button>').addClass('ui-state-default '+'ui-corner-all').text(name).click(function(){fn.apply(self.element[0],arguments);}).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');}).focus(function(){$(this).addClass('ui-state-focus');}).blur(function(){$(this).removeClass('ui-state-focus');}).appendTo(uiDialogButtonPane);});uiDialogButtonPane.appendTo(this.uiDialog);}},_makeDraggable:function(){var self=this,options=this.options,heightBeforeDrag;this.uiDialog.draggable({cancel:'.ui-dialog-content',handle:'.ui-dialog-titlebar',containment:'document',start:function(){heightBeforeDrag=options.height;$(this).height($(this).height()).addClass("ui-dialog-dragging");(options.dragStart&&options.dragStart.apply(self.element[0],arguments));},drag:function(){(options.drag&&options.drag.apply(self.element[0],arguments));},stop:function(){$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);(options.dragStop&&options.dragStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}});},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=this.options,resizeHandles=typeof handles=='string'?handles:'n,e,s,w,se,sw,ne,nw';this.uiDialog.resizable({cancel:'.ui-dialog-content',alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight,start:function(){$(this).addClass("ui-dialog-resizing");(options.resizeStart&&options.resizeStart.apply(self.element[0],arguments));},resize:function(){(options.resize&&options.resize.apply(self.element[0],arguments));},handles:resizeHandles,stop:function(){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();(options.resizeStop&&options.resizeStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}}).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');},_position:function(pos){var wnd=$(window),doc=$(document),pTop=doc.scrollTop(),pLeft=doc.scrollLeft(),minTop=pTop;if($.inArray(pos,['center','top','right','bottom','left'])>=0){pos=[pos=='right'||pos=='left'?pos:'center',pos=='top'||pos=='bottom'?pos:'middle'];}
|
||||
if(pos.constructor!=Array){pos=['center','middle'];}
|
||||
if(pos[0].constructor==Number){pLeft+=pos[0];}else{switch(pos[0]){case'left':pLeft+=0;break;case'right':pLeft+=wnd.width()-this.uiDialog.outerWidth();break;default:case'center':pLeft+=(wnd.width()-this.uiDialog.outerWidth())/2;}}
|
||||
if(pos[1].constructor==Number){pTop+=pos[1];}else{switch(pos[1]){case'top':pTop+=0;break;case'bottom':pTop+=wnd.height()-this.uiDialog.outerHeight();break;default:case'middle':pTop+=(wnd.height()-this.uiDialog.outerHeight())/2;}}
|
||||
pTop=Math.max(pTop,minTop);this.uiDialog.css({top:pTop,left:pLeft});},_setData:function(key,value){(setDataSwitch[key]&&this.uiDialog.data(setDataSwitch[key],value));switch(key){case"buttons":this._createButtons(value);break;case"closeText":this.uiDialogTitlebarCloseText.text(value);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(uiDialogClasses+value);break;case"draggable":(value?this._makeDraggable():this.uiDialog.draggable('destroy'));break;case"height":this.uiDialog.height(value);break;case"position":this._position(value);break;case"resizable":var uiDialog=this.uiDialog,isResizable=this.uiDialog.is(':data(resizable)');(isResizable&&!value&&uiDialog.resizable('destroy'));(isResizable&&typeof value=='string'&&uiDialog.resizable('option','handles',value));(isResizable||this._makeResizable(value));break;case"title":$(".ui-dialog-title",this.uiDialogTitlebar).html(value||' ');break;case"width":this.uiDialog.width(value);break;}
|
||||
$.widget.prototype._setData.apply(this,arguments);},_size:function(){var options=this.options;this.element.css({height:0,minHeight:0,width:'auto'});var nonContentHeight=this.uiDialog.css({height:'auto',width:options.width}).height();this.element.css({minHeight:Math.max(options.minHeight-nonContentHeight,0),height:options.height=='auto'?'auto':Math.max(options.height-nonContentHeight,0)});}});$.extend($.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:'close',dialogClass:'',draggable:true,hide:null,height:'auto',maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:'center',resizable:true,show:null,stack:true,title:'',width:300,zIndex:1000},getter:'isOpen',uuid:0,maxZ:0,getTitleId:function($el){return'ui-dialog-title-'+($el.attr('id')||++this.uuid);},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog);}});$.extend($.ui.dialog.overlay,{instances:[],maxZ:0,events:$.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(event){return event+'.dialog-overlay';}).join(' '),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){var dialogZ=$(event.target).parents('.ui-dialog').css('zIndex')||0;return(dialogZ>$.ui.dialog.overlay.maxZ);});}},1);$(document).bind('keydown.dialog-overlay',function(event){(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&dialog.close(event));});$(window).bind('resize.dialog-overlay',$.ui.dialog.overlay.resize);}
|
||||
var $el=$('<div></div>').appendTo(document.body).addClass('ui-widget-overlay').css({width:this.width(),height:this.height()});(dialog.options.bgiframe&&$.fn.bgiframe&&$el.bgiframe());this.instances.push($el);return $el;},destroy:function($el){this.instances.splice($.inArray(this.instances,$el),1);if(this.instances.length===0){$([document,window]).unbind('.dialog-overlay');}
|
||||
$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css('z-index'));});this.maxZ=maxZ;},height:function(){if($.browser.msie&&$.browser.version<7){var scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight<offsetHeight){return $(window).height()+'px';}else{return scrollHeight+'px';}}else{return $(document).height()+'px';}},width:function(){if($.browser.msie&&$.browser.version<7){var scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(scrollWidth<offsetWidth){return $(window).width()+'px';}else{return scrollWidth+'px';}}else{return $(document).width()+'px';}},resize:function(){var $overlays=$([]);$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this);});$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()});}});$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el);}});})(jQuery);(function($){$.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable;}
|
||||
this._tabify(true);},_setData:function(key,value){if(key=='selected'){if(this.options.collapsible&&value==this.options.selected){return;}
|
||||
this.select(value);}
|
||||
else{this.options[key]=value;if(key=='deselectable'){this.options.collapsible=value;}
|
||||
this._tabify();}},_tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^A-Za-z0-9\-_:\.]/g,'')||this.options.idPrefix+$.data(a);},_sanitizeSelector:function(hash){return hash.replace(/:/g,'\\:');},_cookie:function(){var cookie=this.cookie||(this.cookie=this.options.cookie.name||'ui-tabs-'+$.data(this.list[0]));return $.cookie.apply(null,[cookie].concat($.makeArray(arguments)));},_ui:function(tab,panel){return{tab:tab,panel:panel,index:this.anchors.index(tab)};},_cleanup:function(){this.lis.filter('.ui-state-processing').removeClass('ui-state-processing').find('span:data(label.tabs)').each(function(){var el=$(this);el.html(el.data('label.tabs')).removeData('label.tabs');});},_tabify:function(init){this.list=this.element.children('ul:first');this.lis=$('li:has(a[href])',this.list);this.anchors=this.lis.map(function(){return $('a',this)[0];});this.panels=$([]);var self=this,o=this.options;var fragmentId=/^#.+/;this.anchors.each(function(i,a){var href=$(a).attr('href');var hrefBase=href.split('#')[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split('#')[0]||(baseEl=$('base')[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href;}
|
||||
if(fragmentId.test(href)){self.panels=self.panels.add(self._sanitizeSelector(href));}
|
||||
else if(href!='#'){$.data(a,'href.tabs',href);$.data(a,'load.tabs',href.replace(/#.*$/,''));var id=self._tabId(a);a.href='#'+id;var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom').insertAfter(self.panels[i-1]||self.list);$panel.data('destroy.tabs',true);}
|
||||
self.panels=self.panels.add($panel);}
|
||||
else{o.disabled.push(i);}});if(init){this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.lis.addClass('ui-state-default ui-corner-top');this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});}
|
||||
if(typeof o.selected!='number'&&o.cookie){o.selected=parseInt(self._cookie(),10);}
|
||||
if(typeof o.selected!='number'&&this.lis.filter('.ui-tabs-selected').length){o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));}
|
||||
o.selected=o.selected||0;}
|
||||
else if(o.selected===null){o.selected=-1;}
|
||||
o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter('.ui-state-disabled'),function(n,i){return self.lis.index(n);}))).sort();if($.inArray(o.selected,o.disabled)!=-1){o.disabled.splice($.inArray(o.selected,o.disabled),1);}
|
||||
this.panels.addClass('ui-tabs-hide');this.lis.removeClass('ui-tabs-selected ui-state-active');if(o.selected>=0&&this.anchors.length){this.panels.eq(o.selected).removeClass('ui-tabs-hide');this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');self.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[o.selected],self.panels[o.selected]));});this.load(o.selected);}
|
||||
$(window).bind('unload',function(){self.lis.add(self.anchors).unbind('.tabs');self.lis=self.anchors=self.panels=null;});}
|
||||
else{o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));}
|
||||
this.element[o.collapsible?'addClass':'removeClass']('ui-tabs-collapsible');if(o.cookie){this._cookie(o.selected,o.cookie);}
|
||||
for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');}
|
||||
if(o.cache===false){this.anchors.removeData('cache.tabs');}
|
||||
this.lis.add(this.anchors).unbind('.tabs');if(o.event!='mouseover'){var addState=function(state,el){if(el.is(':not(.ui-state-disabled)')){el.addClass('ui-state-'+state);}};var removeState=function(state,el){el.removeClass('ui-state-'+state);};this.lis.bind('mouseover.tabs',function(){addState('hover',$(this));});this.lis.bind('mouseout.tabs',function(){removeState('hover',$(this));});this.anchors.bind('focus.tabs',function(){addState('focus',$(this).closest('li'));});this.anchors.bind('blur.tabs',function(){removeState('focus',$(this).closest('li'));});}
|
||||
var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];}
|
||||
else{hideFx=showFx=o.fx;}}
|
||||
function resetStyle($el,fx){$el.css({display:''});if($.browser.msie&&fx.opacity){$el[0].style.removeAttribute('filter');}}
|
||||
var showTab=showFx?function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.hide().removeClass('ui-tabs-hide').animate(showFx,showFx.duration||'normal',function(){resetStyle($show,showFx);self._trigger('show',null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.removeClass('ui-tabs-hide');self._trigger('show',null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||'normal',function(){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');self.element.dequeue("tabs");};this.anchors.bind(o.event+'.tabs',function(){var el=this,$li=$(this).closest('li'),$hide=self.panels.filter(':not(.ui-tabs-hide)'),$show=$(self._sanitizeSelector(this.hash));if(($li.hasClass('ui-tabs-selected')&&!o.collapsible)||$li.hasClass('ui-state-disabled')||$li.hasClass('ui-state-processing')||self._trigger('select',null,self._ui(this,$show[0]))===false){this.blur();return false;}
|
||||
o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass('ui-tabs-selected')){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);}
|
||||
self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;}
|
||||
else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);}
|
||||
self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}}
|
||||
if(o.cookie){self._cookie(o.selected,o.cookie);}
|
||||
if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});}
|
||||
self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));}
|
||||
else{throw'jQuery UI Tabs: Mismatching fragment identifier.';}
|
||||
if($.browser.msie){this.blur();}});this.anchors.bind('click.tabs',function(){return false;});},destroy:function(){var o=this.options;this.abort();this.element.unbind('.tabs').removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible').removeData('tabs');this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.anchors.each(function(){var href=$.data(this,'href.tabs');if(href){this.href=href;}
|
||||
var $this=$(this).unbind('.tabs');$.each(['href','load','cache'],function(i,prefix){$this.removeData(prefix+'.tabs');});});this.lis.unbind('.tabs').add(this.panels).each(function(){if($.data(this,'destroy.tabs')){$(this).remove();}
|
||||
else{$(this).removeClass(['ui-state-default','ui-corner-top','ui-tabs-selected','ui-state-active','ui-state-hover','ui-state-focus','ui-state-disabled','ui-tabs-panel','ui-widget-content','ui-corner-bottom','ui-tabs-hide'].join(' '));}});if(o.cookie){this._cookie(null,o.cookie);}},add:function(url,label,index){if(index===undefined){index=this.anchors.length;}
|
||||
var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf('#')?url.replace('#',''):this._tabId($('a',$li)[0]);$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs',true);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).data('destroy.tabs',true);}
|
||||
$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[0].parentNode);}
|
||||
else{$li.insertBefore(this.lis[index]);$panel.insertBefore(this.panels[index]);}
|
||||
o.disabled=$.map(o.disabled,function(n,i){return n>=index?++n:n;});this._tabify();if(this.anchors.length==1){$li.addClass('ui-tabs-selected ui-state-active');$panel.removeClass('ui-tabs-hide');this.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[0],self.panels[0]));});this.load(0);}
|
||||
this._trigger('add',null,this._ui(this.anchors[index],this.panels[index]));},remove:function(index){var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass('ui-tabs-selected')&&this.anchors.length>1){this.select(index+(index+1<this.anchors.length?1:-1));}
|
||||
o.disabled=$.map($.grep(o.disabled,function(n,i){return n!=index;}),function(n,i){return n>=index?--n:n;});this._tabify();this._trigger('remove',null,this._ui($li.find('a')[0],$panel[0]));},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1){return;}
|
||||
this.lis.eq(index).removeClass('ui-state-disabled');o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger('enable',null,this._ui(this.anchors[index],this.panels[index]));},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass('ui-state-disabled');o.disabled.push(index);o.disabled.sort();this._trigger('disable',null,this._ui(this.anchors[index],this.panels[index]));}},select:function(index){if(typeof index=='string'){index=this.anchors.index(this.anchors.filter('[href$='+index+']'));}
|
||||
else if(index===null){index=-1;}
|
||||
if(index==-1&&this.options.collapsible){index=this.options.selected;}
|
||||
this.anchors.eq(index).trigger(this.options.event+'.tabs');},load:function(index){var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,'load.tabs');this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,'cache.tabs')){this.element.dequeue("tabs");return;}
|
||||
this.lis.eq(index).addClass('ui-state-processing');if(o.spinner){var span=$('span',a);span.data('label.tabs',span.html()).html(o.spinner);}
|
||||
this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,'cache.tabs',true);}
|
||||
self._trigger('load',null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s);}
|
||||
catch(e){}
|
||||
self.element.dequeue("tabs");}}));},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr;}
|
||||
this._cleanup();},url:function(index,url){this.anchors.eq(index).removeData('cache.tabs').data('load.tabs',url);},length:function(){return this.anchors.length;}});$.extend($.ui.tabs,{version:'1.7.2',getter:'length',defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:'click',fx:null,idPrefix:'ui-tabs-',panelTemplate:'<div></div>',spinner:'<em>Loading…</em>',tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0);},ms);if(e){e.stopPropagation();}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null);}}:function(e){t=o.selected;rotate();});if(ms){this.element.bind('tabsshow',rotate);this.anchors.bind(o.event+'.tabs',stop);rotate();}
|
||||
else{clearTimeout(self.rotation);this.element.unbind('tabsshow',rotate);this.anchors.unbind(o.event+'.tabs',stop);delete this._rotate;delete this._unrotate;}}});})(jQuery);(function($){$.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar"
|
||||
+" ui-widget"
|
||||
+" ui-widget-content"
|
||||
+" ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=$('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);this._refreshValue();},destroy:function(){this.element.removeClass("ui-progressbar"
|
||||
+" ui-widget"
|
||||
+" ui-widget-content"
|
||||
+" ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();$.widget.prototype.destroy.apply(this,arguments);},value:function(newValue){if(newValue===undefined){return this._value();}
|
||||
this._setData('value',newValue);return this;},_setData:function(key,value){switch(key){case'value':this.options.value=value;this._refreshValue();this._trigger('change',null,{});break;}
|
||||
$.widget.prototype._setData.apply(this,arguments);},_value:function(){var val=this.options.value;if(val<this._valueMin())val=this._valueMin();if(val>this._valueMax())val=this._valueMax();return val;},_valueMin:function(){var valueMin=0;return valueMin;},_valueMax:function(){var valueMax=100;return valueMax;},_refreshValue:function(){var value=this.value();this.valueDiv[value==this._valueMax()?'addClass':'removeClass']("ui-corner-right");this.valueDiv.width(value+'%');this.element.attr("aria-valuenow",value);}});$.extend($.ui.progressbar,{version:"1.7.2",defaults:{value:0}});})(jQuery);;jQuery.effects||(function($){$.effects={version:"1.7.2",save:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null)element.data("ec.storage."+set[i],element[0].style[set[i]]);}},restore:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null)element.css(set[i],element.data("ec.storage."+set[i]));}},setMode:function(el,mode){if(mode=='toggle')mode=el.is(':hidden')?'show':'hide';return mode;},getBaseline:function(origin,original){var y,x;switch(origin[0]){case'top':y=0;break;case'middle':y=0.5;break;case'bottom':y=1;break;default:y=origin[0]/original.height;};switch(origin[1]){case'left':x=0;break;case'center':x=0.5;break;case'right':x=1;break;default:x=origin[1]/original.width;};return{x:x,y:y};},createWrapper:function(element){if(element.parent().is('.ui-effects-wrapper'))
|
||||
return element.parent();var props={width:element.outerWidth(true),height:element.outerHeight(true),'float':element.css('float')};element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var wrapper=element.parent();if(element.css('position')=='static'){wrapper.css({position:'relative'});element.css({position:'relative'});}else{var top=element.css('top');if(isNaN(parseInt(top,10)))top='auto';var left=element.css('left');if(isNaN(parseInt(left,10)))left='auto';wrapper.css({position:element.css('position'),top:top,left:left,zIndex:element.css('z-index')}).show();element.css({position:'relative',top:0,left:0});}
|
||||
wrapper.css(props);return wrapper;},removeWrapper:function(element){if(element.parent().is('.ui-effects-wrapper'))
|
||||
return element.parent().replaceWith(element);return element;},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){unit=element.cssUnit(x);if(unit[0]>0)value[x]=unit[0]*factor+unit[1];});return value;},animateClass:function(value,duration,easing,callback){var cb=(typeof easing=="function"?easing:(callback?callback:null));var ea=(typeof easing=="string"?easing:null);return this.each(function(){var offset={};var that=$(this);var oldStyleAttr=that.attr("style")||'';if(typeof oldStyleAttr=='object')oldStyleAttr=oldStyleAttr["cssText"];if(value.toggle){that.hasClass(value.toggle)?value.remove=value.toggle:value.add=value.toggle;}
|
||||
var oldStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.addClass(value.add);if(value.remove)that.removeClass(value.remove);var newStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.removeClass(value.add);if(value.remove)that.addClass(value.remove);for(var n in newStyle){if(typeof newStyle[n]!="function"&&newStyle[n]&&n.indexOf("Moz")==-1&&n.indexOf("length")==-1&&newStyle[n]!=oldStyle[n]&&(n.match(/color/i)||(!n.match(/color/i)&&!isNaN(parseInt(newStyle[n],10))))&&(oldStyle.position!="static"||(oldStyle.position=="static"&&!n.match(/left|top|bottom|right/))))offset[n]=newStyle[n];}
|
||||
that.animate(offset,duration,ea,function(){if(typeof $(this).attr("style")=='object'){$(this).attr("style")["cssText"]="";$(this).attr("style")["cssText"]=oldStyleAttr;}else $(this).attr("style",oldStyleAttr);if(value.add)$(this).addClass(value.add);if(value.remove)$(this).removeClass(value.remove);if(cb)cb.apply(this,arguments);});});}};function _normalizeArguments(a,m){var o=a[1]&&a[1].constructor==Object?a[1]:{};if(m)o.mode=m;var speed=a[1]&&a[1].constructor!=Object?a[1]:(o.duration?o.duration:a[2]);speed=$.fx.off?0:typeof speed==="number"?speed:$.fx.speeds[speed]||$.fx.speeds._default;var callback=o.callback||($.isFunction(a[1])&&a[1])||($.isFunction(a[2])&&a[2])||($.isFunction(a[3])&&a[3]);return[a[0],o,speed,callback];}
|
||||
$.fn.extend({_show:$.fn.show,_hide:$.fn.hide,__toggle:$.fn.toggle,_addClass:$.fn.addClass,_removeClass:$.fn.removeClass,_toggleClass:$.fn.toggleClass,effect:function(fx,options,speed,callback){return $.effects[fx]?$.effects[fx].call(this,{method:fx,options:options||{},duration:speed,callback:callback}):null;},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0])))
|
||||
return this._show.apply(this,arguments);else{return this.effect.apply(this,_normalizeArguments(arguments,'show'));}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0])))
|
||||
return this._hide.apply(this,arguments);else{return this.effect.apply(this,_normalizeArguments(arguments,'hide'));}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||($.isFunction(arguments[0])||typeof arguments[0]=='boolean')){return this.__toggle.apply(this,arguments);}else{return this.effect.apply(this,_normalizeArguments(arguments,'toggle'));}},addClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{add:classNames},speed,easing,callback]):this._addClass(classNames);},removeClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{remove:classNames},speed,easing,callback]):this._removeClass(classNames);},toggleClass:function(classNames,speed,easing,callback){return((typeof speed!=="boolean")&&speed)?$.effects.animateClass.apply(this,[{toggle:classNames},speed,easing,callback]):this._toggleClass(classNames,speed);},morph:function(remove,add,speed,easing,callback){return $.effects.animateClass.apply(this,[{add:add,remove:remove},speed,easing,callback]);},switchClass:function(){return this.morph.apply(this,arguments);},cssUnit:function(key){var style=this.css(key),val=[];$.each(['em','px','%','pt'],function(i,unit){if(style.indexOf(unit)>0)
|
||||
val=[parseFloat(style),unit];});return val;}});$.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){$.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}
|
||||
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0],10),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1],10),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2],10),255),0)].join(",")+")";};});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
|
||||
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
|
||||
return[parseInt(result[1],10),parseInt(result[2],10),parseInt(result[3],10)];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
|
||||
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
|
||||
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
|
||||
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];if(result=/rgba\(0, 0, 0, 0\)/.exec(color))
|
||||
return colors['transparent'];return colors[$.trim(color).toLowerCase()];}
|
||||
function getColor(elem,attr){var color;do{color=$.curCSS(elem,attr);if(color!=''&&color!='transparent'||$.nodeName(elem,"body"))
|
||||
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};$.easing.jswing=$.easing.swing;$.extend($.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;}
|
||||
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-$.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return $.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return $.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}});})(jQuery);(function($){$.effects.highlight=function(o){return this.queue(function(){var el=$(this),props=['backgroundImage','backgroundColor','opacity'];var mode=$.effects.setMode(el,o.options.mode||'show');var color=o.options.color||"#ffff99";var oldColor=el.css("backgroundColor");$.effects.save(el,props);el.show();el.css({backgroundImage:'none',backgroundColor:color});var animation={backgroundColor:oldColor};if(mode=="hide")animation['opacity']=0;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide")el.hide();$.effects.restore(el,props);if(mode=="show"&&$.browser.msie)this.style.removeAttribute('filter');if(o.callback)o.callback.apply(this,arguments);el.dequeue();}});});};})(jQuery);(function($){$.effects.transfer=function(o){return this.queue(function(){var elem=$(this),target=$(o.options.to),endPosition=target.offset(),animation={top:endPosition.top,left:endPosition.left,height:target.innerHeight(),width:target.innerWidth()},startPosition=elem.offset(),transfer=$('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(o.options.className).css({top:startPosition.top,left:startPosition.left,height:elem.innerHeight(),width:elem.innerWidth(),position:'absolute'}).animate(animation,o.duration,o.options.easing,function(){transfer.remove();(o.callback&&o.callback.apply(elem[0],arguments));elem.dequeue();});});};})(jQuery);
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
### jQuery Multiple File Upload Plugin v1.3 - 2008-09-30 ###
|
||||
* http://www.fyneworks.com/ - diego@fyneworks.com
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
###
|
||||
Project: http://jquery.com/plugins/project/MultiFile/
|
||||
Website: http://www.fyneworks.com/jquery/multiple-file-upload/
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';2(K.1k)(3($){$.B($,{6:3(o){7 $("16:q.2L").6(o)}});$.B($.6,{18:{j:\'\',l:-1,1u:3(s){2($.1F){$.1F({2j:s.x(/\\n/m,\'<2i/>\'),19:{17:\'2K\',2s:\'2J\',2y:\'12.2I\',21:\'#1Q\',1P:\'#1O\',20:\'.8\',\'-1Z-17-1j\':\'1G\',\'-2f-17-1j\':\'1G\'}});K.2e($.2d,2h)}1m{2g(s)}},1p:\'$H\',y:{J:\'J\',1v:\'2r 2n 2q a $W q.\\2v 2x...\',T:\'2D T: $q\',1E:\'2E q 2H 1L 1J T:\\n$q\'}}});$.B($.6,{Z:3(a){p o=[];$(\'16:q\').M(3(){2($(5).X()==\'\')o[o.11]=5});7 $(o).M(3(){5.P=U}).1t(a||\'1w\')},1a:3(a){a=a||\'1w\';7 $(\'16:q.\'+a).1W(a).M(3(){5.P=t})},O:[\'28\',\'24\',\'27\'],1b:{},1H:3(b,c,d){p e,k;d=d||[];2(d.1l.1s().1o("1n")<0)d=[d];2(14(b)==\'3\'){$.6.Z();k=b.1r(c||K,d);$.6.1a();7 k};2(b.1l.1s().1o("1n")<0)b=[b];1q(p i=0;i<b.11;i++){e=b[i]+\'\';2(e)(3(a){$.6.1b[a]=$.15[a]||3(){};$.15[a]=3(){$.6.Z();k=$.6.1b[a].1r(5,2m);$.6.1a();7 k}})(e)}}});$.B($.15,{1c:3(){7 5.M(3(){2l{5.1c()}2k(e){}})},6:3(h){2($.6.O){$.6.1H($.6.O);$.6.O=L};7 $(5).M(3(e){2(5.1x)7;5.1x=U;K.6=(K.6||0)+1;e=K.6;p g={e:5,E:$(5),N:$(5).N()};2(14 h==\'2p\')h={l:h};2(14 h==\'2o\')h={j:h};p o=$.B({},$.6.18,h||{},($.2u?g.E.2t():($.1B?g.E.1B():L))||{});2(!(o.l>0)){o.l=g.E.D(\'2w\');2(!(o.l>0)){o.l=(u(g.e.1D.C(/\\b(l|2A)\\-([0-9]+)\\b/m)||[\'\']).C(/[0-9]+/m)||[\'\'])[0];2(!(o.l>0))o.l=-1;1m o.l=u(o.l).C(/[0-9]+/m)[0]}};o.l=Y 2C(o.l);o.j=o.j||g.E.D(\'j\')||\'\';2(!o.j){o.j=(g.e.1D.C(/\\b(j\\-[\\w\\|]+)\\b/m))||\'\';o.j=Y u(o.j).x(/^(j|W)\\-/i,\'\')};$.B(g,o||{});g.y=$.B({},$.6.18.y,g.y);$.B(g,{n:0,F:[],2G:[],1d:g.e.A||\'6\'+u(e),1e:3(z){7 g.1d+(z>0?\'1I\'+u(z):\'\')},G:3(a,b){p c=g[a],k=$(b).D(\'k\');2(c){p d=c(b,k,g);2(d!=L)7 d}7 U}});2(u(g.j).11>1){g.1f=Y 1K(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'m\')};g.I=g.1d+\'1N\';g.E.1M(\'<S A="\'+g.I+\'"></S>\');g.1g=$(\'#\'+g.I+\'\');g.e.H=g.e.H||\'q\'+e+\'[]\';g.1g.10(\'<R A="\'+g.I+\'1h"></R>\');g.13=$(\'#\'+g.I+\'1h\');g.V=3(c,d){g.n++;c.1i=g;c.i=d;2(c.i>0)c.A=c.H=L;c.A=c.A||g.1e(c.i);c.H=u(g.1p.x(/\\$H/m,g.E.D(\'H\')).x(/\\$A/m,g.E.D(\'A\')).x(/\\$g/m,(e>0?e:\'\')).x(/\\$i/m,(d>0?d:\'\')));$(c).X(\'\').D(\'k\',\'\')[0].k=\'\';2((g.l>0)&&((g.n-1)>(g.l)))c.P=U;g.Q=g.F[c.i]=c;c=$(c);$(c).1R(3(){$(5).1T();2(!g.G(\'1S\',5,g))7 t;p a=\'\',v=u(5.k||\'\');2(g.j&&v&&!v.C(g.1f))a=g.y.1v.x(\'$W\',u(v.C(/\\.\\w{1,4}$/m)));1q(p f 1U g.F)2(g.F[f]&&g.F[f]!=5)2(g.F[f].k==v)a=g.y.1E.x(\'$q\',v.C(/[^\\/\\\\]+$/m));p b=$(g.N).N();b.1t(\'6\');2(a!=\'\'){g.1u(a);g.n--;g.V(b[0],5.i);c.1y().1V(b);c.J();7 t};$(5).19({1A:\'1Y\',1z:\'-1X\'});g.13.22(b);g.1C(5);g.V(b[0],5.i+1);2(!g.G(\'23\',5,g))7 t})};g.1C=3(c){2(!g.G(\'2z\',c,g))7 t;p r=$(\'<S></S>\'),v=u(c.k||\'\'),a=$(\'<R 25="q" 26="\'+g.y.T.x(\'$q\',v)+\'">\'+v.C(/[^\\/\\\\]+$/m)[0]+\'</R>\'),b=$(\'<a 2B="#\'+g.I+\'">\'+g.y.J+\'</a>\');g.13.10(r.10(\'[\',b,\']&2b;\',a));b.29(3(){2(!g.G(\'2a\',c,g))7 t;g.n--;g.Q.P=t;g.F[c.i]=L;$(c).J();$(5).1y().J();$(g.Q).19({1A:\'\',1z:\'\'});$(g.Q).1c().X(\'\').D(\'k\',\'\')[0].k=\'\';2(!g.G(\'2F\',c,g))7 t;7 t});2(!g.G(\'2c\',c,g))7 t};2(!g.1i)g.V(g.e,0);g.n++})}});$(3(){$.6()})})(1k);',62,172,'||if|function||this|MultiFile|return||||||||||||accept|value|max|gi|||var|file|||false|String|||replace|STRING||id|extend|match|attr||slaves|trigger|name|wrapID|remove|window|null|each|clone|autoIntercept|disabled|current|span|div|selected|true|addSlave|ext|val|new|disableEmpty|append|length||labels|typeof|fn|input|border|options|css|reEnableEmpty|intercepted|reset|instanceKey|generateID|rxAccept|wrapper|_labels|MF|radius|jQuery|constructor|else|Array|indexOf|namePattern|for|apply|toString|addClass|error|denied|mfD|_MultiFile|parent|top|position|metadata|addToList|className|duplicate|blockUI|10px|intercept|_F|been|RegExp|already|wrap|_wrap|fff|color|900|change|onFileSelect|blur|in|prepend|removeClass|3000px|absolute|webkit|opacity|backgroundColor|before|afterFileSelect|ajaxSubmit|class|title|validate|submit|click|onFileRemove|nbsp|afterFileAppend|unblockUI|setTimeout|moz|alert|2000|br|message|catch|try|arguments|cannot|string|number|select|You|padding|data|meta|nTry|maxlength|again|size|onFileAppend|limit|href|Number|File|This|afterFileRemove|files|has|0pt|15px|none|multi'.split('|'),0,{}))
|
|
@ -0,0 +1,49 @@
|
|||
.ac_results {
|
||||
padding: 0px;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0px;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
/*
|
||||
if width will be 100% horizontal scrollbar will apear
|
||||
when scroll mode will be used
|
||||
*/
|
||||
/*width: 100%;*/
|
||||
font: menu;
|
||||
font-size: 12px;
|
||||
/*
|
||||
it is very important, if line-height not setted or setted
|
||||
in relative units scroll will be broken in firefox
|
||||
*/
|
||||
line-height: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ac_loading {
|
||||
background: white url('images/loading-small.gif') right center no-repeat;
|
||||
}
|
||||
|
||||
.ac_odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #0A246A;
|
||||
color: white;
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined') { // name and value given, set cookie
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||||
}
|
||||
// CAUTION: Needed to parenthesize options.path and options.domain
|
||||
// in the following expressions, otherwise they evaluate to undefined
|
||||
// in the packed version for some reason...
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { // only name given, get cookie
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,645 @@
|
|||
/*
|
||||
* jQuery Form Plugin
|
||||
* version: 2.28 (10-MAY-2009)
|
||||
* @requires jQuery v1.2.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
/*
|
||||
Usage Note:
|
||||
-----------
|
||||
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
||||
functions are intended to be exclusive. Use ajaxSubmit if you want
|
||||
to bind your own submit handler to the form. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').bind('submit', function() {
|
||||
$(this).ajaxSubmit({
|
||||
target: '#output'
|
||||
});
|
||||
return false; // <-- important!
|
||||
});
|
||||
});
|
||||
|
||||
Use ajaxForm when you want the plugin to manage all the event binding
|
||||
for you. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').ajaxForm({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
|
||||
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
||||
at the appropriate time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for immediately submitting
|
||||
* an HTML form using AJAX.
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
||||
if (!this.length) {
|
||||
log('ajaxSubmit: skipping submit process - no element selected');
|
||||
return this;
|
||||
}
|
||||
|
||||
if (typeof options == 'function')
|
||||
options = { success: options };
|
||||
|
||||
var url = $.trim(this.attr('action'));
|
||||
if (url) {
|
||||
// clean url (don't include hash vaue)
|
||||
url = (url.match(/^([^#]+)/)||[])[1];
|
||||
}
|
||||
url = url || window.location.href || ''
|
||||
|
||||
options = $.extend({
|
||||
url: url,
|
||||
type: this.attr('method') || 'GET'
|
||||
}, options || {});
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
// provide opportunity to alter form data before it is serialized
|
||||
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
var a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (var n in options.data) {
|
||||
if(options.data[n] instanceof Array) {
|
||||
for (var k in options.data[n])
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
else
|
||||
a.push( { name: n, value: options.data[n] } );
|
||||
}
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else
|
||||
options.data = q; // data is the query string for 'post'
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
||||
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
$(options.target).html(data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success)
|
||||
callbacks.push(options.success);
|
||||
|
||||
options.success = function(data, status) {
|
||||
for (var i=0, max=callbacks.length; i < max; i++)
|
||||
callbacks[i].apply(options, [data, status, $form]);
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var files = $('input:file', this).fieldValue();
|
||||
var found = false;
|
||||
for (var j=0; j < files.length; j++)
|
||||
if (files[j])
|
||||
found = true;
|
||||
|
||||
var multipart = false;
|
||||
// var mp = 'multipart/form-data';
|
||||
// multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
if (options.iframe || found || multipart) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if (options.closeKeepAlive)
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
else
|
||||
fileUpload();
|
||||
}
|
||||
else
|
||||
$.ajax(options);
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
|
||||
/* (this breaks the watermark form uploader, turn it off for now)
|
||||
if ($(':input[name=submit]', form).length) {
|
||||
alert('Error: Form elements must not be named "submit".');
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
var opts = $.extend({}, $.ajaxSettings, options);
|
||||
var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
|
||||
|
||||
var id = 'jqFormIO' + (new Date().getTime());
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
|
||||
var io = $io[0];
|
||||
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
aborted: 0,
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {},
|
||||
abort: function() {
|
||||
this.aborted = 1;
|
||||
$io.attr('src','about:blank'); // abort op in progress
|
||||
}
|
||||
};
|
||||
|
||||
var g = opts.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
||||
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
||||
|
||||
if (s.beforeSend && s.beforeSend(xhr, s) === false) {
|
||||
s.global && $.active--;
|
||||
return;
|
||||
}
|
||||
if (xhr.aborted)
|
||||
return;
|
||||
|
||||
var cbInvoked = 0;
|
||||
var timedOut = 0;
|
||||
|
||||
// add submitting element to data if we know it
|
||||
var sub = form.clk;
|
||||
if (sub) {
|
||||
var n = sub.name;
|
||||
if (n && !sub.disabled) {
|
||||
options.extraData = options.extraData || {};
|
||||
options.extraData[n] = sub.value;
|
||||
if (sub.type == "image") {
|
||||
options.extraData[name+'.x'] = form.clk_x;
|
||||
options.extraData[name+'.y'] = form.clk_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
setTimeout(function() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
|
||||
// update form attrs in IE friendly way
|
||||
form.setAttribute('target',id);
|
||||
if (form.getAttribute('method') != 'POST')
|
||||
form.setAttribute('method', 'POST');
|
||||
if (form.getAttribute('action') != opts.url)
|
||||
form.setAttribute('action', opts.url);
|
||||
|
||||
// ie borks in some cases when setting encoding
|
||||
if (! options.skipEncodingOverride) {
|
||||
$form.attr({
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data'
|
||||
});
|
||||
}
|
||||
|
||||
// support timout
|
||||
if (opts.timeout)
|
||||
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (options.extraData)
|
||||
for (var n in options.extraData)
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
form.setAttribute('action',a);
|
||||
t ? form.setAttribute('target', t) : $form.removeAttr('target');
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
var nullCheckFlag = 0;
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked++) return;
|
||||
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) throw 'timeout';
|
||||
// extract the server response from the iframe
|
||||
var data, doc;
|
||||
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
|
||||
if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
|
||||
// in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
|
||||
// the onload callback fires, so we give them a 2nd chance
|
||||
nullCheckFlag = 1;
|
||||
cbInvoked--;
|
||||
setTimeout(cb, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': opts.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
xhr.responseText = ta ? ta.value : xhr.responseText;
|
||||
}
|
||||
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
data = $.httpData(xhr, opts.dataType);
|
||||
}
|
||||
catch(e){
|
||||
ok = false;
|
||||
$.handleError(opts, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
opts.success(data, 'success');
|
||||
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
||||
}
|
||||
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
||||
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
||||
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself.
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
}).each(function() {
|
||||
// store options in hash
|
||||
$(":submit,input:image", this).bind('click.form-plugin',function(e) {
|
||||
var form = this.form;
|
||||
form.clk = this;
|
||||
if (this.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
form.clk_x = e.offsetX;
|
||||
form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $(this).offset();
|
||||
form.clk_x = e.pageX - offset.left;
|
||||
form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
form.clk_x = e.pageX - this.offsetLeft;
|
||||
form.clk_y = e.pageY - this.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
this.unbind('submit.form-plugin');
|
||||
return this.each(function() {
|
||||
$(":submit,input:image", this).unbind('click.form-plugin');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length == 0) return a;
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el) {
|
||||
a.push({name: n, value: $(el).val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle it here
|
||||
var $input = $(form.clk), input = $input[0], n = input.name;
|
||||
if (n && !input.disabled && input.type == 'image') {
|
||||
a.push({name: n, value: $input.val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) return;
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++)
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: this.name, value: v});
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
||||
continue;
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
var v = op.value;
|
||||
if (!v) // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea')
|
||||
this.value = '';
|
||||
else if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = false;
|
||||
else if (tag == 'select')
|
||||
this.selectedIndex = -1;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b == undefined) b = true;
|
||||
return this.each(function() {
|
||||
this.disabled = !b;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*/
|
||||
$.fn.selected = function(select) {
|
||||
if (select == undefined) select = true;
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = select;
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').selected(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// helper fn for console logging
|
||||
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
||||
function log() {
|
||||
if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
|
||||
window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
(function($){$.fn.editable=function(target,options){var settings={target:target,name:'value',id:'id',type:'text',width:'auto',height:'auto',event:'click',onblur:'cancel',loadtype:'GET',loadtext:'Loading...',placeholder:'Click to edit',loaddata:{},submitdata:{},ajaxoptions:{}};if(options){$.extend(settings,options);}
|
||||
var plugin=$.editable.types[settings.type].plugin||function(){};var submit=$.editable.types[settings.type].submit||function(){};var buttons=$.editable.types[settings.type].buttons||$.editable.types['defaults'].buttons;var content=$.editable.types[settings.type].content||$.editable.types['defaults'].content;var element=$.editable.types[settings.type].element||$.editable.types['defaults'].element;var reset=$.editable.types[settings.type].reset||$.editable.types['defaults'].reset;var callback=settings.callback||function(){};var onsubmit=settings.onsubmit||function(){};var onreset=settings.onreset||function(){};var onerror=settings.onerror||reset;if(!$.isFunction($(this)[settings.event])){$.fn[settings.event]=function(fn){return fn?this.bind(settings.event,fn):this.trigger(settings.event);}}
|
||||
$(this).attr('title',settings.tooltip);settings.autowidth='auto'==settings.width;settings.autoheight='auto'==settings.height;return this.each(function(){var self=this;var savedwidth=$(self).width();var savedheight=$(self).height();if(!$.trim($(this).html())){$(this).html(settings.placeholder);}
|
||||
$(this)[settings.event](function(e){if(self.editing){return;}
|
||||
$(self).removeAttr('title');if(0==$(self).width()){settings.width=savedwidth;settings.height=savedheight;}else{if(settings.width!='none'){settings.width=settings.autowidth?$(self).width():settings.width;}
|
||||
if(settings.height!='none'){settings.height=settings.autoheight?$(self).height():settings.height;}}
|
||||
if($(this).html().toLowerCase().replace(/;/,'')==settings.placeholder.toLowerCase().replace(/;/,'')){$(this).html('');}
|
||||
self.editing=true;self.revert=$(self).html();$(self).html('');var form=$('<form />');if(settings.cssclass){if('inherit'==settings.cssclass){form.attr('class',$(self).attr('class'));}else{form.attr('class',settings.cssclass);}}
|
||||
if(settings.style){if('inherit'==settings.style){form.attr('style',$(self).attr('style'));form.css('display',$(self).css('display'));}else{form.attr('style',settings.style);}}
|
||||
var input=element.apply(form,[settings,self]);var input_content;if(settings.loadurl){var t=setTimeout(function(){input.disabled=true;content.apply(form,[settings.loadtext,settings,self]);},100);var loaddata={};loaddata[settings.id]=self.id;if($.isFunction(settings.loaddata)){$.extend(loaddata,settings.loaddata.apply(self,[self.revert,settings]));}else{$.extend(loaddata,settings.loaddata);}
|
||||
$.ajax({type:settings.loadtype,url:settings.loadurl,data:loaddata,async:false,success:function(result){window.clearTimeout(t);input_content=result;input.disabled=false;}});}else if(settings.data){input_content=settings.data;if($.isFunction(settings.data)){input_content=settings.data.apply(self,[self.revert,settings]);}}else{input_content=self.revert;}
|
||||
content.apply(form,[input_content,settings,self]);input.attr('name',settings.name);buttons.apply(form,[settings,self]);$(self).append(form);plugin.apply(form,[settings,self]);$(':input:visible:enabled:first',form).focus();if(settings.select){input.select();}
|
||||
input.keydown(function(e){if(e.keyCode==27){e.preventDefault();reset.apply(form,[settings,self]);}});var t;if('cancel'==settings.onblur){input.blur(function(e){t=setTimeout(function(){reset.apply(form,[settings,self]);},500);});}else if('submit'==settings.onblur){input.blur(function(e){t=setTimeout(function(){form.submit();},200);});}else if($.isFunction(settings.onblur)){input.blur(function(e){settings.onblur.apply(self,[input.val(),settings]);});}else{input.blur(function(e){});}
|
||||
form.submit(function(e){if(t){clearTimeout(t);}
|
||||
e.preventDefault();if(false!==onsubmit.apply(form,[settings,self])){if(false!==submit.apply(form,[settings,self])){if($.isFunction(settings.target)){var str=settings.target.apply(self,[input.val(),settings]);$(self).html(str);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}}else{var submitdata={};submitdata[settings.name]=input.val();submitdata[settings.id]=self.id;if($.isFunction(settings.submitdata)){$.extend(submitdata,settings.submitdata.apply(self,[self.revert,settings]));}else{$.extend(submitdata,settings.submitdata);}
|
||||
if('PUT'==settings.method){submitdata['_method']='put';}
|
||||
$(self).html(settings.indicator);var ajaxoptions={type:'POST',data:submitdata,url:settings.target,success:function(result,status){$(self).html(result);self.editing=false;callback.apply(self,[self.innerHTML,settings]);if(!$.trim($(self).html())){$(self).html(settings.placeholder);}},error:function(xhr,status,error){onerror.apply(form,[settings,self,xhr]);}}
|
||||
$.extend(ajaxoptions,settings.ajaxoptions);$.ajax(ajaxoptions);}}}
|
||||
$(self).attr('title',settings.tooltip);return false;});});this.reset=function(form){if(this.editing){if(false!==onreset.apply(form,[settings,self])){$(self).html(self.revert);self.editing=false;if(!$.trim($(self).html())){$(self).html(settings.placeholder);}
|
||||
$(self).attr('title',settings.tooltip);}}}});};$.editable={types:{defaults:{element:function(settings,original){var input=$('<input type="hidden"></input>');$(this).append(input);return(input);},content:function(string,settings,original){$(':input:first',this).val(string);},reset:function(settings,original){original.reset(this);},buttons:function(settings,original){var form=this;if(settings.submit){if(settings.submit.match(/>$/)){var submit=$(settings.submit).click(function(){if(submit.attr("type")!="submit"){form.submit();}});}else{var submit=$('<button type="submit" />');submit.html(settings.submit);}
|
||||
$(this).append(submit);}
|
||||
if(settings.cancel){if(settings.cancel.match(/>$/)){var cancel=$(settings.cancel);}else{var cancel=$('<button type="cancel" />');cancel.html(settings.cancel);}
|
||||
$(this).append(cancel);$(cancel).click(function(event){if($.isFunction($.editable.types[settings.type].reset)){var reset=$.editable.types[settings.type].reset;}else{var reset=$.editable.types['defaults'].reset;}
|
||||
reset.apply(form,[settings,original]);return false;});}}},text:{element:function(settings,original){var input=$('<input />');if(settings.width!='none'){input.width(settings.width);}
|
||||
if(settings.height!='none'){input.height(settings.height);}
|
||||
input.attr('autocomplete','off');$(this).append(input);return(input);}},textarea:{element:function(settings,original){var textarea=$('<textarea />');if(settings.rows){textarea.attr('rows',settings.rows);}else{textarea.height(settings.height);}
|
||||
if(settings.cols){textarea.attr('cols',settings.cols);}else{textarea.width(settings.width);}
|
||||
$(this).append(textarea);return(textarea);}},select:{element:function(settings,original){var select=$('<select />');$(this).append(select);return(select);},content:function(string,settings,original){if(String==string.constructor){eval('var json = '+string);for(var key in json){if(!json.hasOwnProperty(key)){continue;}
|
||||
if('selected'==key){continue;}
|
||||
var option=$('<option />').val(key).append(json[key]);$('select',this).append(option);}}
|
||||
$('select',this).children().each(function(){if($(this).val()==json['selected']||$(this).text()==original.revert){$(this).attr('selected','selected');};});}}},addInputType:function(name,input){$.editable.types[name]=input;}};})(jQuery);
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* jQuery.LocalScroll - Animated scrolling navigation, using anchors.
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 3/11/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.2.7
|
||||
**/
|
||||
;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery);
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* jQuery.ScrollTo - Easy element scrolling using jQuery.
|
||||
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
|
||||
* Dual licensed under MIT and GPL.
|
||||
* Date: 5/25/2009
|
||||
* @author Ariel Flesler
|
||||
* @version 1.4.2
|
||||
*
|
||||
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
||||
*/
|
||||
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
http://www.JSON.org/json2.js
|
||||
2010-11-17
|
||||
|
||||
Public Domain.
|
||||
|
||||
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
|
||||
See http://www.JSON.org/js.html
|
||||
*/
|
||||
|
||||
if(!this.JSON){this.JSON={};}
|
||||
(function(){"use strict";function f(n){return n<10?'0'+n:n;}
|
||||
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
|
||||
f(this.getUTCMonth()+1)+'-'+
|
||||
f(this.getUTCDate())+'T'+
|
||||
f(this.getUTCHours())+':'+
|
||||
f(this.getUTCMinutes())+':'+
|
||||
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
|
||||
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
|
||||
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
|
||||
if(typeof rep==='function'){value=rep.call(holder,key,value);}
|
||||
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
|
||||
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
|
||||
v=partial.length===0?'[]':gap?'[\n'+gap+
|
||||
partial.join(',\n'+gap)+'\n'+
|
||||
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
|
||||
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
|
||||
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
|
||||
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
|
||||
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
|
||||
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
|
||||
return str('',{'':value});};}
|
||||
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
|
||||
return reviver.call(holder,key,value);}
|
||||
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
|
||||
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
|
||||
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
|
||||
throw new SyntaxError('JSON.parse');};}}());
|
|
@ -0,0 +1,136 @@
|
|||
|
||||
/*** ESSENTIAL STYLES ***/
|
||||
.sf-menu, .sf-menu * {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.sf-menu {
|
||||
line-height: 1.0;
|
||||
}
|
||||
.sf-menu ul {
|
||||
position: absolute;
|
||||
top: -999em;
|
||||
width: 10em; /* left offset of submenus need to match (see below) */
|
||||
}
|
||||
.sf-menu ul li {
|
||||
width: 100%;
|
||||
}
|
||||
.sf-menu li:hover {
|
||||
visibility: inherit; /* fixes IE7 'sticky bug' */
|
||||
}
|
||||
.sf-menu li {
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu a {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.sf-menu li:hover ul,
|
||||
.sf-menu li.sfHover ul {
|
||||
left: 0;
|
||||
top: 2.5em; /* match top ul list item height */
|
||||
z-index: 99;
|
||||
}
|
||||
ul.sf-menu li:hover li ul,
|
||||
ul.sf-menu li.sfHover li ul {
|
||||
top: -999em;
|
||||
}
|
||||
ul.sf-menu li li:hover ul,
|
||||
ul.sf-menu li li.sfHover ul {
|
||||
left: 10em; /* match ul width */
|
||||
top: 0;
|
||||
}
|
||||
ul.sf-menu li li:hover li ul,
|
||||
ul.sf-menu li li.sfHover li ul {
|
||||
top: -999em;
|
||||
}
|
||||
ul.sf-menu li li li:hover ul,
|
||||
ul.sf-menu li li li.sfHover ul {
|
||||
left: 10em; /* match ul width */
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/*** DEMO SKIN ***/
|
||||
.sf-menu {
|
||||
float: left;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.sf-menu a {
|
||||
border-left: 1px solid #fff;
|
||||
border-top: 1px solid #CFDEFF;
|
||||
padding: .75em 1em;
|
||||
text-decoration:none;
|
||||
}
|
||||
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
|
||||
color: #13a;
|
||||
}
|
||||
.sf-menu li {
|
||||
background: #BDD2FF;
|
||||
}
|
||||
.sf-menu li li {
|
||||
background: #AABDE6;
|
||||
}
|
||||
.sf-menu li li li {
|
||||
background: #9AAEDB;
|
||||
}
|
||||
.sf-menu li:hover, .sf-menu li.sfHover,
|
||||
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
|
||||
background: #CFDEFF;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/*** arrows **/
|
||||
.sf-menu a.sf-with-ul {
|
||||
padding-right: 2.25em;
|
||||
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
|
||||
}
|
||||
.sf-sub-indicator {
|
||||
position: absolute;
|
||||
display: block;
|
||||
right: .75em;
|
||||
top: 1.05em; /* IE6 only */
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
text-indent: -999em;
|
||||
overflow: hidden;
|
||||
background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
|
||||
}
|
||||
a > .sf-sub-indicator { /* give all except IE6 the correct values */
|
||||
top: .8em;
|
||||
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
|
||||
}
|
||||
/* apply hovers to modern browsers */
|
||||
a:focus > .sf-sub-indicator,
|
||||
a:hover > .sf-sub-indicator,
|
||||
a:active > .sf-sub-indicator,
|
||||
li:hover > a > .sf-sub-indicator,
|
||||
li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px -100px; /* arrow hovers for modern browsers*/
|
||||
}
|
||||
|
||||
/* point right for anchors in subs */
|
||||
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
|
||||
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
|
||||
/* apply hovers to modern browsers */
|
||||
.sf-menu ul a:focus > .sf-sub-indicator,
|
||||
.sf-menu ul a:hover > .sf-sub-indicator,
|
||||
.sf-menu ul a:active > .sf-sub-indicator,
|
||||
.sf-menu ul li:hover > a > .sf-sub-indicator,
|
||||
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
|
||||
background-position: -10px 0; /* arrow hovers for modern browsers*/
|
||||
}
|
||||
|
||||
/*** shadows for all but IE6 ***/
|
||||
.sf-shadow ul {
|
||||
background: url('../images/shadow.png') no-repeat bottom right;
|
||||
padding: 0 8px 9px 0;
|
||||
-moz-border-radius-bottomleft: 17px;
|
||||
-moz-border-radius-topright: 17px;
|
||||
-webkit-border-top-right-radius: 17px;
|
||||
-webkit-border-bottom-left-radius: 17px;
|
||||
}
|
||||
.sf-shadow ul.sf-shadow-off {
|
||||
background: transparent;
|
||||
}
|
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,121 @@
|
|||
|
||||
/*
|
||||
* Superfish v1.4.8 - jQuery menu widget
|
||||
* Copyright (c) 2008 Joel Birch
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
|
||||
*/
|
||||
|
||||
;(function($){
|
||||
$.fn.superfish = function(op){
|
||||
|
||||
var sf = $.fn.superfish,
|
||||
c = sf.c,
|
||||
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
|
||||
over = function(){
|
||||
var $$ = $(this), menu = getMenu($$);
|
||||
clearTimeout(menu.sfTimer);
|
||||
$$.showSuperfishUl().siblings().hideSuperfishUl();
|
||||
},
|
||||
out = function(){
|
||||
var $$ = $(this), menu = getMenu($$), o = sf.op;
|
||||
clearTimeout(menu.sfTimer);
|
||||
menu.sfTimer=setTimeout(function(){
|
||||
o.retainPath=($.inArray($$[0],o.$path)>-1);
|
||||
$$.hideSuperfishUl();
|
||||
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
|
||||
},o.delay);
|
||||
},
|
||||
getMenu = function($menu){
|
||||
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
|
||||
sf.op = sf.o[menu.serial];
|
||||
return menu;
|
||||
},
|
||||
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
|
||||
|
||||
return this.each(function() {
|
||||
var s = this.serial = sf.o.length;
|
||||
var o = $.extend({},sf.defaults,op);
|
||||
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
|
||||
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
|
||||
.filter('li:has(ul)').removeClass(o.pathClass);
|
||||
});
|
||||
sf.o[s] = sf.op = o;
|
||||
|
||||
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
|
||||
if (o.autoArrows) addArrow( $('>a:first-child',this) );
|
||||
})
|
||||
.not('.'+c.bcClass)
|
||||
.hideSuperfishUl();
|
||||
|
||||
var $a = $('a',this);
|
||||
$a.each(function(i){
|
||||
var $li = $a.eq(i).parents('li');
|
||||
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
|
||||
});
|
||||
o.onInit.call(this);
|
||||
|
||||
}).each(function() {
|
||||
var menuClasses = [c.menuClass];
|
||||
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
|
||||
$(this).addClass(menuClasses.join(' '));
|
||||
});
|
||||
};
|
||||
|
||||
var sf = $.fn.superfish;
|
||||
sf.o = [];
|
||||
sf.op = {};
|
||||
sf.IE7fix = function(){
|
||||
var o = sf.op;
|
||||
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
|
||||
this.toggleClass(sf.c.shadowClass+'-off');
|
||||
};
|
||||
sf.c = {
|
||||
bcClass : 'sf-breadcrumb',
|
||||
menuClass : 'sf-js-enabled',
|
||||
anchorClass : 'sf-with-ul',
|
||||
arrowClass : 'sf-sub-indicator',
|
||||
shadowClass : 'sf-shadow'
|
||||
};
|
||||
sf.defaults = {
|
||||
hoverClass : 'sfHover',
|
||||
pathClass : 'overideThisToUse',
|
||||
pathLevels : 1,
|
||||
delay : 800,
|
||||
animation : {opacity:'show'},
|
||||
speed : 'normal',
|
||||
autoArrows : true,
|
||||
dropShadows : true,
|
||||
disableHI : false, // true disables hoverIntent detection
|
||||
onInit : function(){}, // callback functions
|
||||
onBeforeShow: function(){},
|
||||
onShow : function(){},
|
||||
onHide : function(){}
|
||||
};
|
||||
$.fn.extend({
|
||||
hideSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
not = (o.retainPath===true) ? o.$path : '';
|
||||
o.retainPath = false;
|
||||
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
|
||||
.find('>ul').hide().css('visibility','hidden');
|
||||
o.onHide.call($ul);
|
||||
return this;
|
||||
},
|
||||
showSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
sh = sf.c.shadowClass+'-off',
|
||||
$ul = this.addClass(o.hoverClass)
|
||||
.find('>ul:hidden').css('visibility','visible');
|
||||
sf.IE7fix.call($ul);
|
||||
o.onBeforeShow.call($ul);
|
||||
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
After Width: | Height: | Size: 603 B |
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
Uploadify v2.1.0
|
||||
Release Date: August 24, 2009
|
||||
|
||||
Copyright (c) 2009 Ronnie Garcia, Travis Nickels
|
||||
|
||||
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.
|
||||
*/
|
||||
.uploadifyQueueItem {
|
||||
font: 11px Verdana, Geneva, sans-serif;
|
||||
border: 2px solid #E5E5E5;
|
||||
background-color: #F5F5F5;
|
||||
margin-top: 5px;
|
||||
padding: 10px;
|
||||
width: auto;
|
||||
}
|
||||
.uploadifyError {
|
||||
border: 2px solid #FBCBBC !important;
|
||||
background-color: #FDE5DD !important;
|
||||
}
|
||||
.uploadifyQueueItem .cancel {
|
||||
float: right;
|
||||
}
|
||||
.uploadifyProgress {
|
||||
background-color: #FFFFFF;
|
||||
border-top: 1px solid #808080;
|
||||
border-left: 1px solid #808080;
|
||||
border-right: 1px solid #C5C5C5;
|
||||
border-bottom: 1px solid #C5C5C5;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
background-color: #0099FF;
|
||||
width: 1px;
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
/* RTL support ~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
.rtl .uploadifyQueueItem .cancel {
|
||||
float: left;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.com/yui/license.html
|
||||
version: 2.8.1
|
||||
*/
|
||||
body{margin:10px;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong,dt{font-weight:bold;}optgroup{font-weight:normal;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}del{text-decoration:line-through;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}sup{vertical-align:super;}sub{vertical-align:sub;}p,fieldset,table,pre{margin-bottom:1em;}button,input[type="checkbox"],input[type="radio"],input[type="reset"],input[type="submit"]{padding:1px;}
|
|
@ -0,0 +1,67 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Admin_Akismet_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$form = akismet::get_configure_form();
|
||||
|
||||
if (request::method() == "post") {
|
||||
// @todo move the "post" handler part of this code into a separate function
|
||||
access::verify_csrf();
|
||||
|
||||
if ($form->validate()) {
|
||||
$new_key = $form->configure_akismet->api_key->value;
|
||||
$old_key = module::get_var("akismet", "api_key");
|
||||
if ($old_key && !$new_key) {
|
||||
message::success(t("Your Akismet key has been cleared."));
|
||||
} else if ($old_key && $new_key && $old_key != $new_key) {
|
||||
message::success(t("Your Akismet key has been changed."));
|
||||
} else if (!$old_key && $new_key) {
|
||||
message::success(t("Your Akismet key has been saved."));
|
||||
}
|
||||
|
||||
log::success("akismet", t("Akismet key changed to %new_key",
|
||||
array("new_key" => $new_key)));
|
||||
module::set_var("akismet", "api_key", $new_key);
|
||||
akismet::check_config();
|
||||
url::redirect("admin/akismet");
|
||||
} else {
|
||||
$valid_key = false;
|
||||
}
|
||||
} else {
|
||||
$valid_key = module::get_var("akismet", "api_key") ? 1 : 0;
|
||||
}
|
||||
|
||||
akismet::check_config();
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Akismet spam filtering");
|
||||
$view->content = new View("admin_akismet.html");
|
||||
$view->content->valid_key = $valid_key;
|
||||
$view->content->form = $form;
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function stats() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_akismet_stats.html");
|
||||
$view->content->api_key = module::get_var("akismet", "api_key");
|
||||
$view->content->blog_url = url::base(false, "http");
|
||||
print $view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class akismet_Core {
|
||||
public static $test_mode = TEST_MODE;
|
||||
|
||||
static function get_configure_form() {
|
||||
$form = new Forge("admin/akismet", "", "post", array("id" => "g-configure-akismet-form"));
|
||||
$group = $form->group("configure_akismet")->label(t("Configure Akismet"));
|
||||
$group->input("api_key")->label(t("API Key"))->value(module::get_var("akismet", "api_key"))
|
||||
->callback("akismet::validate_key")
|
||||
->error_messages("invalid", t("The API key you provided is invalid."));
|
||||
$group->submit("")->value(t("Save"));
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a comment against Akismet and return "spam", "ham" or "unknown".
|
||||
* @param Comment_Model $comment A comment to check
|
||||
* @return $string "spam", "ham" or "unknown"
|
||||
*/
|
||||
static function check_comment($comment) {
|
||||
if (akismet::$test_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = self::_build_request("comment-check", $comment);
|
||||
$response = self::_http_post($request);
|
||||
$answer = $response->body[0];
|
||||
if ($answer == "true") {
|
||||
return "spam";
|
||||
} else if ($answer == "false") {
|
||||
return "ham";
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell Akismet that this comment is spam
|
||||
* @param Comment_Model $comment A comment to check
|
||||
*/
|
||||
static function submit_spam($comment) {
|
||||
if (akismet::$test_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = self::_build_request("submit-spam", $comment);
|
||||
self::_http_post($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell Akismet that this comment is ham
|
||||
* @param Comment_Model $comment A comment to check
|
||||
*/
|
||||
static function submit_ham($comment) {
|
||||
if (akismet::$test_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = self::_build_request("submit-ham", $comment);
|
||||
self::_http_post($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check an API Key against Akismet to make sure that it's valid
|
||||
* @param string $api_key the API key
|
||||
* @return boolean
|
||||
*/
|
||||
static function validate_key($api_key_input) {
|
||||
if ($api_key_input->value) {
|
||||
$request = self::_build_verify_request($api_key_input->value);
|
||||
$response = self::_http_post($request, "rest.akismet.com");
|
||||
if ("valid" != $response->body[0]) {
|
||||
$api_key_input->add_error("invalid", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static function check_config() {
|
||||
$api_key = module::get_var("akismet", "api_key");
|
||||
if (empty($api_key)) {
|
||||
site_status::warning(
|
||||
t("Akismet is not quite ready! Please provide an <a href=\"%url\">API Key</a>",
|
||||
array("url" => html::mark_clean(url::site("admin/akismet")))),
|
||||
"akismet_config");
|
||||
} else {
|
||||
site_status::clear("akismet_config");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static function _build_verify_request($api_key) {
|
||||
$base_url = url::base(false, "http");
|
||||
$query_string = "key={$api_key}&blog=$base_url";
|
||||
|
||||
$version = module::get_version("akismet");
|
||||
$http_request = "POST /1.1/verify-key HTTP/1.0\r\n";
|
||||
$http_request .= "Host: rest.akismet.com\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($query_string) . "\r\n";
|
||||
$http_request .= "User-Agent: Gallery/3 | Akismet/$version\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $query_string;
|
||||
|
||||
return $http_request;
|
||||
}
|
||||
|
||||
static function _build_request($function, $comment) {
|
||||
$comment_data = array();
|
||||
$comment_data["HTTP_ACCEPT"] = $comment->server_http_accept;
|
||||
$comment_data["HTTP_ACCEPT_ENCODING"] = $comment->server_http_accept_encoding;
|
||||
$comment_data["HTTP_ACCEPT_LANGUAGE"] = $comment->server_http_accept_language;
|
||||
$comment_data["HTTP_CONNECTION"] = $comment->server_http_connection;
|
||||
$comment_data["HTTP_HOST"] = $comment->server_http_host;
|
||||
$comment_data["HTTP_USER_AGENT"] = $comment->server_http_user_agent;
|
||||
$comment_data["QUERY_STRING"] = $comment->server_query_string;
|
||||
$comment_data["REMOTE_ADDR"] = $comment->server_remote_addr;
|
||||
$comment_data["REMOTE_HOST"] = $comment->server_remote_host;
|
||||
$comment_data["REMOTE_PORT"] = $comment->server_remote_port;
|
||||
$comment_data["SERVER_HTTP_ACCEPT_CHARSET"] = $comment->server_http_accept_charset;
|
||||
$comment_data["blog"] = url::base(false, "http");
|
||||
$comment_data["comment_author"] = $comment->author_name();
|
||||
$comment_data["comment_author_email"] = $comment->author_email();
|
||||
$comment_data["comment_author_url"] = $comment->author_url();
|
||||
$comment_data["comment_content"] = $comment->text;
|
||||
$comment_data["comment_type"] = "comment";
|
||||
$comment_data["permalink"] = url::site("comments/{$comment->id}");
|
||||
$comment_data["referrer"] = $comment->server_http_referer;
|
||||
$comment_data["user_agent"] = $comment->server_http_user_agent;
|
||||
$comment_data["user_ip"] = $comment->server_remote_addr;
|
||||
|
||||
$query_string = array();
|
||||
foreach ($comment_data as $key => $data) {
|
||||
$query_string[] = "$key=" . urlencode($data);
|
||||
}
|
||||
$query_string = join("&", $query_string);
|
||||
|
||||
$version = module::get_version("akismet");
|
||||
$http_request = "POST /1.1/$function HTTP/1.0\r\n";
|
||||
$http_request .= "Host: " . module::get_var("akismet", "api_key") . ".rest.akismet.com\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($query_string) . "\r\n";
|
||||
$http_request .= "User-Agent: Gallery/3 | Akismet/$version\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $query_string;
|
||||
|
||||
return $http_request;
|
||||
}
|
||||
|
||||
private static function _http_post($http_request, $host=null) {
|
||||
if (!$host) {
|
||||
$host = module::get_var("akismet", "api_key") . ".rest.akismet.com";
|
||||
}
|
||||
$response = "";
|
||||
|
||||
Kohana_Log::add("debug", "Send request\n" . print_r($http_request, 1));
|
||||
if (false !== ($fs = @fsockopen($host, 80, $errno, $errstr, 5))) {
|
||||
fwrite($fs, $http_request);
|
||||
while ( !feof($fs) ) {
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
}
|
||||
fclose($fs);
|
||||
list($headers, $body) = explode("\r\n\r\n", $response);
|
||||
$headers = explode("\r\n", $headers);
|
||||
$body = explode("\r\n", $body);
|
||||
$response = new ArrayObject(
|
||||
array("headers" => $headers, "body" => $body), ArrayObject::ARRAY_AS_PROPS);
|
||||
} else {
|
||||
throw new Exception("@todo CONNECTION TO SPAM SERVICE FAILED");
|
||||
}
|
||||
Kohana_Log::add("debug", "Received response\n" . print_r($response, 1));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class akismet_event_Core {
|
||||
static function comment_created($comment) {
|
||||
if (!module::get_var("akismet", "api_key")) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(akismet::check_comment($comment)) {
|
||||
case "spam":
|
||||
$comment->state = "spam";
|
||||
module::incr_var("comment", "spam_caught");
|
||||
break;
|
||||
|
||||
case "ham":
|
||||
$comment->state = "published";
|
||||
break;
|
||||
|
||||
case "unknown":
|
||||
$comment->state = "unpublished";
|
||||
break;
|
||||
}
|
||||
$comment->save();
|
||||
}
|
||||
|
||||
static function comment_updated($original, $new) {
|
||||
if (!module::get_var("akismet", "api_key")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($original->state != "spam" && $new->state == "spam") {
|
||||
akismet::submit_spam($new);
|
||||
} else if ($original->state == "spam" && $new->state != "spam") {
|
||||
akismet::submit_ham($new);
|
||||
}
|
||||
}
|
||||
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->get("settings_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("akismet")
|
||||
->label(t("Akismet"))
|
||||
->url(url::site("admin/akismet")));
|
||||
|
||||
if (module::get_var("akismet", "api_key")) {
|
||||
$menu->get("statistics_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("akismet")
|
||||
->label(t("Akismet"))
|
||||
->url(url::site("admin/akismet/stats")));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class akismet_installer {
|
||||
static function activate() {
|
||||
akismet::check_config();
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("akismet_config");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
name = "Akismet"
|
||||
description = "Filter comments through the Akismet web service to detect and eliminate spam (http://akismet.com). You'll need a WordPress.com API key to use it."
|
||||
version = 1
|
|
@ -0,0 +1,18 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-admin-akismet" class="g-block">
|
||||
<h1> <?= t("Akismet spam filtering") ?> </h1>
|
||||
<p>
|
||||
<?= t("Akismet is a free, automated spam filtering service. In order to use it, you need to sign up for a <a href=\"%api_key_url\">Wordpress.com API Key</a>, which is also free. Your comments will be automatically relayed to <a href=\"%akismet_url\">Akismet.com</a> where they'll be scanned for spam. Spam messages will be flagged accordingly and hidden from your vistors until you approve or delete them.",
|
||||
array("api_key_url" => "http://wordpress.com/api-keys",
|
||||
"akismet_url" => "http://akismet.com")) ?>
|
||||
</p>
|
||||
<div class="g-block-content">
|
||||
<? if ($valid_key): ?>
|
||||
<div class="g-module-status g-success">
|
||||
<?= t("Your API key is valid. Your comments will be filtered!") ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javscript">
|
||||
$(document).ready(function() {
|
||||
$("#g-akismet-external-stats").css("height", "600");
|
||||
});
|
||||
</script>
|
||||
<div id="g-akismet-stats">
|
||||
<iframe id="g-akismet-external-stats" width="100%" height="500" frameborder="0"
|
||||
src="http://<?= $api_key ?>.web.akismet.com/1.0/user-stats.php?blog=<?= urlencode($blog_url) ?>">
|
||||
</iframe>
|
||||
</div>
|
|
@ -0,0 +1,52 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Admin_Comments_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Comment settings");
|
||||
$view->content = new View("admin_comments.html");
|
||||
$view->content->form = $this->_get_admin_form();
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function save() {
|
||||
access::verify_csrf();
|
||||
$form = $this->_get_admin_form();
|
||||
$form->validate();
|
||||
module::set_var("comment", "access_permissions",
|
||||
$form->comment_settings->access_permissions->value);
|
||||
message::success(t("Comment settings updated"));
|
||||
url::redirect("admin/comments");
|
||||
}
|
||||
|
||||
private function _get_admin_form() {
|
||||
$form = new Forge("admin/comments/save", "", "post",
|
||||
array("id" => "g-comments-admin-form"));
|
||||
$comment_settings = $form->group("comment_settings")->label(t("Permissions"));
|
||||
$comment_settings->dropdown("access_permissions")
|
||||
->label(t("Who can leave comments?"))
|
||||
->options(array("everybody" => t("Everybody"),
|
||||
"registered_users" => t("Only registered users")))
|
||||
->selected(module::get_var("comment", "access_permissions"));
|
||||
$comment_settings->submit("save")->value(t("Save"));
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Admin_Manage_Comments_Controller extends Admin_Controller {
|
||||
private static $items_per_page = 20;
|
||||
|
||||
public function index() {
|
||||
// Get rid of old deleted/spam comments once in a while
|
||||
db::build()
|
||||
->delete("comments")
|
||||
->where("state", "IN", array("deleted", "spam"))
|
||||
->where("updated", "<", db::expr("UNIX_TIMESTAMP() - 86400 * 7"))
|
||||
->execute();
|
||||
|
||||
// Redirect to the appropriate queue
|
||||
url::redirect("admin/manage_comments/queue/unpublished");
|
||||
}
|
||||
|
||||
public function menu_labels() {
|
||||
$menu = $this->_menu($this->_counts());
|
||||
json::reply(array((string) $menu->get("unpublished")->label,
|
||||
(string) $menu->get("published")->label,
|
||||
(string) $menu->get("spam")->label,
|
||||
(string) $menu->get("deleted")->label));
|
||||
}
|
||||
|
||||
public function queue($state) {
|
||||
$page = max(Input::instance()->get("page"), 1);
|
||||
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Manage comments");
|
||||
$view->content = new View("admin_manage_comments.html");
|
||||
$view->content->counts = $this->_counts();
|
||||
$view->content->menu = $this->_menu($view->content->counts);
|
||||
$view->content->state = $state;
|
||||
$view->content->comments = ORM::factory("comment")
|
||||
->order_by("created", "DESC")
|
||||
->order_by("id", "DESC")
|
||||
->where("state", "=", $state)
|
||||
->limit(self::$items_per_page)
|
||||
->offset(($page - 1) * self::$items_per_page)
|
||||
->find_all();
|
||||
$view->content->pager = new Pagination();
|
||||
$view->content->pager->initialize(
|
||||
array("query_string" => "page",
|
||||
"total_items" => $view->content->counts->$state,
|
||||
"items_per_page" => self::$items_per_page,
|
||||
"style" => "classic"));
|
||||
|
||||
print $view;
|
||||
}
|
||||
|
||||
private function _menu($counts) {
|
||||
return Menu::factory("root")
|
||||
->append(Menu::factory("link")
|
||||
->id("unpublished")
|
||||
->label(t2("Awaiting Moderation (%count)",
|
||||
"Awaiting Moderation (%count)",
|
||||
$counts->unpublished))
|
||||
->url(url::site("admin/manage_comments/queue/unpublished")))
|
||||
->append(Menu::factory("link")
|
||||
->id("published")
|
||||
->label(t2("Approved (%count)",
|
||||
"Approved (%count)",
|
||||
$counts->published))
|
||||
->url(url::site("admin/manage_comments/queue/published")))
|
||||
->append(Menu::factory("link")
|
||||
->id("spam")
|
||||
->label(t2("Spam (%count)",
|
||||
"Spam (%count)",
|
||||
$counts->spam))
|
||||
->url(url::site("admin/manage_comments/queue/spam")))
|
||||
->append(Menu::factory("link")
|
||||
->id("deleted")
|
||||
->label(t2("Recently Deleted (%count)",
|
||||
"Recently Deleted (%count)",
|
||||
$counts->deleted))
|
||||
->url(url::site("admin/manage_comments/queue/deleted")));
|
||||
}
|
||||
|
||||
private function _counts() {
|
||||
$counts = new stdClass();
|
||||
$counts->unpublished = 0;
|
||||
$counts->published = 0;
|
||||
$counts->spam = 0;
|
||||
$counts->deleted = 0;
|
||||
foreach (db::build()
|
||||
->select("state")
|
||||
->select(array("c" => 'COUNT("*")'))
|
||||
->from("comments")
|
||||
->group_by("state")
|
||||
->execute() as $row) {
|
||||
$counts->{$row->state} = $row->c;
|
||||
}
|
||||
return $counts;
|
||||
}
|
||||
|
||||
public function set_state($id, $state) {
|
||||
access::verify_csrf();
|
||||
|
||||
$comment = ORM::factory("comment", $id);
|
||||
$orig = clone $comment;
|
||||
if ($comment->loaded()) {
|
||||
$comment->state = $state;
|
||||
$comment->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_all_spam() {
|
||||
access::verify_csrf();
|
||||
|
||||
db::build()
|
||||
->delete("comments")
|
||||
->where("state", "=", "spam")
|
||||
->execute();
|
||||
url::redirect("admin/manage_comments/queue/spam");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Comments_Controller extends Controller {
|
||||
/**
|
||||
* Add a new comment to the collection.
|
||||
*/
|
||||
public function create($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
access::required("view", $item);
|
||||
if (!comment::can_comment()) {
|
||||
access::forbidden();
|
||||
}
|
||||
|
||||
$form = comment::get_add_form($item);
|
||||
try {
|
||||
$valid = $form->validate();
|
||||
$comment = ORM::factory("comment");
|
||||
$comment->item_id = $id;
|
||||
$comment->author_id = identity::active_user()->id;
|
||||
$comment->text = $form->add_comment->text->value;
|
||||
$comment->guest_name = $form->add_comment->inputs["name"]->value;
|
||||
$comment->guest_email = $form->add_comment->email->value;
|
||||
$comment->guest_url = $form->add_comment->url->value;
|
||||
$comment->validate();
|
||||
} catch (ORM_Validation_Exception $e) {
|
||||
// Translate ORM validation errors into form error messages
|
||||
foreach ($e->validation->errors() as $key => $error) {
|
||||
switch ($key) {
|
||||
case "guest_name": $key = "name"; break;
|
||||
case "guest_email": $key = "email"; break;
|
||||
case "guest_url": $key = "url"; break;
|
||||
}
|
||||
$form->add_comment->inputs[$key]->add_error($error, 1);
|
||||
}
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$comment->save();
|
||||
$view = new Theme_View("comment.html", "other", "comment-fragment");
|
||||
$view->comment = $comment;
|
||||
|
||||
json::reply(array("result" => "success",
|
||||
"view" => (string)$view,
|
||||
"form" => (string)comment::get_add_form($item)));
|
||||
} else {
|
||||
$form = comment::prefill_add_form($form);
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Present a form for adding a new comment to this item or editing an existing comment.
|
||||
*/
|
||||
public function form_add($item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
if (!comment::can_comment()) {
|
||||
access::forbidden();
|
||||
}
|
||||
|
||||
print comment::prefill_add_form(comment::get_add_form($item));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#g-content #g-comment-form {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
#g-content #g-comments {
|
||||
margin-top: 2em;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#g-content #g-comments ul li {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
#g-content #g-comments .g-author {
|
||||
border-bottom: 1px solid #ccc;
|
||||
color: #999;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
#g-content #g-comments ul li div {
|
||||
padding: 0 8px 8px 43px;
|
||||
}
|
||||
|
||||
#g-content #g-comments .g-avatar {
|
||||
height: 32px;
|
||||
margin-right: .4em;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
#g-add-comment {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
#g-admin-comments-menu {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
#g-admin-comments-menu a {
|
||||
margin: 0;
|
||||
padding: .2em .6em;
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the API for handling comments.
|
||||
*
|
||||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
class comment_Core {
|
||||
static function get_add_form($item) {
|
||||
$form = new Forge("comments/create/{$item->id}", "", "post", array("id" => "g-comment-form"));
|
||||
$group = $form->group("add_comment")->label(t("Add comment"));
|
||||
$group->input("name")
|
||||
->label(t("Name"))
|
||||
->id("g-author")
|
||||
->error_messages("required", t("You must enter a name for yourself"));
|
||||
$group->input("email")
|
||||
->label(t("Email (hidden)"))
|
||||
->id("g-email")
|
||||
->error_messages("required", t("You must enter a valid email address"))
|
||||
->error_messages("invalid", t("You must enter a valid email address"));
|
||||
$group->input("url")
|
||||
->label(t("Website (hidden)"))
|
||||
->id("g-url")
|
||||
->error_messages("url", t("You must enter a valid url"));
|
||||
$group->textarea("text")
|
||||
->label(t("Comment"))
|
||||
->id("g-text")
|
||||
->error_messages("required", t("You must enter a comment"));
|
||||
$group->hidden("item_id")->value($item->id);
|
||||
module::event("comment_add_form", $form);
|
||||
module::event("captcha_protect_form", $form);
|
||||
$group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all");
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
static function prefill_add_form($form) {
|
||||
$active = identity::active_user();
|
||||
if (!$active->guest) {
|
||||
$group = $form->add_comment;
|
||||
$group->inputs["name"]->value($active->full_name)->disabled("disabled");
|
||||
$group->email->value($active->email)->disabled("disabled");
|
||||
$group->url->value($active->url)->disabled("disabled");
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
static function can_comment() {
|
||||
return !identity::active_user()->guest ||
|
||||
module::get_var("comment", "access_permissions") == "everybody";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comment_block_Core {
|
||||
static function get_admin_list() {
|
||||
return array("recent_comments" => t("Recent comments"));
|
||||
}
|
||||
|
||||
static function get($block_id) {
|
||||
$block = new Block();
|
||||
switch ($block_id) {
|
||||
case "recent_comments":
|
||||
$block->css_id = "g-recent-comments";
|
||||
$block->title = t("Recent comments");
|
||||
$block->content = new View("admin_block_recent_comments.html");
|
||||
$block->content->comments =
|
||||
ORM::factory("comment")->order_by("created", "DESC")->limit(5)->find_all();
|
||||
break;
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comment_event_Core {
|
||||
static function item_deleted($item) {
|
||||
db::build()
|
||||
->delete("comments")
|
||||
->where("item_id", "=", $item->id)
|
||||
->execute();
|
||||
}
|
||||
|
||||
static function user_deleted($user) {
|
||||
$guest = identity::guest();
|
||||
if (!empty($guest)) { // could be empty if there is not identity provider
|
||||
db::build()
|
||||
->update("comments")
|
||||
->set("author_id", $guest->id)
|
||||
->set("guest_email", null)
|
||||
->set("guest_name", "guest")
|
||||
->set("guest_url", null)
|
||||
->where("author_id", "=", $user->id)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
static function identity_provider_changed($old_provider, $new_provider) {
|
||||
$guest = identity::guest();
|
||||
db::build()
|
||||
->update("comments")
|
||||
->set("author_id", $guest->id)
|
||||
->set("guest_email", null)
|
||||
->set("guest_name", "guest")
|
||||
->set("guest_url", null)
|
||||
->execute();
|
||||
}
|
||||
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->get("settings_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("comment")
|
||||
->label(t("Comments"))
|
||||
->url(url::site("admin/comments")));
|
||||
|
||||
$menu->get("content_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("comments")
|
||||
->label(t("Comments"))
|
||||
->url(url::site("admin/manage_comments")));
|
||||
}
|
||||
|
||||
static function photo_menu($menu, $theme) {
|
||||
$menu
|
||||
->append(Menu::factory("link")
|
||||
->id("comments")
|
||||
->label(t("View comments on this item"))
|
||||
->url("#comments")
|
||||
->css_id("g-comments-link"));
|
||||
}
|
||||
|
||||
static function item_index_data($item, $data) {
|
||||
foreach (db::build()
|
||||
->select("text")
|
||||
->from("comments")
|
||||
->where("item_id", "=", $item->id)
|
||||
->execute() as $row) {
|
||||
$data[] = $row->text;
|
||||
}
|
||||
}
|
||||
|
||||
static function show_user_profile($data) {
|
||||
$view = new View("user_profile_comments.html");
|
||||
$view->comments = ORM::factory("comment")
|
||||
->order_by("created", "DESC")
|
||||
->where("state", "=", "published")
|
||||
->where("author_id", "=", $data->user->id)
|
||||
->find_all();
|
||||
if ($view->comments->count()) {
|
||||
$data->content[] = (object)array("title" => t("Comments"), "view" => $view);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comment_installer {
|
||||
static function install() {
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {comments} (
|
||||
`author_id` int(9) default NULL,
|
||||
`created` int(9) NOT NULL,
|
||||
`guest_email` varchar(128) default NULL,
|
||||
`guest_name` varchar(128) default NULL,
|
||||
`guest_url` varchar(255) default NULL,
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`item_id` int(9) NOT NULL,
|
||||
`server_http_accept_charset` varchar(64) default NULL,
|
||||
`server_http_accept_encoding` varchar(64) default NULL,
|
||||
`server_http_accept_language` varchar(64) default NULL,
|
||||
`server_http_accept` varchar(128) default NULL,
|
||||
`server_http_connection` varchar(64) default NULL,
|
||||
`server_http_host` varchar(64) default NULL,
|
||||
`server_http_referer` varchar(255) default NULL,
|
||||
`server_http_user_agent` varchar(128) default NULL,
|
||||
`server_query_string` varchar(64) default NULL,
|
||||
`server_remote_addr` varchar(32) default NULL,
|
||||
`server_remote_host` varchar(64) default NULL,
|
||||
`server_remote_port` varchar(16) default NULL,
|
||||
`state` varchar(15) default 'unpublished',
|
||||
`text` text,
|
||||
`updated` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
module::set_var("comment", "spam_caught", 0);
|
||||
module::set_var("comment", "access_permissions", "everybody");
|
||||
module::set_version("comment", 3);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
$db = Database::instance();
|
||||
if ($version == 1) {
|
||||
$db->query("ALTER TABLE {comments} CHANGE `state` `state` varchar(15) default 'unpublished'");
|
||||
module::set_version("comment", $version = 2);
|
||||
}
|
||||
|
||||
if ($version == 2) {
|
||||
module::set_var("comment", "access_permissions", "everybody");
|
||||
module::set_version("comment", $version = 3);
|
||||
}
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
$db = Database::instance();
|
||||
|
||||
// Notify listeners that we're deleting some data. This is probably going to be very
|
||||
// inefficient for large uninstalls, and we could make it better by doing things like passing
|
||||
// a SQL fragment through so that the listeners could use subselects. But by using a single,
|
||||
// simple event API we lighten the load on module developers.
|
||||
foreach (ORM::factory("item")
|
||||
->join("comments", "items.id", "comments.item_id")
|
||||
->find_all() as $item) {
|
||||
module::event("item_related_update", $item);
|
||||
}
|
||||
$db->query("DROP TABLE IF EXISTS {comments};");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comment_rest_Core {
|
||||
static function get($request) {
|
||||
$comment = rest::resolve($request->url);
|
||||
access::required("view", $comment->item());
|
||||
|
||||
return array(
|
||||
"url" => $request->url,
|
||||
"entity" => $comment->as_restful_array(),
|
||||
"relationships" => rest::relationships("comment", $comment));
|
||||
}
|
||||
|
||||
static function put($request) {
|
||||
// Only admins can edit comments, for now
|
||||
if (!identity::active_user()->admin) {
|
||||
access::forbidden();
|
||||
}
|
||||
|
||||
$comment = rest::resolve($request->url);
|
||||
$comment = ORM::factory("comment");
|
||||
$comment->text = $request->params->text;
|
||||
$comment->save();
|
||||
}
|
||||
|
||||
static function delete($request) {
|
||||
if (!identity::active_user()->admin) {
|
||||
access::forbidden();
|
||||
}
|
||||
|
||||
$comment = rest::resolve($request->url);
|
||||
access::required("edit", $comment->item());
|
||||
|
||||
$comment->delete();
|
||||
}
|
||||
|
||||
static function relationships($resource_type, $resource) {
|
||||
switch ($resource_type) {
|
||||
case "item":
|
||||
return array(
|
||||
"comments" => array(
|
||||
"url" => rest::url("item_comments", $resource)));
|
||||
}
|
||||
}
|
||||
|
||||
static function resolve($id) {
|
||||
$comment = ORM::factory("comment", $id);
|
||||
if (!access::can("view", $comment->item())) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
return $comment;
|
||||
}
|
||||
|
||||
static function url($comment) {
|
||||
return url::abs_site("rest/comment/{$comment->id}");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class comment_rss_Core {
|
||||
static function available_feeds($item, $tag) {
|
||||
$feeds["comment/newest"] = t("All new comments");
|
||||
if ($item) {
|
||||
$feeds["comment/item/$item->id"] =
|
||||
t("Comments on %title", array("title" => html::purify($item->title)));
|
||||
}
|
||||
return $feeds;
|
||||
}
|
||||
|
||||
static function feed($feed_id, $offset, $limit, $id) {
|
||||
if ($feed_id != "newest" && $feed_id != "item") {
|
||||
return;
|
||||
}
|
||||
|
||||
$comments = ORM::factory("comment")
|
||||
->viewable()
|
||||
->where("comments.state", "=", "published")
|
||||
->order_by("comments.created", "DESC");
|
||||
|
||||
if ($feed_id == "item") {
|
||||
$item = ORM::factory("item", $id);
|
||||
$comments
|
||||
->where("items.left_ptr", ">=", $item->left_ptr)
|
||||
->where("items.right_ptr", "<=", $item->right_ptr);
|
||||
}
|
||||
|
||||
$feed = new stdClass();
|
||||
$feed->view = "comment.mrss";
|
||||
$feed->comments = array();
|
||||
foreach ($comments->find_all($limit, $offset) as $comment) {
|
||||
$item = $comment->item();
|
||||
$feed->comments[] = new ArrayObject(
|
||||
array("pub_date" => date("D, d M Y H:i:s T", $comment->created),
|
||||
"text" => nl2br(html::purify($comment->text)),
|
||||
"thumb_url" => $item->thumb_url(),
|
||||
"thumb_height" => $item->thumb_height,
|
||||
"thumb_width" => $item->thumb_width,
|
||||
"item_uri" => url::abs_site("{$item->type}s/$item->id"),
|
||||
"title" => (
|
||||
($item->id == item::root()->id) ?
|
||||
html::purify($item->title) :
|
||||
t("%site_title - %item_title",
|
||||
array("site_title" => item::root()->title,
|
||||
"item_title" => $item->title))),
|
||||
"author" => html::clean($comment->author_name())),
|
||||
ArrayObject::ARRAY_AS_PROPS);
|
||||
}
|
||||
|
||||
$feed->max_pages = ceil($comments->count_all() / $limit);
|
||||
$feed->title = html::purify(t("%site_title - Recent Comments",
|
||||
array("site_title" => item::root()->title)));
|
||||
$feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id));
|
||||
$feed->description = t("Recent comments");
|
||||
|
||||
return $feed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comment_theme_Core {
|
||||
static function head($theme) {
|
||||
return $theme->css("comment.css")
|
||||
. $theme->script("comment.js");
|
||||
}
|
||||
|
||||
static function admin_head($theme) {
|
||||
return $theme->css("comment.css");
|
||||
}
|
||||
|
||||
static function photo_bottom($theme) {
|
||||
$block = new Block;
|
||||
$block->css_id = "g-comments";
|
||||
$block->title = t("Comments");
|
||||
$block->anchor = "comments";
|
||||
|
||||
$view = new View("comments.html");
|
||||
$view->comments = ORM::factory("comment")
|
||||
->where("item_id", "=", $theme->item()->id)
|
||||
->where("state", "=", "published")
|
||||
->order_by("created", "ASC")
|
||||
->find_all();
|
||||
|
||||
$block->content = $view;
|
||||
return $block;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class comments_rest_Core {
|
||||
/**
|
||||
* Possible request parameters:
|
||||
* start=#
|
||||
* start at the Nth comment (zero based)
|
||||
*
|
||||
* num=#
|
||||
* return up to N comments (max 100)
|
||||
*/
|
||||
static function get($request) {
|
||||
$comments = array();
|
||||
|
||||
$p = $request->params;
|
||||
$num = isset($p->num) ? min((int)$p->num, 100) : 10;
|
||||
$start = isset($p->start) ? (int)$p->start : 0;
|
||||
|
||||
foreach (ORM::factory("comment")->viewable()->find_all($num, $start) as $comment) {
|
||||
$comments[] = rest::url("comment", $comment);
|
||||
}
|
||||
return array("url" => rest::url("comments"),
|
||||
"members" => $comments);
|
||||
}
|
||||
|
||||
|
||||
static function post($request) {
|
||||
$entity = $request->params->entity;
|
||||
|
||||
$item = rest::resolve($entity->item);
|
||||
access::required("edit", $item);
|
||||
|
||||
$comment = ORM::factory("comment");
|
||||
$comment->author_id = identity::active_user()->id;
|
||||
$comment->item_id = $item->id;
|
||||
$comment->text = $entity->text;
|
||||
$comment->save();
|
||||
|
||||
return array("url" => rest::url("comment", $comment));
|
||||
}
|
||||
|
||||
static function url() {
|
||||
return url::abs_site("rest/comments");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class item_comments_rest_Core {
|
||||
static function get($request) {
|
||||
$item = rest::resolve($request->url);
|
||||
access::required("view", $item);
|
||||
|
||||
$comments = array();
|
||||
foreach (ORM::factory("comment")
|
||||
->viewable()
|
||||
->where("item_id", "=", $item->id)
|
||||
->order_by("created", "DESC")
|
||||
->find_all() as $comment) {
|
||||
$comments[] = rest::url("comment", $comment);
|
||||
}
|
||||
|
||||
return array(
|
||||
"url" => $request->url,
|
||||
"members" => $comments);
|
||||
}
|
||||
|
||||
static function resolve($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
if (!access::can("view", $item)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
static function url($item) {
|
||||
return url::abs_site("rest/item_comments/{$item->id}");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
$("document").ready(function() {
|
||||
$("#g-add-comment").click(function(event) {
|
||||
event.preventDefault();
|
||||
if (!$("#g-comment-form").length) {
|
||||
$.get($(this).attr("href"),
|
||||
{},
|
||||
function(data) {
|
||||
$("#g-comment-detail").append(data);
|
||||
ajaxify_comment_form();
|
||||
$.scrollTo("#g-comment-form-anchor", 800);
|
||||
});
|
||||
}
|
||||
});
|
||||
$(".g-no-comments a").click(function(event) {
|
||||
event.preventDefault();
|
||||
if (!$("#g-comment-form").length) {
|
||||
$.get($(this).attr("href"),
|
||||
{},
|
||||
function(data) {
|
||||
$("#g-comment-detail").append(data);
|
||||
ajaxify_comment_form();
|
||||
});
|
||||
$(".g-no-comments").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function ajaxify_comment_form() {
|
||||
$("#g-comments form").ajaxForm({
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.result == "success") {
|
||||
$("#g-comments #g-comment-detail ul").append(data.view);
|
||||
$("#g-comments #g-comment-detail ul li:last").effect("highlight", {color: "#cfc"}, 8000);
|
||||
$("#g-comment-form").hide(2000).remove();
|
||||
$("#g-no-comments").hide(2000);
|
||||
} else {
|
||||
if (data.form) {
|
||||
$("#g-comments form").replaceWith(data.form);
|
||||
ajaxify_comment_form();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Comment_Model_Core extends ORM {
|
||||
function item() {
|
||||
return ORM::factory("item", $this->item_id);
|
||||
}
|
||||
|
||||
function author() {
|
||||
return identity::lookup_user($this->author_id);
|
||||
}
|
||||
|
||||
function author_name() {
|
||||
$author = $this->author();
|
||||
if ($author->guest) {
|
||||
return $this->guest_name;
|
||||
} else {
|
||||
return $author->display_name();
|
||||
}
|
||||
}
|
||||
|
||||
function author_email() {
|
||||
$author = $this->author();
|
||||
if ($author->guest) {
|
||||
return $this->guest_email;
|
||||
} else {
|
||||
return $author->email;
|
||||
}
|
||||
}
|
||||
|
||||
function author_url() {
|
||||
$author = $this->author();
|
||||
if ($author->guest) {
|
||||
return $this->guest_url;
|
||||
} else {
|
||||
return $author->url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some custom per-instance rules.
|
||||
*/
|
||||
public function validate(Validation $array=null) {
|
||||
// validate() is recursive, only modify the rules on the outermost call.
|
||||
if (!$array) {
|
||||
$this->rules = array(
|
||||
"guest_name" => array("callbacks" => array(array($this, "valid_author"))),
|
||||
"guest_email" => array("callbacks" => array(array($this, "valid_email"))),
|
||||
"guest_url" => array("rules" => array("url")),
|
||||
"item_id" => array("callbacks" => array(array($this, "valid_item"))),
|
||||
"state" => array("rules" => array("Comment_Model::valid_state")),
|
||||
"text" => array("rules" => array("required")),
|
||||
);
|
||||
}
|
||||
|
||||
parent::validate($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ORM::save()
|
||||
*/
|
||||
public function save() {
|
||||
$this->updated = time();
|
||||
if (!$this->loaded()) {
|
||||
// New comment
|
||||
$this->created = $this->updated;
|
||||
if (empty($this->state)) {
|
||||
$this->state = "published";
|
||||
}
|
||||
|
||||
// These values are useful for spam fighting, so save them with the comment. It's painful to
|
||||
// check each one to see if it already exists before setting it, so just use server_http_host
|
||||
// as a semaphore for now (we use that in g2_import.php)
|
||||
if (empty($this->server_http_host)) {
|
||||
$input = Input::instance();
|
||||
$this->server_http_accept = substr($input->server("HTTP_ACCEPT"), 0, 128);
|
||||
$this->server_http_accept_charset = substr($input->server("HTTP_ACCEPT_CHARSET"), 0, 64);
|
||||
$this->server_http_accept_encoding = substr($input->server("HTTP_ACCEPT_ENCODING"), 0, 64);
|
||||
$this->server_http_accept_language = substr($input->server("HTTP_ACCEPT_LANGUAGE"), 0, 64);
|
||||
$this->server_http_connection = substr($input->server("HTTP_CONNECTION"), 0, 64);
|
||||
$this->server_http_host = substr($input->server("HTTP_HOST"), 0, 64);
|
||||
$this->server_http_referer = substr($input->server("HTTP_REFERER"), 0, 255);
|
||||
$this->server_http_user_agent = substr($input->server("HTTP_USER_AGENT"), 0, 128);
|
||||
$this->server_query_string = substr($input->server("QUERY_STRING"), 0, 64);
|
||||
$this->server_remote_addr = substr($input->server("REMOTE_ADDR"), 0, 32);
|
||||
$this->server_remote_host = substr($input->server("REMOTE_HOST"), 0, 64);
|
||||
$this->server_remote_port = substr($input->server("REMOTE_PORT"), 0, 16);
|
||||
}
|
||||
|
||||
$visible_change = $this->state == "published";
|
||||
parent::save();
|
||||
module::event("comment_created", $this);
|
||||
} else {
|
||||
// Updated comment
|
||||
$original = ORM::factory("comment", $this->id);
|
||||
$visible_change = $original->state == "published" || $this->state == "published";
|
||||
parent::save();
|
||||
module::event("comment_updated", $original, $this);
|
||||
}
|
||||
|
||||
// We only notify on the related items if we're making a visible change.
|
||||
if ($visible_change) {
|
||||
$item = $this->item();
|
||||
module::event("item_related_update", $item);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a set of restrictions to any following queries to restrict access only to items
|
||||
* viewable by the active user.
|
||||
* @chainable
|
||||
*/
|
||||
public function viewable() {
|
||||
$this->join("items", "items.id", "comments.item_id");
|
||||
return item::viewable($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we have an appropriate author id set, or a guest name.
|
||||
*/
|
||||
public function valid_author(Validation $v, $field) {
|
||||
if (empty($this->author_id)) {
|
||||
$v->add_error("author_id", "required");
|
||||
} else if ($this->author_id == identity::guest()->id && empty($this->guest_name)) {
|
||||
$v->add_error("guest_name", "required");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that the email address is legal.
|
||||
*/
|
||||
public function valid_email(Validation $v, $field) {
|
||||
if ($this->author_id == identity::guest()->id) {
|
||||
if (empty($v->guest_email)) {
|
||||
$v->add_error("guest_email", "required");
|
||||
} else if (!valid::email($v->guest_email)) {
|
||||
$v->add_error("guest_email", "invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we have a valid associated item id.
|
||||
*/
|
||||
public function valid_item(Validation $v, $field) {
|
||||
if (db::build()
|
||||
->from("items")
|
||||
->where("id", "=", $this->item_id)
|
||||
->count_records() != 1) {
|
||||
$v->add_error("item_id", "invalid");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that the state is legal.
|
||||
*/
|
||||
static function valid_state($value) {
|
||||
return in_array($value, array("published", "unpublished", "spam", "deleted"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as ORM::as_array() but convert id fields into their RESTful form.
|
||||
*/
|
||||
public function as_restful_array() {
|
||||
$data = array();
|
||||
foreach ($this->as_array() as $key => $value) {
|
||||
if (strncmp($key, "server_", 7)) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
$data["item"] = rest::url("item", $this->item());
|
||||
unset($data["item_id"]);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
name = "Comments"
|
||||
description = "Allows users and guests to leave comments on photos and albums."
|
||||
version = 3
|
|
@ -0,0 +1,23 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<? foreach ($comments as $comment): ?>
|
||||
<li class="<?= text::alternate("g-even", "g-odd") ?>">
|
||||
<img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>"
|
||||
class="g-avatar"
|
||||
alt="<?= html::clean_attribute($comment->author_name()) ?>"
|
||||
width="32"
|
||||
height="32" />
|
||||
<?= gallery::date_time($comment->created) ?>
|
||||
<? if ($comment->author()->guest): ?>
|
||||
<?= t('%author_name said <em>%comment_text</em>',
|
||||
array("author_name" => html::clean($comment->author_name()),
|
||||
"comment_text" => text::limit_words(nl2br(html::purify($comment->text)), 50))); ?>
|
||||
<? else: ?>
|
||||
<?= t('<a href="%url">%author_name</a> said <em>%comment_text</em>',
|
||||
array("author_name" => html::clean($comment->author_name()),
|
||||
"url" => user_profile::url($comment->author_id),
|
||||
"comment_text" => text::limit_words(nl2br(html::purify($comment->text)), 50))); ?>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
</ul>
|
|
@ -0,0 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Comment settings") ?> </h1>
|
||||
<div class="g-block-content">
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,201 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript">
|
||||
var set_state_url =
|
||||
<?= html::js_string(url::site("admin/manage_comments/set_state/__ID__/__STATE__?csrf=$csrf")) ?>;
|
||||
function set_state(state, id) {
|
||||
$.get(set_state_url.replace("__STATE__", state).replace("__ID__", id),
|
||||
{},
|
||||
function() {
|
||||
$("#g-comment-" + id).slideUp();
|
||||
update_menu();
|
||||
});
|
||||
}
|
||||
|
||||
var delete_url =
|
||||
<?= html::js_string(url::site("admin/manage_comments/delete/__ID__?csrf=$csrf")) ?>;
|
||||
|
||||
function del(id) {
|
||||
$.get(delete_url.replace("__ID__", id),
|
||||
{},
|
||||
function() {
|
||||
$("#g-comment-" + id).slideUp();
|
||||
update_menu();
|
||||
});
|
||||
}
|
||||
|
||||
function update_menu() {
|
||||
$.get(<?= html::js_string(url::site("admin/manage_comments/menu_labels")) ?>, {},
|
||||
function(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
$("#g-admin-comments-menu li:eq(" + i + ") a").html(data[i]);
|
||||
}
|
||||
},
|
||||
"json");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="g-admin-comments" class="g-block">
|
||||
<h1> <?= t("Manage comments") ?> </h1>
|
||||
|
||||
<div class="g-block-content">
|
||||
<!-- @todo: Highlight active menu option -->
|
||||
<div id="g-admin-comments-menu" class="ui-helper-clearfix">
|
||||
<?= $menu->render() ?>
|
||||
</div>
|
||||
|
||||
<!-- @todo: Remove after setting active option? -->
|
||||
<h2>
|
||||
<? if ($state == "published"): ?>
|
||||
<?= t("Approved comments") ?>
|
||||
<? elseif ($state == "unpublished"): ?>
|
||||
<?= t("Comments awaiting moderation") ?>
|
||||
<? elseif ($state == "spam"): ?>
|
||||
<?= t("Spam comments") ?>
|
||||
<? elseif ($state == "deleted"): ?>
|
||||
<?= t("Recently deleted comments") ?>
|
||||
<? endif ?>
|
||||
</h2>
|
||||
|
||||
<? if ($state == "spam"): ?>
|
||||
<div>
|
||||
<? $spam_caught = module::get_var("comment", "spam_caught") ?>
|
||||
<? if ($spam_caught > 0): ?>
|
||||
<p>
|
||||
<?= t2("Gallery has caught %count spam for you since you installed spam filtering.",
|
||||
"Gallery has caught %count spam for you since you installed spam filtering.",
|
||||
$spam_caught) ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
<p>
|
||||
<? if ($counts->spam): ?>
|
||||
<?= t2("There is currently one comment in your spam queue. You can delete it with a single click, but there is no undo operation so you may want to check the message first to make sure that it really is spam.",
|
||||
"There are currently %count comments in your spam queue. You can delete them all with a single click, but there is no undo operation so you may want to check the messages first to make sure that they really are spam. All spam messages will be deleted after 7 days automatically.",
|
||||
$counts->spam) ?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="<?= url::site("admin/manage_comments/delete_all_spam?csrf=$csrf") ?>">
|
||||
<?= t("Delete all spam") ?>
|
||||
</a>
|
||||
<? else: ?>
|
||||
<?= t("Your spam queue is empty!") ?>
|
||||
<? endif ?>
|
||||
</p>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<? if ($state == "deleted"): ?>
|
||||
<div>
|
||||
<p>
|
||||
<?= t("These are messages that have been recently deleted. They will be permanently erased automatically after 7 days.") ?>
|
||||
</p>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<table id="g-admin-comments-list">
|
||||
<tr>
|
||||
<th>
|
||||
<?= t("Author") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= t("Comment") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= t("Actions") ?>
|
||||
</th>
|
||||
</tr>
|
||||
<? foreach ($comments as $comment): ?>
|
||||
<tr id="g-comment-<?= $comment->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td>
|
||||
<a href="#">
|
||||
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
|
||||
class="g-avatar"
|
||||
alt="<?= html::clean_attribute($comment->author_name()) ?>"
|
||||
width="40"
|
||||
height="40" />
|
||||
</a>
|
||||
<p><a href="mailto:<?= html::clean_attribute($comment->author_email()) ?>"
|
||||
title="<?= html::clean_attribute($comment->author_email()) ?>"> <?= html::clean($comment->author_name()) ?> </a></p>
|
||||
</td>
|
||||
<td>
|
||||
<div class="g-right">
|
||||
<? $item = $comment->item() ?>
|
||||
<div class="g-item g-photo">
|
||||
<a href="<?= $item->url() ?>">
|
||||
<? if ($item->has_thumb()): ?>
|
||||
<img src="<?= $item->thumb_url() ?>"
|
||||
alt="<?= html::purify($item->title)->for_html_attr() ?>"
|
||||
<?= photo::img_dimensions($item->thumb_width, $item->thumb_height, 75) ?>
|
||||
/>
|
||||
<? else: ?>
|
||||
<?= t("No thumbnail") ?>
|
||||
<? endif ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<p><?= gallery::date($comment->created) ?></p>
|
||||
<?= nl2br(html::purify($comment->text)) ?>
|
||||
</td>
|
||||
<td>
|
||||
<ul class="g-buttonset-vertical">
|
||||
<? if ($comment->state != "unpublished"): ?>
|
||||
<li>
|
||||
<a href="javascript:set_state('unpublished',<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-check"></span>
|
||||
<?= t("Unapprove") ?>
|
||||
</a>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<? if ($comment->state != "published"): ?>
|
||||
<li>
|
||||
<a href="javascript:set_state('published',<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-check"></span>
|
||||
<?= t("Approve") ?>
|
||||
</a>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<? if ($comment->state != "spam"): ?>
|
||||
<li>
|
||||
<a href="javascript:set_state('spam',<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-cancel"></span>
|
||||
<?= t("Spam") ?>
|
||||
</a>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<!--
|
||||
<li>
|
||||
<a href="javascript:reply(<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>
|
||||
<?= t("Reply") ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:Edit(<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span>
|
||||
<?= t("Edit") ?>
|
||||
</a>
|
||||
</li>
|
||||
-->
|
||||
<li>
|
||||
<a href="javascript:set_state('deleted',<?=$comment->id?>)"
|
||||
class="g-button ui-state-default ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span>
|
||||
<?= t("Delete") ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
</table>
|
||||
|
||||
<div class="g-paginator">
|
||||
<?= $pager ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<li id="g-comment-<?= $comment->id; ?>">
|
||||
<p class="g-author">
|
||||
<a href="#">
|
||||
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
|
||||
class="g-avatar"
|
||||
alt="<?= html::clean_attribute($comment->author_name()) ?>"
|
||||
width="40"
|
||||
height="40" />
|
||||
</a>
|
||||
<? if ($comment->author()->guest): ?>
|
||||
<?= t("on %date_time, %name said",
|
||||
array("date_time" => gallery::date_time($comment->created),
|
||||
"name" => html::clean($comment->author_name()))) ?>
|
||||
<? else: ?>
|
||||
<?= t("on %date_time, <a href=\"%url\">%name</a> said",
|
||||
array("date_time" => gallery::date_time($comment->created),
|
||||
"url" => user_profile::url($comment->author_id),
|
||||
"name" => html::clean($comment->author_name()))) ?>
|
||||
<? endif ?>
|
||||
</p>
|
||||
<div>
|
||||
<?= nl2br(html::purify($comment->text)) ?>
|
||||
</div>
|
||||
</li>
|
|
@ -0,0 +1,43 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? echo "<?xml version=\"1.0\" ?>" ?>
|
||||
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:fh="http://purl.org/syndication/history/1.0">
|
||||
<channel>
|
||||
<generator>Gallery 3</generator>
|
||||
<title><?= html::clean($feed->title) ?></title>
|
||||
<link><?= $feed->uri ?></link>
|
||||
<description><?= html::clean($feed->description) ?></description>
|
||||
<language>en-us</language>
|
||||
<atom:link rel="self" href="<?= $feed->uri ?>" type="application/rss+xml" />
|
||||
<fh:complete/>
|
||||
<? if (!empty($feed->previous_page_uri)): ?>
|
||||
<atom:link rel="previous" href="<?= $feed->previous_page_uri ?>" type="application/rss+xml" />
|
||||
<? endif ?>
|
||||
<? if (!empty($feed->next_page_uri)): ?>
|
||||
<atom:link rel="next" href="<?= $feed->next_page_uri ?>" type="application/rss+xml" />
|
||||
<? endif ?>
|
||||
<pubDate><?= $pub_date ?></pubDate>
|
||||
<lastBuildDate><?= $pub_date ?></lastBuildDate>
|
||||
<? foreach ($feed->comments as $comment): ?>
|
||||
<item>
|
||||
<title><?= html::purify($comment->title) ?></title>
|
||||
<link><?= html::clean($comment->item_uri) ?></link>
|
||||
<author><?= html::clean($comment->author) ?></author>
|
||||
<guid isPermaLink="true"><?= $comment->item_uri ?></guid>
|
||||
<pubDate><?= $comment->pub_date ?></pubDate>
|
||||
<content:encoded>
|
||||
<![CDATA[
|
||||
<p><?= nl2br(html::purify($comment->text)) ?></p>
|
||||
<p>
|
||||
<img alt="" src="<?= $comment->thumb_url ?>"
|
||||
height="<?= $comment->thumb_height ?>" width="<?= $comment->thumb_width ?>" />
|
||||
<br />
|
||||
</p>
|
||||
]]>
|
||||
</content:encoded>
|
||||
</item>
|
||||
<? endforeach ?>
|
||||
</channel>
|
||||
</rss>
|
|
@ -0,0 +1,56 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? if (comment::can_comment()): ?>
|
||||
<a href="<?= url::site("form/add/comments/{$item->id}") ?>#comment-form" id="g-add-comment"
|
||||
class="g-button ui-corner-all ui-icon-left ui-state-default">
|
||||
<span class="ui-icon ui-icon-comment"></span>
|
||||
<?= t("Add a comment") ?>
|
||||
</a>
|
||||
<? endif ?>
|
||||
|
||||
<div id="g-comment-detail">
|
||||
<? if (!$comments->count()): ?>
|
||||
<p class="g-no-comments">
|
||||
<? if (comment::can_comment()): ?>
|
||||
<?= t("No comments yet. Be the first to <a %attrs>comment</a>!",
|
||||
array("attrs" => html::mark_clean("href=\"" . url::site("form/add/comments/{$item->id}") . "\" class=\"showCommentForm\""))) ?>
|
||||
<? else: ?>
|
||||
<?= t("No comments yet.") ?>
|
||||
<? endif ?>
|
||||
</p>
|
||||
<ul>
|
||||
<li class="g-no-comments"> </li>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
|
||||
<? if ($comments->count()): ?>
|
||||
<ul>
|
||||
<? foreach ($comments as $comment): ?>
|
||||
<li id="g-comment-<?= $comment->id ?>">
|
||||
<p class="g-author">
|
||||
<a href="#">
|
||||
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
|
||||
class="g-avatar"
|
||||
alt="<?= html::clean_attribute($comment->author_name()) ?>"
|
||||
width="40"
|
||||
height="40" />
|
||||
</a>
|
||||
<? if ($comment->author()->guest): ?>
|
||||
<?= t('on %date %name said',
|
||||
array("date" => gallery::date_time($comment->created),
|
||||
"name" => html::clean($comment->author_name()))); ?>
|
||||
<? else: ?>
|
||||
<?= t('on %date <a href="%url">%name</a> said',
|
||||
array("date" => gallery::date_time($comment->created),
|
||||
"url" => user_profile::url($comment->author_id),
|
||||
"name" => html::clean($comment->author_name()))); ?>
|
||||
<? endif ?>
|
||||
</p>
|
||||
<div>
|
||||
<?= nl2br(html::purify($comment->text)) ?>
|
||||
</div>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
<a name="comment-form" id="g-comment-form-anchor"></a>
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-comment-detail">
|
||||
<ul>
|
||||
<? foreach ($comments as $comment): ?>
|
||||
<li id="g-comment-<?= $comment->id ?>">
|
||||
<p class="g-author">
|
||||
<?= t("on %date for %title ",
|
||||
array("date" => gallery::date_time($comment->created),
|
||||
"title" => $comment->item()->title)); ?>
|
||||
<a href="<?= $comment->item()->url() ?>">
|
||||
<?= $comment->item()->thumb_img(array(), 50) ?>
|
||||
</a>
|
||||
</p>
|
||||
<div>
|
||||
<?= nl2br(html::purify($comment->text)) ?>
|
||||
</div>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,29 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* PHP Mail Configuration parameters
|
||||
* from => email address that appears as the from address
|
||||
* line-length => word wrap length (PHP documentations suggest no larger tha 70 characters
|
||||
* reply-to => what goes into the reply to header
|
||||
*/
|
||||
$config["ranges"] = array(
|
||||
"Digibug1" => array("low" => "65.249.152.0", "high" => "65.249.159.255"),
|
||||
"Digibug2" => array("low" => "208.122.55.0", "high" => "208.122.55.255")
|
||||
);
|
|
@ -0,0 +1,27 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Admin_Digibug_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$v = new Admin_View("admin.html");
|
||||
$v->page_title = t("Digibug");
|
||||
$v->content = new View("admin_digibug.html");
|
||||
print $v;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Digibug_Controller extends Controller {
|
||||
const ALLOW_PRIVATE_GALLERY = true;
|
||||
|
||||
public function print_photo($id) {
|
||||
access::verify_csrf();
|
||||
$item = ORM::factory("item", $id);
|
||||
access::required("view", $item);
|
||||
|
||||
if (access::group_can(identity::everybody(), "view_full", $item)) {
|
||||
$full_url = $item->file_url(true);
|
||||
$thumb_url = $item->thumb_url(true);
|
||||
} else {
|
||||
$proxy = ORM::factory("digibug_proxy");
|
||||
$proxy->uuid = random::hash();
|
||||
$proxy->item_id = $item->id;
|
||||
$proxy->save();
|
||||
$full_url = url::abs_site("digibug/print_proxy/full/$proxy->uuid");
|
||||
$thumb_url = url::abs_site("digibug/print_proxy/thumb/$proxy->uuid");
|
||||
}
|
||||
|
||||
$v = new View("digibug_form.html");
|
||||
$v->order_params = array(
|
||||
"digibug_api_version" => "100",
|
||||
"company_id" => module::get_var("digibug", "company_id"),
|
||||
"event_id" => module::get_var("digibug", "event_id"),
|
||||
"cmd" => "addimg",
|
||||
"partner_code" => "69",
|
||||
"return_url" => url::abs_site("digibug/close_window"),
|
||||
"num_images" => "1",
|
||||
"image_1" => $full_url,
|
||||
"thumb_1" => $thumb_url,
|
||||
"image_height_1" => $item->height,
|
||||
"image_width_1" => $item->width,
|
||||
"thumb_height_1" => $item->thumb_height,
|
||||
"thumb_width_1" => $item->thumb_width,
|
||||
"title_1" => html::purify($item->title));
|
||||
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function print_proxy($type, $uuid) {
|
||||
// If its a request for the full size then make sure we are coming from an
|
||||
// authorized address
|
||||
if ($type == "full") {
|
||||
$remote_addr = ip2long(Input::instance()->server("REMOTE_ADDR"));
|
||||
if ($remote_addr === false) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
$config = Kohana::config("digibug");
|
||||
|
||||
$authorized = false;
|
||||
foreach ($config["ranges"] as $ip_range) {
|
||||
$low = ip2long($ip_range["low"]);
|
||||
$high = ip2long($ip_range["high"]);
|
||||
$authorized = $low !== false && $high !== false &&
|
||||
$low <= $remote_addr && $remote_addr <= $high;
|
||||
if ($authorized) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$authorized) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
}
|
||||
|
||||
$proxy = ORM::factory("digibug_proxy")->where("uuid", "=", $uuid)->find();
|
||||
if (!$proxy->loaded() || !$proxy->item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
$file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path();
|
||||
if (!file_exists($file)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// We don't need to save the session for this request
|
||||
Session::instance()->abort_save();
|
||||
|
||||
if (!TEST_MODE) {
|
||||
// Dump out the image
|
||||
header("Content-Type: {$proxy->item->mime_type}");
|
||||
Kohana::close_buffers(false);
|
||||
$fd = fopen($file, "rb");
|
||||
fpassthru($fd);
|
||||
fclose($fd);
|
||||
}
|
||||
|
||||
$this->_clean_expired();
|
||||
}
|
||||
|
||||
public function close_window() {
|
||||
print "<script type=\"text/javascript\">window.close();</script>";
|
||||
}
|
||||
|
||||
private function _clean_expired() {
|
||||
db::build()
|
||||
->delete("digibug_proxies")
|
||||
->where("request_date", "<=", db::expr("(CURDATE() - INTERVAL 10 DAY)"))
|
||||
->limit(20)
|
||||
->execute();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class digibug_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->get("settings_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("digibug_menu")
|
||||
->label(t("Digibug"))
|
||||
->url(url::site("admin/digibug")));
|
||||
}
|
||||
|
||||
static function site_menu($menu, $theme) {
|
||||
$item = $theme->item();
|
||||
if ($item && $item->type == "photo") {
|
||||
$menu->get("options_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("digibug")
|
||||
->label(t("Print with Digibug"))
|
||||
->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
|
||||
->css_id("g-print-digibug-link")
|
||||
->css_class("g-print-digibug-link ui-icon-print"));
|
||||
}
|
||||
}
|
||||
|
||||
static function context_menu($menu, $theme, $item) {
|
||||
if ($item->type == "photo") {
|
||||
$menu->get("options_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("digibug")
|
||||
->label(t("Print with Digibug"))
|
||||
->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf"))
|
||||
->css_class("g-print-digibug-link ui-icon-print"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class digibug_installer {
|
||||
static function install() {
|
||||
Database::instance()
|
||||
->query("CREATE TABLE {digibug_proxies} (
|
||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
||||
`uuid` char(32) NOT NULL,
|
||||
`request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp,
|
||||
`item_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
module::set_var("digibug", "company_id", "3153");
|
||||
module::set_var("digibug", "event_id", "8491");
|
||||
module::set_version("digibug", 2);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
if ($version == 1) {
|
||||
module::clear_var("digibug", "default_company_id");
|
||||
module::clear_var("digibug", "default_event_id");
|
||||
module::clear_var("digibug", "basic_default_company_id");
|
||||
module::clear_var("digibug", "basic_event_id");
|
||||
module::set_var("digibug", "company_id", "3153");
|
||||
module::set_var("digibug", "event_id", "8491");
|
||||
module::set_version("digibug", $version = 2);
|
||||
}
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
Database::instance()->query("DROP TABLE IF EXISTS {digibug_proxies}");
|
||||
module::delete("digibug");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class digibug_theme_Core {
|
||||
static function head($theme) {
|
||||
return $theme->script("digibug.js");
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,43 @@
|
|||
$(document).ready(function() {
|
||||
$(".g-print-digibug-link").click(function(e) {
|
||||
e.preventDefault();
|
||||
return digibug_popup(e.currentTarget.href, { width: 800, height: 600 } );
|
||||
});
|
||||
});
|
||||
|
||||
function digibug_popup(url, options) {
|
||||
options = $.extend({
|
||||
/* default options */
|
||||
width: '800',
|
||||
height: '600',
|
||||
target: 'dbPopWin',
|
||||
scrollbars: 'yes',
|
||||
resizable: 'no',
|
||||
menuBar: 'no',
|
||||
addressBar: 'yes'
|
||||
}, options);
|
||||
|
||||
// center the window by default.
|
||||
if (!options.winY) {
|
||||
options.winY = screen.height / 2 - options.height / 2;
|
||||
};
|
||||
if (!options.winX) {
|
||||
options.winX = screen.width / 2 - options.width / 2;
|
||||
};
|
||||
|
||||
open(
|
||||
url,
|
||||
options['target'],
|
||||
'width= ' + options.width +
|
||||
',height=' + options.height +
|
||||
',top=' + options.winY +
|
||||
',left=' + options.winX +
|
||||
',scrollbars=' + options.scrollbars +
|
||||
',resizable=' + options.resizable +
|
||||
',menubar=' + options.menuBar +
|
||||
',location=' + options.addressBar
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class Digibug_Proxy_Model_Core extends ORM {
|
||||
protected $belongs_to = array("item");
|
||||
}
|