merge in WP 2.7 theme changes
[opensuse:lizards_o_o.git] / wp-content / plugins / postratings / postratings-admin-js.php
1 <?php\r
2 /*\r
3 +----------------------------------------------------------------+\r
4 |                                                                                                                                                                                       |\r
5 |       WordPress 2.1 Plugin: WP-PostRatings 1.20                                                               |\r
6 |       Copyright (c) 2007 Lester "GaMerZ" Chan                                                                 |\r
7 |                                                                                                                                                                                       |\r
8 |       File Written By:                                                                                                                                        |\r
9 |       - Lester "GaMerZ" Chan                                                                                                                  |\r
10 |       - http://lesterchan.net                                                                                                                 |\r
11 |                                                                                                                                                                                       |\r
12 |       File Information:                                                                                                                                       |\r
13 |       - Post Ratings Admin Javascript File                                                                                    |\r
14 |       - wp-content/plugins/postratings/postratings-admin-js.php                       |\r
15 |                                                                                                                                                                                       |\r
16 +----------------------------------------------------------------+\r
17 */\r
18 \r
19 \r
20 ### Include wp-config.php\r
21 @require('../../../wp-config.php');\r
22 cache_javascript_headers();\r
23 \r
24 \r
25 ### Determine postratings-admin-ajax.php Path\r
26 $postratings_admin_ajax_url = dirname($_SERVER['PHP_SELF']);\r
27 if(substr($postratings_admin_ajax_url, -1) == '/') {\r
28         $postratings_admin_ajax_url  = substr($postratings_admin_ajax_url, 0, -1);\r
29 }\r
30 ?>\r
31 // Variables\r
32 var postratings_admin_ajax_url = "<?php echo $postratings_admin_ajax_url; ?>/postratings-admin-ajax.php";\r
33 var postratings_admin = new sack(postratings_admin_ajax_url);\r
34 \r
35 \r
36 // Function: Hide PostRatings Loading\r
37 function postratings_admin_hide_loading() {\r
38         document.getElementById('postratings_loading').style.display = 'none';\r
39 }\r
40 \r
41 \r
42 // Function: Update Rating Text, Rating Value\r
43 function update_rating_text_value() {\r
44         image_form = document.getElementsByName('postratings_image');\r
45         for (var i=0; i < image_form.length; i++) {\r
46                 if (image_form[i].checked) {\r
47                         image = image_form[i].value;\r
48                 }\r
49         }\r
50         max = document.getElementById('postratings_max').value;\r
51         custom = document.getElementById('postratings_customrating').value;\r
52         document.getElementById('postratings_loading').style.display = 'block';\r
53         postratings_admin.reset();\r
54         postratings_admin.setVar("custom", custom);\r
55         postratings_admin.setVar("image", image);\r
56         postratings_admin.setVar("max", max);\r
57         postratings_admin.method = 'GET';\r
58         postratings_admin.element = 'rating_text_value';\r
59         postratings_admin.onCompletion = postratings_admin_hide_loading;\r
60         postratings_admin.runAJAX();\r
61 }