[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/kcfinder/js/browser/ -> settings.js (source)

   1  <?php
   2  
   3  /** This file is part of KCFinder project
   4    *
   5    *      @desc Settings panel functionality
   6    *   @package KCFinder
   7    *   @version 2.21
   8    *    @author Pavel Tzonkov <[email protected]>
   9    * @copyright 2010 KCFinder Project
  10    *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
  11    *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
  12    *      @link http://kcfinder.sunhater.com
  13    */?>
  14  
  15  browser.initSettings = function() {
  16  
  17      if (!this.shows.length) {
  18          var showInputs = $('#show input[type="checkbox"]').toArray();
  19          $.each(showInputs, function (i, input) {
  20              browser.shows[i] = input.name;
  21          });
  22      }
  23  
  24      var shows = this.shows;
  25  
  26      if (!_.kuki.isSet('showname')) {
  27          _.kuki.set('showname', 'on');
  28          $.each(shows, function (i, val) {
  29              if (val != "name") _.kuki.set('show' + val, 'off');
  30          });
  31      }
  32  
  33      $('#show input[type="checkbox"]').click(function() {
  34          var kuki = $(this).get(0).checked ? 'on' : 'off';
  35          _.kuki.set('show' + $(this).get(0).name, kuki)
  36          if ($(this).get(0).checked)
  37              $('#files .file div.' + $(this).get(0).name).css('display', 'block');
  38          else
  39              $('#files .file div.' + $(this).get(0).name).css('display', 'none');
  40      });
  41  
  42      $.each(shows, function(i, val) {
  43          var checked = (_.kuki.get('show' + val) == 'on') ? 'checked' : '';
  44          $('#show input[name="' + val + '"]').attr('checked', checked);
  45      });
  46  
  47      if (!this.orders.length) {
  48          var orderInputs = $('#order input[type="radio"]').toArray();
  49          $.each(orderInputs, function (i, input) {
  50              browser.orders[i] = input.value;
  51          });
  52      }
  53  
  54      var orders = this.orders;
  55  
  56      if (!_.kuki.isSet('order'))
  57          _.kuki.set('order', 'name');
  58  
  59      if (!_.kuki.isSet('orderDesc'))
  60          _.kuki.set('orderDesc', 'off');
  61  
  62      $('#order input[value="' + _.kuki.get('order') + '"]').attr('checked', 'checked');
  63      $('#order input[name="desc"]').attr('checked',
  64          (_.kuki.get('orderDesc') == 'on') ? 'checked' : ''
  65      );
  66  
  67      $('#order input[type="radio"]').click(function() {
  68          _.kuki.set('order', $(this).get(0).value);
  69          browser.orderFiles();
  70      });
  71  
  72      $('#order input[name="desc"]').click(function() {
  73          _.kuki.set('orderDesc', $(this).get(0).checked ? "on" : "off");
  74          browser.orderFiles();
  75      });
  76  
  77      if (!_.kuki.isSet('view'))
  78          _.kuki.set('view', 'thumbs');
  79  
  80      if (_.kuki.get('view') == "list") {
  81          $('#show input').attr('checked', 'checked');
  82          $('#show input').attr('disabled', 'disabled');
  83      }
  84  
  85      $('#view input[value="' + _.kuki.get('view') + '"]').attr('checked', 'checked');
  86  
  87      $('#view input').click(function() {
  88          var view = $(this).attr('value');
  89          if (_.kuki.get('view') != view) {
  90              _.kuki.set('view', view);
  91              if (view == 'list') {
  92                  $('#show input').attr('checked', 'checked');
  93                  $('#show input').attr('disabled', 'disabled');
  94              } else {
  95                  $.each(browser.shows, function(i, val) {
  96                      if (_.kuki.get('show' + val) != "on")
  97                          $('#show input[name="' + val + '"]').attr('checked', '');
  98                  });
  99                  $('#show input').attr('disabled', '');
 100              }
 101          }
 102          browser.refresh();
 103      });
 104  };


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1