Total Complexity | 10 |
Complexity/F | 1.43 |
Lines of Code | 45 |
Function Count | 7 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | |||
6 | ;(function ($, pt) { |
||
7 | $().ready(function () { |
||
8 | $('#Form_EditForm').bind('PageSaved', function (e, b, d) { |
||
9 | var pageID = $('#Form_EditForm_ID').val(); |
||
10 | pt('sitetree').getTreeNodeByIdx(pageID).ajaxExpansion(); |
||
11 | }); |
||
12 | |||
13 | // bind the migrate form so we can properly handle a migrate |
||
14 | $('#Form_EditForm_Migrate').livequery(function () { |
||
15 | $(this).click(function () { |
||
16 | // we don't want this to be submitted via the edit form, as we want to do an ajax postback for this |
||
17 | // and not tie up the response. |
||
18 | var form = $(this).parents('form'); |
||
19 | // wrap it all up and post away! |
||
20 | var params = form.serializeArray(); |
||
21 | var postParams = {}; |
||
22 | $.each(params, function (index) { |
||
23 | postParams[this.name] = this.value; |
||
24 | }); |
||
25 | |||
26 | postParams['action_migrate'] = true; |
||
27 | statusMessage('Importing ...', 2); |
||
28 | |||
29 | $.post(form.attr('action'), postParams, function (data) { |
||
30 | |||
31 | if (data) { |
||
32 | var response = $.parseJSON(data); |
||
33 | if (response && response.status) { |
||
34 | statusMessage(response.message, 'good'); |
||
35 | } else { |
||
36 | statusMessage("There was a problem with the import"); |
||
37 | } |
||
38 | } |
||
39 | // reset the base form |
||
40 | if (pt) { |
||
41 | pt(form.attr('id')).resetElements(); |
||
42 | } |
||
43 | }); |
||
44 | return false; |
||
45 | }); |
||
46 | |||
47 | }); |
||
48 | |||
49 | }); |
||
50 | })(jQuery, $); |
||
51 |