Beispiel #1
0
  private void buildJSImagesList() {
    String str = "var tinyMCEImageList = new Array(\n";
    Path dir = Paths.get(System.getProperty("user.home"), ".saas", "app", "ui", "img", "www");
    boolean isFirst = true;
    for (File f : dir.toFile().listFiles()) {
      if (f.isDirectory()) {
        continue;
      }

      String s = "[\"" + f.getName() + "\", \"img/www/" + f.getName() + "\"]";
      if (isFirst) {
        str += s;
        isFirst = false;
      } else {
        str += ",\n" + s;
      }
    }

    str += "\n);";

    Path f =
        Paths.get(System.getProperty("user.home"), ".saas", "app", "ui", "js", "image_list.js");
    try {
      Files.write(f, str.getBytes());
    } catch (IOException ex) {
      Logger.getGlobal().log(Level.WARNING, str, ex);
      JSMediator.alert(getSession(), ex.toString());
    }
  }
Beispiel #2
0
  private void savePage(String page) {
    PopupPanel popupPanel = new PopupPanel(getSession());
    popupPanel.setTitle("Сообщение");
    popupPanel.setPanel("Сохранено");

    if (core.isPageExist(selectedPage)) {
      Result r = core.modifyWWWPage(selectedPage, page);
      if (r.isError()) {
        JSMediator.alert(getSession(), r.getReason());
      } else {
        popupPanel.showPanel();
      }

    } else {
      Result r = core.addWWWPage(selectedPage, page);
      if (r.isError()) {
        JSMediator.alert(getSession(), r.getReason());
      } else {
        popupPanel.showPanel();
      }
    }
  }