Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1002334 // editSnippet

JavaX fragment (include)

static S editSnippet(S id, S text) {
  if (isLocalSnippetID(id)) ret "Snippet saved" with saveLocalSnippet(id, text);
  ret editSnippet(id, text,
    standardCredentialsUser(), standardCredentialsPass());
}

static S editSnippet(S id, S text, S user, S pass) {
  if (!isSnippetID(id)) fail("Need snippet ID");
  Map query = litmap("id", parseSnippetID(id),
    "text", text,
    "_user", user,
    "_pass", pass,
    "len", lUtf8(text));
  S url = tb_mainServer() + "/tb-int/update_snippet_text.php";
  S page = doPost(query, url);
  if (!page.contains("OK"))
    fail("Error editing snippet " + id + ": " + quote(page));
  ret page + " - edited " + fsI(id);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002334
Snippet name: editSnippet
Eternal ID of this version: #1002334/7
Text MD5: cc5e11a35cd74eb5f7a634fef399edcf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 09:04:10
Source code size: 678 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 774 / 1040
Version history: 6 change(s)
Referenced in: [show references]