├── LICENSE
├── README.md
├── lib
├── admin.php
├── css
│ └── rkv.repo.admin.css
├── js
│ ├── jquery.autosize.js
│ ├── jquery.autosize.min.js
│ ├── jquery.datepick.min.js
│ └── rkv.repo.admin.js
├── markdown.php
├── parse.php
└── postmeta.php
├── reaktiv-remote-repo.php
└── sample-plugin
├── RKV_Remote_Updater.php
└── sample-plugin.php
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Reaktiv Remote Repo
2 | ===================
3 |
4 | A plugin to provide a self-hosted WP plugin repository
5 |
6 |
7 | ## General Setup ##
8 |
9 | To properly set this up, you must add some code to your plugin, with data from the site you have set up Reaktiv Remote Repo on.
10 | All of this should reside in your root file. Note: all of this code resides in your individual plugin. The actual updater class
11 | does not get modified in any way.
12 |
13 |
14 | You first add your repository update URL as a constant. It should be the domain of your site, with `update` on the end.
15 |
16 | ```php
17 | if ( ! defined( 'YOUR_REPO_URL' ) ) {
18 | define( 'YOUR_REPO_URL', 'http://yourdomain.com/update/' );
19 | }
20 | ```
21 |
22 | You then need to add the unique key as a constant. This key is generated in your individual item in the repo.
23 |
24 | ```php
25 | if ( ! defined( 'YOUR_PLUGIN_UNIQUE' ) ) {
26 | define( 'YOUR_PLUGIN_UNIQUE', 'XXXXXXXXXX' );
27 | }
28 | ```
29 |
30 | Include a version number, which is what the update will check against.
31 |
32 | ```php
33 | if ( ! defined( 'YOUR_PLUGIN_VER' ) ) {
34 | define( 'YOUR_PLUGIN_VER', '0.0.1' );
35 | }
36 | ```
37 |
38 | Include the updater class file in your plugin, and load it.
39 |
40 | ```php
41 | add_action( 'plugins_loaded', 'rkv_load_updater' );
42 |
43 | function rkv_load_updater() {
44 |
45 | if ( ! class_exists( 'RKV_Remote_Updater' ) ) {
46 | include( 'lib/RKV_Remote_Updater.php' );
47 | }
48 | }
49 | ```
50 |
51 | And then add the update function in your plugin
52 |
53 | ```php
54 | add_action( 'admin_init', 'rkv_remote_update' );
55 |
56 | function rkv_remote_update() {
57 |
58 | // ensure the class exists before running
59 | if ( ! class_exists( 'RKV_Remote_Updater' ) ) {
60 | return;
61 | }
62 |
63 | $updater = new RKV_Remote_Updater( YOUR_REPO_URL, __FILE__, array(
64 | 'unique' => YOUR_PLUGIN_UNIQUE,
65 | 'version' => YOUR_PLUGIN_VER,
66 | )
67 | );
68 | }
69 | ```
70 |
--------------------------------------------------------------------------------
/lib/admin.php:
--------------------------------------------------------------------------------
1 | \n";
107 | $rules .= "Order Allow,Deny\n";
108 | $rules .= "Allow from all\n";
109 | $rules .= "\n";
110 |
111 | return $rules;
112 | }
113 |
114 | /**
115 | * Creates blank index.php and .htaccess files
116 | *
117 | * This function runs approximately once per month in order to ensure all folders
118 | * have their necessary protection files
119 | *
120 | * @return void
121 | */
122 | public function secure_upload_dir() {
123 |
124 | // if ( false === get_transient( 'rkv_check_protection_files' ) ) {
125 |
126 | $upload_path = self::get_upload_dir();
127 |
128 | // Make sure the /edd folder is created
129 | wp_mkdir_p( $upload_path );
130 |
131 | // Top level .htaccess file
132 | $rules = self::get_htaccess_rules();
133 | if ( self::htaccess_exists() ) {
134 | $contents = @file_get_contents( $upload_path . '/.htaccess' );
135 | if ( $contents !== $rules || ! $contents ) {
136 | // Update the .htaccess rules if they don't match
137 | @file_put_contents( $upload_path . '/.htaccess', $rules );
138 | }
139 | } elseif( wp_is_writable( $upload_path ) ) {
140 | // Create the file if it doesn't exist
141 | @file_put_contents( $upload_path . '/.htaccess', $rules );
142 | }
143 |
144 | // Top level blank index.php
145 | if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) {
146 | @file_put_contents( $upload_path . '/index.php', 'post_type == 'repo-items' ) :
165 |
166 | global $post;
167 |
168 | wp_enqueue_style( 'rkv-repo', plugins_url( '/css/rkv.repo.admin.css', __FILE__ ), array(), null, 'all' );
169 |
170 | wp_enqueue_media( array( 'post' => $post->ID ) );
171 | wp_enqueue_script( 'datepick', plugins_url( '/js/jquery.datepick.min.js', __FILE__ ), array('jquery'), null, true );
172 | wp_enqueue_script( 'rkv-repo', plugins_url( '/js/rkv.repo.admin.js', __FILE__ ) , array( 'jquery', 'jquery-ui-sortable', 'media-upload' ), null, true );
173 | wp_localize_script( 'rkv-repo', 'rkvAsset', array(
174 | 'icon' => '',
175 | 'uptitle' => 'Upload or select a file',
176 | 'upbutton' => 'Add This File',
177 | 'upcheck' => '',
178 | ));
179 |
180 | endif;
181 |
182 | }
183 |
184 | /**
185 | * reorder menu
186 | *
187 | * @return
188 | */
189 |
190 | public function menu_order( $menu_ord ) {
191 |
192 | if ( ! $menu_ord )
193 | return true;
194 |
195 | return array(
196 | 'index.php', // this represents the dashboard link
197 | 'edit.php?post_type=repo-items', // custom post type
198 | 'edit.php', // this is the default POST admin menu
199 | );
200 | }
201 |
202 | /**
203 | * adjust admin display columns
204 | *
205 | * @return
206 | */
207 |
208 | public function repo_columns( $columns ) {
209 |
210 | // remove stuff
211 | unset( $columns['date'] );
212 |
213 | // now add the custom stuff
214 | $columns['title'] = __( 'Item Name', '' );
215 | $columns['package'] = __( 'Package File', '' );
216 | $columns['version'] = __( 'Version', '' );
217 | $columns['added'] = __( 'Added', '' );
218 | $columns['updated'] = __( 'Updated', '' );
219 | $columns['readme'] = __( 'Readme', '' );
220 |
221 | $columns = apply_filters( 'rkv_remote_repo_admin_columns', $columns );
222 |
223 | return $columns;
224 |
225 | }
226 |
227 |
228 | /**
229 | * Column mods
230 | *
231 | * @return
232 | */
233 |
234 | public function display_columns( $column, $post_id ) {
235 |
236 | $meta = get_post_meta( $post_id, '_rkv_repo_data', true );
237 | $none = '('.__( 'none entered', '' ).')';
238 |
239 | switch ( $column ) {
240 |
241 | case 'package':
242 | $data = !empty( $meta['package'] ) ? ''.__( 'Download', '' ).'' : $none;
243 |
244 | echo $data;
245 |
246 | break;
247 |
248 | case 'version':
249 | $data = !empty( $meta['version'] ) ? $meta['version'] : $none;
250 |
251 | echo $data;
252 |
253 | break;
254 |
255 | case 'added':
256 | $data = !empty( $meta['added'] ) ? date( 'Y-m-d', floatval( $meta['added'] ) ) : $none;
257 |
258 | echo $data;
259 |
260 | break;
261 |
262 | case 'updated':
263 | $data = !empty( $meta['last_updated'] ) ? date( 'Y-m-d', floatval( $meta['last_updated'] ) ) : $none;
264 |
265 | echo $data;
266 |
267 | break;
268 |
269 | case 'readme':
270 | $file = get_post_meta( $post_id, '_rkv_repo_readme_file', true );
271 | $data = ! $file ? 'dashicons-no meta-column-no' : 'dashicons-yes meta-column-yes';
272 |
273 | echo '';
274 |
275 | break;
276 |
277 | // end all case breaks
278 | }
279 |
280 | }
281 |
282 |
283 | /**
284 | * build out post type
285 | *
286 | * @return
287 | */
288 |
289 | public function _register_types() {
290 |
291 | $labels = array(
292 | 'name' => __( 'Repository', '' ),
293 | 'menu_name' => __( 'Repository', '' ),
294 | 'all_items' => __( 'Items', '' ),
295 | 'singular_name' => __( 'Item', '' ),
296 | 'add_new' => __( 'Add New Item', '' ),
297 | 'add_new_item' => __( 'Add New Item', '' ),
298 | 'edit' => __( 'Edit Item', '' ),
299 | 'edit_item' => __( 'Edit Item', '' ),
300 | 'new_item' => __( 'New Item', '' ),
301 | 'view' => __( 'View Item', '' ),
302 | 'view_item' => __( 'View Item', '' ),
303 | 'search_items' => __( 'Search Repository', '' ),
304 | 'not_found' => __( 'No Items found', '' ),
305 | 'not_found_in_trash' => __( 'No Items found in Trash', '' ),
306 | );
307 |
308 | $cpt_args = array(
309 | 'labels' => $labels,
310 | 'public' => true,
311 | 'show_in_menu' => true,
312 | 'show_in_nav_menus' => false,
313 | 'show_ui' => true,
314 | 'publicly_queryable' => true,
315 | 'exclude_from_search' => true,
316 | 'hierarchical' => false,
317 | 'menu_position' => null,
318 | 'capability_type' => 'post',
319 | 'query_var' => true,
320 | 'menu_icon' => 'dashicons-share-alt',
321 | 'rewrite' => false,
322 | 'has_archive' => false,
323 | 'supports' => array( 'title' ),
324 | );
325 |
326 | $cpt_args = apply_filters( 'rkv_remote_repo_type_args', $cpt_args );
327 |
328 | register_post_type( 'repo-items', $cpt_args );
329 |
330 | }
331 |
332 | /// end class
333 | }
334 |
335 |
336 | // Instantiate our class
337 | new RKV_Remote_Repo_Admin();
338 |
--------------------------------------------------------------------------------
/lib/css/rkv.repo.admin.css:
--------------------------------------------------------------------------------
1 | /* post table */
2 |
3 | th.column-readme,
4 | td.column-readme {
5 | width: 100px;
6 | text-align: center;
7 | }
8 |
9 | span.meta-column-item {
10 | display: block;
11 | width: 100%;
12 | font-size: 24px;
13 | }
14 |
15 | span.meta-column-yes {
16 | color: #458b00;
17 | }
18 |
19 | span.meta-column-no {
20 | color: #cc0000;
21 | }
22 |
23 | /* post editor */
24 |
25 | /* unique ID box */
26 | #repo-unique-id {
27 | background: #fff;
28 | padding: 10px;
29 | margin: 0 0 10px 0;
30 | border: 1px solid #E5E5E5;
31 | }
32 |
33 | #repo-unique-id p {
34 | display: inline-block;
35 | vertical-align: top;
36 | margin: 0;
37 | font-size: 16px;
38 | line-height: 20px;
39 | }
40 |
41 | #repo-unique-id p.code-item {
42 | margin: 0 5px 0 0;
43 | }
44 |
45 | #repo-unique-id p.code-item code {
46 | font-size: 18px;
47 | line-height: 20px;
48 | color: #fff;
49 | background: #333;
50 | font-weight: 700;
51 | letter-spacing: 1px;
52 | padding: 3px 10px 2px;
53 | cursor: text;
54 | }
55 |
56 | #repo-unique-id p.code-label {
57 | font-style: italic;
58 | font-size: 14px;
59 | }
60 |
61 | /* file details */
62 | input.repo-item-file-text {
63 | width: 75%;
64 | margin-right: 10px;
65 | }
66 |
67 | textarea.repo-item-textarea {
68 | width: 100%;
69 | min-height: 50px;
70 | overflow: auto;
71 | vertical-align: top;
72 | resize: vertical;
73 | }
74 |
75 | input.repo-item-num-text {
76 | width: 40%;
77 | }
78 |
79 | label.repo-item-label {
80 | width: 60%;
81 | }
82 |
83 | p.repo-cal-field {
84 | position: relative;
85 | }
86 |
87 | p.repo-cal-field .rkv-cal-icon {
88 | position: absolute;
89 | right: 152px;
90 | top: 8px;
91 | font-size: 14px;
92 | cursor: pointer;
93 | }
94 |
95 | tr.repo-screenshots-field p.uploader-info {
96 | cursor: pointer;
97 | margin: 0 0 1em;
98 | }
99 |
100 | tr.repo-screenshots-field span.rkv-screenshot-uploader {
101 | cursor: pointer;
102 | margin: 0 3px 0 0;
103 | }
104 |
105 | tr.repo-screenshots-field span.screenshot-spinner {
106 | visibility: hidden;
107 | display: inline-block;
108 | vertical-align: top;
109 | float: none;
110 | position: relative;
111 | left: 20px;
112 | top: -1px;
113 | }
114 |
115 | div.repo-screenshot-gallery div.screenshot-item {
116 | display: inline-block;
117 | vertical-align: top;
118 | position: relative;
119 | width: 92px;
120 | }
121 |
122 | div.repo-screenshot-gallery div.screenshot-item img.screenshot-image {
123 | width: 80px;
124 | height: 80px;
125 | padding: 2px;
126 | border: 1px solid #ccc;
127 | margin: 0 10px 0 0;
128 | }
129 |
130 | div.repo-screenshot-gallery div.screenshot-item span.screenshot-remove {
131 | position: absolute;
132 | bottom: 0;
133 | right: 0;
134 | cursor: pointer;
135 | padding: 2px;
136 | background: #efefef;
137 | border: 1px solid #ccc;
138 | color: #ff0000;
139 | border-radius: 50%;
140 | font-size: 14px;
141 | height: 14px;
142 | width: 14px;
143 | }
144 |
145 |
146 | tr.repo-readme-notice h4.readme-info-text {
147 | margin: 0;
148 | font-weight: 400;
149 | }
150 |
151 | tr.repo-upgrade-notice-field span.repo-unotice-vers-title,
152 | tr.repo-upgrade-notice-field span.repo-unotice-text-title {
153 | font-size: 12px;
154 | font-weight: 700;
155 | }
156 |
157 | tr.repo-upgrade-notice-field span.repo-unotice-vers-title,
158 | tr.repo-upgrade-notice-field input.repo-unotice-vers {
159 | display: inline-block;
160 | vertical-align: top;
161 | width: 5%;
162 | margin-right: 1%;
163 | }
164 | tr.repo-upgrade-notice-field span.repo-unotice-text-title,
165 | tr.repo-upgrade-notice-field input.repo-unotice-text {
166 | display: inline-block;
167 | vertical-align: top;
168 | width: 80%;
169 | }
170 |
171 | /* Default styling for jQuery Datepicker v4.0.6. */
172 | .datepick {
173 | background-color: #fff;
174 | color: #000;
175 | border: 1px solid #444;
176 | -moz-border-radius: 0.25em;
177 | -webkit-border-radius: 0.25em;
178 | border-radius: 0.25em;
179 | font-family: Arial,Helvetica,Sans-serif;
180 | font-size: 90%;
181 | }
182 | .datepick-rtl {
183 | direction: rtl;
184 | }
185 | .datepick-popup {
186 | z-index: 1000;
187 | }
188 | .datepick-disable {
189 | position: absolute;
190 | z-index: 100;
191 | background-color: white;
192 | opacity: 0.5;
193 | filter: alpha(opacity=50);
194 | }
195 | .datepick a {
196 | color: #fff;
197 | text-decoration: none;
198 | }
199 | .datepick a.datepick-disabled {
200 | color: #888;
201 | cursor: auto;
202 | }
203 | .datepick button {
204 | margin: 0.25em;
205 | padding: 0.125em 0em;
206 | background-color: #fcc;
207 | border: none;
208 | -moz-border-radius: 0.25em;
209 | -webkit-border-radius: 0.25em;
210 | border-radius: 0.25em;
211 | font-weight: bold;
212 | }
213 | .datepick-nav, .datepick-ctrl {
214 | float: left;
215 | width: 100%;
216 | background-color: #000;
217 | color: #fff;
218 | font-size: 90%;
219 | font-weight: bold;
220 | }
221 | .datepick-ctrl {
222 | background-color: #600;
223 | }
224 | .datepick-cmd {
225 | width: 30%;
226 | }
227 | .datepick-cmd:hover {
228 | background-color: #777;
229 | }
230 | .datepick-ctrl .datepick-cmd:hover {
231 | background-color: #f08080;
232 | }
233 | .datepick-cmd-prevJump, .datepick-cmd-nextJump {
234 | width: 8%;
235 | }
236 | a.datepick-cmd {
237 | height: 1.5em;
238 | }
239 | button.datepick-cmd {
240 | text-align: center;
241 | }
242 | .datepick-cmd-prev, .datepick-cmd-prevJump, .datepick-cmd-clear {
243 | float: left;
244 | padding-left: 2%;
245 | }
246 | .datepick-cmd-current, .datepick-cmd-today {
247 | float: left;
248 | width: 35%;
249 | text-align: center;
250 | }
251 | .datepick-cmd-next, .datepick-cmd-nextJump, .datepick-cmd-close {
252 | float: right;
253 | padding-right: 2%;
254 | text-align: right;
255 | }
256 | .datepick-rtl .datepick-cmd-prev, .datepick-rtl .datepick-cmd-prevJump,
257 | .datepick-rtl .datepick-cmd-clear {
258 | float: right;
259 | padding-left: 0%;
260 | padding-right: 2%;
261 | text-align: right;
262 | }
263 | .datepick-rtl .datepick-cmd-current, .datepick-rtl .datepick-cmd-today {
264 | float: right;
265 | }
266 | .datepick-rtl .datepick-cmd-next, .datepick-rtl .datepick-cmd-nextJump,
267 | .datepick-rtl .datepick-cmd-close {
268 | float: left;
269 | padding-left: 2%;
270 | padding-right: 0%;
271 | text-align: left;
272 | }
273 | .datepick-month-nav {
274 | float: left;
275 | background-color: #777;
276 | text-align: center;
277 | }
278 | .datepick-month-nav div {
279 | float: left;
280 | width: 12.5%;
281 | margin: 1%;
282 | padding: 1%;
283 | }
284 | .datepick-month-nav span {
285 | color: #888;
286 | }
287 | .datepick-month-row {
288 | clear: left;
289 | }
290 | .datepick-month {
291 | float: left;
292 | width: 15em;
293 | border: 1px solid #444;
294 | text-align: center;
295 | }
296 | .datepick-month-header, .datepick-month-header select, .datepick-month-header input {
297 | height: 1.5em;
298 | background-color: #444;
299 | color: #fff;
300 | font-weight: bold;
301 | }
302 | .datepick-month-header select, .datepick-month-header input {
303 | height: 1.4em;
304 | border: none;
305 | }
306 | .datepick-month-header input {
307 | position: absolute;
308 | display: none;
309 | }
310 | .datepick-month table {
311 | width: 100%;
312 | border-collapse: collapse;
313 | }
314 | .datepick-month thead {
315 | border-bottom: 1px solid #aaa;
316 | }
317 | .datepick-month th, .datepick-month td {
318 | margin: 0em;
319 | padding: 0em;
320 | font-weight: normal;
321 | text-align: center;
322 | }
323 | .datepick-month th {
324 | border: 1px solid #777;
325 | }
326 | .datepick-month th, .datepick-month th a {
327 | background-color: #777;
328 | color: #fff;
329 | }
330 | .datepick-month td {
331 | background-color: #eee;
332 | border: 1px solid #aaa;
333 | }
334 | .datepick-month td.datepick-week {
335 | border: 1px solid #777;
336 | }
337 | .datepick-month td.datepick-week * {
338 | background-color: #777;
339 | color: #fff;
340 | border: none;
341 | }
342 | .datepick-month a {
343 | display: block;
344 | width: 100%;
345 | padding: 0.125em 0em;
346 | background-color: #eee;
347 | color: #000;
348 | text-decoration: none;
349 | }
350 | .datepick-month span {
351 | display: block;
352 | width: 100%;
353 | padding: 0.125em 0em;
354 | }
355 | .datepick-month td span {
356 | color: #888;
357 | }
358 | .datepick-month td .datepick-other-month {
359 | background-color: #fff;
360 | }
361 | .datepick-month td .datepick-weekend {
362 | background-color: #ddd;
363 | }
364 | .datepick-month td .datepick-today {
365 | background-color: #f0c0c0;
366 | }
367 | .datepick-month td .datepick-highlight {
368 | background-color: #f08080;
369 | }
370 | .datepick-month td .datepick-selected {
371 | background-color: #777;
372 | color: #fff;
373 | }
374 | .datepick-month th.datepick-week {
375 | background-color: #777;
376 | color: #fff;
377 | }
378 | .datepick-status {
379 | clear: both;
380 | background-color: #ddd;
381 | text-align: center;
382 | }
383 | .datepick-clear-fix {
384 | clear: both;
385 | }
386 | .datepick-cover {
387 | display: none;
388 | display/**/: block;
389 | position: absolute;
390 | z-index: -1;
391 | filter: mask();
392 | top: -1px;
393 | left: -1px;
394 | width: 100px;
395 | height: 100px;
396 | }
397 |
--------------------------------------------------------------------------------
/lib/js/jquery.autosize.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Autosize v1.18.4 - 2014-01-11
3 | Automatically adjust textarea height based on user input.
4 | (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5 | license: http://www.opensource.org/licenses/mit-license.php
6 | */
7 | (function ($) {
8 | var
9 | defaults = {
10 | className: 'autosizejs',
11 | append: '',
12 | callback: false,
13 | resizeDelay: 10,
14 | placeholder: true
15 | },
16 |
17 | // border:0 is unnecessary, but avoids a bug in Firefox on OSX
18 | copy = '',
19 |
20 | // line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
21 | typographyStyles = [
22 | 'fontFamily',
23 | 'fontSize',
24 | 'fontWeight',
25 | 'fontStyle',
26 | 'letterSpacing',
27 | 'textTransform',
28 | 'wordSpacing',
29 | 'textIndent'
30 | ],
31 |
32 | // to keep track which textarea is being mirrored when adjust() is called.
33 | mirrored,
34 |
35 | // the mirror element, which is used to calculate what size the mirrored element should be.
36 | mirror = $(copy).data('autosize', true)[0];
37 |
38 | // test that line-height can be accurately copied.
39 | mirror.style.lineHeight = '99px';
40 | if ($(mirror).css('lineHeight') === '99px') {
41 | typographyStyles.push('lineHeight');
42 | }
43 | mirror.style.lineHeight = '';
44 |
45 | $.fn.autosize = function (options) {
46 | if (!this.length) {
47 | return this;
48 | }
49 |
50 | options = $.extend({}, defaults, options || {});
51 |
52 | if (mirror.parentNode !== document.body) {
53 | $(document.body).append(mirror);
54 | }
55 |
56 | return this.each(function () {
57 | var
58 | ta = this,
59 | $ta = $(ta),
60 | maxHeight,
61 | minHeight,
62 | boxOffset = 0,
63 | callback = $.isFunction(options.callback),
64 | originalStyles = {
65 | height: ta.style.height,
66 | overflow: ta.style.overflow,
67 | overflowY: ta.style.overflowY,
68 | wordWrap: ta.style.wordWrap,
69 | resize: ta.style.resize
70 | },
71 | timeout,
72 | width = $ta.width();
73 |
74 | if ($ta.data('autosize')) {
75 | // exit if autosize has already been applied, or if the textarea is the mirror element.
76 | return;
77 | }
78 | $ta.data('autosize', true);
79 |
80 | if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
81 | boxOffset = $ta.outerHeight() - $ta.height();
82 | }
83 |
84 | // IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
85 | minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
86 |
87 | $ta.css({
88 | overflow: 'hidden',
89 | overflowY: 'hidden',
90 | wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
91 | resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal'
92 | });
93 |
94 | // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
95 | // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
96 | function setWidth() {
97 | var width;
98 | var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
99 |
100 | if (style) {
101 |
102 | width = ta.getBoundingClientRect().width;
103 |
104 | if (width === 0) {
105 | width = parseInt(style.width,10);
106 | }
107 |
108 | $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
109 | width -= parseInt(style[val],10);
110 | });
111 | } else {
112 | width = Math.max($ta.width(), 0);
113 | }
114 |
115 | mirror.style.width = width + 'px';
116 | }
117 |
118 | function initMirror() {
119 | var styles = {};
120 |
121 | mirrored = ta;
122 | mirror.className = options.className;
123 | maxHeight = parseInt($ta.css('maxHeight'), 10);
124 |
125 | // mirror is a duplicate textarea located off-screen that
126 | // is automatically updated to contain the same text as the
127 | // original textarea. mirror always has a height of 0.
128 | // This gives a cross-browser supported way getting the actual
129 | // height of the text, through the scrollTop property.
130 | $.each(typographyStyles, function(i,val){
131 | styles[val] = $ta.css(val);
132 | });
133 | $(mirror).css(styles);
134 |
135 | setWidth();
136 |
137 | // Chrome-specific fix:
138 | // When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
139 | // made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
140 | if (window.chrome) {
141 | var width = ta.style.width;
142 | ta.style.width = '0px';
143 | var ignore = ta.offsetWidth;
144 | ta.style.width = width;
145 | }
146 | }
147 |
148 | // Using mainly bare JS in this function because it is going
149 | // to fire very often while typing, and needs to very efficient.
150 | function adjust() {
151 | var height, original;
152 |
153 | if (mirrored !== ta) {
154 | initMirror();
155 | } else {
156 | setWidth();
157 | }
158 |
159 | if (!ta.value && options.placeholder) {
160 | // If the textarea is empty, copy the placeholder text into
161 | // the mirror control and use that for sizing so that we
162 | // don't end up with placeholder getting trimmed.
163 | mirror.value = ($(ta).attr("placeholder") || '') + options.append;
164 | } else {
165 | mirror.value = ta.value + options.append;
166 | }
167 |
168 | mirror.style.overflowY = ta.style.overflowY;
169 | original = parseInt(ta.style.height,10);
170 |
171 | // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
172 | mirror.scrollTop = 0;
173 |
174 | mirror.scrollTop = 9e4;
175 |
176 | // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
177 | height = mirror.scrollTop;
178 |
179 | if (maxHeight && height > maxHeight) {
180 | ta.style.overflowY = 'scroll';
181 | height = maxHeight;
182 | } else {
183 | ta.style.overflowY = 'hidden';
184 | if (height < minHeight) {
185 | height = minHeight;
186 | }
187 | }
188 |
189 | height += boxOffset;
190 |
191 | if (original !== height) {
192 | ta.style.height = height + 'px';
193 | if (callback) {
194 | options.callback.call(ta,ta);
195 | }
196 | }
197 | }
198 |
199 | function resize () {
200 | clearTimeout(timeout);
201 | timeout = setTimeout(function(){
202 | var newWidth = $ta.width();
203 |
204 | if (newWidth !== width) {
205 | width = newWidth;
206 | adjust();
207 | }
208 | }, parseInt(options.resizeDelay,10));
209 | }
210 |
211 | if ('onpropertychange' in ta) {
212 | if ('oninput' in ta) {
213 | // Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
214 | // so binding to onkeyup to catch most of those occasions. There is no way that I
215 | // know of to detect something like 'cut' in IE9.
216 | $ta.on('input.autosize keyup.autosize', adjust);
217 | } else {
218 | // IE7 / IE8
219 | $ta.on('propertychange.autosize', function(){
220 | if(event.propertyName === 'value'){
221 | adjust();
222 | }
223 | });
224 | }
225 | } else {
226 | // Modern Browsers
227 | $ta.on('input.autosize', adjust);
228 | }
229 |
230 | // Set options.resizeDelay to false if using fixed-width textarea elements.
231 | // Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
232 |
233 | if (options.resizeDelay !== false) {
234 | $(window).on('resize.autosize', resize);
235 | }
236 |
237 | // Event for manual triggering if needed.
238 | // Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
239 | $ta.on('autosize.resize', adjust);
240 |
241 | // Event for manual triggering that also forces the styles to update as well.
242 | // Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
243 | $ta.on('autosize.resizeIncludeStyle', function() {
244 | mirrored = null;
245 | adjust();
246 | });
247 |
248 | $ta.on('autosize.destroy', function(){
249 | mirrored = null;
250 | clearTimeout(timeout);
251 | $(window).off('resize', resize);
252 | $ta
253 | .off('autosize')
254 | .off('.autosize')
255 | .css(originalStyles)
256 | .removeData('autosize');
257 | });
258 |
259 | // Call adjust in case the textarea already contains text.
260 | adjust();
261 | });
262 | };
263 | }(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto
264 |
--------------------------------------------------------------------------------
/lib/js/jquery.autosize.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Autosize v1.18.4 - 2014-01-11
3 | Automatically adjust textarea height based on user input.
4 | (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5 | license: http://www.opensource.org/licenses/mit-license.php
6 | */
7 | !function(a){var b,c={className:"autosizejs",append:"",callback:!1,resizeDelay:10,placeholder:!0},d='',e=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],f=a(d).data("autosize",!0)[0];f.style.lineHeight="99px","99px"===a(f).css("lineHeight")&&e.push("lineHeight"),f.style.lineHeight="",a.fn.autosize=function(d){return this.length?(d=a.extend({},c,d||{}),f.parentNode!==document.body&&a(document.body).append(f),this.each(function(){function c(){var b,c=window.getComputedStyle?window.getComputedStyle(m,null):!1;c?(b=m.getBoundingClientRect().width,0===b&&(b=parseInt(c.width,10)),a.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(a,d){b-=parseInt(c[d],10)})):b=Math.max(n.width(),0),f.style.width=b+"px"}function g(){var g={};if(b=m,f.className=d.className,j=parseInt(n.css("maxHeight"),10),a.each(e,function(a,b){g[b]=n.css(b)}),a(f).css(g),c(),window.chrome){var h=m.style.width;m.style.width="0px";{m.offsetWidth}m.style.width=h}}function h(){var e,h;b!==m?g():c(),f.value=!m.value&&d.placeholder?(a(m).attr("placeholder")||"")+d.append:m.value+d.append,f.style.overflowY=m.style.overflowY,h=parseInt(m.style.height,10),f.scrollTop=0,f.scrollTop=9e4,e=f.scrollTop,j&&e>j?(m.style.overflowY="scroll",e=j):(m.style.overflowY="hidden",k>e&&(e=k)),e+=o,h!==e&&(m.style.height=e+"px",p&&d.callback.call(m,m))}function i(){clearTimeout(l),l=setTimeout(function(){var a=n.width();a!==r&&(r=a,h())},parseInt(d.resizeDelay,10))}var j,k,l,m=this,n=a(m),o=0,p=a.isFunction(d.callback),q={height:m.style.height,overflow:m.style.overflow,overflowY:m.style.overflowY,wordWrap:m.style.wordWrap,resize:m.style.resize},r=n.width();n.data("autosize")||(n.data("autosize",!0),("border-box"===n.css("box-sizing")||"border-box"===n.css("-moz-box-sizing")||"border-box"===n.css("-webkit-box-sizing"))&&(o=n.outerHeight()-n.height()),k=Math.max(parseInt(n.css("minHeight"),10)-o||0,n.height()),n.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===n.css("resize")||"vertical"===n.css("resize")?"none":"horizontal"}),"onpropertychange"in m?"oninput"in m?n.on("input.autosize keyup.autosize",h):n.on("propertychange.autosize",function(){"value"===event.propertyName&&h()}):n.on("input.autosize",h),d.resizeDelay!==!1&&a(window).on("resize.autosize",i),n.on("autosize.resize",h),n.on("autosize.resizeIncludeStyle",function(){b=null,h()}),n.on("autosize.destroy",function(){b=null,clearTimeout(l),a(window).off("resize",i),n.off("autosize").off(".autosize").css(q).removeData("autosize")}),h())})):this}}(window.jQuery||window.$);
--------------------------------------------------------------------------------
/lib/js/jquery.datepick.min.js:
--------------------------------------------------------------------------------
1 | /* http://keith-wood.name/datepick.html
2 | Date picker for jQuery v4.0.6.
3 | Written by Keith Wood (kbwood{at}iinet.com.au) February 2010.
4 | Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
5 | MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
6 | Please attribute the author if you use it. */
7 | (function($){function Datepicker(){this._defaults={pickerClass:'',showOnFocus:true,showTrigger:null,showAnim:'show',showOptions:{},showSpeed:'normal',popupContainer:null,alignment:'bottom',fixedWeeks:false,firstDay:0,calculateWeek:this.iso8601Week,monthsToShow:1,monthsOffset:0,monthsToStep:1,monthsToJump:12,useMouseWheel:true,changeMonth:true,yearRange:'c-10:c+10',shortYearCutoff:'+10',showOtherMonths:false,selectOtherMonths:false,defaultDate:null,selectDefaultDate:false,minDate:null,maxDate:null,dateFormat:'mm/dd/yyyy',autoSize:false,rangeSelect:false,rangeSeparator:' - ',multiSelect:0,multiSeparator:',',onDate:null,onShow:null,onChangeMonthYear:null,onSelect:null,onClose:null,altField:null,altFormat:null,constrainInput:true,commandsAsDateFormat:false,commands:this.commands};this.regional={'':{monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dateFormat:'mm/dd/yyyy',firstDay:0,renderer:this.defaultRenderer,prevText:'<Prev',prevStatus:'Show the previous month',prevJumpText:'<<',prevJumpStatus:'Show the previous year',nextText:'Next>',nextStatus:'Show the next month',nextJumpText:'>>',nextJumpStatus:'Show the next year',currentText:'Current',currentStatus:'Show the current month',todayText:'Today',todayStatus:'Show today\'s month',clearText:'Clear',clearStatus:'Clear all the dates',closeText:'Close',closeStatus:'Close the datepicker',yearStatus:'Change the year',monthStatus:'Change the month',weekText:'Wk',weekStatus:'Week of the year',dayStatus:'Select DD, M d, yyyy',defaultStatus:'Select a date',isRTL:false}};$.extend(this._defaults,this.regional['']);this._disabled=[]}$.extend(Datepicker.prototype,{dataName:'datepick',markerClass:'hasDatepick',_popupClass:'datepick-popup',_triggerClass:'datepick-trigger',_disableClass:'datepick-disable',_coverClass:'datepick-cover',_monthYearClass:'datepick-month-year',_curMonthClass:'datepick-month-',_anyYearClass:'datepick-any-year',_curDoWClass:'datepick-dow-',commands:{prev:{text:'prevText',status:'prevStatus',keystroke:{keyCode:33},enabled:function(a){var b=a.curMinDate();return(!b||$.datepick.add($.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),1-a.get('monthsToStep'),'m'),a),1),-1,'d').getTime()>=b.getTime())},date:function(a){return $.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),-a.get('monthsToStep'),'m'),a),1)},action:function(a){$.datepick.changeMonth(this,-a.get('monthsToStep'))}},prevJump:{text:'prevJumpText',status:'prevJumpStatus',keystroke:{keyCode:33,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||$.datepick.add($.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),1-a.get('monthsToJump'),'m'),a),1),-1,'d').getTime()>=b.getTime())},date:function(a){return $.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),-a.get('monthsToJump'),'m'),a),1)},action:function(a){$.datepick.changeMonth(this,-a.get('monthsToJump'))}},next:{text:'nextText',status:'nextStatus',keystroke:{keyCode:34},enabled:function(a){var b=a.get('maxDate');return(!b||$.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),a.get('monthsToStep'),'m'),a),1).getTime()<=b.getTime())},date:function(a){return $.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),a.get('monthsToStep'),'m'),a),1)},action:function(a){$.datepick.changeMonth(this,a.get('monthsToStep'))}},nextJump:{text:'nextJumpText',status:'nextJumpStatus',keystroke:{keyCode:34,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||$.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),a.get('monthsToJump'),'m'),a),1).getTime()<=b.getTime())},date:function(a){return $.datepick.day($.datepick._applyMonthsOffset($.datepick.add($.datepick.newDate(a.drawDate),a.get('monthsToJump'),'m'),a),1)},action:function(a){$.datepick.changeMonth(this,a.get('monthsToJump'))}},current:{text:'currentText',status:'currentStatus',keystroke:{keyCode:36,ctrlKey:true},enabled:function(a){var b=a.curMinDate();var c=a.get('maxDate');var d=a.selectedDates[0]||$.datepick.today();return(!b||d.getTime()>=b.getTime())&&(!c||d.getTime()<=c.getTime())},date:function(a){return a.selectedDates[0]||$.datepick.today()},action:function(a){var b=a.selectedDates[0]||$.datepick.today();$.datepick.showMonth(this,b.getFullYear(),b.getMonth()+1)}},today:{text:'todayText',status:'todayStatus',keystroke:{keyCode:36,ctrlKey:true},enabled:function(a){var b=a.curMinDate();var c=a.get('maxDate');return(!b||$.datepick.today().getTime()>=b.getTime())&&(!c||$.datepick.today().getTime()<=c.getTime())},date:function(a){return $.datepick.today()},action:function(a){$.datepick.showMonth(this)}},clear:{text:'clearText',status:'clearStatus',keystroke:{keyCode:35,ctrlKey:true},enabled:function(a){return true},date:function(a){return null},action:function(a){$.datepick.clear(this)}},close:{text:'closeText',status:'closeStatus',keystroke:{keyCode:27},enabled:function(a){return true},date:function(a){return null},action:function(a){$.datepick.hide(this)}},prevWeek:{text:'prevWeekText',status:'prevWeekStatus',keystroke:{keyCode:38,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||$.datepick.add($.datepick.newDate(a.drawDate),-7,'d').getTime()>=b.getTime())},date:function(a){return $.datepick.add($.datepick.newDate(a.drawDate),-7,'d')},action:function(a){$.datepick.changeDay(this,-7)}},prevDay:{text:'prevDayText',status:'prevDayStatus',keystroke:{keyCode:37,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||$.datepick.add($.datepick.newDate(a.drawDate),-1,'d').getTime()>=b.getTime())},date:function(a){return $.datepick.add($.datepick.newDate(a.drawDate),-1,'d')},action:function(a){$.datepick.changeDay(this,-1)}},nextDay:{text:'nextDayText',status:'nextDayStatus',keystroke:{keyCode:39,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||$.datepick.add($.datepick.newDate(a.drawDate),1,'d').getTime()<=b.getTime())},date:function(a){return $.datepick.add($.datepick.newDate(a.drawDate),1,'d')},action:function(a){$.datepick.changeDay(this,1)}},nextWeek:{text:'nextWeekText',status:'nextWeekStatus',keystroke:{keyCode:40,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||$.datepick.add($.datepick.newDate(a.drawDate),7,'d').getTime()<=b.getTime())},date:function(a){return $.datepick.add($.datepick.newDate(a.drawDate),7,'d')},action:function(a){$.datepick.changeDay(this,7)}}},defaultRenderer:{picker:'
'+'
{link:prev}{link:today}{link:next}
{months}'+'{popup:start}
{link:clear}{link:close}
{popup:end}'+'
',monthRow:'
{months}
',month:'
{monthHeader}
'+'
{weekHeader}{weeks}
',weekHeader:'
{days}
',dayHeader:'
{day}
',week:'
{days}
',day:'
{day}
',monthSelector:'.datepick-month',daySelector:'td',rtlClass:'datepick-rtl',multiClass:'datepick-multi',defaultClass:'',selectedClass:'datepick-selected',highlightedClass:'datepick-highlight',todayClass:'datepick-today',otherMonthClass:'datepick-other-month',weekendClass:'datepick-weekend',commandClass:'datepick-cmd',commandButtonClass:'',commandLinkClass:'',disabledClass:'datepick-disabled'},setDefaults:function(a){$.extend(this._defaults,a||{});return this},_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),_msPerDay:24*60*60*1000,ATOM:'yyyy-mm-dd',COOKIE:'D, dd M yyyy',FULL:'DD, MM d, yyyy',ISO_8601:'yyyy-mm-dd',JULIAN:'J',RFC_822:'D, d M yy',RFC_850:'DD, dd-M-yy',RFC_1036:'D, d M yy',RFC_1123:'D, d M yyyy',RFC_2822:'D, d M yyyy',RSS:'D, d M yy',TICKS:'!',TIMESTAMP:'@',W3C:'yyyy-mm-dd',formatDate:function(f,g,h){if(typeof f!='string'){h=g;g=f;f=''}if(!g){return''}f=f||this._defaults.dateFormat;h=h||{};var i=h.dayNamesShort||this._defaults.dayNamesShort;var j=h.dayNames||this._defaults.dayNames;var k=h.monthNamesShort||this._defaults.monthNamesShort;var l=h.monthNames||this._defaults.monthNames;var m=h.calculateWeek||this._defaults.calculateWeek;var n=function(a,b){var c=1;while(s+c1};var o=function(a,b,c,d){var e=''+b;if(n(a,d)){while(e.length1};var w=function(a,b){var c=v(a,b);var d=[2,3,c?4:2,11,20]['oy@!'.indexOf(a)+1];var e=new RegExp('^-?\\d{1,'+d+'}');var f=h.substring(z).match(e);if(!f){throw'Missing number at position {0}'.replace(/\{0\}/,z);}z+=f[0].length;return parseInt(f[0],10);};var x=function(a,b,c,d){var e=(v(a,d)?c:b);for(var i=0;i-1){q=1;r=s;for(var D=this.daysInMonth(p,q);r>D;D=this.daysInMonth(p,q)){q++;r-=D;}}var C=this.newDate(p,q,r);if(C.getFullYear()!=p||C.getMonth()+1!=q||C.getDate()!=r){throw'Invalid date';}return C;},determineDate:function(f,g,h,i,j){if(h&&typeof h!='object'){j=i;i=h;h=null;}if(typeof i!='string'){j=i;i='';}var k=function(a){try{return $.datepick.parseDate(i,a,j);}catch(e){}a=a.toLowerCase();var b=(a.match(/^c/)&&h?$.datepick.newDate(h):null)||$.datepick.today();var c=/([+-]?[0-9]+)\s*(d|w|m|y)?/g;var d=c.exec(a);while(d){b=$.datepick.add(b,parseInt(d[1],10),d[2]||'d');d=c.exec(a);}return b;};g=(g?$.datepick.newDate(g):null);f=(f==null?g:(typeof f=='string'?k(f):(typeof f=='number'?(isNaN(f)||f==Infinity||f==-Infinity?g:$.datepick.add($.datepick.today(),f,'d')):$.datepick.newDate(f))));return f;},daysInMonth:function(a,b){b=(a.getFullYear?a.getMonth()+1:b);a=(a.getFullYear?a.getFullYear():a);return this.newDate(a,b+1,0).getDate();},dayOfYear:function(a,b,c){var d=(a.getFullYear?a:this.newDate(a,b,c));var e=this.newDate(d.getFullYear(),1,1);return Math.floor((d.getTime()-e.getTime())/this._msPerDay)+1;},iso8601Week:function(a,b,c){var d=(a.getFullYear?new Date(a.getTime()):this.newDate(a,b,c));d.setDate(d.getDate()+4-(d.getDay()||7));var e=d.getTime();d.setMonth(0,1);return Math.floor(Math.round((e-d)/86400000)/7)+1;},today:function(){return this._normaliseDate(new Date());},newDate:function(a,b,c){return(!a?null:(a.getFullYear?this._normaliseDate(new Date(a.getTime())):new Date(a,b-1,c,12)));},_normaliseDate:function(a){if(a){a.setHours(12,0,0,0);}return a;},year:function(a,b){a.setFullYear(b);return this._normaliseDate(a);},month:function(a,b){a.setMonth(b-1);return this._normaliseDate(a);},day:function(a,b){a.setDate(b);return this._normaliseDate(a);},add:function(a,b,c){if(c=='d'||c=='w'){this._normaliseDate(a);a.setDate(a.getDate()+b*(c=='w'?7:1));}else{var d=a.getFullYear()+(c=='y'?b:0);var e=a.getMonth()+(c=='m'?b:0);a.setTime($.datepick.newDate(d,e+1,Math.min(a.getDate(),this.daysInMonth(d,e+1))).getTime());}return a;},_applyMonthsOffset:function(a,b){var c=b.get('monthsOffset');if($.isFunction(c)){c=c.apply(b.target[0],[a]);}return $.datepick.add(a,-c,'m');},_attachPicker:function(c,d){c=$(c);if(c.hasClass(this.markerClass)){return;}c.addClass(this.markerClass);var e={target:c,selectedDates:[],drawDate:null,pickingRange:false,inline:($.inArray(c[0].nodeName.toLowerCase(),['div','span'])>-1),get:function(a){var b=this.settings[a]!==undefined?this.settings[a]:$.datepick._defaults[a];if($.inArray(a,['defaultDate','minDate','maxDate'])>-1){b=$.datepick.determineDate(b,null,this.selectedDates[0],this.get('dateFormat'),e.getConfig());}return b;},curMinDate:function(){return(this.pickingRange?this.selectedDates[0]:this.get('minDate'));},getConfig:function(){return{dayNamesShort:this.get('dayNamesShort'),dayNames:this.get('dayNames'),monthNamesShort:this.get('monthNamesShort'),monthNames:this.get('monthNames'),calculateWeek:this.get('calculateWeek'),shortYearCutoff:this.get('shortYearCutoff')};}};$.data(c[0],this.dataName,e);var f=($.fn.metadata?c.metadata():{});e.settings=$.extend({},d||{},f||{});if(e.inline){e.drawDate=$.datepick._checkMinMax($.datepick.newDate(e.selectedDates[0]||e.get('defaultDate')||$.datepick.today()),e);e.prevDate=$.datepick.newDate(e.drawDate);this._update(c[0]);if($.fn.mousewheel){c.mousewheel(this._doMouseWheel);}}else{this._attachments(c,e);c.bind('keydown.'+this.dataName,this._keyDown).bind('keypress.'+this.dataName,this._keyPress).bind('keyup.'+this.dataName,this._keyUp);if(c.attr('disabled')){this.disable(c[0]);}}},options:function(a,b){var c=$.data(a,this.dataName);return(c?(b?(b=='all'?c.settings:c.settings[b]):$.datepick._defaults):{});},option:function(a,b,c){a=$(a);if(!a.hasClass(this.markerClass)){return;}b=b||{};if(typeof b=='string'){var d=b;b={};b[d]=c;}var e=$.data(a[0],this.dataName);var f=e.selectedDates;extendRemove(e.settings,b);this.setDate(a[0],f,null,false,true);e.pickingRange=false;e.drawDate=$.datepick.newDate(this._checkMinMax((b.defaultDate?e.get('defaultDate'):e.drawDate)||e.get('defaultDate')||$.datepick.today(),e));if(!e.inline){this._attachments(a,e);}if(e.inline||e.div){this._update(a[0]);}},_attachments:function(a,b){a.unbind('focus.'+this.dataName);if(b.get('showOnFocus')){a.bind('focus.'+this.dataName,this.show);}if(b.trigger){b.trigger.remove();}var c=b.get('showTrigger');b.trigger=(!c?$([]):$(c).clone().removeAttr('id').addClass(this._triggerClass)[b.get('isRTL')?'insertBefore':'insertAfter'](a).click(function(){if(!$.datepick.isDisabled(a[0])){$.datepick[$.datepick.curInst==b?'hide':'show'](a[0]);}}));this._autoSize(a,b);var d=this._extractDates(b,a.val());if(d){this.setDate(a[0],d,null,true);}if(b.get('selectDefaultDate')&&b.get('defaultDate')&&b.selectedDates.length==0){this.setDate(a[0],$.datepick.newDate(b.get('defaultDate')||$.datepick.today()));}},_autoSize:function(d,e){if(e.get('autoSize')&&!e.inline){var f=$.datepick.newDate(2009,10,20);var g=e.get('dateFormat');if(g.match(/[DM]/)){var h=function(a){var b=0;var c=0;for(var i=0;ib){b=a[i].length;c=i;}}return c;};f.setMonth(h(e.get(g.match(/MM/)?'monthNames':'monthNamesShort')));f.setDate(h(e.get(g.match(/DD/)?'dayNames':'dayNamesShort'))+20-f.getDay());}e.target.attr('size',$.datepick.formatDate(g,f,e.getConfig()).length);}},destroy:function(a){a=$(a);if(!a.hasClass(this.markerClass)){return;}var b=$.data(a[0],this.dataName);if(b.trigger){b.trigger.remove();}a.removeClass(this.markerClass).empty().unbind('.'+this.dataName);if(b.inline&&$.fn.mousewheel){a.unmousewheel();}if(!b.inline&&b.get('autoSize')){a.removeAttr('size');}$.removeData(a[0],this.dataName);},multipleEvents:function(b){var c=arguments;return function(a){for(var i=0;i').find('button,select').attr('disabled','disabled').end().find('a').removeAttr('href');}else{b.disabled=true;d.trigger.filter('button.'+this._triggerClass).attr('disabled','disabled').end().filter('img.'+this._triggerClass).css({opacity:'0.5',cursor:'default'});}this._disabled=$.map(this._disabled,function(a){return(a==b?null:a);});this._disabled.push(b);},isDisabled:function(a){return(a&&$.inArray(a,this._disabled)>-1);},show:function(c){c=c.target||c;var d=$.data(c,$.datepick.dataName);if($.datepick.curInst==d){return;}if($.datepick.curInst){$.datepick.hide($.datepick.curInst,true);}if(d){d.lastVal=null;d.selectedDates=$.datepick._extractDates(d,$(c).val());d.pickingRange=false;d.drawDate=$.datepick._checkMinMax($.datepick.newDate(d.selectedDates[0]||d.get('defaultDate')||$.datepick.today()),d);d.prevDate=$.datepick.newDate(d.drawDate);$.datepick.curInst=d;$.datepick._update(c,true);var e=$.datepick._checkOffset(d);d.div.css({left:e.left,top:e.top});var f=d.get('showAnim');var g=d.get('showSpeed');g=(g=='normal'&&$.ui&&$.ui.version>='1.8'?'_default':g);var h=function(){var a=d.div.find('.'+$.datepick._coverClass);if(a.length){var b=$.datepick._getBorders(d.div);a.css({left:-b[0],top:-b[1],width:d.div.outerWidth()+b[0],height:d.div.outerHeight()+b[1]});}};if($.effects&&$.effects[f]){var i=d.div.data();for(var j in i){if(j.match(/^ec\.storage\./)){i[j]=d._mainDiv.css(j.replace(/ec\.storage\./,''));}}d.div.data(i).show(f,d.get('showOptions'),g,h);}else{d.div[f||'show']((f?g:''),h);}if(!f){h();}}},_extractDates:function(a,b){if(b==a.lastVal){return;}a.lastVal=b;var c=a.get('dateFormat');var d=a.get('multiSelect');var f=a.get('rangeSelect');b=b.split(d?a.get('multiSeparator'):(f?a.get('rangeSeparator'):'\x00'));var g=[];for(var i=0;i').addClass(this._popupClass).css({display:(b?'none':'static'),position:'absolute',left:a.offset().left,top:a.offset().top+a.outerHeight()}).appendTo($(c.get('popupContainer')||'body'));if($.fn.mousewheel){c.div.mousewheel(this._doMouseWheel);}}c.div.html(this._generateContent(a[0],c));a.focus();}}},_updateInput:function(a,b){var c=$.data(a,this.dataName);if(c){var d='';var e='';var f=(c.get('multiSelect')?c.get('multiSeparator'):c.get('rangeSeparator'));var g=c.get('dateFormat');var h=c.get('altFormat')||g;for(var i=0;i0?f:'')+$.datepick.formatDate(g,c.selectedDates[i],c.getConfig()));e+=(i>0?f:'')+$.datepick.formatDate(h,c.selectedDates[i],c.getConfig());}if(!c.inline&&!b){$(a).val(d);}$(c.get('altField')).val(e);var j=c.get('onSelect');if(j&&!b&&!c.inSelect){c.inSelect=true;j.apply(a,[c.selectedDates]);c.inSelect=false;}}},_getBorders:function(c){var d=function(a){var b=($.browser.msie?1:0);return{thin:1+b,medium:3+b,thick:5+b}[a]||a;};return[parseFloat(d(c.css('border-left-width'))),parseFloat(d(c.css('border-top-width')))];},_checkOffset:function(a){var b=(a.target.is(':hidden')&&a.trigger?a.trigger:a.target);var c=b.offset();var d=false;$(a.target).parents().each(function(){d|=$(this).css('position')=='fixed';return!d;});if(d&&$.browser.opera){c.left-=document.documentElement.scrollLeft;c.top-=document.documentElement.scrollTop;}var e=(!$.browser.mozilla||document.doctype?document.documentElement.clientWidth:0)||document.body.clientWidth;var f=(!$.browser.mozilla||document.doctype?document.documentElement.clientHeight:0)||document.body.clientHeight;if(e==0){return c;}var g=a.get('alignment');var h=a.get('isRTL');var i=document.documentElement.scrollLeft||document.body.scrollLeft;var j=document.documentElement.scrollTop||document.body.scrollTop;var k=c.top-a.div.outerHeight()-(d&&$.browser.opera?document.documentElement.scrollTop:0);var l=c.top+b.outerHeight();var m=c.left;var n=c.left+b.outerWidth()-a.div.outerWidth()-(d&&$.browser.opera?document.documentElement.scrollLeft:0);var o=(c.left+a.div.outerWidth()-i)>e;var p=(c.top+a.target.outerHeight()+a.div.outerHeight()-j)>f;if(g=='topLeft'){c={left:m,top:k};}else if(g=='topRight'){c={left:n,top:k};}else if(g=='bottomLeft'){c={left:m,top:l};}else if(g=='bottomRight'){c={left:n,top:l};}else if(g=='top'){c={left:(h||o?n:m),top:k};}else{c={left:(h||o?n:m),top:(p?k:l)};}c.left=Math.max((d?0:i),c.left-(d?i:0));c.top=Math.max((d?0:j),c.top-(d?j:0));return c;},_checkExternalClick:function(a){if(!$.datepick.curInst){return;}var b=$(a.target);if(!b.parents().andSelf().hasClass($.datepick._popupClass)&&!b.hasClass($.datepick.markerClass)&&!b.parents().andSelf().hasClass($.datepick._triggerClass)){$.datepick.hide($.datepick.curInst);}},hide:function(b,c){var d=$.data(b,this.dataName)||b;if(d&&d==$.datepick.curInst){var e=(c?'':d.get('showAnim'));var f=d.get('showSpeed');f=(f=='normal'&&$.ui&&$.ui.version>='1.8'?'_default':f);var g=function(){d.div.remove();d.div=null;$.datepick.curInst=null;var a=d.get('onClose');if(a){a.apply(b,[d.selectedDates]);}};d.div.stop();if($.effects&&$.effects[e]){d.div.hide(e,d.get('showOptions'),f,g);}else{var h=(e=='slideDown'?'slideUp':(e=='fadeIn'?'fadeOut':'hide'));d.div[h]((e?f:''),g);}if(!e){g();}}},_keyDown:function(a){var b=a.target;var c=$.data(b,$.datepick.dataName);var d=false;if(c.div){if(a.keyCode==9){$.datepick.hide(b);}else if(a.keyCode==13){$.datepick.selectDate(b,$('a.'+c.get('renderer').highlightedClass,c.div)[0]);d=true;}else{var e=c.get('commands');for(var f in e){var g=e[f];if(g.keystroke.keyCode==a.keyCode&&!!g.keystroke.ctrlKey==!!(a.ctrlKey||a.metaKey)&&!!g.keystroke.altKey==a.altKey&&!!g.keystroke.shiftKey==a.shiftKey){$.datepick.performAction(b,f);d=true;break;}}}}else{var g=c.get('commands').current;if(g.keystroke.keyCode==a.keyCode&&!!g.keystroke.ctrlKey==!!(a.ctrlKey||a.metaKey)&&!!g.keystroke.altKey==a.altKey&&!!g.keystroke.shiftKey==a.shiftKey){$.datepick.show(b);d=true;}}c.ctrlKey=((a.keyCode<48&&a.keyCode!=32)||a.ctrlKey||a.metaKey);if(d){a.preventDefault();a.stopPropagation();}return!d;},_keyPress:function(a){var b=a.target;var c=$.data(b,$.datepick.dataName);if(c&&c.get('constrainInput')){var d=String.fromCharCode(a.keyCode||a.charCode);var e=$.datepick._allowedChars(c);return(a.metaKey||c.ctrlKey||d<' '||!e||e.indexOf(d)>-1);}return true;},_allowedChars:function(a){var b=a.get('dateFormat');var c=(a.get('multiSelect')?a.get('multiSeparator'):(a.get('rangeSelect')?a.get('rangeSeparator'):''));var d=false;var e=false;for(var i=0;i0){$.datepick.setDate(b,d,null,true);}}catch(a){}}return true;},_doMouseWheel:function(a,b){var c=($.datepick.curInst&&$.datepick.curInst.target[0])||$(a.target).closest('.'+$.datepick.markerClass)[0];if($.datepick.isDisabled(c)){return;}var d=$.data(c,$.datepick.dataName);if(d.get('useMouseWheel')){b=($.browser.opera?-b:b);b=(b<0?-1:+1);$.datepick.changeMonth(c,-d.get(a.ctrlKey?'monthsToJump':'monthsToStep')*b);}a.preventDefault();},clear:function(a){var b=$.data(a,this.dataName);if(b){b.selectedDates=[];this.hide(a);if(b.get('selectDefaultDate')&&b.get('defaultDate')){this.setDate(a,$.datepick.newDate(b.get('defaultDate')||$.datepick.today()));}else{this._updateInput(a);}}},getDate:function(a){var b=$.data(a,this.dataName);return(b?b.selectedDates:[]);},setDate:function(a,b,c,d,e){var f=$.data(a,this.dataName);if(f){if(!$.isArray(b)){b=[b];if(c){b.push(c);}}var g=f.get('dateFormat');var h=f.get('minDate');var k=f.get('maxDate');var l=f.selectedDates[0];f.selectedDates=[];for(var i=0;i=h.getTime())&&(!k||m.getTime()<=k.getTime())){var n=false;for(var j=0;jf.selectedDates[1].getTime()?f.selectedDates[0]:f.selectedDates[1]);break;}f.pickingRange=false;}f.prevDate=(f.drawDate?$.datepick.newDate(f.drawDate):null);f.drawDate=this._checkMinMax($.datepick.newDate(f.selectedDates[0]||f.get('defaultDate')||$.datepick.today()),f);if(!e){this._update(a);this._updateInput(a,d);}}},isSelectable:function(a,b){var c=$.data(a,this.dataName);if(!c){return false;}b=$.datepick.determineDate(b,c.selectedDates[0]||this.today(),null,c.get('dateFormat'),c.getConfig());return this._isSelectable(a,b,c.get('onDate'),c.get('minDate'),c.get('maxDate'));},_isSelectable:function(a,b,c,d,e){var f=(typeof c=='boolean'?{selectable:c}:(!c?{}:c.apply(a,[b,true])));return(f.selectable!=false)&&(!d||b.getTime()>=d.getTime())&&(!e||b.getTime()<=e.getTime());},performAction:function(a,b){var c=$.data(a,this.dataName);if(c&&!this.isDisabled(a)){var d=c.get('commands');if(d[b]&&d[b].enabled.apply(a,[c])){d[b].action.apply(a,[c]);}}},showMonth:function(a,b,c,d){var e=$.data(a,this.dataName);if(e&&(d!=null||(e.drawDate.getFullYear()!=b||e.drawDate.getMonth()+1!=c))){e.prevDate=$.datepick.newDate(e.drawDate);var f=this._checkMinMax((b!=null?$.datepick.newDate(b,c,1):$.datepick.today()),e);e.drawDate=$.datepick.newDate(f.getFullYear(),f.getMonth()+1,(d!=null?d:Math.min(e.drawDate.getDate(),$.datepick.daysInMonth(f.getFullYear(),f.getMonth()+1))));this._update(a);}},changeMonth:function(a,b){var c=$.data(a,this.dataName);if(c){var d=$.datepick.add($.datepick.newDate(c.drawDate),b,'m');this.showMonth(a,d.getFullYear(),d.getMonth()+1);}},changeDay:function(a,b){var c=$.data(a,this.dataName);if(c){var d=$.datepick.add($.datepick.newDate(c.drawDate),b,'d');this.showMonth(a,d.getFullYear(),d.getMonth()+1,d.getDate());}},_checkMinMax:function(a,b){var c=b.get('minDate');var d=b.get('maxDate');a=(c&&a.getTime()d.getTime()?$.datepick.newDate(d):a);return a;},retrieveDate:function(a,b){var c=$.data(a,this.dataName);return(!c?null:this._normaliseDate(new Date(parseInt(b.className.replace(/^.*dp(-?\d+).*$/,'$1'),10))));},selectDate:function(a,b){var c=$.data(a,this.dataName);if(c&&!this.isDisabled(a)){var d=this.retrieveDate(a,b);var e=c.get('multiSelect');var f=c.get('rangeSelect');if(e){var g=false;for(var i=0;i':'');var r=i.get('commands');var s=i.get('commandsAsDateFormat');var t=function(a,b,c,d,e){if(q.indexOf('{'+a+':'+d+'}')==-1){return;}var f=r[d];var g=(s?f.date.apply(h,[i]):null);q=q.replace(new RegExp('\\{'+a+':'+d+'\\}','g'),'<'+b+(f.status?' title="'+i.get(f.status)+'"':'')+' class="'+j.commandClass+' '+j.commandClass+'-'+d+' '+e+(f.enabled(i)?'':' '+j.disabledClass)+'">'+(g?$.datepick.formatDate(i.get(f.text),g,i.getConfig()):i.get(f.text))+''+c+'>');};for(var u in r){t('button','button type="button"','button',u,j.commandButtonClass);t('link','a href="javascript:void(0)"','a',u,j.commandLinkClass);}q=$(q);if(k[1]>1){var v=0;$(j.monthSelector,q).each(function(){var a=++v%k[1];$(this).addClass(a==1?'first':(a==0?'last':''));});}var w=this;q.find(j.daySelector+' a').hover(function(){$(this).addClass(j.highlightedClass);},function(){(i.inline?$(this).parents('.'+w.markerClass):i.div).find(j.daySelector+' a').removeClass(j.highlightedClass);}).click(function(){w.selectDate(h,this);}).end().find('select.'+this._monthYearClass+':not(.'+this._anyYearClass+')').change(function(){var a=$(this).val().split('/');w.showMonth(h,parseInt(a[1],10),parseInt(a[0],10));}).end().find('select.'+this._anyYearClass).click(function(){$(this).css('visibility','hidden').next('input').css({left:this.offsetLeft,top:this.offsetTop,width:this.offsetWidth,height:this.offsetHeight}).show().focus();}).end().find('input.'+w._monthYearClass).change(function(){try{var a=parseInt($(this).val(),10);a=(isNaN(a)?i.drawDate.getFullYear():a);w.showMonth(h,a,i.drawDate.getMonth()+1,i.drawDate.getDate());}catch(e){alert(e);}}).keydown(function(a){if(a.keyCode==13){$(a.target).change();}else if(a.keyCode==27){$(a.target).hide().prev('select').css('visibility','visible');i.target.focus();}});q.find('.'+j.commandClass).click(function(){if(!$(this).hasClass(j.disabledClass)){var a=this.className.replace(new RegExp('^.*'+j.commandClass+'-([^ ]+).*$'),'$1');$.datepick.performAction(h,a);}});if(i.get('isRTL')){q.addClass(j.rtlClass);}if(k[0]*k[1]>1){q.addClass(j.multiClass);}var x=i.get('pickerClass');if(x){q.addClass(x);}$('body').append(q);var y=0;q.find(j.monthSelector).each(function(){y+=$(this).outerWidth();});q.width(y/k[0]);var z=i.get('onShow');if(z){z.apply(h,[q,i]);}return q;},_generateMonth:function(a,b,c,d,e,f){var g=$.datepick.daysInMonth(c,d);var h=b.get('monthsToShow');h=($.isArray(h)?h:[1,h]);var j=b.get('fixedWeeks')||(h[0]*h[1]>1);var k=b.get('firstDay');var l=($.datepick.newDate(c,d,1).getDay()-k+7)%7;var m=(j?6:Math.ceil((l+g)/7));var n=b.get('showOtherMonths');var o=b.get('selectOtherMonths')&&n;var p=b.get('dayStatus');var q=(b.pickingRange?b.selectedDates[0]:b.get('minDate'));var r=b.get('maxDate');var s=b.get('rangeSelect');var t=b.get('onDate');var u=e.week.indexOf('{weekOfYear}')>-1;var v=b.get('calculateWeek');var w=$.datepick.today();var x=$.datepick.newDate(c,d,1);$.datepick.add(x,-l-(j&&(x.getDay()==k)?7:0),'d');var y=x.getTime();var z='';for(var A=0;A'+(v?v(x):0)+'');var C='';for(var D=0;D<7;D++){var E=false;if(s&&b.selectedDates.length>0){E=(x.getTime()>=b.selectedDates[0]&&x.getTime()<=b.selectedDates[1]);}else{for(var i=0;i'+(n||(x.getMonth()+1)==d?F.content||x.getDate():' ')+(G?'':''));$.datepick.add(x,1,'d');y=x.getTime();}z+=this._prepare(e.week,b).replace(/\{days\}/g,C).replace(/\{weekOfYear\}/g,B);}var H=this._prepare(e.month,b).match(/\{monthHeader(:[^\}]+)?\}/);H=(H[0].length<=13?'MM yyyy':H[0].substring(13,H[0].length-1));H=(f?this._generateMonthSelection(b,c,d,q,r,H,e):$.datepick.formatDate(H,$.datepick.newDate(c,d,1),b.getConfig()));var I=this._prepare(e.weekHeader,b).replace(/\{days\}/g,this._generateDayHeaders(b,e));return this._prepare(e.month,b).replace(/\{monthHeader(:[^\}]+)?\}/g,H).replace(/\{weekHeader\}/g,I).replace(/\{weeks\}/g,z);},_generateDayHeaders:function(a,b){var c=a.get('firstDay');var d=a.get('dayNames');var e=a.get('dayNamesMin');var f='';for(var g=0;g<7;g++){var h=(g+c)%7;f+=this._prepare(b.dayHeader,a).replace(/\{day\}/g,''+e[h]+'');}return f;},_generateMonthSelection:function(a,b,c,d,e,f){if(!a.get('changeMonth')){return $.datepick.formatDate(f,$.datepick.newDate(b,c,1),a.getConfig());}var g=a.get('monthNames'+(f.match(/mm/i)?'':'Short'));var h=f.replace(/m+/i,'\\x2E').replace(/y+/i,'\\x2F');var i='';h=h.replace(/\\x2E/,i);var j=a.get('yearRange');if(j=='any'){i=''+'';}else{j=j.split(':');var k=$.datepick.today().getFullYear();var l=(j[0].match('c[+-].*')?b+parseInt(j[0].substring(1),10):((j[0].match('[+-].*')?k:0)+parseInt(j[0],10)));var n=(j[1].match('c[+-].*')?b+parseInt(j[1].substring(1),10):((j[1].match('[+-].*')?k:0)+parseInt(j[1],10)));i='';}h=h.replace(/\\x2F/,i);return h;},_prepare:function(e,f){var g=function(a,b){while(true){var c=e.indexOf('{'+a+':start}');if(c==-1){return;}var d=e.substring(c).indexOf('{'+a+':end}');if(d>-1){e=e.substring(0,c)+(b?e.substr(c+a.length+8,d-a.length-8):'')+e.substring(c+d+a.length+6);}}};g('inline',f.inline);g('popup',!f.inline);var h=/\{l10n:([^\}]+)\}/;var i=null;while(i=h.exec(e)){e=e.replace(i[0],f.get(i[1]));}return e;}});function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a;};$.fn.datepick=function(a){var b=Array.prototype.slice.call(arguments,1);if($.inArray(a,['getDate','isDisabled','isSelectable','options','retrieveDate'])>-1){return $.datepick[a].apply($.datepick,[this[0]].concat(b));}return this.each(function(){if(typeof a=='string'){$.datepick[a].apply($.datepick,[this].concat(b))}else{$.datepick._attachPicker(this,a||{})}})};$.datepick=new Datepicker();$(function(){$(document).mousedown($.datepick._checkExternalClick).resize(function(){$.datepick.hide($.datepick.curInst)})})})(jQuery);
--------------------------------------------------------------------------------
/lib/js/rkv.repo.admin.js:
--------------------------------------------------------------------------------
1 | /*!
2 | Autosize v1.18.4 - 2014-01-11
3 | Automatically adjust textarea height based on user input.
4 | (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize
5 | license: http://www.opensource.org/licenses/mit-license.php
6 | */
7 | !function(a){var b,c={className:"autosizejs",append:"",callback:!1,resizeDelay:10,placeholder:!0},d='',e=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],f=a(d).data("autosize",!0)[0];f.style.lineHeight="99px","99px"===a(f).css("lineHeight")&&e.push("lineHeight"),f.style.lineHeight="",a.fn.autosize=function(d){return this.length?(d=a.extend({},c,d||{}),f.parentNode!==document.body&&a(document.body).append(f),this.each(function(){function c(){var b,c=window.getComputedStyle?window.getComputedStyle(m,null):!1;c?(b=m.getBoundingClientRect().width,0===b&&(b=parseInt(c.width,10)),a.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(a,d){b-=parseInt(c[d],10)})):b=Math.max(n.width(),0),f.style.width=b+"px"}function g(){var g={};if(b=m,f.className=d.className,j=parseInt(n.css("maxHeight"),10),a.each(e,function(a,b){g[b]=n.css(b)}),a(f).css(g),c(),window.chrome){var h=m.style.width;m.style.width="0px";{m.offsetWidth}m.style.width=h}}function h(){var e,h;b!==m?g():c(),f.value=!m.value&&d.placeholder?(a(m).attr("placeholder")||"")+d.append:m.value+d.append,f.style.overflowY=m.style.overflowY,h=parseInt(m.style.height,10),f.scrollTop=0,f.scrollTop=9e4,e=f.scrollTop,j&&e>j?(m.style.overflowY="scroll",e=j):(m.style.overflowY="hidden",k>e&&(e=k)),e+=o,h!==e&&(m.style.height=e+"px",p&&d.callback.call(m,m))}function i(){clearTimeout(l),l=setTimeout(function(){var a=n.width();a!==r&&(r=a,h())},parseInt(d.resizeDelay,10))}var j,k,l,m=this,n=a(m),o=0,p=a.isFunction(d.callback),q={height:m.style.height,overflow:m.style.overflow,overflowY:m.style.overflowY,wordWrap:m.style.wordWrap,resize:m.style.resize},r=n.width();n.data("autosize")||(n.data("autosize",!0),("border-box"===n.css("box-sizing")||"border-box"===n.css("-moz-box-sizing")||"border-box"===n.css("-webkit-box-sizing"))&&(o=n.outerHeight()-n.height()),k=Math.max(parseInt(n.css("minHeight"),10)-o||0,n.height()),n.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===n.css("resize")||"vertical"===n.css("resize")?"none":"horizontal"}),"onpropertychange"in m?"oninput"in m?n.on("input.autosize keyup.autosize",h):n.on("propertychange.autosize",function(){"value"===event.propertyName&&h()}):n.on("input.autosize",h),d.resizeDelay!==!1&&a(window).on("resize.autosize",i),n.on("autosize.resize",h),n.on("autosize.resizeIncludeStyle",function(){b=null,h()}),n.on("autosize.destroy",function(){b=null,clearTimeout(l),a(window).off("resize",i),n.off("autosize").off(".autosize").css(q).removeData("autosize")}),h())})):this}}(window.jQuery||window.$);
8 |
9 |
10 | //********************************************************
11 | // now start the engine
12 | //********************************************************
13 | jQuery(document).ready( function($) {
14 |
15 | // **************************************************************
16 | // load datepicker
17 | // **************************************************************
18 |
19 | var icon = rkvAsset.icon;
20 | var stampfield;
21 |
22 | $( 'p.repo-cal-field' ).each(function() {
23 |
24 | stampfield = $( this ).find( 'input.repo-cal-stamp' );
25 |
26 | $( this ).find( 'input.repo-cal-text' ).datepick({
27 | defaultDate: null,
28 | selectDefaultDate: true,
29 | dateFormat: 'yyyy-mm-dd',
30 | showTrigger: icon,
31 | altField: stampfield,
32 | altFormat: '@',
33 | });
34 |
35 | });
36 |
37 | // expanding textarea fields
38 | $( 'textarea.repo-item-textarea' ).autosize();
39 |
40 |
41 | //********************************************************
42 | // media uploader for package file
43 | //********************************************************
44 |
45 | // Uploading files
46 | var file_frame;
47 | var fieldbox;
48 |
49 | jQuery( 'tr.repo-upload-item-field' ).on('click', 'input.repo-file-upload', function( event ){
50 |
51 | event.preventDefault();
52 |
53 | //get my field ID for later
54 | fieldbox = jQuery( this ).prev( 'input.repo-item-file-upload' );
55 |
56 | // If the media frame already exists, reopen it.
57 | if ( file_frame ) {
58 | file_frame.open();
59 | return;
60 | }
61 |
62 | // Create the media frame.
63 | file_frame = wp.media.frames.file_frame = wp.media({
64 | title: rkvAsset.uptitle,
65 | button: {
66 | text: rkvAsset.upbutton
67 | },
68 | multiple: false
69 | });
70 |
71 | // When an image is selected, run a callback.
72 | file_frame.on( 'select', function() {
73 | // We set multiple to false so only get one item from the uploader
74 | attachment = file_frame.state().get('selection').first().toJSON();
75 |
76 | // clear the existing value
77 | jQuery( fieldbox ).val( '' );
78 |
79 | // Populate the field with the file URL
80 | jQuery( fieldbox ).val( attachment.url );
81 |
82 | });
83 |
84 | // Finally, open the modal
85 | file_frame.open();
86 | });
87 |
88 | //********************************************************
89 | // load the uploader
90 | //********************************************************
91 |
92 | jQuery( 'tr.repo-screenshots-field' ).on( 'click', 'p.uploader-info', function( event ) {
93 |
94 | event.preventDefault();
95 |
96 | // If the media frame already exists, reopen it.
97 | if ( file_frame ) {
98 | file_frame.open();
99 | return;
100 | }
101 |
102 | // Create the media frame.
103 | file_frame = wp.media.frames.file_frame = wp.media({
104 | title: jQuery( this ).data( 'uploader_title' ),
105 | button: {
106 | text: jQuery( this ).data( 'uploader_button_text' )
107 | },
108 | multiple: false // Set to true to allow multiple files to be selected
109 | });
110 |
111 | // When an image is selected, run a callback.
112 | file_frame.on( 'select', function() {
113 | // We set multiple to false so only get one image from the uploader
114 | attachment = file_frame.state().get('selection').first().toJSON();
115 |
116 | // fetch my variables
117 | var image_id = attachment.id;
118 | var thumb_url = attachment.sizes.thumbnail.url;
119 |
120 | var thumb_show = '