1 function update_postmeta() { |
1 function update_images() { |
2 (function($){ |
2 (function($){ |
3 setMessage("<p>"+update_message+"</p>"); |
3 setMessage( "<p>" + prtfl_var.update_img_message + "</p>" ); |
4 var curr = 0; |
4 var curr = 0; |
5 $.ajax({ |
5 $.ajax({ |
6 url: '../wp-admin/admin-ajax.php?action=prtfl_update_info',//update_url, |
6 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', |
7 type: "POST", |
7 type: "POST", |
8 data: "action1=get_portfolio_id", |
8 data: "action1=get_all_attachment" + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, |
9 success: function(result) { |
9 success: function( result ) { |
10 var list = eval('('+result+')'); |
10 var list = eval( '(' + result + ')' ); |
11 |
11 if ( ! list ) { |
12 if (!list) { |
12 setError( "<p>" + prtfl_var.not_found_img_info + "</p>" ); |
13 setError( "<p>"+not_found_info+"</p>" ); |
13 $( "#ajax_update_images" ).removeAttr( "disabled" ); |
14 $("#ajax_update_postmeta").removeAttr("disabled"); |
|
15 return; |
14 return; |
16 } |
15 } |
17 $('#prtfl_loader').show(); |
16 $( '#prtfl_img_loader' ).show(); |
18 |
|
19 function updatenItem() { |
|
20 if (curr >= list.length) { |
|
21 $.ajax({ |
|
22 url: '../wp-admin/admin-ajax.php?action=prtfl_update_info', |
|
23 type: "POST", |
|
24 data: "action1=update_options", |
|
25 success: function(result) { |
|
26 } |
|
27 }); |
|
28 $("#ajax_update_postmeta").removeAttr("disabled"); |
|
29 setMessage("<p>"+success+"</p>"); |
|
30 $('#prtfl_loader').hide(); |
|
31 return; |
|
32 } |
|
33 |
|
34 $.ajax({ |
|
35 url: '../wp-admin/admin-ajax.php?action=prtfl_update_info', |
|
36 type: "POST", |
|
37 data: "action1=update_info&id="+list[curr].ID, |
|
38 success: function(result) { |
|
39 curr = curr + 1; |
|
40 updatenItem(); |
|
41 } |
|
42 }); |
|
43 } |
|
44 |
|
45 updatenItem(); |
|
46 }, |
|
47 error: function( request, status, error ) { |
|
48 setError( "<p>"+error + request.status+"</p>" ); |
|
49 } |
|
50 }); |
|
51 })(jQuery); |
|
52 } |
|
53 |
|
54 function update_images() { |
|
55 (function($){ |
|
56 setMessage("<p>"+update_img_message+"</p>"); |
|
57 var curr = 0; |
|
58 $.ajax({ |
|
59 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image',//update_img_url, |
|
60 type: "POST", |
|
61 data: "action1=get_all_attachment", |
|
62 success: function(result) { |
|
63 var list = eval('('+result+')'); |
|
64 |
|
65 if (!list) { |
|
66 setError( "<p>"+not_found_img_info+"</p>" ); |
|
67 $("#ajax_update_images").removeAttr("disabled"); |
|
68 return; |
|
69 } |
|
70 $('#prtfl_img_loader').show(); |
|
71 |
17 |
72 function updatenImageItem() { |
18 function updatenImageItem() { |
73 if (curr >= list.length) { |
19 if ( curr >= list.length ) { |
74 $.ajax({ |
20 $.ajax({ |
75 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', |
21 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', |
76 type: "POST", |
22 type: "POST", |
77 data: "action1=update_options", |
23 data: "action1=update_options" + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, |
78 success: function(result) { |
24 success: function( result ) { |
|
25 /**/ |
79 } |
26 } |
80 }); |
27 }); |
81 $("#ajax_update_images").removeAttr("disabled"); |
28 $( "#ajax_update_images" ).removeAttr( "disabled" ); |
82 setMessage("<p>"+img_success+"</p>"); |
29 setMessage("<p>" + prtfl_var.img_success + "</p>"); |
83 $('#prtfl_img_loader').hide(); |
30 $( '#prtfl_img_loader' ).hide(); |
84 return; |
31 return; |
85 } |
32 } |
86 |
|
87 $.ajax({ |
33 $.ajax({ |
88 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', |
34 url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', |
89 type: "POST", |
35 type: "POST", |
90 data: "action1=update_image&id="+list[curr].ID, |
36 data: "action1=update_image&id=" + list[ curr ].ID + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, |
91 success: function(result) { |
37 success: function( result ) { |
92 curr = curr + 1; |
38 curr = curr + 1; |
93 updatenImageItem(); |
39 updatenImageItem(); |
94 } |
40 } |
95 }); |
41 }); |
96 } |
42 } |
97 |
43 |
98 updatenImageItem(); |
44 updatenImageItem(); |
99 }, |
45 }, |
100 error: function( request, status, error ) { |
46 error: function( request, status, error ) { |
101 setError( "<p>"+img_error + request.status+"</p>" ); |
47 setError( "<p>" + prtfl_var.img_error + request.status + "</p>" ); |
102 } |
48 } |
103 }); |
49 }); |
104 })(jQuery); |
50 })(jQuery); |
105 } |
51 } |
106 |
52 |
107 function setMessage(msg) { |
53 function setMessage( msg ) { |
108 (function($){ |
54 (function($){ |
109 $(".error").hide(); |
55 $( ".error" ).hide(); |
110 $(".updated").html(msg); |
56 $( ".updated" ).html( msg ); |
111 $(".updated").show(); |
57 $( ".updated" ).show(); |
|
58 $( '#prtfl_settings_notice' ).hide(); |
112 })(jQuery); |
59 })(jQuery); |
113 } |
60 } |
114 |
61 |
115 function setError(msg) { |
62 function setError( msg ) { |
116 (function($){ |
63 (function($){ |
117 $(".updated").hide(); |
64 $( ".updated" ).hide(); |
118 $(".error").html(msg); |
65 $( ".error" ).html( msg ); |
119 $(".error").show(); |
66 $( ".error" ).show(); |
120 })(jQuery); |
67 })(jQuery); |
121 } |
68 } |
|
69 |
|
70 (function($) { |
|
71 $(document).ready( function() { |
|
72 $( '#prtfl_form_image_size input' ).bind( "change click select", function() { |
|
73 if ( $( this ).attr( 'type' ) != 'submit' ) { |
|
74 $( '.updated.fade' ).css( 'display', 'none' ); |
|
75 $( '#prtfl_settings_notice' ).css( 'display', 'block' ); |
|
76 }; |
|
77 }); |
|
78 }); |
|
79 })(jQuery); |