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

19
LINES

< > BotCompany Repo | #1002334 // editSnippet

JavaX fragment (include)

1  
static S editSnippet(S id, S text) {
2  
  if (isLocalSnippetID(id)) ret "Snippet saved" with saveLocalSnippet(id, text);
3  
  ret editSnippet(id, text,
4  
    standardCredentialsUser(), standardCredentialsPass());
5  
}
6  
7  
static S editSnippet(S id, S text, S user, S pass) {
8  
  if (!isSnippetID(id)) fail("Need snippet ID");
9  
  Map query = litmap("id", parseSnippetID(id),
10  
    "text", text,
11  
    "_user", user,
12  
    "_pass", pass,
13  
    "len", lUtf8(text));
14  
  S url = tb_mainServer() + "/tb-int/update_snippet_text.php";
15  
  S page = doPost(query, url);
16  
  if (!page.contains("OK"))
17  
    fail("Error editing snippet " + id + ": " + quote(page));
18  
  ret page + " - edited " + fsI(id);
19  
}

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: 775 / 1042
Version history: 6 change(s)
Referenced in: [show references]