// copyright (c) 2006-2008 Franz Inc, Oakland, CA - All rights reserved.
//
// The software, data and information contained herein are proprietary
// to, and comprise valuable trade secrets of, Franz, Inc.  They are
// given in confidence by Franz, Inc. pursuant to a written license
// agreement, and may be stored and used only in accordance with the terms
// of such license.
//
// Restricted Rights Legend
// ------------------------
// Use, duplication, and disclosure of the software, data and information
// contained herein by any agency, department or entity of the U.S.
// Government are subject to restrictions of Restricted Rights for
// Commercial Software developed at private expense as specified in
// DOD FAR Supplement 52.227-7013 (c) (1) (ii), as applicable.

// These get called from the site/stores template when the user
// creates a new store.

function newLocalStore(name, file, write) {
  activityPost("site/store/local/add", [name, file, write], "Adding store");
}

function newEmptyStore(name, file) {
  activityPost("site/store/empty/add", [name, file], "Adding store");
}

function newRemoteStore(name, file, host, port, write) {
  port = Number(port);
  if (isNaN(port) || port <= 0)
    showMessage("The port must be a positive integer.", true, true);
  else
    activityPost("site/store/remote/add", [name, file, host, port, write], "Adding store");
}

function newFederatedStore(name, stores) {
  activityPost("site/store/federated/add", [name, stores], "Adding store");
}

function deleteStore(name) {
  showDialog("Close store '" + name + "'?", ok, null, false, false);
  function ok() {
    activityPost("site/store/delete", [name], "Closing store");
  }
}

function disableStore(name) {
  activityPost("site/store/disable", [name], "Disabling store");
}
function enableStore(name) {
  activityPost("site/store/enable", [name], "Enabling store");
}