//~OPTIONS
{
  include: ["fcf:NSystem/languages.js", "files-tabs/styles.css"],
  access:  ["root"],
}

//~ARGUMENTS
{
  languages: fcf.argVal(fcf.NTools.languages.getLanguages()),
  files:     fcf.argProg(),
}

//~TEMPLATE
<h4>!{{Translation files}}!:</h4>
@{{
  render.template("@controls:table", {
      value: fcf.argRef("files"),
      outputRowCount: 10,
      dragable: true,
      enableToolbar: true,
      enableSearch:  true,
      toolbarLeftItems: fcf.argVal([
        fcf.argTmpl("@controls:button", {title: "!{{New}}!", fcfEventClick: "parent.getParent().onNew(wrapper)"}),
        fcf.argTmpl("@controls:button", {title: "!{{Append}}!", fcfEventClick: "parent.getParent().onAppend(wrapper)"}),
      ]),
      columns: [
        {
          alias:          "path",
          title:          "!{{File}}!",
          type:           "string",
        },
        {
          alias:          "language",
          title:          "!{{Language}}!",
          type:           "string"
        },
        {
          alias:          "download", 
          title:          "!{{Download}}!", 
          type:           "text",
          value:          "<a href='@{fcf.getPath(record.path, false)}@' target='_blank'>download</a>",
          args:           { encodeHtml: false }
        },
        {
          alias:          "remove", 
          title:          "!{{Remove}}!", 
          type:           "text",
          template:       "@controls:button",
          args:           {
            title:          "!{{Remove}}!",
            fcfEventClick:  "parent.getParent().onRemoveFile('@{record.path}@')",
            enable:         fcf.argVal("@{{!args._notEnable}}@"),
            _notEnable:     fcf.argRecordRef("system"),
          },
        },
        {
          alias:          "enable", 
          title:          "!{{Enable}}!", 
          enableTitle:    false,
          type:           "text",
          template:       "@controls:checkbox",
        },
        {
          alias:          "editable", 
          title:          "!{{Editable}}!", 
          enableTitle:    false,
          type:           "text",
          template:       "@controls:checkbox",
        },
      ]
    });
}}@
<description>!{{List of translation files. The order of files defines the redefinition rules (from top to bottom). Use drag and drop to change the order of files.}}!</description>
<p>
<hr>
@{{ render.template("@controls:button", {fcfAlias: "save",   title: fcf.t("Save"),   enable: false, fcfEventClick: "parent.onSave()" })}}@
@{{ render.template("@controls:button", {fcfAlias: "cancel", title: fcf.t("Cancel"), enable: false, fcfEventClick: "parent.onCancel()" })}}@
</p>