openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #04680
lp:~openerp-dev/openobject-client-web/proto61-fix-chrome-debug-niv into lp:openobject-client-web
Nicolas Vanhoren (OpenERP) has proposed merging lp:~openerp-dev/openobject-client-web/proto61-fix-chrome-debug-niv into lp:openobject-client-web.
Requested reviews:
Antony Lesuisse (al-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/proto61-fix-chrome-debug-niv/+merge/55107
Fixed bug that made Chrome's debugger unusable.
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~openerp-dev/openobject-client-web/proto61-fix-chrome-debug-niv/+merge/55107
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/proto61-fix-chrome-debug-niv.
=== added file 'LICENSE'
--- LICENSE 1970-01-01 00:00:00 +0000
+++ LICENSE 2011-03-28 09:08:30 +0000
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ 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
+them 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.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey 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;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero 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 that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ 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.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+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.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ 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
+state 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 Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
=== added file 'README'
--- README 1970-01-01 00:00:00 +0000
+++ README 2011-03-28 09:08:30 +0000
@@ -0,0 +1,42 @@
+Coding style
+------------
+
+Javascript
+ http://javascript.crockford.com/code.html with the following amendements:
+ - Line Length should be 160 (132?), dont split at 80, rationale in 2011 we all use 16/9 screens
+
+ http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml ?
+
+Modules Conventions
+-------------------
+
+addons/<modulename>/controllers/ python controller
+addons/<modulename>/controllers/main.py main python controller is there is only one (or should it be <modulename>.py ?)
+addons/<modulename>/static/ static directory (directly served by the web server)
+addons/<modulename>/static/<external_library>/ directory containing an external javascrip library respect the directory structure of upstream is this directory
+addons/<modulename>/static/openerp/ module specfic static files
+addons/<modulename>/static/openerp/js/ module specific javscript files
+addons/<modulename>/static/openerp/css/ module specific css files
+addons/<modulename>/static/openerp/img/ module specific images files
+addons/<modulename>/static/openerp/ other files
+addons/<modulename>/__openerp__.py module manifest referencing js and css files
+
+
+Dependecies
+-----------
+Depends on
+
+install "CherryPy>=3.1.2" "-d cherrypy"
+install "simplejson>=2.0.9" "-d simplejson"
+
+Maybe soon on
+
+#install "Babel>=0.9.4" "-d babel"
+#install "pytz>=2009j" "-d pytz"
+
+Probably not anymore on:
+
+#install "Mako>=0.2.4" "-d mako"
+#install "formencode>=1.2.2" "-d formencode"
+#install "pyparsing>=1.5.2" "-f pyparsing.py"
+#install "xlwt>=0.7" "-d xlwt"
=== removed file 'addons/__init__.py'
=== added directory 'addons/base'
=== added file 'addons/base/__init__.py'
--- addons/base/__init__.py 1970-01-01 00:00:00 +0000
+++ addons/base/__init__.py 2011-03-28 09:08:30 +0000
@@ -0,0 +1,1 @@
+import controllers
=== added file 'addons/base/__openerp__.py'
--- addons/base/__openerp__.py 1970-01-01 00:00:00 +0000
+++ addons/base/__openerp__.py 2011-03-28 09:08:30 +0000
@@ -0,0 +1,6 @@
+{
+ "name" : "OpenERP Web base",
+ "version" : "2.0",
+ "depends" : [],
+ 'active': True,
+}
=== added directory 'addons/base/controllers'
=== added file 'addons/base/controllers/__init__.py'
--- addons/base/controllers/__init__.py 1970-01-01 00:00:00 +0000
+++ addons/base/controllers/__init__.py 2011-03-28 09:08:30 +0000
@@ -0,0 +1,1 @@
+import main
=== added file 'addons/base/controllers/main.py'
--- addons/base/controllers/main.py 1970-01-01 00:00:00 +0000
+++ addons/base/controllers/main.py 2011-03-28 09:08:30 +0000
@@ -0,0 +1,342 @@
+# -*- coding: utf-8 -*-
+import glob, os
+from xml.etree import ElementTree
+from cStringIO import StringIO
+
+import simplejson
+
+import openerpweb
+
+
+class Xml2Json:
+ # xml2json-direct
+ # Simple and straightforward XML-to-JSON converter in Python
+ # New BSD Licensed
+ #
+ # URL: http://code.google.com/p/xml2json-direct/
+ @staticmethod
+ def convert_to_json(s):
+ return simplejson.dumps(Xml2Json.convert_to_structure(s), sort_keys=True, indent=4)
+
+ @staticmethod
+ def convert_to_structure(s):
+ root = ElementTree.fromstring(s)
+ return Xml2Json.convert_element(root)
+
+ @staticmethod
+ def convert_element(el, skip_whitespaces=True):
+ res = {}
+ if el.tag[0] == "{":
+ ns, name = el.tag.rsplit("}", 1)
+ res["tag"] = name
+ res["namespace"] = ns[1:]
+ else:
+ res["tag"] = el.tag
+ res["attrs"] = {}
+ for k, v in el.items():
+ res["attrs"][k] = v
+ kids = []
+ if el.text and (not skip_whitespaces or el.text.strip() != ''):
+ kids.append(el.text)
+ for kid in el:
+ kids.append(Xml2Json.convert_element(kid))
+ if kid.tail and (not skip_whitespaces or kid.tail.strip() != ''):
+ kids.append(kid.tail)
+ res["children"] = kids
+ return res
+
+#----------------------------------------------------------
+# OpenERP Web base Controllers
+#----------------------------------------------------------
+
+class Session(openerpweb.Controller):
+ _cp_path = "/base/session"
+
+ def manifest_glob(self, modlist, key):
+ files = []
+ for i in modlist:
+ globlist = openerpweb.addons_manifest.get(i, {}).get(key, [])
+ for j in globlist:
+ for k in glob.glob(os.path.join(openerpweb.path_addons, i, j)):
+ files.append(k[len(openerpweb.path_addons):])
+ return files
+
+ def concat_files(self, file_list):
+ """ Concatenate file content
+ return (concat,timestamp)
+ concat: concatenation of file content
+ timestamp: max(os.path.getmtime of file_list)
+ """
+ root = openerpweb.path_root
+ files_content = []
+ files_timestamp = 0
+ for i in file_list:
+ fname = os.path.join(root, i)
+ ftime = os.path.getmtime(fname)
+ if ftime > files_timestamp:
+ files_timestamp = ftime
+ files_content = open(fname).read()
+ files_concat = "".join(files_content)
+ return files_concat
+
+ @openerpweb.jsonrequest
+ def login(self, req, db, login, password):
+ req.session.login(db, login, password)
+ return {
+ "session_id": req.session_id,
+ "uid": req.session._uid,
+ }
+
+ @openerpweb.jsonrequest
+ def modules(self, req):
+ return {"modules": ["base", "base_hello", "base_calendar"]}
+
+ @openerpweb.jsonrequest
+ def csslist(self, req, mods='base,base_hello'):
+ return {'files': self.manifest_glob(mods.split(','), 'css')}
+
+ @openerpweb.jsonrequest
+ def jslist(self, req, mods='base,base_hello'):
+ return {'files': self.manifest_glob(mods.split(','), 'js')}
+
+ def css(self, req, mods='base,base_hello'):
+ files = self.manifest_glob(mods.split(','), 'css')
+ concat = self.concat_files(files)[0]
+ # TODO request set the Date of last modif and Etag
+ return concat
+ css.exposed = True
+
+ def js(self, req, mods='base,base_hello'):
+ files = self.manifest_glob(mods.split(','), 'js')
+ concat = self.concat_files(files)[0]
+ # TODO request set the Date of last modif and Etag
+ return concat
+ js.exposed = True
+
+
+class Menu(openerpweb.Controller):
+ _cp_path = "/base/menu"
+
+ @openerpweb.jsonrequest
+ def load(self, req):
+ return {'data': self.do_load(req)}
+
+ def do_load(self, req):
+ """ Loads all menu items (all applications and their sub-menus).
+
+ :param req: A request object, with an OpenERP session attribute
+ :type req: < session -> OpenERPSession >
+ :return: the menu root
+ :rtype: dict('children': menu_nodes)
+ """
+ Menus = req.session.model('ir.ui.menu')
+ # menus are loaded fully unlike a regular tree view, cause there are
+ # less than 512 items
+ menu_ids = Menus.search([])
+ menu_items = Menus.read(menu_ids, ['name', 'sequence', 'parent_id'])
+ menu_root = {'id': False, 'name': 'root', 'parent_id': [-1, '']}
+ menu_items.append(menu_root)
+
+ # make a tree using parent_id
+ menu_items_map = dict((menu_item["id"], menu_item) for menu_item in menu_items)
+ for menu_item in menu_items:
+ if menu_item['parent_id']:
+ parent = menu_item['parent_id'][0]
+ else:
+ parent = False
+ if parent in menu_items_map:
+ menu_items_map[parent].setdefault(
+ 'children', []).append(menu_item)
+
+ # sort by sequence a tree using parent_id
+ for menu_item in menu_items:
+ menu_item.setdefault('children', []).sort(
+ key=lambda x:x["sequence"])
+
+ return menu_root
+
+ @openerpweb.jsonrequest
+ def action(self, req, menu_id):
+ print "QUERY"
+ m = req.session.model('ir.values')
+ r = m.get('action', 'tree_but_open', [('ir.ui.menu', menu_id)], False, {})
+ print r
+ res = {"action": r}
+ return res
+
+
+class DataSet(openerpweb.Controller):
+ _cp_path = "/base/dataset"
+
+ @openerpweb.jsonrequest
+ def fields(self, req, model):
+ return {'fields': req.session.model(model).fields_get()}
+
+ @openerpweb.jsonrequest
+ def find(self, request, model, fields=False, offset=0, limit=False,
+ domain=None, context=None, sort=None):
+ return self.do_find(request, model, fields, offset, limit,
+ domain, context, sort)
+ def do_find(self, request, model, fields=False, offset=0, limit=False,
+ domain=None, context=None, sort=None):
+ """ Performs a search() followed by a read() (if needed) using the
+ provided search criteria
+
+ :param request: a JSON-RPC request object
+ :type request: openerpweb.JsonRequest
+ :param model: the name of the model to search on
+ :type model: str
+ :param fields: a list of the fields to return in the result records
+ :type fields: [str]
+ :param offset: from which index should the results start being returned
+ :type offset: int
+ :param limit: the maximum number of records to return
+ :type limit: int
+ :param domain: the search domain for the query
+ :type domain: list
+ :param context: the context in which the search should be executed
+ :type context: dict
+ :param sort: sorting directives
+ :type sort: list
+ :returns: a list of result records
+ :rtype: list
+ """
+ Model = request.session.model(model)
+ ids = Model.search(domain or [], offset or 0, limit or False,
+ sort or False, context or False)
+ if fields and fields == ['id']:
+ # shortcut read if we only want the ids
+ return map(lambda id: {'id': id}, ids)
+ return Model.read(ids, fields or False)
+
+ @openerpweb.jsonrequest
+ def get(self, request, model, ids):
+ self.do_get(request, model, ids)
+
+ def do_get(self, request, model, ids):
+ """ Fetches and returns the records of the model ``model`` whose ids
+ are in ``ids``.
+
+ The results are in the same order as the inputs, but elements may be
+ missing (if there is no record left for the id)
+
+ :param request: the JSON-RPC2 request object
+ :type request: openerpweb.JsonRequest
+ :param model: the model to read from
+ :type model: str
+ :param ids: a list of identifiers
+ :type ids: list
+ :returns: a list of records, in the same order as the list of ids
+ :rtype: list
+ """
+ Model = request.session.model(model)
+ records = Model.read(ids)
+
+ record_map = dict((record['id'], record) for record in records)
+
+ return [record_map[id] for id in ids if record_map.get(id)]
+
+class DataRecord(openerpweb.Controller):
+ _cp_path = "/base/datarecord"
+
+ @openerpweb.jsonrequest
+ def load(self, req, model, id, fields):
+ m = req.session.model(model)
+ value = {}
+ r = m.read([id])
+ if r:
+ value = r[0]
+ return {'value': value}
+
+
+class View(openerpweb.Controller):
+ def fields_view_get(self, session, model, view_id, view_type, transform=True):
+ Model = session.model(model)
+ r = Model.fields_view_get(view_id, view_type)
+ if transform:
+ context = {} # TODO: dict(ctx_sesssion, **ctx_action)
+ xml = self.transform_view(r['arch'], context)
+ else:
+ xml = ElementTree.fromstring(r['arch'])
+ r['arch'] = Xml2Json.convert_element(xml)
+ return r
+
+ def normalize_attrs(self, elem, context):
+ """ Normalize @attrs, @invisible, @required, @readonly and @states, so
+ the client only has to deal with @attrs.
+
+ See `the discoveries pad <http://pad.openerp.com/discoveries>`_ for
+ the rationale.
+
+ :param elem: the current view node (Python object)
+ :type elem: xml.etree.ElementTree.Element
+ :param dict context: evaluation context
+ """
+ # If @attrs is normalized in json by server, the eval should be replaced by simplejson.loads
+ attrs = eval(elem.attrib.get('attrs', '{}'))
+ if 'states' in elem.attrib:
+ if 'invisible' not in attrs:
+ attrs['invisible'] = []
+ # This should be done by the server
+ attrs['invisible'].append(('state', 'in', elem.attrib['states'].split(',')))
+ del(elem.attrib['states'])
+ if attrs:
+ elem.attrib['attrs'] = simplejson.dumps(attrs)
+ for a in ['invisible', 'readonly', 'required']:
+ if a in elem.attrib:
+ # In the XML we trust
+ avalue = bool(eval(elem.attrib.get(a, 'False'),
+ {'context': context or {}}))
+ if not avalue:
+ del elem.attrib[a]
+ else:
+ elem.attrib[a] = '1'
+ if a == 'invisible' and 'attrs' in elem.attrib:
+ del elem.attrib['attrs']
+
+ def transform_view(self, view_string, context=None):
+ # transform nodes on the fly via iterparse, instead of
+ # doing it statically on the parsing result
+ parser = ElementTree.iterparse(StringIO(view_string), events=("start",))
+ root = None
+ for event, elem in parser:
+ if event == "start":
+ if root is None:
+ root = elem
+ self.normalize_attrs(elem, context)
+ return root
+
+
+class FormView(View):
+ _cp_path = "/base/formview"
+
+ @openerpweb.jsonrequest
+ def load(self, req, model, view_id):
+ fields_view = self.fields_view_get(req.session, model, view_id, 'form')
+ return {'fields_view': fields_view}
+
+
+class ListView(View):
+ _cp_path = "/base/listview"
+
+ @openerpweb.jsonrequest
+ def load(self, req, model, view_id):
+ fields_view = self.fields_view_get(req.session, model, view_id, 'tree')
+ return {'fields_view': fields_view}
+
+
+class SearchView(View):
+ _cp_path = "/base/searchview"
+
+ @openerpweb.jsonrequest
+ def load(self, req, model, view_id):
+ fields_view = self.fields_view_get(req.session, model, view_id, 'search')
+ return {'fields_view': fields_view}
+
+
+class Action(openerpweb.Controller):
+ _cp_path = "/base/action"
+
+ @openerpweb.jsonrequest
+ def load(self, req, action_id):
+ return {}
=== added directory 'addons/base/static'
=== added directory 'addons/base/static/LABjs'
=== added file 'addons/base/static/LABjs/LAB.js'
--- addons/base/static/LABjs/LAB.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/LABjs/LAB.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,5 @@
+/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
+ v1.2.0 (c) Kyle Simpson
+ MIT License
+*/
+(function(p){var q="string",w="head",L="body",M="script",u="readyState",j="preloaddone",x="loadtrigger",N="srcuri",E="preload",Z="complete",y="done",z="which",O="preserve",F="onreadystatechange",ba="onload",P="hasOwnProperty",bb="script/cache",Q="[object ",bw=Q+"Function]",bx=Q+"Array]",e=null,h=true,i=false,k=p.document,bc=p.location,bd=p.ActiveXObject,A=p.setTimeout,be=p.clearTimeout,R=function(a){return k.getElementsByTagName(a)},S=Object.prototype.toString,G=function(){},r={},T={},bf=/^[^?#]*\//.exec(bc.href)[0],bg=/^\w+\:\/\/\/?[^\/]+/.exec(bf)[0],by=R(M),bh=p.opera&&S.call(p.opera)==Q+"Opera]",bi=("MozAppearance"in k.documentElement.style),bj=(k.createElement(M).async===true),v={cache:!(bi||bh),order:bi||bh||bj,xhr:h,dupe:h,base:"",which:w};v[O]=i;v[E]=h;r[w]=k.head||R(w);r[L]=R(L);function B(a){return S.call(a)===bw}function U(a,b){var c=/^\w+\:\/\//,d;if(typeof a!=q)a="";if(typeof b!=q)b="";d=((/^\/\//.test(a))?bc.protocol:"")+a;d=(c.test(d)?"":b)+d;return((c.test(d)?"":(d.charAt(0)==="/"?bg:bf))+d)}function bz(a){return(U(a).indexOf(bg)===0)}function bA(a){var b,c=-1;while(b=by[++c]){if(typeof b.src==q&&a===U(b.src)&&b.type!==bb)return h}return i}function H(t,l){t=!(!t);if(l==e)l=v;var bk=i,C=t&&l[E],bl=C&&l.cache,I=C&&l.order,bm=C&&l.xhr,bB=l[O],bC=l.which,bD=l.base,bn=G,J=i,D,s=h,m={},K=[],V=e;C=bl||bm||I;function bo(a,b){if((a[u]&&a[u]!==Z&&a[u]!=="loaded")||b[y]){return i}a[ba]=a[F]=e;return h}function W(a,b,c){c=!(!c);if(!c&&!(bo(a,b)))return;b[y]=h;for(var d in m){if(m[P](d)&&!(m[d][y]))return}bk=h;bn()}function bp(a){if(B(a[x])){a[x]();a[x]=e}}function bE(a,b){if(!bo(a,b))return;b[j]=h;A(function(){r[b[z]].removeChild(a);bp(b)},0)}function bF(a,b){if(a[u]===4){a[F]=G;b[j]=h;A(function(){bp(b)},0)}}function X(b,c,d,g,f,n){var o=b[z];A(function(){if("item"in r[o]){if(!r[o][0]){A(arguments.callee,25);return}r[o]=r[o][0]}var a=k.createElement(M);if(typeof d==q)a.type=d;if(typeof g==q)a.charset=g;if(B(f)){a[ba]=a[F]=function(){f(a,b)};a.src=c;if(bj){a.async=i}}r[o].insertBefore(a,(o===w?r[o].firstChild:e));if(typeof n==q){a.text=n;W(a,b,h)}},0)}function bq(a,b,c,d){T[a[N]]=h;X(a,b,c,d,W)}function br(a,b,c,d){var g=arguments;if(s&&a[j]==e){a[j]=i;X(a,b,bb,d,bE)}else if(!s&&a[j]!=e&&!a[j]){a[x]=function(){br.apply(e,g)}}else if(!s){bq.apply(e,g)}}function bs(a,b,c,d){var g=arguments,f;if(s&&a[j]==e){a[j]=i;f=a.xhr=(bd?new bd("Microsoft.XMLHTTP"):new p.XMLHttpRequest());f[F]=function(){bF(f,a)};f.open("GET",b);f.send("")}else if(!s&&a[j]!=e&&!a[j]){a[x]=function(){bs.apply(e,g)}}else if(!s){T[a[N]]=h;X(a,b,c,d,e,a.xhr.responseText);a.xhr=e}}function bt(a){if(typeof a=="undefined"||!a)return;if(a.allowDup==e)a.allowDup=l.dupe;var b=a.src,c=a.type,d=a.charset,g=a.allowDup,f=U(b,bD),n,o=bz(f);if(typeof d!=q)d=e;g=!(!g);if(!g&&((T[f]!=e)||(s&&m[f])||bA(f))){if(m[f]!=e&&m[f][j]&&!m[f][y]&&o){W(e,m[f],h)}return}if(m[f]==e)m[f]={};n=m[f];if(n[z]==e)n[z]=bC;n[y]=i;n[N]=f;J=h;if(!I&&bm&&o)bs(n,f,c,d);else if(!I&&bl)br(n,f,c,d);else bq(n,f,c,d)}function Y(a){if(t&&!I)K.push(a);if(!t||C)a()}function bu(a){var b=[],c;for(c=-1;++c<a.length;){if(S.call(a[c])===bx)b=b.concat(bu(a[c]));else b[b.length]=a[c]}return b}D={script:function(){be(V);var a=bu(arguments),b=D,c;if(bB){for(c=-1;++c<a.length;){if(B(a[c]))a[c]=a[c]();if(c===0){Y(function(){bt((typeof a[0]==q)?{src:a[0]}:a[0])})}else b=b.script(a[c]);b=b.wait()}}else{for(c=-1;++c<a.length;){if(B(a[c]))a[c]=a[c]()}Y(function(){for(c=-1;++c<a.length;){bt((typeof a[c]==q)?{src:a[c]}:a[c])}})}V=A(function(){s=i},5);return b},wait:function(a){be(V);s=i;if(!B(a))a=G;var b=H(t||J,l),c=b.trigger,d=function(){try{a()}catch(err){}c()};delete b.trigger;var g=function(){if(J&&!bk)bn=d;else d()};if(t&&!J)K.push(g);else Y(g);return b}};if(t){D.trigger=function(){var a,b=-1;while(a=K[++b])a();K=[]}}else D.trigger=G;return D}function bv(a){var b,c={},d={"UseCachePreload":"cache","UseLocalXHR":"xhr","UsePreloading":E,"AlwaysPreserveOrder":O,"AllowDuplicates":"dupe"},g={"AppendTo":z,"BasePath":"base"};for(b in d)g[b]=d[b];c.order=!(!v.order);for(b in g){if(g[P](b)&&v[g[b]]!=e)c[g[b]]=(a[b]!=e)?a[b]:v[g[b]]}for(b in d){if(d[P](b))c[d[b]]=!(!c[d[b]])}if(!c[E])c.cache=c.order=c.xhr=i;c.which=(c.which===w||c.which===L)?c.which:w;return c}p.$LAB={setGlobalDefaults:function(a){v=bv(a)},setOptions:function(a){return H(i,bv(a))},script:function(){return H().script.apply(e,arguments)},wait:function(){return H().wait.apply(e,arguments)}};(function(a,b,c){if(k[u]==e&&k[a]){k[u]="loading";k[a](b,c=function(){k.removeEventListener(b,c,i);k[u]=Z},i)}})("addEventListener","DOMContentLoaded")})(window);
\ No newline at end of file
=== added directory 'addons/base/static/jquery'
=== added directory 'addons/base/static/jquery.jqGrid'
=== added file 'addons/base/static/jquery.jqGrid/Changes.txt'
--- addons/base/static/jquery.jqGrid/Changes.txt 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/Changes.txt 2011-03-28 09:08:30 +0000
@@ -0,0 +1,1160 @@
+3.6 version
+===========
+Bug Fixes
+---------
+ * Fix problem with getAbsoluteIndex on IE8
+ * Fix in triggerReload grid to reset the savedRow array.
+ * Fix in setGridWidth method when try to resize a grid a and there is no data.
+ * Fix header aligment in ie8
+ * Fix in createEl function to check for val and not for html when select
+ * making getChangedCells method compatible with unformat function if defined
+ * Fixed record count when scroll true
+ * Fix in setSelection method to accept numbers
+ * Fix IE header checkbox when multiselect is true
+ * Fix for searching DOM elements with id containing special characters
+ * Fix a checkbox checking in form editing module.
+ * Fix getCol to use unformat function
+ * Better looking buttons in form editing
+ * Fix searchFilter in IE7 and IE6 not to return undefined value when more
+than one field is searched.
+ * Some fixes for datepicker UI in inline and cell edit (when present)
+ * Fix in setLabel method not to clear the sort icons when we set new label
+ * Fix in form edit when a formatter select is used
+ * Fix the id pollution when multiselect is enabled. Now the id of every
+common multiselect is combination of cb_ + id of the grid
+ * Fixed bug when deselectAfterSort false and we are in multiselect mode
+ * Fix in unformat number and currency
+ * Fixed bug when creating a select with dataUrl and select is set to multiple.
+ * Fix a bug when creating select with multiple option. Also the attribute
+should be set immediatley after the element is created and not after.
+ * Fix a bug in form edit. The comapared values should be trimed since of
+split(",") which cause the elements to begin with space.
+ * Fix a jqGrid loader (development version) for IE browsers
+ * Fix for form icons in Opera
+ * Fix getGridParam to return values 0 or false
+ * Avoiding the overhead of local functions and maintenance issues when the
+parameters change
+ * Opera fix for cursor col-resize
+ * Fix in editGridRow when a save key is defined and the key is Eneter we
+should not do save when we are in teaxtarea element
+ * Fix in formatter checkbox when the value is undefined. We also add a
+default format for the checkbox too
+ * Fix addRowData to use key:true (keyIndex) when rowid is not defined
+ * Fix formatter bug for the select to use the defaultFormat
+ * Adding a 3 parameter to the unformat function - the cellobject.
+ * Fix alternate rows when we sort data locally.
+ * Fix in addRowData for alternate rows when we add item as last
+ * Fix collapseRow in treegrid preventing infinite recursion
+ * Fix in stripHtml function to parse numeric values
+ * Fix in delGridRow to get "fresh" Data from delData object
+ * Fix problems with width option if set as string.
+ * Fixing $jgrid.format function in base module to accept undefined parameter.
+ * Fix for saveRow method in aftersave function. Also we pass the request and
+not the responseText. Also both aftersave and success functions have the
+same type parameter - the response
+ * Fix for serchhidden in searchGrid method
+ * Fix for setGridWidth method
+ * Fix setColWidth function
+ * Fix for topinfo and bottom info in formedit to appear separatley in edit and add dialogs
+ * Fix searchFilter css to work when called from subgrid
+ * Fix celledit to work better when datepicker is attached
+ * Fix in viewGrid row to vizualize only the columns that only not hidden.
+
+
+Additions and changes
+---------------------
+ * New API
+ * RTL Support
+ * Column reordering
+ * Added life scrolling of data
+ * Added gridResize method which can resize the grid. Also use a jQuery UI
+resizable and can use any options of this widget
+ * Added sortableRows method which allow us to sort rows with drag and drop
+ * Added gridDnD method. The method connect two or more grids so that drag and drop rows
+between these is possible
+ * Add columnChooser method which allows choosing/sorting columns at the same
+time. This method requiere multiselect plugin
+ * Now getRowData can return all rows when rowid is not set.
+ * getCol now can return summary, average and count of the selected row. The
+3 parameter determines this (valid are sum, avg, count). If this parameter
+is set and is valid, the returned value is a scalar.If the param is not
+valid the returned value is empty array.
+ * To setRowData we add a 3 parameter. If the parameter is string we use
+addClass to add classes. If the parameter is object we use css to add css
+properties. Note that we can set properties and classes without data, in
+this case we should set data to false
+ * Adding a event object to ondblClickRow and onRightClickRow events as 4 parameter
+ * Add a ant based build system which allow us to minify the JS code
+ * Added custom validation property in editing modules
+ * Added possibility to create custom element in editing modules
+ * Adding support to configure the ajax request in a way that user want. This
+is done in all modules where ajax is used.
+ * Added class in cell edit and inline edit so that the cell or row can not
+be edited - the corresponding classes are 'not-editable-cell' and
+'not-editable-row'.
+ * Added Hebrew Translation
+ * Added a beforeCheckValues event in editGridRow method. The execution is
+before checking the values. Should return object of the posted data.
+ * Added Romanian translation
+ * Added a property classes in colModel where we can attach classes to column.
+ * info_dialog function can be used as separate modal dialog
+ * Added a class ui-ellipsis in grid css file. Also work in FireFox too.
+ * Changind the order of calling the events beforeSearch and beforeClear in
+filterToolbar method. Also the events are called immediatley after triggering the grid
+ * To onCellSelect we replace the 4 parameter with the more natuaral event instead of e.target -
+sorry if this will bring to some confusions.
+ * Added searchoptions value parameter in order to separate the editing module and search module.
+We first look for such option in searchoptions and if not found we use the
+editoptions value
+ * Added fixed property in colModel which allow us not to change the
+column width if shrinkToFit is true and we set new width of the grid.
+ * Added buildSelect function to deserialize data for the select. This is option
+can be added in editoptions or search options
+
+
+Please read The Installation instructions first in install.txt
+================================================
+3.5 beta (buld6- build11)
+
+New Properties and methods
+==========================
+
+- Added new grid parameter hoverrows. When set to false the mouse hovering is
+disabled in the grid data rows.
+
+- Added rowid as parameter to error function in saveRow method - inline
+editing module
+
+- treeGrid to be initially work with datatype local
+
+- Added new method updateGridRows (grid.custom.js)
+This method update the existing data in the grid by given id rowname.
+
+Syntax: updateGridRows (data, rowidname, jsonreader)
+
+data is a array of data in format
+[{name:value,name1:value1...},{name:value,name2:value2...}]
+where the name is the name from colModel and value is the actuall value.
+It is not neccessary that all columns are present in the data item object
+(the same as setRowData method)
+
+rowidname (string) - is the name of the row which should acts as id.
+If not set the name "id" is used.
+
+jsonreader (boolean) default false. If set to true a jsonReader definition
+is used to set the data. Note that this work only of the item in jsonReader
+object 'repeatitems' is set to true.
+
+- Switch to namedItems JS function. This improve the speed. Previously we
+walk throught the entry rowset to find the rowIndex of the given rowid.
+Now we use the build in javaScript method namedItems which do the same.
+
+- multiselect is enabled in inline edit module.
+
+- To the importComplete event in jqGridImport method we pass the response.
+
+- Added support for alternate rows. Also added new jqGrid option altclass.
+The default value is 'ui-priority-secondary' THis way we can develop our own
+alternate class.
+
+- Added ShrinkToFit option in setColumns method which fit columns to the grid
+width. Default value is false.
+
+- Extend tableToGrid method to use custom options when building the grid.
+The call to this function is
+tableToGrid(selector, options)
+where options is the object with jqGrid options.
+
+- Adding 4px right to the view records text for better view
+
+- Add a onClose event to all modals in form editing (except alert dialog)
+The default value is null. This event can be passed in editGridRow, delGridRow,
+viewGridRow, and setColumns methods. The event raised when a close icon is clicked,
+a cancel button is clicked or ESC key is pressed (if this is enabled).
+
+- Significant speed improvents in tree Grid when a relative large data is loaded.
+
+- Added dataheight parameter to all modal windows, where we can control the
+scrolling content. Intitially this parameter is auto.
+To summarize - we have two parameters for controlling the height of the modal.
+height and dataheight.
+The height parameter control the height of the entry modal, dataheight parameter
+control the height of the scrolling content. The buttons of the modals are
+allways visible at the bottom of the modal.Also some improvments in jqDnR.
+
+- In setColumns method we add colnameview and closeAfterSubmit parameters. The
+colnameview (default true). If set to false the names from colModel are not
+visible. closeAfterSubmit if defined cleses the dialog after the submit
+button is clicked.
+
+- Added parameter viewsortcols in jqGrid parameters. The purpose of this
+parameter is to define different look and behavior of sorting icons that
+appear near the header. This parameter is array with the following default
+options
+viewsortcols : [false,'vertical',true]
+
+The first parameter determines if all icons should be viewed at the same time
+when all columns have sort property set to true.
+The default of false determines that only the icons of the current sorting column
+should be viewed.
+Setting this parameter to true causes all icons in all sortable columns to be viewed.
+
+The second parameter determines how icons should be placed - vertical means that
+the sorting icons are one under another. 'horizontal' means that the icons should
+be one near other.
+
+The third parameter determines the click functionality. If set to true the columns are
+sorted if the header is clicked. If set to false the columns are sorted only when
+the icons are clicked.
+
+Important note: When set a third parameter to false be a sure that the first parameter
+is set to true, otherwise you will lost the sorting.
+
+
+Fixes
+=====
+- Fixed bug in filterToolbar. We search now by index and when not found by
+name.
+
+- Fix in searchGrid method. We search now by index and when not found by
+name.
+
+- Fixed bug in IE when resizing columns. The function getOffset is changed
+so that the resizing speed is the same as in Safari and FF.
+
+- Fix multiple select bug in createEl function. Now we set the options before
+checking for multiple:true
+
+- Fixed bug in treegrid. The strict comparation in getNodeParent method
+causes bad results.
+
+- Fix in setGridWidth method. We do not initialize correct the new width which
+causes after the first set of the width to not work in other grid in the same
+page.
+
+- Fixed bug in GridExport. We delete the columns that are generated
+dynamically - multiselect, subgrid, treegrid or rownumbers. This way the
+import is without errors
+
+- Fixed a bug in addRowData method to add data with id = 0 (number)
+
+- Fixed a forever loading bug in IE.
+
+- Fixed altRows bug in delRowData method
+
+- navGrid method fix for warning modal and IE6
+
+- Fix setColumns method to the common apprach of forms and modals
+
+- Fix for IE8 in getAbsoluteIndex method. IE8 seems to work as other browsers
+
+- Fixed bug in delRowData - the grid does not resize when first row is
+deleted.
+
+- Fixed bug when rownumbers and subgrid are used together
+
+- Fixed bug in row editing when the column name contain dot.
+
+- Fixing bug in viewGridRow - also the id manes of the form are changed in order
+to be not equal of those in editGridRow
+
+
+
+3.5 beta (buld5)
+
+FormEditing
+===========
+- added options checkOnUpdate (default false) in editGridRow method.
+Also available in add and edit mode.
+When this option is set to true the behaviour as follow:
+When something is changed in the form and the user click on
+Cancel button, navigator buttons, close button (on upper right corner of the
+form), in overlay (if available) or press Esc key (if set) a message box apper
+asking the user to save the changes, not to save the changes and go back in the
+form or cancel all changes (this will close the modal form)
+Note that checkOnSubmit option will work only when a submit button is clicked.
+When nothing is changed we contionue with the action.
+
+- added option - rowabove (default false) in colModel formoptions
+When set to true a new empty row is added above this row in form editing.
+- added option - rowcontent (default empty) in colModel formoptions.
+This option have sense only when rowabove option is set to true.
+With this option is possible to set a content to the new added empty row in
+the form. In order to style easy these rows a class 'contentinfo' is set.
+
+- added new items in the language files to support the checkOnUpdate option
+
+- added class 'delmsg' in the delGridRow method. This allow us to change the
+message dynamically using a beforeShow or afterSow eventrs. The class is added
+to a element td.
+
+Fixes
+=====
+- fix in Bulgarian translations files.
+- fix in searchGrid method. Now we search by index (from colModel) and only if
+it is not available we search by name.
+- Fix for date parser in the base module. Now we can sort locally on
+dates that contain month names
+- Fixed bug in searchGrid. The translation messages for the operations does not
+apper when not set in colModel
+- removed some not needed events from base grid. Also return false do these
+by default;
+- Fix bug to check if datepicker is available in searchGrid.
+- Fix a bug in searchGrid in IE6, where the data value is not set for elements
+after the first
+- Fixed bug when calling of jqModal multiple times on the same element. We
+need the initialization only once and not every time. This cause a memory
+leaks
+- Fixed bug in formatter where the data containing ' causes break in IE
+- Fixed bug in base module when adding data where the data contain a ' char.
+This breaks in IE browsers.
+- Fixed bug in checkboxes. We add the value setted in the editoptions. Also
+converting to lower case make the option checkOnUpdate to be true every time.
+- We replace white-space nowrap with pre in td element in the CSS file. This fixes
+the bug in IE where the first row does not wrap when the text is longer than
+the column width. Also this requiere DOCTYPE declaration in the document.
+- Fixed bug in viewGridRow method where when resizing the modal causes the data
+to apper bad.
+
+
+3.5 beta (buld4)
+Base
+====
+- added option footerrow - default false. If set to true this will place a
+footer table with one row below the gird records and above the pager.
+The number of columns equal of these from colModel
+
+-added option userDataOnFooter(default false) which directly place the user data
+array at footer. The rules are as follow: If the userData array contain name
+which is equal to those of colModel then the value is placed in that column.
+If there are no such values nothing is palced. Note that if this option
+is used we use the current formatter options (if available) for that column.
+
+-Added method getCol(colname). Colname can be either number which represents
+the index of the column or name from colModel. The method return array with
+the values of the coulmn.
+
+- Added method footerData ( action, data, format). This method get or set data
+on footer.
+
+action - can be 'get' or 'set'. If not set default is get.
+When set to 'get' - the result is object of type name:value, where the name is
+a name from colModel. This will return a data from the footer. The other two
+options does not have effect in this case.
+
+When set to 'set' a data array (object) should be set. This will place
+the values in the footer.
+
+format - default is true. This instruct the method to use the formmater
+(if set in colModel) when a new values are set.
+Setting to false will disable the using of formatter.
+
+Related css items in the ui.jqgrid.css
+.ui-jqgrid-sdiv - is a div container for the footer
+.ui-jqgrid-ftable - is the class for the table
+tr.footrow - is the class for the footer row
+tr.footrow td is the item for the cell formating
+
+In order to format every cell in a way that you want
+maybe you can use
+
+jQuery("tr.footrow td:eq(2)","#gbox_mygrid").css(...)
+where the td:eq(2) point to the third column
+and mygrid is the id of the grid. The id of the global grid container
+is constructed via "gbox_"+the id of the grid.
+
+There are no methods to show and hide the footer row dynamically, but
+following the above example we can do
+
+jQuery(".ui-jqgrid-sdiv","#gbox_mygrid").hide() - this will hide the footer row.
+
+jQuery(".ui-jqgrid-sdiv","#gbox_mygrid").show() - this will show the footer row.
+
+
+Form Editing
+============
+aded option in editGridRow - checkOnSubmit (default false)
+This option only work in editing mode and not in add.
+When set to true - the method looks if any data is changed in the form and
+if this is a case a dilog message appear where the user is asked to confirm the
+changes or cancel it. Pressing cancel will return to the form, but does not
+set the values to its original state.
+
+Note that this causes a some changes in the language file.
+
+Fixes
+=====
+
+- Removed imgpath from cell edit and inline edit modules and common module.
+This parameter is no longer valid in 3.5
+- Replace $ with jQuery in grid.common.js which causes problems when used with
+other librariers like prototype.
+- removed a checking e.srcElement from base module. jQuery allready fix this.
+- fixing the size option in select when using ajax to load selects.
+- Fixed bug in IE browsers, when clicked on href tag with child nodes,
+IE incorrect report in all cases that this is a href element. This couses
+onSelectCell not to behave correct.
+- Fixed bug in searchGrid - group options are not passed to serchFilter in
+order get them from Language file.
+- Fix in bulgarian trnslations.
+- Fix on sorting column. The initial sort check first for index and then for
+column name. Before the checking for the index was missed.
+Sortorder converted to lower case in order to avoid some cofusions.
+- Fix in set columns module. The modal does not appear correctly due to
+missed parameter
+
+
+
+3.5 beta (buld3)
+
+Base
+====
+- To the loading message is added ui-state-active class from Theme roller.
+This is more natural, indicating that the grid is active when data is loaded.
+
+Form Editing
+============
+- Added keyboard navigation, which allow us to navigate throught the records while
+in form editing pressing certain keys. This option is available in editGridRow
+and viewGridRow methods. The default state is disabled. To enable this you
+should set the options in the edit/add parameters:
+
+navkeys: [true,38,40]
+The first item enables the navigation.
+The second item corresponds to reccord up and by default is the the key code
+for Up key
+The third item corresponds to reccord down and by default is the key code for
+Down key
+Example
+$("#mygrid").navGrid("#pager",{options},{id:'myeditid',navkeys: [true,38,40]}..)
+Also this option does not work in add mode.
+
+Note: Instead that this does not have sense, if you plan to navigate with keys
+it is recommended to add this option in add mode. This should be done
+because the form for add and edit is the same and it is unknown which action
+will be lunched first.
+
+- Added posibility to save the form pressing certain key - add/edit mode only
+By default this option is disabled.
+To enable
+savekey: [true,13]
+The first item enables saving with pressing certain key.
+The second item corresponds to key code for saving. Default Enter (key code 13)
+
+Note that this binding should be used for both adding and editing a row.
+Since the binding is for the form, there is no possibility to have one
+key in add and another in edit mode.
+
+- Added icons for the buttons in the form. The corresponding class in the css
+is "fm-button"
+By default all icons are enabled.
+For add/edit method editGridRow
+The save button is defined with
+saveicon : [true,"left","ui-icon-disk"]
+The close button is defined with
+closeicon: [true,"left","ui-icon-close"]
+
+The first item enables the icon
+The second item tells where to pu icon left or right
+The third item corresponds to valid ui icon from theme roller
+
+For viewGrid Row
+closeicon : [true,"left","ui-icon-close"]
+
+For Deleting
+delicon: [true,"left","ui-icon-scissors"]
+cancelicon: [true,"left","ui-icon-cancel"]
+
+Fixes
+======
+-Fixed bug when getting the index of the row. Strict compare should be removed.
+-Fixed bug when datatype is function - we need to exit when call it and not to
+continue.
+-Fixed bug in form editing - the buttons do not align properly.
+
+3.5 beta (build2)
+
+Navigator
+=========
+This was missed in the first build
+In the navGrid we can pass uniquie id's of the buttons in order to manipulate
+them easy. If no id is set we create one which is combination of:
+for add button "add_"+ the id of the grid
+for edit button "edit_"+ the id of the grid
+for view button "view_" + the id of the grid
+for delete button "del_" + the id of the grid
+for search button "search_" + the id of the grid
+for refresh button "refresh_" + the id of the grid
+Example:
+$("#mygrid").navGrid("#pager",{options}, {id:'myeditid'},{id:'myaddid'}...)
+
+Base Grid
+=========
+- Record number information now can format the values according to the
+formatter setting (if available) getting information from language file.
+
+Fixes
+=====
+
+- Fixed bug when multi select with json. We pass wrong parameter to addMulti
+function
+- Spelling error in all language files, which cause not to set the default
+value correct
+- Fixed bug when creating warning message. Fixed bug when determining the
+number column element in the form
+- Fixed bug - clientSide datatype should be converted to lower case
+according to the new improvements
+- Fixed bug in IE6/7 when try to select a option in the select generated via
+ajax
+
+===============================
+Upgrade from 3.4.x to 3.5 beta.
+===============================
+
+
+1. Installation
+--------------
+See install.txt
+
+2. Code changes
+---------------
+2.1 The following grid options are deprecated - i.e. you can remove them from
+the grid options. They are not needed in 3.5 version
+
+imgpath
+sortascimg
+sortdescimg
+firstimg
+previmg
+nextimg
+lastimg
+sortclass
+resizeclass
+
+2.2 Second change is related to custom formatters. Starting with version 3.5,
+the custom formatter is passed the following parameters:
+
+formatter : function ( cellvalue, options, rowObject )
+{
+// format the cellvalue to new format
+return new_formated_cellvalue;
+}
+
+Note the return in the function. This function should always return a value
+in order to work correctly. The parameters are
+
+cellvalue - is the value to be formatted
+options - is an object containing the following element
+
+options : { rowId: rid, colModel: cm}
+where rid - is the id of the row
+colModel is the object of the properties for this column getted from colModel
+array of jqGrid
+
+rowObject - is a row data represented in the format determined from datatype
+option.
+If we have datatype: xml/xmlstring - the rowObject is xml node,provided
+according to the rules from xmlReader
+If we have datatype: json/jsonstring - the rowObject is array, provided
+according to the rules from jsonReader
+
+Example:
+Code in 3.4.x variant
+
+formatter : function ( elem, cellvalue, options)
+{
+var newval = "<strong>"+cellvalue+"</strong>";
+jQuery(elem).html(newval);
+}
+
+
+Code in 3.5
+
+formatter : function ( cellvalue, options, rowObject )
+{
+return "<strong>"+cellvalue+"</strong>";
+}
+
+
+Base Module
+============
+Bug fixes
+---------
+- fixed bug in onCellSelect event when used in IE browsers - now the rowIndex
+passed to this event is calculated correctly regardless of hidden columns.
+
+- fixed width bug when multiselect is used. Previously the width of this column
+is recalculated according to table width and when shrinkToFit is set to true.
+Now the column has fixed width and is no longer recalculated when the grid
+width is changed. See documentation for the new options
+
+- fixed width bug when subgrid is used. Previously the width of this column is
+recalculated according to table width and when shrinkToFit is set to true. Now
+the column has fixed width and is no longer recalculated when the grid width
+is changed. See documentation for the new options
+
+- fixed bug in addRowData method when the grid is empty and we try to add one
+or more columns. The width of the data was not being recalculated correctly,
+according to the header elements.
+
+- fixed bug when we use xmlstring and jsonstring to add data. Previously all
+the data from the string is loaded without reference to the rowNum parameter.
+Also this behaviour is changed for xml and json data. In other words, we now
+load only rowNum number of rows even when the request consists of more rows.
+
+- fixed bug when posting values of input of type select set to multiple:true.
+Now in all editing modules the posted values in for multiselect are separated
+with comma
+
+- fixed bug in the size option of multi select. If the size option is not set
+for multiselect the default value is 3
+
+Deprecated options
+----------------
+imgpath: "", in all modules
+sortascimg: "sort_asc.gif",
+sortdescimg: "sort_desc.gif",
+firstimg: "first.gif",
+previmg: "prev.gif",
+nextimg: "next.gif",
+lastimg: "last.gif",
+sortclass: "grid_sort",
+resizeclass: "grid_resize",
+
+Note that imgpath is not used anymore in all modules.
+The altRows option is still here, but will have no effect until the jQuery
+UI Theme roller supports alternative rows.
+
+
+Note that the table element where we define the grid can not have a class
+scroll - i.e. class scroll in the table definition can be omitted, but this
+is NOT true for the pager element.
+
+New options
+-----------
+datatype can now set as 'script'. In other words, we now support script
+as datatype.
+
+reccount: numeric, Default 0. Determines the exact number of available
+grid rows. Can be <= from rowNum parameter
+
+autowidth: boolean, Default false. When set to true, the grid width is
+recalculated automatically to the width of the parent element. This is done
+only initially when the grid is created. In order to resize the grid when
+the parent element changes width you should apply custom code and use a
+setGridWidth method for this purpose.
+
+scrollOffset: numeric, Default 18. Determines the width of the vertical
+scrollbar. Since different browsers interpret this width differently (and it
+is difficult to calculate it in all browsers) this can be changed.
+
+cellLayout: numeric, Default 5. This option determines the padding + border
+width of the cell. Usually this should not be changed, but if custom changes
+to td element are made in the grid css file this will need to be changed.
+
+subGridWidth: numeric, Default 20. Determines the width of the subgrid column
+if the subGrid option is set to true.
+
+multiselectWidth: numeric, Default 20. Determines the width of the multiselect
+column if multiselect is set to true.
+
+rownumbers: boolean, Default false. If this option is set to true, a new column
+at left of the grid is added. The purpose of this column is to count the number
+of available rows, beginning from 1. In this case colModel is extended
+automatically with new element with name - 'rn'. Also, be careful not to use
+the name 'rn' in colModel
+
+rownumWidth: numeric, Default 25. Determines the width of the row number column
+if rownumbers option is set to true.
+
+pagerpos: string, Default 'center'. Determines the position of the pager in the
+grid. By default the pager element when created is divided in 3 parts (one part
+for pager, one part for navigator buttons and one part for record information)
+
+recordpos: string, Default 'right'. Determines the position of the record
+information in the pager.
+
+toolbar now accepts another option: "both". When we set toolbar: [true,"both"]
+two toolbars are created -- one on the top of table data and one of the bottom
+of the table data. When we have two toolbars then we create two elements (div).
+The id of the top bar is constructed like "t_"+id of the grid and the bottom
+toolbar the id is "tb_"+id of the grid. In case when only one toolbar is
+created we have the id as "t_" + id of the grid, independent of where this
+toolbar is created (top or bottom)
+
+gridview: boolean, Default value false. In the previous versions of jqGrid,
+including 3.5 alfa, reading a relatively big data sets (Rows >=100 ) caused
+speed problems. The reason for this was that as every cell was inserted into
+the grid we applied about 5-6 jQuery calls to it. Now this problem is resolved;
+we now insert the entry row at once with a jQuery append. The result is
+impressive - about 3-5 times faster. What will be the result if we insert all
+the data at once? Yes, this can be done with a help of gridview option when set
+to true. The result is a grid that is 5 to 10 times faster. Of course when this
+option is set to true we have some limitations. If set to true we can not use
+- treeGrid
+- subGrid, or
+- afterInsertRow event.
+If you do not use these three options in the grid you can set this option to
+true and enjoy the speed.
+
+addRowData now is 1-2 times faster because we are using the concept to insert
+the row at once
+
+Added jQuery function parse (removed from json2.js module):
+jQuery.parse(jsonstring)
+To prevent JavaScript hijacking attacks, web application authors are encouraged
+to use this function. This returns a JSON representation of the variable.
+
+Cyclic structures are detected and safely interrupted, but could not be further
+restored.
+1. The while(1); construct, located at the beginning of JSON text,
+2. Comments at the beginning and end of the text.
+JSON data providers are encouraged to use one or both of these methods to
+prevent data execution. Such JSON response may then look like this:
+while(1);/*{[
+ {"name":"safe value 1"},
+ {"name":"safe value 2"},
+ ...
+]}*/
+jqGrid uses this function when obtaining a data with datatype:'json', also used
+in subGrid.
+
+Added jQuery function stringToDoc: jQuery.stringToDoc(xmlstring). This returns
+the xml document of xml string
+
+Added new method: jQuery("#mygrid").updateColumns(); this synchronizes the
+width of the headers with the data. Useful when used with table drag and drop.
+
+
+colModel changes and additions
+------------------------------
+searchhidden is removed from editrules object
+
+added searchoptions object to define properties, events and other settings when
+a search is performed
+searchoptions : {
+ dataUrl : value,
+ dataInit: function,
+ dataEvents : array,
+ defaultValue: value,
+ attr: object,
+ searchhidden: boolean,
+ sopt: array
+}
+To summarize - when we want to deal with search we should use the following
+options in colModel
+
+search : boolean , // true/false
+stype: value, // text/select
+searchoptions : object // see above
+
+Note: when the dataUrl is not used for the search type select, the definitions
+for the select are taken from editoptions value property - i.e
+editoptions:{value:"1:one;2:two",...}. See below for how to use these options in
+different search methods.
+
+
+Added new object formoptions to define various settings in form editing. Also
+valid only in this module.
+
+formoptions : {
+ elmprefix:value,
+ elmsuffix:value,
+ rowpos: number,
+ colpos:number,
+ label: value
+}
+See below for how to use
+
+The editoptions are extended with the following properties. Valid in all editing
+modules editoptions : {
+ dataUrl : value, dataInit: function, dataEvents : array, defaultValue:
+ value/function,
+} See below
+
+
+Changes in all editing modules
+==============================
+
+edittype property is extended with the support of the following input elements:
+button, image and file
+
+As described above in all editing modules we can add additional properties and
+events to the editing element:
+
+editoptions : {
+ dataUrl : value, dataInit: function, dataEvents : array, defaultValue:
+ value/function
+}
+-------------------------------------------------------------------------------
+dataUrl option is valid only for the elements of type select - i.e.,
+edittype:select
+
+When this option is set, the element will be filled with values from the ajax
+request. The data should be a valid html select element with the desired
+options. <select>
+ <option value="1">One</option> <option value="2">Two</option>
+</select>
+
+In form editing for add/edit this is called only once. In order to call it every
+time the form is launched you should set the option recreateForm:true or use
+other events like beforeShowForm (with another custom ajax call) to fill the
+desired element.
+
+In inline edit and cell edit this is fired every time you edit the row or cell
+element.
+--------------------------------------------------------------------------------
+dataInit : function (elem) {
+// do something
+}
+
+If set, this function is called only once ? when the element is created. The
+function is passed the specified element. This option is ideal for attaching
+date picker, time picker, etc. Example:
+
+dataInit : function (elem) {
+ $(elem).datepicker();
+}
+--------------------------------------------------------------------------------
+dataEvents: list of events to apply to the data element; uses
+$("#id").bind(type, [data], fn) to bind events to data element
+
+Should be described like this dataEvents: [
+ { type: 'click', data: { i: 7 }, fn: function(e) { console.log(e.data.i); }
+ }, { type: 'keypress', fn: function(e) { console.log('keypress'); } }
+]
+
+The event(s) are called only once when the element is created
+-------------------------------------------------------------------------------
+defaultValue: 'value' or function This option is valid only in Form Editing
+module when used with editGridRow method in add mode.If set this the input
+element is set with this value if only element is empty. If used in selects the
+text should be provided and not the key. Also when a function is used the
+function should return value.
+
+Now we can validate a url. The corresponding settings is in colModel
+editrules:{required:true, url:true}
+
+
+FormEditing
+===========
+In all methods that deal with the modals are added the following options (thanks
+to Faserline Team: www.faserline.com)
+
+jqModal: true. The default value is true. How it works. If set to true, first
+jqGrid checks if the jqModal plugin is available. If this plugin is available we
+create the modal according to the jqModal plugin. If this plugin is not
+available jqGrid create its own modal. The difference between the jqModal window
+and jqGrid modal window is that the overlay covers only the grid, but not the
+entry page as jqModal does. If this option is set to false, jqGrid will create
+its own modal as described above even if jqModal is available.
+
+The only exception here is searchGrid method created with the new searchFilter
+plugin, where this option is not available. In this method a jqGrid modal window
+is used.
+
+closeOnEscape : false. Default false. When set to true the modal window can be
+closed with ESC key.
+
+
+
+=======searchGrid==================
+From now on jqGrid use a new search engine
+thanks to wonderful plugin provided from Kasey Speakman (kasey@xxxxxxxxxxxxxxx).
+This plugin can also be used separately. Detailed documentation is provided in
+the jquery.searchFilter.js which is provided with jqGrid package.
+
+These options are not used anymore in the searchGrid method
+----------------------------------------------------------
+top : 0,
+left: 0,
+width: 360,
+height: 80,
+modal: false,
+closeicon: 'ico-close.gif',
+dirty: false,
+processData: "",
+
+Added the following options
+---------------------------
+
+recreateFilter: false, This option construct the filter every time a search
+button is clicked.
+
+multipleSearch : false, When set to false the behaviour of the search is the
+same as those in versions before 3.5 When set to true: 1. We have a possibility
+to add/delete as many conditions as we want 2. The posted data to the server is
+string (actually a json array converted to string)
+
+sFilter: 'filters', This option has an effect only when the multipleSearch is
+set to true; it describes the name of the posted string. By default this, i.e.
+the posted data, can look like this
+
+filters ={
+ "groupOp":"AND","rules":[{"field":"id","op":"gt","data":"1"},
+{"field":"name","op":"bw","data":"Client"}]
+}
+
+groupOp determines the logical operator that can be used in the where statement
+of the select. The value can be AND or OR. This can be changed used a select box
+which is created at bottom of the search filter.
+
+The rules array describes actually which fields and how they are included in the
+where clause The field element describes the name of the field The op element
+describes the operator that should be used in the search The data element is the
+data that we want to search.
+
+The above example (if getted and constructed correctly) should generate the
+following where clause
+
+SELECT .... FROM table,... WHERE id > 1 AND name LIKE 'Client%'
+-------------------------------------------------------------------------------
+As described above the search is constructed according to the searchoptions in
+colModel
+
+search : boolean , // true/false stype: value, // text/select
+
+searchoptions : {
+ dataUrl : value,
+ dataInit: function,
+ dataEvents : array,
+ attr: object,
+ searchhidden: boolean,
+ sopt: array
+}
+Note that here is missing the defaultValue. The option is not implemented in
+this method.
+
+
+stype determines the search type - can be select or text. If not set a text is
+used
+
+searchoptions
+-------------------------------------------------------------------------------
+dataUrl option is valid only for the elements of type select, i.e.
+edittype:select
+
+When this option is set the element will be filled with values from the ajax
+request. The data should be a valid html select element with the desired
+options. <select>
+ <option value="1">One</option> <option value="2">Two</option>
+</select>
+
+This is called only once.
+
+-------------------------------------------------------------------------------
+dataInit : function (elem) {
+// do something
+}
+
+If set this function is called only once when the element is created. To the
+function is passed the element. Also this option is ideal for attaching date
+picker, time picker and etc. Example
+
+dataInit : function (elem) {
+ $(elem).datepicker();
+}
+--------------------------------------------------------------------------------
+dataEvents: list of events to apply to the data element; uses
+$("#id").bind(type, [data], fn) to bind events to data element
+
+Should be described like this
+dataEvents: [
+{ type: 'click', data: { i: 7 }, fn: function(e) { console.log(e.data.i); }},
+{ type: 'keypress', fn: function(e) { console.log('keypress'); } }
+]
+
+The event(s) are called only once when the element is created
+--------------------------------------------------------------------------------
+attr is object where we can set valid attributes to the created element
+
+attr : { title: "Some title" }
+------------------------------------------------------------------------------
+searchhidden : if set to true, the hidden element will appear in the search.
+-------------------------------------------------------------------------------
+array that correspond to the op element in the posted data and determines the
+operation. If not set all the available options will be used; if set only the
+set values will appear as selectboxes.
+
+All available option are sopt:
+['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
+
+The corresponding texts are in language file and mean the following ['equal',
+'not equal', 'less', 'less or equal','greater','greater or equal', 'begins
+with','does not begin with','is in','is not in','ends with','does not end
+with','contains','does not contain'],
+
+Note that the elements in sopt array can be mixed in any order.
+
+
+=========add/edit form==========
+In the editGridRow method the following options are no longer used
+
+closeicon: 'ico-close.gif',
+imgpath: ''
+
+Added new property formoptions (in colModel); thanks to Faserline Team
+(www.faserline.com)
+
+The purpose of these options is to reorder the elements in the form and to add
+some information before and after the editing element.
+
+formoptions : {
+ elmprefix:'',
+ elmsuffix:'',
+ rowpos:number,
+ colpos:number,
+ label: value
+}
+
+If you go to use this object in collModel it is recommended that all editing
+fields use this property and with at least the rowpos and colpos set.
+
+Elemprefix: if set, a text or html content appears before the input element
+
+Elemsuffix: if set, a text or html content appears after the input element
+
+Label: if set, this replace the name from colNames array that appears as label
+in the form.
+
+rowpos : number determines the row position of the element (again with the
+text-label) in the form; the count begins from 1
+
+colpos : number determines the column position of the element (again with the
+label) in the form beginning from 1
+
+Two elements can have equal row position, but different column position. This
+will place the two elements in one row on the form.
+
+=========== delete=================================
+In the delGridRow method the following options are no longer used
+
+closeicon: 'ico-close.gif',
+imgpath: '',
+
+
+
+============= view =============================
+Added viewGridRow method; thanks to Faserline Team (www.faserline.com)
+
+This method is similar to the editGridRow method except that the fields are not
+editable and we do not have any events attached to the form. Here are the
+options viewGridRow (options) where
+options = {
+ top : 0,
+ left: 0,
+ width: 0,
+ height: 0,
+ modal: false,
+ drag: true,
+ closeOnEscape : false,
+ labelswidth: '30%'
+}
+
+
+All the options have the same thing as these in editGridRow except the option
+labelswidth which default value is 30%. Since we construct the view with table
+element it is difficult to calculate, in this case, how much width is needed for
+the labels. Depending on the needs this value can be increased or decreased
+
+Custom method
+=============
+In the custom module is added new method filterToolbar.
+
+This method is the same as filterGrid, except that the search input elements are
+placed in the grid just below the header elements. When the header elements are
+resized the input search elements are also resized according to the new width.
+Another difference to the filterGrid is that the filter toolbar uses definitions
+from colModel just like the searchGrid
+
+Should be called like this
+
+jQuery("#mygrid").filterToolbar(options)
+
+where options are
+
+options = {
+ autosearch: true,
+ beforeSearch: null,
+ afterSearch: null,
+ beforeClear: null,
+ afterClear: null,
+ searchurl : ''
+}
+
+autosearch: true Search is performed according to the following rules For text
+element when a Enter key is pressed while inputting values a search is
+performed. For select element when the value changes.
+
+beforeSearch - event which fires before a search
+
+afterSearch - event which fires after a search
+
+beforeClear - event which fires before clearing entered values (i.e.,
+clearToolbar is activated)
+
+afterClear - event which fires after clearing entered values (i.e., clearToolbar
+is activated)
+
+The rules of creating toolbar search input elements are the same as searchGrid
+using the colModel
+searchoptions : {
+ dataUrl : value,
+ dataInit: function,
+ dataEvents : array,
+ defaultValue: value,
+ attr: object
+}
+
+Note the missing sopt element, but addition of defaultValue property
+
+This method has 3 new additional methods that can be used:
+
+triggerToolbar - when called perform a search dynamically
+
+clearToolbar - when called clear the search values and set the default one if
+available
+
+toggleToolbar - toggles the searchbar
+
+A typical call to these methods
+
+var sgrid = $("#mygrid")[0] sgrid.triggerToolbar();
+
+will trigger the search of mygrid.
+
+
+Import module
+=============
+added option importComplete event which fires after constructing the grid.
+
+
+Inline edit
+===========
+added afterrestorefunc as 9th parameter. The event fires after the row is
+restored
+
+treeGrid
+========
+the tree icons can be changed using the following grid parameter treeIcons. The
+default values are.
+treeIcons ={
+ plus:'ui-icon-triangle-1-e',
+ minus:'ui-icon-triangle-1-s',
+ leaf:'ui-icon-radio-off'
+};
+Note that icons from UI Theme should be used.
+
+formatter
+=========
+
+- the source format for date formatter (srcformat) now can accept month names
+- it is possible to enable checkboxes as editable when created with formatter In
+ the format options we should in this case checkbox : {disabled:false} The
+ default is false. To enable this option globally you can change this value in
+ the language file
+
+- the showLink now can accept custom name for the id The parameter is idName :
+ 'id' The default is id. Can be changed in formatoptions or in the language
+ file.
+
=== added file 'addons/base/static/jquery.jqGrid/build.properties'
--- addons/base/static/jquery.jqGrid/build.properties 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/build.properties 2011-03-28 09:08:30 +0000
@@ -0,0 +1,8 @@
+# Path for the Google Compiler jar file. By default in the same directory as this properties file.
+GoogleCompiler = compiler.jar
+
+srcdir = js
+distdir = dist
+
+target = jquery.jqGrid.js
+target.min = jquery.jqGrid.min.js
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/build.xml'
--- addons/base/static/jquery.jqGrid/build.xml 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/build.xml 2011-03-28 09:08:30 +0000
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<project name="jqGrid" default="build" basedir=".">
+
+ <!-- define the path of compressor in this file -->
+ <property file="build.properties" />
+
+ <target name="init">
+ <mkdir dir="${distdir}" />
+ </target>
+
+ <target name="jqgrid" depends="init">
+ <concat destfile="${distdir}/${target}">
+ <fileset file="js/grid.base.js"/>
+ <fileset file="js/grid.custom.js"/>
+ <fileset file="js/jqModal.js"/>
+ <fileset file="js/jqDnR.js"/>
+ <fileset file="js/JsonXml.js"/>
+ <fileset file="js/jquery.fmatter.js"/>
+ <fileset file="js/grid.common.js"/>
+ <fileset file="js/grid.filter.js"/>
+ <fileset file="js/grid.formedit.js"/>
+ <fileset file="js/grid.inlinedit.js"/>
+ <fileset file="js/grid.celledit.js"/>
+ <fileset file="js/grid.subgrid.js"/>
+ <fileset file="js/grid.treegrid.js"/>
+ <fileset file="js/grid.grouping.js"/>
+ <fileset file="js/grid.import.js"/>
+ <fileset file="js/grid.jqueryui.js"/>
+ <fileset file="js/grid.tbltogrid.js"/>
+ </concat>
+ </target>
+
+ <target name="jqgrid.min" depends="jqgrid">
+ <apply executable="java" parallel="false" verbose="true" failonerror="true" dest="${distdir}">
+ <fileset dir="${distdir}">
+ <include name="${target}" />
+ </fileset>
+ <arg line="-jar" />
+ <arg path="${GoogleCompiler}" />
+ <arg value="--warning_level" />
+ <arg value="QUIET" />
+ <arg value="--js_output_file" />
+ <targetfile />
+ <arg value="--js" />
+ <mapper type="glob" from="${target}" to="${target.min}" />
+ </apply>
+ <echo message="${target.min} built." />
+ </target>
+
+ <target name="i18n">
+ <mkdir dir="${distdir}/i18n" />
+ <copy todir="${distdir}/i18n" overwrite="true">
+ <fileset dir="${srcdir}/i18n">
+ <include name="grid.locale-*.js" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="build" depends="jqgrid, jqgrid.min, i18n"/>
+
+ <target name="clean">
+ <delete dir="${distdir}" />
+ </target>
+
+ <target name="all" depends="clean,build"/>
+
+</project>
=== added directory 'addons/base/static/jquery.jqGrid/css'
=== added file 'addons/base/static/jquery.jqGrid/css/ellipsis-xbl.xml'
--- addons/base/static/jquery.jqGrid/css/ellipsis-xbl.xml 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/css/ellipsis-xbl.xml 2011-03-28 09:08:30 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<bindings
+ xmlns="http://www.mozilla.org/xbl"
+ xmlns:xbl="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <binding id="ellipsis">
+ <content>
+ <xul:window><!-- xul:window tag required for FF2 -->
+ <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
+ </xul:window>
+ </content>
+ </binding>
+</bindings>
=== added file 'addons/base/static/jquery.jqGrid/css/ui.jqgrid.css'
--- addons/base/static/jquery.jqGrid/css/ui.jqgrid.css 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/css/ui.jqgrid.css 2011-03-28 09:08:30 +0000
@@ -0,0 +1,139 @@
+/*Grid*/
+.ui-jqgrid {position: relative; font-size:11px;}
+.ui-jqgrid .ui-jqgrid-view {position: relative;left:0px; top: 0px; padding: .0em;}
+/* caption*/
+.ui-jqgrid .ui-jqgrid-titlebar {padding: .3em .2em .2em .3em; position: relative; border-left: 0px none;border-right: 0px none; border-top: 0px none;}
+.ui-jqgrid .ui-jqgrid-title { float: left; margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-titlebar-close { position: absolute;top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height:18px;}.ui-jqgrid .ui-jqgrid-titlebar-close span { display: block; margin: 1px; }
+.ui-jqgrid .ui-jqgrid-titlebar-close:hover { padding: 0; }
+/* header*/
+.ui-jqgrid .ui-jqgrid-hdiv {position: relative; margin: 0em;padding: 0em; overflow-x: hidden; overflow-y: auto; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-hbox {float: left; padding-right: 20px;}
+.ui-jqgrid .ui-jqgrid-htable {table-layout:fixed;margin:0em;}
+.ui-jqgrid .ui-jqgrid-htable th {height:22px;padding: 0 2px 0 2px;}
+.ui-jqgrid .ui-jqgrid-htable th div {overflow: hidden; position:relative; height:17px;}
+.ui-th-column, .ui-jqgrid .ui-jqgrid-htable th.ui-th-column {overflow: hidden;white-space: nowrap;text-align:center;border-top : 0px none;border-bottom : 0px none;}
+.ui-th-ltr, .ui-jqgrid .ui-jqgrid-htable th.ui-th-ltr {border-left : 0px none;}
+.ui-th-rtl, .ui-jqgrid .ui-jqgrid-htable th.ui-th-rtl {border-right : 0px none;}
+.ui-jqgrid .ui-th-div-ie {white-space: nowrap; zoom :1; height:17px;}
+.ui-jqgrid .ui-jqgrid-resize {height:20px !important;position: relative; cursor :e-resize;display: inline;overflow: hidden;}
+.ui-jqgrid .ui-grid-ico-sort {overflow:hidden;position:absolute;display:inline; cursor: pointer !important;}
+.ui-jqgrid .ui-icon-asc {margin-top:-3px; height:12px;}
+.ui-jqgrid .ui-icon-desc {margin-top:3px;height:12px;}
+.ui-jqgrid .ui-i-asc {margin-top:0px;height:16px;}
+.ui-jqgrid .ui-i-desc {margin-top:0px;margin-left:13px;height:16px;}
+.ui-jqgrid .ui-jqgrid-sortable {cursor:pointer;}
+.ui-jqgrid tr.ui-search-toolbar th { border-top-width: 1px !important; border-top-color: inherit !important; border-top-style: ridge !important }
+tr.ui-search-toolbar input {margin: 1px 0px 0px 0px}
+tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
+/* body */
+.ui-jqgrid .ui-jqgrid-bdiv {position: relative; margin: 0em; padding:0; overflow: auto; text-align:left;}
+.ui-jqgrid .ui-jqgrid-btable {table-layout:fixed; margin:0em;}
+.ui-jqgrid tr.jqgrow td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqgfirstrow td {padding: 0 2px 0 2px;border-right-width: 1px; border-right-style: solid;}
+.ui-jqgrid tr.jqgroup td {font-weight: normal; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.jqfoot td {font-weight: bold; overflow: hidden; white-space: pre; height: 22px;padding: 0 2px 0 2px;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid tr.ui-row-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.ui-row-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+.ui-jqgrid td.jqgrid-rownum { padding: 0 2px 0 2px; margin: 0px; border: 0px none;}
+.ui-jqgrid .ui-jqgrid-resize-mark { width:2px; left:0; background-color:#777; cursor: e-resize; cursor: col-resize; position:absolute; top:0; height:100px; overflow:hidden; display:none; border:0 none;}
+/* footer */
+.ui-jqgrid .ui-jqgrid-sdiv {position: relative; margin: 0em;padding: 0em; overflow: hidden; border-left: 0px none !important; border-top : 0px none !important; border-right : 0px none !important;}
+.ui-jqgrid .ui-jqgrid-ftable {table-layout:fixed; margin-bottom:0em;}
+.ui-jqgrid tr.footrow td {font-weight: bold; overflow: hidden; white-space:nowrap; height: 21px;padding: 0 2px 0 2px;border-top-width: 1px; border-top-color: inherit; border-top-style: solid;}
+.ui-jqgrid tr.footrow-ltr td {text-align:left;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;}
+.ui-jqgrid tr.footrow-rtl td {text-align:right;border-left-width: 1px; border-left-color: inherit; border-left-style: solid;}
+/* Pager*/
+.ui-jqgrid .ui-jqgrid-pager { border-left: 0px none !important;border-right: 0px none !important; border-bottom: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .ui-pager-control {position: relative;}
+.ui-jqgrid .ui-pg-table {position: relative; padding-bottom:2px; width:auto; margin: 0em;}
+.ui-jqgrid .ui-pg-table td {font-weight:normal; vertical-align:middle; padding:1px;}
+.ui-jqgrid .ui-pg-button { height:19px !important;}
+.ui-jqgrid .ui-pg-button span { display: block; margin: 1px; float:left;}
+.ui-jqgrid .ui-pg-button:hover { padding: 0px; }
+.ui-jqgrid .ui-state-disabled:hover {padding:1px;}
+.ui-jqgrid .ui-pg-input { height:13px;font-size:.8em; margin: 0em;}
+.ui-jqgrid .ui-pg-selbox {font-size:.8em; line-height:18px; display:block; height:18px; margin: 0em;}
+.ui-jqgrid .ui-separator {height: 18px; border-left: 1px solid #ccc ; border-right: 1px solid #ccc ; margin: 1px; float: right;}
+.ui-jqgrid .ui-paging-info {font-weight: normal;height:19px; margin-top:3px;margin-right:4px;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div {padding:1px 0;float:left;list-style-image:none;list-style-position:outside;list-style-type:none;position:relative;}
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-button { cursor:pointer; }
+.ui-jqgrid .ui-jqgrid-pager .ui-pg-div span.ui-icon {float:left;margin:0 2px;}
+.ui-jqgrid td input, .ui-jqgrid td select .ui-jqgrid td textarea { margin: 0em;}
+.ui-jqgrid td textarea {width:auto;height:auto;}
+.ui-jqgrid .ui-jqgrid-toppager {border-left: 0px none !important;border-right: 0px none !important; border-top: 0px none !important; margin: 0px !important; padding: 0px !important; position: relative; height: 25px !important;white-space: nowrap;overflow: hidden;}
+/*subgrid*/
+.ui-jqgrid .ui-jqgrid-btable .ui-sgcollapsed span {display: block;}
+.ui-jqgrid .ui-subgrid {margin:0em;padding:0em; width:100%;}
+.ui-jqgrid .ui-subgrid table {table-layout: fixed;}
+.ui-jqgrid .ui-subgrid tr.ui-subtblcell td {height:18px;border-right-width: 1px; border-right-color: inherit; border-right-style: solid;border-bottom-width: 1px; border-bottom-color: inherit; border-bottom-style: solid;}
+.ui-jqgrid .ui-subgrid td.subgrid-data {border-top: 0px none !important;}
+.ui-jqgrid .ui-subgrid td.subgrid-cell {border-width: 0px 0px 1px 0px;}
+.ui-jqgrid .ui-th-subgrid {height:20px;}
+/* loading */
+.ui-jqgrid .loading {position: absolute; top: 45%;left: 45%;width: auto;z-index:101;padding: 6px; margin: 5px;text-align: center;font-weight: bold;display: none;border-width: 2px !important;}
+.ui-jqgrid .jqgrid-overlay {display:none;z-index:100;}
+* html .jqgrid-overlay {width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+* .jqgrid-overlay iframe {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+/* end loading div */
+/* toolbar */
+.ui-jqgrid .ui-userdata {border-left: 0px none; border-right: 0px none; height : 21px;overflow: hidden; }
+/*Modal Window */
+.ui-jqdialog { display: none; width: 300px; position: absolute; padding: .2em; font-size:11px; overflow:visible;}
+.ui-jqdialog .ui-jqdialog-titlebar { padding: .3em .2em; position: relative; }
+.ui-jqdialog .ui-jqdialog-title { margin: .1em 0 .2em; }
+.ui-jqdialog .ui-jqdialog-titlebar-close { position: absolute; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+
+.ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: 1px; }
+.ui-jqdialog .ui-jqdialog-titlebar-close:hover, .ui-jqdialog .ui-jqdialog-titlebar-close:focus { padding: 0; }
+.ui-jqdialog-content, .ui-jqdialog .ui-jqdialog-content { border: 0; padding: .3em .2em; background: none; height:auto;}
+.ui-jqdialog .ui-jqconfirm {padding: .4em 1em; border-width:3px;position:absolute;bottom:10px;right:10px;overflow:visible;display:none;height:80px;width:220px;text-align:center;}
+/* end Modal window*/
+/* Form edit */
+.ui-jqdialog-content .FormGrid {margin: 0px;}
+.ui-jqdialog-content .EditTable { width: 100%; margin-bottom:0em;}
+.ui-jqdialog-content .DelTable { width: 100%; margin-bottom:0em;}
+.EditTable td input, .EditTable td select, .EditTable td textarea {margin: 0em;}
+.EditTable td textarea { width:auto; height:auto;}
+.ui-jqdialog-content td.EditButton {text-align: right;border-top: 0px none;border-left: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content td.navButton {text-align: center; border-left: 0px none;border-top: 0px none;border-right: 0px none; padding-bottom:5px; padding-top:5px;}
+.ui-jqdialog-content input.FormElement {padding:.3em}
+.ui-jqdialog-content .data-line {padding-top:.1em;border: 0px none;}
+
+.ui-jqdialog-content .CaptionTD {text-align: left; vertical-align: middle;border: 0px none; padding: 2px;white-space: nowrap;}
+.ui-jqdialog-content .DataTD {padding: 2px; border: 0px none; vertical-align: top;}
+.ui-jqdialog-content .form-view-data {white-space:pre}
+.fm-button { display: inline-block; margin:0 4px 0 0; padding: .4em .5em; text-decoration:none !important; cursor:pointer; position: relative; text-align: center; zoom: 1; }
+.fm-button-icon-left { padding-left: 1.9em; }
+.fm-button-icon-right { padding-right: 1.9em; }
+.fm-button-icon-left .ui-icon { right: auto; left: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px; }
+.fm-button-icon-right .ui-icon { left: auto; right: .2em; margin-left: 0; position: absolute; top: 50%; margin-top: -8px;}
+#nData, #pData { float: left; margin:3px;padding: 0; width: 15px; }
+/* End Eorm edit */
+/*.ui-jqgrid .edit-cell {}*/
+.ui-jqgrid .selected-row, div.ui-jqgrid .selected-row td {font-style : normal;border-left: 0px none;}
+/* Tree Grid */
+.ui-jqgrid .tree-wrap {float: left; position: relative;height: 18px;white-space: nowrap;overflow: hidden;}
+.ui-jqgrid .tree-minus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
+.ui-jqgrid .tree-plus {position: absolute; height: 18px; width: 18px; overflow: hidden;}
+.ui-jqgrid .tree-leaf {position: absolute; height: 18px; width: 18px;overflow: hidden;}
+.ui-jqgrid .treeclick {cursor: pointer;}
+/* moda dialog */
+.jqmOverlay { background-color: #000; }
+* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;width: expression(this.parentNode.offsetWidth+'px');height: expression(this.parentNode.offsetHeight+'px');}
+.ui-jqgrid-dnd tr td {border-right-width: 1px; border-right-color: inherit; border-right-style: solid; height:20px}
+/* RTL Support */
+.ui-jqgrid .ui-jqgrid-title-rtl {float:right;margin: .1em 0 .2em; }
+.ui-jqgrid .ui-jqgrid-hbox-rtl {float: right; padding-left: 20px;}
+.ui-jqgrid .ui-jqgrid-resize-ltr {float: right;margin: -2px -2px -2px 0px;}
+.ui-jqgrid .ui-jqgrid-resize-rtl {float: left;margin: -2px 0px -1px -3px;}
+.ui-jqgrid .ui-sort-rtl {left:0px;}
+.ui-jqgrid .tree-wrap-ltr {float: left;}
+.ui-jqgrid .tree-wrap-rtl {float: right;}
+.ui-jqgrid .ui-ellipsis {text-overflow:ellipsis; -moz-binding:url('ellipsis-xbl.xml#ellipsis');}
+.ui-searchFilter { display: none; position: absolute; z-index: 770; overflow: visible;}
+.ui-searchFilter table {position:relative; margin:0em; width:auto}
+.ui-searchFilter table td {margin: 0em; padding: 1px;}
+.ui-searchFilter table td input, .ui-searchFilter table td select {margin: 0.1em;}
+.ui-searchFilter .ui-state-default { cursor: pointer; }
+.ui-searchFilter .divider hr {margin: 1px; }
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/install.txt'
--- addons/base/static/jquery.jqGrid/install.txt 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/install.txt 2011-03-28 09:08:30 +0000
@@ -0,0 +1,43 @@
+Installation
+
+Download the jqGrid package from the www.trirand/blog site section downloads.
+Note the new download manager where you can choose which modules you want to
+include in the download.
+
+In order to use jqGrid 3.5, first a UI theme css file should be loaded.
+Download the desired theme (or build a custom one) from jQueryUI site
+(www.jqueryui.com) and point in your link tag in head section the path to the
+theme css
+
+<link rel="stylesheet" type="text/css" media="screen" href="path_to_ui_css_file/jquery-ui-1.7.1.custom.css" />
+
+where the path_to_ui_css_file is a valid path to the ui theme file
+
+Extract the jqGrid package and copy the ui.jqgrid.css from css directory to
+your webserver directory. It is not necessary that the jqgrid css file is in
+the same directory as those of the jquery ui css.
+
+<link rel="stylesheet" type="text/css" media="screen" href="path_to_jqgrid_css_file/ui.jqgrid.css" />
+
+Starting with this version, jqGrid does not use a loader (which loads the
+needed files one by one), but all the needed code is contained in one file.
+The desired modules can be built using the jqGrid download manager from the
+site pointed above. In order to use this, first a language file should be
+loaded and then the jqgrid file.
+
+Copy the desired language file from js/i18n directory to your web server
+directory where you store the java script files. Every language file is
+named grid.locale-XX.js, where XX is a two-letter code for the language.
+Copy the jquery.jqGid.min.js file to the same or other valid directory in
+your web server
+
+Include both the files in script tags in the head section
+
+<script src="path_to_js_files/grid.locale-en.js" type="text/javascript"></script>
+<script src="path_to_js_files/jquery.jqGrid.min.js" type="text/javascript"></script>
+
+For debugging purposes, I have created a grid.loader.js which does the same
+loading of the files as in previous versions. The location of the file is in
+src directory of the package. In order to use this, the variable pathojsfiles
+should be adjusted to point to the appropriate folder - see 3.4.x docs.
+
=== added file 'addons/base/static/jquery.jqGrid/jquery.jqGrid.js'
--- addons/base/static/jquery.jqGrid/jquery.jqGrid.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/jquery.jqGrid.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,50 @@
+//This file should be used if you want to debug and develop
+function jqGridInclude()
+{
+ var pathtojsfiles = "/base/static/jquery.jqGrid/js/"; // need to be ajusted
+ // set include to false if you do not want some modules to be included
+ var modules = [
+ { include: true, incfile:'i18n/grid.locale-en.js'}, // jqGrid translation
+ { include: true, incfile:'grid.base.js'}, // jqGrid base
+ { include: true, incfile:'grid.common.js'}, // jqGrid common for editing
+ { include: true, incfile:'grid.formedit.js'}, // jqGrid Form editing
+ { include: true, incfile:'grid.inlinedit.js'}, // jqGrid inline editing
+ { include: true, incfile:'grid.celledit.js'}, // jqGrid cell editing
+ { include: true, incfile:'grid.subgrid.js'}, //jqGrid subgrid
+ { include: true, incfile:'grid.treegrid.js'}, //jqGrid treegrid
+ { include: true, incfile:'grid.grouping.js'}, //jqGrid grouping
+ { include: true, incfile:'grid.custom.js'}, //jqGrid custom
+ { include: true, incfile:'grid.tbltogrid.js'}, //jqGrid table to grid
+ { include: true, incfile:'grid.import.js'}, //jqGrid import
+ { include: true, incfile:'jquery.fmatter.js'}, //jqGrid formater
+ { include: true, incfile:'JsonXml.js'}, //xmljson utils
+ { include: true, incfile:'grid.jqueryui.js'}, //jQuery UI utils
+ { include: true, incfile:'grid.filter.js'} // filter Plugin
+ ];
+ var filename;
+ for(var i=0;i<modules.length; i++)
+ {
+ if(modules[i].include === true) {
+ filename = pathtojsfiles+modules[i].incfile;
+ if(jQuery.browser.safari) {
+ jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
+ } else {
+ if (jQuery.browser.msie) {
+ document.write('<script charset="utf-8" type="text/javascript" src="'+filename+'"></script>');
+ } else {
+ IncludeJavaScript(filename);
+ }
+ }
+ }
+ }
+ function IncludeJavaScript(jsFile)
+ {
+ var oHead = document.getElementsByTagName('head')[0];
+ var oScript = document.createElement('script');
+ oScript.setAttribute('type', 'text/javascript');
+ oScript.setAttribute('language', 'javascript');
+ oScript.setAttribute('src', jsFile);
+ oHead.appendChild(oScript);
+ }
+}
+jqGridInclude();
=== added directory 'addons/base/static/jquery.jqGrid/js'
=== added file 'addons/base/static/jquery.jqGrid/js/JsonXml.js'
--- addons/base/static/jquery.jqGrid/js/JsonXml.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/JsonXml.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,338 @@
+/*
+ The below work is licensed under Creative Commons GNU LGPL License.
+
+ Original work:
+
+ License: http://creativecommons.org/licenses/LGPL/2.1/
+ Author: Stefan Goessner/2006
+ Web: http://goessner.net/
+
+ Modifications made:
+
+ Version: 0.9-p5
+ Description: Restructured code, JSLint validated (no strict whitespaces),
+ added handling of empty arrays, empty strings, and int/floats values.
+ Author: Michael Schøler/2008-01-29
+ Web: http://michael.hinnerup.net/blog/2008/01/26/converting-json-to-xml-and-xml-to-json/
+
+ Description: json2xml added support to convert functions as CDATA
+ so it will be easy to write characters that cause some problems when convert
+ Author: Tony Tomov
+*/
+
+/*global alert */
+var xmlJsonClass = {
+ // Param "xml": Element or document DOM node.
+ // Param "tab": Tab or indent string for pretty output formatting omit or use empty string "" to supress.
+ // Returns: JSON string
+ xml2json: function(xml, tab) {
+ if (xml.nodeType === 9) {
+ // document node
+ xml = xml.documentElement;
+ }
+ var nws = this.removeWhite(xml);
+ var obj = this.toObj(nws);
+ var json = this.toJson(obj, xml.nodeName, "\t");
+ return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
+ },
+
+ // Param "o": JavaScript object
+ // Param "tab": tab or indent string for pretty output formatting omit or use empty string "" to supress.
+ // Returns: XML string
+ json2xml: function(o, tab) {
+ var toXml = function(v, name, ind) {
+ var xml = "";
+ var i, n;
+ if (v instanceof Array) {
+ if (v.length === 0) {
+ xml += ind + "<"+name+">__EMPTY_ARRAY_</"+name+">\n";
+ }
+ else {
+ for (i = 0, n = v.length; i < n; i += 1) {
+ var sXml = ind + toXml(v[i], name, ind+"\t") + "\n";
+ xml += sXml;
+ }
+ }
+ }
+ else if (typeof(v) === "object") {
+ var hasChild = false;
+ xml += ind + "<" + name;
+ var m;
+ for (m in v) if (v.hasOwnProperty(m)) {
+ if (m.charAt(0) === "@") {
+ xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
+ }
+ else {
+ hasChild = true;
+ }
+ }
+ xml += hasChild ? ">" : "/>";
+ if (hasChild) {
+ for (m in v) if (v.hasOwnProperty(m)) {
+ if (m === "#text") {
+ xml += v[m];
+ }
+ else if (m === "#cdata") {
+ xml += "<![CDATA[" + v[m] + "]]>";
+ }
+ else if (m.charAt(0) !== "@") {
+ xml += toXml(v[m], m, ind+"\t");
+ }
+ }
+ xml += (xml.charAt(xml.length - 1) === "\n" ? ind : "") + "</" + name + ">";
+ }
+ }
+ else if (typeof(v) === "function") {
+ xml += ind + "<" + name + ">" + "<![CDATA[" + v + "]]>" + "</" + name + ">";
+ }
+ else {
+ if (v.toString() === "\"\"" || v.toString().length === 0) {
+ xml += ind + "<" + name + ">__EMPTY_STRING_</" + name + ">";
+ }
+ else {
+ xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
+ }
+ }
+ return xml;
+ };
+ var xml = "";
+ var m;
+ for (m in o) if (o.hasOwnProperty(m)) {
+ xml += toXml(o[m], m, "");
+ }
+ return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
+ },
+ // Internal methods
+ toObj: function(xml) {
+ var o = {};
+ var FuncTest = /function/i;
+ if (xml.nodeType === 1) {
+ // element node ..
+ if (xml.attributes.length) {
+ // element with attributes ..
+ var i;
+ for (i = 0; i < xml.attributes.length; i += 1) {
+ o["@" + xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue || "").toString();
+ }
+ }
+ if (xml.firstChild) {
+ // element has child nodes ..
+ var textChild = 0, cdataChild = 0, hasElementChild = false;
+ var n;
+ for (n = xml.firstChild; n; n = n.nextSibling) {
+ if (n.nodeType === 1) {
+ hasElementChild = true;
+ }
+ else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
+ // non-whitespace text
+ textChild += 1;
+ }
+ else if (n.nodeType === 4) {
+ // cdata section node
+ cdataChild += 1;
+ }
+ }
+ if (hasElementChild) {
+ if (textChild < 2 && cdataChild < 2) {
+ // structured element with evtl. a single text or/and cdata node ..
+ this.removeWhite(xml);
+ for (n = xml.firstChild; n; n = n.nextSibling) {
+ if (n.nodeType === 3) {
+ // text node
+ o["#text"] = this.escape(n.nodeValue);
+ }
+ else if (n.nodeType === 4) {
+ // cdata node
+ if (FuncTest.test(n.nodeValue)) {
+ o[n.nodeName] = [o[n.nodeName], n.nodeValue];
+ } else {
+ o["#cdata"] = this.escape(n.nodeValue);
+ }
+ }
+ else if (o[n.nodeName]) {
+ // multiple occurence of element ..
+ if (o[n.nodeName] instanceof Array) {
+ o[n.nodeName][o[n.nodeName].length] = this.toObj(n);
+ }
+ else {
+ o[n.nodeName] = [o[n.nodeName], this.toObj(n)];
+ }
+ }
+ else {
+ // first occurence of element ..
+ o[n.nodeName] = this.toObj(n);
+ }
+ }
+ }
+ else {
+ // mixed content
+ if (!xml.attributes.length) {
+ o = this.escape(this.innerXml(xml));
+ }
+ else {
+ o["#text"] = this.escape(this.innerXml(xml));
+ }
+ }
+ }
+ else if (textChild) {
+ // pure text
+ if (!xml.attributes.length) {
+ o = this.escape(this.innerXml(xml));
+ if (o === "__EMPTY_ARRAY_") {
+ o = "[]";
+ } else if (o === "__EMPTY_STRING_") {
+ o = "";
+ }
+ }
+ else {
+ o["#text"] = this.escape(this.innerXml(xml));
+ }
+ }
+ else if (cdataChild) {
+ // cdata
+ if (cdataChild > 1) {
+ o = this.escape(this.innerXml(xml));
+ }
+ else {
+ for (n = xml.firstChild; n; n = n.nextSibling) {
+ if(FuncTest.test(xml.firstChild.nodeValue)) {
+ o = xml.firstChild.nodeValue;
+ break;
+ } else {
+ o["#cdata"] = this.escape(n.nodeValue);
+ }
+ }
+ }
+ }
+ }
+ if (!xml.attributes.length && !xml.firstChild) {
+ o = null;
+ }
+ }
+ else if (xml.nodeType === 9) {
+ // document.node
+ o = this.toObj(xml.documentElement);
+ }
+ else {
+ alert("unhandled node type: " + xml.nodeType);
+ }
+ return o;
+ },
+ toJson: function(o, name, ind, wellform) {
+ if(wellform === undefined) wellform = true;
+ var json = name ? ("\"" + name + "\"") : "", tab = "\t", newline = "\n";
+ if(!wellform) {
+ tab= ""; newline= "";
+ }
+
+ if (o === "[]") {
+ json += (name ? ":[]" : "[]");
+ }
+ else if (o instanceof Array) {
+ var n, i, ar=[];
+ for (i = 0, n = o.length; i < n; i += 1) {
+ ar[i] = this.toJson(o[i], "", ind + tab, wellform);
+ }
+ json += (name ? ":[" : "[") + (ar.length > 1 ? (newline + ind + tab + ar.join(","+newline + ind + tab) + newline + ind) : ar.join("")) + "]";
+ }
+ else if (o === null) {
+ json += (name && ":") + "null";
+ }
+ else if (typeof(o) === "object") {
+ var arr = [], m;
+ for (m in o) {
+ if (o.hasOwnProperty(m)) {
+ arr[arr.length] = this.toJson(o[m], m, ind + tab, wellform);
+ }
+ }
+ json += (name ? ":{" : "{") + (arr.length > 1 ? (newline + ind + tab + arr.join(","+newline + ind + tab) + newline + ind) : arr.join("")) + "}";
+ }
+ else if (typeof(o) === "string") {
+ /*
+ var objRegExp = /(^-?\d+\.?\d*$)/;
+ var FuncTest = /function/i;
+ var os = o.toString();
+ if (objRegExp.test(os) || FuncTest.test(os) || os==="false" || os==="true") {
+ // int or float
+ json += (name && ":") + "\"" +os + "\"";
+ }
+ else {
+ */
+ json += (name && ":") + "\"" + o.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"";
+ //}
+ }
+ else {
+ json += (name && ":") + "\"" + o.toString()+ "\"";
+ }
+ return json;
+ },
+ innerXml: function(node) {
+ var s = "";
+ if ("innerHTML" in node) {
+ s = node.innerHTML;
+ }
+ else {
+ var asXml = function(n) {
+ var s = "", i;
+ if (n.nodeType === 1) {
+ s += "<" + n.nodeName;
+ for (i = 0; i < n.attributes.length; i += 1) {
+ s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue || "").toString() + "\"";
+ }
+ if (n.firstChild) {
+ s += ">";
+ for (var c = n.firstChild; c; c = c.nextSibling) {
+ s += asXml(c);
+ }
+ s += "</" + n.nodeName + ">";
+ }
+ else {
+ s += "/>";
+ }
+ }
+ else if (n.nodeType === 3) {
+ s += n.nodeValue;
+ }
+ else if (n.nodeType === 4) {
+ s += "<![CDATA[" + n.nodeValue + "]]>";
+ }
+ return s;
+ };
+ for (var c = node.firstChild; c; c = c.nextSibling) {
+ s += asXml(c);
+ }
+ }
+ return s;
+ },
+ escape: function(txt) {
+ return txt.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, '\\n').replace(/[\r]/g, '\\r');
+ },
+ removeWhite: function(e) {
+ e.normalize();
+ var n;
+ for (n = e.firstChild; n; ) {
+ if (n.nodeType === 3) {
+ // text node
+ if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) {
+ // pure whitespace text node
+ var nxt = n.nextSibling;
+ e.removeChild(n);
+ n = nxt;
+ }
+ else {
+ n = n.nextSibling;
+ }
+ }
+ else if (n.nodeType === 1) {
+ // element node
+ this.removeWhite(n);
+ n = n.nextSibling;
+ }
+ else {
+ // any other node
+ n = n.nextSibling;
+ }
+ }
+ return e;
+ }
+};
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/grid.base.js'
--- addons/base/static/jquery.jqGrid/js/grid.base.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.base.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,3124 @@
+/*
+ * jqGrid 3.8.2 - jQuery Grid
+ * Copyright (c) 2008, Tony Tomov, tony@xxxxxxxxxxx
+ * Dual licensed under the MIT and GPL licenses
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * Date: 2010-12-14
+ */
+//jsHint options
+/*global document, window, jQuery, DOMParser, ActiveXObject $ */
+
+(function ($) {
+
+$.jgrid = $.jgrid || {};
+$.extend($.jgrid,{
+ htmlDecode : function(value){
+ if(value==' ' || value==' ' || (value.length==1 && value.charCodeAt(0)==160)) { return "";}
+ return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"');
+ },
+ htmlEncode : function (value){
+ return !value ? value : String(value).replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/\"/g, """);
+ },
+ format : function(format){ //jqgformat
+ var args = $.makeArray(arguments).slice(1);
+ if(format===undefined) { format = ""; }
+ return format.replace(/\{(\d+)\}/g, function(m, i){
+ return args[i];
+ });
+ },
+ getCellIndex : function (cell) {
+ var c = $(cell);
+ if (c.is('tr')) { return -1; }
+ c = (!c.is('td') && !c.is('th') ? c.closest("td,th") : c)[0];
+ if ($.browser.msie) { return $.inArray(c, c.parentNode.cells); }
+ return c.cellIndex;
+ },
+ stripHtml : function(v) {
+ v = v+"";
+ var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
+ if (v) {
+ v = v.replace(regexp,"");
+ return (v && v !== ' ' && v !== ' ') ? v.replace(/\"/g,"'") : "";
+ } else {
+ return v;
+ }
+ },
+ stringToDoc : function (xmlString) {
+ var xmlDoc;
+ if(typeof xmlString !== 'string') { return xmlString; }
+ try {
+ var parser = new DOMParser();
+ xmlDoc = parser.parseFromString(xmlString,"text/xml");
+ }
+ catch(e) {
+ xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
+ xmlDoc.async=false;
+ xmlDoc.loadXML(xmlString);
+ }
+ return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null;
+ },
+ parse : function(jsonString) {
+ var js = jsonString;
+ if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
+ if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
+ if(!js) { js = "{}"; }
+ return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
+ JSON.parse(js) :
+ eval('(' + js + ')');
+ },
+ parseDate : function(format, date) {
+ var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0},k,hl,dM, regdate = /[\\\/:_;.,\t\T\s-]/;
+ if(date && date !== null && date !== undefined){
+ date = $.trim(date);
+ date = date.split(regdate);
+ format = format.split(regdate);
+ var dfmt = $.jgrid.formatter.date.monthNames;
+ var afmt = $.jgrid.formatter.date.AmPm;
+ var h12to24 = function(ampm, h){
+ if (ampm === 0){ if (h == 12) { h = 0;} }
+ else { if (h != 12) { h += 12; } }
+ return h;
+ };
+ for(k=0,hl=format.length;k<hl;k++){
+ if(format[k] == 'M') {
+ dM = $.inArray(date[k],dfmt);
+ if(dM !== -1 && dM < 12){date[k] = dM+1;}
+ }
+ if(format[k] == 'F') {
+ dM = $.inArray(date[k],dfmt);
+ if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
+ }
+ if(format[k] == 'a') {
+ dM = $.inArray(date[k],afmt);
+ if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){
+ date[k] = dM;
+ tsp.h = h12to24(date[k], tsp.h);
+ }
+ }
+ if(format[k] == 'A') {
+ dM = $.inArray(date[k],afmt);
+ if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){
+ date[k] = dM-2;
+ tsp.h = h12to24(date[k], tsp.h);
+ }
+ }
+ if(date[k] !== undefined) {
+ tsp[format[k].toLowerCase()] = parseInt(date[k],10);
+ }
+ }
+ tsp.m = parseInt(tsp.m,10)-1;
+ var ty = tsp.y;
+ if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;}
+ else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;}
+ }
+ return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s,0);
+ },
+ jqID : function(sid){
+ sid = sid + "";
+ return sid.replace(/([\.\:\[\]])/g,"\\$1");
+ },
+ getAccessor : function(obj, expr) {
+ var ret,p,prm = [], i;
+ if( typeof expr === 'function') { return expr(obj); }
+ ret = obj[expr];
+ if(ret===undefined) {
+ try {
+ if ( typeof expr === 'string' ) {
+ prm = expr.split('.');
+ }
+ i = prm.length;
+ if( i ) {
+ ret = obj;
+ while (ret && i--) {
+ p = prm.shift();
+ ret = ret[p];
+ }
+ }
+ } catch (e) {}
+ }
+ return ret;
+ },
+ ajaxOptions: {},
+ from : function(source,initalQuery){
+ // Original Author Hugo Bonacci
+ // License MIT http://jlinq.codeplex.com/license
+ var queryObject=function(d,q){
+ if(typeof(d)=="string"){
+ d=$.data(d);
+ }
+ var self=this,
+ _data=d,
+ _usecase=true,
+ _trim=false,
+ _query=q,
+ _stripNum = /[\$,%]/g,
+ _lastCommand=null,
+ _lastField=null,
+ _negate=false,
+ _queuedOperator="",
+ _sorting=[],
+ _useProperties=true;
+ if(typeof(d)=="object"&&d.push) {
+ if(d.length>0){
+ if(typeof(d[0])!="object"){
+ _useProperties=false;
+ }else{
+ _useProperties=true;
+ }
+ }
+ }else{
+ throw "data provides is not an array";
+ }
+ this._hasData=function(){
+ return _data===null?false:_data.length===0?false:true;
+ };
+ this._getStr=function(s){
+ var phrase=[];
+ if(_trim){
+ phrase.push("jQuery.trim(");
+ }
+ phrase.push("String("+s+")");
+ if(_trim){
+ phrase.push(")");
+ }
+ if(!_usecase){
+ phrase.push(".toLowerCase()");
+ }
+ return phrase.join("");
+ };
+ this._strComp=function(val){
+ if(typeof(val)=="string"){
+ return".toString()";
+ }else{
+ return"";
+ }
+ };
+ this._group=function(f,u){
+ return({field:f.toString(),unique:u,items:[]});
+ };
+ this._toStr=function(phrase){
+ if(_trim){
+ phrase=$.trim(phrase);
+ }
+ if(!_usecase){
+ phrase=phrase.toLowerCase();
+ }
+ phrase=phrase.toString().replace(/\\/g,'\\\\').replace(/\"/g,'\\"');
+ return phrase;
+ };
+ this._funcLoop=function(func){
+ var results=[];
+ $.each(_data,function(i,v){
+ results.push(func(v));
+ });
+ return results;
+ };
+ this._append=function(s){
+ if(_query===null){
+ _query="";
+ } else {
+ _query+=_queuedOperator === "" ? " && " :_queuedOperator;
+ }
+ if(_negate){
+ _query+="!";
+ }
+ _query+="("+s+")";
+ _negate=false;
+ _queuedOperator="";
+ };
+ this._setCommand=function(f,c){
+ _lastCommand=f;
+ _lastField=c;
+ };
+ this._resetNegate=function(){
+ _negate=false;
+ };
+ this._repeatCommand=function(f,v){
+ if(_lastCommand===null){
+ return self;
+ }
+ if(f!==null&&v!==null){
+ return _lastCommand(f,v);
+ }
+ if(_lastField===null){
+ return _lastCommand(f);
+ }
+ if(!_useProperties){
+ return _lastCommand(f);
+ }
+ return _lastCommand(_lastField,f);
+ };
+ this._equals=function(a,b){
+ return(self._compare(a,b,1)===0);
+ };
+ this._compare=function(a,b,d){
+ if( d === undefined) { d = 1; }
+ if(a===undefined) { a = null; }
+ if(b===undefined) { b = null; }
+ if(a===null && b===null){
+ return 0;
+ }
+ if(a===null&&b!==null){
+ return 1;
+ }
+ if(a!==null&&b===null){
+ return -1;
+ }
+ if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
+ a=String(a).toLowerCase();
+ b=String(b).toLowerCase();
+ }
+ if(a<b){return -d;}
+ if(a>b){return d;}
+ return 0;
+ };
+ this._performSort=function(){
+ if(_sorting.length===0){return;}
+ _data=self._doSort(_data,0);
+ };
+ this._doSort=function(d,q){
+ var by=_sorting[q].by,
+ dir=_sorting[q].dir,
+ type = _sorting[q].type,
+ dfmt = _sorting[q].datefmt;
+ if(q==_sorting.length-1){
+ return self._getOrder(d, by, dir, type, dfmt);
+ }
+ q++;
+ var values=self._getGroup(d,by,dir,type,dfmt);
+ var results=[];
+ for(var i=0;i<values.length;i++){
+ var sorted=self._doSort(values[i].items,q);
+ for(var j=0;j<sorted.length;j++){
+ results.push(sorted[j]);
+ }
+ }
+ return results;
+ };
+ this._getOrder=function(data,by,dir,type, dfmt){
+ var sortData=[],_sortData=[], newDir = dir=="a" ? 1 : -1, i,ab,j,
+ findSortKey;
+
+ if(type === undefined ) { type = "text"; }
+ if (type == 'float' || type== 'number' || type== 'currency' || type== 'numeric') {
+ findSortKey = function($cell, a) {
+ var key = parseFloat( String($cell).replace(_stripNum, ''));
+ return isNaN(key) ? 0.00 : key;
+ };
+ } else if (type=='int' || type=='integer') {
+ findSortKey = function($cell, a) {
+ return $cell ? parseFloat(String($cell).replace(_stripNum, '')) : 0;
+ };
+ } else if(type == 'date' || type == 'datetime') {
+ findSortKey = function($cell, a) {
+ return $.jgrid.parseDate(dfmt,$cell).getTime();
+ };
+ } else if($.isFunction(type)) {
+ findSortKey = type;
+ } else {
+ findSortKey = function($cell, a) {
+ if(!$cell) {$cell ="";}
+ return $.trim(String($cell).toUpperCase());
+ };
+ }
+ $.each(data,function(i,v){
+ ab = by!=="" ? $.jgrid.getAccessor(v,by) : v;
+ if(ab === undefined) { ab = ""; }
+ ab = findSortKey(ab, v);
+ _sortData.push({ 'vSort': ab,'index':i});
+ });
+
+ _sortData.sort(function(a,b){
+ a = a.vSort;
+ b = b.vSort;
+ return self._compare(a,b,newDir);
+ });
+ j=0;
+ var nrec= data.length;
+ // overhead, but we do not change the original data.
+ while(j<nrec) {
+ i = _sortData[j].index;
+ sortData.push(data[i]);
+ j++;
+ }
+ return sortData;
+ };
+ this._getGroup=function(data,by,dir,type, dfmt){
+ var results=[],
+ group=null,
+ last=null, val;
+ $.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){
+ val = $.jgrid.getAccessor(v, by);
+ if(val === undefined) { val = ""; }
+ if(!self._equals(last,val)){
+ last=val;
+ if(group !== null){
+ results.push(group);
+ }
+ group=self._group(by,val);
+ }
+ group.items.push(v);
+ });
+ if(group !== null){
+ results.push(group);
+ }
+ return results;
+ };
+ this.ignoreCase=function(){
+ _usecase=false;
+ return self;
+ };
+ this.useCase=function(){
+ _usecase=true;
+ return self;
+ };
+ this.trim=function(){
+ _trim=true;
+ return self;
+ };
+ this.noTrim=function(){
+ _trim=false;
+ return self;
+ };
+ this.execute=function(){
+ var match=_query, results=[];
+ if(match === null){
+ return self;
+ }
+ $.each(_data,function(){
+ if(eval(match)){results.push(this);}
+ });
+ _data=results;
+ return self;
+ };
+ this.data=function(){
+ return _data;
+ };
+ this.select=function(f){
+ self._performSort();
+ if(!self._hasData()){ return[]; }
+ self.execute();
+ if($.isFunction(f)){
+ var results=[];
+ $.each(_data,function(i,v){
+ results.push(f(v));
+ });
+ return results;
+ }
+ return _data;
+ };
+ this.hasMatch=function(f){
+ if(!self._hasData()) { return false; }
+ self.execute();
+ return _data.length>0;
+ };
+ this.andNot=function(f,v,x){
+ _negate=!_negate;
+ return self.and(f,v,x);
+ };
+ this.orNot=function(f,v,x){
+ _negate=!_negate;
+ return self.or(f,v,x);
+ };
+ this.not=function(f,v,x){
+ return self.andNot(f,v,x);
+ };
+ this.and=function(f,v,x){
+ _queuedOperator=" && ";
+ if(f===undefined){
+ return self;
+ }
+ return self._repeatCommand(f,v,x);
+ };
+ this.or=function(f,v,x){
+ _queuedOperator=" || ";
+ if(f===undefined) { return self; }
+ return self._repeatCommand(f,v,x);
+ };
+ this.isNot=function(f){
+ _negate=!_negate;
+ return self.is(f);
+ };
+ this.is=function(f){
+ self._append('this.'+f);
+ self._resetNegate();
+ return self;
+ };
+ this._compareValues=function(func,f,v,how,t){
+ var fld;
+ if(_useProperties){
+ fld='this.'+f;
+ }else{
+ fld='this';
+ }
+ if(v===undefined) { v = null; }
+ //var val=v===null?f:v,
+ var val =v,
+ swst = t.stype === undefined ? "text" : t.stype;
+ if(v !== null) {
+ switch(swst) {
+ case 'int':
+ case 'integer':
+ val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
+ fld = 'parseInt('+fld+',10)';
+ val = 'parseInt('+val+',10)';
+ break;
+ case 'float':
+ case 'number':
+ case 'numeric':
+ val = String(val).replace(_stripNum, '');
+ val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
+ fld = 'parseFloat('+fld+')';
+ val = 'parseFloat('+val+')';
+ break;
+ case 'date':
+ case 'datetime':
+ val = String($.jgrid.parseDate(t.newfmt || 'Y-m-d',val).getTime());
+ fld = 'jQuery.jgrid.parseDate("'+t.srcfmt+'",'+fld+').getTime()';
+ break;
+ default :
+ fld=self._getStr(fld);
+ val=self._getStr('"'+self._toStr(val)+'"');
+ }
+ }
+ self._append(fld+' '+how+' '+val);
+ self._setCommand(func,f);
+ self._resetNegate();
+ return self;
+ };
+ this.equals=function(f,v,t){
+ return self._compareValues(self.equals,f,v,"==",t);
+ };
+ this.notEquals=function(f,v,t){
+ return self._compareValues(self.equals,f,v,"!==",t);
+ };
+ this.isNull = function(f,v,t){
+ return self._compareValues(self.equals,f,null,"===",t);
+ };
+ this.greater=function(f,v,t){
+ return self._compareValues(self.greater,f,v,">",t);
+ };
+ this.less=function(f,v,t){
+ return self._compareValues(self.less,f,v,"<",t);
+ };
+ this.greaterOrEquals=function(f,v,t){
+ return self._compareValues(self.greaterOrEquals,f,v,">=",t);
+ };
+ this.lessOrEquals=function(f,v,t){
+ return self._compareValues(self.lessOrEquals,f,v,"<=",t);
+ };
+ this.startsWith=function(f,v){
+ var val = (v===undefined || v===null) ? f: v,
+ length=_trim ? $.trim(val.toString()).length : val.toString().length;
+ if(_useProperties){
+ self._append(self._getStr('this.'+f)+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"'));
+ }else{
+ length=_trim?$.trim(v.toString()).length:v.toString().length;
+ self._append(self._getStr('this')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(f)+'"'));
+ }
+ self._setCommand(self.startsWith,f);
+ self._resetNegate();
+ return self;
+ };
+ this.endsWith=function(f,v){
+ var val = (v===undefined || v===null) ? f: v,
+ length=_trim ? $.trim(val.toString()).length:val.toString().length;
+ if(_useProperties){
+ self._append(self._getStr('this.'+f)+'.substr('+self._getStr('this.'+f)+'.length-'+length+','+length+') == "'+self._toStr(v)+'"');
+ } else {
+ self._append(self._getStr('this')+'.substr('+self._getStr('this')+'.length-"'+self._toStr(f)+'".length,"'+self._toStr(f)+'".length) == "'+self._toStr(f)+'"');
+ }
+ self._setCommand(self.endsWith,f);self._resetNegate();
+ return self;
+ };
+ this.contains=function(f,v){
+ if(_useProperties){
+ self._append(self._getStr('this.'+f)+'.indexOf("'+self._toStr(v)+'",0) > -1');
+ }else{
+ self._append(self._getStr('this')+'.indexOf("'+self._toStr(f)+'",0) > -1');
+ }
+ self._setCommand(self.contains,f);
+ self._resetNegate();
+ return self;
+ };
+ this.groupBy=function(by,dir,type, datefmt){
+ if(!self._hasData()){
+ return null;
+ }
+ return self._getGroup(_data,by,dir,type, datefmt);
+ };
+ this.orderBy=function(by,dir,stype, dfmt){
+ dir = dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase());
+ if(stype === null || stype === undefined) { stype = "text"; }
+ if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; }
+ if(dir=="desc"||dir=="descending"){dir="d";}
+ if(dir=="asc"||dir=="ascending"){dir="a";}
+ _sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt});
+ return self;
+ };
+ return self;
+ };
+ return new queryObject(source,null);
+ },
+ extend : function(methods) {
+ $.extend($.fn.jqGrid,methods);
+ if (!this.no_legacy_api) {
+ $.fn.extend(methods);
+ }
+ }
+});
+
+$.fn.jqGrid = function( pin ) {
+ if (typeof pin == 'string') {
+ //var fn = $.fn.jqGrid[pin];
+ var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);
+ if (!fn) {
+ throw ("jqGrid - No such method: " + pin);
+ }
+ var args = $.makeArray(arguments).slice(1);
+ return fn.apply(this,args);
+ }
+ return this.each( function() {
+ if(this.grid) {return;}
+
+ var p = $.extend(true,{
+ url: "",
+ height: 150,
+ page: 1,
+ rowNum: 20,
+ rowTotal : null,
+ records: 0,
+ pager: "",
+ pgbuttons: true,
+ pginput: true,
+ colModel: [],
+ rowList: [],
+ colNames: [],
+ sortorder: "asc",
+ sortname: "",
+ datatype: "xml",
+ mtype: "GET",
+ altRows: false,
+ selarrrow: [],
+ savedRow: [],
+ shrinkToFit: true,
+ xmlReader: {},
+ jsonReader: {},
+ subGrid: false,
+ subGridModel :[],
+ reccount: 0,
+ lastpage: 0,
+ lastsort: 0,
+ selrow: null,
+ beforeSelectRow: null,
+ onSelectRow: null,
+ onSortCol: null,
+ ondblClickRow: null,
+ onRightClickRow: null,
+ onPaging: null,
+ onSelectAll: null,
+ loadComplete: null,
+ gridComplete: null,
+ loadError: null,
+ loadBeforeSend: null,
+ afterInsertRow: null,
+ beforeRequest: null,
+ onHeaderClick: null,
+ viewrecords: false,
+ loadonce: false,
+ multiselect: false,
+ multikey: false,
+ editurl: null,
+ search: false,
+ caption: "",
+ hidegrid: true,
+ hiddengrid: false,
+ postData: {},
+ userData: {},
+ treeGrid : false,
+ treeGridModel : 'nested',
+ treeReader : {},
+ treeANode : -1,
+ ExpandColumn: null,
+ tree_root_level : 0,
+ prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null, totalrows:"totalrows"},
+ forceFit : false,
+ gridstate : "visible",
+ cellEdit: false,
+ cellsubmit: "remote",
+ nv:0,
+ loadui: "enable",
+ toolbar: [false,""],
+ scroll: false,
+ multiboxonly : false,
+ deselectAfterSort : true,
+ scrollrows : false,
+ autowidth: false,
+ scrollOffset :18,
+ cellLayout: 5,
+ subGridWidth: 20,
+ multiselectWidth: 20,
+ gridview: false,
+ rownumWidth: 25,
+ rownumbers : false,
+ pagerpos: 'center',
+ recordpos: 'right',
+ footerrow : false,
+ userDataOnFooter : false,
+ hoverrows : true,
+ altclass : 'ui-priority-secondary',
+ viewsortcols : [false,'vertical',true],
+ resizeclass : '',
+ autoencode : false,
+ remapColumns : [],
+ ajaxGridOptions :{},
+ direction : "ltr",
+ toppager: false,
+ headertitles: false,
+ scrollTimeout: 40,
+ data : [],
+ _index : {},
+ grouping : false,
+ groupingView : {groupField:[],groupOrder:[], groupText:[],groupColumnShow:[],groupSummary:[], showSummaryOnHide: false, sortitems:[], sortnames:[], groupDataSorted : false, summary:[],summaryval:[], plusicon: 'ui-icon-circlesmall-plus', minusicon: 'ui-icon-circlesmall-minus'},
+ ignoreCase : false,
+ cmTemplate : {}
+ }, $.jgrid.defaults, pin || {});
+ var grid={
+ headers:[],
+ cols:[],
+ footers: [],
+ dragStart: function(i,x,y) {
+ this.resizing = { idx: i, startX: x.clientX, sOL : y[0]};
+ this.hDiv.style.cursor = "col-resize";
+ this.curGbox = $("#rs_m"+$.jgrid.jqID(p.id),"#gbox_"+$.jgrid.jqID(p.id));
+ this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});
+ if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); }
+ document.onselectstart=function(){return false;};
+ },
+ dragMove: function(x) {
+ if(this.resizing) {
+ var diff = x.clientX-this.resizing.startX,
+ h = this.headers[this.resizing.idx],
+ newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn;
+ if(newWidth > 33) {
+ this.curGbox.css({left:this.resizing.sOL+diff});
+ if(p.forceFit===true ){
+ hn = this.headers[this.resizing.idx+p.nv];
+ nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff;
+ if(nWn >33) {
+ h.newWidth = newWidth;
+ hn.newWidth = nWn;
+ }
+ } else {
+ this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff;
+ h.newWidth = newWidth;
+ }
+ }
+ }
+ },
+ dragEnd: function() {
+ this.hDiv.style.cursor = "default";
+ if(this.resizing) {
+ var idx = this.resizing.idx,
+ nw = this.headers[idx].newWidth || this.headers[idx].width;
+ nw = parseInt(nw,10);
+ this.resizing = false;
+ $("#rs_m"+$.jgrid.jqID(p.id)).css("display","none");
+ p.colModel[idx].width = nw;
+ this.headers[idx].width = nw;
+ this.headers[idx].el.style.width = nw + "px";
+ this.cols[idx].style.width = nw+"px";
+ if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";}
+ if(p.forceFit===true){
+ nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width;
+ this.headers[idx+p.nv].width = nw;
+ this.headers[idx+p.nv].el.style.width = nw + "px";
+ this.cols[idx+p.nv].style.width = nw+"px";
+ if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";}
+ p.colModel[idx+p.nv].width = nw;
+ } else {
+ p.tblwidth = this.newWidth || p.tblwidth;
+ $('table:first',this.bDiv).css("width",p.tblwidth+"px");
+ $('table:first',this.hDiv).css("width",p.tblwidth+"px");
+ this.hDiv.scrollLeft = this.bDiv.scrollLeft;
+ if(p.footerrow) {
+ $('table:first',this.sDiv).css("width",p.tblwidth+"px");
+ this.sDiv.scrollLeft = this.bDiv.scrollLeft;
+ }
+ }
+ if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
+ }
+ this.curGbox = null;
+ document.onselectstart=function(){return true;};
+ },
+ populateVisible: function() {
+ if (grid.timer) { clearTimeout(grid.timer); }
+ grid.timer = null;
+ var dh = $(grid.bDiv).height();
+ if (!dh) { return; }
+ var table = $("table:first", grid.bDiv);
+ var rows = $("> tbody > tr:gt(0):visible:first", table);
+ var rh = rows.outerHeight() || grid.prevRowHeight;
+ if (!rh) { return; }
+ grid.prevRowHeight = rh;
+ var rn = p.rowNum;
+ var scrollTop = grid.scrollTop = grid.bDiv.scrollTop;
+ var ttop = Math.round(table.position().top) - scrollTop;
+ var tbot = ttop + table.height();
+ var div = rh * rn;
+ var page, npage, empty;
+ if ( tbot < dh && ttop <= 0 &&
+ (p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
+ {
+ npage = parseInt((dh - tbot + div - 1) / div,10);
+ if (tbot >= 0 || npage < 2 || p.scroll === true) {
+ page = Math.round((tbot + scrollTop) / div) + 1;
+ ttop = -1;
+ } else {
+ ttop = 1;
+ }
+ }
+ if (ttop > 0) {
+ page = parseInt(scrollTop / div,10) + 1;
+ npage = parseInt((scrollTop + dh) / div,10) + 2 - page;
+ empty = true;
+ }
+ if (npage) {
+ if (p.lastpage && page > p.lastpage || p.lastpage==1) {
+ return;
+ }
+ if (grid.hDiv.loading) {
+ grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
+ } else {
+ p.page = page;
+ if (empty) {
+ grid.selectionPreserver(table[0]);
+ grid.emptyRows(grid.bDiv,false);
+ }
+ grid.populate(npage);
+ }
+ }
+ },
+ scrollGrid: function() {
+ if(p.scroll) {
+ var scrollTop = grid.bDiv.scrollTop;
+ if(grid.scrollTop === undefined) { grid.scrollTop = 0; }
+ if (scrollTop != grid.scrollTop) {
+ grid.scrollTop = scrollTop;
+ if (grid.timer) { clearTimeout(grid.timer); }
+ grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
+ }
+ }
+ grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;
+ if(p.footerrow) {
+ grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;
+ }
+ },
+ selectionPreserver : function(ts) {
+ var p = ts.p;
+ var sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null;
+ var left = ts.grid.bDiv.scrollLeft;
+ var complete = p.gridComplete;
+ p.gridComplete = function() {
+ p.selrow = null;
+ p.selarrrow = [];
+ if(p.multiselect && sra && sra.length>0) {
+ for(var i=0;i<sra.length;i++){
+ if (sra[i] != sr) {
+ $(ts).jqGrid("setSelection",sra[i],false);
+ }
+ }
+ }
+ if (sr) {
+ $(ts).jqGrid("setSelection",sr,false);
+ }
+ ts.grid.bDiv.scrollLeft = left;
+ p.gridComplete = complete;
+ if (p.gridComplete) {
+ complete();
+ }
+ };
+ }
+ };
+ if(this.tagName != 'TABLE') {
+ alert("Element is not a table");
+ return;
+ }
+ $(this).empty();
+ this.p = p ;
+ var i, dir,ts;
+ if(this.p.colNames.length === 0) {
+ for (i=0;i<this.p.colModel.length;i++){
+ this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name;
+ }
+ }
+ if( this.p.colNames.length !== this.p.colModel.length ) {
+ alert($.jgrid.errors.model);
+ return;
+ }
+ var gv = $("<div class='ui-jqgrid-view'></div>"), ii,
+ isMSIE = $.browser.msie ? true:false,
+ isSafari = $.browser.safari ? true : false;
+ ts = this;
+ ts.p.direction = $.trim(ts.p.direction.toLowerCase());
+ if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; }
+ dir = ts.p.direction;
+
+ $(gv).insertBefore(this);
+ $(this).appendTo(gv).removeClass("scroll");
+ var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
+ $(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir});
+ $(gv).appendTo(eg).attr("id","gview_"+this.id);
+ if (isMSIE && $.browser.version <= 6) {
+ ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
+ } else { ii="";}
+ $("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);
+ $("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);
+ $(this).attr({cellspacing:"0",cellpadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});
+ var sortkeys = ["shiftKey","altKey","ctrlKey"],
+ intNum = function(val,defval) {
+ val = parseInt(val,10);
+ if (isNaN(val)) { return defval ? defval : 0;}
+ else {return val;}
+ },
+ formatCol = function (pos, rowInd, tv, rawObject, rowId, rdata){
+ var cm = ts.p.colModel[pos],
+ ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name, celp, acp=[];
+ if(ral) { result += "text-align:"+ral+";"; }
+ if(cm.hidden===true) { result += "display:none;"; }
+ if(rowInd===0) {
+ result += "width: "+grid.headers[pos].width+"px;";
+ } else if (cm.cellattr && $.isFunction(cm.cellattr))
+ {
+ celp = cm.cellattr.call(ts, rowId, tv, rawObject, cm, rdata);
+ if(celp && typeof(celp) === "string") {
+ celp = celp.replace(/style/i,'style').replace(/title/i,'title');
+ if(celp.indexOf('title') > -1) { cm.title=false;}
+ if(celp.indexOf('class') > -1) { clas = undefined;}
+ acp = celp.split("style");
+ if(acp.length === 2 ) {
+ acp[1] = $.trim(acp[1].replace("=",""));
+ if(acp[1].indexOf("'") === 0 || acp[1].indexOf('"') === 0) {
+ acp[1] = acp[1].substring(1);
+ }
+ result += acp[1].replace(/'/gi,'"');
+ } else {
+ result += "\"";
+ }
+ }
+ }
+ if(!acp.length) { acp[0] = ""; result += "\"";}
+ result += (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :"");
+ result += " aria-describedby=\""+ts.p.id+"_"+nm+"\"";
+ return result + acp[0];
+ },
+ cellVal = function (val) {
+ return val === undefined || val === null || val === "" ? " " : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
+ },
+ formatter = function (rowId, cellval , colpos, rwdat, _act){
+ var cm = ts.p.colModel[colpos],v;
+ if(typeof cm.formatter !== 'undefined') {
+ var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos };
+ if($.isFunction( cm.formatter ) ) {
+ v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
+ } else if($.fmatter){
+ v = $.fn.fmatter(cm.formatter, cellval,opts, rwdat, _act);
+ } else {
+ v = cellVal(cellval);
+ }
+ } else {
+ v = cellVal(cellval);
+ }
+ return v;
+ },
+ addCell = function(rowId,cell,pos,irow, srvr) {
+ var v,prp;
+ v = formatter(rowId,cell,pos,srvr,'add');
+ prp = formatCol( pos,irow, v, srvr, rowId, true);
+ return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
+ },
+ addMulti = function(rowid,pos,irow){
+ var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"/>",
+ prp = formatCol( pos,irow,'',null, rowid, true);
+ return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
+ },
+ addRowNum = function (pos,irow,pG,rN) {
+ var v = (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow,
+ prp = formatCol( pos,irow,v, null, irow, true);
+ return "<td role=\"gridcell\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>";
+ },
+ reader = function (datatype) {
+ var field, f=[], j=0, i;
+ for(i =0; i<ts.p.colModel.length; i++){
+ field = ts.p.colModel[i];
+ if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') {
+ if(datatype == "local") {
+ f[j] = field.name;
+ } else {
+ f[j] = (datatype=="xml") ? field.xmlmap || field.name : field.jsonmap || field.name;
+ }
+ j++;
+ }
+ }
+ return f;
+ },
+ orderedCols = function (offset) {
+ var order = ts.p.remapColumns;
+ if (!order || !order.length) {
+ order = $.map(ts.p.colModel, function(v,i) { return i; });
+ }
+ if (offset) {
+ order = $.map(order, function(v) { return v<offset?null:v-offset; });
+ }
+ return order;
+ },
+ emptyRows = function (parent, scroll) {
+ if(ts.p.deepempty) {$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:gt(0)").remove();}
+ else {
+ var trf = $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:first")[0];
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").empty().append(trf);
+ }
+ if (scroll && ts.p.scroll) {
+ $(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});
+ parent.scrollTop = 0;
+ }
+ },
+ refreshIndex = function() {
+ var datalen = ts.p.data.length, idname, i, val,
+ ni = ts.p.rownumbers===true ? 1 :0,
+ gi = ts.p.multiselect ===true ? 1 :0,
+ si = ts.p.subGrid===true ? 1 :0;
+
+ if(ts.p.keyIndex === false || ts.p.loadonce === true) {
+ idname = ts.p.localReader.id;
+ } else {
+ idname = ts.p.colModel[ts.p.keyIndex+gi+si+ni].name;
+ }
+ for(i =0;i < datalen; i++) {
+ val = $.jgrid.getAccessor(ts.p.data[i],idname);
+ ts.p._index[val] = i;
+ }
+ },
+ addXmlData = function (xml,t, rcnt, more, adjust) {
+ var startReq = new Date(),
+ locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "xmlstring",
+ xmlid,
+ frd = ts.p.datatype == "local" ? "local" : "xml";
+ if(locdata) {
+ ts.p.data = [];
+ ts.p._index = {};
+ ts.p.localReader.id = xmlid = "_id_";
+ }
+ ts.p.reccount = 0;
+ if($.isXMLDoc(xml)) {
+ if(ts.p.treeANode===-1 && !ts.p.scroll) {
+ emptyRows(t,false);
+ rcnt=1;
+ } else { rcnt = rcnt > 1 ? rcnt :1; }
+ } else { return; }
+ var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
+ if(!ts.p.xmlReader.repeatitems) {f = reader(frd);}
+ if( ts.p.keyIndex===false) {
+ idn = ts.p.xmlReader.id;
+ } else {
+ idn = ts.p.keyIndex;
+ }
+ if(f.length>0 && !isNaN(idn)) {
+ if (ts.p.remapColumns && ts.p.remapColumns.length) {
+ idn = $.inArray(idn, ts.p.remapColumns);
+ }
+ idn=f[idn];
+ }
+ if( (idn+"").indexOf("[") === -1 ) {
+ if (f.length) {
+ getId = function( trow, k) {return $(idn,trow).text() || k;};
+ } else {
+ getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;};
+ }
+ }
+ else {
+ getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;};
+ }
+ ts.p.userData = {};
+ $(ts.p.xmlReader.page,xml).each(function() {ts.p.page = this.textContent || this.text || 0; });
+ $(ts.p.xmlReader.total,xml).each(function() {ts.p.lastpage = this.textContent || this.text; if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } } );
+ $(ts.p.xmlReader.records,xml).each(function() {ts.p.records = this.textContent || this.text || 0; } );
+ $(ts.p.xmlReader.userdata,xml).each(function() {ts.p.userData[this.getAttribute("name")]=this.textContent || this.text;});
+ var gxml = $(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml);
+ if (!gxml) { gxml = []; }
+ var gl = gxml.length, j=0, grpdata={}, rn;
+ if(gxml && gl){
+ rn = parseInt(ts.p.rowNum,10);
+ var br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1,altr;
+ if (adjust) { rn *= adjust+1; }
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow="";
+ if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
+ hiderow = " style=\"display:none;\"";
+ }
+ while (j<gl) {
+ xmlr = gxml[j];
+ rid = getId(xmlr,br+j);
+ altr = rcnt === 0 ? 0 : rcnt+1;
+ cn1 = (altr+j)%2 == 1 ? cn : '';
+ rowData.push( "<tr"+hiderow+" id=\""+rid+"\" role=\"row\" class =\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">" );
+ if(ts.p.rownumbers===true) {
+ rowData.push( addRowNum(0,j,ts.p.page,ts.p.rowNum) );
+ ni=1;
+ }
+ if(ts.p.multiselect===true) {
+ rowData.push( addMulti(rid,ni,j) );
+ gi=1;
+ }
+ if (ts.p.subGrid===true) {
+ rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt) );
+ si= 1;
+ }
+ if(ts.p.xmlReader.repeatitems){
+ if (!F) { F=orderedCols(gi+si+ni); }
+ var cells = $(ts.p.xmlReader.cell,xmlr);
+ $.each(F, function (k) {
+ var cell = cells[this];
+ if (!cell) { return false; }
+ v = cell.textContent || cell.text;
+ rd[ts.p.colModel[k+gi+si+ni].name] = v;
+ rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr) );
+ });
+ } else {
+ for(i = 0; i < f.length;i++) {
+ v = $(f[i],xmlr).text();
+ rd[ts.p.colModel[i+gi+si+ni].name] = v;
+ rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr) );
+ }
+ }
+ rowData.push("</tr>");
+ if(ts.p.grouping) {
+ var grlen = ts.p.groupingView.groupField.length, grpitem = [];
+ for(var z=0;z<grlen;z++) {
+ grpitem.push(rd[ts.p.groupingView.groupField[z]]);
+ }
+ grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
+ rowData = [];
+ }
+ if(locdata) {
+ rd[xmlid] = rid;
+ ts.p.data.push(rd);
+ }
+ if(ts.p.gridview === false ) {
+ if( ts.p.treeGrid === true) {
+ fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
+ row = $(rowData.join(''))[0]; // speed overhead
+ $(ts.rows[j+fpos]).after(row);
+ try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
+ } else {
+ $("tbody:first",t).append(rowData.join(''));
+ }
+ if (ts.p.subGrid===true) {
+ try {$(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
+ }
+ if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
+ rowData=[];
+ }
+ rd={};
+ ir++;
+ j++;
+ if(ir==rn) {break;}
+ }
+ }
+ if(ts.p.gridview === true) {
+ if(ts.p.grouping) {
+ $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
+ grpdata = null;
+ } else {
+ $("tbody:first",t).append(rowData.join(''));
+ }
+ }
+ ts.p.totaltime = new Date() - startReq;
+ if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} }
+ rowData =null;
+ if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
+ ts.p.reccount=ir;
+ ts.p.treeANode = -1;
+ if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
+ if(locdata) {
+ ts.p.records = gl;
+ ts.p.lastpage = Math.ceil(gl/ rn);
+ }
+ if (!more) { ts.updatepager(false,true); }
+ if(locdata) {
+ while (ir<gl) {
+ xmlr = gxml[ir];
+ rid = getId(xmlr,ir);
+ if(ts.p.xmlReader.repeatitems){
+ if (!F) { F=orderedCols(gi+si+ni); }
+ var cells2 = $(ts.p.xmlReader.cell,xmlr);
+ $.each(F, function (k) {
+ var cell = cells2[this];
+ if (!cell) { return false; }
+ v = cell.textContent || cell.text;
+ rd[ts.p.colModel[k+gi+si+ni].name] = v;
+ });
+ } else {
+ for(i = 0; i < f.length;i++) {
+ v = $(f[i],xmlr).text();
+ rd[ts.p.colModel[i+gi+si+ni].name] = v;
+ }
+ }
+ rd[xmlid] = rid;
+ ts.p.data.push(rd);
+ rd = {};
+ ir++;
+ }
+ refreshIndex();
+ }
+ },
+ addJSONData = function(data,t, rcnt, more, adjust) {
+ var startReq = new Date();
+ if(data) {
+ if(ts.p.treeANode === -1 && !ts.p.scroll) {
+ emptyRows(t,false);
+ rcnt=1;
+ } else { rcnt = rcnt > 1 ? rcnt :1; }
+ } else { return; }
+
+ var dReader, locid, frd,
+ locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring";
+ if(locdata) { ts.p.data = []; ts.p._index = {}; locid = ts.p.localReader.id = "_id_";}
+ ts.p.reccount = 0;
+ if(ts.p.datatype == "local") {
+ dReader = ts.p.localReader;
+ frd= 'local';
+ } else {
+ dReader = ts.p.jsonReader;
+ frd='json';
+ }
+ var ir=0,v,i,j,row,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
+ ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0;
+ lp = $.jgrid.getAccessor(data,dReader.total);
+ ts.p.lastpage = lp === undefined ? 1 : lp;
+ ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
+ ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
+ if(!dReader.repeatitems) {
+ F = f = reader(frd);
+ }
+ if( ts.p.keyIndex===false ) {
+ idn = dReader.id;
+ } else {
+ idn = ts.p.keyIndex;
+ }
+ if(f.length>0 && !isNaN(idn)) {
+ if (ts.p.remapColumns && ts.p.remapColumns.length) {
+ idn = $.inArray(idn, ts.p.remapColumns);
+ }
+ idn=f[idn];
+ }
+ drows = $.jgrid.getAccessor(data,dReader.root);
+ if (!drows) { drows = []; }
+ len = drows.length; i=0;
+ var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?(parseInt(ts.p.page,10)-1)*rn+1:1, altr;
+ if (adjust) { rn *= adjust+1; }
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow="";
+ if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
+ hiderow = " style=\"display:none;\"";
+ }
+ while (i<len) {
+ cur = drows[i];
+ idr = $.jgrid.getAccessor(cur,idn);
+ if(idr === undefined) {
+ idr = br+i;
+ if(f.length===0){
+ if(dReader.cell){
+ var ccur = $.jgrid.getAccessor(cur,dReader.cell);
+ idr = ccur[idn] || idr;
+ ccur=null;
+ }
+ }
+ }
+ altr = rcnt === 1 ? 0 : rcnt;
+ cn1 = (altr+i)%2 == 1 ? cn : '';
+ rowData.push("<tr"+hiderow+" id=\""+ idr +"\" role=\"row\" class= \"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">");
+ if(ts.p.rownumbers===true) {
+ rowData.push( addRowNum(0,i,ts.p.page,ts.p.rowNum) );
+ ni=1;
+ }
+ if(ts.p.multiselect){
+ rowData.push( addMulti(idr,ni,i) );
+ gi = 1;
+ }
+ if (ts.p.subGrid) {
+ rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt) );
+ si= 1;
+ }
+ if (dReader.repeatitems) {
+ if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
+ if (!F) { F=orderedCols(gi+si+ni); }
+ }
+ for (j=0;j<F.length;j++) {
+ v = $.jgrid.getAccessor(cur,F[j]);
+ rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur) );
+ rd[ts.p.colModel[j+gi+si+ni].name] = v;
+ }
+ rowData.push( "</tr>" );
+ if(ts.p.grouping) {
+ var grlen = ts.p.groupingView.groupField.length, grpitem = [];
+ for(var z=0;z<grlen;z++) {
+ grpitem.push(rd[ts.p.groupingView.groupField[z]]);
+ }
+ grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
+ rowData = [];
+ }
+ if(locdata) { rd[locid] = idr; ts.p.data.push(rd); }
+ if(ts.p.gridview === false ) {
+ if( ts.p.treeGrid === true) {
+ fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
+ row = $(rowData.join(''))[0];
+ $(ts.rows[i+fpos]).after(row);
+ try {$(ts).jqGrid("setTreeNode",rd,row);} catch (e) {}
+ } else {
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
+ }
+ if(ts.p.subGrid === true ) {
+ try { $(ts).jqGrid("addSubGrid",ts.rows[ts.rows.length-1],gi+ni);} catch (_){}
+ }
+ if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
+ rowData=[];//ari=0;
+ }
+ rd={};
+ ir++;
+ i++;
+ if(ir==rn) { break; }
+ }
+ if(ts.p.gridview === true ) {
+ if(ts.p.grouping) {
+ $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
+ grpdata = null;
+ } else {
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
+ }
+ }
+ ts.p.totaltime = new Date() - startReq;
+ if(ir>0) {
+ if(ts.p.records===0) { ts.p.records=len; }
+ }
+ rowData = null;
+ if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
+ ts.p.reccount=ir;
+ ts.p.treeANode = -1;
+ if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
+ if(locdata) {
+ ts.p.records = len;
+ ts.p.lastpage = Math.ceil(len/ rn);
+ }
+ if (!more) { ts.updatepager(false,true); }
+ if(locdata) {
+ while (ir<len && drows[ir]) {
+ cur = drows[ir];
+ idr = $.jgrid.getAccessor(cur,idn);
+ if(idr === undefined) {
+ idr = br+ir;
+ if(f.length===0){
+ if(dReader.cell){
+ var ccur2 = $.jgrid.getAccessor(cur,dReader.cell);
+ idr = ccur2[idn] || idr;
+ ccur2=null;
+ }
+ }
+ }
+ if(cur) {
+ if (dReader.repeatitems) {
+ if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
+ if (!F) { F=orderedCols(gi+si+ni); }
+ }
+
+ for (j=0;j<F.length;j++) {
+ v = $.jgrid.getAccessor(cur,F[j]);
+ rd[ts.p.colModel[j+gi+si+ni].name] = v;
+ }
+ rd[locid] = idr;
+ ts.p.data.push(rd);
+ rd = {};
+ }
+ ir++;
+ }
+ refreshIndex();
+ }
+ },
+ addLocalData = function() {
+ var st, fndsort=false, cmtypes={}, grtypes=[], grindexes=[], srcformat, sorttype, newformat;
+ if(!$.isArray(ts.p.data)) {
+ return;
+ }
+ var grpview = ts.p.grouping ? ts.p.groupingView : false;
+ $.each(ts.p.colModel,function(i,v){
+ sorttype = this.sorttype || "text";
+ if(sorttype == "date" || sorttype == "datetime") {
+ if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') {
+ if(this.formatoptions && this.formatoptions.srcformat) {
+ srcformat = this.formatoptions.srcformat;
+ } else {
+ srcformat = $.jgrid.formatter.date.srcformat;
+ }
+ if(this.formatoptions && this.formatoptions.newformat) {
+ newformat = this.formatoptions.newformat;
+ } else {
+ newformat = $.jgrid.formatter.date.newformat;
+ }
+ } else {
+ srcformat = newformat = this.datefmt || "Y-m-d";
+ }
+ cmtypes[this.name] = {"stype": sorttype, "srcfmt": srcformat,"newfmt":newformat};
+ } else {
+ cmtypes[this.name] = {"stype": sorttype, "srcfmt":'',"newfmt":''};
+ }
+ if(ts.p.grouping && this.name == grpview.groupField[0]) {
+ var grindex = this.name;
+ if (typeof this.index != 'undefined') {
+ grindex = this.index;
+ }
+ grtypes[0] = cmtypes[grindex];
+ grindexes.push(grindex);
+ }
+ if(!fndsort && (this.index == ts.p.sortname || this.name == ts.p.sortname)){
+ st = this.name; // ???
+ fndsort = true;
+ }
+ });
+ if(ts.p.treeGrid) {
+ $(ts).jqGrid("SortTree", st, ts.p.sortorder, cmtypes[st].stype, cmtypes[st].srcfmt);
+ return;
+ }
+ var compareFnMap = {
+ 'eq':function(queryObj, op) {return queryObj.equals;},
+ 'ne':function(queryObj,op) {return queryObj.notEquals;},
+ 'lt':function(queryObj,op) {return queryObj.less;},
+ 'le':function(queryObj,op) {return queryObj.lessOrEquals;},
+ 'gt':function(queryObj,op) {return queryObj.greater;},
+ 'ge':function(queryObj,op) {return queryObj.greaterOrEquals;},
+ 'cn':function(queryObj,op) {return queryObj.contains;},
+ 'nc':function(queryObj,op) {return op === "OR" ? queryObj.orNot().contains : queryObj.andNot().contains;},
+ 'bw':function(queryObj,op) {return queryObj.startsWith;},
+ 'bn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().startsWith : queryObj.andNot().startsWith;},
+ 'en':function(queryObj,op) {return op === "OR" ? queryObj.orNot().endsWith : queryObj.andNot().endsWith;},
+ 'ew':function(queryObj,op) {return queryObj.endsWith;},
+ 'ni':function(queryObj,op) {return op === "OR" ? queryObj.orNot().equals : queryObj.andNot().equals;},
+ 'in':function(queryObj,op) {return queryObj.equals;},
+ 'nu':function(queryObj,op) {return queryObj.isNull;},
+ 'nn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().isNull : queryObj.andNot().isNull;}
+
+ },
+ query = $.jgrid.from(ts.p.data);
+ if (ts.p.ignoreCase) { query = query.ignoreCase(); }
+ function tojLinq ( group ) {
+ var s = 0, index, opr, rule;
+ if (group.groups !== undefined) {
+ for (index = 0; index < group.groups.length; index++) {
+ try {
+ tojLinq(group.groups[index]);
+ } catch (e) {alert(e);}
+ s++;
+ }
+ }
+ if (group.rules !== undefined) {
+ if(s>0) {
+ var result = query.select();
+ query = $.jgrid.from( result);
+ }
+ try{
+ for (index = 0; index < group.rules.length; index++) {
+ rule = group.rules[index];
+ opr = group.groupOp.toString().toUpperCase();
+ if (compareFnMap[rule.op] && rule.field ) {
+ if(s > 0 && opr && opr === "OR") {
+ query = query.or();
+ }
+ query = compareFnMap[rule.op](query, opr)(rule.field, rule.data, cmtypes[rule.field]);
+ }
+ s++;
+ }
+ } catch (g) {alert(g);}
+ }
+ }
+
+ if (ts.p.search === true) {
+ var srules = ts.p.postData.filters;
+ if(srules) {
+ if(typeof srules == "string") { srules = $.jgrid.parse(srules);}
+ tojLinq( srules );
+ } else {
+ try {
+ query = compareFnMap[ts.p.postData.searchOper](query)(ts.p.postData.searchField, ts.p.postData.searchString,cmtypes[ts.p.postData.searchField]);
+ } catch (se){}
+ }
+ }
+ if(ts.p.grouping) {
+ query.orderBy(grindexes,grpview.groupOrder[0],grtypes[0].stype, grtypes[0].srcfmt);
+ grpview.groupDataSorted = true;
+ }
+ if (st && ts.p.sortorder && fndsort) {
+ if(ts.p.sortorder.toUpperCase() == "DESC") {
+ query.orderBy(ts.p.sortname, "d", cmtypes[st].stype, cmtypes[st].srcfmt);
+ } else {
+ query.orderBy(ts.p.sortname, "a", cmtypes[st].stype, cmtypes[st].srcfmt);
+ }
+ }
+ var queryResults = query.select(),
+ recordsperpage = parseInt(ts.p.rowNum,10),
+ total = queryResults.length,
+ page = parseInt(ts.p.page,10),
+ totalpages = Math.ceil(total / recordsperpage),
+ retresult = {};
+ queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage );
+ query = null;
+ cmtypes = null;
+ retresult[ts.p.localReader.total] = totalpages;
+ retresult[ts.p.localReader.page] = page;
+ retresult[ts.p.localReader.records] = total;
+ retresult[ts.p.localReader.root] = queryResults;
+ queryResults = null;
+ return retresult;
+ },
+ updatepager = function(rn, dnd) {
+ var cp, last, base, from,to,tot,fmt, pgboxes = "";
+ base = parseInt(ts.p.page,10)-1;
+ if(base < 0) { base = 0; }
+ base = base*parseInt(ts.p.rowNum,10);
+ to = base + ts.p.reccount;
+ if (ts.p.scroll) {
+ var rows = $("tbody:first > tr:gt(0)", ts.grid.bDiv);
+ base = to - rows.length;
+ ts.p.reccount = rows.length;
+ var rh = rows.outerHeight() || ts.grid.prevRowHeight;
+ if (rh) {
+ var top = base * rh;
+ var height = parseInt(ts.p.records,10) * rh;
+ $(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"});
+ }
+ ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft;
+ }
+ pgboxes = ts.p.pager ? ts.p.pager : "";
+ pgboxes += ts.p.toppager ? (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
+ if(pgboxes) {
+ fmt = $.jgrid.formatter.integer || {};
+ cp = intNum(ts.p.page);
+ last = intNum(ts.p.lastpage);
+ $(".selbox",pgboxes).attr("disabled",false);
+ if(ts.p.pginput===true) {
+ $('.ui-pg-input',pgboxes).val(ts.p.page);
+ $('#sp_1',pgboxes).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);
+
+ }
+ if (ts.p.viewrecords){
+ if(ts.p.reccount === 0) {
+ $(".ui-paging-info",pgboxes).html(ts.p.emptyrecords);
+ } else {
+ from = base+1;
+ tot=ts.p.records;
+ if($.fmatter) {
+ from = $.fmatter.util.NumberFormat(from,fmt);
+ to = $.fmatter.util.NumberFormat(to,fmt);
+ tot = $.fmatter.util.NumberFormat(tot,fmt);
+ }
+ $(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot));
+ }
+ }
+ if(ts.p.pgbuttons===true) {
+ if(cp<=0) {cp = last = 0;}
+ if(cp==1 || cp === 0) {
+ $("#first, #prev",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
+ if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
+ } else {
+ $("#first, #prev",ts.p.pager).removeClass('ui-state-disabled');
+ if(ts.p.toppager) { $("#first_t, #prev_t",ts.p.toppager).removeClass('ui-state-disabled'); }
+ }
+ if(cp==last || cp === 0) {
+ $("#next, #last",ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
+ if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
+ } else {
+ $("#next, #last",ts.p.pager).removeClass('ui-state-disabled');
+ if(ts.p.toppager) { $("#next_t, #last_t",ts.p.toppager).removeClass('ui-state-disabled'); }
+ }
+ }
+ }
+ if(rn===true && ts.p.rownumbers === true) {
+ $("td.jqgrid-rownum",ts.rows).each(function(i){
+ $(this).html(base+1+i);
+ });
+ }
+ if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');}
+ if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);}
+ },
+ beginReq = function() {
+ ts.grid.hDiv.loading = true;
+ if(ts.p.hiddengrid) { return;}
+ switch(ts.p.loadui) {
+ case "disable":
+ break;
+ case "enable":
+ $("#load_"+$.jgrid.jqID(ts.p.id)).show();
+ break;
+ case "block":
+ $("#lui_"+$.jgrid.jqID(ts.p.id)).show();
+ $("#load_"+$.jgrid.jqID(ts.p.id)).show();
+ break;
+ }
+ },
+ endReq = function() {
+ ts.grid.hDiv.loading = false;
+ switch(ts.p.loadui) {
+ case "disable":
+ break;
+ case "enable":
+ $("#load_"+$.jgrid.jqID(ts.p.id)).hide();
+ break;
+ case "block":
+ $("#lui_"+$.jgrid.jqID(ts.p.id)).hide();
+ $("#load_"+$.jgrid.jqID(ts.p.id)).hide();
+ break;
+ }
+ },
+ populate = function (npage) {
+ if(!ts.grid.hDiv.loading) {
+ var pvis = ts.p.scroll && npage === false;
+ var prm = {}, dt, dstr, pN=ts.p.prmNames;
+ if(ts.p.page <=0) { ts.p.page = 1; }
+ if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();}
+ if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;}
+ if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;}
+ if(ts.p.rowTotal !== null && pN.totalrows !== null) { prm[pN.totalrows]= ts.p.rowTotal; }
+ var lc = ts.p.loadComplete;
+ var lcf = $.isFunction(lc);
+ if (!lcf) { lc = null; }
+ var adjust = 0;
+ npage = npage || 1;
+ if (npage > 1) {
+ if(pN.npage !== null) {
+ prm[pN.npage] = npage;
+ adjust = npage - 1;
+ npage = 1;
+ } else {
+ lc = function(req) {
+ ts.p.page++;
+ ts.grid.hDiv.loading = false;
+ if (lcf) {
+ ts.p.loadComplete.call(ts,req);
+ }
+ populate(npage-1);
+ };
+ }
+ } else if (pN.npage !== null) {
+ delete ts.p.postData[pN.npage];
+ }
+ if(ts.p.grouping) {
+ $(ts).jqGrid('groupingSetup');
+ if(ts.p.groupingView.groupDataSorted === true) {
+ prm[pN.sort] = ts.p.groupingView.groupField[0] +" "+ ts.p.groupingView.groupOrder[0]+", "+prm[pN.sort];
+ }
+ }
+ $.extend(ts.p.postData,prm);
+ var rcnt = !ts.p.scroll ? 1 : ts.rows.length-1;
+ if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
+ else if($.isFunction(ts.p.beforeRequest)) {ts.p.beforeRequest.call(ts);}
+ dt = ts.p.datatype.toLowerCase();
+ switch(dt)
+ {
+ case "json":
+ case "jsonp":
+ case "xml":
+ case "script":
+ $.ajax($.extend({
+ url:ts.p.url,
+ type:ts.p.mtype,
+ dataType: dt ,
+ data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
+ success:function(data,st) {
+ if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
+ else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
+ if(lc) { lc.call(ts,data); }
+ if (pvis) { ts.grid.populateVisible(); }
+ if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
+ data=null;
+ endReq();
+ },
+ error:function(xhr,st,err){
+ if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); }
+ endReq();
+ xhr=null;
+ },
+ beforeSend: function(xhr){
+ beginReq();
+ if($.isFunction(ts.p.loadBeforeSend)) { ts.p.loadBeforeSend.call(ts,xhr); }
+ }
+ },$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
+ break;
+ case "xmlstring":
+ beginReq();
+ dstr = $.jgrid.stringToDoc(ts.p.datastr);
+ addXmlData(dstr,ts.grid.bDiv);
+ if(lcf) {ts.p.loadComplete.call(ts,dstr);}
+ ts.p.datatype = "local";
+ ts.p.datastr = null;
+ endReq();
+ break;
+ case "jsonstring":
+ beginReq();
+ if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
+ else { dstr = ts.p.datastr; }
+ addJSONData(dstr,ts.grid.bDiv);
+ if(lcf) {ts.p.loadComplete.call(ts,dstr);}
+ ts.p.datatype = "local";
+ ts.p.datastr = null;
+ endReq();
+ break;
+ case "local":
+ case "clientside":
+ beginReq();
+ ts.p.datatype = "local";
+ var req = addLocalData();
+ addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust);
+ if(lc) { lc.call(ts,req); }
+ if (pvis) { ts.grid.populateVisible(); }
+ endReq();
+ break;
+ }
+ }
+ },
+ setPager = function (pgid, tp){
+ // TBD - consider escaping pgid with pgid = $.jgrid.jqID(pgid);
+ var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
+ pginp = "",
+ pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
+ str="", pgcnt, lft, cent, rgt, twd, tdw, i,
+ clearVals = function(onpaging){
+ var ret;
+ if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); }
+ ts.p.selrow = null;
+ if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
+ ts.p.savedRow = [];
+ if(ret=='stop') {return false;}
+ return true;
+ };
+ pgid = pgid.substr(1);
+ pgcnt = "pg_"+pgid;
+ lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right";
+ $("#"+$.jgrid.jqID(pgid) )
+ .append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>")
+ .attr("dir","ltr"); //explicit setting
+ if(ts.p.rowList.length >0){
+ str = "<td dir='"+dir+"'>";
+ str +="<select class='ui-pg-selbox' role='listbox'>";
+ for(i=0;i<ts.p.rowList.length;i++){
+ str +="<option role=\"option\" value=\""+ts.p.rowList[i]+"\""+((ts.p.rowNum == ts.p.rowList[i])?" selected=\"selected\"":"")+">"+ts.p.rowList[i]+"</option>";
+ }
+ str +="</select></td>";
+ }
+ if(dir=="rtl") { pgl += str; }
+ if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>";}
+ if(ts.p.pgbuttons===true) {
+ var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); }
+ pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";
+ pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";
+ pgl += pginp !== "" ? sep+pginp+sep:"";
+ pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";
+ pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>";
+ } else if (pginp !== "") { pgl += pginp; }
+ if(dir=="ltr") { pgl += str; }
+ pgl += "</tr></tbody></table>";
+ if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");}
+ $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);
+ tdw = $(".ui-jqgrid").css("font-size") || "11px";
+ $(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
+ twd = $(pgl).clone().appendTo("#testpg").width();
+ $("#testpg").remove();
+ if(twd > 0) {
+ if(pginp !== "") { twd += 50; } //should be param
+ $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd);
+ }
+ ts.p._nvtd = [];
+ ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3);
+ ts.p._nvtd[1] = 0;
+ pgl=null;
+ $('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
+ ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
+ ts.p.rowNum = this.value;
+ if(tp) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
+ else if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
+ if(!clearVals('records')) { return false; }
+ populate();
+ return false;
+ });
+ if(ts.p.pgbuttons===true) {
+ $(".ui-pg-button","#"+pgcnt).hover(function(e){
+ if($(this).hasClass('ui-state-disabled')) {
+ this.style.cursor='default';
+ } else {
+ $(this).addClass('ui-state-hover');
+ this.style.cursor='pointer';
+ }
+ },function(e) {
+ if($(this).hasClass('ui-state-disabled')) {
+ } else {
+ $(this).removeClass('ui-state-hover');
+ this.style.cursor= "default";
+ }
+ });
+ $("#first"+tp+", #prev"+tp+", #next"+tp+", #last"+tp,"#"+pgid).click( function(e) {
+ var cp = intNum(ts.p.page,1),
+ last = intNum(ts.p.lastpage,1), selclick = false,
+ fp=true, pp=true, np=true,lp=true;
+ if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; }
+ else if( last>1 && cp >=1) {
+ if( cp === 1) { fp=false; pp=false; }
+ else if( cp>1 && cp <last){ }
+ else if( cp===last){ np=false;lp=false; }
+ } else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
+ if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;}
+ if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;}
+ if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;}
+ if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
+ if(selclick) {
+ if(!clearVals(this.id)) { return false; }
+ populate();
+ }
+ return false;
+ });
+ }
+ if(ts.p.pginput===true) {
+ $('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
+ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+ if(key == 13) {
+ ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
+ if(!clearVals('user')) { return false; }
+ populate();
+ return false;
+ }
+ return this;
+ });
+ }
+ },
+ sortData = function (index, idxcol,reload,sor){
+ if(!ts.p.colModel[idxcol].sortable) { return; }
+ var so;
+ if(ts.p.savedRow.length > 0) {return;}
+ if(!reload) {
+ if( ts.p.lastsort == idxcol ) {
+ if( ts.p.sortorder == 'asc') {
+ ts.p.sortorder = 'desc';
+ } else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';}
+ } else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; }
+ ts.p.page = 1;
+ }
+ if(sor) {
+ if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
+ else { ts.p.sortorder = sor; }
+ }
+ var thd= $("thead:first",ts.grid.hDiv).get(0);
+ $("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass('ui-state-disabled');
+ $("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");
+ $("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass('ui-state-disabled');
+ $("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");
+ if(!ts.p.viewsortcols[0]) {
+ if(ts.p.lastsort != idxcol) {
+ $("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();
+ $("tr th:eq("+idxcol+") span.s-ico",thd).show();
+ }
+ }
+ index = index.substring(5);
+ ts.p.sortname = ts.p.colModel[idxcol].index || index;
+ so = ts.p.sortorder;
+ if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}}
+ if(ts.p.datatype == "local") {
+ if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");}
+ } else {
+ ts.p.selrow = null;
+ if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
+ ts.p.selarrrow =[];
+ ts.p.savedRow =[];
+ }
+ if(ts.p.scroll) {
+ var sscroll = ts.grid.bDiv.scrollLeft;
+ emptyRows(ts.grid.bDiv,true);
+ ts.grid.hDiv.scrollLeft = sscroll;
+ }
+ if(ts.p.subGrid && ts.p.datatype=='local') {
+ $("td.sgexpanded","#"+$.jgrid.jqID(ts.p.id)).each(function(){
+ $(this).trigger("click");
+ });
+ }
+ populate();
+ ts.p.lastsort = idxcol;
+ if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
+ },
+ setColWidth = function () {
+ var initwidth = 0, brd=ts.p.cellLayout, vc=0, lvc, scw=ts.p.scrollOffset,cw,hs=false,aw,tw=0,gw=0,
+ cl = 0, cr;
+ if (isSafari) { brd=0; }
+ $.each(ts.p.colModel, function(i) {
+ if(typeof this.hidden === 'undefined') {this.hidden=false;}
+ if(this.hidden===false){
+ initwidth += intNum(this.width,0);
+ if(this.fixed) {
+ tw += this.width;
+ gw += this.width+brd;
+ } else {
+ vc++;
+ }
+ cl++;
+ }
+ });
+ if (ts.p.shrinkToFit === false) {initwidth += brd*cl;}
+ if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;}
+ else { grid.width = ts.p.width;}
+ ts.p.tblwidth = initwidth;
+ if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;}
+ if(ts.p.shrinkToFit===true && vc > 0) {
+ aw = grid.width-brd*vc-gw;
+ if(isNaN(ts.p.height)) {
+ } else {
+ aw -= scw;
+ hs = true;
+ }
+ initwidth =0;
+ $.each(ts.p.colModel, function(i) {
+ if(this.hidden === false && !this.fixed){
+ cw = Math.round(aw*this.width/(ts.p.tblwidth-tw));
+ this.width =cw;
+ initwidth += cw;
+ lvc = i;
+ }
+ });
+ cr =0;
+ if (hs) {
+ if(grid.width-gw-(initwidth+brd*vc) !== scw){
+ cr = grid.width-gw-(initwidth+brd*vc)-scw;
+ }
+ } else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) {
+ cr = grid.width-gw-(initwidth+brd*vc);
+ }
+ ts.p.colModel[lvc].width += cr;
+ ts.p.tblwidth = initwidth+cr+tw+cl*brd;
+ if(ts.p.tblwidth > ts.p.width) {
+ ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10));
+ ts.p.tblwidth = ts.p.width;
+ }
+ }
+ },
+ nextVisible= function(iCol) {
+ var ret = iCol, j=iCol, i;
+ for (i = iCol+1;i<ts.p.colModel.length;i++){
+ if(ts.p.colModel[i].hidden !== true ) {
+ j=i; break;
+ }
+ }
+ return j-ret;
+ },
+ getOffset = function (iCol) {
+ var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout;
+ ret[0] = ret[1] = ret[2] = 0;
+ for(i=0;i<=iCol;i++){
+ if(ts.p.colModel[i].hidden === false ) {
+ ret[0] += ts.p.colModel[i].width+brd1;
+ }
+ }
+ if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; }
+ ret[0] = ret[0] - ts.grid.bDiv.scrollLeft;
+ if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);}
+ if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);}
+ if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);}
+ ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height();
+ return ret;
+ };
+ this.p.id = this.id;
+ if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;}
+ ts.p.keyIndex=false;
+ for (i=0; i<ts.p.colModel.length;i++) {
+ ts.p.colModel[i] = $.extend({}, ts.p.cmTemplate, ts.p.colModel[i].template || {}, ts.p.colModel[i]);
+ if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) {
+ ts.p.keyIndex = i;
+ }
+ }
+ ts.p.sortorder = ts.p.sortorder.toLowerCase();
+ if(ts.p.grouping===true) {
+ ts.p.scroll = false;
+ ts.p.rownumbers = false;
+ ts.p.subGrid = false;
+ ts.p.treeGrid = false;
+ ts.p.gridview = true;
+ }
+ if(this.p.treeGrid === true) {
+ try { $(this).jqGrid("setTreeGrid");} catch (_) {}
+ if(ts.p.datatype != "local") { ts.p.localReader = {id: "_id_"}; }
+ }
+ if(this.p.subGrid) {
+ try { $(ts).jqGrid("setSubGrid");} catch (s){}
+ }
+ if(this.p.multiselect) {
+ this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
+ this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
+ }
+ if(this.p.rownumbers) {
+ this.p.colNames.unshift("");
+ this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
+ }
+ ts.p.xmlReader = $.extend(true,{
+ root: "rows",
+ row: "row",
+ page: "rows>page",
+ total: "rows>total",
+ records : "rows>records",
+ repeatitems: true,
+ cell: "cell",
+ id: "[id]",
+ userdata: "userdata",
+ subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"}
+ }, ts.p.xmlReader);
+ ts.p.jsonReader = $.extend(true,{
+ root: "rows",
+ page: "page",
+ total: "total",
+ records: "records",
+ repeatitems: true,
+ cell: "cell",
+ id: "id",
+ userdata: "userdata",
+ subgrid: {root:"rows", repeatitems: true, cell:"cell"}
+ },ts.p.jsonReader);
+ ts.p.localReader = $.extend(true,{
+ root: "rows",
+ page: "page",
+ total: "total",
+ records: "records",
+ repeatitems: false,
+ cell: "cell",
+ id: "id",
+ userdata: "userdata",
+ subgrid: {root:"rows", repeatitems: true, cell:"cell"}
+ },ts.p.localReader);
+ if(ts.p.scroll){
+ ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[];
+ }
+ if(ts.p.data.length) { refreshIndex(); }
+ var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
+ tdc, idn, w, res, sort,
+ td, ptr, tbody, imgs,iac="",idc="";
+ if(ts.p.shrinkToFit===true && ts.p.forceFit===true) {
+ for (i=ts.p.colModel.length-1;i>=0;i--){
+ if(!ts.p.colModel[i].hidden) {
+ ts.p.colModel[i].resizable=false;
+ break;
+ }
+ }
+ }
+ if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";}
+ tdc = isMSIE ? "class='ui-th-div-ie'" :"";
+ imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";
+ imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";
+ for(i=0;i<this.p.colNames.length;i++){
+ var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :"";
+ thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">";
+ idn = ts.p.colModel[i].index || ts.p.colModel[i].name;
+ thead += "<div id='jqgh_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
+ if(!ts.p.colModel[i].width) { ts.p.colModel[i].width = 150; }
+ else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
+ if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
+ if (idn == ts.p.sortname) {
+ ts.p.lastsort = i;
+ }
+ thead += imgs+"</div></th>";
+ }
+ thead += "</tr></thead>";
+ imgs = null;
+ $(this).append(thead);
+ $("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');});
+ if(this.p.multiselect) {
+ var emp=[], chk;
+ $('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){
+ ts.p.selarrrow = [];
+ if (this.checked) {
+ $("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked","checked");
+ $(ts.rows).each(function(i) {
+ if ( i>0 ) {
+ if(!$(this).hasClass("subgrid") && !$(this).hasClass("jqgroup")){
+ $(this).addClass("ui-state-highlight").attr("aria-selected","true");
+ ts.p.selarrrow.push(this.id);
+ ts.p.selrow = this.id;
+ }
+ }
+ });
+ chk=true;
+ emp=[];
+ }
+ else {
+ $("[id^=jqg_"+ts.p.id+"_"+"]").removeAttr("checked");
+ $(ts.rows).each(function(i) {
+ if(i>0) {
+ if(!$(this).hasClass("subgrid")){
+ $(this).removeClass("ui-state-highlight").attr("aria-selected","false");
+ emp.push(this.id);
+ }
+ }
+ });
+ ts.p.selrow = null;
+ chk=false;
+ }
+ if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);}
+ });
+ }
+
+ if(ts.p.autowidth===true) {
+ var pw = $(eg).innerWidth();
+ ts.p.width = pw > 0? pw: 'nw';
+ }
+ setColWidth();
+ $(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'> </div>");
+ $(gv).css("width",grid.width+"px");
+ thead = $("thead:first",ts).get(0);
+ var tfoot = "";
+ if(ts.p.footerrow) { tfoot += "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>"; }
+ var thr = $("tr:first",thead),
+ firstr = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
+ ts.p.disableClick=false;
+ $("th",thr).each(function ( j ) {
+ w = ts.p.colModel[j].width;
+ if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
+ if(ts.p.colModel[j].resizable){
+ res = document.createElement("span");
+ $(res).html(" ").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
+ if(!$.browser.opera) { $(res).css("cursor","col-resize"); }
+ $(this).addClass(ts.p.resizeclass);
+ } else {
+ res = "";
+ }
+ $(this).css("width",w+"px").prepend(res);
+ var hdcol = "";
+ if( ts.p.colModel[j].hidden ) {
+ $(this).css("display","none");
+ hdcol = "display:none;";
+ }
+ firstr += "<td role='gridcell' style='height:0px;width:"+w+"px;"+hdcol+"'></td>";
+ grid.headers[j] = { width: w, el: this };
+ sort = ts.p.colModel[j].sortable;
+ if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;}
+ var nm = ts.p.colModel[j].name;
+ if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
+ if(ts.p.viewsortcols[2]){
+ $("div",this).addClass('ui-jqgrid-sortable');
+ }
+ }
+ if(sort) {
+ if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}}
+ else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}
+ }
+ if(ts.p.footerrow) { tfoot += "<td role='gridcell' "+formatCol(j,0,'', null, '', false)+"> </td>"; }
+ }).mousedown(function(e) {
+ if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; }
+ var ci = $.jgrid.getCellIndex(this);
+ if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);}
+ grid.dragStart(ci, e, getOffset(ci));
+ return false;
+ }).click(function(e) {
+ if (ts.p.disableClick) {
+ ts.p.disableClick = false;
+ return false;
+ }
+ var s = "th>div.ui-jqgrid-sortable",r,d;
+ if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; }
+ var t = $(e.target).closest(s);
+ if (t.length != 1) { return; }
+ var ci = $.jgrid.getCellIndex(this);
+ if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); }
+ sortData( $('div',this)[0].id, ci, r, d);
+ return false;
+ });
+ if (ts.p.sortable && $.fn.sortable) {
+ try {
+ $(ts).jqGrid("sortableColumns", thr);
+ } catch (e){}
+ }
+ if(ts.p.footerrow) { tfoot += "</tr></tbody></table>"; }
+ firstr += "</tr>";
+ tbody = document.createElement("tbody");
+ this.appendChild(tbody);
+ $(this).addClass('ui-jqgrid-btable').append(firstr);
+ firstr = null;
+ var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),
+ hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false,
+ hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>");
+ thead = null;
+ grid.hDiv = document.createElement("div");
+ $(grid.hDiv)
+ .css({ width: grid.width+"px"})
+ .addClass("ui-state-default ui-jqgrid-hdiv")
+ .append(hb);
+ $(hb).append(hTable);
+ hTable = null;
+ if(hg) { $(grid.hDiv).hide(); }
+ if(ts.p.pager){
+ // TBD -- escape ts.p.pager here?
+ if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
+ else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
+ $(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
+ if(hg) {$(ts.p.pager).hide();}
+ setPager(ts.p.pager,'');
+ }
+ if( ts.p.cellEdit === false && ts.p.hoverrows === true) {
+ $(ts).bind('mouseover',function(e) {
+ ptr = $(e.target).closest("tr.jqgrow");
+ if($(ptr).attr("class") !== "subgrid") {
+ $(ptr).addClass("ui-state-hover");
+ }
+ return false;
+ }).bind('mouseout',function(e) {
+ ptr = $(e.target).closest("tr.jqgrow");
+ $(ptr).removeClass("ui-state-hover");
+ return false;
+ });
+ }
+ var ri,ci;
+ $(ts).before(grid.hDiv).click(function(e) {
+ td = e.target;
+ var scb = $(td).hasClass("cbox");
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
+ if($(ptr).length === 0 ) {
+ return this;
+ }
+ var cSel = true;
+ if($.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); }
+ if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return this; }
+ if(cSel === true) {
+ if(ts.p.cellEdit === true) {
+ if(ts.p.multiselect && scb){
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
+ } else {
+ ri = ptr[0].rowIndex;
+ ci = $.jgrid.getCellIndex(td);
+ try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}
+ }
+ } else if ( !ts.p.multikey ) {
+ if(ts.p.multiselect && ts.p.multiboxonly) {
+ if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true);}
+ else {
+ $(ts.p.selarrrow).each(function(i,n){
+ var ind = ts.rows.namedItem(n);
+ $(ind).removeClass("ui-state-highlight");
+ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(n)).attr("checked",false);
+ });
+ ts.p.selarrrow = [];
+ $("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
+ }
+ } else {
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
+ }
+ } else {
+ if(e[ts.p.multikey]) {
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
+ } else if(ts.p.multiselect && scb) {
+ scb = $("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked");
+ $("[id^=jqg_"+ts.p.id+"_"+"]").attr("checked",!scb);
+ }
+ }
+ if($.isFunction(ts.p.onCellSelect)) {
+ ri = ptr[0].id;
+ ci = $.jgrid.getCellIndex(td);
+ ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e);
+ }
+ e.stopPropagation();
+ } else {
+ return this;
+ }
+ }).bind('reloadGrid', function(e,opts) {
+ if(ts.p.treeGrid ===true) { ts.p.datatype = ts.p.treedatatype;}
+ if (opts && opts.current) {
+ ts.grid.selectionPreserver(ts);
+ }
+ if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection"); if(ts.p.data.length) { refreshIndex();} }
+ else if(!ts.p.treeGrid) {
+ ts.p.selrow=null;
+ if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
+ ts.p.savedRow = [];
+ }
+ if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true);}
+ if (opts && opts.page) {
+ var page = opts.page;
+ if (page > ts.p.lastpage) { page = ts.p.lastpage; }
+ if (page < 1) { page = 1; }
+ ts.p.page = page;
+ if (ts.grid.prevRowHeight) {
+ ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum;
+ } else {
+ ts.grid.bDiv.scrollTop = 0;
+ }
+ }
+ if (ts.grid.prevRowHeight && ts.p.scroll) {
+ delete ts.p.lastpage;
+ ts.grid.populateVisible();
+ } else {
+ ts.grid.populate();
+ }
+ return false;
+ });
+ if( $.isFunction(this.p.ondblClickRow) ) {
+ $(this).dblclick(function(e) {
+ td = e.target;
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
+ if($(ptr).length === 0 ){return false;}
+ ri = ptr[0].rowIndex;
+ ci = $.jgrid.getCellIndex(td);
+ ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
+ return false;
+ });
+ }
+ if ($.isFunction(this.p.onRightClickRow)) {
+ $(this).bind('contextmenu', function(e) {
+ td = e.target;
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
+ if($(ptr).length === 0 ){return false;}
+ if(!ts.p.multiselect) { $(ts).jqGrid("setSelection",ptr[0].id,true); }
+ ri = ptr[0].rowIndex;
+ ci = $.jgrid.getCellIndex(td);
+ ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
+ return false;
+ });
+ }
+ grid.bDiv = document.createElement("div");
+ $(grid.bDiv)
+ .append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this))
+ .addClass("ui-jqgrid-bdiv")
+ .css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"})
+ .scroll(grid.scrollGrid);
+ $("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});
+ if( isMSIE ) {
+ if( $("tbody",this).size() == 2 ) { $("tbody:gt(0)",this).remove();}
+ if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});}
+ } else {
+ if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});}
+ }
+ if(hg) {$(grid.bDiv).hide();}
+ grid.cDiv = document.createElement("div");
+ var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover(
+ function(){ arf.addClass('ui-state-hover');},
+ function() {arf.removeClass('ui-state-hover');})
+ .append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : "";
+ $(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>")
+ .addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
+ $(grid.cDiv).insertBefore(grid.hDiv);
+ if( ts.p.toolbar[0] ) {
+ grid.uDiv = document.createElement("div");
+ if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
+ else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);}
+ if(ts.p.toolbar[1]=="both") {
+ grid.ubDiv = document.createElement("div");
+ $(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
+ $(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);
+ if(hg) {$(grid.ubDiv).hide();}
+ } else {
+ $(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
+ }
+ if(hg) {$(grid.uDiv).hide();}
+ }
+ if(ts.p.toppager) {
+ ts.p.toppager = $.jgrid.jqID(ts.p.id)+"_toppager";
+ grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0];
+ ts.p.toppager = "#"+ts.p.toppager;
+ $(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width);
+ setPager(ts.p.toppager,'_t');
+ }
+ if(ts.p.footerrow) {
+ grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0];
+ hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");
+ $(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);
+ $(hb).append(tfoot);
+ grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;
+ if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; }
+ if(hg) {$(grid.sDiv).hide();}
+ }
+ hb = null;
+ if(ts.p.caption) {
+ var tdt = ts.p.datatype;
+ if(ts.p.hidegrid===true) {
+ $(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){
+ var onHdCl = $.isFunction(ts.p.onHeaderClick),
+ elems = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
+ counter, self = this;
+ if(ts.p.toolbar[0]===true) {
+ if( ts.p.toolbar[1]=='both') {
+ elems += ', #' + $(grid.ubDiv).attr('id');
+ }
+ elems += ', #' + $(grid.uDiv).attr('id');
+ }
+ counter = $(elems,"#gview_"+$.jgrid.jqID(ts.p.id)).length;
+
+ if(ts.p.gridstate == 'visible') {
+ $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideUp("fast", function() {
+ counter--;
+ if (counter === 0) {
+ $("span",self).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
+ ts.p.gridstate = 'hidden';
+ if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).hide(); }
+ if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
+ }
+ });
+ } else if(ts.p.gridstate == 'hidden'){
+ $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideDown("fast", function() {
+ counter--;
+ if (counter === 0) {
+ $("span",self).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
+ if(hg) {ts.p.datatype = tdt;populate();hg=false;}
+ ts.p.gridstate = 'visible';
+ if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).show(); }
+ if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
+ }
+ });
+ }
+ return false;
+ });
+ if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");}
+ }
+ } else {$(grid.cDiv).hide();}
+ $(grid.hDiv).after(grid.bDiv)
+ .mousemove(function (e) {
+ if(grid.resizing){grid.dragMove(e);return false;}
+ });
+ $(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; });
+ $(document).mouseup(function (e) {
+ if(grid.resizing) { grid.dragEnd(); return false;}
+ return true;
+ });
+ ts.formatCol = formatCol;
+ ts.sortData = sortData;
+ ts.updatepager = updatepager;
+ ts.refreshIndex = refreshIndex;
+ ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);};
+ $.extend(grid,{populate : populate, emptyRows: emptyRows});
+ this.grid = grid;
+ ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);};
+ ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);};
+ this.grid.cols = this.rows[0].cells;
+
+ populate();ts.p.hiddengrid=false;
+ $(window).unload(function () {
+ ts = null;
+ });
+ });
+};
+$.jgrid.extend({
+ getGridParam : function(pName) {
+ var $t = this[0];
+ if (!$t || !$t.grid) {return;}
+ if (!pName) { return $t.p; }
+ else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
+ },
+ setGridParam : function (newParams){
+ return this.each(function(){
+ if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
+ });
+ },
+ getDataIDs : function () {
+ var ids=[], i=0, len, j=0;
+ this.each(function(){
+ len = this.rows.length;
+ if(len && len>0){
+ while(i<len) {
+ if($(this.rows[i]).hasClass('jqgrow')) {
+ ids[j] = this.rows[i].id;
+ j++;
+ }
+ i++;
+ }
+ }
+ });
+ return ids;
+ },
+ setSelection : function(selection,onsr) {
+ return this.each(function(){
+ var $t = this, stat,pt, ner, ia, tpsr;
+ if(selection === undefined) { return; }
+ onsr = onsr === false ? false : true;
+ pt=$t.rows.namedItem(selection+"");
+ if(!pt) { return; }
+ function scrGrid(iR){
+ var ch = $($t.grid.bDiv)[0].clientHeight,
+ st = $($t.grid.bDiv)[0].scrollTop,
+ rpos = $t.rows[iR].offsetTop,
+ rh = $t.rows[iR].clientHeight;
+ if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; }
+ else if(rpos < ch+st) {
+ if(rpos < st) {
+ $($t.grid.bDiv)[0].scrollTop = rpos;
+ }
+ }
+ }
+ if($t.p.scrollrows===true) {
+ ner = $t.rows.namedItem(selection).rowIndex;
+ if(ner >=0 ){
+ scrGrid(ner);
+ }
+ }
+ if(!$t.p.multiselect) {
+ if(pt.className !== "ui-subgrid") {
+ if( $t.p.selrow ) {
+ $($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
+ }
+ if( $t.p.selrow != pt.id) {
+ $t.p.selrow = pt.id;
+ $(pt).addClass("ui-state-highlight").attr("aria-selected","true");
+ stat = true;
+ } else {
+ stat = false;
+ $t.p.selrow = null;
+ }
+ if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id, stat); }
+ }
+ } else {
+ $t.p.selrow = pt.id;
+ ia = $.inArray($t.p.selrow,$t.p.selarrrow);
+ if ( ia === -1 ){
+ if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
+ stat = true;
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
+ $t.p.selarrrow.push($t.p.selrow);
+ } else {
+ if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
+ stat = false;
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
+ $t.p.selarrrow.splice(ia,1);
+ tpsr = $t.p.selarrrow[0];
+ $t.p.selrow = (tpsr === undefined) ? null : tpsr;
+ }
+ if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id , stat); }
+ }
+ });
+ },
+ resetSelection : function(){
+ return this.each(function(){
+ var t = this, ind;
+ if(!t.p.multiselect) {
+ if(t.p.selrow) {
+ $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
+ t.p.selrow = null;
+ }
+ } else {
+ $(t.p.selarrrow).each(function(i,n){
+ ind = t.rows.namedItem(n);
+ $(ind).removeClass("ui-state-highlight").attr("aria-selected","false");
+ $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(n)).attr("checked",false);
+ });
+ $("#cb_"+$.jgrid.jqID(t.p.id)).attr("checked",false);
+ t.p.selarrrow = [];
+ }
+ t.p.savedRow = [];
+ });
+ },
+ getRowData : function( rowid ) {
+ var res = {}, resall, getall=false, len, j=0;
+ this.each(function(){
+ var $t = this,nm,ind;
+ if(typeof(rowid) == 'undefined') {
+ getall = true;
+ resall = [];
+ len = $t.rows.length;
+ } else {
+ ind = $t.rows.namedItem(rowid);
+ if(!ind) { return res; }
+ len = 2;
+ }
+ while(j<len){
+ if(getall) { ind = $t.rows[j]; }
+ if( $(ind).hasClass('jqgrow') ) {
+ $('td',ind).each( function(i) {
+ nm = $t.p.colModel[i].name;
+ if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
+ if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
+ res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
+ } else {
+ try {
+ res[nm] = $.unformat(this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
+ } catch (e){
+ res[nm] = $.jgrid.htmlDecode($(this).html());
+ }
+ }
+ }
+ });
+ if(getall) { resall.push(res); res={}; }
+ }
+ j++;
+ }
+ });
+ return resall ? resall: res;
+ },
+ delRowData : function(rowid) {
+ var success = false, rowInd, ia, ri;
+ this.each(function() {
+ var $t = this;
+ rowInd = $t.rows.namedItem(rowid);
+ if(!rowInd) {return false;}
+ else {
+ ri = rowInd.rowIndex;
+ $(rowInd).remove();
+ $t.p.records--;
+ $t.p.reccount--;
+ $t.updatepager(true,false);
+ success=true;
+ if($t.p.multiselect) {
+ ia = $.inArray(rowid,$t.p.selarrrow);
+ if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
+ }
+ if(rowid == $t.p.selrow) {$t.p.selrow=null;}
+ }
+ if($t.p.datatype == 'local') {
+ var pos = $t.p._index[rowid];
+ if(typeof(pos) != 'undefined') {
+ $t.p.data.splice(pos,1);
+ $t.refreshIndex();
+ }
+ }
+ if( $t.p.altRows === true && success ) {
+ var cn = $t.p.altclass;
+ $($t.rows).each(function(i){
+ if(i % 2 ==1) { $(this).addClass(cn); }
+ else { $(this).removeClass(cn); }
+ });
+ }
+ });
+ return success;
+ },
+ setRowData : function(rowid, data, cssp) {
+ var nm, success=true, title;
+ this.each(function(){
+ if(!this.grid) {return false;}
+ var t = this, vl, ind, cp = typeof cssp, lcdata={};
+ ind = t.rows.namedItem(rowid);
+ if(!ind) { return false; }
+ if( data ) {
+ try {
+ $(this.p.colModel).each(function(i){
+ nm = this.name;
+ if( data[nm] !== undefined) {
+ lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date(data[nm],this) : data[nm];
+ vl = t.formatter( rowid, data[nm], i, data, 'edit');
+ title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
+ if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
+ $("td:eq("+i+") > span:first",ind).html(vl).attr(title);
+ } else {
+ $("td:eq("+i+")",ind).html(vl).attr(title);
+ }
+ }
+ });
+ if(t.p.datatype == 'local') {
+ var pos = t.p._index[rowid];
+ if(typeof(pos) != 'undefined') {
+ t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata);
+ }
+ lcdata = null;
+ }
+ } catch (e) {
+ success = false;
+ }
+ }
+ if(success) {
+ if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);}
+ }
+ });
+ return success;
+ },
+ addRowData : function(rowid,rdata,pos,src) {
+ if(!pos) {pos = "last";}
+ var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data, cm;
+ if(rdata) {
+ if($.isArray(rdata)) {
+ aradd=true;
+ pos = "last";
+ cnm = rowid;
+ } else {
+ rdata = [rdata];
+ aradd = false;
+ }
+ this.each(function() {
+ var t = this, datalen = rdata.length;
+ ni = t.p.rownumbers===true ? 1 :0;
+ gi = t.p.multiselect ===true ? 1 :0;
+ si = t.p.subGrid===true ? 1 :0;
+ if(!aradd) {
+ if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
+ else {
+ rowid = (t.p.records+1)+"";
+ if(t.p.keyIndex !== false) {
+ cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
+ if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
+ }
+ }
+ }
+ cn = t.p.altclass;
+ var k = 0, cna ="", lcdata = {},
+ air = $.isFunction(t.p.afterInsertRow) ? true : false;
+ while(k < datalen) {
+ data = rdata[k];
+ row="";
+ if(aradd) {
+ try {rowid = data[cnm];}
+ catch (e) {rowid = (t.p.records+1)+"";}
+ cna = t.p.altRows === true ? (t.rows.length-1)%2 === 0 ? cn : "" : "";
+ }
+ if(ni){
+ prp = t.formatCol(0,1,'',null,rowid, true);
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>";
+ }
+ if(gi) {
+ v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+t.p.id+"_"+rowid+"\" class=\"cbox\"/>";
+ prp = t.formatCol(ni,1,'', null, rowid, true);
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>";
+ }
+ if(si) {
+ row += $(t).jqGrid("addSubGridCell",gi+ni,1);
+ }
+ for(i = gi+si+ni; i < t.p.colModel.length;i++){
+ cm = t.p.colModel[i];
+ nm = cm.name;
+ lcdata[nm] = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(data[nm],cm) : data[nm];
+ v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, 'edit');
+ prp = t.formatCol(i,1,v, rowid, data, true);
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>";
+ }
+ row = "<tr id=\""+rowid+"\" role=\"row\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>";
+ if(t.p.subGrid===true) {
+ row = $(row)[0];
+ $(t).jqGrid("addSubGrid",row,gi+ni);
+ }
+ if(t.rows.length === 0){
+ $("table:first",t.grid.bDiv).append(row);
+ } else {
+ switch (pos) {
+ case 'last':
+ $(t.rows[t.rows.length-1]).after(row);
+ break;
+ case 'first':
+ $(t.rows[0]).after(row);
+ break;
+ case 'after':
+ sind = t.rows.namedItem(src);
+ if (sind) {
+ if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); }
+ else { $(sind).after(row); }
+ }
+ break;
+ case 'before':
+ sind = t.rows.namedItem(src);
+ if(sind) {$(sind).before(row);sind=sind.rowIndex;}
+ break;
+ }
+ }
+ t.p.records++;
+ t.p.reccount++;
+ if(air) { t.p.afterInsertRow.call(t,rowid,data,data); }
+ k++;
+ if(t.p.datatype == 'local') {
+ t.p._index[rowid] = t.p.data.length;
+ t.p.data.push(lcdata);
+ lcdata = {};
+ }
+ }
+ if( t.p.altRows === true && !aradd) {
+ if (pos == "last") {
+ if ((t.rows.length-1)%2 == 1) {$(t.rows[t.rows.length-1]).addClass(cn);}
+ } else {
+ $(t.rows).each(function(i){
+ if(i % 2 ==1) { $(this).addClass(cn); }
+ else { $(this).removeClass(cn); }
+ });
+ }
+ }
+ t.updatepager(true,true);
+ success = true;
+ });
+ }
+ return success;
+ },
+ footerData : function(action,data, format) {
+ var nm, success=false, res={}, title;
+ function isEmpty(obj) {
+ for(var i in obj) {
+ if (obj.hasOwnProperty(i)) { return false; }
+ }
+ return true;
+ }
+ if(typeof(action) == "undefined") { action = "get"; }
+ if(typeof(format) != "boolean") { format = true; }
+ action = action.toLowerCase();
+ this.each(function(){
+ var t = this, vl;
+ if(!t.grid || !t.p.footerrow) {return false;}
+ if(action == "set") { if(isEmpty(data)) { return false; } }
+ success=true;
+ $(this.p.colModel).each(function(i){
+ nm = this.name;
+ if(action == "set") {
+ if( data[nm] !== undefined) {
+ vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm];
+ title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
+ $("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title);
+ success = true;
+ }
+ } else if(action == "get") {
+ res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html();
+ }
+ });
+ });
+ return action == "get" ? res : success;
+ },
+ ShowHideCol : function(colname,show) {
+ return this.each(function() {
+ var $t = this, fndh=false;
+ if (!$t.grid ) {return;}
+ if( typeof colname === 'string') {colname=[colname];}
+ show = show != "none" ? "" : "none";
+ var sw = show === "" ? true :false;
+ $(this.p.colModel).each(function(i) {
+ if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) {
+ $("tr",$t.grid.hDiv).each(function(){
+ $(this).children("th:eq("+i+")").css("display",show);
+ });
+ $($t.rows).each(function(j){
+ $(this).children("td:eq("+i+")").css("display",show);
+ });
+ if($t.p.footerrow) { $($t.grid.sDiv).children("td:eq("+i+")").css("display", show); }
+ if(show == "none") { $t.p.tblwidth -= this.width+$t.p.cellLayout;} else {$t.p.tblwidth += this.width;}
+ this.hidden = !sw;
+ fndh=true;
+ }
+ });
+ if(fndh===true) {
+ $("table:first",$t.grid.hDiv).width($t.p.tblwidth);
+ $("table:first",$t.grid.bDiv).width($t.p.tblwidth);
+ $t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
+ if($t.p.footerrow) {
+ $("table:first",$t.grid.sDiv).width($t.p.tblwidth);
+ $t.grid.sDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
+ }
+ if($t.p.shrinkToFit===true) {
+ $($t).jqGrid("setGridWidth",$t.grid.width-0.001,true);
+ }
+ }
+ });
+ },
+ hideCol : function (colname) {
+ return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"none");});
+ },
+ showCol : function(colname) {
+ return this.each(function(){$(this).jqGrid("ShowHideCol",colname,"");});
+ },
+ remapColumns : function(permutation, updateCells, keepHeader)
+ {
+ function resortArray(a) {
+ var ac;
+ if (a.length) {
+ ac = $.makeArray(a);
+ } else {
+ ac = $.extend({}, a);
+ }
+ $.each(permutation, function(i) {
+ a[i] = ac[this];
+ });
+ }
+ var ts = this.get(0);
+ function resortRows(parent, clobj) {
+ $(">tr"+(clobj||""), parent).each(function() {
+ var row = this;
+ var elems = $.makeArray(row.cells);
+ $.each(permutation, function() {
+ var e = elems[this];
+ if (e) {
+ row.appendChild(e);
+ }
+ });
+ });
+ }
+ resortArray(ts.p.colModel);
+ resortArray(ts.p.colNames);
+ resortArray(ts.grid.headers);
+ resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)");
+ if (updateCells) {
+ resortRows($("#"+$.jgrid.jqID(ts.p.id)+" tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
+ }
+ if (ts.p.footerrow) {
+ resortRows($("tbody:first", ts.grid.sDiv));
+ }
+ if (ts.p.remapColumns) {
+ if (!ts.p.remapColumns.length){
+ ts.p.remapColumns = $.makeArray(permutation);
+ } else {
+ resortArray(ts.p.remapColumns);
+ }
+ }
+ ts.p.lastsort = $.inArray(ts.p.lastsort, permutation);
+ if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); }
+ },
+ setGridWidth : function(nwidth, shrink) {
+ return this.each(function(){
+ if (!this.grid ) {return;}
+ var $t = this, cw,
+ initwidth = 0, brd=$t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0, tw=0,
+ cl = 0,cr;
+ if(typeof shrink != 'boolean') {
+ shrink=$t.p.shrinkToFit;
+ }
+ if(isNaN(nwidth)) {return;}
+ else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;}
+ $("#gbox_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
+ $("#gview_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
+ $($t.grid.bDiv).css("width",nwidth+"px");
+ $($t.grid.hDiv).css("width",nwidth+"px");
+ if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");}
+ if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");}
+ if($t.p.toolbar[0] === true){
+ $($t.grid.uDiv).css("width",nwidth+"px");
+ if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");}
+ }
+ if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); }
+ if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;}
+ if(shrink===true) {
+ if ($.browser.safari) { brd=0;}
+ $.each($t.p.colModel, function(i) {
+ if(this.hidden===false){
+ initwidth += parseInt(this.width,10);
+ if(this.fixed) {
+ tw += this.width;
+ gw += this.width+brd;
+ } else {
+ vc++;
+ }
+ cl++;
+ }
+ });
+ if(vc === 0) { return; }
+ $t.p.tblwidth = initwidth;
+ aw = nwidth-brd*vc-gw;
+ if(!isNaN($t.p.height)) {
+ if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.rows.length === 1){
+ hs = true;
+ aw -= scw;
+ }
+ }
+ initwidth =0;
+ var cle = $t.grid.cols.length >0;
+ $.each($t.p.colModel, function(i) {
+ if(this.hidden === false && !this.fixed){
+ cw = Math.round(aw*this.width/($t.p.tblwidth-tw));
+ if (cw < 0) { return; }
+ this.width =cw;
+ initwidth += cw;
+ $t.grid.headers[i].width=cw;
+ $t.grid.headers[i].el.style.width=cw+"px";
+ if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; }
+ if(cle) { $t.grid.cols[i].style.width = cw+"px"; }
+ lvc = i;
+ }
+ });
+ cr =0;
+ if (hs) {
+ if(nwidth-gw-(initwidth+brd*vc) !== scw){
+ cr = nwidth-gw-(initwidth+brd*vc)-scw;
+ }
+ } else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) {
+ cr = nwidth-gw-(initwidth+brd*vc);
+ }
+ $t.p.colModel[lvc].width += cr;
+ $t.p.tblwidth = initwidth+cr+tw+brd*cl;
+ if($t.p.tblwidth > nwidth) {
+ var delta = $t.p.tblwidth - parseInt(nwidth,10);
+ $t.p.tblwidth = nwidth;
+ cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta;
+ } else {
+ cw= $t.p.colModel[lvc].width;
+ }
+ $t.grid.headers[lvc].width = cw;
+ $t.grid.headers[lvc].el.style.width=cw+"px";
+ if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; }
+ $('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px");
+ $('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px");
+ $t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
+ if($t.p.footerrow) {
+ $t.grid.footers[lvc].style.width = cw+"px";
+ $('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px");
+ }
+ }
+ });
+ },
+ setGridHeight : function (nh) {
+ return this.each(function (){
+ var $t = this;
+ if(!$t.grid) {return;}
+ $($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
+ $t.p.height = nh;
+ if ($t.p.scroll) { $t.grid.populateVisible(); }
+ });
+ },
+ setCaption : function (newcap){
+ return this.each(function(){
+ this.p.caption=newcap;
+ $("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);
+ $(this.grid.cDiv).show();
+ });
+ },
+ setLabel : function(colname, nData, prop, attrp ){
+ return this.each(function(){
+ var $t = this, pos=-1;
+ if(!$t.grid) {return;}
+ if(isNaN(colname)) {
+ $($t.p.colModel).each(function(i){
+ if (this.name == colname) {
+ pos = i;return false;
+ }
+ });
+ } else {pos = parseInt(colname,10);}
+ if(pos>=0) {
+ var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);
+ if (nData){
+ var ico = $(".s-ico",thecol);
+ $("[id^=jqgh_]",thecol).empty().html(nData).append(ico);
+ $t.p.colNames[pos] = nData;
+ }
+ if (prop) {
+ if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);}
+ }
+ if(typeof attrp === 'object') {$(thecol).attr(attrp);}
+ }
+ });
+ },
+ setCell : function(rowid,colname,nData,cssp,attrp, forceupd) {
+ return this.each(function(){
+ var $t = this, pos =-1,v, title;
+ if(!$t.grid) {return;}
+ if(isNaN(colname)) {
+ $($t.p.colModel).each(function(i){
+ if (this.name == colname) {
+ pos = i;return false;
+ }
+ });
+ } else {pos = parseInt(colname,10);}
+ if(pos>=0) {
+ var ind = $t.rows.namedItem(rowid);
+ if (ind){
+ var tcell = $("td:eq("+pos+")",ind);
+ if(nData !== "" || forceupd === true) {
+ v = $t.formatter(rowid, nData, pos,ind,'edit');
+ title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {};
+ if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) {
+ $("span",$(tcell)).html(v).attr(title);
+ } else {
+ $(tcell).html(v).attr(title);
+ }
+ if($t.p.datatype == "local") {
+ var cm = $t.p.colModel[pos], index;
+ nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(nData,cm) : nData;
+ index = $t.p._index[rowid];
+ if(typeof index != "undefined") {
+ $t.p.data[index][cm.name] = nData;
+ }
+ }
+ }
+ if(typeof cssp === 'string'){
+ $(tcell).addClass(cssp);
+ } else if(cssp) {
+ $(tcell).css(cssp);
+ }
+ if(typeof attrp === 'object') {$(tcell).attr(attrp);}
+ }
+ }
+ });
+ },
+ getCell : function(rowid,col) {
+ var ret = false;
+ this.each(function(){
+ var $t=this, pos=-1;
+ if(!$t.grid) {return;}
+ if(isNaN(col)) {
+ $($t.p.colModel).each(function(i){
+ if (this.name === col) {
+ pos = i;return false;
+ }
+ });
+ } else {pos = parseInt(col,10);}
+ if(pos>=0) {
+ var ind = $t.rows.namedItem(rowid);
+ if(ind) {
+ try {
+ ret = $.unformat($("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos);
+ } catch (e){
+ ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html());
+ }
+ }
+ }
+ });
+ return ret;
+ },
+ getCol : function (col, obj, mathopr) {
+ var ret = [], val, sum=0;
+ obj = typeof (obj) != 'boolean' ? false : obj;
+ if(typeof mathopr == 'undefined') { mathopr = false; }
+ this.each(function(){
+ var $t=this, pos=-1;
+ if(!$t.grid) {return;}
+ if(isNaN(col)) {
+ $($t.p.colModel).each(function(i){
+ if (this.name === col) {
+ pos = i;return false;
+ }
+ });
+ } else {pos = parseInt(col,10);}
+ if(pos>=0) {
+ var ln = $t.rows.length, i =0;
+ if (ln && ln>0){
+ while(i<ln){
+ if($($t.rows[i]).hasClass('jqgrow')) {
+ try {
+ val = $.unformat($($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos);
+ } catch (e) {
+ val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML);
+ }
+ if(mathopr) { sum += parseFloat(val); }
+ else if(obj) { ret.push( {id:$t.rows[i].id,value:val} ); }
+ else { ret.push( val ); }
+ }
+ i++;
+ }
+ if(mathopr) {
+ switch(mathopr.toLowerCase()){
+ case 'sum': ret =sum; break;
+ case 'avg': ret = sum/ln; break;
+ case 'count': ret = ln; break;
+ }
+ }
+ }
+ }
+ });
+ return ret;
+ },
+ clearGridData : function(clearfooter) {
+ return this.each(function(){
+ var $t = this;
+ if(!$t.grid) {return;}
+ if(typeof clearfooter != 'boolean') { clearfooter = false; }
+ if($t.p.deepempty) {$("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:gt(0)").remove();}
+ else {
+ var trf = $("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:first")[0];
+ $("#"+$.jgrid.jqID($t.p.id)+" tbody:first").empty().append(trf);
+ }
+ if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html(" "); }
+ $t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = [];
+ $t.p.records = 0;$t.p.page=1;$t.p.lastpage=0;$t.p.reccount=0;
+ $t.p.data = []; $t.p_index = {};
+ $t.updatepager(true,false);
+ });
+ },
+ getInd : function(rowid,rc){
+ var ret =false,rw;
+ this.each(function(){
+ rw = this.rows.namedItem(rowid);
+ if(rw) {
+ ret = rc===true ? rw: rw.rowIndex;
+ }
+ });
+ return ret;
+ }
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.celledit.js'
--- addons/base/static/jquery.jqGrid/js/grid.celledit.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.celledit.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,486 @@
+;(function($){
+/*
+**
+ * jqGrid extension for cellediting Grid Data
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+/**
+ * all events and options here are aded anonynous and not in the base grid
+ * since the array is to big. Here is the order of execution.
+ * From this point we use jQuery isFunction
+ * formatCell
+ * beforeEditCell,
+ * onSelectCell (used only for noneditable cels)
+ * afterEditCell,
+ * beforeSaveCell, (called before validation of values if any)
+ * beforeSubmitCell (if cellsubmit remote (ajax))
+ * afterSubmitCell(if cellsubmit remote (ajax)),
+ * afterSaveCell,
+ * errorCell,
+ * serializeCellData - new
+ * Options
+ * cellsubmit (remote,clientArray) (added in grid options)
+ * cellurl
+ * ajaxCellOptions
+* */
+$.jgrid.extend({
+ editCell : function (iRow,iCol, ed){
+ return this.each(function (){
+ var $t = this, nm, tmp,cc;
+ if (!$t.grid || $t.p.cellEdit !== true) {return;}
+ iCol = parseInt(iCol,10);
+ // select the row that can be used for other methods
+ $t.p.selrow = $t.rows[iRow].id;
+ if (!$t.p.knv) {$($t).jqGrid("GridNav");}
+ // check to see if we have already edited cell
+ if ($t.p.savedRow.length>0) {
+ // prevent second click on that field and enable selects
+ if (ed===true ) {
+ if(iRow == $t.p.iRow && iCol == $t.p.iCol){
+ return;
+ }
+ }
+ // save the cell
+ $($t).jqGrid("saveCell",$t.p.savedRow[0].id,$t.p.savedRow[0].ic);
+ } else {
+ window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+ }
+ nm = $t.p.colModel[iCol].name;
+ if (nm=='subgrid' || nm=='cb' || nm=='rn') {return;}
+ cc = $("td:eq("+iCol+")",$t.rows[iRow]);
+ if ($t.p.colModel[iCol].editable===true && ed===true && !cc.hasClass("not-editable-cell")) {
+ if(parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) {
+ $("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
+ $($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
+ }
+ $(cc).addClass("edit-cell ui-state-highlight");
+ $($t.rows[iRow]).addClass("selected-row ui-state-hover");
+ try {
+ tmp = $.unformat(cc,{rowId: $t.rows[iRow].id, colModel:$t.p.colModel[iCol]},iCol);
+ } catch (_) {
+ tmp = $(cc).html();
+ }
+ if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+ if (!$t.p.colModel[iCol].edittype) {$t.p.colModel[iCol].edittype = "text";}
+ $t.p.savedRow.push({id:iRow,ic:iCol,name:nm,v:tmp});
+ if($.isFunction($t.p.formatCell)) {
+ var tmp2 = $t.p.formatCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+ if(tmp2 !== undefined ) {tmp = tmp2;}
+ }
+ var opt = $.extend({}, $t.p.colModel[iCol].editoptions || {} ,{id:iRow+"_"+nm,name:nm});
+ var elc = $.jgrid.createEl($t.p.colModel[iCol].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
+ if ($.isFunction($t.p.beforeEditCell)) {
+ $t.p.beforeEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+ }
+ $(cc).html("").append(elc).attr("tabindex","0");
+ window.setTimeout(function () { $(elc).focus();},0);
+ $("input, select, textarea",cc).bind("keydown",function(e) {
+ if (e.keyCode === 27) {
+ if($("input.hasDatepicker",cc).length >0) {
+ if( $(".ui-datepicker").is(":hidden") ) { $($t).jqGrid("restoreCell",iRow,iCol); }
+ else { $("input.hasDatepicker",cc).datepicker('hide'); }
+ } else {
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ }
+ } //ESC
+ if (e.keyCode === 13) {$($t).jqGrid("saveCell",iRow,iCol);}//Enter
+ if (e.keyCode == 9) {
+ if(!$t.grid.hDiv.loading ) {
+ if (e.shiftKey) {$($t).jqGrid("prevCell",iRow,iCol);} //Shift TAb
+ else {$($t).jqGrid("nextCell",iRow,iCol);} //Tab
+ } else {
+ return false;
+ }
+ }
+ e.stopPropagation();
+ });
+ if ($.isFunction($t.p.afterEditCell)) {
+ $t.p.afterEditCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+ }
+ } else {
+ if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) {
+ $("td:eq("+$t.p.iCol+")",$t.rows[$t.p.iRow]).removeClass("edit-cell ui-state-highlight");
+ $($t.rows[$t.p.iRow]).removeClass("selected-row ui-state-hover");
+ }
+ cc.addClass("edit-cell ui-state-highlight");
+ $($t.rows[iRow]).addClass("selected-row ui-state-hover");
+ if ($.isFunction($t.p.onSelectCell)) {
+ tmp = cc.html().replace(/\ \;/ig,'');
+ $t.p.onSelectCell.call($t, $t.rows[iRow].id,nm,tmp,iRow,iCol);
+ }
+ }
+ $t.p.iCol = iCol; $t.p.iRow = iRow;
+ });
+ },
+ saveCell : function (iRow, iCol){
+ return this.each(function(){
+ var $t= this, fr;
+ if (!$t.grid || $t.p.cellEdit !== true) {return;}
+ if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;}
+ if(fr !== null) {
+ var cc = $("td:eq("+iCol+")",$t.rows[iRow]),v,v2,
+ cm = $t.p.colModel[iCol], nm = cm.name, nmjq = $.jgrid.jqID(nm) ;
+ switch (cm.edittype) {
+ case "select":
+ if(!cm.editoptions.multiple) {
+ v = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).val();
+ v2 = $("#"+iRow+"_"+nmjq+">option:selected",$t.rows[iRow]).text();
+ } else {
+ var sel = $("#"+iRow+"_"+nmjq,$t.rows[iRow]), selectedText = [];
+ v = $(sel).val();
+ if(v) { v.join(",");} else { v=""; }
+ $("option:selected",sel).each(
+ function(i,selected){
+ selectedText[i] = $(selected).text();
+ }
+ );
+ v2 = selectedText.join(",");
+ }
+ if(cm.formatter) { v2 = v; }
+ break;
+ case "checkbox":
+ var cbv = ["Yes","No"];
+ if(cm.editoptions){
+ cbv = cm.editoptions.value.split(":");
+ }
+ v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).attr("checked") ? cbv[0] : cbv[1];
+ v2=v;
+ break;
+ case "password":
+ case "text":
+ case "textarea":
+ case "button" :
+ v = $("#"+iRow+"_"+nmjq,$t.rows[iRow]).val();
+ v2=v;
+ break;
+ case 'custom' :
+ try {
+ if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
+ v = cm.editoptions.custom_value.call($t, $(".customelement",cc),'get');
+ if (v===undefined) { throw "e2";} else { v2=v; }
+ } else { throw "e1"; }
+ } catch (e) {
+ if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
+ if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
+ else {$.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+ }
+ break;
+ }
+ // The common approach is if nothing changed do not do anything
+ if (v2 != $t.p.savedRow[fr].v){
+ if ($.isFunction($t.p.beforeSaveCell)) {
+ var vv = $t.p.beforeSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+ if (vv) {v = vv; v2=vv;}
+ }
+ var cv = $.jgrid.checkValues(v,iCol,$t);
+ if(cv[0] === true) {
+ var addpost = {};
+ if ($.isFunction($t.p.beforeSubmitCell)) {
+ addpost = $t.p.beforeSubmitCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+ if (!addpost) {addpost={};}
+ }
+ if( $("input.hasDatepicker",cc).length >0) { $("input.hasDatepicker",cc).datepicker('hide'); }
+ if ($t.p.cellsubmit == 'remote') {
+ if ($t.p.cellurl) {
+ var postdata = {};
+ if($t.p.autoencode) { v = $.jgrid.htmlEncode(v); }
+ postdata[nm] = v;
+ var idname,oper, opers;
+ opers = $t.p.prmNames;
+ idname = opers.id;
+ oper = opers.oper;
+ postdata[idname] = $t.rows[iRow].id;
+ postdata[oper] = opers.editoper;
+ postdata = $.extend(addpost,postdata);
+ $("#lui_"+$t.p.id).show();
+ $t.grid.hDiv.loading = true;
+ $.ajax( $.extend( {
+ url: $t.p.cellurl,
+ data :$.isFunction($t.p.serializeCellData) ? $t.p.serializeCellData.call($t, postdata) : postdata,
+ type: "POST",
+ complete: function (result, stat) {
+ $("#lui_"+$t.p.id).hide();
+ $t.grid.hDiv.loading = false;
+ if (stat == 'success') {
+ if ($.isFunction($t.p.afterSubmitCell)) {
+ var ret = $t.p.afterSubmitCell.call($t, result,postdata.id,nm,v,iRow,iCol);
+ if(ret[0] === true) {
+ $(cc).empty();
+ $($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
+ $(cc).addClass("dirty-cell");
+ $($t.rows[iRow]).addClass("edited");
+ if ($.isFunction($t.p.afterSaveCell)) {
+ $t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+ }
+ $t.p.savedRow.splice(0,1);
+ } else {
+ $.jgrid.info_dialog($.jgrid.errors.errcap,ret[1],$.jgrid.edit.bClose);
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ }
+ } else {
+ $(cc).empty();
+ $($t).jqGrid("setCell",$t.rows[iRow].id, iCol, v2, false, false, true);
+ $(cc).addClass("dirty-cell");
+ $($t.rows[iRow]).addClass("edited");
+ if ($.isFunction($t.p.afterSaveCell)) {
+ $t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+ }
+ $t.p.savedRow.splice(0,1);
+ }
+ }
+ },
+ error:function(res,stat) {
+ $("#lui_"+$t.p.id).hide();
+ $t.grid.hDiv.loading = false;
+ if ($.isFunction($t.p.errorCell)) {
+ $t.p.errorCell.call($t, res,stat);
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ } else {
+ $.jgrid.info_dialog($.jgrid.errors.errcap,res.status+" : "+res.statusText+"<br/>"+stat,$.jgrid.edit.bClose);
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ }
+ }
+ }, $.jgrid.ajaxOptions, $t.p.ajaxCellOptions || {}));
+ } else {
+ try {
+ $.jgrid.info_dialog($.jgrid.errors.errcap,$.jgrid.errors.nourl,$.jgrid.edit.bClose);
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ } catch (e) {}
+ }
+ }
+ if ($t.p.cellsubmit == 'clientArray') {
+ $(cc).empty();
+ $($t).jqGrid("setCell",$t.rows[iRow].id,iCol, v2, false, false, true);
+ $(cc).addClass("dirty-cell");
+ $($t.rows[iRow]).addClass("edited");
+ if ($.isFunction($t.p.afterSaveCell)) {
+ $t.p.afterSaveCell.call($t, $t.rows[iRow].id,nm, v, iRow,iCol);
+ }
+ $t.p.savedRow.splice(0,1);
+ }
+ } else {
+ try {
+ window.setTimeout(function(){$.jgrid.info_dialog($.jgrid.errors.errcap,v+" "+cv[1],$.jgrid.edit.bClose);},100);
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ } catch (e) {}
+ }
+ } else {
+ $($t).jqGrid("restoreCell",iRow,iCol);
+ }
+ }
+ if ($.browser.opera) {
+ $("#"+$t.p.knv).attr("tabindex","-1").focus();
+ } else {
+ window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+ }
+ });
+ },
+ restoreCell : function(iRow, iCol) {
+ return this.each(function(){
+ var $t= this, fr;
+ if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+ if ( $t.p.savedRow.length >= 1) {fr = 0;} else {fr=null;}
+ if(fr !== null) {
+ var cc = $("td:eq("+iCol+")",$t.rows[iRow]);
+ // datepicker fix
+ if($.isFunction($.fn.datepicker)) {
+ try {
+ $("input.hasDatepicker",cc).datepicker('hide');
+ } catch (e) {}
+ }
+ $(cc).empty().attr("tabindex","-1");
+ $($t).jqGrid("setCell",$t.rows[iRow].id, iCol, $t.p.savedRow[fr].v, false, false, true);
+ if ($.isFunction($t.p.afterRestoreCell)) {
+ $t.p.afterRestoreCell.call($t, $t.rows[iRow].id, $t.p.savedRow[fr].v, iRow, iCol);
+ }
+ $t.p.savedRow.splice(0,1);
+ }
+ window.setTimeout(function () { $("#"+$t.p.knv).attr("tabindex","-1").focus();},0);
+ });
+ },
+ nextCell : function (iRow,iCol) {
+ return this.each(function (){
+ var $t = this, nCol=false;
+ if (!$t.grid || $t.p.cellEdit !== true) {return;}
+ // try to find next editable cell
+ for (var i=iCol+1; i<$t.p.colModel.length; i++) {
+ if ( $t.p.colModel[i].editable ===true) {
+ nCol = i; break;
+ }
+ }
+ if(nCol !== false) {
+ $($t).jqGrid("editCell",iRow,nCol,true);
+ } else {
+ if ($t.p.savedRow.length >0) {
+ $($t).jqGrid("saveCell",iRow,iCol);
+ }
+ }
+ });
+ },
+ prevCell : function (iRow,iCol) {
+ return this.each(function (){
+ var $t = this, nCol=false;
+ if (!$t.grid || $t.p.cellEdit !== true) {return;}
+ // try to find next editable cell
+ for (var i=iCol-1; i>=0; i--) {
+ if ( $t.p.colModel[i].editable ===true) {
+ nCol = i; break;
+ }
+ }
+ if(nCol !== false) {
+ $($t).jqGrid("editCell",iRow,nCol,true);
+ } else {
+ if ($t.p.savedRow.length >0) {
+ $($t).jqGrid("saveCell",iRow,iCol);
+ }
+ }
+ });
+ },
+ GridNav : function() {
+ return this.each(function () {
+ var $t = this;
+ if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+ // trick to process keydown on non input elements
+ $t.p.knv = $t.p.id + "_kn";
+ var selection = $("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+$t.p.knv+"'></span></span>"),
+ i, kdir;
+ $(selection).insertBefore($t.grid.cDiv);
+ $("#"+$t.p.knv)
+ .focus()
+ .keydown(function (e){
+ kdir = e.keyCode;
+ if($t.p.direction == "rtl") {
+ if(kdir==37) { kdir = 39;}
+ else if (kdir==39) { kdir = 37; }
+ }
+ switch (kdir) {
+ case 38:
+ if ($t.p.iRow-1 >0 ) {
+ scrollGrid($t.p.iRow-1,$t.p.iCol,'vu');
+ $($t).jqGrid("editCell",$t.p.iRow-1,$t.p.iCol,false);
+ }
+ break;
+ case 40 :
+ if ($t.p.iRow+1 <= $t.rows.length-1) {
+ scrollGrid($t.p.iRow+1,$t.p.iCol,'vd');
+ $($t).jqGrid("editCell",$t.p.iRow+1,$t.p.iCol,false);
+ }
+ break;
+ case 37 :
+ if ($t.p.iCol -1 >= 0) {
+ i = findNextVisible($t.p.iCol-1,'lft');
+ scrollGrid($t.p.iRow, i,'h');
+ $($t).jqGrid("editCell",$t.p.iRow, i,false);
+ }
+ break;
+ case 39 :
+ if ($t.p.iCol +1 <= $t.p.colModel.length-1) {
+ i = findNextVisible($t.p.iCol+1,'rgt');
+ scrollGrid($t.p.iRow,i,'h');
+ $($t).jqGrid("editCell",$t.p.iRow,i,false);
+ }
+ break;
+ case 13:
+ if (parseInt($t.p.iCol,10)>=0 && parseInt($t.p.iRow,10)>=0) {
+ $($t).jqGrid("editCell",$t.p.iRow,$t.p.iCol,true);
+ }
+ break;
+ }
+ return false;
+ });
+ function scrollGrid(iR, iC, tp){
+ if (tp.substr(0,1)=='v') {
+ var ch = $($t.grid.bDiv)[0].clientHeight,
+ st = $($t.grid.bDiv)[0].scrollTop,
+ nROT = $t.rows[iR].offsetTop+$t.rows[iR].clientHeight,
+ pROT = $t.rows[iR].offsetTop;
+ if(tp == 'vd') {
+ if(nROT >= ch) {
+ $($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop + $t.rows[iR].clientHeight;
+ }
+ }
+ if(tp == 'vu'){
+ if (pROT < st ) {
+ $($t.grid.bDiv)[0].scrollTop = $($t.grid.bDiv)[0].scrollTop - $t.rows[iR].clientHeight;
+ }
+ }
+ }
+ if(tp=='h') {
+ var cw = $($t.grid.bDiv)[0].clientWidth,
+ sl = $($t.grid.bDiv)[0].scrollLeft,
+ nCOL = $t.rows[iR].cells[iC].offsetLeft+$t.rows[iR].cells[iC].clientWidth,
+ pCOL = $t.rows[iR].cells[iC].offsetLeft;
+ if(nCOL >= cw+parseInt(sl,10)) {
+ $($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft + $t.rows[iR].cells[iC].clientWidth;
+ } else if (pCOL < sl) {
+ $($t.grid.bDiv)[0].scrollLeft = $($t.grid.bDiv)[0].scrollLeft - $t.rows[iR].cells[iC].clientWidth;
+ }
+ }
+ }
+ function findNextVisible(iC,act){
+ var ind, i;
+ if(act == 'lft') {
+ ind = iC+1;
+ for (i=iC;i>=0;i--){
+ if ($t.p.colModel[i].hidden !== true) {
+ ind = i;
+ break;
+ }
+ }
+ }
+ if(act == 'rgt') {
+ ind = iC-1;
+ for (i=iC; i<$t.p.colModel.length;i++){
+ if ($t.p.colModel[i].hidden !== true) {
+ ind = i;
+ break;
+ }
+ }
+ }
+ return ind;
+ }
+ });
+ },
+ getChangedCells : function (mthd) {
+ var ret=[];
+ if (!mthd) {mthd='all';}
+ this.each(function(){
+ var $t= this,nm;
+ if (!$t.grid || $t.p.cellEdit !== true ) {return;}
+ $($t.rows).each(function(j){
+ var res = {};
+ if ($(this).hasClass("edited")) {
+ $('td',this).each( function(i) {
+ nm = $t.p.colModel[i].name;
+ if ( nm !== 'cb' && nm !== 'subgrid') {
+ if (mthd=='dirty') {
+ if ($(this).hasClass('dirty-cell')) {
+ try {
+ res[nm] = $.unformat(this,{rowId:$t.rows[j].id, colModel:$t.p.colModel[i]},i);
+ } catch (e){
+ res[nm] = $.jgrid.htmlDecode($(this).html());
+ }
+ }
+ } else {
+ try {
+ res[nm] = $.unformat(this,{rowId:$t.rows[j].id,colModel:$t.p.colModel[i]},i);
+ } catch (e) {
+ res[nm] = $.jgrid.htmlDecode($(this).html());
+ }
+ }
+ }
+ });
+ res.id = this.id;
+ ret.push(res);
+ }
+ });
+ });
+ return ret;
+ }
+/// end cell editing
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.common.js'
--- addons/base/static/jquery.jqGrid/js/grid.common.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.common.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,656 @@
+;(function($){
+/*
+ * jqGrid common function
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+*/
+/*global jQuery, $ */
+
+$.extend($.jgrid,{
+// Modal functions
+ showModal : function(h) {
+ h.w.show();
+ },
+ closeModal : function(h) {
+ h.w.hide().attr("aria-hidden","true");
+ if(h.o) { h.o.remove(); }
+ },
+ hideModal : function (selector,o) {
+ o = $.extend({jqm : true, gb :''}, o || {});
+ if(o.onClose) {
+ var oncret = o.onClose(selector);
+ if (typeof oncret == 'boolean' && !oncret ) { return; }
+ }
+ if ($.fn.jqm && o.jqm === true) {
+ $(selector).attr("aria-hidden","true").jqmHide();
+ } else {
+ if(o.gb !== '') {
+ try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){}
+ }
+ $(selector).hide().attr("aria-hidden","true");
+ }
+ },
+//Helper functions
+ findPos : function(obj) {
+ var curleft = 0, curtop = 0;
+ if (obj.offsetParent) {
+ do {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ } while (obj = obj.offsetParent);
+ //do not change obj == obj.offsetParent
+ }
+ return [curleft,curtop];
+ },
+ createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel) {
+ var mw = document.createElement('div'), rtlsup, self = this;
+ rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false;
+ mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
+ mw.id = aIDs.themodal;
+ var mh = document.createElement('div');
+ mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
+ mh.id = aIDs.modalhead;
+ $(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>");
+ var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>")
+ .hover(function(){ahr.addClass('ui-state-hover');},
+ function(){ahr.removeClass('ui-state-hover');})
+ .append("<span class='ui-icon ui-icon-closethick'></span>");
+ $(mh).append(ahr);
+ if(rtlsup) {
+ mw.dir = "rtl";
+ $(".ui-jqdialog-title",mh).css("float","right");
+ $(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em");
+ } else {
+ mw.dir = "ltr";
+ $(".ui-jqdialog-title",mh).css("float","left");
+ $(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em");
+ }
+ var mc = document.createElement('div');
+ $(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent);
+ $(mc).append(content);
+ mw.appendChild(mc);
+ $(mw).prepend(mh);
+ if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog
+ else {$(mw).insertBefore(insertSelector);}
+ if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use
+ var coord = {};
+ if ( $.fn.jqm && p.jqModal === true) {
+ if(p.left ===0 && p.top===0) {
+ var pos = [];
+ pos = this.findPos(posSelector);
+ p.left = pos[0] + 4;
+ p.top = pos[1] + 4;
+ }
+ coord.top = p.top+"px";
+ coord.left = p.left;
+ } else if(p.left !==0 || p.top!==0) {
+ coord.left = p.left;
+ coord.top = p.top+"px";
+ }
+ $("a.ui-jqdialog-titlebar-close",mh).click(function(e){
+ var oncm = $("#"+aIDs.themodal).data("onClose") || p.onClose;
+ var gboxclose = $("#"+aIDs.themodal).data("gbox") || p.gbox;
+ self.hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm});
+ return false;
+ });
+ if (p.width === 0 || !p.width) {p.width = 300;}
+ if(p.height === 0 || !p.height) {p.height =200;}
+ if(!p.zIndex) {
+ var parentZ = $(insertSelector).parents("*[role=dialog]").first().css("z-index");
+ if(parentZ) {
+ p.zIndex = parseInt(parentZ,10)+1;
+ } else {
+ p.zIndex = 950;
+ }
+ }
+ var rtlt = 0;
+ if( rtlsup && coord.left && !appendsel) {
+ rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do
+ // just in case
+ coord.left = parseInt(coord.left,10) + parseInt(rtlt,10);
+ }
+ if(coord.left) { coord.left += "px"; }
+ $(mw).css($.extend({
+ width: isNaN(p.width) ? "auto": p.width+"px",
+ height:isNaN(p.height) ? "auto" : p.height + "px",
+ zIndex:p.zIndex,
+ overflow: 'hidden'
+ },coord))
+ .attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"});
+ if(typeof p.drag == 'undefined') { p.drag=true;}
+ if(typeof p.resize == 'undefined') {p.resize=true;}
+ if (p.drag) {
+ $(mh).css('cursor','move');
+ if($.fn.jqDrag) {
+ $(mw).jqDrag(mh);
+ } else {
+ try {
+ $(mw).draggable({handle: $("#"+mh.id)});
+ } catch (e) {}
+ }
+ }
+ if(p.resize) {
+ if($.fn.jqResize) {
+ $(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
+ $("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false);
+ } else {
+ try {
+ $(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false});
+ } catch (r) {}
+ }
+ }
+ if(p.closeOnEscape === true){
+ $(mw).keydown( function( e ) {
+ if( e.which == 27 ) {
+ var cone = $("#"+aIDs.themodal).data("onClose") || p.onClose;
+ self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone});
+ }
+ });
+ }
+ },
+ viewModal : function (selector,o){
+ o = $.extend({
+ toTop: true,
+ overlay: 10,
+ modal: false,
+ onShow: this.showModal,
+ onHide: this.closeModal,
+ gbox: '',
+ jqm : true,
+ jqM : true
+ }, o || {});
+ if ($.fn.jqm && o.jqm === true) {
+ if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); }
+ else {$(selector).attr("aria-hidden","false").jqmShow();}
+ } else {
+ if(o.gbox !== '') {
+ $(".jqgrid-overlay:first",o.gbox).show();
+ $(selector).data("gbox",o.gbox);
+ }
+ $(selector).show().attr("aria-hidden","false");
+ try{$(':input:visible',selector)[0].focus();}catch(_){}
+ }
+ },
+
+ info_dialog : function(caption, content,c_b, modalopt) {
+ var mopt = {
+ width:290,
+ height:'auto',
+ dataheight: 'auto',
+ drag: true,
+ resize: false,
+ caption:"<b>"+caption+"</b>",
+ left:250,
+ top:170,
+ zIndex : 1000,
+ jqModal : true,
+ modal : false,
+ closeOnEscape : true,
+ align: 'center',
+ buttonalign : 'center',
+ buttons : []
+ // {text:'textbutt', id:"buttid", onClick : function(){...}}
+ // if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1...
+ };
+ $.extend(mopt,modalopt || {});
+ var jm = mopt.jqModal, self = this;
+ if($.fn.jqm && !jm) { jm = false; }
+ // in case there is no jqModal
+ var buttstr ="";
+ if(mopt.buttons.length > 0) {
+ for(var i=0;i<mopt.buttons.length;i++) {
+ if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; }
+ buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>";
+ }
+ }
+ var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px",
+ cn = "text-align:"+mopt.align+";";
+ var cnt = "<div id='info_id'>";
+ cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>";
+ cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" :
+ buttstr !== "" ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : "";
+ cnt += "</div>";
+
+ try {
+ if($("#info_dialog").attr("aria-hidden") == "false") {
+ this.hideModal("#info_dialog",{jqm:jm});
+ }
+ $("#info_dialog").remove();
+ } catch (e){}
+ this.createModal({
+ themodal:'info_dialog',
+ modalhead:'info_head',
+ modalcontent:'info_content',
+ scrollelm: 'infocnt'},
+ cnt,
+ mopt,
+ '','',true
+ );
+ // attach onclick after inserting into the dom
+ if(buttstr) {
+ $.each(mopt.buttons,function(i){
+ $("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;});
+ });
+ }
+ $("#closedialog", "#info_id").click(function(e){
+ self.hideModal("#info_dialog",{jqm:jm});
+ return false;
+ });
+ $(".fm-button","#info_dialog").hover(
+ function(){$(this).addClass('ui-state-hover');},
+ function(){$(this).removeClass('ui-state-hover');}
+ );
+ if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); }
+ this.viewModal("#info_dialog",{
+ onHide: function(h) {
+ h.w.hide().remove();
+ if(h.o) { h.o.remove(); }
+ },
+ modal :mopt.modal,
+ jqm:jm
+ });
+ if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); }
+ try{ $("#info_dialog").focus();} catch (m){}
+ },
+// Form Functions
+ createEl : function(eltype,options,vl,autowidth, ajaxso) {
+ var elem = "";
+ function bindEv (el, opt) {
+ if($.isFunction(opt.dataInit)) {
+ opt.dataInit(el);
+ }
+ if(opt.dataEvents) {
+ $.each(opt.dataEvents, function() {
+ if (this.data !== undefined) {
+ $(el).bind(this.type, this.data, this.fn);
+ } else {
+ $(el).bind(this.type, this.fn);
+ }
+ });
+ }
+ return opt;
+ }
+ function setAttributes(elm, atr) {
+ var exclude = ['dataInit','dataEvents', 'value','dataUrl', 'buildSelect'];
+ $.each(atr, function(key, value){
+ if($.inArray(key, exclude) === -1) {
+ $(elem).attr(key,value);
+ }
+ });
+ }
+ switch (eltype)
+ {
+ case "textarea" :
+ elem = document.createElement("textarea");
+ if(autowidth) {
+ if(!options.cols) { $(elem).css({width:"98%"});}
+ } else if (!options.cols) { options.cols = 20; }
+ if(!options.rows) { options.rows = 2; }
+ if(vl==' ' || vl==' ' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";}
+ elem.value = vl;
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ $(elem).attr({"role":"textbox","multiline":"true"});
+ break;
+ case "checkbox" : //what code for simple checkbox
+ elem = document.createElement("input");
+ elem.type = "checkbox";
+ if( !options.value ) {
+ var vl1 = vl.toLowerCase();
+ if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") {
+ elem.checked=true;
+ elem.defaultChecked=true;
+ elem.value = vl;
+ } else {
+ elem.value = "on";
+ }
+ $(elem).attr("offval","off");
+ } else {
+ var cbval = options.value.split(":");
+ if(vl === cbval[0]) {
+ elem.checked=true;
+ elem.defaultChecked=true;
+ }
+ elem.value = cbval[0];
+ $(elem).attr("offval",cbval[1]);
+ }
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ $(elem).attr("role","checkbox");
+ break;
+ case "select" :
+ elem = document.createElement("select");
+ elem.setAttribute("role","select");
+ var msl, ovm = [];
+ if(options.multiple===true) {
+ msl = true;
+ elem.multiple="multiple";
+ $(elem).attr("aria-multiselectable","true");
+ } else { msl = false; }
+ if(typeof(options.dataUrl) != "undefined") {
+ $.ajax($.extend({
+ url: options.dataUrl,
+ type : "GET",
+ dataType: "html",
+ success: function(data,status){
+ var a;
+ if(typeof(options.buildSelect) != "undefined") {
+ var b = options.buildSelect(data);
+ a = $(b).html();
+ } else {
+ a = $(data).html();
+ }
+ if(a) {
+ $(elem).append(a);
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;}
+ if(msl) {
+ ovm = vl.split(",");
+ ovm = $.map(ovm,function(n){return $.trim(n);});
+ } else {
+ ovm[0] = $.trim(vl);
+ }
+ //$(elem).attr(options);
+ setTimeout(function(){
+ $("option",elem).each(function(i){
+ //if(i===0) { this.selected = ""; }
+ $(this).attr("role","option");
+ if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) {
+ this.selected= "selected";
+ if(!msl) { return false; }
+ }
+ });
+ },0);
+ }
+ }
+ },ajaxso || {}));
+ } else if(options.value) {
+ var i;
+ if(msl) {
+ ovm = vl.split(",");
+ ovm = $.map(ovm,function(n){return $.trim(n);});
+ if(typeof options.size === 'undefined') {options.size = 3;}
+ } else {
+ options.size = 1;
+ }
+ if(typeof options.value === 'function') { options.value = options.value(); }
+ var so,sv, ov;
+ if(typeof options.value === 'string') {
+ so = options.value.split(";");
+ for(i=0; i<so.length;i++){
+ sv = so[i].split(":");
+ if(sv.length > 2 ) {
+ sv[1] = $.map(sv,function(n,i){if(i>0) { return n;} }).join(":");
+ }
+ ov = document.createElement("option");
+ ov.setAttribute("role","option");
+ ov.value = sv[0]; ov.innerHTML = sv[1];
+ if (!msl && ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; }
+ if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";}
+ elem.appendChild(ov);
+ }
+ } else if (typeof options.value === 'object') {
+ var oSv = options.value;
+ for ( var key in oSv) {
+ if (oSv.hasOwnProperty(key ) ){
+ ov = document.createElement("option");
+ ov.setAttribute("role","option");
+ ov.value = key; ov.innerHTML = oSv[key];
+ if (!msl && ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; }
+ if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; }
+ elem.appendChild(ov);
+ }
+ }
+ }
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ }
+ break;
+ case "text" :
+ case "password" :
+ case "button" :
+ var role;
+ if(eltype=="button") { role = "button"; }
+ else { role = "textbox"; }
+ elem = document.createElement("input");
+ elem.type = eltype;
+ elem.value = vl;
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ if(eltype != "button"){
+ if(autowidth) {
+ if(!options.size) { $(elem).css({width:"98%"}); }
+ } else if (!options.size) { options.size = 20; }
+ }
+ $(elem).attr("role",role);
+ break;
+ case "image" :
+ case "file" :
+ elem = document.createElement("input");
+ elem.type = eltype;
+ setAttributes(elem, options);
+ options = bindEv(elem,options);
+ break;
+ case "custom" :
+ elem = document.createElement("span");
+ try {
+ if($.isFunction(options.custom_element)) {
+ var celm = options.custom_element.call(this,vl,options);
+ if(celm) {
+ celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name});
+ $(elem).empty().append(celm);
+ } else {
+ throw "e2";
+ }
+ } else {
+ throw "e1";
+ }
+ } catch (e) {
+ if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);}
+ if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);}
+ else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); }
+ }
+ break;
+ }
+ return elem;
+ },
+// Date Validation Javascript
+ checkDate : function (format, date) {
+ var daysInFebruary = function(year){
+ // February has 29 days in any year evenly divisible by four,
+ // EXCEPT for centurial years which are not also divisible by 400.
+ return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 );
+ },
+ DaysArray = function(n) {
+ for (var i = 1; i <= n; i++) {
+ this[i] = 31;
+ if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
+ if (i==2) {this[i] = 29;}
+ }
+ return this;
+ };
+
+ var tsp = {}, sep;
+ format = format.toLowerCase();
+ //we search for /,-,. for the date separator
+ if(format.indexOf("/") != -1) {
+ sep = "/";
+ } else if(format.indexOf("-") != -1) {
+ sep = "-";
+ } else if(format.indexOf(".") != -1) {
+ sep = ".";
+ } else {
+ sep = "/";
+ }
+ format = format.split(sep);
+ date = date.split(sep);
+ if (date.length != 3) { return false; }
+ var j=-1,yln, dln=-1, mln=-1;
+ for(var i=0;i<format.length;i++){
+ var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10);
+ tsp[format[i]] = dv;
+ yln = format[i];
+ if(yln.indexOf("y") != -1) { j=i; }
+ if(yln.indexOf("m") != -1) { mln=i; }
+ if(yln.indexOf("d") != -1) { dln=i; }
+ }
+ if (format[j] == "y" || format[j] == "yyyy") {
+ yln=4;
+ } else if(format[j] =="yy"){
+ yln = 2;
+ } else {
+ yln = -1;
+ }
+ var daysInMonth = DaysArray(12),
+ strDate;
+ if (j === -1) {
+ return false;
+ } else {
+ strDate = tsp[format[j]].toString();
+ if(yln == 2 && strDate.length == 1) {yln = 1;}
+ if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){
+ return false;
+ }
+ }
+ if(mln === -1) {
+ return false;
+ } else {
+ strDate = tsp[format[mln]].toString();
+ if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){
+ return false;
+ }
+ }
+ if(dln === -1) {
+ return false;
+ } else {
+ strDate = tsp[format[dln]].toString();
+ if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){
+ return false;
+ }
+ }
+ return true;
+ },
+ isEmpty : function(val)
+ {
+ if (val.match(/^\s+$/) || val === "") {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ checkTime : function(time){
+ // checks only hh:ss (and optional am/pm)
+ var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs;
+ if(!this.isEmpty(time))
+ {
+ regs = time.match(re);
+ if(regs) {
+ if(regs[3]) {
+ if(regs[1] < 1 || regs[1] > 12) { return false; }
+ } else {
+ if(regs[1] > 23) { return false; }
+ }
+ if(regs[2] > 59) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ return true;
+ },
+ checkValues : function(val, valref,g, customobject, nam) {
+ var edtrul,i, nm, dft, len;
+ if(typeof(customobject) === "undefined") {
+ if(typeof(valref)=='string'){
+ for( i =0, len=g.p.colModel.length;i<len; i++){
+ if(g.p.colModel[i].name==valref) {
+ edtrul = g.p.colModel[i].editrules;
+ valref = i;
+ try { nm = g.p.colModel[i].formoptions.label; } catch (e) {}
+ break;
+ }
+ }
+ } else if(valref >=0) {
+ edtrul = g.p.colModel[valref].editrules;
+ }
+ } else {
+ edtrul = customobject;
+ nm = nam===undefined ? "_" : nam;
+ }
+ if(edtrul) {
+ if(!nm) { nm = g.p.colNames[valref]; }
+ if(edtrul.required === true) {
+ if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; }
+ }
+ // force required
+ var rqfield = edtrul.required === false ? false : true;
+ if(edtrul.number === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
+ }
+ }
+ if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) {
+ if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];}
+ }
+ if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) {
+ if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];}
+ }
+ var filter;
+ if(edtrul.email === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ // taken from $ Validate plugin
+ filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
+ if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];}
+ }
+ }
+ if(edtrul.integer === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; }
+ if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];}
+ }
+ }
+ if(edtrul.date === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) {
+ dft = g.p.colModel[valref].formatoptions.newformat;
+ } else {
+ dft = g.p.colModel[valref].datefmt || "Y-m-d";
+ }
+ if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; }
+ }
+ }
+ if(edtrul.time === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; }
+ }
+ }
+ if(edtrul.url === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+ if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];}
+ }
+ }
+ if(edtrul.custom === true) {
+ if( !(rqfield === false && this.isEmpty(val)) ) {
+ if($.isFunction(edtrul.custom_func)) {
+ var ret = edtrul.custom_func.call(g,val,nm);
+ if($.isArray(ret)) {
+ return ret;
+ } else {
+ return [false,$.jgrid.edit.msg.customarray,""];
+ }
+ } else {
+ return [false,$.jgrid.edit.msg.customfcheck,""];
+ }
+ }
+ }
+ }
+ return [true,"",""];
+ }
+});
+})(jQuery);
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/grid.custom.js'
--- addons/base/static/jquery.jqGrid/js/grid.custom.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.custom.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,440 @@
+(function($){
+/**
+ * jqGrid extension for custom methods
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+/*global jQuery, $ */
+
+$.jgrid.extend({
+ getColProp : function(colname){
+ var ret ={}, $t = this[0];
+ if ( !$t.grid ) { return false; }
+ var cM = $t.p.colModel;
+ for ( var i =0;i<cM.length;i++ ) {
+ if ( cM[i].name == colname ) {
+ ret = cM[i];
+ break;
+ }
+ }
+ return ret;
+ },
+ setColProp : function(colname, obj){
+ //do not set width will not work
+ return this.each(function(){
+ if ( this.grid ) {
+ if ( obj ) {
+ var cM = this.p.colModel;
+ for ( var i =0;i<cM.length;i++ ) {
+ if ( cM[i].name == colname ) {
+ $.extend(this.p.colModel[i],obj);
+ break;
+ }
+ }
+ }
+ }
+ });
+ },
+ sortGrid : function(colname,reload, sor){
+ return this.each(function(){
+ var $t=this,idx=-1;
+ if ( !$t.grid ) { return;}
+ if ( !colname ) { colname = $t.p.sortname; }
+ for ( var i=0;i<$t.p.colModel.length;i++ ) {
+ if ( $t.p.colModel[i].index == colname || $t.p.colModel[i].name==colname ) {
+ idx = i;
+ break;
+ }
+ }
+ if ( idx!=-1 ){
+ var sort = $t.p.colModel[idx].sortable;
+ if ( typeof sort !== 'boolean' ) { sort = true; }
+ if ( typeof reload !=='boolean' ) { reload = false; }
+ if ( sort ) { $t.sortData("jqgh_"+colname, idx, reload, sor); }
+ }
+ });
+ },
+ GridDestroy : function () {
+ return this.each(function(){
+ if ( this.grid ) {
+ if ( this.p.pager ) { // if not part of grid
+ $(this.p.pager).remove();
+ }
+ var gid = this.id;
+ try {
+ $("#gbox_"+gid).remove();
+ } catch (_) {}
+ }
+ });
+ },
+ GridUnload : function(){
+ return this.each(function(){
+ if ( !this.grid ) {return;}
+ var defgrid = {id: $(this).attr('id'),cl: $(this).attr('class')};
+ if (this.p.pager) {
+ $(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
+ }
+ var newtable = document.createElement('table');
+ $(newtable).attr({id:defgrid.id});
+ newtable.className = defgrid.cl;
+ var gid = this.id;
+ $(newtable).removeClass("ui-jqgrid-btable");
+ if( $(this.p.pager).parents("#gbox_"+gid).length === 1 ) {
+ $(newtable).insertBefore("#gbox_"+gid).show();
+ $(this.p.pager).insertBefore("#gbox_"+gid);
+ } else {
+ $(newtable).insertBefore("#gbox_"+gid).show();
+ }
+ $("#gbox_"+gid).remove();
+ });
+ },
+ setGridState : function(state) {
+ return this.each(function(){
+ if ( !this.grid ) {return;}
+ var $t = this;
+ if(state == 'hidden'){
+ $(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+$t.p.id).slideUp("fast");
+ if($t.p.pager) {$($t.p.pager).slideUp("fast");}
+ if($t.p.toppager) {$($t.p.toppager).slideUp("fast");}
+ if($t.p.toolbar[0]===true) {
+ if( $t.p.toolbar[1]=='both') {
+ $($t.grid.ubDiv).slideUp("fast");
+ }
+ $($t.grid.uDiv).slideUp("fast");
+ }
+ if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideUp("fast"); }
+ $(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
+ $t.p.gridstate = 'hidden';
+ } else if(state=='visible') {
+ $(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+$t.p.id).slideDown("fast");
+ if($t.p.pager) {$($t.p.pager).slideDown("fast");}
+ if($t.p.toppager) {$($t.p.toppager).slideDown("fast");}
+ if($t.p.toolbar[0]===true) {
+ if( $t.p.toolbar[1]=='both') {
+ $($t.grid.ubDiv).slideDown("fast");
+ }
+ $($t.grid.uDiv).slideDown("fast");
+ }
+ if($t.p.footerrow) { $(".ui-jqgrid-sdiv","#gbox_"+$t.p.id).slideDown("fast"); }
+ $(".ui-jqgrid-titlebar-close span",$t.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
+ $t.p.gridstate = 'visible';
+ }
+
+ });
+ },
+ filterToolbar : function(p){
+ p = $.extend({
+ autosearch: true,
+ searchOnEnter : true,
+ beforeSearch: null,
+ afterSearch: null,
+ beforeClear: null,
+ afterClear: null,
+ searchurl : '',
+ stringResult: false,
+ groupOp: 'AND',
+ defaultSearch : "bw"
+ },p || {});
+ return this.each(function(){
+ var $t = this;
+ if(this.ftoolbar) { return; }
+ var triggerToolbar = function() {
+ var sdata={}, j=0, v, nm, sopt={},so;
+ $.each($t.p.colModel,function(i,n){
+ nm = this.index || this.name;
+ switch (this.stype) {
+ case 'select' :
+ so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : 'eq';
+ v = $("select[name="+nm+"]",$t.grid.hDiv).val();
+ if(v) {
+ sdata[nm] = v;
+ sopt[nm] = so;
+ j++;
+ } else {
+ try {
+ delete $t.p.postData[nm];
+ } catch (e) {}
+ }
+ break;
+ case 'text':
+ so = (this.searchoptions && this.searchoptions.sopt) ? this.searchoptions.sopt[0] : p.defaultSearch;
+ v = $("input[name="+nm+"]",$t.grid.hDiv).val();
+ if(v) {
+ sdata[nm] = v;
+ sopt[nm] = so;
+ j++;
+ } else {
+ try {
+ delete $t.p.postData[nm];
+ } catch (z) {}
+ }
+ break;
+ }
+ });
+ var sd = j>0 ? true : false;
+ if(p.stringResult === true || $t.p.datatype == "local") {
+ var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
+ var gi=0;
+ $.each(sdata,function(i,n){
+ if (gi > 0) {ruleGroup += ",";}
+ ruleGroup += "{\"field\":\"" + i + "\",";
+ ruleGroup += "\"op\":\"" + sopt[i] + "\",";
+ n+="";
+ ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}";
+ gi++;
+ });
+ ruleGroup += "]}";
+ $.extend($t.p.postData,{filters:ruleGroup});
+ $.each(['searchField', 'searchString', 'searchOper'], function(i, n){
+ if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];}
+ });
+ } else {
+ $.extend($t.p.postData,sdata);
+ }
+ var saveurl;
+ if($t.p.searchurl) {
+ saveurl = $t.p.url;
+ $($t).jqGrid("setGridParam",{url:$t.p.searchurl});
+ }
+ var bsr = false;
+ if($.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);}
+ if(!bsr) { $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]); }
+ if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
+ if($.isFunction(p.afterSearch)){p.afterSearch();}
+ };
+ var clearToolbar = function(trigger){
+ var sdata={}, v, j=0, nm;
+ trigger = (typeof trigger != 'boolean') ? true : trigger;
+ $.each($t.p.colModel,function(i,n){
+ v = (this.searchoptions && this.searchoptions.defaultValue) ? this.searchoptions.defaultValue : "";
+ nm = this.index || this.name;
+ switch (this.stype) {
+ case 'select' :
+ var v1;
+ $("select[name="+nm+"] option",$t.grid.hDiv).each(function (i){
+ if(i===0) { this.selected = true; }
+ if ($(this).text() == v) {
+ this.selected = true;
+ v1 = $(this).val();
+ return false;
+ }
+ });
+ if (v1) {
+ // post the key and not the text
+ sdata[nm] = v1;
+ j++;
+ } else {
+ try {
+ delete $t.p.postData[nm];
+ } catch(e) {}
+ }
+ break;
+ case 'text':
+ $("input[name="+nm+"]",$t.grid.hDiv).val(v);
+ if(v) {
+ sdata[nm] = v;
+ j++;
+ } else {
+ try {
+ delete $t.p.postData[nm];
+ } catch (y){}
+ }
+ break;
+ }
+ });
+ var sd = j>0 ? true : false;
+ if(p.stringResult === true || $t.p.datatype == "local") {
+ var ruleGroup = "{\"groupOp\":\"" + p.groupOp + "\",\"rules\":[";
+ var gi=0;
+ $.each(sdata,function(i,n){
+ if (gi > 0) {ruleGroup += ",";}
+ ruleGroup += "{\"field\":\"" + i + "\",";
+ ruleGroup += "\"op\":\"" + "eq" + "\",";
+ n+="";
+ ruleGroup += "\"data\":\"" + n.replace(/\\/g,'\\\\').replace(/\"/g,'\\"') + "\"}";
+ gi++;
+ });
+ ruleGroup += "]}";
+ $.extend($t.p.postData,{filters:ruleGroup});
+ $.each(['searchField', 'searchString', 'searchOper'], function(i, n){
+ if($t.p.postData.hasOwnProperty(n)) { delete $t.p.postData[n];}
+ });
+ } else {
+ $.extend($t.p.postData,sdata);
+ }
+ var saveurl;
+ if($t.p.searchurl) {
+ saveurl = $t.p.url;
+ $($t).jqGrid("setGridParam",{url:$t.p.searchurl});
+ }
+ var bcv = false;
+ if($.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);}
+ if(!bcv) {
+ if(trigger) {
+ $($t).jqGrid("setGridParam",{search:sd}).trigger("reloadGrid",[{page:1}]);
+ }
+ }
+ if(saveurl) {$($t).jqGrid("setGridParam",{url:saveurl});}
+ if($.isFunction(p.afterClear)){p.afterClear();}
+ };
+ var toggleToolbar = function(){
+ var trow = $("tr.ui-search-toolbar",$t.grid.hDiv);
+ if(trow.css("display")=='none') { trow.show(); }
+ else { trow.hide(); }
+ };
+ // create the row
+ function bindEvents(selector, events) {
+ var jElem = $(selector);
+ if (jElem[0]) {
+ jQuery.each(events, function() {
+ if (this.data !== undefined) {
+ jElem.bind(this.type, this.data, this.fn);
+ } else {
+ jElem.bind(this.type, this.fn);
+ }
+ });
+ }
+ }
+ var tr = $("<tr class='ui-search-toolbar' role='rowheader'></tr>");
+ var timeoutHnd;
+ $.each($t.p.colModel,function(i,n){
+ var cm=this, thd , th, soptions,surl,self;
+ th = $("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+$t.p.direction+"'></th>");
+ thd = $("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");
+ if(this.hidden===true) { $(th).css("display","none");}
+ this.search = this.search === false ? false : true;
+ if(typeof this.stype == 'undefined' ) {this.stype='text';}
+ soptions = $.extend({},this.searchoptions || {});
+ if(this.search){
+ switch (this.stype)
+ {
+ case "select":
+ surl = this.surl || soptions.dataUrl;
+ if(surl) {
+ // data returned should have already constructed html select
+ // primitive jQuery load
+ self = thd;
+ $.ajax($.extend({
+ url: surl,
+ dataType: "html",
+ complete: function(res,status) {
+ if(soptions.buildSelect !== undefined) {
+ var d = soptions.buildSelect(res);
+ if (d) { $(self).append(d); }
+ } else {
+ $(self).append(res.responseText);
+ }
+ if(soptions.defaultValue) { $("select",self).val(soptions.defaultValue); }
+ $("select",self).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
+ if(soptions.attr) {$("select",self).attr(soptions.attr);}
+ $("select",self).css({width: "100%"});
+ // preserve autoserch
+ if(soptions.dataInit !== undefined) { soptions.dataInit($("select",self)[0]); }
+ if(soptions.dataEvents !== undefined) { bindEvents($("select",self)[0],soptions.dataEvents); }
+ if(p.autosearch===true){
+ $("select",self).change(function(e){
+ triggerToolbar();
+ return false;
+ });
+ }
+ res=null;
+ }
+ }, $.jgrid.ajaxOptions, $t.p.ajaxSelectOptions || {} ));
+ } else {
+ var oSv;
+ if(cm.searchoptions && cm.searchoptions.value) {
+ oSv = cm.searchoptions.value;
+ } else if(cm.editoptions && cm.editoptions.value) {
+ oSv = cm.editoptions.value;
+ }
+ if (oSv) {
+ var elem = document.createElement("select");
+ elem.style.width = "100%";
+ $(elem).attr({name:cm.index || cm.name, id: "gs_"+cm.name});
+ var so, sv, ov;
+ if(typeof oSv === "string") {
+ so = oSv.split(";");
+ for(var k=0; k<so.length;k++){
+ sv = so[k].split(":");
+ ov = document.createElement("option");
+ ov.value = sv[0]; ov.innerHTML = sv[1];
+ elem.appendChild(ov);
+ }
+ } else if(typeof oSv === "object" ) {
+ for ( var key in oSv) {
+ if(oSv.hasOwnProperty(key)) {
+ ov = document.createElement("option");
+ ov.value = key; ov.innerHTML = oSv[key];
+ elem.appendChild(ov);
+ }
+ }
+ }
+ if(soptions.defaultValue) { $(elem).val(soptions.defaultValue); }
+ if(soptions.attr) {$(elem).attr(soptions.attr);}
+ if(soptions.dataInit !== undefined) { soptions.dataInit(elem); }
+ if(soptions.dataEvents !== undefined) { bindEvents(elem, soptions.dataEvents); }
+ $(thd).append(elem);
+ if(p.autosearch===true){
+ $(elem).change(function(e){
+ triggerToolbar();
+ return false;
+ });
+ }
+ }
+ }
+ break;
+ case 'text':
+ var df = soptions.defaultValue ? soptions.defaultValue: "";
+ $(thd).append("<input type='text' style='width:95%;padding:0px;' name='"+(cm.index || cm.name)+"' id='gs_"+cm.name+"' value='"+df+"'/>");
+ if(soptions.attr) {$("input",thd).attr(soptions.attr);}
+ if(soptions.dataInit !== undefined) { soptions.dataInit($("input",thd)[0]); }
+ if(soptions.dataEvents !== undefined) { bindEvents($("input",thd)[0], soptions.dataEvents); }
+ if(p.autosearch===true){
+ if(p.searchOnEnter) {
+ $("input",thd).keypress(function(e){
+ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+ if(key == 13){
+ triggerToolbar();
+ return false;
+ }
+ return this;
+ });
+ } else {
+ $("input",thd).keydown(function(e){
+ var key = e.which;
+ switch (key) {
+ case 13:
+ return false;
+ case 9 :
+ case 16:
+ case 37:
+ case 38:
+ case 39:
+ case 40:
+ case 27:
+ break;
+ default :
+ if(timeoutHnd) { clearTimeout(timeoutHnd); }
+ timeoutHnd = setTimeout(function(){triggerToolbar();},500);
+ }
+ });
+ }
+ }
+ break;
+ }
+ }
+ $(th).append(thd);
+ $(tr).append(th);
+ });
+ $("table thead",$t.grid.hDiv).append(tr);
+ this.ftoolbar = true;
+ this.triggerToolbar = triggerToolbar;
+ this.clearToolbar = clearToolbar;
+ this.toggleToolbar = toggleToolbar;
+ });
+ }
+});
+})(jQuery);
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/grid.filter.js'
--- addons/base/static/jquery.jqGrid/js/grid.filter.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.filter.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,675 @@
+/*
+ * jqFilter jQuery jqGrid filter addon.
+ * Copyright (c) 2011, Tony Tomov, tony@xxxxxxxxxxx
+ * Dual licensed under the MIT and GPL licenses
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * The work is inspired from this Stefan Pirvu
+ * http://www.codeproject.com/KB/scripting/json-filtering.aspx
+ *
+ * The filter uses JSON entities to hold filter rules and groups. Here is an example of a filter:
+
+{ "groupOp": "AND",
+ "groups" : [
+ { "groupOp": "OR",
+ "rules": [
+ { "field": "name", "op": "eq", "data": "England" },
+ { "field": "id", "op": "le", "data": "5"}
+ ]
+ }
+ ],
+ "rules": [
+ { "field": "name", "op": "eq", "data": "Romania" },
+ { "field": "id", "op": "le", "data": "1"}
+ ]
+}
+*/
+/*global jQuery, $ */
+
+(function ($) {
+
+$.fn.jqFilter = function( arg ) {
+ if (typeof arg === 'string') {
+
+ var fn = $.fn.jqFilter[arg];
+ if (!fn) {
+ throw ("jqFilter - No such method: " + arg);
+ }
+ var args = $.makeArray(arguments).slice(1);
+ return fn.apply(this,args);
+ }
+
+ var p = $.extend(true,{
+ filter: null,
+ columns: [],
+ onChange : null,
+ checkValues : null,
+ error: false,
+ errmsg : "",
+ errorcheck : true,
+ showQuery : true,
+ sopt : null,
+ ops : [
+ {"name": "eq", "description": "equal", "operator":"="},
+ {"name": "ne", "description": "not equal", "operator":"<>"},
+ {"name": "lt", "description": "less", "operator":"<"},
+ {"name": "le", "description": "less or equal","operator":"<="},
+ {"name": "gt", "description": "greater", "operator":">"},
+ {"name": "ge", "description": "greater or equal", "operator":">="},
+ {"name": "bw", "description": "begins with", "operator":"LIKE"},
+ {"name": "bn", "description": "does not begin with", "operator":"NOT LIKE"},
+ {"name": "in", "description": "in", "operator":"IN"},
+ {"name": "ni", "description": "not in", "operator":"NOT IN"},
+ {"name": "ew", "description": "ends with", "operator":"LIKE"},
+ {"name": "en", "description": "does not end with", "operator":"NOT LIKE"},
+ {"name": "cn", "description": "contains", "operator":"LIKE"},
+ {"name": "nc", "description": "does not contain", "operator":"NOT LIKE"},
+ {"name": "nu", "description": "is null", "operator":"IS NULL"},
+ {"name": "nn", "description": "is not null", "operator":"IS NOT NULL"}
+ ],
+ numopts : ['eq','ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'],
+ stropts : ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc', 'nu', 'nn', 'in', 'ni'],
+ _gridsopt : [], // grid translated strings, do not tuch
+ groupOps : ["AND", "OR"],
+ groupButton : true
+ }, arg || {});
+ return this.each( function() {
+ if (this.filter) {return;}
+ this.p = p;
+ // setup filter in case if they is not defined
+ if (this.p.filter === null || this.p.filter === undefined) {
+ this.p.filter = {
+ groupOp: this.p.groupOps[0],
+ rules: [],
+ groups: []
+ };
+ }
+ var i, len = this.p.columns.length, cl;
+
+ // translating the options
+ if(this.p._gridsopt.length) {
+ // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
+ for(i=0;i<this.p._gridsopt.length;i++) {
+ this.p.ops[i].description = this.p._gridsopt[i];
+ }
+ }
+ this.p.initFilter = $.extend(true,{},this.p.filter);
+
+ // set default values for the columns if they are not set
+ if( !len ) {return;}
+ for(i=0; i < len; i++) {
+ cl = this.p.columns[i];
+ if( cl.stype ) {
+ // grid compatibility
+ cl.inputtype = cl.stype;
+ } else if(!cl.inputtype) {
+ cl.inputtype = 'text';
+ }
+ if( cl.sorttype ) {
+ // grid compatibility
+ cl.searchtype = cl.sorttype;
+ } else if (!cl.searchtype) {
+ cl.searchtype = 'string';
+ }
+ if(cl.hidden === undefined) {
+ // jqGrid compatibility
+ cl.hidden = false;
+ }
+ if(!cl.label) {
+ cl.label = cl.name;
+ }
+ if(!cl.hasOwnProperty('searchoptions')) {
+ cl.searchoptions = {};
+ }
+ if(!cl.hasOwnProperty('searchrules')) {
+ cl.searchrules = {};
+ }
+
+ }
+ if(this.p.showQuery) {
+ $(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>");
+ }
+ /*
+ *Perform checking.
+ *
+ */
+ var checkData = function(val, colModelItem) {
+ var ret = [true,""];
+ if($.isFunction(colModelItem.searchrules)) {
+ ret = colModelItem.searchrules(val, colModelItem);
+ } else if($.jgrid && $.jgrid.checkValues) {
+ try {
+ ret = $.jgrid.checkValues(val, -1, null, colModelItem.searchrules, colModelItem.label);
+ } catch (e) {}
+ }
+ if(ret && ret.length && ret[0] === false) {
+ p.error = !ret[0];
+ p.errmsg = ret[1];
+ }
+ },
+ randId = function() {
+ return Math.floor(Math.random()*10000).toString();
+ };
+
+ this.onchange = function ( ){
+ // clear any error
+ this.p.error = false;
+ this.p.errmsg="";
+ return $.isFunction(this.p.onChange) ? this.p.onChange.call( this, this.p ) : false;
+ };
+ /*
+ * Redrow the filter every time when new field is added/deleted
+ * and field is changed
+ */
+ this.reDraw = function() {
+ $("table.group:first",this).remove();
+ var t = this.createTableForGroup(p.filter, null);
+ $(this).append(t);
+ };
+ /*
+ * Creates a grouping data for the filter
+ * @param group - object
+ * @param parentgroup - object
+ */
+ this.createTableForGroup = function(group, parentgroup) {
+ var that = this, i;
+
+ // this table will hold all the group (tables) and rules (rows)
+ var table = $("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody>");
+ // create error message row
+ if(parentgroup === null) {
+ $(table).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");
+ }
+
+ var tr = $("<tr></tr>");
+ $(table).append(tr);
+ // this header will hold the group operator type and group action buttons for
+ // creating subgroup "+ {}", creating rule "+" or deleting the group "-"
+ var th = $("<th colspan='5' align='left'></th>");
+ tr.append(th);
+
+ // dropdown for: choosing group operator type
+ var groupOpSelect = $("<select class='opsel'></select>");
+ th.append(groupOpSelect);
+ // populate dropdown with all posible group operators: or, and
+ var str= "", selected;
+ for (i = 0; i < p.groupOps.length; i++) {
+ selected = group.groupOp === that.p.groupOps[i] ? " selected='selected'" :"";
+ str += "<option value='"+that.p.groupOps[i]+"'" + selected+">"+that.p.groupOps[i]+"</option>";
+ }
+
+ groupOpSelect
+ .append(str)
+ .bind('change',function() {
+ group.groupOp = $(groupOpSelect).val();
+ that.onchange(); // signals that the filter has changed
+ });
+
+ // button for adding a new subgroup
+ var inputAddSubgroup;
+ if(this.p.groupButton) {
+ inputAddSubgroup = $("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");
+ inputAddSubgroup.bind('click',function() {
+ if (group.groups === undefined ) {
+ group.groups = [];
+ }
+
+ group.groups.push({
+ groupOp: p.groupOps[0],
+ rules: [],
+ groups: []
+ }); // adding a new group
+
+ that.reDraw(); // the html has changed, force reDraw
+
+ that.onchange(); // signals that the filter has changed
+ return false;
+ });
+ } else {
+ inputAddSubgroup = "<span></span>";
+ }
+ th.append(inputAddSubgroup);
+
+ // button for adding a new rule
+ var inputAddRule = $("<input type='button' value='+' title='Add rule' class='add-rule'/>"), cm;
+ inputAddRule.bind('click',function() {
+ //if(!group) { group = {};}
+ if (group.rules === undefined) {
+ group.rules = [];
+ }
+ for (i = 0; i < that.p.columns.length; i++) {
+ // but show only serchable and serchhidden = true fields
+ var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search ,
+ hidden = (that.p.columns[i].hidden === true),
+ ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
+ if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+ cm = that.p.columns[i];
+ break;
+ }
+ }
+ var opr;
+ if( cm.searchoptions.sopt ) {opr = cm.searchoptions.sopt;}
+ else if(that.p.sopt) { opr= that.p.sopt; }
+ else if (cm.searchtype === 'string') {opr = that.p.stropts;}
+ else {opr = that.p.numopts;}
+
+ group.rules.push({
+ field: cm.name,
+ op: opr[0],
+ data: ""
+ }); // adding a new rule
+
+ that.reDraw(); // the html has changed, force reDraw
+ // for the moment no change have been made to the rule, so
+ // this will not trigger onchange event
+ return false;
+ });
+ th.append(inputAddRule);
+
+ // button for delete the group
+ if (parentgroup !== null) { // ignore the first group
+ var inputDeleteGroup = $("<input type='button' value='-' title='Delete group' class='delete-group'/>");
+ th.append(inputDeleteGroup);
+ inputDeleteGroup.bind('click',function() {
+ // remove group from parent
+ for (i = 0; i < parentgroup.groups.length; i++) {
+ if (parentgroup.groups[i] === group) {
+ parentgroup.groups.splice(i, 1);
+ break;
+ }
+ }
+
+ that.reDraw(); // the html has changed, force reDraw
+
+ that.onchange(); // signals that the filter has changed
+ return false;
+ });
+ }
+
+ // append subgroup rows
+ if (group.groups !== undefined) {
+ for (i = 0; i < group.groups.length; i++) {
+ var trHolderForSubgroup = $("<tr></tr>");
+ table.append(trHolderForSubgroup);
+
+ var tdFirstHolderForSubgroup = $("<td class='first'></td>");
+ trHolderForSubgroup.append(tdFirstHolderForSubgroup);
+
+ var tdMainHolderForSubgroup = $("<td colspan='4'></td>");
+ tdMainHolderForSubgroup.append(this.createTableForGroup(group.groups[i], group));
+ trHolderForSubgroup.append(tdMainHolderForSubgroup);
+ }
+ }
+ if(group.groupOp === undefined) {
+ group.groupOp = that.p.groupOps[0];
+ }
+
+ // append rules rows
+ if (group.rules !== undefined) {
+ for (i = 0; i < group.rules.length; i++) {
+ table.append(
+ this.createTableRowForRule(group.rules[i], group)
+ );
+ }
+ }
+
+ return table;
+ };
+ /*
+ * Create the rule data for the filter
+ */
+ this.createTableRowForRule = function(rule, group) {
+ // save current entity in a variable so that it could
+ // be referenced in anonimous method calls
+
+ var that=this, tr = $("<tr></tr>"),
+ //document.createElement("tr"),
+
+ // first column used for padding
+ //tdFirstHolderForRule = document.createElement("td"),
+ i, op, trpar, cm, str="", selected;
+ //tdFirstHolderForRule.setAttribute("class", "first");
+ tr.append("<td class='first'></td>");
+
+
+ // create field container
+ var ruleFieldTd = $("<td class='columns'></td>");
+ tr.append(ruleFieldTd);
+
+
+ // dropdown for: choosing field
+ var ruleFieldSelect = $("<select></select>");
+ ruleFieldTd.append(ruleFieldSelect);
+ ruleFieldSelect.bind('change',function() {
+ rule.field = $(ruleFieldSelect).val();
+
+ trpar = $(this).parents("tr:first");
+ for (i=0;i<that.p.columns.length;i++) {
+ if(that.p.columns[i].name === rule.field) {
+ cm = that.p.columns[i];
+ break;
+ }
+ }
+ if(!cm) { return;}
+ cm.searchoptions.id = randId();
+ var elm = $.jgrid.createEl(cm.inputtype,cm.searchoptions, "", true, that.p.ajaxSelectOptions, true);
+ $(elm).addClass("input-elm");
+ //that.createElement(rule, "");
+
+ if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
+ else if(that.p.sopt) { op= that.p.sopt; }
+ else if (cm.searchtype === 'string') {op = that.p.stropts;}
+ else {op = that.p.numopts;}
+ // operators
+ var s ="",so="";
+ for ( i = 0; i < that.p.ops.length; i++) {
+ if($.inArray(that.p.ops[i].name, op) !== -1) {
+ so = rule.op === that.p.ops[i].name ? " selected=selected" : "";
+ s += "<option value='"+that.p.ops[i].name+"'"+ so+">"+that.p.ops[i].description+"</option>";
+ }
+ }
+ $(".selectopts",trpar).empty().append( s );
+
+ // data
+ $(".data",trpar).empty().append( elm );
+ $(".input-elm",trpar).bind('change',function() {
+ rule.data = $(this).val();
+ if($.isArray(rule.data)) { rule.data = rule.data.join(","); }
+ that.onchange(); // signals that the filter has changed
+ });
+ setTimeout(function(){ //IE, Opera, Chrome
+ rule.data = $(elm).val();
+ that.onchange(); // signals that the filter has changed
+ }, 0);
+ });
+
+ // populate drop down with user provided column definitions
+ var j=0;
+ for (i = 0; i < that.p.columns.length; i++) {
+ // but show only serchable and serchhidden = true fields
+ var searchable = (typeof that.p.columns[i].search === 'undefined') ? true: that.p.columns[i].search ,
+ hidden = (that.p.columns[i].hidden === true),
+ ignoreHiding = (that.p.columns[i].searchoptions.searchhidden === true);
+ if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+ selected = "";
+ if(rule.field === that.p.columns[i].name) {
+ selected = " selected='selected'";
+ j=i;
+ }
+ str += "<option value='"+that.p.columns[i].name+"'" +selected+">"+that.p.columns[i].label+"</option>";
+ }
+ }
+ ruleFieldSelect.append( str );
+
+
+ // create operator container
+ var ruleOperatorTd = $("<td class='operators'></td>");
+ tr.append(ruleOperatorTd);
+ cm = p.columns[j];
+ // create it here so it can be referentiated in the onchange event
+ //var RD = that.createElement(rule, rule.data);
+ cm.searchoptions.id = randId();
+ var ruleDataInput = $.jgrid.createEl(cm.inputtype,cm.searchoptions, rule.data, true, that.p.ajaxSelectOptions, true);
+
+ // dropdown for: choosing operator
+ var ruleOperatorSelect = $("<select class='selectopts'></select>");
+ ruleOperatorTd.append(ruleOperatorSelect);
+ ruleOperatorSelect.bind('change',function() {
+ rule.op = $(ruleOperatorSelect).val();
+ trpar = $(this).parents("tr:first");
+ var rd = $(".input-elm",trpar)[0];
+ if (rule.op === "nu" || rule.op === "nn") { // disable for operator "is null" and "is not null"
+ rule.data = "";
+ rd.value = "";
+ rd.setAttribute("readonly", "true");
+ rd.setAttribute("disabled", "true");
+ } else {
+ rd.removeAttribute("readonly");
+ rd.removeAttribute("disabled");
+ }
+
+ that.onchange(); // signals that the filter has changed
+ });
+
+ // populate drop down with all available operators
+ if( cm.searchoptions.sopt ) {op = cm.searchoptions.sopt;}
+ else if(that.p.sopt) { op= that.p.sopt; }
+ else if (cm.searchtype === 'string') {op = p.stropts;}
+ else {op = that.p.numopts;}
+ str="";
+ for ( i = 0; i < that.p.ops.length; i++) {
+ if($.inArray(that.p.ops[i].name, op) !== -1) {
+ selected = rule.op === that.p.ops[i].name ? " selected='selected'" : "";
+ str += "<option value='"+that.p.ops[i].name+"'"+selected+">"+that.p.ops[i].description+"</option>";
+ }
+ }
+ ruleOperatorSelect.append( str );
+ // create data container
+ var ruleDataTd = $("<td class='data'></td>");
+ tr.append(ruleDataTd);
+
+ // textbox for: data
+ // is created previously
+ //ruleDataInput.setAttribute("type", "text");
+ ruleDataTd.append(ruleDataInput);
+
+ $(ruleDataInput)
+ .addClass("input-elm")
+ .bind('change', function() {
+ rule.data = $(this).val();
+ if($.isArray(rule.data)) { rule.data = rule.data.join(","); }
+
+ that.onchange(); // signals that the filter has changed
+ });
+
+ // create action container
+ var ruleDeleteTd = $("<td></td>");
+ tr.append(ruleDeleteTd);
+
+ // create button for: delete rule
+ var ruleDeleteInput = $("<input type='button' value='-' title='Delete rule' class='delete-rule'/>");
+ ruleDeleteTd.append(ruleDeleteInput);
+ //$(ruleDeleteInput).html("").height(20).width(30).button({icons: { primary: "ui-icon-minus", text:false}});
+ ruleDeleteInput.bind('click',function() {
+ // remove rule from group
+ for (i = 0; i < group.rules.length; i++) {
+ if (group.rules[i] === rule) {
+ group.rules.splice(i, 1);
+ break;
+ }
+ }
+
+ that.reDraw(); // the html has changed, force reDraw
+
+ that.onchange(); // signals that the filter has changed
+ return false;
+ });
+
+ return tr;
+ };
+
+ this.getStringForGroup = function(group) {
+ var s = "(", index;
+ if (group.groups !== undefined) {
+ for (index = 0; index < group.groups.length; index++) {
+ if (s.length > 1) {
+ s += " " + group.groupOp + " ";
+ }
+ try {
+ s += this.getStringForGroup(group.groups[index]);
+ } catch (eg) {alert(eg);}
+ }
+ }
+
+ if (group.rules !== undefined) {
+ try{
+ for (index = 0; index < group.rules.length; index++) {
+ if (s.length > 1) {
+ s += " " + group.groupOp + " ";
+ }
+ s += this.getStringForRule(group.rules[index]);
+ }
+ } catch (e) {alert(e);}
+ }
+
+ s += ")";
+
+ if (s === "()") {
+ return ""; // ignore groups that don't have rules
+ } else {
+ return s;
+ }
+ };
+ this.getStringForRule = function(rule) {
+ var opUF = "",opC="", i, cm, ret, val,
+ numtypes = ['int', 'integer', 'float', 'number', 'currency']; // jqGrid
+ for (i = 0; i < this.p.ops.length; i++) {
+ if (this.p.ops[i].name === rule.op) {
+ opUF = this.p.ops[i].operator;
+ opC = this.p.ops[i].name;
+ break;
+ }
+ }
+ for (i=0; i<this.p.columns.length; i++) {
+ if(this.p.columns[i].name === rule.field) {
+ cm = this.p.columns[i];
+ break;
+ }
+ }
+ val = rule.data;
+ if(opC === 'bw' || opC === 'bn') { val = val+"%"; }
+ if(opC === 'ew' || opC === 'en') { val = "%"+val; }
+ if(opC === 'cn' || opC === 'nc') { val = "%"+val+"%"; }
+ if(opC === 'in' || opC === 'ni') { val = " ("+val+")"; }
+ if(p.errorcheck) { checkData(rule.data, cm); }
+ if($.inArray(cm.searchtype, numtypes) !== -1 || opC === 'nn' || opC === 'nu') { ret = rule.field + " " + opUF + " " + val; }
+ else { ret = rule.field + " " + opUF + " \"" + val + "\""; }
+ return ret;
+ };
+ this.resetFilter = function () {
+ this.p.filter = $.extend(true,{},this.p.initFilter);
+ this.reDraw();
+ this.onchange();
+ };
+ this.hideError = function() {
+ $("th.ui-state-error", this).html("");
+ $("tr.error", this).hide();
+ };
+ this.showError = function() {
+ $("th.ui-state-error", this).html(this.p.errmsg);
+ $("tr.error", this).show();
+ };
+ this.toUserFriendlyString = function() {
+ return this.getStringForGroup(p.filter);
+ };
+ this.toString = function() {
+ // this will obtain a string that can be used to match an item.
+ var that = this;
+ function getStringRule(rule) {
+ if(that.p.errorcheck) {
+ var i, cm;
+ for (i=0; i<that.p.columns.length; i++) {
+ if(that.p.columns[i].name === rule.field) {
+ cm = that.p.columns[i];
+ break;
+ }
+ }
+ if(cm) {checkData(rule.data, cm);}
+ }
+ return rule.op + "(item." + rule.field + ",'" + rule.data + "')";
+ }
+
+ function getStringForGroup(group) {
+ var s = "(", index;
+
+ if (group.groups !== undefined) {
+ for (index = 0; index < group.groups.length; index++) {
+ if (s.length > 1) {
+ if (group.groupOp === "OR") {
+ s += " || ";
+ }
+ else {
+ s += " && ";
+ }
+ }
+ s += getStringForGroup(group.groups[index]);
+ }
+ }
+
+ if (group.rules !== undefined) {
+ for (index = 0; index < group.rules.length; index++) {
+ if (s.length > 1) {
+ if (group.groupOp === "OR") {
+ s += " || ";
+ }
+ else {
+ s += " && ";
+ }
+ }
+ s += getStringRule(group.rules[index]);
+ }
+ }
+
+ s += ")";
+
+ if (s === "()") {
+ return ""; // ignore groups that don't have rules
+ } else {
+ return s;
+ }
+ }
+
+ return getStringForGroup(this.p.filter);
+ };
+
+ // Here we init the filter
+ this.reDraw();
+
+ if(this.p.showQuery) {
+ this.onchange();
+ }
+ // mark is as created so that it will not be created twice on this element
+ this.filter = true;
+ });
+};
+$.extend($.fn.jqFilter,{
+ /*
+ * Return SQL like string. Can be used directly
+ */
+ toSQLString : function()
+ {
+ var s ="";
+ this.each(function(){
+ s = this.toUserFriendlyString();
+ });
+ return s;
+ },
+ /*
+ * Return filter data as object.
+ */
+ filterData : function()
+ {
+ var s;
+ this.each(function(){
+ s = this.p.filter;
+ });
+ return s;
+
+ },
+ getParameter : function (param) {
+ if(param !== undefined) {
+ if (this.p.hasOwnProperty(param) ) {
+ return this.p[param];
+ }
+ }
+ return this.p;
+ },
+ resetFilter: function() {
+ return this.each(function(){
+ this.resetFilter();
+ });
+ }
+
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.formedit.js'
--- addons/base/static/jquery.jqGrid/js/grid.formedit.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.formedit.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,1888 @@
+(function($){
+/**
+ * jqGrid extension for form editing Grid Data
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+/*global xmlJsonClass, jQuery, $ */
+var rp_ge = null;
+$.jgrid.extend({
+ searchGrid : function (p) {
+ p = $.extend({
+ recreateFilter: false,
+ drag: true,
+ sField:'searchField',
+ sValue:'searchString',
+ sOper: 'searchOper',
+ sFilter: 'filters',
+ loadDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only.
+ beforeShowSearch: null,
+ afterShowSearch : null,
+ onInitializeSearch: null,
+ closeAfterSearch : false,
+ closeAfterReset: false,
+ closeOnEscape : false,
+ multipleSearch : false,
+ multipleGroup : false,
+ //cloneSearchRowOnAdd: true,
+ top : 0,
+ left: 0,
+ jqModal : true,
+ modal: true,
+ resize : false,
+ width: 450,
+ height: 'auto',
+ dataheight: 'auto',
+ showQuery: true,
+ errorcheck : true,
+ // translation
+ // if you want to change or remove the order change it in sopt
+ // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'],
+ sopt: null,
+ stringResult: undefined,
+ onClose : null,
+ onSearch : null,
+ onReset : null,
+ overlay : 10,
+ columns : []
+ }, $.jgrid.search, p || {});
+ return this.each(function() {
+ var $t = this;
+ if(!$t.grid) {return;}
+ var fid = "fbox_"+$t.p.id,
+ showFrm = true,
+ IDs = {themodal:'editmod'+fid,modalhead:'edithd'+fid,modalcontent:'editcnt'+fid, scrollelm : fid},
+ defaultFilters = $t.p.postData[p.sFilter],
+ fil = $("<div><div id='"+fid+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+$t.p.id);
+ if(typeof(defaultFilters) === "string") {
+ defaultFilters = $.jgrid.parse( defaultFilters );
+ }
+ if(p.recreateFilter === true) {
+ $("#"+IDs.themodal).remove();
+ }
+ function showFilter() {
+ if($.isFunction(p.beforeShowSearch)) {
+ showFrm = p.beforeShowSearch($("#"+fid));
+ if(typeof(showFrm) === "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm) {
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+fid,jqm:p.jqModal, modal:p.modal, overlay: p.overlay});
+ if($.isFunction(p.afterShowSearch)) {
+ p.afterShowSearch($("#"+fid));
+ }
+ }
+ }
+ if ( $("#"+IDs.themodal).html() !== null ) {
+ showFilter();
+ } else {
+ if($.isFunction(p.onInitializeSearch) ) {
+ p.onInitializeSearch($("#"+fid));
+ }
+ var columns = $.extend([],$t.p.colModel),
+ bS ="<a href='javascript:void(0)' id='"+fid+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-search'></span>"+p.Find+"</a>",
+ bC ="<a href='javascript:void(0)' id='"+fid+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+p.Reset+"</a>",
+ bQ = "";
+ if(p.showQuery) {
+ bQ ="<a href='javascript:void(0)' id='"+fid+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";
+ }
+ var bt = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable ui-widget content' style='border:0px none;margin-top:5px' id='"+fid+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+bC+"</td><td class='EditButton'>"+bQ+bS+"</td></tr></tbody></table>",
+ colnm, found=false;
+ if(!p.columns.length) {
+ $.each(columns, function(i,n){
+ if(!n.label) {
+ n.label = $t.p.colNames[i];
+ }
+ // find first searchable column and set it if no default filter
+ if(!found) {
+ var searchable = (typeof n.search === 'undefined') ? true: n.search ,
+ hidden = (n.hidden === true),
+ ignoreHiding = (n.searchoptions && n.searchoptions.searchhidden === true);
+ if ((ignoreHiding && searchable) || (searchable && !hidden)) {
+ found = true;
+ colnm = n.name;
+ }
+ }
+ });
+ } else {
+ columns = p.columns;
+ }
+ // old behaviour
+ if( (!defaultFilters && colnm) || p.multipleSearch === false ) {
+ defaultFilters = {"groupOp": "AND",rules:[{"field":colnm,"op":"eq","data":""}]};
+ }
+ $("#"+fid).jqFilter({
+ columns : columns,
+ filter: p.loadDefaults ? defaultFilters : null,
+ showQuery: p.showQuery,
+ errorcheck : p.errorcheck,
+ sopt: p.sopt,
+ groupButton : p.multipleGroup,
+ _gridsopt : $.jgrid.search.odata,
+ onChange : function( sp ) {
+ if(this.p.showQuery) {
+ $('.query',this).html(this.toUserFriendlyString());
+ }
+ }
+ });
+ fil.append( bt );
+ if(p.multipleSearch === false) {
+ $(".add-rule","#"+fid).hide();
+ $(".delete-rule","#"+fid).hide();
+ }
+ if($.isFunction(p.onInitializeSearch) ) {
+ p.onInitializeSearch($("#"+fid));
+ }
+ $.jgrid.createModal(IDs ,fil,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0]);
+ if(bQ) {
+ $("#"+fid+"_query").bind('click', function(e){
+ $(".queryresult", fil).toggle();
+ return false;
+ });
+ }
+ if (p.stringResult===undefined) {
+ // to provide backward compatibility, inferring stringResult value from multipleSearch
+ p.stringResult = p.multipleSearch;
+ }
+ $("#"+fid+"_search").bind('click', function(){
+ var fl = $("#"+fid),
+ sdata={}, res ,
+ filters = fl.jqFilter('filterData');
+ if(p.errorcheck) {
+ fl[0].hideError();
+ if(!p.showQuery) { fl.jqFilter('toSQLString'); }
+ if(fl[0].p.error) {
+ fl[0].showError();
+ return false;
+ }
+ }
+
+ if(p.stringResult && $t.p.datatype !== "local") {
+ try {
+ // xmlJsonClass or JSON.stringify
+ res = xmlJsonClass.toJson(filters, '', '', false);
+ } catch (e) {
+ try {
+ res = JSON.stringify(filters);
+ } catch (e2) { }
+ }
+ if(typeof(res)==="string") {
+ sdata[p.sFilter] = res;
+ $.each([p.sField,p.sValue, p.sOper], function() { sdata[this] = "";});
+ }
+ } else {
+ if(p.multipleSearch) {
+ sdata[p.sFilter] = filters;
+ $.each([p.sField,p.sValue, p.sOper], function() { sdata[this] = "";});
+ } else {
+ sdata[p.sField] = filters.rules[0].field;
+ sdata[p.sValue] = filters.rules[0].data;
+ sdata[p.sOper] = filters.rules[0].op;
+ sdata[p.sFilter] = "";
+ }
+ }
+ $t.p.search = true;
+ $.extend($t.p.postData,sdata);
+ $($t).trigger("reloadGrid",[{page:1}]);
+ if($.isFunction(p.onSearch) ) {
+ p.onSearch();
+ }
+ if(p.closeAfterSearch) {
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+$t.p.id,jqm:p.jqModal,onClose: p.onClose});
+ }
+ return false;
+ });
+ $("#"+fid+"_reset").bind('click', function(){
+ var sdata={},
+ fl = $("#"+fid);
+ $t.p.search = false;
+ if(p.multipleSearch===false) {
+ sdata[p.sField] = sdata[p.sValue] = sdata[p.sOper] = "";
+ } else {
+ sdata[p.sFilter] = "";
+ }
+ fl[0].resetFilter();
+ $.extend($t.p.postData,sdata);
+ $($t).trigger("reloadGrid",[{page:1}]);
+ if($.isFunction(p.onReset) ) {
+ p.onReset();
+ }
+ return false;
+ });
+ showFilter();
+ $(".fm-button:not(.ui-state-disabled)",fil).hover(
+ function(){$(this).addClass('ui-state-hover');},
+ function(){$(this).removeClass('ui-state-hover');}
+ );
+ }
+ });
+ },
+ editGridRow : function(rowid, p){
+ p = $.extend({
+ top : 0,
+ left: 0,
+ width: 300,
+ height: 'auto',
+ dataheight: 'auto',
+ modal: false,
+ overlay : 10,
+ drag: true,
+ resize: true,
+ url: null,
+ mtype : "POST",
+ clearAfterAdd :true,
+ closeAfterEdit : false,
+ reloadAfterSubmit : true,
+ onInitializeForm: null,
+ beforeInitData: null,
+ beforeShowForm: null,
+ afterShowForm: null,
+ beforeSubmit: null,
+ afterSubmit: null,
+ onclickSubmit: null,
+ afterComplete: null,
+ onclickPgButtons : null,
+ afterclickPgButtons: null,
+ editData : {},
+ recreateForm : false,
+ jqModal : true,
+ closeOnEscape : false,
+ addedrow : "first",
+ topinfo : '',
+ bottominfo: '',
+ saveicon : [],
+ closeicon : [],
+ savekey: [false,13],
+ navkeys: [false,38,40],
+ checkOnSubmit : false,
+ checkOnUpdate : false,
+ _savedData : {},
+ processing : false,
+ onClose : null,
+ ajaxEditOptions : {},
+ serializeEditData : null,
+ viewPagerButtons : true
+ }, $.jgrid.edit, p || {});
+ rp_ge = p;
+ return this.each(function(){
+ var $t = this;
+ if (!$t.grid || !rowid) { return; }
+ var gID = $t.p.id,
+ frmgr = "FrmGrid_"+gID,frmtb = "TblGrid_"+gID,
+ IDs = {themodal:'editmod'+gID,modalhead:'edithd'+gID,modalcontent:'editcnt'+gID, scrollelm : frmgr},
+ onBeforeShow = $.isFunction(rp_ge.beforeShowForm) ? rp_ge.beforeShowForm : false,
+ onAfterShow = $.isFunction(rp_ge.afterShowForm) ? rp_ge.afterShowForm : false,
+ onBeforeInit = $.isFunction(rp_ge.beforeInitData) ? rp_ge.beforeInitData : false,
+ onInitializeForm = $.isFunction(rp_ge.onInitializeForm) ? rp_ge.onInitializeForm : false,
+ copydata = null,
+ showFrm = true,
+ maxCols = 1, maxRows=0, postdata, extpost, newData, diff;
+ if (rowid === "new") {
+ rowid = "_empty";
+ p.caption=rp_ge.addCaption;
+ } else {
+ p.caption=rp_ge.editCaption;
+ }
+ if(p.recreateForm===true && $("#"+IDs.themodal).html() !== null) {
+ $("#"+IDs.themodal).remove();
+ }
+ var closeovrl = true;
+ if(p.checkOnUpdate && p.jqModal && !p.modal) {
+ closeovrl = false;
+ }
+ function getFormData(){
+ $(".FormElement", "#"+frmtb).each(function(i) {
+ var celm = $(".customelement", this);
+ if (celm.length) {
+ var elem = celm[0], nm = $(elem).attr('name');
+ $.each($t.p.colModel, function(i,n){
+ if(this.name === nm && this.editoptions && $.isFunction(this.editoptions.custom_value)) {
+ try {
+ postdata[nm] = this.editoptions.custom_value($("#"+$.jgrid.jqID(nm),"#"+frmtb),'get');
+ if (postdata[nm] === undefined) { throw "e1"; }
+ } catch (e) {
+ if (e==="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose);}
+ else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+ }
+ return true;
+ }
+ });
+ } else {
+ switch ($(this).get(0).type) {
+ case "checkbox":
+ if($(this).attr("checked")) {
+ postdata[this.name]= $(this).val();
+ }else {
+ var ofv = $(this).attr("offval");
+ postdata[this.name]= ofv;
+ }
+ break;
+ case "select-one":
+ postdata[this.name]= $("option:selected",this).val();
+ extpost[this.name]= $("option:selected",this).text();
+ break;
+ case "select-multiple":
+ postdata[this.name]= $(this).val();
+ if(postdata[this.name]) { postdata[this.name] = postdata[this.name].join(","); }
+ else { postdata[this.name] =""; }
+ var selectedText = [];
+ $("option:selected",this).each(
+ function(i,selected){
+ selectedText[i] = $(selected).text();
+ }
+ );
+ extpost[this.name]= selectedText.join(",");
+ break;
+ case "password":
+ case "text":
+ case "textarea":
+ case "button":
+ postdata[this.name] = $(this).val();
+
+ break;
+ }
+ if($t.p.autoencode) { postdata[this.name] = $.jgrid.htmlEncode(postdata[this.name]); }
+ }
+ });
+ return true;
+ }
+ function createData(rowid,obj,tb,maxcols){
+ var nm, hc,trdata, cnt=0,tmp, dc,elc, retpos=[], ind=false,
+ tdtmpl = "<td class='CaptionTD'> </td><td class='DataTD'> </td>", tmpl="", i; //*2
+ for (i =1; i<=maxcols;i++) {
+ tmpl += tdtmpl;
+ }
+ if(rowid != '_empty') {
+ ind = $(obj).jqGrid("getInd",rowid);
+ }
+ $(obj.p.colModel).each( function(i) {
+ nm = this.name;
+ // hidden fields are included in the form
+ if(this.editrules && this.editrules.edithidden === true) {
+ hc = false;
+ } else {
+ hc = this.hidden === true ? true : false;
+ }
+ dc = hc ? "style='display:none'" : "";
+ if ( nm !== 'cb' && nm !== 'subgrid' && this.editable===true && nm !== 'rn') {
+ if(ind === false) {
+ tmp = "";
+ } else {
+ if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+ tmp = $("td:eq("+i+")",obj.rows[ind]).text();
+ } else {
+ try {
+ tmp = $.unformat($("td:eq("+i+")",obj.rows[ind]),{rowId:rowid, colModel:this},i);
+ } catch (_) {
+ tmp = $("td:eq("+i+")",obj.rows[ind]).html();
+ }
+ }
+ }
+ var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
+ frmopt = $.extend({}, {elmprefix:'',elmsuffix:'',rowabove:false,rowcontent:''}, this.formoptions || {}),
+ rp = parseInt(frmopt.rowpos,10) || cnt+1,
+ cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
+ if(rowid == "_empty" && opt.defaultValue ) {
+ tmp = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
+ }
+ if(!this.edittype) { this.edittype = "text"; }
+ if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+ elc = $.jgrid.createEl(this.edittype,opt,tmp,false,$.extend({},$.jgrid.ajaxOptions,obj.p.ajaxSelectOptions || {}));
+ if(tmp === "" && this.edittype == "checkbox") {tmp = $(elc).attr("offval");}
+ if(tmp === "" && this.edittype == "select") {tmp = $("option:eq(0)",elc).text();}
+ if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
+ $(elc).addClass("FormElement");
+ if(this.edittype == 'text' || this.edittype == 'textarea') {
+ $(elc).addClass("ui-widget-content ui-corner-all");
+ }
+ trdata = $(tb).find("tr[rowpos="+rp+"]");
+ if(frmopt.rowabove) {
+ var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
+ $(tb).append(newdata);
+ newdata[0].rp = rp;
+ }
+ if ( trdata.length===0 ) {
+ trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","tr_"+nm);
+ $(trdata).append(tmpl);
+ $(tb).append(trdata);
+ trdata[0].rp = rp;
+ }
+ $("td:eq("+(cp-2)+")",trdata[0]).html( typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label);
+ $("td:eq("+(cp-1)+")",trdata[0]).append(frmopt.elmprefix).append(elc).append(frmopt.elmsuffix);
+ retpos[cnt] = i;
+ cnt++;
+ }
+ });
+ if( cnt > 0) {
+ var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+obj.p.id+"_id' value='"+rowid+"'/></td></tr>");
+ idrow[0].rp = cnt+999;
+ $(tb).append(idrow);
+ if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) { rp_ge._savedData[obj.p.id+"_id"] = rowid; }
+ }
+ return retpos;
+ }
+ function fillData(rowid,obj,fmid){
+ var nm,cnt=0,tmp, fld,opt,vl,vlc;
+ if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {rp_ge._savedData = {};rp_ge._savedData[obj.p.id+"_id"]=rowid;}
+ var cm = obj.p.colModel;
+ if(rowid == '_empty') {
+ $(cm).each(function(i){
+ nm = this.name;
+ opt = $.extend({}, this.editoptions || {} );
+ fld = $("#"+$.jgrid.jqID(nm),"#"+fmid);
+ if(fld[0] !== null) {
+ vl = "";
+ if(opt.defaultValue ) {
+ vl = $.isFunction(opt.defaultValue) ? opt.defaultValue() : opt.defaultValue;
+ if(fld[0].type=='checkbox') {
+ vlc = vl.toLowerCase();
+ if(vlc.search(/(false|0|no|off|undefined)/i)<0 && vlc!=="") {
+ fld[0].checked = true;
+ fld[0].defaultChecked = true;
+ fld[0].value = vl;
+ } else {
+ fld.attr({checked:"",defaultChecked:""});
+ }
+ } else {fld.val(vl); }
+ } else {
+ if( fld[0].type=='checkbox' ) {
+ fld[0].checked = false;
+ fld[0].defaultChecked = false;
+ vl = $(fld).attr("offval");
+ } else if (fld[0].type && fld[0].type.substr(0,6)=='select') {
+ fld[0].selectedIndex = 0;
+ } else {
+ fld.val(vl);
+ }
+ }
+ if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = vl; }
+ }
+ });
+ $("#id_g","#"+fmid).val(rowid);
+ return;
+ }
+ var tre = $(obj).jqGrid("getInd",rowid,true);
+ if(!tre) { return; }
+ $('td',tre).each( function(i) {
+ nm = cm[i].name;
+ // hidden fields are included in the form
+ if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && cm[i].editable===true) {
+ if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+ tmp = $(this).text();
+ } else {
+ try {
+ tmp = $.unformat($(this),{rowId:rowid, colModel:cm[i]},i);
+ } catch (_) {
+ tmp = $(this).html();
+ }
+ }
+ if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+ if(rp_ge.checkOnSubmit===true || rp_ge.checkOnUpdate) { rp_ge._savedData[nm] = tmp; }
+ nm = $.jgrid.jqID(nm);
+ switch (cm[i].edittype) {
+ case "password":
+ case "text":
+ case "button" :
+ case "image":
+ $("#"+nm,"#"+fmid).val(tmp);
+ break;
+ case "textarea":
+ if(tmp == " " || tmp == " " || (tmp.length==1 && tmp.charCodeAt(0)==160) ) {tmp='';}
+ $("#"+nm,"#"+fmid).val(tmp);
+ break;
+ case "select":
+ var opv = tmp.split(",");
+ opv = $.map(opv,function(n){return $.trim(n);});
+ $("#"+nm+" option","#"+fmid).each(function(j){
+ if (!cm[i].editoptions.multiple && (opv[0] == $.trim($(this).text()) || opv[0] == $.trim($(this).val())) ){
+ this.selected= true;
+ } else if (cm[i].editoptions.multiple){
+ if( $.inArray($.trim($(this).text()), opv ) > -1 || $.inArray($.trim($(this).val()), opv ) > -1 ){
+ this.selected = true;
+ }else{
+ this.selected = false;
+ }
+ } else {
+ this.selected = false;
+ }
+ });
+ break;
+ case "checkbox":
+ tmp = tmp+"";
+ if(cm[i].editoptions && cm[i].editoptions.value) {
+ var cb = cm[i].editoptions.value.split(":");
+ if(cb[0] == tmp) {
+ $("#"+nm,"#"+fmid).attr("checked",true);
+ $("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
+ } else {
+ $("#"+nm,"#"+fmid).attr("checked",false);
+ $("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
+ }
+ } else {
+ tmp = tmp.toLowerCase();
+ if(tmp.search(/(false|0|no|off|undefined)/i)<0 && tmp!=="") {
+ $("#"+nm,"#"+fmid).attr("checked",true);
+ $("#"+nm,"#"+fmid).attr("defaultChecked",true); //ie
+ } else {
+ $("#"+nm,"#"+fmid).attr("checked",false);
+ $("#"+nm,"#"+fmid).attr("defaultChecked",""); //ie
+ }
+ }
+ break;
+ case 'custom' :
+ try {
+ if(cm[i].editoptions && $.isFunction(cm[i].editoptions.custom_value)) {
+ cm[i].editoptions.custom_value($("#"+nm,"#"+fmid),'set',tmp);
+ } else { throw "e1"; }
+ } catch (e) {
+ if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);}
+ else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+ }
+ break;
+ }
+ cnt++;
+ }
+ });
+ if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
+ }
+ function postIt() {
+ var copydata, ret=[true,"",""], onCS = {}, opers = $t.p.prmNames, idname, oper, key;
+ if($.isFunction(rp_ge.beforeCheckValues)) {
+ var retvals = rp_ge.beforeCheckValues(postdata,$("#"+frmgr),postdata[$t.p.id+"_id"] == "_empty" ? opers.addoper : opers.editoper);
+ if(retvals && typeof(retvals) === 'object') { postdata = retvals; }
+ }
+ for( key in postdata ){
+ if(postdata.hasOwnProperty(key)) {
+ ret = $.jgrid.checkValues(postdata[key],key,$t);
+ if(ret[0] === false) { break; }
+ }
+ }
+ if(ret[0]) {
+ if( $.isFunction( rp_ge.onclickSubmit)) { onCS = rp_ge.onclickSubmit(rp_ge,postdata) || {}; }
+ if( $.isFunction(rp_ge.beforeSubmit)) { ret = rp_ge.beforeSubmit(postdata,$("#"+frmgr)); }
+ }
+
+ if(ret[0] && !rp_ge.processing) {
+ rp_ge.processing = true;
+ $("#sData", "#"+frmtb+"_2").addClass('ui-state-active');
+ oper = opers.oper;
+ idname = opers.id;
+ // we add to pos data array the action - the name is oper
+ postdata[oper] = ($.trim(postdata[$t.p.id+"_id"]) == "_empty") ? opers.addoper : opers.editoper;
+ if(postdata[oper] != opers.addoper) {
+ postdata[idname] = postdata[$t.p.id+"_id"];
+ } else {
+ // check to see if we have allredy this field in the form and if yes lieve it
+ if( postdata[idname] === undefined ) { postdata[idname] = postdata[$t.p.id+"_id"]; }
+ }
+ delete postdata[$t.p.id+"_id"];
+ postdata = $.extend(postdata,rp_ge.editData,onCS);
+
+ var ajaxOptions = $.extend({
+ url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
+ type: rp_ge.mtype,
+ data: $.isFunction(rp_ge.serializeEditData) ? rp_ge.serializeEditData(postdata) : postdata,
+ complete:function(data,Status){
+ if(Status != "success") {
+ ret[0] = false;
+ if ($.isFunction(rp_ge.errorTextFormat)) {
+ ret[1] = rp_ge.errorTextFormat(data);
+ } else {
+ ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
+ }
+ } else {
+ // data is posted successful
+ // execute aftersubmit with the returned data from server
+ if( $.isFunction(rp_ge.afterSubmit) ) {
+ ret = rp_ge.afterSubmit(data,postdata);
+ }
+ }
+ if(ret[0] === false) {
+ $("#FormError>td","#"+frmtb).html(ret[1]);
+ $("#FormError","#"+frmtb).show();
+ } else {
+ // remove some values if formattaer select or checkbox
+ $.each($t.p.colModel, function(i,n){
+ if(extpost[this.name] && this.formatter && this.formatter=='select') {
+ try {delete extpost[this.name];} catch (e) {}
+ }
+ });
+ postdata = $.extend(postdata,extpost);
+ if($t.p.autoencode) {
+ $.each(postdata,function(n,v){
+ postdata[n] = $.jgrid.htmlDecode(v);
+ });
+ }
+ rp_ge.reloadAfterSubmit = rp_ge.reloadAfterSubmit && $t.p.datatype != "local";
+ // the action is add
+ if(postdata[oper] == opers.addoper ) {
+ //id processing
+ // user not set the id ret[2]
+ if(!ret[2]) { ret[2] = (parseInt($t.p.records,10)+1)+""; }
+ postdata[idname] = ret[2];
+ if(rp_ge.closeAfterAdd) {
+ if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
+ else {
+ $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow);
+ $($t).jqGrid("setSelection",ret[2]);
+ }
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
+ } else if (rp_ge.clearAfterAdd) {
+ if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
+ else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
+ fillData("_empty",$t,frmgr);
+ } else {
+ if(rp_ge.reloadAfterSubmit) { $($t).trigger("reloadGrid"); }
+ else { $($t).jqGrid("addRowData",ret[2],postdata,p.addedrow); }
+ }
+ } else {
+ // the action is update
+ if(rp_ge.reloadAfterSubmit) {
+ $($t).trigger("reloadGrid");
+ if( !rp_ge.closeAfterEdit ) { setTimeout(function(){$($t).jqGrid("setSelection",postdata[idname]);},1000); }
+ } else {
+ if($t.p.treeGrid === true) {
+ $($t).jqGrid("setTreeRow",postdata[idname],postdata);
+ } else {
+ $($t).jqGrid("setRowData",postdata[idname],postdata);
+ }
+ }
+ if(rp_ge.closeAfterEdit) { $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose}); }
+ }
+ if($.isFunction(rp_ge.afterComplete)) {
+ copydata = data;
+ setTimeout(function(){rp_ge.afterComplete(copydata,postdata,$("#"+frmgr));copydata=null;},500);
+ }
+ }
+ rp_ge.processing=false;
+ if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
+ $("#"+frmgr).data("disabled",false);
+ if(rp_ge._savedData[$t.p.id+"_id"] !="_empty"){
+ for(var key in rp_ge._savedData) {
+ if(postdata[key]) {
+ rp_ge._savedData[key] = postdata[key];
+ }
+ }
+ }
+ }
+ $("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
+ try{$(':input:visible',"#"+frmgr)[0].focus();} catch (e){}
+ },
+ error:function(xhr,st,err){
+ $("#FormError>td","#"+frmtb).html(st+ " : "+err);
+ $("#FormError","#"+frmtb).show();
+ rp_ge.processing=false;
+ $("#"+frmgr).data("disabled",false);
+ $("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
+ }
+ }, $.jgrid.ajaxOptions, rp_ge.ajaxEditOptions );
+
+ if (!ajaxOptions.url && !rp_ge.useDataProxy) {
+ if ($.isFunction($t.p.dataProxy)) {
+ rp_ge.useDataProxy = true;
+ } else {
+ ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
+ }
+ }
+ if (ret[0]) {
+ if (rp_ge.useDataProxy) { $t.p.dataProxy.call($t, ajaxOptions, "set_"+$t.p.id); }
+ else { $.ajax(ajaxOptions); }
+ }
+ }
+ if(ret[0] === false) {
+ $("#FormError>td","#"+frmtb).html(ret[1]);
+ $("#FormError","#"+frmtb).show();
+ // return;
+ }
+ }
+ function compareData(nObj, oObj ) {
+ var ret = false,key;
+ for (key in nObj) {
+ if(nObj[key] != oObj[key]) {
+ ret = true;
+ break;
+ }
+ }
+ return ret;
+ }
+ function checkUpdates () {
+ var stat = true;
+ $("#FormError","#"+frmtb).hide();
+ if(rp_ge.checkOnUpdate) {
+ postdata = {}; extpost={};
+ getFormData();
+ newData = $.extend({},postdata,extpost);
+ diff = compareData(newData,rp_ge._savedData);
+ if(diff) {
+ $("#"+frmgr).data("disabled",true);
+ $(".confirm","#"+IDs.themodal).show();
+ stat = false;
+ }
+ }
+ return stat;
+ }
+ function restoreInline()
+ {
+ if (rowid !== "_empty" && typeof($t.p.savedRow) !== "undefined" && $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid.restoreRow)) {
+ for (var i=0;i<$t.p.savedRow.length;i++) {
+ if ($t.p.savedRow[i].id == rowid) {
+ $($t).jqGrid('restoreRow',rowid);
+ break;
+ }
+ }
+ }
+ }
+ function updateNav(cr,totr){
+ if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
+ if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
+ }
+ function getCurrPos() {
+ var rowsInGrid = $($t).jqGrid("getDataIDs"),
+ selrow = $("#id_g","#"+frmtb).val(),
+ pos = $.inArray(selrow,rowsInGrid);
+ return [pos,rowsInGrid];
+ }
+
+ if ( $("#"+IDs.themodal).html() !== null ) {
+ if(onBeforeInit) {
+ showFrm = onBeforeInit($("#"+frmgr));
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+ restoreInline();
+ $(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
+ $("#FormError","#"+frmtb).hide();
+ if(rp_ge.topinfo) {
+ $(".topinfo","#"+frmtb+"_2").html(rp_ge.topinfo);
+ $(".tinfo","#"+frmtb+"_2").show();
+ } else {
+ $(".tinfo","#"+frmtb+"_2").hide();
+ }
+ if(rp_ge.bottominfo) {
+ $(".bottominfo","#"+frmtb+"_2").html(rp_ge.bottominfo);
+ $(".binfo","#"+frmtb+"_2").show();
+ } else {
+ $(".binfo","#"+frmtb+"_2").hide();
+ }
+ // filldata
+ fillData(rowid,$t,frmgr);
+ ///
+ if(rowid=="_empty" || !rp_ge.viewPagerButtons) {
+ $("#pData, #nData","#"+frmtb+"_2").hide();
+ } else {
+ $("#pData, #nData","#"+frmtb+"_2").show();
+ }
+ if(rp_ge.processing===true) {
+ rp_ge.processing=false;
+ $("#sData", "#"+frmtb+"_2").removeClass('ui-state-active');
+ }
+ if($("#"+frmgr).data("disabled")===true) {
+ $(".confirm","#"+IDs.themodal).hide();
+ $("#"+frmgr).data("disabled",false);
+ }
+ if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
+ $("#"+IDs.themodal).data("onClose",rp_ge.onClose);
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
+ if(!closeovrl) {
+ $(".jqmOverlay").click(function(){
+ if(!checkUpdates()) { return false; }
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
+ return false;
+ });
+ }
+ if(onAfterShow) { onAfterShow($("#"+frmgr)); }
+ } else {
+ var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px",
+ frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>").data("disabled",false),
+ tbl = $("<table id='"+frmtb+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");
+ if(onBeforeInit) {
+ showFrm = onBeforeInit($("#"+frmgr));
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+ restoreInline();
+ $($t.p.colModel).each( function(i) {
+ var fmto = this.formoptions;
+ maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
+ maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
+ });
+ $(frm).append(tbl);
+ var flr = $("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+(maxCols*2)+"'></td></tr>");
+ flr[0].rp = 0;
+ $(tbl).append(flr);
+ //topinfo
+ flr = $("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+(maxCols*2)+"'>"+rp_ge.topinfo+"</td></tr>");
+ flr[0].rp = 0;
+ $(tbl).append(flr);
+ // set the id.
+ // use carefull only to change here colproperties.
+ // create data
+ var rtlb = $t.p.direction == "rtl" ? true :false,
+ bp = rtlb ? "nData" : "pData",
+ bn = rtlb ? "pData" : "nData";
+ createData(rowid,$t,tbl,maxCols);
+ // buttons at footer
+ var bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",
+ bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",
+ bS ="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
+ bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
+ var bt = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bS+bC+"</td></tr>";
+ bt += "<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+rp_ge.bottominfo+"</td></tr>";
+ bt += "</tbody></table>";
+ if(maxRows > 0) {
+ var sd=[];
+ $.each($(tbl)[0].rows,function(i,r){
+ sd[i] = r;
+ });
+ sd.sort(function(a,b){
+ if(a.rp > b.rp) {return 1;}
+ if(a.rp < b.rp) {return -1;}
+ return 0;
+ });
+ $.each(sd, function(index, row) {
+ $('tbody',tbl).append(row);
+ });
+ }
+ p.gbox = "#gbox_"+gID;
+ var cle = false;
+ if(p.closeOnEscape===true){
+ p.closeOnEscape = false;
+ cle = true;
+ }
+ var tms = $("<span></span>").append(frm).append(bt);
+ $.jgrid.createModal(IDs,tms,p,"#gview_"+$t.p.id,$("#gbox_"+$t.p.id)[0]);
+ if(rtlb) {
+ $("#pData, #nData","#"+frmtb+"_2").css("float","right");
+ $(".EditButton","#"+frmtb+"_2").css("text-align","left");
+ }
+ if(rp_ge.topinfo) { $(".tinfo","#"+frmtb+"_2").show(); }
+ if(rp_ge.bottominfo) { $(".binfo","#"+frmtb+"_2").show(); }
+ tms = null; bt=null;
+ $("#"+IDs.themodal).keydown( function( e ) {
+ var wkey = e.target;
+ if ($("#"+frmgr).data("disabled")===true ) { return false; }//??
+ if(rp_ge.savekey[0] === true && e.which == rp_ge.savekey[1]) { // save
+ if(wkey.tagName != "TEXTAREA") {
+ $("#sData", "#"+frmtb+"_2").trigger("click");
+ return false;
+ }
+ }
+ if(e.which === 27) {
+ if(!checkUpdates()) { return false; }
+ if(cle) { $.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: rp_ge.onClose}); }
+ return false;
+ }
+ if(rp_ge.navkeys[0]===true) {
+ if($("#id_g","#"+frmtb).val() == "_empty") { return true; }
+ if(e.which == rp_ge.navkeys[1]){ //up
+ $("#pData", "#"+frmtb+"_2").trigger("click");
+ return false;
+ }
+ if(e.which == rp_ge.navkeys[2]){ //down
+ $("#nData", "#"+frmtb+"_2").trigger("click");
+ return false;
+ }
+ }
+ });
+ if(p.checkOnUpdate) {
+ $("a.ui-jqdialog-titlebar-close span","#"+IDs.themodal).removeClass("jqmClose");
+ $("a.ui-jqdialog-titlebar-close","#"+IDs.themodal).unbind("click")
+ .click(function(){
+ if(!checkUpdates()) { return false; }
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
+ return false;
+ });
+ }
+ p.saveicon = $.extend([true,"left","ui-icon-disk"],p.saveicon);
+ p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
+ // beforeinitdata after creation of the form
+ if(p.saveicon[0]===true) {
+ $("#sData","#"+frmtb+"_2").addClass(p.saveicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+ .append("<span class='ui-icon "+p.saveicon[2]+"'></span>");
+ }
+ if(p.closeicon[0]===true) {
+ $("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+ .append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
+ }
+ if(rp_ge.checkOnSubmit || rp_ge.checkOnUpdate) {
+ bS ="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bYes+"</a>";
+ bN ="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bNo+"</a>";
+ bC ="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+p.bExit+"</a>";
+ var ii, zI = p.zIndex || 999; zI ++;
+ if ($.browser.msie && $.browser.version ==6) {
+ ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
+ } else { ii="";}
+ $("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+zI+";display:none;'> "+ii+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(zI+1)+"'>"+p.saveData+"<br/><br/>"+bS+bN+bC+"</div>").insertAfter("#"+frmgr);
+ $("#sNew","#"+IDs.themodal).click(function(){
+ postIt();
+ $("#"+frmgr).data("disabled",false);
+ $(".confirm","#"+IDs.themodal).hide();
+ return false;
+ });
+ $("#nNew","#"+IDs.themodal).click(function(){
+ $(".confirm","#"+IDs.themodal).hide();
+ $("#"+frmgr).data("disabled",false);
+ setTimeout(function(){$(":input","#"+frmgr)[0].focus();},0);
+ return false;
+ });
+ $("#cNew","#"+IDs.themodal).click(function(){
+ $(".confirm","#"+IDs.themodal).hide();
+ $("#"+frmgr).data("disabled",false);
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
+ return false;
+ });
+ }
+ // here initform - only once
+ if(onInitializeForm) { onInitializeForm($("#"+frmgr)); }
+ if(rowid=="_empty" || !rp_ge.viewPagerButtons) { $("#pData,#nData","#"+frmtb+"_2").hide(); } else { $("#pData,#nData","#"+frmtb+"_2").show(); }
+ if(onBeforeShow) { onBeforeShow($("#"+frmgr)); }
+ $("#"+IDs.themodal).data("onClose",rp_ge.onClose);
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, overlay: p.overlay,modal:p.modal});
+ if(!closeovrl) {
+ $(".jqmOverlay").click(function(){
+ if(!checkUpdates()) { return false; }
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
+ return false;
+ });
+ }
+ if(onAfterShow) { onAfterShow($("#"+frmgr)); }
+ $(".fm-button","#"+IDs.themodal).hover(
+ function(){$(this).addClass('ui-state-hover');},
+ function(){$(this).removeClass('ui-state-hover');}
+ );
+ $("#sData", "#"+frmtb+"_2").click(function(e){
+ postdata = {}; extpost={};
+ $("#FormError","#"+frmtb).hide();
+ // all depend on ret array
+ //ret[0] - succes
+ //ret[1] - msg if not succes
+ //ret[2] - the id that will be set if reload after submit false
+ getFormData();
+ if(postdata[$t.p.id+"_id"] == "_empty") { postIt(); }
+ else if(p.checkOnSubmit===true ) {
+ newData = $.extend({},postdata,extpost);
+ diff = compareData(newData,rp_ge._savedData);
+ if(diff) {
+ $("#"+frmgr).data("disabled",true);
+ $(".confirm","#"+IDs.themodal).show();
+ } else {
+ postIt();
+ }
+ } else {
+ postIt();
+ }
+ return false;
+ });
+ $("#cData", "#"+frmtb+"_2").click(function(e){
+ if(!checkUpdates()) { return false; }
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal,onClose: rp_ge.onClose});
+ return false;
+ });
+ $("#nData", "#"+frmtb+"_2").click(function(e){
+ if(!checkUpdates()) { return false; }
+ $("#FormError","#"+frmtb).hide();
+ var npos = getCurrPos();
+ npos[0] = parseInt(npos[0],10);
+ if(npos[0] != -1 && npos[1][npos[0]+1]) {
+ if($.isFunction(p.onclickPgButtons)) {
+ p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
+ }
+ fillData(npos[1][npos[0]+1],$t,frmgr);
+ $($t).jqGrid("setSelection",npos[1][npos[0]+1]);
+ if($.isFunction(p.afterclickPgButtons)) {
+ p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
+ }
+ updateNav(npos[0]+1,npos[1].length-1);
+ }
+ return false;
+ });
+ $("#pData", "#"+frmtb+"_2").click(function(e){
+ if(!checkUpdates()) { return false; }
+ $("#FormError","#"+frmtb).hide();
+ var ppos = getCurrPos();
+ if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
+ if($.isFunction(p.onclickPgButtons)) {
+ p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
+ }
+ fillData(ppos[1][ppos[0]-1],$t,frmgr);
+ $($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
+ if($.isFunction(p.afterclickPgButtons)) {
+ p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
+ }
+ updateNav(ppos[0]-1,ppos[1].length-1);
+ }
+ return false;
+ });
+ }
+ var posInit =getCurrPos();
+ updateNav(posInit[0],posInit[1].length-1);
+
+ });
+ },
+ viewGridRow : function(rowid, p){
+ p = $.extend({
+ top : 0,
+ left: 0,
+ width: 0,
+ height: 'auto',
+ dataheight: 'auto',
+ modal: false,
+ overlay: 10,
+ drag: true,
+ resize: true,
+ jqModal: true,
+ closeOnEscape : false,
+ labelswidth: '30%',
+ closeicon: [],
+ navkeys: [false,38,40],
+ onClose: null,
+ beforeShowForm : null,
+ beforeInitData : null,
+ viewPagerButtons : true
+ }, $.jgrid.view, p || {});
+ return this.each(function(){
+ var $t = this;
+ if (!$t.grid || !rowid) { return; }
+ if(!p.imgpath) { p.imgpath= $t.p.imgpath; }
+ // I hate to rewrite code, but ...
+ var gID = $t.p.id,
+ frmgr = "ViewGrid_"+gID , frmtb = "ViewTbl_"+gID,
+ IDs = {themodal:'viewmod'+gID,modalhead:'viewhd'+gID,modalcontent:'viewcnt'+gID, scrollelm : frmgr},
+ onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false,
+ showFrm = true,
+ maxCols = 1, maxRows=0;
+ function focusaref(){ //Sfari 3 issues
+ if(p.closeOnEscape===true || p.navkeys[0]===true) {
+ setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
+ }
+ }
+ function createData(rowid,obj,tb,maxcols){
+ var nm, hc,trdata, cnt=0,tmp, dc, retpos=[], ind=false,
+ tdtmpl = "<td class='CaptionTD form-view-label ui-widget-content' width='"+p.labelswidth+"'> </td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'> </td>", tmpl="",
+ tdtmpl2 = "<td class='CaptionTD form-view-label ui-widget-content'> </td><td class='DataTD form-view-data ui-widget-content'> </td>",
+ fmtnum = ['integer','number','currency'],max1 =0, max2=0 ,maxw,setme, viewfld;
+ for (var i =1;i<=maxcols;i++) {
+ tmpl += i == 1 ? tdtmpl : tdtmpl2;
+ }
+ // find max number align rigth with property formatter
+ $(obj.p.colModel).each( function(i) {
+ if(this.editrules && this.editrules.edithidden === true) {
+ hc = false;
+ } else {
+ hc = this.hidden === true ? true : false;
+ }
+ if(!hc && this.align==='right') {
+ if(this.formatter && $.inArray(this.formatter,fmtnum) !== -1 ) {
+ max1 = Math.max(max1,parseInt(this.width,10));
+ } else {
+ max2 = Math.max(max2,parseInt(this.width,10));
+ }
+ }
+ });
+ maxw = max1 !==0 ? max1 : max2 !==0 ? max2 : 0;
+ ind = $(obj).jqGrid("getInd",rowid);
+ $(obj.p.colModel).each( function(i) {
+ nm = this.name;
+ setme = false;
+ // hidden fields are included in the form
+ if(this.editrules && this.editrules.edithidden === true) {
+ hc = false;
+ } else {
+ hc = this.hidden === true ? true : false;
+ }
+ dc = hc ? "style='display:none'" : "";
+ viewfld = (typeof this.viewable != 'boolean') ? true : this.viewable;
+ if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn' && viewfld) {
+ if(ind === false) {
+ tmp = "";
+ } else {
+ if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+ tmp = $("td:eq("+i+")",obj.rows[ind]).text();
+ } else {
+ tmp = $("td:eq("+i+")",obj.rows[ind]).html();
+ }
+ }
+ setme = this.align === 'right' && maxw !==0 ? true : false;
+ var opt = $.extend({}, this.editoptions || {} ,{id:nm,name:nm}),
+ frmopt = $.extend({},{rowabove:false,rowcontent:''}, this.formoptions || {}),
+ rp = parseInt(frmopt.rowpos,10) || cnt+1,
+ cp = parseInt((parseInt(frmopt.colpos,10) || 1)*2,10);
+ if(frmopt.rowabove) {
+ var newdata = $("<tr><td class='contentinfo' colspan='"+(maxcols*2)+"'>"+frmopt.rowcontent+"</td></tr>");
+ $(tb).append(newdata);
+ newdata[0].rp = rp;
+ }
+ trdata = $(tb).find("tr[rowpos="+rp+"]");
+ if ( trdata.length===0 ) {
+ trdata = $("<tr "+dc+" rowpos='"+rp+"'></tr>").addClass("FormData").attr("id","trv_"+nm);
+ $(trdata).append(tmpl);
+ $(tb).append(trdata);
+ trdata[0].rp = rp;
+ }
+ $("td:eq("+(cp-2)+")",trdata[0]).html('<b>'+ (typeof frmopt.label === 'undefined' ? obj.p.colNames[i]: frmopt.label)+'</b>');
+ $("td:eq("+(cp-1)+")",trdata[0]).append("<span>"+tmp+"</span>").attr("id","v_"+nm);
+ if(setme){
+ $("td:eq("+(cp-1)+") span",trdata[0]).css({'text-align':'right',width:maxw+"px"});
+ }
+ retpos[cnt] = i;
+ cnt++;
+ }
+ });
+ if( cnt > 0) {
+ var idrow = $("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+ (maxcols*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+rowid+"'/></td></tr>");
+ idrow[0].rp = cnt+99;
+ $(tb).append(idrow);
+ }
+ return retpos;
+ }
+ function fillData(rowid,obj){
+ var nm, hc,cnt=0,tmp, opt,trv;
+ trv = $(obj).jqGrid("getInd",rowid,true);
+ if(!trv) { return; }
+ $('td',trv).each( function(i) {
+ nm = obj.p.colModel[i].name;
+ // hidden fields are included in the form
+ if(obj.p.colModel[i].editrules && obj.p.colModel[i].editrules.edithidden === true) {
+ hc = false;
+ } else {
+ hc = obj.p.colModel[i].hidden === true ? true : false;
+ }
+ if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
+ if(nm == obj.p.ExpandColumn && obj.p.treeGrid === true) {
+ tmp = $(this).text();
+ } else {
+ tmp = $(this).html();
+ }
+ opt = $.extend({},obj.p.colModel[i].editoptions || {});
+ nm = $.jgrid.jqID("v_"+nm);
+ $("#"+nm+" span","#"+frmtb).html(tmp);
+ if (hc) { $("#"+nm,"#"+frmtb).parents("tr:first").hide(); }
+ cnt++;
+ }
+ });
+ if(cnt>0) { $("#id_g","#"+frmtb).val(rowid); }
+ }
+ function updateNav(cr,totr){
+ if (cr===0) { $("#pData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#pData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
+ if (cr==totr) { $("#nData","#"+frmtb+"_2").addClass('ui-state-disabled'); } else { $("#nData","#"+frmtb+"_2").removeClass('ui-state-disabled'); }
+ }
+ function getCurrPos() {
+ var rowsInGrid = $($t).jqGrid("getDataIDs"),
+ selrow = $("#id_g","#"+frmtb).val(),
+ pos = $.inArray(selrow,rowsInGrid);
+ return [pos,rowsInGrid];
+ }
+
+ if ( $("#"+IDs.themodal).html() !== null ) {
+ if(onBeforeInit) {
+ showFrm = onBeforeInit($("#"+frmgr));
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+ $(".ui-jqdialog-title","#"+IDs.modalhead).html(p.caption);
+ $("#FormError","#"+frmtb).hide();
+ fillData(rowid,$t);
+ if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, jqM: false, overlay: p.overlay, modal:p.modal});
+ focusaref();
+ } else {
+ var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
+ var frm = $("<form name='FormPost' id='"+frmgr+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+dh+";'></form>"),
+ tbl =$("<table id='"+frmtb+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
+ if(onBeforeInit) {
+ showFrm = onBeforeInit($("#"+frmgr));
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+ $($t.p.colModel).each( function(i) {
+ var fmto = this.formoptions;
+ maxCols = Math.max(maxCols, fmto ? fmto.colpos || 0 : 0 );
+ maxRows = Math.max(maxRows, fmto ? fmto.rowpos || 0 : 0 );
+ });
+ // set the id.
+ $(frm).append(tbl);
+ createData(rowid, $t, tbl, maxCols);
+ var rtlb = $t.p.direction == "rtl" ? true :false,
+ bp = rtlb ? "nData" : "pData",
+ bn = rtlb ? "pData" : "nData",
+
+ // buttons at footer
+ bP = "<a href='javascript:void(0)' id='"+bp+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
+ bN = "<a href='javascript:void(0)' id='"+bn+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
+ bC ="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+p.bClose+"</a>";
+ if(maxRows > 0) {
+ var sd=[];
+ $.each($(tbl)[0].rows,function(i,r){
+ sd[i] = r;
+ });
+ sd.sort(function(a,b){
+ if(a.rp > b.rp) {return 1;}
+ if(a.rp < b.rp) {return -1;}
+ return 0;
+ });
+ $.each(sd, function(index, row) {
+ $('tbody',tbl).append(row);
+ });
+ }
+ p.gbox = "#gbox_"+gID;
+ var cle = false;
+ if(p.closeOnEscape===true){
+ p.closeOnEscape = false;
+ cle = true;
+ }
+ var bt = $("<span></span>").append(frm).append("<table border='0' class='EditTable' id='"+frmtb+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+p.labelswidth+"'>"+(rtlb ? bN+bP : bP+bN)+"</td><td class='EditButton'>"+bC+"</td></tr></tbody></table>");
+ $.jgrid.createModal(IDs,bt,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
+ if(rtlb) {
+ $("#pData, #nData","#"+frmtb+"_2").css("float","right");
+ $(".EditButton","#"+frmtb+"_2").css("text-align","left");
+ }
+ if(!p.viewPagerButtons) { $("#pData, #nData","#"+frmtb+"_2").hide(); }
+ bt = null;
+ $("#"+IDs.themodal).keydown( function( e ) {
+ if(e.which === 27) {
+ if(cle) { $.jgrid.hideModal(this,{gb:p.gbox,jqm:p.jqModal, onClose: p.onClose}); }
+ return false;
+ }
+ if(p.navkeys[0]===true) {
+ if(e.which === p.navkeys[1]){ //up
+ $("#pData", "#"+frmtb+"_2").trigger("click");
+ return false;
+ }
+ if(e.which === p.navkeys[2]){ //down
+ $("#nData", "#"+frmtb+"_2").trigger("click");
+ return false;
+ }
+ }
+ });
+ p.closeicon = $.extend([true,"left","ui-icon-close"],p.closeicon);
+ if(p.closeicon[0]===true) {
+ $("#cData","#"+frmtb+"_2").addClass(p.closeicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+ .append("<span class='ui-icon "+p.closeicon[2]+"'></span>");
+ }
+ if($.isFunction(p.beforeShowForm)) { p.beforeShowForm($("#"+frmgr)); }
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, modal:p.modal});
+ $(".fm-button:not(.ui-state-disabled)","#"+frmtb+"_2").hover(
+ function(){$(this).addClass('ui-state-hover');},
+ function(){$(this).removeClass('ui-state-hover');}
+ );
+ focusaref();
+ $("#cData", "#"+frmtb+"_2").click(function(e){
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: p.onClose});
+ return false;
+ });
+ $("#nData", "#"+frmtb+"_2").click(function(e){
+ $("#FormError","#"+frmtb).hide();
+ var npos = getCurrPos();
+ npos[0] = parseInt(npos[0],10);
+ if(npos[0] != -1 && npos[1][npos[0]+1]) {
+ if($.isFunction(p.onclickPgButtons)) {
+ p.onclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]]);
+ }
+ fillData(npos[1][npos[0]+1],$t);
+ $($t).jqGrid("setSelection",npos[1][npos[0]+1]);
+ if($.isFunction(p.afterclickPgButtons)) {
+ p.afterclickPgButtons('next',$("#"+frmgr),npos[1][npos[0]+1]);
+ }
+ updateNav(npos[0]+1,npos[1].length-1);
+ }
+ focusaref();
+ return false;
+ });
+ $("#pData", "#"+frmtb+"_2").click(function(e){
+ $("#FormError","#"+frmtb).hide();
+ var ppos = getCurrPos();
+ if(ppos[0] != -1 && ppos[1][ppos[0]-1]) {
+ if($.isFunction(p.onclickPgButtons)) {
+ p.onclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]]);
+ }
+ fillData(ppos[1][ppos[0]-1],$t);
+ $($t).jqGrid("setSelection",ppos[1][ppos[0]-1]);
+ if($.isFunction(p.afterclickPgButtons)) {
+ p.afterclickPgButtons('prev',$("#"+frmgr),ppos[1][ppos[0]-1]);
+ }
+ updateNav(ppos[0]-1,ppos[1].length-1);
+ }
+ focusaref();
+ return false;
+ });
+ }
+ var posInit =getCurrPos();
+ updateNav(posInit[0],posInit[1].length-1);
+ });
+ },
+ delGridRow : function(rowids,p) {
+ p = $.extend({
+ top : 0,
+ left: 0,
+ width: 240,
+ height: 'auto',
+ dataheight : 'auto',
+ modal: false,
+ overlay: 10,
+ drag: true,
+ resize: true,
+ url : '',
+ mtype : "POST",
+ reloadAfterSubmit: true,
+ beforeShowForm: null,
+ beforeInitData : null,
+ afterShowForm: null,
+ beforeSubmit: null,
+ onclickSubmit: null,
+ afterSubmit: null,
+ jqModal : true,
+ closeOnEscape : false,
+ delData: {},
+ delicon : [],
+ cancelicon : [],
+ onClose : null,
+ ajaxDelOptions : {},
+ processing : false,
+ serializeDelData : null,
+ useDataProxy : false
+ }, $.jgrid.del, p ||{});
+ rp_ge = p;
+ return this.each(function(){
+ var $t = this;
+ if (!$t.grid ) { return; }
+ if(!rowids) { return; }
+ var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false,
+ onAfterShow = typeof p.afterShowForm === 'function' ? true: false,
+ onBeforeInit = $.isFunction(p.beforeInitData) ? p.beforeInitData : false,
+ gID = $t.p.id, onCS = {},
+ showFrm = true,
+ dtbl = "DelTbl_"+gID,postd, idname, opers, oper,
+ IDs = {themodal:'delmod'+gID,modalhead:'delhd'+gID,modalcontent:'delcnt'+gID, scrollelm: dtbl};
+ if (jQuery.isArray(rowids)) { rowids = rowids.join(); }
+ if ( $("#"+IDs.themodal).html() !== null ) {
+ if(onBeforeInit) {
+ showFrm = onBeforeInit( $("#"+dtbl));
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+ $("#DelData>td","#"+dtbl).text(rowids);
+ $("#DelError","#"+dtbl).hide();
+ if( rp_ge.processing === true) {
+ rp_ge.processing=false;
+ $("#dData", "#"+dtbl).removeClass('ui-state-active');
+ }
+ if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal,jqM: false, overlay: p.overlay, modal:p.modal});
+ if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
+ } else {
+ var dh = isNaN(p.dataheight) ? p.dataheight : p.dataheight+"px";
+ var tbl = "<div id='"+dtbl+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+dh+";'>";
+ tbl += "<table class='DelTable'><tbody>";
+ // error data
+ tbl += "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
+ tbl += "<tr id='DelData' style='display:none'><td >"+rowids+"</td></tr>";
+ tbl += "<tr><td class=\"delmsg\" style=\"white-space:pre;\">"+p.msg+"</td></tr><tr><td > </td></tr>";
+ // buttons at footer
+ tbl += "</tbody></table></div>";
+ var bS = "<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+p.bSubmit+"</a>",
+ bC = "<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+p.bCancel+"</a>";
+ tbl += "<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+dtbl+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr></tr><tr><td class='DelButton EditButton'>"+bS+" "+bC+"</td></tr></tbody></table>";
+ p.gbox = "#gbox_"+gID;
+ $.jgrid.createModal(IDs,tbl,p,"#gview_"+$t.p.id,$("#gview_"+$t.p.id)[0]);
+
+ if(onBeforeInit) {
+ showFrm = onBeforeInit( $("#"+dtbl) );
+ if(typeof(showFrm) == "undefined") {
+ showFrm = true;
+ }
+ }
+ if(showFrm === false) { return; }
+
+ $(".fm-button","#"+dtbl+"_2").hover(
+ function(){$(this).addClass('ui-state-hover');},
+ function(){$(this).removeClass('ui-state-hover');}
+ );
+ p.delicon = $.extend([true,"left","ui-icon-scissors"],p.delicon);
+ p.cancelicon = $.extend([true,"left","ui-icon-cancel"],p.cancelicon);
+ if(p.delicon[0]===true) {
+ $("#dData","#"+dtbl+"_2").addClass(p.delicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+ .append("<span class='ui-icon "+p.delicon[2]+"'></span>");
+ }
+ if(p.cancelicon[0]===true) {
+ $("#eData","#"+dtbl+"_2").addClass(p.cancelicon[1] == "right" ? 'fm-button-icon-right' : 'fm-button-icon-left')
+ .append("<span class='ui-icon "+p.cancelicon[2]+"'></span>");
+ }
+ $("#dData","#"+dtbl+"_2").click(function(e){
+ var ret=[true,""]; onCS = {};
+ var postdata = $("#DelData>td","#"+dtbl).text(); //the pair is name=val1,val2,...
+ if( typeof p.onclickSubmit === 'function' ) { onCS = p.onclickSubmit(rp_ge, postdata) || {}; }
+ if( typeof p.beforeSubmit === 'function' ) { ret = p.beforeSubmit(postdata); }
+ if(ret[0] && !rp_ge.processing) {
+ rp_ge.processing = true;
+ $(this).addClass('ui-state-active');
+ opers = $t.p.prmNames;
+ postd = $.extend({},rp_ge.delData, onCS);
+ oper = opers.oper;
+ postd[oper] = opers.deloper;
+ idname = opers.id;
+ postd[idname] = postdata;
+
+ var ajaxOptions = $.extend({
+ url: rp_ge.url ? rp_ge.url : $($t).jqGrid('getGridParam','editurl'),
+ type: p.mtype,
+ data: $.isFunction(p.serializeDelData) ? p.serializeDelData(postd) : postd,
+ complete:function(data,Status){
+ if(Status != "success") {
+ ret[0] = false;
+ if ($.isFunction(rp_ge.errorTextFormat)) {
+ ret[1] = rp_ge.errorTextFormat(data);
+ } else {
+ ret[1] = Status + " Status: '" + data.statusText + "'. Error code: " + data.status;
+ }
+ } else {
+ // data is posted successful
+ // execute aftersubmit with the returned data from server
+ if( typeof rp_ge.afterSubmit === 'function' ) {
+ ret = rp_ge.afterSubmit(data,postd);
+ }
+ }
+ if(ret[0] === false) {
+ $("#DelError>td","#"+dtbl).html(ret[1]);
+ $("#DelError","#"+dtbl).show();
+ } else {
+ if(rp_ge.reloadAfterSubmit && $t.p.datatype != "local") {
+ $($t).trigger("reloadGrid");
+ } else {
+ var toarr = [];
+ toarr = postdata.split(",");
+ if($t.p.treeGrid===true){
+ try {$($t).jqGrid("delTreeNode",toarr[0]);} catch(e){}
+ } else {
+ for(var i=0;i<toarr.length;i++) {
+ $($t).jqGrid("delRowData",toarr[i]);
+ }
+ }
+ $t.p.selrow = null;
+ $t.p.selarrrow = [];
+ }
+ if($.isFunction(rp_ge.afterComplete)) {
+ setTimeout(function(){rp_ge.afterComplete(data,postdata);},500);
+ }
+ }
+ rp_ge.processing=false;
+ $("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
+ if(ret[0]) { $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose}); }
+ },
+ error:function(xhr,st,err){
+ $("#DelError>td","#"+dtbl).html(st+ " : "+err);
+ $("#DelError","#"+dtbl).show();
+ rp_ge.processing=false;
+ $("#dData", "#"+dtbl+"_2").removeClass('ui-state-active');
+ }
+ }, $.jgrid.ajaxOptions, p.ajaxDelOptions);
+
+
+ if (!ajaxOptions.url && !rp_ge.useDataProxy) {
+ if ($.isFunction($t.p.dataProxy)) {
+ rp_ge.useDataProxy = true;
+ } else {
+ ret[0]=false; ret[1] += " "+$.jgrid.errors.nourl;
+ }
+ }
+ if (ret[0]) {
+ if (rp_ge.useDataProxy) { $t.p.dataProxy.call($t, ajaxOptions, "del_"+$t.p.id); }
+ else { $.ajax(ajaxOptions); }
+ }
+ }
+
+ if(ret[0] === false) {
+ $("#DelError>td","#"+dtbl).html(ret[1]);
+ $("#DelError","#"+dtbl).show();
+ }
+ return false;
+ });
+ $("#eData", "#"+dtbl+"_2").click(function(e){
+ $.jgrid.hideModal("#"+IDs.themodal,{gb:"#gbox_"+gID,jqm:p.jqModal, onClose: rp_ge.onClose});
+ return false;
+ });
+ if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }
+ $.jgrid.viewModal("#"+IDs.themodal,{gbox:"#gbox_"+gID,jqm:p.jqModal, overlay: p.overlay, modal:p.modal});
+ if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }
+ }
+ if(p.closeOnEscape===true) {
+ setTimeout(function(){$(".ui-jqdialog-titlebar-close","#"+IDs.modalhead).focus();},0);
+ }
+ });
+ },
+ navGrid : function (elem, o, pEdit,pAdd,pDel,pSearch, pView) {
+ o = $.extend({
+ edit: true,
+ editicon: "ui-icon-pencil",
+ add: true,
+ addicon:"ui-icon-plus",
+ del: true,
+ delicon:"ui-icon-trash",
+ search: true,
+ searchicon:"ui-icon-search",
+ refresh: true,
+ refreshicon:"ui-icon-refresh",
+ refreshstate: 'firstpage',
+ view: false,
+ viewicon : "ui-icon-document",
+ position : "left",
+ closeOnEscape : true,
+ beforeRefresh : null,
+ afterRefresh : null,
+ cloneToTop : false
+ }, $.jgrid.nav, o ||{});
+ return this.each(function() {
+ if(this.nav) { return; }
+ var alertIDs = {themodal:'alertmod',modalhead:'alerthd',modalcontent:'alertcnt'},
+ $t = this, vwidth, vheight, twd, tdw;
+ if(!$t.grid || typeof elem != 'string') { return; }
+ if ($("#"+alertIDs.themodal).html() === null) {
+ if (typeof window.innerWidth != 'undefined') {
+ vwidth = window.innerWidth;
+ vheight = window.innerHeight;
+ } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth !== 0) {
+ vwidth = document.documentElement.clientWidth;
+ vheight = document.documentElement.clientHeight;
+ } else {
+ vwidth=1024;
+ vheight=768;
+ }
+ $.jgrid.createModal(alertIDs,"<div>"+o.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+$t.p.id,jqModal:true,drag:true,resize:true,caption:o.alertcap,top:vheight/2-25,left:vwidth/2-100,width:200,height:'auto',closeOnEscape:o.closeOnEscape},"","",true);
+ }
+ var clone = 1;
+ if(o.cloneToTop && $t.p.toppager) { clone = 2; }
+ for(var i = 0; i<clone; i++) {
+ var tbd,
+ navtbl = $("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
+ sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
+ pgid, elemids;
+ if(i===0) {
+ pgid = elem;
+ elemids = $t.p.id;
+ if(pgid == $t.p.toppager) {
+ elemids += "_top";
+ clone = 1;
+ }
+ } else {
+ pgid = $t.p.toppager;
+ elemids = $t.p.id+"_top";
+ }
+ if($t.p.direction == "rtl") { $(navtbl).attr("dir","rtl").css("float","right"); }
+ if (o.add) {
+ pAdd = pAdd || {};
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.addicon+"'></span>"+o.addtext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.addtitle || "",id : pAdd.id || "add_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ if (typeof o.addfunc == 'function') {
+ o.addfunc();
+ } else {
+ $($t).jqGrid("editGridRow","new",pAdd);
+ }
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ if (o.edit) {
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ pEdit = pEdit || {};
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.editicon+"'></span>"+o.edittext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.edittitle || "",id: pEdit.id || "edit_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ var sr = $t.p.selrow;
+ if (sr) {
+ if(typeof o.editfunc == 'function') {
+ o.editfunc(sr);
+ } else {
+ $($t).jqGrid("editGridRow",sr,pEdit);
+ }
+ } else {
+ $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
+ $("#jqg_alrt").focus();
+ }
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ if (o.view) {
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ pView = pView || {};
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.viewicon+"'></span>"+o.viewtext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.viewtitle || "",id: pView.id || "view_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ var sr = $t.p.selrow;
+ if (sr) {
+ $($t).jqGrid("viewGridRow",sr,pView);
+ } else {
+ $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true});
+ $("#jqg_alrt").focus();
+ }
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ if (o.del) {
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ pDel = pDel || {};
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.delicon+"'></span>"+o.deltext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.deltitle || "",id: pDel.id || "del_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ var dr;
+ if($t.p.multiselect) {
+ dr = $t.p.selarrrow;
+ if(dr.length===0) { dr = null; }
+ } else {
+ dr = $t.p.selrow;
+ }
+ if(dr){
+ if("function" == typeof o.delfunc){
+ o.delfunc(dr);
+ }else{
+ $($t).jqGrid("delGridRow",dr,pDel);
+ }
+ } else {
+ $.jgrid.viewModal("#"+alertIDs.themodal,{gbox:"#gbox_"+$t.p.id,jqm:true}); $("#jqg_alrt").focus();
+ }
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ if(o.add || o.edit || o.del || o.view) { $("tr",navtbl).append(sep); }
+ if (o.search) {
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ pSearch = pSearch || {};
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.searchicon+"'></span>"+o.searchtext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.searchtitle || "",id:pSearch.id || "search_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $($t).jqGrid("searchGrid",pSearch);
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ if (o.refresh) {
+ tbd = $("<td class='ui-pg-button ui-corner-all'></td>");
+ $(tbd).append("<div class='ui-pg-div'><span class='ui-icon "+o.refreshicon+"'></span>"+o.refreshtext+"</div>");
+ $("tr",navtbl).append(tbd);
+ $(tbd,navtbl)
+ .attr({"title":o.refreshtitle || "",id: "refresh_"+elemids})
+ .click(function(){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ if($.isFunction(o.beforeRefresh)) { o.beforeRefresh(); }
+ $t.p.search = false;
+ try {
+ var gID = $t.p.id;
+ $t.p.postData.filters ="";
+ $("#fbox_"+gID).jqFilter('resetFilter');
+ if($.isFunction($t.clearToolbar)) { $t.clearToolbar(false); }
+ } catch (e) {}
+ switch (o.refreshstate) {
+ case 'firstpage':
+ $($t).trigger("reloadGrid", [{page:1}]);
+ break;
+ case 'current':
+ $($t).trigger("reloadGrid", [{current:true}]);
+ break;
+ }
+ if($.isFunction(o.afterRefresh)) { o.afterRefresh(); }
+ }
+ return false;
+ }).hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass("ui-state-hover");
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ tbd = null;
+ }
+ tdw = $(".ui-jqgrid").css("font-size") || "11px";
+ $('body').append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
+ twd = $(navtbl).clone().appendTo("#testpg2").width();
+ $("#testpg2").remove();
+ $(pgid+"_"+o.position,pgid).append(navtbl);
+ if($t.p._nvtd) {
+ if(twd > $t.p._nvtd[0] ) {
+ $(pgid+"_"+o.position,pgid).width(twd);
+ $t.p._nvtd[0] = twd;
+ }
+ $t.p._nvtd[1] = twd;
+ }
+ tdw =null; twd=null; navtbl =null;
+ this.nav = true;
+ }
+ });
+ },
+ navButtonAdd : function (elem, p) {
+ p = $.extend({
+ caption : "newButton",
+ title: '',
+ buttonicon : 'ui-icon-newwin',
+ onClickButton: null,
+ position : "last",
+ cursor : 'pointer'
+ }, p ||{});
+ return this.each(function() {
+ if( !this.grid) { return; }
+ if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
+ var findnav = $(".navtable",elem)[0], $t = this;
+ if (findnav) {
+ if( p.id && $("#"+p.id, findnav).html() !== null ) { return; }
+ var tbd = $("<td></td>");
+ if(p.buttonicon.toString().toUpperCase() == "NONE") {
+ $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'>"+p.caption+"</div>");
+ } else {
+ $(tbd).addClass('ui-pg-button ui-corner-all').append("<div class='ui-pg-div'><span class='ui-icon "+p.buttonicon+"'></span>"+p.caption+"</div>");
+ }
+ if(p.id) {$(tbd).attr("id",p.id);}
+ if(p.position=='first'){
+ if(findnav.rows[0].cells.length ===0 ) {
+ $("tr",findnav).append(tbd);
+ } else {
+ $("tr td:eq(0)",findnav).before(tbd);
+ }
+ } else {
+ $("tr",findnav).append(tbd);
+ }
+ $(tbd,findnav)
+ .attr("title",p.title || "")
+ .click(function(e){
+ if (!$(this).hasClass('ui-state-disabled')) {
+ if ($.isFunction(p.onClickButton) ) { p.onClickButton.call($t,e); }
+ }
+ return false;
+ })
+ .hover(
+ function () {
+ if (!$(this).hasClass('ui-state-disabled')) {
+ $(this).addClass('ui-state-hover');
+ }
+ },
+ function () {$(this).removeClass("ui-state-hover");}
+ );
+ }
+ });
+ },
+ navSeparatorAdd:function (elem,p) {
+ p = $.extend({
+ sepclass : "ui-separator",
+ sepcontent: ''
+ }, p ||{});
+ return this.each(function() {
+ if( !this.grid) { return; }
+ if( elem.indexOf("#") !== 0) { elem = "#"+elem; }
+ var findnav = $(".navtable",elem)[0];
+ if(findnav) {
+ var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+p.sepclass+"'></span>"+p.sepcontent+"</td>";
+ $("tr",findnav).append(sep);
+ }
+ });
+ },
+ GridToForm : function( rowid, formid ) {
+ return this.each(function(){
+ var $t = this;
+ if (!$t.grid) { return; }
+ var rowdata = $($t).jqGrid("getRowData",rowid);
+ if (rowdata) {
+ for(var i in rowdata) {
+ if ( $("[name="+i+"]",formid).is("input:radio") || $("[name="+i+"]",formid).is("input:checkbox")) {
+ $("[name="+i+"]",formid).each( function() {
+ if( $(this).val() == rowdata[i] ) {
+ $(this).attr("checked","checked");
+ } else {
+ $(this).attr("checked","");
+ }
+ });
+ } else {
+ // this is very slow on big table and form.
+ $("[name="+i+"]",formid).val(rowdata[i]);
+ }
+ }
+ }
+ });
+ },
+ FormToGrid : function(rowid, formid, mode, position){
+ return this.each(function() {
+ var $t = this;
+ if(!$t.grid) { return; }
+ if(!mode) { mode = 'set'; }
+ if(!position) { position = 'first'; }
+ var fields = $(formid).serializeArray();
+ var griddata = {};
+ $.each(fields, function(i, field){
+ griddata[field.name] = field.value;
+ });
+ if(mode=='add') { $($t).jqGrid("addRowData",rowid,griddata, position); }
+ else if(mode=='set') { $($t).jqGrid("setRowData",rowid,griddata); }
+ });
+ }
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.grouping.js'
--- addons/base/static/jquery.jqGrid/js/grid.grouping.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.grouping.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,255 @@
+// Grouping module
+;(function($){
+$.jgrid.extend({
+ groupingSetup : function () {
+ return this.each(function (){
+ var $t = this,
+ grp = $t.p.groupingView;
+ if(grp !== null && ( (typeof grp === 'object') || $.isFunction(grp) ) ) {
+ if(!grp.groupField.length) {
+ $t.p.grouping = false;
+ } else {
+ for(var i=0;i<grp.groupField.length;i++) {
+ if(!grp.groupOrder[i]) {
+ grp.groupOrder[i] = 'asc';
+ }
+ if(!grp.groupText[i]) {
+ grp.groupText[i] = '{0}';
+ }
+ if( typeof(grp.groupColumnShow[i]) != 'boolean') {
+ grp.groupColumnShow[i] = true;
+ }
+ if( typeof(grp.groupSummary[i]) != 'boolean') {
+ grp.groupSummary[i] = false;
+ }
+ if(grp.groupColumnShow[i] === true) {
+ $($t).jqGrid('showCol',grp.groupField[i]);
+ } else {
+ $($t).jqGrid('hideCol',grp.groupField[i]);
+ }
+ grp.sortitems[i] = [];
+ grp.sortnames[i] = [];
+ grp.summaryval[i] = [];
+ if(grp.groupSummary[i]) {
+ grp.summary[i] =[];
+ var cm = $t.p.colModel;
+ for(var j=0, cml = cm.length; j < cml; j++) {
+ if(cm[j].summaryType) {
+ grp.summary[i].push({nm:cm[j].name,st:cm[j].summaryType, v:''});
+ }
+ }
+ }
+ }
+ $t.p.scroll = false;
+ $t.p.rownumbers = false;
+ $t.p.subGrid = false;
+ $t.p.treeGrid = false;
+ $t.p.gridview = true;
+ }
+ } else {
+ $t.p.grouping = false;
+ }
+ });
+ },
+ groupingPrepare : function (rData, items, gdata, record) {
+ this.each(function(){
+ // currently only one level
+ // Is this a good idea to do it so!!!!?????
+ items[0] += "";
+ var itm = items[0].toString().split(' ').join('');
+
+ var grp = this.p.groupingView, $t= this;
+ if(gdata.hasOwnProperty(itm)) {
+ gdata[itm].push(rData);
+ } else {
+ gdata[itm] = [];
+ gdata[itm].push(rData);
+ grp.sortitems[0].push(itm);
+ grp.sortnames[0].push($.trim(items[0].toString()));
+ grp.summaryval[0][itm] = $.extend(true,[],grp.summary[0]);
+ }
+ if(grp.groupSummary[0]) {
+ $.each(grp.summaryval[0][itm],function(i,n) {
+ if ($.isFunction(this.st)) {
+ this.v = this.st.call($t, this.v, this.nm, record);
+ } else {
+ this.v = $($t).jqGrid('groupingCalculations.'+this.st, this.v, this.nm, record);
+ }
+ });
+ }
+ });
+ return gdata;
+ },
+ groupingToggle : function(hid){
+ this.each(function(){
+ var $t = this,
+ grp = $t.p.groupingView,
+ strpos = hid.lastIndexOf('_'),
+ uid = hid.substring(0,strpos+1),
+ num = parseInt(hid.substring(strpos+1),10)+1,
+ minus = grp.minusicon,
+ plus = grp.plusicon,
+ collapsed = false;
+ if( $("#"+hid+" span").hasClass(minus) ) {
+ if(grp.showSummaryOnHide && grp.groupSummary[0]) {
+ $("#"+hid).nextUntil(".jqfoot").hide();
+ } else {
+ $("#"+hid).nextUntil("#"+uid+String(num)).hide();
+ }
+ $("#"+hid+" span").removeClass(minus).addClass(plus);
+ collapsed = true;
+ } else {
+ $("#"+hid).nextUntil("#"+uid+String(num)).show();
+ $("#"+hid+" span").removeClass(plus).addClass(minus);
+ collapsed = false;
+ }
+ if( $.isFunction($t.p.onClickGroup)) { $t.p.onClickGroup.call($t, hid , collapsed); }
+
+ });
+ return false;
+ },
+ groupingRender : function (grdata, colspans ) {
+ return this.each(function(){
+ var $t = this,
+ grp = $t.p.groupingView,
+ str = "", icon = "", hid, pmrtl ="", gv, cp, ii;
+ //only one level for now
+ if(!grp.groupDataSorted) {
+ // ???? TO BE IMPROVED
+ grp.sortitems[0].sort();
+ grp.sortnames[0].sort();
+ if(grp.groupOrder[0].toLowerCase() == 'desc')
+ {
+ grp.sortitems[0].reverse();
+ grp.sortnames[0].reverse();
+ }
+ }
+ if(grp.groupCollapse) { pmrtl = grp.plusicon; }
+ else {pmrtl = grp.minusicon;}
+ pmrtl += " tree-wrap-"+$t.p.direction;
+ ii = 0;
+ while(ii < colspans) {
+ if($t.p.colModel[ii].name == grp.groupField[0]) {
+ cp = ii;
+ break;
+ }
+ ii++;
+ }
+ $.each(grp.sortitems[0],function(i,n){
+ hid = $t.p.id+"ghead_"+i;
+ icon = "<span style='cursor:pointer;' class='ui-icon "+pmrtl+"' onclick=\"jQuery('#"+$t.p.id+"').jqGrid('groupingToggle','"+hid+"');return false;\"></span>";
+ try {
+ gv = $t.formatter(hid, grp.sortnames[0][i], cp, grp.sortitems[0] );
+ } catch (egv) {
+ gv = grp.sortnames[0][i];
+ }
+ str += "<tr id=\""+hid+"\" role=\"row\" class= \"ui-widget-content jqgroup ui-row-"+$t.p.direction+"\"><td colspan=\""+colspans+"\">"+icon+$.jgrid.format(grp.groupText[0], gv, grdata[n].length)+"</td></tr>";
+ for(var kk=0;kk<grdata[n].length;kk++) {
+ str += grdata[n][kk].join('');
+ }
+ if(grp.groupSummary[0]) {
+ var hhdr = "";
+ if(grp.groupCollapse && !grp.showSummaryOnHide) {
+ hhdr = " style=\"display:none;\"";
+ }
+ str += "<tr"+hhdr+" role=\"row\" class=\"ui-widget-content jqfoot ui-row-"+$t.p.direction+"\">";
+ var fdata = grp.summaryval[0][n],
+ cm = $t.p.colModel,
+ vv, grlen = grdata[n].length;
+ for(var k=0; k<colspans;k++) {
+ var tmpdata = "<td "+$t.formatCol(k,1,'')+"> </td>",
+ tplfld = "{0}";
+ $.each(fdata,function(){
+ if(this.nm == cm[k].name) {
+ if(cm[k].summaryTpl) {
+ tplfld = cm[k].summaryTpl;
+ }
+ if(this.st == 'avg') {
+ if(this.v && grlen > 0) {
+ this.v = (this.v/grlen);
+ }
+ }
+ try {
+ vv = $t.formatter('', this.v, k, this);
+ } catch (ef) {
+ vv = this.v;
+ }
+ tmpdata= "<td "+$t.formatCol(k,1,'')+">"+$.jgrid.format(tplfld,vv)+ "</td>";
+ return false;
+ }
+ });
+ str += tmpdata;
+ }
+ str += "</tr>";
+ }
+ });
+ $("#"+$t.p.id+" tbody:first").append(str);
+ // free up memory
+ str = null;
+ });
+ },
+ groupingGroupBy : function (name, options, current) {
+ return this.each(function(){
+ var $t = this;
+ if(typeof(name) == "string") {
+ name = [name];
+ }
+ var grp = $t.p.groupingView;
+ $t.p.grouping = true;
+ // show previoous hidden groups if they are hidden
+ for(var i=0;i<grp.groupField.length;i++) {
+ if(!grp.groupColumnShow[i]) {
+ $($t).jqGrid('showCol',grp.groupField[i]);
+ }
+ }
+ $t.p.groupingView = $.extend($t.p.groupingView, options || {});
+ grp.groupField = name;
+ $($t).trigger("reloadGrid");
+ });
+ },
+ groupingRemove : function (current) {
+ return this.each(function(){
+ var $t = this;
+ if(typeof(current) == 'undefined') {
+ current = true;
+ }
+ $t.p.grouping = false;
+ if(current===true) {
+ $("tr.jqgroup, tr.jqfoot","#"+$t.p.id+" tbody:first").remove();
+ $("tr.jqgrow:hidden","#"+$t.p.id+" tbody:first").show();
+ } else {
+ $($t).trigger("reloadGrid");
+ }
+ });
+ },
+ groupingCalculations : {
+ "sum" : function(v, field, rc) {
+ return parseFloat(v||0) + parseFloat((rc[field]||0));
+ },
+ "min" : function(v, field, rc) {
+ if(v==="") {
+ return parseFloat(rc[field]||0);
+ }
+ return Math.min(parseFloat(v),parseFloat(rc[field]||0));
+ },
+ "max" : function(v, field, rc) {
+ if(v==="") {
+ return parseFloat(rc[field]||0);
+ }
+ return Math.max(parseFloat(v),parseFloat(rc[field]||0));
+ },
+ "count" : function(v, field, rc) {
+ if(v==="") {v=0;}
+ if(rc.hasOwnProperty(field)) {
+ return v+1;
+ } else {
+ return 0;
+ }
+ },
+ "avg" : function(v, field, rc) {
+ // the same as sum, but at end we divide it
+ return parseFloat(v||0) + parseFloat((rc[field]||0));
+ }
+ }
+});
+})(jQuery);
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/grid.import.js'
--- addons/base/static/jquery.jqGrid/js/grid.import.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.import.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,201 @@
+;(function($){
+/*
+ * jqGrid extension for constructing Grid Data from external file
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+ $.jgrid.extend({
+ jqGridImport : function(o) {
+ o = $.extend({
+ imptype : "xml", // xml, json, xmlstring, jsonstring
+ impstring: "",
+ impurl: "",
+ mtype: "GET",
+ impData : {},
+ xmlGrid :{
+ config : "roots>grid",
+ data: "roots>rows"
+ },
+ jsonGrid :{
+ config : "grid",
+ data: "data"
+ },
+ ajaxOptions :{}
+ }, o || {});
+ return this.each(function(){
+ var $t = this;
+ var XmlConvert = function (xml,o) {
+ var cnfg = $(o.xmlGrid.config,xml)[0];
+ var xmldata = $(o.xmlGrid.data,xml)[0], jstr, jstr1;
+ if(xmlJsonClass.xml2json && $.jgrid.parse) {
+ jstr = xmlJsonClass.xml2json(cnfg," ");
+ jstr = $.jgrid.parse(jstr);
+ for(var key in jstr) {
+ if(jstr.hasOwnProperty(key)) {
+ jstr1=jstr[key];
+ }
+ }
+ if(xmldata) {
+ // save the datatype
+ var svdatatype = jstr.grid.datatype;
+ jstr.grid.datatype = 'xmlstring';
+ jstr.grid.datastr = xml;
+ $($t).jqGrid( jstr1 ).jqGrid("setGridParam",{datatype:svdatatype});
+ } else {
+ $($t).jqGrid( jstr1 );
+ }
+ jstr = null;jstr1=null;
+ } else {
+ alert("xml2json or parse are not present");
+ }
+ };
+ var JsonConvert = function (jsonstr,o){
+ if (jsonstr && typeof jsonstr == 'string') {
+ var json = $.jgrid.parse(jsonstr);
+ var gprm = json[o.jsonGrid.config];
+ var jdata = json[o.jsonGrid.data];
+ if(jdata) {
+ var svdatatype = gprm.datatype;
+ gprm.datatype = 'jsonstring';
+ gprm.datastr = jdata;
+ $($t).jqGrid( gprm ).jqGrid("setGridParam",{datatype:svdatatype});
+ } else {
+ $($t).jqGrid( gprm );
+ }
+ }
+ };
+ switch (o.imptype){
+ case 'xml':
+ $.ajax($.extend({
+ url:o.impurl,
+ type:o.mtype,
+ data: o.impData,
+ dataType:"xml",
+ complete: function(xml,stat) {
+ if(stat == 'success') {
+ XmlConvert(xml.responseXML,o);
+ if($.isFunction(o.importComplete)) {
+ o.importComplete(xml);
+ }
+ }
+ xml=null;
+ }
+ }, o.ajaxOptions));
+ break;
+ case 'xmlstring' :
+ // we need to make just the conversion and use the same code as xml
+ if(o.impstring && typeof o.impstring == 'string') {
+ var xmld = $.jgrid.stringToDoc(o.impstring);
+ if(xmld) {
+ XmlConvert(xmld,o);
+ if($.isFunction(o.importComplete)) {
+ o.importComplete(xmld);
+ }
+ o.impstring = null;
+ }
+ xmld = null;
+ }
+ break;
+ case 'json':
+ $.ajax($.extend({
+ url:o.impurl,
+ type:o.mtype,
+ data: o.impData,
+ dataType:"json",
+ complete: function(json,stat) {
+ if(stat == 'success') {
+ JsonConvert(json.responseText,o );
+ if($.isFunction(o.importComplete)) {
+ o.importComplete(json);
+ }
+ }
+ json=null;
+ }
+ }, o.ajaxOptions ));
+ break;
+ case 'jsonstring' :
+ if(o.impstring && typeof o.impstring == 'string') {
+ JsonConvert(o.impstring,o );
+ if($.isFunction(o.importComplete)) {
+ o.importComplete(o.impstring);
+ }
+ o.impstring = null;
+ }
+ break;
+ }
+ });
+ },
+ jqGridExport : function(o) {
+ o = $.extend({
+ exptype : "xmlstring",
+ root: "grid",
+ ident: "\t"
+ }, o || {});
+ var ret = null;
+ this.each(function () {
+ if(!this.grid) { return;}
+ var gprm = $.extend({},$(this).jqGrid("getGridParam"));
+ // we need to check for:
+ // 1.multiselect, 2.subgrid 3. treegrid and remove the unneded columns from colNames
+ if(gprm.rownumbers) {
+ gprm.colNames.splice(0,1);
+ gprm.colModel.splice(0,1);
+ }
+ if(gprm.multiselect) {
+ gprm.colNames.splice(0,1);
+ gprm.colModel.splice(0,1);
+ }
+ if(gprm.subGrid) {
+ gprm.colNames.splice(0,1);
+ gprm.colModel.splice(0,1);
+ }
+ gprm.knv = null;
+ if(gprm.treeGrid) {
+ for (var key in gprm.treeReader) {
+ if(gprm.treeReader.hasOwnProperty(key)) {
+ gprm.colNames.splice(gprm.colNames.length-1);
+ gprm.colModel.splice(gprm.colModel.length-1);
+ }
+ }
+ }
+ switch (o.exptype) {
+ case 'xmlstring' :
+ ret = "<"+o.root+">"+xmlJsonClass.json2xml(gprm,o.ident)+"</"+o.root+">";
+ break;
+ case 'jsonstring' :
+ ret = "{"+ xmlJsonClass.toJson(gprm,o.root,o.ident)+"}";
+ if(gprm.postData.filters !== undefined) {
+ ret=ret.replace(/filters":"/,'filters":');
+ ret=ret.replace(/}]}"/,'}]}');
+ }
+ break;
+ }
+ });
+ return ret;
+ },
+ excelExport : function(o) {
+ o = $.extend({
+ exptype : "remote",
+ url : null,
+ oper: "oper",
+ tag: "excel",
+ exportOptions : {}
+ }, o || {});
+ return this.each(function(){
+ if(!this.grid) { return;}
+ var url;
+ if(o.exptype == "remote") {
+ var pdata = $.extend({},this.p.postData);
+ pdata[o.oper] = o.tag;
+ var params = jQuery.param(pdata);
+ if(o.url.indexOf("?") != -1) { url = o.url+"&"+params; }
+ else { url = o.url+"?"+params; }
+ window.location = url;
+ }
+ });
+ }
+ });
+})(jQuery);
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/grid.inlinedit.js'
--- addons/base/static/jquery.jqGrid/js/grid.inlinedit.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.inlinedit.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,255 @@
+;(function($){
+/**
+ * jqGrid extension for manipulating Grid Data
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+$.jgrid.extend({
+//Editing
+ editRow : function(rowid,keys,oneditfunc,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
+ return this.each(function(){
+ var $t = this, nm, tmp, editable, cnt=0, focus=null, svr={}, ind,cm;
+ if (!$t.grid ) { return; }
+ ind = $($t).jqGrid("getInd",rowid,true);
+ if( ind === false ) {return;}
+ editable = $(ind).attr("editable") || "0";
+ if (editable == "0" && !$(ind).hasClass("not-editable-row")) {
+ cm = $t.p.colModel;
+ $('td',ind).each( function(i) {
+ nm = cm[i].name;
+ var treeg = $t.p.treeGrid===true && nm == $t.p.ExpandColumn;
+ if(treeg) { tmp = $("span:first",this).html();}
+ else {
+ try {
+ tmp = $.unformat(this,{rowId:rowid, colModel:cm[i]},i);
+ } catch (_) {
+ tmp = $(this).html();
+ }
+ }
+ if ( nm != 'cb' && nm != 'subgrid' && nm != 'rn') {
+ if($t.p.autoencode) { tmp = $.jgrid.htmlDecode(tmp); }
+ svr[nm]=tmp;
+ if(cm[i].editable===true) {
+ if(focus===null) { focus = i; }
+ if (treeg) { $("span:first",this).html(""); }
+ else { $(this).html(""); }
+ var opt = $.extend({},cm[i].editoptions || {},{id:rowid+"_"+nm,name:nm});
+ if(!cm[i].edittype) { cm[i].edittype = "text"; }
+ var elc = $.jgrid.createEl(cm[i].edittype,opt,tmp,true,$.extend({},$.jgrid.ajaxOptions,$t.p.ajaxSelectOptions || {}));
+ $(elc).addClass("editable");
+ if(treeg) { $("span:first",this).append(elc); }
+ else { $(this).append(elc); }
+ //Again IE
+ if(cm[i].edittype == "select" && cm[i].editoptions.multiple===true && $.browser.msie) {
+ $(elc).width($(elc).width());
+ }
+ cnt++;
+ }
+ }
+ });
+ if(cnt > 0) {
+ svr.id = rowid; $t.p.savedRow.push(svr);
+ $(ind).attr("editable","1");
+ $("td:eq("+focus+") input",ind).focus();
+ if(keys===true) {
+ $(ind).bind("keydown",function(e) {
+ if (e.keyCode === 27) {$($t).jqGrid("restoreRow",rowid, afterrestorefunc);}
+ if (e.keyCode === 13) {
+ var ta = e.target;
+ if(ta.tagName == 'TEXTAREA') { return true; }
+ $($t).jqGrid("saveRow",rowid,succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc );
+ return false;
+ }
+ e.stopPropagation();
+ });
+ }
+ if( $.isFunction(oneditfunc)) { oneditfunc.call($t, rowid); }
+ }
+ }
+ });
+ },
+ saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc) {
+ return this.each(function(){
+ var $t = this, nm, tmp={}, tmp2={}, editable, fr, cv, ind;
+ if (!$t.grid ) { return; }
+ ind = $($t).jqGrid("getInd",rowid,true);
+ if(ind === false) {return;}
+ editable = $(ind).attr("editable");
+ url = url ? url : $t.p.editurl;
+ if (editable==="1") {
+ var cm;
+ $("td",ind).each(function(i) {
+ cm = $t.p.colModel[i];
+ nm = cm.name;
+ if ( nm != 'cb' && nm != 'subgrid' && cm.editable===true && nm != 'rn') {
+ switch (cm.edittype) {
+ case "checkbox":
+ var cbv = ["Yes","No"];
+ if(cm.editoptions ) {
+ cbv = cm.editoptions.value.split(":");
+ }
+ tmp[nm]= $("input",this).attr("checked") ? cbv[0] : cbv[1];
+ break;
+ case 'text':
+ case 'password':
+ case 'textarea':
+ case "button" :
+ tmp[nm]=$("input, textarea",this).val();
+ break;
+ case 'select':
+ if(!cm.editoptions.multiple) {
+ tmp[nm] = $("select>option:selected",this).val();
+ tmp2[nm] = $("select>option:selected", this).text();
+ } else {
+ var sel = $("select",this), selectedText = [];
+ tmp[nm] = $(sel).val();
+ if(tmp[nm]) { tmp[nm]= tmp[nm].join(","); } else { tmp[nm] =""; }
+ $("select > option:selected",this).each(
+ function(i,selected){
+ selectedText[i] = $(selected).text();
+ }
+ );
+ tmp2[nm] = selectedText.join(",");
+ }
+ if(cm.formatter && cm.formatter == 'select') { tmp2={}; }
+ break;
+ case 'custom' :
+ try {
+ if(cm.editoptions && $.isFunction(cm.editoptions.custom_value)) {
+ tmp[nm] = cm.editoptions.custom_value.call($t, $(".customelement",this),'get');
+ if (tmp[nm] === undefined) { throw "e2"; }
+ } else { throw "e1"; }
+ } catch (e) {
+ if (e=="e1") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose); }
+ if (e=="e2") { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+$.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose); }
+ else { $.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose); }
+ }
+ break;
+ }
+ cv = $.jgrid.checkValues(tmp[nm],i,$t);
+ if(cv[0] === false) {
+ cv[1] = tmp[nm] + " " + cv[1];
+ return false;
+ }
+ if($t.p.autoencode) { tmp[nm] = $.jgrid.htmlEncode(tmp[nm]); }
+ }
+ });
+ if (cv[0] === false){
+ try {
+ var positions = $.jgrid.findPos($("#"+$.jgrid.jqID(rowid), $t.grid.bDiv)[0]);
+ $.jgrid.info_dialog($.jgrid.errors.errcap,cv[1],$.jgrid.edit.bClose,{left:positions[0],top:positions[1]});
+ } catch (e) {
+ alert(cv[1]);
+ }
+ return;
+ }
+ if(tmp) {
+ var idname, opers, oper;
+ opers = $t.p.prmNames;
+ oper = opers.oper;
+ idname = opers.id;
+ tmp[oper] = opers.editoper;
+ tmp[idname] = rowid;
+ if(typeof($t.p.inlineData) == 'undefined') { $t.p.inlineData ={}; }
+ if(typeof(extraparam) == 'undefined') { extraparam ={}; }
+ tmp = $.extend({},tmp,$t.p.inlineData,extraparam);
+ }
+ if (url == 'clientArray') {
+ tmp = $.extend({},tmp, tmp2);
+ if($t.p.autoencode) {
+ $.each(tmp,function(n,v){
+ tmp[n] = $.jgrid.htmlDecode(v);
+ });
+ }
+ var resp = $($t).jqGrid("setRowData",rowid,tmp);
+ $(ind).attr("editable","0");
+ for( var k=0;k<$t.p.savedRow.length;k++) {
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+ }
+ if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
+ if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,resp); }
+ } else {
+ $("#lui_"+$t.p.id).show();
+ $.ajax($.extend({
+ url:url,
+ data: $.isFunction($t.p.serializeRowData) ? $t.p.serializeRowData.call($t, tmp) : tmp,
+ type: "POST",
+ complete: function(res,stat){
+ $("#lui_"+$t.p.id).hide();
+ if (stat === "success"){
+ var ret;
+ if( $.isFunction(succesfunc)) { ret = succesfunc.call($t, res);}
+ else { ret = true; }
+ if (ret===true) {
+ if($t.p.autoencode) {
+ $.each(tmp,function(n,v){
+ tmp[n] = $.jgrid.htmlDecode(v);
+ });
+ }
+ tmp = $.extend({},tmp, tmp2);
+ $($t).jqGrid("setRowData",rowid,tmp);
+ $(ind).attr("editable","0");
+ for( var k=0;k<$t.p.savedRow.length;k++) {
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+ }
+ if(fr >= 0) { $t.p.savedRow.splice(fr,1); }
+ if( $.isFunction(aftersavefunc) ) { aftersavefunc.call($t, rowid,res); }
+ } else {
+ if($.isFunction(errorfunc) ) {
+ errorfunc.call($t, rowid, res, stat);
+ }
+ $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
+ }
+ }
+ },
+ error:function(res,stat){
+ $("#lui_"+$t.p.id).hide();
+ if($.isFunction(errorfunc) ) {
+ errorfunc.call($t, rowid, res, stat);
+ } else {
+ alert("Error Row: "+rowid+" Result: " +res.status+":"+res.statusText+" Status: "+stat);
+ }
+ $($t).jqGrid("restoreRow",rowid, afterrestorefunc);
+ }
+ }, $.jgrid.ajaxOptions, $t.p.ajaxRowOptions || {}));
+ }
+ $(ind).unbind("keydown");
+ }
+ });
+ },
+ restoreRow : function(rowid, afterrestorefunc) {
+ return this.each(function(){
+ var $t= this, fr, ind, ares={};
+ if (!$t.grid ) { return; }
+ ind = $($t).jqGrid("getInd",rowid,true);
+ if(ind === false) {return;}
+ for( var k=0;k<$t.p.savedRow.length;k++) {
+ if( $t.p.savedRow[k].id == rowid) {fr = k; break;}
+ }
+ if(fr >= 0) {
+ if($.isFunction($.fn.datepicker)) {
+ try {
+ $("input.hasDatepicker","#"+$.jgrid.jqID(ind.id)).datepicker('hide');
+ } catch (e) {}
+ }
+ $.each($t.p.colModel, function(i,n){
+ if(this.editable === true && this.name in $t.p.savedRow[fr]) {
+ ares[this.name] = $t.p.savedRow[fr][this.name];
+ }
+ });
+ $($t).jqGrid("setRowData",rowid,ares);
+ $(ind).attr("editable","0").unbind("keydown");
+ $t.p.savedRow.splice(fr,1);
+ }
+ if ($.isFunction(afterrestorefunc))
+ {
+ afterrestorefunc.call($t, rowid);
+ }
+ });
+ }
+//end inline edit
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.jqueryui.js'
--- addons/base/static/jquery.jqGrid/js/grid.jqueryui.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.jqueryui.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,504 @@
+;(function($){
+/*
+**
+ * jqGrid addons using jQuery UI
+ * Author: Mark Williams
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * depends on jQuery UI
+**/
+if ($.browser.msie && $.browser.version==8) {
+ $.expr[":"].hidden = function(elem) {
+ return elem.offsetWidth === 0 || elem.offsetHeight === 0 ||
+ elem.style.display == "none";
+ };
+}
+// requiere load multiselect before grid
+$.jgrid._multiselect = false;
+if($.ui) {
+ if ($.ui.multiselect ) {
+ if($.ui.multiselect.prototype._setSelected) {
+ var setSelected = $.ui.multiselect.prototype._setSelected;
+ $.ui.multiselect.prototype._setSelected = function(item,selected) {
+ var ret = setSelected.call(this,item,selected);
+ if (selected && this.selectedList) {
+ var elt = this.element;
+ this.selectedList.find('li').each(function() {
+ if ($(this).data('optionLink')) {
+ $(this).data('optionLink').remove().appendTo(elt);
+ }
+ });
+ }
+ return ret;
+ };
+ }
+ if($.ui.multiselect.prototype.destroy) {
+ $.ui.multiselect.prototype.destroy = function() {
+ this.element.show();
+ this.container.remove();
+ if ($.Widget === undefined) {
+ $.widget.prototype.destroy.apply(this, arguments);
+ } else {
+ $.Widget.prototype.destroy.apply(this, arguments);
+ }
+ };
+ }
+ $.jgrid._multiselect = true;
+ }
+}
+
+$.jgrid.extend({
+ sortableColumns : function (tblrow)
+ {
+ return this.each(function (){
+ var ts = this;
+ function start() {ts.p.disableClick = true;}
+ var sortable_opts = {
+ "tolerance" : "pointer",
+ "axis" : "x",
+ "scrollSensitivity": "1",
+ "items": '>th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)',
+ "placeholder": {
+ element: function(item) {
+ var el = $(document.createElement(item[0].nodeName))
+ .addClass(item[0].className+" ui-sortable-placeholder ui-state-highlight")
+ .removeClass("ui-sortable-helper")[0];
+ return el;
+ },
+ update: function(self, p) {
+ p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10));
+ p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10));
+ }
+ },
+ "update": function(event, ui) {
+ var p = $(ui.item).parent();
+ var th = $(">th", p);
+ var colModel = ts.p.colModel;
+ var cmMap = {};
+ $.each(colModel, function(i) { cmMap[this.name]=i; });
+ var permutation = [];
+ th.each(function(i) {
+ var id = $(">div", this).get(0).id.replace(/^jqgh_/, "");
+ if (id in cmMap) {
+ permutation.push(cmMap[id]);
+ }
+ });
+
+ $(ts).jqGrid("remapColumns",permutation, true, true);
+ if ($.isFunction(ts.p.sortable.update)) {
+ ts.p.sortable.update(permutation);
+ }
+ setTimeout(function(){ts.p.disableClick=false;}, 50);
+ }
+ };
+ if (ts.p.sortable.options) {
+ $.extend(sortable_opts, ts.p.sortable.options);
+ } else if ($.isFunction(ts.p.sortable)) {
+ ts.p.sortable = { "update" : ts.p.sortable };
+ }
+ if (sortable_opts.start) {
+ var s = sortable_opts.start;
+ sortable_opts.start = function(e,ui) {
+ start();
+ s.call(this,e,ui);
+ };
+ } else {
+ sortable_opts.start = start;
+ }
+ if (ts.p.sortable.exclude) {
+ sortable_opts.items += ":not("+ts.p.sortable.exclude+")";
+ }
+ tblrow.sortable(sortable_opts).data("sortable").floating = true;
+ });
+ },
+ columnChooser : function(opts) {
+ var self = this;
+ if($("#colchooser_"+self[0].p.id).length ) { return; }
+ var selector = $('<div id="colchooser_'+self[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');
+ var select = $('select', selector);
+
+ function insert(perm,i,v) {
+ if(i>=0){
+ var a = perm.slice();
+ var b = a.splice(i,Math.max(perm.length-i,i));
+ if(i>perm.length) { i = perm.length; }
+ a[i] = v;
+ return a.concat(b);
+ }
+ }
+ opts = $.extend({
+ "width" : 420,
+ "height" : 240,
+ "classname" : null,
+ "done" : function(perm) { if (perm) { self.jqGrid("remapColumns", perm, true); } },
+ /* msel is either the name of a ui widget class that
+ extends a multiselect, or a function that supports
+ creating a multiselect object (with no argument,
+ or when passed an object), and destroying it (when
+ passed the string "destroy"). */
+ "msel" : "multiselect",
+ /* "msel_opts" : {}, */
+
+ /* dlog is either the name of a ui widget class that
+ behaves in a dialog-like way, or a function, that
+ supports creating a dialog (when passed dlog_opts)
+ or destroying a dialog (when passed the string
+ "destroy")
+ */
+ "dlog" : "dialog",
+
+ /* dlog_opts is either an option object to be passed
+ to "dlog", or (more likely) a function that creates
+ the options object.
+ The default produces a suitable options object for
+ ui.dialog */
+ "dlog_opts" : function(opts) {
+ var buttons = {};
+ buttons[opts.bSubmit] = function() {
+ opts.apply_perm();
+ opts.cleanup(false);
+ };
+ buttons[opts.bCancel] = function() {
+ opts.cleanup(true);
+ };
+ return {
+ "buttons": buttons,
+ "close": function() {
+ opts.cleanup(true);
+ },
+ "modal" : opts.modal ? opts.modal : false,
+ "resizable": opts.resizable ? opts.resizable : true,
+ "width": opts.width+20
+ };
+ },
+ /* Function to get the permutation array, and pass it to the
+ "done" function */
+ "apply_perm" : function() {
+ $('option',select).each(function(i) {
+ if (this.selected) {
+ self.jqGrid("showCol", colModel[this.value].name);
+ } else {
+ self.jqGrid("hideCol", colModel[this.value].name);
+ }
+ });
+
+ var perm = [];
+ //fixedCols.slice(0);
+ $('option[selected]',select).each(function() { perm.push(parseInt(this.value,10)); });
+ $.each(perm, function() { delete colMap[colModel[parseInt(this,10)].name]; });
+ $.each(colMap, function() {
+ var ti = parseInt(this,10);
+ perm = insert(perm,ti,ti);
+ });
+ if (opts.done) {
+ opts.done.call(self, perm);
+ }
+ },
+ /* Function to cleanup the dialog, and select. Also calls the
+ done function with no permutation (to indicate that the
+ columnChooser was aborted */
+ "cleanup" : function(calldone) {
+ call(opts.dlog, selector, 'destroy');
+ call(opts.msel, select, 'destroy');
+ selector.remove();
+ if (calldone && opts.done) {
+ opts.done.call(self);
+ }
+ },
+ "msel_opts" : {}
+ }, $.jgrid.col, opts || {});
+ if($.ui) {
+ if ($.ui.multiselect ) {
+ if(opts.msel == "multiselect") {
+ if(!$.jgrid._multiselect) {
+ // should be in language file
+ alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
+ return;
+ }
+ opts.msel_opts = $.extend($.ui.multiselect.defaults,opts.msel_opts);
+ }
+ }
+ }
+ if (opts.caption) {
+ selector.attr("title", opts.caption);
+ }
+ if (opts.classname) {
+ selector.addClass(opts.classname);
+ select.addClass(opts.classname);
+ }
+ if (opts.width) {
+ $(">div",selector).css({"width": opts.width,"margin":"0 auto"});
+ select.css("width", opts.width);
+ }
+ if (opts.height) {
+ $(">div",selector).css("height", opts.height);
+ select.css("height", opts.height - 10);
+ }
+ var colModel = self.jqGrid("getGridParam", "colModel");
+ var colNames = self.jqGrid("getGridParam", "colNames");
+ var colMap = {}, fixedCols = [];
+
+ select.empty();
+ $.each(colModel, function(i) {
+ colMap[this.name] = i;
+ if (this.hidedlg) {
+ if (!this.hidden) {
+ fixedCols.push(i);
+ }
+ return;
+ }
+
+ select.append("<option value='"+i+"' "+
+ (this.hidden?"":"selected='selected'")+">"+colNames[i]+"</option>");
+ });
+ function call(fn, obj) {
+ if (!fn) { return; }
+ if (typeof fn == 'string') {
+ if ($.fn[fn]) {
+ $.fn[fn].apply(obj, $.makeArray(arguments).slice(2));
+ }
+ } else if ($.isFunction(fn)) {
+ fn.apply(obj, $.makeArray(arguments).slice(2));
+ }
+ }
+
+ var dopts = $.isFunction(opts.dlog_opts) ? opts.dlog_opts.call(self, opts) : opts.dlog_opts;
+ call(opts.dlog, selector, dopts);
+ var mopts = $.isFunction(opts.msel_opts) ? opts.msel_opts.call(self, opts) : opts.msel_opts;
+ call(opts.msel, select, mopts);
+ },
+ sortableRows : function (opts) {
+ // Can accept all sortable options and events
+ return this.each(function(){
+ var $t = this;
+ if(!$t.grid) { return; }
+ // Currently we disable a treeGrid sortable
+ if($t.p.treeGrid) { return; }
+ if($.fn.sortable) {
+ opts = $.extend({
+ "cursor":"move",
+ "axis" : "y",
+ "items": ".jqgrow"
+ },
+ opts || {});
+ if(opts.start && $.isFunction(opts.start)) {
+ opts._start_ = opts.start;
+ delete opts.start;
+ } else {opts._start_=false;}
+ if(opts.update && $.isFunction(opts.update)) {
+ opts._update_ = opts.update;
+ delete opts.update;
+ } else {opts._update_ = false;}
+ opts.start = function(ev,ui) {
+ $(ui.item).css("border-width","0px");
+ $("td",ui.item).each(function(i){
+ this.style.width = $t.grid.cols[i].style.width;
+ });
+ if($t.p.subGrid) {
+ var subgid = $(ui.item).attr("id");
+ try {
+ $($t).jqGrid('collapseSubGridRow',subgid);
+ } catch (e) {}
+ }
+ if(opts._start_) {
+ opts._start_.apply(this,[ev,ui]);
+ }
+ };
+ opts.update = function (ev,ui) {
+ $(ui.item).css("border-width","");
+ if($t.p.rownumbers === true) {
+ $("td.jqgrid-rownum",$t.rows).each(function(i){
+ $(this).html(i+1);
+ });
+ }
+ if(opts._update_) {
+ opts._update_.apply(this,[ev,ui]);
+ }
+ };
+ $("tbody:first",$t).sortable(opts);
+ $("tbody:first",$t).disableSelection();
+ }
+ });
+ },
+ gridDnD : function(opts) {
+ return this.each(function(){
+ var $t = this;
+ if(!$t.grid) { return; }
+ // Currently we disable a treeGrid drag and drop
+ if($t.p.treeGrid) { return; }
+ if(!$.fn.draggable || !$.fn.droppable) { return; }
+ function updateDnD ()
+ {
+ var datadnd = $.data($t,"dnd");
+ $("tr.jqgrow:not(.ui-draggable)",$t).draggable($.isFunction(datadnd.drag) ? datadnd.drag.call($($t),datadnd) : datadnd.drag);
+ }
+ var appender = "<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>";
+ if($("#jqgrid_dnd").html() === null) {
+ $('body').append(appender);
+ }
+
+ if(typeof opts == 'string' && opts == 'updateDnD' && $t.p.jqgdnd===true) {
+ updateDnD();
+ return;
+ }
+ opts = $.extend({
+ "drag" : function (opts) {
+ return $.extend({
+ start : function (ev, ui) {
+ // if we are in subgrid mode try to collapse the node
+ if($t.p.subGrid) {
+ var subgid = $(ui.helper).attr("id");
+ try {
+ $($t).jqGrid('collapseSubGridRow',subgid);
+ } catch (e) {}
+ }
+ // hack
+ // drag and drop does not insert tr in table, when the table has no rows
+ // we try to insert new empty row on the target(s)
+ for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
+ if($($.data($t,"dnd").connectWith[i]).jqGrid('getGridParam','reccount') == "0" ){
+ $($.data($t,"dnd").connectWith[i]).jqGrid('addRowData','jqg_empty_row',{});
+ }
+ }
+ ui.helper.addClass("ui-state-highlight");
+ $("td",ui.helper).each(function(i) {
+ this.style.width = $t.grid.headers[i].width+"px";
+ });
+ if(opts.onstart && $.isFunction(opts.onstart) ) { opts.onstart.call($($t),ev,ui); }
+ },
+ stop :function(ev,ui) {
+ if(ui.helper.dropped) {
+ var ids = $(ui.helper).attr("id");
+ $($t).jqGrid('delRowData',ids );
+ }
+ // if we have a empty row inserted from start event try to delete it
+ for (var i=0;i<$.data($t,"dnd").connectWith.length;i++){
+ $($.data($t,"dnd").connectWith[i]).jqGrid('delRowData','jqg_empty_row');
+ }
+ if(opts.onstop && $.isFunction(opts.onstop) ) { opts.onstop.call($($t),ev,ui); }
+ }
+ },opts.drag_opts || {});
+ },
+ "drop" : function (opts) {
+ return $.extend({
+ accept: function(d) {
+ if (!$(d).hasClass('jqgrow')) { return d;}
+ var tid = $(d).closest("table.ui-jqgrid-btable");
+ if(tid.length > 0 && $.data(tid[0],"dnd") !== undefined) {
+ var cn = $.data(tid[0],"dnd").connectWith;
+ return $.inArray('#'+this.id,cn) != -1 ? true : false;
+ }
+ return d;
+ },
+ drop: function(ev, ui) {
+ if (!$(ui.draggable).hasClass('jqgrow')) { return; }
+ var accept = $(ui.draggable).attr("id");
+ var getdata = ui.draggable.parent().parent().jqGrid('getRowData',accept);
+ if(!opts.dropbyname) {
+ var j =0, tmpdata = {}, dropname;
+ var dropmodel = $("#"+this.id).jqGrid('getGridParam','colModel');
+ try {
+ for (var key in getdata) {
+ if(getdata.hasOwnProperty(key) && dropmodel[j]) {
+ dropname = dropmodel[j].name;
+ tmpdata[dropname] = getdata[key];
+ }
+ j++;
+ }
+ getdata = tmpdata;
+ } catch (e) {}
+ }
+ ui.helper.dropped = true;
+ if(opts.beforedrop && $.isFunction(opts.beforedrop) ) {
+ //parameters to this callback - event, element, data to be inserted, sender, reciever
+ // should return object which will be inserted into the reciever
+ var datatoinsert = opts.beforedrop.call(this,ev,ui,getdata,$('#'+$t.id),$(this));
+ if (typeof datatoinsert != "undefined" && datatoinsert !== null && typeof datatoinsert == "object") { getdata = datatoinsert; }
+ }
+ if(ui.helper.dropped) {
+ var grid;
+ if(opts.autoid) {
+ if($.isFunction(opts.autoid)) {
+ grid = opts.autoid.call(this,getdata);
+ } else {
+ grid = Math.ceil(Math.random()*1000);
+ grid = opts.autoidprefix+grid;
+ }
+ }
+ // NULL is interpreted as undefined while null as object
+ $("#"+this.id).jqGrid('addRowData',grid,getdata,opts.droppos);
+ }
+ if(opts.ondrop && $.isFunction(opts.ondrop) ) { opts.ondrop.call(this,ev,ui, getdata); }
+ }}, opts.drop_opts || {});
+ },
+ "onstart" : null,
+ "onstop" : null,
+ "beforedrop": null,
+ "ondrop" : null,
+ "drop_opts" : {
+ "activeClass": "ui-state-active",
+ "hoverClass": "ui-state-hover"
+ },
+ "drag_opts" : {
+ "revert": "invalid",
+ "helper": "clone",
+ "cursor": "move",
+ "appendTo" : "#jqgrid_dnd",
+ "zIndex": 5000
+ },
+ "dropbyname" : false,
+ "droppos" : "first",
+ "autoid" : true,
+ "autoidprefix" : "dnd_"
+ }, opts || {});
+
+ if(!opts.connectWith) { return; }
+ opts.connectWith = opts.connectWith.split(",");
+ opts.connectWith = $.map(opts.connectWith,function(n){return $.trim(n);});
+ $.data($t,"dnd",opts);
+
+ if($t.p.reccount != "0" && !$t.p.jqgdnd) {
+ updateDnD();
+ }
+ $t.p.jqgdnd = true;
+ for (var i=0;i<opts.connectWith.length;i++){
+ var cn =opts.connectWith[i];
+ $(cn).droppable($.isFunction(opts.drop) ? opts.drop.call($($t),opts) : opts.drop);
+ }
+ });
+ },
+ gridResize : function(opts) {
+ return this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$.fn.resizable) { return; }
+ opts = $.extend({}, opts || {});
+ if(opts.alsoResize ) {
+ opts._alsoResize_ = opts.alsoResize;
+ delete opts.alsoResize;
+ } else {
+ opts._alsoResize_ = false;
+ }
+ if(opts.stop && $.isFunction(opts.stop)) {
+ opts._stop_ = opts.stop;
+ delete opts.stop;
+ } else {
+ opts._stop_ = false;
+ }
+ opts.stop = function (ev, ui) {
+ $($t).jqGrid('setGridParam',{height:$("#gview_"+$t.p.id+" .ui-jqgrid-bdiv").height()});
+ $($t).jqGrid('setGridWidth',ui.size.width,opts.shrinkToFit);
+ if(opts._stop_) { opts._stop_.call($t,ev,ui); }
+ };
+ if(opts._alsoResize_) {
+ var optstest = "{\'#gview_"+$t.p.id+" .ui-jqgrid-bdiv\':true,'" +opts._alsoResize_+"':true}";
+ opts.alsoResize = eval('('+optstest+')'); // the only way that I found to do this
+ } else {
+ opts.alsoResize = $(".ui-jqgrid-bdiv","#gview_"+$t.p.id);
+ }
+ delete opts._alsoResize_;
+ $("#gbox_"+$t.p.id).resizable(opts);
+ });
+ }
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.subgrid.js'
--- addons/base/static/jquery.jqGrid/js/grid.subgrid.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.subgrid.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,260 @@
+;(function($){
+/**
+ * jqGrid extension for SubGrid Data
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl-2.0.html
+**/
+$.jgrid.extend({
+setSubGrid : function () {
+ return this.each(function (){
+ var $t = this, cm;
+ $t.p.colNames.unshift("");
+ $t.p.colModel.unshift({name:'subgrid',width: $.browser.safari ? $t.p.subGridWidth+$t.p.cellLayout : $t.p.subGridWidth,sortable: false,resizable:false,hidedlg:true,search:false,fixed:true});
+ cm = $t.p.subGridModel;
+ if(cm[0]) {
+ cm[0].align = $.extend([],cm[0].align || []);
+ for(var i=0;i<cm[0].name.length;i++) { cm[0].align[i] = cm[0].align[i] || 'left';}
+ }
+ });
+},
+addSubGridCell :function (pos,iRow) {
+ var prp='',gv,sid;
+ this.each(function(){
+ prp = this.formatCol(pos,iRow);
+ gv = this.p.gridview;
+ sid= this.p.id;
+ });
+ if( gv === false ){
+ return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" class=\"ui-sgcollapsed sgcollapsed\" "+prp+"><a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a></td>";
+ } else {
+ return "<td role=\"grid\" aria-describedby=\""+sid+"_subgrid\" " +prp +"></td>";
+ }
+},
+addSubGrid : function(t,pos) {
+ return this.each(function(){
+ var ts = this;
+ if (!ts.grid ) { return; }
+ //-------------------------
+ var subGridCell = function(trdiv,cell,pos){
+ var tddiv = $("<td align='"+ts.p.subGridModel[0].align[pos]+"'></td>").html(cell);
+ $(trdiv).append(tddiv);
+ };
+ var subGridXml = function(sjxml, sbid){
+ var tddiv, i, sgmap,
+ dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
+ trdiv = $("<tr></tr>");
+ for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
+ tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
+ $(tddiv).html(ts.p.subGridModel[0].name[i]);
+ $(tddiv).width( ts.p.subGridModel[0].width[i]);
+ $(trdiv).append(tddiv);
+ }
+ $(dummy).append(trdiv);
+ if (sjxml){
+ sgmap = ts.p.xmlReader.subgrid;
+ $(sgmap.root+" "+sgmap.row, sjxml).each( function(){
+ trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
+ if(sgmap.repeatitems === true) {
+ $(sgmap.cell,this).each( function(i) {
+ subGridCell(trdiv, $(this).text() || ' ',i);
+ });
+ } else {
+ var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
+ if (f) {
+ for (i=0;i<f.length;i++) {
+ subGridCell(trdiv, $(f[i],this).text() || ' ',i);
+ }
+ }
+ }
+ $(dummy).append(trdiv);
+ });
+ }
+ var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
+ $("#"+pID+sbid).append(dummy);
+ ts.grid.hDiv.loading = false;
+ $("#load_"+ts.p.id).hide();
+ return false;
+ };
+ var subGridJson = function(sjxml, sbid){
+ var tddiv,result , i,cur, sgmap,j,
+ dummy = $("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
+ trdiv = $("<tr></tr>");
+ for (i = 0; i<ts.p.subGridModel[0].name.length; i++) {
+ tddiv = $("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+ts.p.direction+"'></th>");
+ $(tddiv).html(ts.p.subGridModel[0].name[i]);
+ $(tddiv).width( ts.p.subGridModel[0].width[i]);
+ $(trdiv).append(tddiv);
+ }
+ $(dummy).append(trdiv);
+ if (sjxml){
+ sgmap = ts.p.jsonReader.subgrid;
+ result = sjxml[sgmap.root];
+ if ( typeof result !== 'undefined' ) {
+ for (i=0;i<result.length;i++) {
+ cur = result[i];
+ trdiv = $("<tr class='ui-widget-content ui-subtblcell'></tr>");
+ if(sgmap.repeatitems === true) {
+ if(sgmap.cell) { cur=cur[sgmap.cell]; }
+ for (j=0;j<cur.length;j++) {
+ subGridCell(trdiv, cur[j] || ' ',j);
+ }
+ } else {
+ var f = ts.p.subGridModel[0].mapping || ts.p.subGridModel[0].name;
+ if(f.length) {
+ for (j=0;j<f.length;j++) {
+ subGridCell(trdiv, cur[f[j]] || ' ',j);
+ }
+ }
+ }
+ $(dummy).append(trdiv);
+ }
+ }
+ }
+ var pID = $("table:first",ts.grid.bDiv).attr("id")+"_";
+ $("#"+pID+sbid).append(dummy);
+ ts.grid.hDiv.loading = false;
+ $("#load_"+ts.p.id).hide();
+ return false;
+ };
+ var populatesubgrid = function( rd ) {
+ var sid,dp, i, j;
+ sid = $(rd).attr("id");
+ dp = {nd_: (new Date().getTime())};
+ dp[ts.p.prmNames.subgridid]=sid;
+ if(!ts.p.subGridModel[0]) { return false; }
+ if(ts.p.subGridModel[0].params) {
+ for(j=0; j < ts.p.subGridModel[0].params.length; j++) {
+ for(i=0; i<ts.p.colModel.length; i++) {
+ if(ts.p.colModel[i].name == ts.p.subGridModel[0].params[j]) {
+ dp[ts.p.colModel[i].name]= $("td:eq("+i+")",rd).text().replace(/\ \;/ig,'');
+ }
+ }
+ }
+ }
+ if(!ts.grid.hDiv.loading) {
+ ts.grid.hDiv.loading = true;
+ $("#load_"+ts.p.id).show();
+ if(!ts.p.subgridtype) { ts.p.subgridtype = ts.p.datatype; }
+ if($.isFunction(ts.p.subgridtype)) {
+ ts.p.subgridtype.call(ts, dp);
+ } else {
+ ts.p.subgridtype = ts.p.subgridtype.toLowerCase();
+ }
+ switch(ts.p.subgridtype) {
+ case "xml":
+ case "json":
+ $.ajax($.extend({
+ type:ts.p.mtype,
+ url: ts.p.subGridUrl,
+ dataType:ts.p.subgridtype,
+ data: $.isFunction(ts.p.serializeSubGridData)? ts.p.serializeSubGridData.call(ts, dp) : dp,
+ complete: function(sxml) {
+ if(ts.p.subgridtype == "xml") {
+ subGridXml(sxml.responseXML, sid);
+ } else {
+ subGridJson($.jgrid.parse(sxml.responseText),sid);
+ }
+ sxml=null;
+ }
+ }, $.jgrid.ajaxOptions, ts.p.ajaxSubgridOptions || {}));
+ break;
+ }
+ }
+ return false;
+ };
+ var res,_id, pID,atd, nhc, subdata, bfsc;
+ $("td:eq("+pos+")",t).click( function(e) {
+ if($(this).hasClass("sgcollapsed")) {
+ pID = ts.p.id;
+ res = $(this).parent();
+ atd = pos >=1 ? "<td colspan='"+pos+"'> </td>":"";
+ _id = $(res).attr("id");
+ bfsc =true;
+ if($.isFunction(ts.p.subGridBeforeExpand)) {
+ bfsc = ts.p.subGridBeforeExpand.call(ts, pID+"_"+_id,_id);
+ }
+ if(bfsc === false) {return false;}
+ nhc = 0;
+ $.each(ts.p.colModel,function(i,v){
+ if(this.hidden === true || this.name == 'rn' || this.name == 'cb') {nhc++;}
+ });
+ subdata = "<tr role='row' class='ui-subgrid'>"+atd+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon ui-icon-carat-1-sw'/></td><td colspan='"+parseInt(ts.p.colNames.length-1-nhc,10)+"' class='ui-widget-content subgrid-data'><div id="+pID+"_"+_id+" class='tablediv'>";
+ $(this).parent().after( subdata+ "</div></td></tr>" );
+ if( $.isFunction(ts.p.subGridRowExpanded)) {
+ ts.p.subGridRowExpanded.call(ts, pID+"_"+ _id,_id);
+ } else {
+ populatesubgrid(res);
+ }
+ $(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-minus'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
+ } else if($(this).hasClass("sgexpanded")) {
+ bfsc = true;
+ if( $.isFunction(ts.p.subGridRowColapsed)) {
+ res = $(this).parent();
+ _id = $(res).attr("id");
+ bfsc = ts.p.subGridRowColapsed.call(ts, pID+"_"+_id,_id );
+ }
+ if(bfsc===false) {return false;}
+ $(this).parent().next().remove(".ui-subgrid");
+ $(this).html("<a href='javascript:void(0);'><span class='ui-icon ui-icon-plus'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
+ }
+ return false;
+ });
+ ts.subGridXml = function(xml,sid) {subGridXml(xml,sid);};
+ ts.subGridJson = function(json,sid) {subGridJson(json,sid);};
+ });
+},
+expandSubGridRow : function(rowid) {
+ return this.each(function () {
+ var $t = this;
+ if(!$t.grid && !rowid) {return;}
+ if($t.p.subGrid===true) {
+ var rc = $(this).jqGrid("getInd",rowid,true);
+ if(rc) {
+ var sgc = $("td.sgcollapsed",rc)[0];
+ if(sgc) {
+ $(sgc).trigger("click");
+ }
+ }
+ }
+ });
+},
+collapseSubGridRow : function(rowid) {
+ return this.each(function () {
+ var $t = this;
+ if(!$t.grid && !rowid) {return;}
+ if($t.p.subGrid===true) {
+ var rc = $(this).jqGrid("getInd",rowid,true);
+ if(rc) {
+ var sgc = $("td.sgexpanded",rc)[0];
+ if(sgc) {
+ $(sgc).trigger("click");
+ }
+ }
+ }
+ });
+},
+toggleSubGridRow : function(rowid) {
+ return this.each(function () {
+ var $t = this;
+ if(!$t.grid && !rowid) {return;}
+ if($t.p.subGrid===true) {
+ var rc = $(this).jqGrid("getInd",rowid,true);
+ if(rc) {
+ var sgc = $("td.sgcollapsed",rc)[0];
+ if(sgc) {
+ $(sgc).trigger("click");
+ } else {
+ sgc = $("td.sgexpanded",rc)[0];
+ if(sgc) {
+ $(sgc).trigger("click");
+ }
+ }
+ }
+ }
+ });
+}
+});
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/grid.tbltogrid.js'
--- addons/base/static/jquery.jqGrid/js/grid.tbltogrid.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.tbltogrid.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,106 @@
+/*
+ Transform a table to a jqGrid.
+ Peter Romianowski <peter.romianowski@xxxxxxxxx>
+ If the first column of the table contains checkboxes or
+ radiobuttons then the jqGrid is made selectable.
+*/
+// Addition - selector can be a class or id
+function tableToGrid(selector, options) {
+jQuery(selector).each(function() {
+ if(this.grid) {return;} //Adedd from Tony Tomov
+ // This is a small "hack" to make the width of the jqGrid 100%
+ jQuery(this).width("99%");
+ var w = jQuery(this).width();
+
+ // Text whether we have single or multi select
+ var inputCheckbox = jQuery('input[type=checkbox]:first', jQuery(this));
+ var inputRadio = jQuery('input[type=radio]:first', jQuery(this));
+ var selectMultiple = inputCheckbox.length > 0;
+ var selectSingle = !selectMultiple && inputRadio.length > 0;
+ var selectable = selectMultiple || selectSingle;
+ //var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
+
+ // Build up the columnModel and the data
+ var colModel = [];
+ var colNames = [];
+ jQuery('th', jQuery(this)).each(function() {
+ if (colModel.length === 0 && selectable) {
+ colModel.push({
+ name: '__selection__',
+ index: '__selection__',
+ width: 0,
+ hidden: true
+ });
+ colNames.push('__selection__');
+ } else {
+ colModel.push({
+ name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
+ index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(' ').join('_'),
+ width: jQuery(this).width() || 150
+ });
+ colNames.push(jQuery(this).html());
+ }
+ });
+ var data = [];
+ var rowIds = [];
+ var rowChecked = [];
+ jQuery('tbody > tr', jQuery(this)).each(function() {
+ var row = {};
+ var rowPos = 0;
+ jQuery('td', jQuery(this)).each(function() {
+ if (rowPos === 0 && selectable) {
+ var input = jQuery('input', jQuery(this));
+ var rowId = input.attr("value");
+ rowIds.push(rowId || data.length);
+ if (input.attr("checked")) {
+ rowChecked.push(rowId);
+ }
+ row[colModel[rowPos].name] = input.attr("value");
+ } else {
+ row[colModel[rowPos].name] = jQuery(this).html();
+ }
+ rowPos++;
+ });
+ if(rowPos >0) { data.push(row); }
+ });
+
+ // Clear the original HTML table
+ jQuery(this).empty();
+
+ // Mark it as jqGrid
+ jQuery(this).addClass("scroll");
+
+ jQuery(this).jqGrid(jQuery.extend({
+ datatype: "local",
+ width: w,
+ colNames: colNames,
+ colModel: colModel,
+ multiselect: selectMultiple
+ //inputName: inputName,
+ //inputValueCol: imputName != null ? "__selection__" : null
+ }, options || {}));
+
+ // Add data
+ var a;
+ for (a = 0; a < data.length; a++) {
+ var id = null;
+ if (rowIds.length > 0) {
+ id = rowIds[a];
+ if (id && id.replace) {
+ // We have to do this since the value of a checkbox
+ // or radio button can be anything
+ id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
+ }
+ }
+ if (id === null) {
+ id = a + 1;
+ }
+ jQuery(this).jqGrid("addRowData",id, data[a]);
+ }
+
+ // Set the selection
+ for (a = 0; a < rowChecked.length; a++) {
+ jQuery(this).jqGrid("setSelection",rowChecked[a]);
+ }
+});
+};
=== added file 'addons/base/static/jquery.jqGrid/js/grid.treegrid.js'
--- addons/base/static/jquery.jqGrid/js/grid.treegrid.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/grid.treegrid.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,490 @@
+;(function($) {
+/*
+**
+ * jqGrid extension - Tree Grid
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid.extend({
+ setTreeNode : function(rd, row){
+ return this.each(function(){
+ var $t = this;
+ if( !$t.grid || !$t.p.treeGrid ) { return; }
+ var expCol = $t.p.expColInd,
+ expanded = $t.p.treeReader.expanded_field,
+ isLeaf = $t.p.treeReader.leaf_field,
+ level = $t.p.treeReader.level_field,
+ loaded = $t.p.treeReader.loaded;
+
+ row.level = rd[level];
+
+ if($t.p.treeGridModel == 'nested') {
+ var lft = rd[$t.p.treeReader.left_field],
+ rgt = rd[$t.p.treeReader.right_field];
+ if(!rd[isLeaf]) {
+ // NS Model
+ rd[isLeaf] = (parseInt(rgt,10) === parseInt(lft,10)+1) ? 'true' : 'false';
+ }
+ } else {
+ //row.parent_id = rd[$t.p.treeReader.parent_id_field];
+ }
+ var curLevel = parseInt(rd[level],10), ident,lftpos;
+ if($t.p.tree_root_level === 0) {
+ ident = curLevel+1;
+ lftpos = curLevel;
+ } else {
+ ident = curLevel;
+ lftpos = curLevel -1;
+ }
+ var twrap = "<div class='tree-wrap tree-wrap-"+$t.p.direction+"' style='width:"+(ident*18)+"px;'>";
+ twrap += "<div style='"+($t.p.direction=="rtl" ? "right:" : "left:")+(lftpos*18)+"px;' class='ui-icon ";
+
+ if(rd[loaded] != undefined) {
+ if(rd[loaded]=="true" || rd[loaded]===true) {
+ rd[loaded] = true;
+ } else {
+ rd[loaded] = false;
+ }
+ }
+ if(rd[isLeaf] == "true" || rd[isLeaf] === true) {
+ twrap += $t.p.treeIcons.leaf+" tree-leaf'";
+ rd[isLeaf] = true;
+ rd[expanded] = false;
+ } else {
+ if(rd[expanded] == "true" || rd[expanded] === true) {
+ twrap += $t.p.treeIcons.minus+" tree-minus treeclick'";
+ rd[expanded] = true;
+ } else {
+ twrap += $t.p.treeIcons.plus+" tree-plus treeclick'";
+ rd[expanded] = false;
+ }
+ rd[isLeaf] = false;
+ }
+ twrap += "</div></div>";
+ if(!$t.p.loadonce) {
+ rd[$t.p.localReader.id] = row.id;
+ $t.p.data.push(rd);
+ $t.p._index[row.id]=$t.p.data.length-1;
+ }
+ if(parseInt(rd[level],10) !== parseInt($t.p.tree_root_level,10)) {
+ if(!$($t).jqGrid("isVisibleNode",rd)){
+ $(row).css("display","none");
+ }
+ }
+
+ $("td:eq("+expCol+")",row).wrapInner("<span></span>").prepend(twrap);
+ $(".treeclick",row).bind("click",function(e){
+ var target = e.target || e.srcElement,
+ ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id,
+ pos = $t.p._index[ind2],
+ isLeaf = $t.p.treeReader.leaf_field,
+ expanded = $t.p.treeReader.expanded_field;
+ if(!$t.p.data[pos][isLeaf]){
+ if($t.p.data[pos][expanded]){
+ $($t).jqGrid("collapseRow",$t.p.data[pos]);
+ $($t).jqGrid("collapseNode",$t.p.data[pos]);
+ } else {
+ $($t).jqGrid("expandRow",$t.p.data[pos]);
+ $($t).jqGrid("expandNode",$t.p.data[pos]);
+ }
+ }
+ return false;
+ });
+ if($t.p.ExpandColClick === true) {
+ $("span", row).css("cursor","pointer").bind("click",function(e){
+ var target = e.target || e.srcElement,
+ ind2 =$(target,$t.rows).closest("tr.jqgrow")[0].id,
+ pos = $t.p._index[ind2],
+ isLeaf = $t.p.treeReader.leaf_field,
+ expanded = $t.p.treeReader.expanded_field;
+ if(!$t.p.data[pos][isLeaf]){
+ if($t.p.data[pos][expanded]){
+ $($t).jqGrid("collapseRow",$t.p.data[pos]);
+ $($t).jqGrid("collapseNode",$t.p.data[pos]);
+ } else {
+ $($t).jqGrid("expandRow",$t.p.data[pos]);
+ $($t).jqGrid("expandNode",$t.p.data[pos]);
+ }
+ }
+ $($t).jqGrid("setSelection",ind2);
+ return false;
+ });
+ }
+ });
+ },
+ setTreeGrid : function() {
+ return this.each(function (){
+ var $t = this, i=0, pico;
+ if(!$t.p.treeGrid) { return; }
+ if(!$t.p.treedatatype ) { $.extend($t.p,{treedatatype: $t.p.datatype}); }
+ $t.p.subGrid = false; $t.p.altRows =false;
+ $t.p.pgbuttons = false; $t.p.pginput = false;
+ $t.p.multiselect = false; $t.p.rowList = [];
+ pico = 'ui-icon-triangle-1-' + ($t.p.direction=="rtl" ? 'w' : 'e');
+ $t.p.treeIcons = $.extend({plus:pico,minus:'ui-icon-triangle-1-s',leaf:'ui-icon-radio-off'},$t.p.treeIcons || {});
+ if($t.p.treeGridModel == 'nested') {
+ $t.p.treeReader = $.extend({
+ level_field: "level",
+ left_field:"lft",
+ right_field: "rgt",
+ leaf_field: "isLeaf",
+ expanded_field: "expanded",
+ loaded: "loaded"
+ },$t.p.treeReader);
+ } else
+ if($t.p.treeGridModel == 'adjacency') {
+ $t.p.treeReader = $.extend({
+ level_field: "level",
+ parent_id_field: "parent",
+ leaf_field: "isLeaf",
+ expanded_field: "expanded",
+ loaded: "loaded"
+ },$t.p.treeReader );
+ }
+ for (var key in $t.p.colModel){
+ if($t.p.colModel.hasOwnProperty(key)) {
+ if($t.p.colModel[key].name == $t.p.ExpandColumn) {
+ $t.p.expColInd = i;
+ break;
+ }
+ i++;
+ }
+ }
+ if(!$t.p.expColInd) { $t.p.expColInd = 0; }
+ $.each($t.p.treeReader,function(i,n){
+ if(n){
+ $t.p.colNames.push(n);
+ $t.p.colModel.push({name:n,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false});
+ }
+ });
+ });
+ },
+ expandRow: function (record){
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ var childern = $($t).jqGrid("getNodeChildren",record),
+ //if ($($t).jqGrid("isVisibleNode",record)) {
+ expanded = $t.p.treeReader.expanded_field;
+ $(childern).each(function(i){
+ var id = $.jgrid.getAccessor(this,$t.p.localReader.id);
+ $("#"+id,$t.grid.bDiv).css("display","");
+ if(this[expanded]) {
+ $($t).jqGrid("expandRow",this);
+ }
+ });
+ //}
+ });
+ },
+ collapseRow : function (record) {
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ var childern = $($t).jqGrid("getNodeChildren",record),
+ expanded = $t.p.treeReader.expanded_field;
+ $(childern).each(function(i){
+ var id = $.jgrid.getAccessor(this,$t.p.localReader.id);
+ $("#"+id,$t.grid.bDiv).css("display","none");
+ if(this[expanded]){
+ $($t).jqGrid("collapseRow",this);
+ }
+ });
+ });
+ },
+ // NS ,adjacency models
+ getRootNodes : function() {
+ var result = [];
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ switch ($t.p.treeGridModel) {
+ case 'nested' :
+ var level = $t.p.treeReader.level_field;
+ $($t.p.data).each(function(i){
+ if(parseInt(this[level],10) === parseInt($t.p.tree_root_level,10)) {
+ result.push(this);
+ }
+ });
+ break;
+ case 'adjacency' :
+ var parent_id = $t.p.treeReader.parent_id_field;
+ $($t.p.data).each(function(i){
+ if(this[parent_id] === null || String(this[parent_id]).toLowerCase() == "null") {
+ result.push(this);
+ }
+ });
+ break;
+ }
+ });
+ return result;
+ },
+ getNodeDepth : function(rc) {
+ var ret = null;
+ this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ var $t = this;
+ switch ($t.p.treeGridModel) {
+ case 'nested' :
+ var level = $t.p.treeReader.level_field;
+ ret = parseInt(rc[level],10) - parseInt($t.p.tree_root_level,10);
+ break;
+ case 'adjacency' :
+ ret = $($t).jqGrid("getNodeAncestors",rc).length;
+ break;
+ }
+ });
+ return ret;
+ },
+ getNodeParent : function(rc) {
+ var result = null;
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ switch ($t.p.treeGridModel) {
+ case 'nested' :
+ var lftc = $t.p.treeReader.left_field,
+ rgtc = $t.p.treeReader.right_field,
+ levelc = $t.p.treeReader.level_field,
+ lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+ $(this.p.data).each(function(){
+ if(parseInt(this[levelc],10) === level-1 && parseInt(this[lftc],10) < lft && parseInt(this[rgtc],10) > rgt) {
+ result = this;
+ return false;
+ }
+ });
+ break;
+ case 'adjacency' :
+ var parent_id = $t.p.treeReader.parent_id_field,
+ dtid = $t.p.localReader.id;
+ $(this.p.data).each(function(i,val){
+ if(this[dtid] == rc[parent_id] ) {
+ result = this;
+ return false;
+ }
+ });
+ break;
+ }
+ });
+ return result;
+ },
+ getNodeChildren : function(rc) {
+ var result = [];
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ switch ($t.p.treeGridModel) {
+ case 'nested' :
+ var lftc = $t.p.treeReader.left_field,
+ rgtc = $t.p.treeReader.right_field,
+ levelc = $t.p.treeReader.level_field,
+ lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+ $(this.p.data).each(function(i){
+ if(parseInt(this[levelc],10) === level+1 && parseInt(this[lftc],10) > lft && parseInt(this[rgtc],10) < rgt) {
+ result.push(this);
+ }
+ });
+ break;
+ case 'adjacency' :
+ var parent_id = $t.p.treeReader.parent_id_field,
+ dtid = $t.p.localReader.id;
+ $(this.p.data).each(function(i,val){
+ if(this[parent_id] == rc[dtid]) {
+ result.push(this);
+ }
+ });
+ break;
+ }
+ });
+ return result;
+ },
+ getFullTreeNode : function(rc) {
+ var result = [];
+ this.each(function(){
+ var $t = this, len;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ switch ($t.p.treeGridModel) {
+ case 'nested' :
+ var lftc = $t.p.treeReader.left_field,
+ rgtc = $t.p.treeReader.right_field,
+ levelc = $t.p.treeReader.level_field,
+ lft = parseInt(rc[lftc],10), rgt = parseInt(rc[rgtc],10), level = parseInt(rc[levelc],10);
+ $(this.p.data).each(function(i){
+ if(parseInt(this[levelc],10) >= level && parseInt(this[lftc],10) >= lft && parseInt(this[lftc],10) <= rgt) {
+ result.push(this);
+ }
+ });
+ break;
+ case 'adjacency' :
+ result.push(rc);
+ var parent_id = $t.p.treeReader.parent_id_field,
+ dtid = $t.p.localReader.id;
+ $(this.p.data).each(function(i){
+ len = result.length;
+ for (i = 0; i < len; i++) {
+ if (result[i][dtid] == this[parent_id]) {
+ result.push(this);
+ break;
+ }
+ }
+ });
+ break;
+ }
+ });
+ return result;
+ },
+ // End NS, adjacency Model
+ getNodeAncestors : function(rc) {
+ var ancestors = [];
+ this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ var parent = $(this).jqGrid("getNodeParent",rc);
+ while (parent) {
+ ancestors.push(parent);
+ parent = $(this).jqGrid("getNodeParent",parent);
+ }
+ });
+ return ancestors;
+ },
+ isVisibleNode : function(rc) {
+ var result = true;
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ var ancestors = $($t).jqGrid("getNodeAncestors",rc),
+ expanded = $t.p.treeReader.expanded_field;
+ $(ancestors).each(function(){
+ result = result && this[expanded];
+ if(!result) {return false;}
+ });
+ });
+ return result;
+ },
+ isNodeLoaded : function(rc) {
+ var result;
+ this.each(function(){
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ var isLeaf = $t.p.treeReader.leaf_field;
+ if(rc.loaded !== undefined) {
+ result = rc.loaded;
+ } else if( rc[isLeaf] || $($t).jqGrid("getNodeChildren",rc).length > 0){
+ result = true;
+ } else {
+ result = false;
+ }
+ });
+ return result;
+ },
+ expandNode : function(rc) {
+ return this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ var expanded = this.p.treeReader.expanded_field;
+ if(!rc[expanded]) {
+ var id = $.jgrid.getAccessor(rc,this.p.localReader.id);
+ var rc1 = $("#"+id,this.grid.bDiv)[0];
+ var position = this.p._index[id];
+ if( $(this).jqGrid("isNodeLoaded",this.p.data[position]) ) {
+ rc[expanded] = true;
+ $("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
+ } else {
+ rc[expanded] = true;
+ $("div.treeclick",rc1).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");
+ this.p.treeANode = rc1.rowIndex;
+ this.p.datatype = this.p.treedatatype;
+ if(this.p.treeGridModel == 'nested') {
+ $(this).jqGrid("setGridParam",{postData:{nodeid:id,n_left:rc.lft,n_right:rc.rgt,n_level:rc.level}});
+ } else {
+ $(this).jqGrid("setGridParam",{postData:{nodeid:id,parentid:rc.parent_id,n_level:rc.level}});
+ }
+ $(this).trigger("reloadGrid");
+ if(this.p.treeGridModel == 'nested') {
+ $(this).jqGrid("setGridParam",{postData:{nodeid:'',n_left:'',n_right:'',n_level:''}});
+ } else {
+ $(this).jqGrid("setGridParam",{postData:{nodeid:'',parentid:'',n_level:''}});
+ }
+ }
+ }
+ });
+ },
+ collapseNode : function(rc) {
+ return this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ if(rc.expanded) {
+ rc.expanded = false;
+ var id = $.jgrid.getAccessor(rc,this.p.localReader.id);
+ var rc1 = $("#"+id,this.grid.bDiv)[0];
+ $("div.treeclick",rc1).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus");
+ }
+ });
+ },
+ SortTree : function( sortname, newDir, st, datefmt) {
+ return this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ var i, len,
+ rec, records = [], $t = this, query, roots,
+ rt = $(this).jqGrid("getRootNodes");
+ // Sorting roots
+ query = $.jgrid.from(rt);
+ query.orderBy(sortname,newDir,st, datefmt);
+ roots = query.select();
+
+ // Sorting children
+ for (i = 0, len = roots.length; i < len; i++) {
+ rec = roots[i];
+ records.push(rec);
+ $(this).jqGrid("collectChildrenSortTree",records, rec, sortname, newDir,st, datefmt);
+ }
+ $.each(records, function(index, row) {
+ var id = $.jgrid.getAccessor(this,$t.p.localReader.id);
+ $('#'+$t.p.id+ ' tbody tr:eq('+index+')').after($('tr#'+id,$t.grid.bDiv));
+ });
+ query = null; roots=null;records=null;
+ });
+ },
+ collectChildrenSortTree : function(records, rec, sortname, newDir,st, datefmt) {
+ return this.each(function(){
+ if(!this.grid || !this.p.treeGrid) { return; }
+ var i, len,
+ child, ch, query, children;
+ ch = $(this).jqGrid("getNodeChildren",rec);
+ query = $.jgrid.from(ch);
+ query.orderBy(sortname, newDir, st, datefmt);
+ children = query.select();
+ for (i = 0, len = children.length; i < len; i++) {
+ child = children[i];
+ records.push(child);
+ $(this).jqGrid("collectChildrenSortTree",records, child, sortname, newDir, st, datefmt);
+ }
+ });
+ },
+ // experimental
+ setTreeRow : function(rowid, data) {
+ var success=false;
+ this.each(function(){
+ var t = this;
+ if(!t.grid || !t.p.treeGrid) { return; }
+ success = $(t).jqGrid("setRowData",rowid,data);
+ });
+ return success;
+ },
+ delTreeNode : function (rowid) {
+ return this.each(function () {
+ var $t = this;
+ if(!$t.grid || !$t.p.treeGrid) { return; }
+ var rc = $($t).jqGrid("getInd",rowid,true);
+ if (rc) {
+ var dr = $($t).jqGrid("getNodeChildren",rc);
+ if(dr.length>0){
+ for (var i=0;i<dr.length;i++){
+ $($t).jqGrid("delRowData",dr[i].id);
+ }
+ }
+ $($t).jqGrid("delRowData",rc.id);
+ }
+ });
+ }
+});
+})(jQuery);
\ No newline at end of file
=== added directory 'addons/base/static/jquery.jqGrid/js/i18n'
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-ar.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-ar.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-ar.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,126 @@
+;(function($){
+/**
+ * jqGrid Arabic Translation
+ *
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "تسجÙÙ {0} - {1} عÙÙ {2}",
+ emptyrecords: "Ùا ÙÙجد تسجÙÙ",
+ loadtext: "تØÙ
ÙÙ...",
+ pgtext : "صÙØØ© {0} عÙÙ {1}"
+ },
+ search : {
+ caption: "بØØ«...",
+ Find: "بØØ«",
+ Reset: "Ø¥Ùغاء",
+ odata : ['ÙساÙÙ', 'ÙختÙÙ', 'Ø£ÙÙ', 'Ø£Ù٠أ٠ÙساÙÙ','Ø£Ùبر','Ø£Ùبر Ø£Ù ÙساÙÙ', 'Ùبدأ بÙ','Ùا Ùبدأ بÙ','est dans',"n'est pas dans",'ÙÙت٠بÙ','Ùا ÙÙت٠بÙ','ÙØتÙÙ','Ùا ÙØتÙÙ'],
+ groupOps: [ { op: "Ù
ع", text: "اÙÙÙ" }, { op: "Ø£Ù", text: "Ùا Ø£Øد" } ],
+ matchText: " تÙاÙÙ",
+ rulesText: " ÙÙاعد"
+ },
+ edit : {
+ addCaption: "اضاÙØ©",
+ editCaption: "تØدÙØ«",
+ bSubmit: "تثبÙØ«",
+ bCancel: "Ø¥Ùغاء",
+ bClose: "غÙÙ",
+ saveData: "تغÙرت اÙÙ
عطÙات Ù٠ترÙد اÙتسجÙÙ ?",
+ bYes: "ÙعÙ
",
+ bNo: "Ùا",
+ bExit: "Ø¥Ùغاء",
+ msg: {
+ required: "خاÙØ© إجبارÙØ©",
+ number: "سج٠رÙÙ
صØÙØ",
+ minValue: "Ùجب أ٠تÙÙ٠اÙÙÙÙ
Ø© Ø£Ùبر أ٠تساÙÙ 0",
+ maxValue: "Ùجب أ٠تÙÙ٠اÙÙÙÙ
Ø© Ø£Ù٠أ٠تساÙÙ 0",
+ email: "برÙد غÙر صØÙØ",
+ integer: "سج٠عدد طبÙÙع٠صØÙØ",
+ url: "ÙÙس عÙÙاÙا صØÙØا. اÙبداÙØ© اÙصØÙØØ© ('http://' Ø£Ù 'https://')",
+ nodefined : " ÙÙس Ù
Øدد!",
+ novalue : " ÙÙÙ
Ø© اÙرجÙع Ù
Ø·ÙÙبة!",
+ customarray : "Ùجب عÙ٠اÙداÙØ© اÙشخصÙØ© أ٠تÙتج جدÙÙا",
+ customfcheck : "اÙداÙØ© اÙشخصÙØ© Ù
Ø·ÙÙبة ÙÙ ØاÙØ© اÙتØÙ٠اÙشخصÙ"
+ }
+ },
+ view : {
+ caption: "رأÙت اÙتسجÙÙات",
+ bClose: "غÙÙ"
+ },
+ del : {
+ caption: "ØØ°Ù",
+ msg: "Øذ٠اÙتسجÙÙات اÙÙ
ختارة ?",
+ bSubmit: "ØØ°Ù",
+ bCancel: "Ø¥Ùغاء"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "تغÙÙر اÙتسجÙ٠اÙÙ
ختار",
+ addtext:" ",
+ addtitle: "إضاÙØ© تسجÙÙ",
+ deltext: " ",
+ deltitle: "Øذ٠اÙتسجÙ٠اÙÙ
ختار",
+ searchtext: " ",
+ searchtitle: "بØØ« ع٠تسجÙÙ",
+ refreshtext: "",
+ refreshtitle: "تØدÙØ« اÙجدÙÙ",
+ alertcap: "تØØ°Ùر",
+ alerttext: "Ùرج٠إختÙار اÙسطر",
+ viewtext: "",
+ viewtitle: "إظÙار اÙسطر اÙÙ
ختار"
+ },
+ col : {
+ caption: "إظÙار/إخÙاء اÙأعÙ
دة",
+ bSubmit: "تثبÙØ«",
+ bCancel: "Ø¥Ùغاء"
+ },
+ errors : {
+ errcap : "خطأ",
+ nourl : "Ùا ÙÙجد عÙÙا٠Ù
Øدد",
+ norecords: "Ùا ÙÙجد تسجÙÙ ÙÙÙ
عاÙجة",
+ model : "عدد اÙعÙاÙÙÙ (colNames) <> عدد اÙتسجÙÙات (colModel)!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+ currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+ date : {
+ dayNames: [
+ "اÙØ£Øد", "اÙإثÙÙÙ", "اÙØ«Ùاثاء", "اÙأربعاء", "اÙØ®Ù
Ùس", "اÙجÙ
عة", "اÙسبت",
+ "اÙØ£Øد", "اÙإثÙÙÙ", "اÙØ«Ùاثاء", "اÙأربعاء", "اÙØ®Ù
Ùس", "اÙجÙ
عة", "اÙسبت"
+ ],
+ monthNames: [
+ "جاÙÙÙ", "ÙÙÙرÙ", "Ù
ارس", "Ø£ÙرÙÙ", "Ù
اÙ", "جÙاÙ", "جÙÙÙÙØ©", "Ø£Ùت", "سبتÙ
بر", "Ø£ÙتÙبر", "ÙÙÙÙ
بر", "دÙسÙ
بر",
+ "جاÙÙÙ", "ÙÙÙرÙ", "Ù
ارس", "Ø£ÙرÙÙ", "Ù
اÙ", "جÙاÙ", "جÙÙÙÙØ©", "Ø£Ùت", "سبتÙ
بر", "Ø£ÙتÙبر", "ÙÙÙÙ
بر", "دÙسÙ
بر"
+ ],
+ AmPm : ["صباØا","Ù
ساءا","صباØا","Ù
ساءا"],
+ S: function (j) {return j == 1 ? 'er' : 'e';},
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,132 @@
+;(function($){
+/**
+ * jqGrid Bulgarian Translation
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "{0} - {1} Ð¾Ñ {2}",
+ emptyrecords: "ÐÑма запиÑ(и)",
+ loadtext: "ÐаÑеждам...",
+ pgtext : "СÑÑ. {0} Ð¾Ñ {1}"
+ },
+ search : {
+ caption: "ТÑÑÑене...",
+ Find: "ÐамеÑи",
+ Reset: "ÐзÑиÑÑи",
+ odata : ['Ñавно', 'ÑазлиÑно', 'по-малко', 'по-малко или=','по-голÑмо','по-голÑмо или =', 'запоÑва Ñ','не запоÑва Ñ','Ñе намиÑа в','не Ñе намиÑа в','завÑÑÑва Ñ','не завÑÑÑава Ñ','ÑÑдÑÑжа', 'не ÑÑдÑÑжа' ],
+ groupOps: [ { op: "AND", text: " Ð " }, { op: "OR", text: "ÐÐÐ" } ],
+ matchText: " вклÑÑи",
+ rulesText: " клаÑза"
+ },
+ edit : {
+ addCaption: "Ðов ÐапиÑ",
+ editCaption: "РедакÑÐ¸Ñ ÐапиÑ",
+ bSubmit: "ÐапиÑи",
+ bCancel: "ÐзÑ
од",
+ bClose: "ÐаÑвоÑи",
+ saveData: "ÐанниÑе Ñа пÑоменени! Ðа ÑÑÑ
ÑÐ°Ð½Ñ Ð»Ð¸ пÑомениÑе?",
+ bYes : "Ðа",
+ bNo : "Ðе",
+ bExit : "ÐÑказ",
+ msg: {
+ required:"ÐолеÑо е задÑлжиÑелно",
+ number:"ÐÑведеÑе валидно ÑиÑло!",
+ minValue:"ÑÑойноÑÑÑа ÑÑÑбва да е по-голÑма или Ñавна оÑ",
+ maxValue:"ÑÑойноÑÑÑа ÑÑÑбва да е по-малка или Ñавна оÑ",
+ email: "не е валиден ел. адÑеÑ",
+ integer: "ÐÑведеÑе валидно ÑÑло ÑиÑло",
+ date: "ÐÑведеÑе валидна даÑа",
+ url: "e невалиден URL. ÐзиÑкава Ñе пÑеÑикÑ('http://' или 'https://')",
+ nodefined : " е недеÑиниÑана!",
+ novalue : " изиÑква вÑÑÑане на ÑÑойноÑÑ!",
+ customarray : "ÐоÑÑеб. ФÑнкÑÐ¸Ñ ÑÑÑбва да вÑÑне маÑив!",
+ customfcheck : "ÐоÑÑебиÑелÑка ÑÑнкÑÐ¸Ñ Ðµ задÑлжиÑелна пÑи Ñози Ñип елеменÑ!"
+ }
+ },
+ view : {
+ caption: "ÐÑеглед запиÑ",
+ bClose: "ÐаÑвоÑи"
+ },
+ del : {
+ caption: "ÐзÑÑиване",
+ msg: "Ðа изÑÑÐ¸Ñ Ð»Ð¸ избÑаниÑÑ Ð·Ð°Ð¿Ð¸Ñ?",
+ bSubmit: "ÐзÑÑий",
+ bCancel: "ÐÑказ"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "РедакÑÐ¸Ñ Ð¸Ð·Ð±Ñан запиÑ",
+ addtext:" ",
+ addtitle: "ÐобавÑне нов запиÑ",
+ deltext: " ",
+ deltitle: "ÐзÑÑиване избÑан запиÑ",
+ searchtext: " ",
+ searchtitle: "ТÑÑÑене запиÑ(и)",
+ refreshtext: "",
+ refreshtitle: "Ðбнови ÑаблиÑа",
+ alertcap: "ÐÑедÑпÑеждение",
+ alerttext: "ÐолÑ, избеÑеÑе запиÑ",
+ viewtext: "",
+ viewtitle: "ÐÑеглед избÑан запиÑ"
+ },
+ col : {
+ caption: "ÐзбеÑи колони",
+ bSubmit: "Ðк",
+ bCancel: "ÐзÑ
од"
+ },
+ errors : {
+ errcap : "ÐÑеÑка",
+ nourl : "ÐÑма поÑоÑен url адÑеÑ",
+ norecords: "ÐÑма Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° обÑабоÑка",
+ model : "Ðодела не ÑÑоÑвеÑÑÑва на именаÑа!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" лв.", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "Ðед", "Ðон", "ÐÑ", "СÑ", "ЧеÑ", "ÐеÑ", "СÑб",
+ "ÐеделÑ", "Ðонеделник", "ÐÑоÑник", "СÑÑда", "ЧеÑвÑÑÑÑк", "ÐеÑÑк", "СÑбоÑа"
+ ],
+ monthNames: [
+ "ЯнÑ", "Фев", "ÐаÑ", "ÐпÑ", "Ðай", "Юни", "Юли", "Ðвг", "Сеп", "ÐкÑ", "Ðов", "Ðек",
+ "ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи"
+ ],
+ AmPm : ["","","",""],
+ S: function (j) {
+ if(j==7 || j==8 || j== 27 || j== 28) {
+ return 'ми';
+ }
+ return ['ви', 'Ñи', 'Ñи'][Math.min((j - 1) % 10, 2)];
+ },
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg1251.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg1251.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-bg1251.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,132 @@
+;(function($){
+/**
+ * jqGrid Bulgarian Translation
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "{0} - {1} îò {2}",
+ emptyrecords: "Íÿìà çàïèñ(è)",
+ loadtext: "Çàðåæäàì...",
+ pgtext : "Ñòð. {0} îò {1}"
+ },
+ search : {
+ caption: "Òúðñåíå...",
+ Find: "Íàìåðè",
+ Reset: "Èç÷èñòè",
+ odata : ['ðàâíî', 'ðàçëè÷íî', 'ïî-ìàëêî', 'ïî-ìàëêî èëè=','ïî-ãîëÿìî','ïî-ãîëÿìî èëè =', 'çàïî÷âà ñ','íå çàïî÷âà ñ','ñå íàìèðà â','íå ñå íàìèðà â','çàâúðøâà ñ','íå çàâúðøàâà ñ','ñúäúðæà', 'íå ñúäúðæà' ],
+ groupOps: [ { op: "AND", text: " È " }, { op: "OR", text: "ÈËÈ" } ],
+ matchText: " âêëþ÷è",
+ rulesText: " êëàóçà"
+ },
+ edit : {
+ addCaption: "Íîâ Çàïèñ",
+ editCaption: "Ðåäàêöèÿ Çàïèñ",
+ bSubmit: "Çàïèøè",
+ bCancel: "Èçõîä",
+ bClose: "Çàòâîðè",
+ saveData: "Äàííèòå ñà ïðîìåíåíè! Äà ñúõðàíÿ ëè ïðîìåíèòå?",
+ bYes : "Äà",
+ bNo : "Íå",
+ bExit : "Îòêàç",
+ msg: {
+ required:"Ïîëåòî å çàäúëæèòåëíî",
+ number:"Âúâåäåòå âàëèäíî ÷èñëî!",
+ minValue:"ñòîéíîñòòà òðÿáâà äà å ïî-ãîëÿìà èëè ðàâíà îò",
+ maxValue:"ñòîéíîñòòà òðÿáâà äà å ïî-ìàëêà èëè ðàâíà îò",
+ email: "íå å âàëèäåí åë. àäðåñ",
+ integer: "Âúâåäåòå âàëèäíî öÿëî ÷èñëî",
+ date: "Âúâåäåòå âàëèäíà äàòà",
+ url: "e íåâàëèäåí URL. Èçèñêàâà ñå ïðåôèêñ('http://' èëè 'https://')",
+ nodefined : " å íåäåôèíèðàíà!",
+ novalue : " èçèñêâà âðúùàíå íà ñòîéíîñò!",
+ customarray : "Ïîòðåá. Ôóíêöèÿ òðÿáâà äà âúðíå ìàñèâ!",
+ customfcheck : "Ïîòðåáèòåëñêà ôóíêöèÿ å çàäúëæèòåëíà ïðè òîçè òèï åëåìåíò!"
+ }
+ },
+ view : {
+ caption: "Ïðåãëåä çàïèñ",
+ bClose: "Çàòâîðè"
+ },
+ del : {
+ caption: "Èçòðèâàíå",
+ msg: "Äà èçòðèÿ ëè èçáðàíèÿò çàïèñ?",
+ bSubmit: "Èçòðèé",
+ bCancel: "Îòêàç"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Ðåäàêöèÿ èçáðàí çàïèñ",
+ addtext:" ",
+ addtitle: "Äîáàâÿíå íîâ çàïèñ",
+ deltext: " ",
+ deltitle: "Èçòðèâàíå èçáðàí çàïèñ",
+ searchtext: " ",
+ searchtitle: "Òúðñåíå çàïèñ(è)",
+ refreshtext: "",
+ refreshtitle: "Îáíîâè òàáëèöà",
+ alertcap: "Ïðåäóïðåæäåíèå",
+ alerttext: "Ìîëÿ, èçáåðåòå çàïèñ",
+ viewtext: "",
+ viewtitle: "Ïðåãëåä èçáðàí çàïèñ"
+ },
+ col : {
+ caption: "Èçáîð êîëîíè",
+ bSubmit: "Îê",
+ bCancel: "Èçõîä"
+ },
+ errors : {
+ errcap : "Ãðåøêà",
+ nourl : "Íÿìà ïîñî÷åí url àäðåñ",
+ norecords: "Íÿìà çàïèñ çà îáðàáîòêà",
+ model : "Ìîäåëà íå ñúîòâåòñòâà íà èìåíàòà!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:" ëâ.", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "Íåä", "Ïîí", "Âò", "Ñð", "×åò", "Ïåò", "Ñúá",
+ "Íåäåëÿ", "Ïîíåäåëíèê", "Âòîðíèê", "Ñðÿäà", "×åòâúðòúê", "Ïåòúê", "Ñúáîòà"
+ ],
+ monthNames: [
+ "ßíó", "Ôåâ", "Ìàð", "Àïð", "Ìàé", "Þíè", "Þëè", "Àâã", "Ñåï", "Îêò", "Íîâ", "Äåê",
+ "ßíóàðè", "Ôåâðóàðè", "Ìàðò", "Àïðèë", "Ìàé", "Þíè", "Þëè", "Àâãóñò", "Ñåïòåìâðè", "Îêòîìâðè", "Íîåìâðè", "Äåêåìâðè"
+ ],
+ AmPm : ["","","",""],
+ S: function (j) {
+ if(j==7 || j==8 || j== 27 || j== 28) {
+ return 'ìè';
+ }
+ return ['âè', 'ðè', 'òè'][Math.min((j - 1) % 10, 2)];
+ },
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cat.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cat.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cat.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Catalan Translation
+ * Traducció jqGrid en Catatà per Faserline, S.L.
+ * http://www.faserline.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "Mostrant {0} - {1} de {2}",
+ emptyrecords: "Sense registres que mostrar",
+ loadtext: "Carregant...",
+ pgtext : "PÃ gina {0} de {1}"
+ },
+ search : {
+ caption: "Cerca...",
+ Find: "Cercar",
+ Reset: "Buidar",
+ odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+ groupOps: [ { op: "AND", text: "tot" }, { op: "OR", text: "qualsevol" } ],
+ matchText: " match",
+ rulesText: " rules"
+ },
+ edit : {
+ addCaption: "Afegir registre",
+ editCaption: "Modificar registre",
+ bSubmit: "Guardar",
+ bCancel: "Cancelar",
+ bClose: "Tancar",
+ saveData: "Les dades han canviat. Guardar canvis?",
+ bYes : "Yes",
+ bNo : "No",
+ bExit : "Cancel",
+ msg: {
+ required:"Camp obligatori",
+ number:"Introdueixi un nombre",
+ minValue:"El valor ha de ser major o igual que ",
+ maxValue:"El valor ha de ser menor o igual a ",
+ email: "no és una direcció de correu và lida",
+ integer: "Introdueixi un valor enter",
+ date: "Introdueixi una data correcta ",
+ url: "no és una URL và lida. Prefix requerit ('http://' or 'https://')",
+ nodefined : " is not defined!",
+ novalue : " return value is required!",
+ customarray : "Custom function should return array!",
+ customfcheck : "Custom function should be present in case of custom checking!"
+ }
+ },
+ view : {
+ caption: "Veure registre",
+ bClose: "Tancar"
+ },
+ del : {
+ caption: "Eliminar",
+ msg: "¿Desitja eliminar els registres seleccionats?",
+ bSubmit: "Eliminar",
+ bCancel: "Cancelar"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Modificar fila seleccionada",
+ addtext:" ",
+ addtitle: "Agregar nova fila",
+ deltext: " ",
+ deltitle: "Eliminar fila seleccionada",
+ searchtext: " ",
+ searchtitle: "Cercar informació",
+ refreshtext: "",
+ refreshtitle: "Refrescar taula",
+ alertcap: "AvÃs",
+ alerttext: "Seleccioni una fila",
+ viewtext: " ",
+ viewtitle: "Veure fila seleccionada"
+ },
+// setcolumns module
+ col : {
+ caption: "Mostrar/ocultar columnes",
+ bSubmit: "Enviar",
+ bCancel: "Cancelar"
+ },
+ errors : {
+ errcap : "Error",
+ nourl : "No s'ha especificat una URL",
+ norecords: "No hi ha dades per processar",
+ model : "Les columnes de noms són diferents de les columnes del model"
+ },
+ formatter : {
+ integer : {thousandsSeparator: ".", defaultValue: '0'},
+ number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+ currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+ date : {
+ dayNames: [
+ "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
+ "Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"
+ ],
+ monthNames: [
+ "Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des",
+ "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
+ ],
+ AmPm : ["am","pm","AM","PM"],
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+ srcformat: 'Y-m-d',
+ newformat: 'd-m-Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: 'show',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cn.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cn.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cn.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,132 @@
+;(function($){
+/**
+ * jqGrid Chinese Translation for v3.6
+ * waiting 2010.01.18
+ * http://waiting.javaeye.com/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * update 2010.05.04
+ * add double u3000 SPACE for search:odata to fix SEARCH box display err when narrow width from only use of eq/ne/cn/in/lt/gt operator under IE6/7
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "{0} - {1}\u3000å
± {2} æ¡", // å
±ååæ¯å
¨è§ç©ºæ ¼
+ emptyrecords: "æ æ°æ®æ¾ç¤º",
+ loadtext: "读åä¸...",
+ pgtext : " {0} å
± {1} 页"
+ },
+ search : {
+ caption: "æç´¢...",
+ Find: "æ¥æ¾",
+ Reset: "éç½®",
+ odata : ['çäº\u3000\u3000', 'ä¸ç\u3000\u3000', 'å°äº\u3000\u3000', 'å°äºçäº','大äº\u3000\u3000','大äºçäº',
+ 'å¼å§äº','ä¸å¼å§äº','å±äº\u3000\u3000','ä¸å±äº','ç»æäº','ä¸ç»æäº','å
å«\u3000\u3000','ä¸å
å«'],
+ groupOps: [ { op: "AND", text: "ææ" }, { op: "OR", text: "ä»»ä¸" } ],
+ matchText: " å¹é
",
+ rulesText: " è§å"
+ },
+ edit : {
+ addCaption: "æ·»å è®°å½",
+ editCaption: "ç¼è¾è®°å½",
+ bSubmit: "æ交",
+ bCancel: "åæ¶",
+ bClose: "å
³é",
+ saveData: "æ°æ®å·²æ¹åï¼æ¯å¦ä¿åï¼",
+ bYes : "æ¯",
+ bNo : "å¦",
+ bExit : "åæ¶",
+ msg: {
+ required:"æ¤å段å¿
é",
+ number:"请è¾å
¥æææ°å",
+ minValue:"è¾å¼å¿
须大äºçäº ",
+ maxValue:"è¾å¼å¿
é¡»å°äºçäº ",
+ email: "è¿ä¸æ¯ææçe-mailå°å",
+ integer: "请è¾å
¥æææ´æ°",
+ date: "请è¾å
¥æææ¶é´",
+ url: "æ æç½åãåç¼å¿
须为 ('http://' æ 'https://')",
+ nodefined : " æªå®ä¹ï¼",
+ novalue : " éè¦è¿åå¼ï¼",
+ customarray : "èªå®ä¹å½æ°éè¦è¿åæ°ç»ï¼",
+ customfcheck : "Custom function should be present in case of custom checking!"
+
+ }
+ },
+ view : {
+ caption: "æ¥çè®°å½",
+ bClose: "å
³é"
+ },
+ del : {
+ caption: "å é¤",
+ msg: "å é¤æéè®°å½ï¼",
+ bSubmit: "å é¤",
+ bCancel: "åæ¶"
+ },
+ nav : {
+ edittext: "",
+ edittitle: "ç¼è¾æéè®°å½",
+ addtext:"",
+ addtitle: "æ·»å æ°è®°å½",
+ deltext: "",
+ deltitle: "å é¤æéè®°å½",
+ searchtext: "",
+ searchtitle: "æ¥æ¾",
+ refreshtext: "",
+ refreshtitle: "å·æ°è¡¨æ ¼",
+ alertcap: "注æ",
+ alerttext: "请éæ©è®°å½",
+ viewtext: "",
+ viewtitle: "æ¥çæéè®°å½"
+ },
+ col : {
+ caption: "éæ©å",
+ bSubmit: "ç¡®å®",
+ bCancel: "åæ¶"
+ },
+ errors : {
+ errcap : "é误",
+ nourl : "没æ设置url",
+ norecords: "没æè¦å¤ççè®°å½",
+ model : "colNames å colModel é¿åº¦ä¸çï¼"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+ ],
+ monthNames: [
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ ],
+ AmPm : ["am","pm","AM","PM"],
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+ srcformat: 'Y-m-d',
+ newformat: 'm-d-Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "Y/j/n",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cs.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cs.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-cs.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Czech Translation
+ * Pavel Jirak pavel.jirak@xxxxxxxx
+ * doplnil Thomas Wagner xwagne01@xxxxxxxxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "Zobrazeno {0} - {1} z {2} záznamů",
+ emptyrecords: "Nenalezeny žádné záznamy",
+ loadtext: "NaÄÃtám...",
+ pgtext : "Strana {0} z {1}"
+ },
+ search : {
+ caption: "Vyhledávám...",
+ Find: "Hledat",
+ Reset: "Reset",
+ odata : ['rovno', 'nerovono', 'menÅ¡Ã', 'menÅ¡Ã nebo rovno','vÄtÅ¡Ã', 'vÄtÅ¡Ã nebo rovno', 'zaÄÃná s', 'nezaÄÃná s', 'je v', 'nenà v', 'konÄà s', 'nekonÄà s', 'obahuje', 'neobsahuje'],
+ groupOps: [ { op: "AND", text: "vÅ¡ech" }, { op: "OR", text: "nÄkterého z" } ],
+ matchText: " hledat podle",
+ rulesText: " pravidel"
+ },
+ edit : {
+ addCaption: "PÅidat záznam",
+ editCaption: "Editace záznamu",
+ bSubmit: "Uložit",
+ bCancel: "Storno",
+ bClose: "ZavÅÃt",
+ saveData: "Data byla zmÄnÄna! Uložit zmÄny?",
+ bYes : "Ano",
+ bNo : "Ne",
+ bExit : "Zrušit",
+ msg: {
+ required:"Pole je vyžadováno",
+ number:"ProsÃm, vložte validnà ÄÃslo",
+ minValue:"hodnota musà být vÄtÅ¡Ã než nebo rovná ",
+ maxValue:"hodnota musà být menšà než nebo rovná ",
+ email: "nenà validnà e-mail",
+ integer: "ProsÃm, vložte celé ÄÃslo",
+ date: "ProsÃm, vložte validnà datum",
+ url: "nenà platnou URL. Vyžadován prefix ('http://' or 'https://')",
+ nodefined : " nenà definován!",
+ novalue : " je vyžadována návratová hodnota!",
+ customarray : "Custom function mÄlá vrátit pole!",
+ customfcheck : "Custom function by mÄla být pÅÃtomna v pÅÃpadÄ custom checking!"
+ }
+ },
+ view : {
+ caption: "Zobrazit záznam",
+ bClose: "ZavÅÃt"
+ },
+ del : {
+ caption: "Smazat",
+ msg: "Smazat vybraný(é) záznam(y)?",
+ bSubmit: "Smazat",
+ bCancel: "Storno"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Editovat vybraný Åádek",
+ addtext:" ",
+ addtitle: "PÅidat nový Åádek",
+ deltext: " ",
+ deltitle: "Smazat vybraný záznam ",
+ searchtext: " ",
+ searchtitle: "NajÃt záznamy",
+ refreshtext: "",
+ refreshtitle: "Obnovit tabulku",
+ alertcap: "VarovánÃ",
+ alerttext: "ProsÃm, vyberte Åádek",
+ viewtext: "",
+ viewtitle: "Zobrazit vybraný Åádek"
+ },
+ col : {
+ caption: "Zobrazit/Skrýt sloupce",
+ bSubmit: "Uložit",
+ bCancel: "Storno"
+ },
+ errors : {
+ errcap : "Chyba",
+ nourl : "Nenà nastavena url",
+ norecords: "Žádné záznamy ke zpracovánÃ",
+ model : "Délka colNames <> colModel!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "Ne", "Po", "Ãt", "St", "Ät", "Pá", "So",
+ "NedÄle", "PondÄlÃ", "Ãterý", "StÅeda", "Ätvrtek", "Pátek", "Sobota"
+ ],
+ monthNames: [
+ "Led", "Ãno", "BÅe", "Dub", "KvÄ", "Äer", "Ävc", "Srp", "ZáÅ", "ÅÃj", "Lis", "Pro",
+ "Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec"
+ ],
+ AmPm : ["do","od","DO","OD"],
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-da.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-da.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-da.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Danish Translation
+ * Aesiras A/S
+ * http://www.aesiras.dk
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "Vis {0} - {1} of {2}",
+ emptyrecords: "Ingen linjer fundet",
+ loadtext: "Henter...",
+ pgtext : "Side {0} af {1}"
+ },
+ search : {
+ caption: "Søg...",
+ Find: "Find",
+ Reset: "Nulstil",
+ odata : ['lig', 'forskellige fra', 'mindre', 'mindre eller lig','større','større eller lig', 'begynder med','begynder ikke med','findes i','findes ikke i','ender med','ender ikke med','indeholder','indeholder ikke'],
+ groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
+ matchText: " lig",
+ rulesText: " regler"
+ },
+ edit : {
+ addCaption: "Tilføj",
+ editCaption: "Ret",
+ bSubmit: "Send",
+ bCancel: "Annuller",
+ bClose: "Luk",
+ saveData: "Data er ændret. Gem data?",
+ bYes : "Ja",
+ bNo : "Nej",
+ bExit : "Fortryd",
+ msg: {
+ required:"Felt er nødvendigt",
+ number:"Indtast venligst et validt tal",
+ minValue:"værdi skal være større end eller lig med",
+ maxValue:"værdi skal være mindre end eller lig med",
+ email: "er ikke en gyldig email",
+ integer: "Indtast venligst et gyldigt heltal",
+ date: "Indtast venligst en gyldig datoværdi",
+ url: "er ugyldig URL. Prefix mangler ('http://' or 'https://')",
+ nodefined : " er ikke defineret!",
+ novalue : " returværdi kræves!",
+ customarray : "Custom function should return array!",
+ customfcheck : "Custom function should be present in case of custom checking!"
+ }
+ },
+ view : {
+ caption: "Vis linje",
+ bClose: "Luk"
+ },
+ del : {
+ caption: "Slet",
+ msg: "Slet valgte linje(r)?",
+ bSubmit: "Slet",
+ bCancel: "Fortryd"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Rediger valgte linje",
+ addtext:" ",
+ addtitle: "Tilføj ny linje",
+ deltext: " ",
+ deltitle: "Slet valgte linje",
+ searchtext: " ",
+ searchtitle: "Find linjer",
+ refreshtext: "",
+ refreshtitle: "Indlæs igen",
+ alertcap: "Advarsel",
+ alerttext: "Vælg venligst linje",
+ viewtext: "",
+ viewtitle: "Vis valgte linje"
+ },
+ col : {
+ caption: "Vis/skjul kolonner",
+ bSubmit: "Opdatere",
+ bCancel: "Fortryd"
+ },
+ errors : {
+ errcap : "Fejl",
+ nourl : "Ingen url valgt",
+ norecords: "Ingen linjer at behandle",
+ model : "colNames og colModel har ikke samme længde!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
+ currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+ date : {
+ dayNames: [
+ "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør",
+ "Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"
+ ],
+ monthNames: [
+ "Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
+ "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
+ ],
+ AmPm : ["","","",""],
+ S: function (j) {return '.'},
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "j/n/Y",
+ LongDate: "l d. F Y",
+ FullDateTime: "l d F Y G:i:s",
+ MonthDay: "d. F",
+ ShortTime: "G:i",
+ LongTime: "G:i:s",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+// DA
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-de.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-de.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-de.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,133 @@
+;(function($){
+/**
+ * jqGrid German Translation
+ * Version 1.0.0 (developed for jQuery Grid 3.3.1)
+ * Olaf Klöppel opensource@xxxxxxxxxxx
+ * http://blue-hit.de/
+ *
+ * Updated for jqGrid 3.8
+ * Andreas Flack
+ * http://www.contentcontrol-berlin.de
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "Zeige {0} - {1} von {2}",
+ emptyrecords: "Keine Datensätze vorhanden",
+ loadtext: "Lädt...",
+ pgtext : "Seite {0} von {1}"
+ },
+ search : {
+ caption: "Suche...",
+ Find: "Suchen",
+ Reset: "Zurücksetzen",
+ odata : ['gleich', 'ungleich', 'kleiner', 'kleiner gleich','gröÃer','gröÃer gleich', 'beginnt mit','beginnt nicht mit','ist in','ist nicht in','endet mit','endet nicht mit','enthält','enthält nicht'],
+ groupOps: [ { op: "AND", text: "alle" }, { op: "OR", text: "mindestens eine" } ],
+ matchText: " erfülle",
+ rulesText: " Bedingung(en)"
+ },
+ edit : {
+ addCaption: "Datensatz hinzufügen",
+ editCaption: "Datensatz bearbeiten",
+ bSubmit: "Speichern",
+ bCancel: "Abbrechen",
+ bClose: "SchlieÃen",
+ saveData: "Daten wurden geändert! Ãnderungen speichern?",
+ bYes : "ja",
+ bNo : "nein",
+ bExit : "abbrechen",
+ msg: {
+ required:"Feld ist erforderlich",
+ number: "Bitte geben Sie eine Zahl ein",
+ minValue:"Wert muss gröÃer oder gleich sein, als ",
+ maxValue:"Wert muss kleiner oder gleich sein, als ",
+ email: "ist keine gültige E-Mail-Adresse",
+ integer: "Bitte geben Sie eine Ganzzahl ein",
+ date: "Bitte geben Sie ein gültiges Datum ein",
+ url: "ist keine gültige URL. Präfix muss eingegeben werden ('http://' oder 'https://')",
+ nodefined : " ist nicht definiert!",
+ novalue : " Rückgabewert ist erforderlich!",
+ customarray : "Benutzerdefinierte Funktion sollte ein Array zurückgeben!",
+ customfcheck : "Benutzerdefinierte Funktion sollte im Falle der benutzerdefinierten Ãberprüfung vorhanden sein!"
+ }
+ },
+ view : {
+ caption: "Datensatz anzeigen",
+ bClose: "SchlieÃen"
+ },
+ del : {
+ caption: "Löschen",
+ msg: "Ausgewählte Datensätze löschen?",
+ bSubmit: "Löschen",
+ bCancel: "Abbrechen"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Ausgewählte Zeile editieren",
+ addtext:" ",
+ addtitle: "Neue Zeile einfügen",
+ deltext: " ",
+ deltitle: "Ausgewählte Zeile löschen",
+ searchtext: " ",
+ searchtitle: "Datensatz suchen",
+ refreshtext: "",
+ refreshtitle: "Tabelle neu laden",
+ alertcap: "Warnung",
+ alerttext: "Bitte Zeile auswählen",
+ viewtext: "",
+ viewtitle: "Ausgewählte Zeile anzeigen"
+ },
+ col : {
+ caption: "Spalten auswählen",
+ bSubmit: "Speichern",
+ bCancel: "Abbrechen"
+ },
+ errors : {
+ errcap : "Fehler",
+ nourl : "Keine URL angegeben",
+ norecords: "Keine Datensätze zu bearbeiten",
+ model : "colNames und colModel sind unterschiedlich lang!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: ".", defaultValue: '0'},
+ number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+ currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" â¬", defaultValue: '0,00'},
+ date : {
+ dayNames: [
+ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa",
+ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"
+ ],
+ monthNames: [
+ "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez",
+ "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"
+ ],
+ AmPm : ["am","pm","AM","PM"],
+ S: function (j) {return 'ter'},
+ srcformat: 'Y-m-d',
+ newformat: 'd.m.Y',
+ masks : {
+ ISO8601Long: "Y-m-d H:i:s",
+ ISO8601Short: "Y-m-d",
+ ShortDate: "j.n.Y",
+ LongDate: "l, j. F Y",
+ FullDateTime: "l, d. F Y G:i:s",
+ MonthDay: "d. F",
+ ShortTime: "G:i",
+ LongTime: "G:i:s",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
\ No newline at end of file
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-el.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-el.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-el.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,126 @@
+;(function($){
+/**
+ * jqGrid Greek (el) Translation
+ * Alex Cicovic
+ * http://www.alexcicovic.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "View {0} - {1} of {2}",
+ emptyrecords: "No records to view",
+ loadtext: "ΦÏÏÏÏÏη...",
+ pgtext : "Page {0} of {1}"
+ },
+ search : {
+ caption: "ÎναζήÏηÏη...",
+ Find: "ÎÏÏεÏη",
+ Reset: "ÎÏαναÏοÏά",
+ odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+ groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
+ matchText: " match",
+ rulesText: " rules"
+ },
+ edit : {
+ addCaption: "ÎιÏαγÏγή ÎγγÏαÏήÏ",
+ editCaption: "ÎÏεξεÏγαÏία ÎγγÏαÏήÏ",
+ bSubmit: "ÎαÏαÏÏÏηÏη",
+ bCancel: "ÎκÏ
Ïο",
+ bClose: "ÎλείÏιμο",
+ saveData: "Data has been changed! Save changes?",
+ bYes : "Yes",
+ bNo : "No",
+ bExit : "Cancel",
+ msg: {
+ required:"Το Ïεδίο είναι αÏαÏαίÏηÏο",
+ number:"Το Ïεδίο δÎÏεÏαι μÏνο αÏιθμοÏÏ",
+ minValue:"Î Ïιμή ÏÏÎÏει να είναι μεγαλÏÏεÏη ή ίÏη ÏοÏ
",
+ maxValue:"Î Ïιμή ÏÏÎÏει να είναι μικÏÏÏεÏη ή ίÏη ÏοÏ
",
+ email: "ΠδιεÏθÏ
νÏη e-mail δεν είναι ÎγκÏ
Ïη",
+ integer: "Το Ïεδίο δÎÏεÏαι μÏνο ακÎÏαιοÏ
Ï Î±ÏιθμοÏÏ",
+ url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+ nodefined : " is not defined!",
+ novalue : " return value is required!",
+ customarray : "Custom function should return array!",
+ customfcheck : "Custom function should be present in case of custom checking!"
+ }
+ },
+ view : {
+ caption: "View Record",
+ bClose: "Close"
+ },
+ del : {
+ caption: "ÎιαγÏαÏή",
+ msg: "ÎιαγÏαÏή ÏÏν εÏιλεγμÎνÏν εγγÏαÏÏν;",
+ bSubmit: "Îαι",
+ bCancel: "ÎκÏ
Ïο"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "ÎÏεξεÏγαÏία εÏιλεγμÎÎ½Î·Ï ÎµÎ³Î³ÏαÏήÏ",
+ addtext:" ",
+ addtitle: "ÎιÏαγÏγή νÎÎ±Ï ÎµÎ³Î³ÏαÏήÏ",
+ deltext: " ",
+ deltitle: "ÎιαγÏαÏή εÏιλεγμÎÎ½Î·Ï ÎµÎ³Î³ÏαÏήÏ",
+ searchtext: " ",
+ searchtitle: "ÎÏÏεÏη ÎγγÏαÏÏν",
+ refreshtext: "",
+ refreshtitle: "ÎνανÎÏÏη Πίνακα",
+ alertcap: "Î ÏοÏοÏή",
+ alerttext: "Îεν ÎÏεÏε εÏιλÎξει εγγÏαÏή",
+ viewtext: "",
+ viewtitle: "View selected row"
+ },
+ col : {
+ caption: "ÎμÏάνιÏη / ÎÏÏκÏÏ
Ïη ΣÏηλÏν",
+ bSubmit: "ÎÎ",
+ bCancel: "ÎκÏ
Ïο"
+ },
+ errors : {
+ errcap : "ΣÏάλμα",
+ nourl : "Îεν ÎÏει δοθεί διεÏθÏ
νÏη ÏειÏιÏÎ¼Î¿Ï Î³Î¹Î± Ïη ÏÏ
γκεκÏιμÎνη ενÎÏγεια",
+ norecords: "Îεν Ï
ÏάÏÏοÏ
ν εγγÏαÏÎÏ ÏÏÎ¿Ï ÎµÏεξεÏγαÏία",
+ model : "ÎνιÏÎ¿Ï Î±ÏιθμÏÏ ÏεδίÏν colNames/colModel!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "ÎÏ
Ï", "ÎεÏ
", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ",
+ "ÎÏ
Ïιακή", "ÎεÏ
ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏκεÏ
ή", "ΣάββαÏο"
+ ],
+ monthNames: [
+ "Îαν", "Φεβ", "ÎαÏ", "ÎÏÏ", "Îαι", "ÎοÏ
ν", "ÎοÏ
λ", "ÎÏ
γ", "ΣεÏ", "ÎκÏ", "Îοε", "Îεκ",
+ "ÎανοÏ
άÏιοÏ", "ΦεβÏοÏ
άÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏγοÏ
ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ"
+ ],
+ AmPm : ["Ïμ","μμ","Î Î","ÎÎ"],
+ S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''},
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-en.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-en.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-en.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid English Translation
+ * Tony Tomov tony@xxxxxxxxxxx
+ * http://trirand.com/blog/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "View {0} - {1} of {2}",
+ emptyrecords: "No records to view",
+ loadtext: "Loading...",
+ pgtext : "Page {0} of {1}"
+ },
+ search : {
+ caption: "Search...",
+ Find: "Find",
+ Reset: "Reset",
+ odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
+ groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
+ matchText: " match",
+ rulesText: " rules"
+ },
+ edit : {
+ addCaption: "Add Record",
+ editCaption: "Edit Record",
+ bSubmit: "Submit",
+ bCancel: "Cancel",
+ bClose: "Close",
+ saveData: "Data has been changed! Save changes?",
+ bYes : "Yes",
+ bNo : "No",
+ bExit : "Cancel",
+ msg: {
+ required:"Field is required",
+ number:"Please, enter valid number",
+ minValue:"value must be greater than or equal to ",
+ maxValue:"value must be less than or equal to",
+ email: "is not a valid e-mail",
+ integer: "Please, enter valid integer value",
+ date: "Please, enter valid date value",
+ url: "is not a valid URL. Prefix required ('http://' or 'https://')",
+ nodefined : " is not defined!",
+ novalue : " return value is required!",
+ customarray : "Custom function should return array!",
+ customfcheck : "Custom function should be present in case of custom checking!"
+
+ }
+ },
+ view : {
+ caption: "View Record",
+ bClose: "Close"
+ },
+ del : {
+ caption: "Delete",
+ msg: "Delete selected record(s)?",
+ bSubmit: "Delete",
+ bCancel: "Cancel"
+ },
+ nav : {
+ edittext: "",
+ edittitle: "Edit selected row",
+ addtext:"",
+ addtitle: "Add new row",
+ deltext: "",
+ deltitle: "Delete selected row",
+ searchtext: "",
+ searchtitle: "Find records",
+ refreshtext: "",
+ refreshtitle: "Reload Grid",
+ alertcap: "Warning",
+ alerttext: "Please, select row",
+ viewtext: "",
+ viewtitle: "View selected row"
+ },
+ col : {
+ caption: "Select columns",
+ bSubmit: "Ok",
+ bCancel: "Cancel"
+ },
+ errors : {
+ errcap : "Error",
+ nourl : "No url is set",
+ norecords: "No records to process",
+ model : "Length of colNames <> colModel!"
+ },
+ formatter : {
+ integer : {thousandsSeparator: " ", defaultValue: '0'},
+ number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'},
+ currency : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0.00'},
+ date : {
+ dayNames: [
+ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+ ],
+ monthNames: [
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
+ ],
+ AmPm : ["am","pm","AM","PM"],
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+ srcformat: 'Y-m-d',
+ newformat: 'd/m/Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-es.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-es.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-es.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,128 @@
+;(function($){
+/**
+ * jqGrid Spanish Translation
+ * Traduccion jqGrid en Español por Yamil Bracho
+ * Traduccion corregida y ampliada por Faserline, S.L.
+ * http://www.faserline.com
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+$.jgrid = {
+ defaults : {
+ recordtext: "Mostrando {0} - {1} de {2}",
+ emptyrecords: "Sin registros que mostrar",
+ loadtext: "Cargando...",
+ pgtext : "Página {0} de {1}"
+ },
+ search : {
+ caption: "Búsqueda...",
+ Find: "Buscar",
+ Reset: "Limpiar",
+ odata : ['igual ', 'no igual a', 'menor que', 'menor o igual que','mayor que','mayor o igual a', 'empiece por','no empiece por','está en','no está en','termina por','no termina por','contiene','no contiene'],
+ groupOps: [ { op: "AND", text: "todo" }, { op: "OR", text: "cualquier" } ],
+ matchText: " match",
+ rulesText: " reglas"
+ },
+ edit : {
+ addCaption: "Agregar registro",
+ editCaption: "Modificar registro",
+ bSubmit: "Guardar",
+ bCancel: "Cancelar",
+ bClose: "Cerrar",
+ saveData: "Se han modificado los datos, ¿guardar cambios?",
+ bYes : "Si",
+ bNo : "No",
+ bExit : "Cancelar",
+ msg: {
+ required:"Campo obligatorio",
+ number:"Introduzca un número",
+ minValue:"El valor debe ser mayor o igual a ",
+ maxValue:"El valor debe ser menor o igual a ",
+ email: "no es una dirección de correo válida",
+ integer: "Introduzca un valor entero",
+ date: "Introduza una fecha correcta ",
+ url: "no es una URL válida. Prefijo requerido ('http://' or 'https://')",
+ nodefined : " no está definido.",
+ novalue : " valor de retorno es requerido.",
+ customarray : "La función personalizada debe devolver un array.",
+ customfcheck : "La función personalizada debe estar presente en el caso de validación personalizada."
+ }
+ },
+ view : {
+ caption: "Consultar registro",
+ bClose: "Cerrar"
+ },
+ del : {
+ caption: "Eliminar",
+ msg: "¿Desea eliminar los registros seleccionados?",
+ bSubmit: "Eliminar",
+ bCancel: "Cancelar"
+ },
+ nav : {
+ edittext: " ",
+ edittitle: "Modificar fila seleccionada",
+ addtext:" ",
+ addtitle: "Agregar nueva fila",
+ deltext: " ",
+ deltitle: "Eliminar fila seleccionada",
+ searchtext: " ",
+ searchtitle: "Buscar información",
+ refreshtext: "",
+ refreshtitle: "Recargar datos",
+ alertcap: "Aviso",
+ alerttext: "Seleccione una fila",
+ viewtext: "",
+ viewtitle: "Ver fila seleccionada"
+ },
+ col : {
+ caption: "Mostrar/ocultar columnas",
+ bSubmit: "Enviar",
+ bCancel: "Cancelar"
+ },
+ errors : {
+ errcap : "Error",
+ nourl : "No se ha especificado una URL",
+ norecords: "No hay datos para procesar",
+ model : "Las columnas de nombres son diferentes de las columnas de modelo"
+ },
+ formatter : {
+ integer : {thousandsSeparator: ".", defaultValue: '0'},
+ number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
+ currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
+ date : {
+ dayNames: [
+ "Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa",
+ "Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"
+ ],
+ monthNames: [
+ "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic",
+ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
+ ],
+ AmPm : ["am","pm","AM","PM"],
+ S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
+ srcformat: 'Y-m-d',
+ newformat: 'd-m-Y',
+ masks : {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+ },
+ reformatAfterEdit : false
+ },
+ baseLinkUrl: '',
+ showAction: '',
+ target: '',
+ checkbox : {disabled:true},
+ idName : 'id'
+ }
+};
+})(jQuery);
=== added file 'addons/base/static/jquery.jqGrid/js/i18n/grid.locale-fa.js'
--- addons/base/static/jquery.jqGrid/js/i18n/grid.locale-fa.js 1970-01-01 00:00:00 +0000
+++ addons/base/static/jquery.jqGrid/js/i18n/grid.locale-fa.js 2011-03-28 09:08:30 +0000
@@ -0,0 +1,145 @@
+;(function ($) {
+/**
+ * jqGrid Persian Translation
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+**/
+ $.jgrid = {
+ defaults: {
+ recordtext: "ÙÙ
ابش {0} - {1} از {2}",
+ emptyrecords: "رکÙØ±Ø¯Û ÛاÙت Ùشد",
+ loadtext: "بارگزارÙ...",
+ pgtext: "صÙØÙ {0} از {1}"
+ },
+ search: {
+ caption: "جستجÙ...",
+ Find: "ÙاÙت٠Ùا",
+ Reset: "از ÙÙ",
+ odata: ['برابر', 'Ùا برابر', 'بÙ', 'Ú©ÙÚکتر', 'از', 'بزرگتر', 'شرÙع با', 'شرÙع ÙØ´Ùد با', 'Ùباشد', 'عض٠اÛÙ Ùباشد', 'اتÙ
اÙ
با', 'تÙ
اÙ
ÙØ´Ùد با', 'ØاÙÛ', 'Ùباشد ØاÙÛ'],
+ groupOps: [{
+ op: "AND",
+ text: "Ú©Ù"
+ },
+ {
+ op: "OR",
+ text: "Ù
جÙ
Ùع"
+ }],
+ matchText: " ØاÙÛ",
+ rulesText: " اطÙاعات"
+ },
+ edit: {
+ addCaption: "اضاÙ٠کرد٠رکÙرد",
+ editCaption: "ÙÙراÙØ´ رکÙرد",
+ bSubmit: "ثبت",
+ bCancel: "اÙصراÙ",
+ bClose: "بستÙ",
+ saveData: "دÛتا تعÛÛر کرد! ذخÛر٠شÙدØ",
+ bYes: "بÙÙ",
+ bNo: "Ø®Ûر",
+ bExit: "اÙصراÙ",
+ msg: {
+ required: "ÙÙÙدÙا باÙد ختÙ
ا پر Ø´ÙÙد",
+ number: "ÙØ·Ùا عدد Ùعتبر Ùارد Ú©ÙÙد",
+ minValue: "Ù
Ùدار Ùارد شد٠باÙد بزرگتر Ùا Ù
ساÙ٠با",
+ maxValue: "Ù
Ùدار Ùارد شد٠باÙد Ú©ÙÚکتر Ùا Ù
ساÙÙ",
+ email: "پست اÙکترÙÙÙÚ© Ùارد شد٠Ù
عتبر ÙÙست",
+ integer: "ÙØ·Ùا ÙÚ© عدد صØÙØ Ùارد Ú©ÙÙد",
+ date: "ÙØ·Ùا ÙÚ© تارÙØ® Ù
عتبر Ùارد Ú©ÙÙد",
+ url: "اÛ٠آدرس صØÛØ ÙÙ
Û Ø¨Ø§Ø´Ø¯. Ù¾ÛØ´ÙÙد ÙÛاز است ('http://' Ûا 'https://')",
+ nodefined: " تعرÛÙ ÙشدÙ!",
+ novalue: " Ù
Ùدار Ø¨Ø±Ú¯Ø´ØªÛ Ø§Ø¬Ø¨Ø§Ø±Û Ø§Ø³Øª!",
+ customarray: "تابع Ø´Ù
ا باÛد Ù
Ùدار آراÛ٠داشت٠باشد!",
+ customfcheck: "Ø¨Ø±Ø§Û Ø¯Ø§Ø´ØªÙ Ù
تد دÙØ®Ùا٠شÙ
ا باÛد سطÙ٠با ÚÚ©ÛÙÚ¯ دÙØ®Ùا٠داشت٠باشÛد!"
+ }
+ },
+ view: {
+ caption: "ÙÙ
اÛØ´ رکÙرد",
+ bClose: "بستÙ"
+ },
+ del: {
+ caption: "ØØ°Ù",
+ msg: "از Øذ٠گزÙÙÙ Ùا٠اÙتخاب شد٠Ù
Ø·Ù
ئ٠ÙستÙدØ",
+ bSubmit: "ØØ°Ù",
+ bCancel: "ابطاÙ"
+ },
+ nav: {
+ edittext: " ",
+ edittitle: "ÙÙراÙØ´ ردÙÙ Ùا٠اÙتخاب شدÙ",
+ addtext: " ",
+ addtitle: "اÙزÙد٠ردÙ٠جدÙد",
+ deltext: " ",
+ deltitle: "Øذ٠ردب٠Ùا٠اÙتخاب شدÙ",
+ searchtext: " ",
+ searchtitle: "جستجÙ٠ردÙÙ",
+ refreshtext: "",
+ refreshtitle: "بازÙاب٠Ù
جدد صÙØÙ",
+ alertcap: "اخطار",
+ alerttext: "ÙØ·Ùا ÙÚ© ردÙ٠اÙتخاب Ú©ÙÙد",
+ viewtext: "",
+ viewtitle: "ÙÙ
اÛØ´ رکÙرد ÙØ§Û Ø§Ùتخاب شدÙ"
+ },
+ col: {
+ caption: "ÙÙ
اÙØ´/عدÙ
ÙÙ
اÙØ´ ستÙÙ",
+ bSubmit: "ثبت",
+ bCancel: "اÙصراÙ"
+ },
+ errors: {
+ errcap: "خطا",
+ nourl: "ÙÙÚ Ø¢Ø¯Ø±Ø³Ù ØªÙظÙÙ
Ùشد٠است",
+ norecords: "ÙÙÚ Ø±Ú©Ùرد٠برا٠پردازش Ù
ÙجÙد ÙÙست",
+ model: "Ø·ÙÙ ÙاÙ
ستÙÙ Ùا Ù
ØاÙ٠ستÙÙ Ùا٠Ù
د٠Ù
٠باشد!"
+ },
+ formatter: {
+ integer: {
+ thousandsSeparator: " ",
+ defaultValue: "0"
+ },
+ number: {
+ decimalSeparator: ".",
+ thousandsSeparator: " ",
+ decimalPlaces: 2,
+ defaultValue: "0.00"
+ },
+ currency: {
+ decimalSeparator: ".",
+ thousandsSeparator: " ",
+ decimalPlaces: 2,
+ prefix: "",
+ suffix: "",
+ defaultValue: "0"
+ },
+ date: {
+ dayNames: ["ÙÚ©", "دÙ", "سÙ", "ÚÙار", "Ù¾Ùج", "جÙ
ع", "Ø´Ùب", "ÙÚ©Ø´ÙبÙ", "دÙØ´ÙبÙ", "س٠شÙبÙ", "ÚÙارشÙبÙ", "Ù¾ÙجشÙبÙ", "جÙ
عÙ", "Ø´ÙبÙ"],
+ monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ÚاÙÙÙÙ", "ÙÙرÙÙ", "Ù
ارس", "Ø¢ÙرÙÙ", "Ù
Ù", "ÚÙئÙ", "ÚÙئÙÙ", "اÙت", "سپتاÙ
بر", "اکتبر", "ÙÙاÙ
بر", "December"],
+ AmPm: ["ب.ظ", "ب.ظ", "Ù.ظ", "Ù.ظ"],
+ S: function (b) {
+ return b < 11 || b > 13 ? ["st", "nd", "rd", "th"][Math.min((b - 1) % 10, 3)] : "th"
+ },
+ srcformat: "Y-m-d",
+ newformat: "d/m/Y",
+ masks: {
+ ISO8601Long: "Y-m-d H:i:s",
+ ISO8601Short: "Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+
Follow ups