showEdit: function()

in server/resources/js/ResourceDialog.js [42:76]


  showEdit: function (resource_id, canEdit) {
    Form.enable(this.formElement());
    this.setSaving(false);
    this.editMode = true;
    this.id = resource_id;
    this.canEdit = canEdit;
    this.clearErrors();
    $j('#resource_id').val(resource_id);
    var r = this.myData[resource_id]; // current resource contents
    this.currentResourceName = r['name'];
    $j('#resource_name').val(this.currentResourceName);
    var type = r['type'];
    if (r['infinite']) {
      type = "infinite"
    } else {
      type = type.toLowerCase();
    }
    $j('#resource_type option').each(function () {
      var self = $j(this);
      self.prop("selected", self.val() === type);
    });
    $j('#resource_type').trigger('change');

    $j('#resource_enabled').prop('checked', r['enabled']);

    if (type === 'quoted') {
      $j('#resource_quota').val(r['quota']);
    } else if (type === 'custom') {
      $j('#resource_quota').val(1);
      $j('#customValues').val(r['customValues'].join('\n'));
    } else {
      $j('#resource_quota').val(1);
    }
    this.showCommon();
  },