source: extensions/AMenuManager/js/amm_albumConfig.js @ 8962

Last change on this file since 8962 was 8962, checked in by grum, 13 years ago

release 3.0.0
fix bug:1716, bug:2128, bug:1296, bug:2052, bug:1910, bug:1723, bug:1709, bug:1680, bug:1477, bug:2129
rewrite plugin core, implement ajax interface, optimize JS

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1/**
2 * albumConfig
3 *
4 * release 1.0.0
5 */
6function albumConfig(opt, keys, token, initValues)
7{
8  var options = {
9          ajaxUrl:'plugins/AMenuManager/amm_ajax.php'
10        },
11      translatedKeys= {
12        },
13      properties = {
14          token:token
15        },
16
17
18  /**
19   * submit config
20   */
21  submit = function ()
22    {
23      if(!checkValidity()) return(false);
24
25      displayProcessing(true);
26
27      // build datas
28      var datas = {
29        selectCat:$("#iamm_album_selectedCat").categorySelector('value')
30      };
31
32
33      $.ajax(
34        {
35          type: "POST",
36          url: options.ajaxUrl,
37          async: true,
38          data: { ajaxfct:"admin.album.setConfig", token:properties.token, datas:datas },
39          success:
40            function(msg)
41            {
42              displayProcessing(false);
43
44              returned=msg.split('!');
45
46              if(returned[0]=='OK')
47              {
48                $('#iConfigState')
49                  .html(returned[1])
50                  .removeClass('errors')
51                  .addClass('infos')
52                  .css('display', 'block');
53              }
54              else
55              {
56                $('#iConfigState')
57                  .html(returned[1])
58                  .removeClass('infos')
59                  .addClass('errors')
60                  .css('display', 'block');
61              }
62            }
63        }
64      );
65    },
66
67  /**
68   * check validity of form
69   */
70  checkValidity = function ()
71    {
72      $('.error').removeClass('error');
73      ok=true;
74
75      return(ok);
76    },
77
78  /**
79   * display or hide the processing flower
80   */
81  displayProcessing = function (visible)
82    {
83      if(visible)
84      {
85        $('#iBDProcessing').css("display", "block");
86      }
87      else
88      {
89        $('#iBDProcessing').css("display", "none");
90      }
91    },
92
93  /**
94   * initialize the object and page form
95   */
96  init = function (initValues)
97  {
98    $('#iamm_album_selectedCat').categorySelector(
99      {
100        serverUrl:'plugins/GrumPluginClasses/gpc_ajax.php',
101        listMaxWidth:650,
102        listMaxHeight:550,
103        userMode:'public',
104        galleryRoot:false,
105        displayStatus:false,
106        filter:'all',
107        multiple:true,
108        load:
109          function (event)
110          {
111            $(this)
112              .categorySelector('collapse', ':all')
113              .categorySelector('value', initValues.selectCat);
114          },
115        change: function () { $('#iConfigState').hide(); }
116      }
117    );
118  };
119
120
121  $.extend(options, opt);
122  $.extend(translatedKeys, keys);
123
124  this.submit = function () { submit(); };
125
126  init(initValues);
127}
128
129
Note: See TracBrowser for help on using the repository browser.