/[drupal]/contributions/modules/jqp/jqp.admin.js
ViewVC logotype

Contents of /contributions/modules/jqp/jqp.admin.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sun Apr 19 10:30:22 2009 UTC (7 months, 1 week ago) by skilip
Branch: MAIN
CVS Tags: DRUPAL-6--2-0-BETA1, HEAD
Branch point for: DRUPAL-6--2
File MIME type: text/javascript
Added all files required for v.2
1 Drupal.behaviors.libraryCheckInput = function (context) {
2 $('input.form-autocomplete:not(.libraryCheckInput)', context).addClass('libraryCheckInput').bind('keyup blur', function() {
3 libraryCheckFile($(this));
4 });
5 };
6
7 /**
8 * Checks if the current input is a valid filename.
9 */
10 function libraryCheckFile(input) {
11 var basepath = Drupal.settings.basePath;
12 var input, value, type, status_image, status, extention;
13
14 value = input.val();
15 status_image = input.parents('tr').find('img');
16 type = input.parents('tr').find('td:eq(2)').text();
17 status_image.attr('src', basepath + Drupal.settings.jqp_module_path + '/loading.gif');
18
19 $.ajax({
20 url:basepath + 'jqp_ajax_check_file',
21 type:'post',
22 dataType:'json',
23 data:{path: value, type:type},
24 success:function (json) {
25 status = (json.result) ? 'ok' : 'warning';
26
27 if (json.result == true) {
28 extention = value.substr(value.lastIndexOf('.') + 1, value.length);
29 input.parents('tr').find('.form-select').val((extention == 'js' ? 'scripts' : 'stylesheets'));
30 };
31 input.parents('tr').removeClass('warning ok').addClass(status);
32 status_image.attr('src', basepath + 'misc/watchdog-' + status + '.png');
33 }
34 });
35 }

  ViewVC Help
Powered by ViewVC 1.1.2