Jump to content

picyka

uniGUI Subscriber
  • Posts

    1082
  • Joined

  • Last visited

  • Days Won

    34

Everything posted by picyka

  1. I would like to generate for the domain of my system https://xxxx.domain.com.br
  2. I don't quite understand this, but does this work for domains too?
  3. A tip for those who want to copy text with few codes, I believe this could be implemented natively in unigui ServerModule -> CustomMeta <script language="JavaScript"> function addslashes(str) { return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); }; async function copyText(texto) { try { await navigator.clipboard.writeText(texto); } catch (err) { console.error('Failed to copy: ', err); } }; async function pasteText(jsName) { navigator.clipboard.readText().then(texto => { let txt = addslashes(texto); txt = txt.replace(/(?:\r\n|\r|\n)/g, '\\n'); let cmd = jsName + ".setValue('" + txt + "');"; eval(cmd); }); }; </script> procedure TUniMainModule.Copy(Control : TUniFormControl; MsgSucess : Boolean); begin var lTexto := String(Control.Text); Self.CopyStr(lTexto, MsgSucess); end; procedure TUniMainModule.CopyStr(Text: String; MsgSucess: Boolean); begin try var lTexto := TStringUtils.JsEncode(Text); var lJsString := 'copyText(' + QuotedStr(lTexto) + ');'; UniSession.JSCode(lJsString); if MsgSucess then TToastUtils.Sucess('Copiado!',True,'Sucesso',1000); except on E: Exception do TMessageUtils.Error(E.Message); end; end; procedure TUniMainModule.Paste(Control : TUniFormControl); begin try var lJsName := Control.JSName; var lJsString := 'pasteText(' + QuotedStr(lJsName) + ');'; UniSession.JSCode(lJsString); except on E: Exception do TMessageUtils.Error(E.Message); end; end; class function TStringUtils.JsEncode(const Src: String; const useNumericReference: boolean): String; var i, l: integer; Buf, P: PAnsiChar; ch: integer; begin Result := ''; l := Length(Src); if l = 0 then Exit; if useNumericReference then GetMem(Buf, l * 6) // to be on the *very* safe side else GetMem(Buf, l * 2); // to be on the *very* safe side try P := Buf; for i := low(Src) to high(Src) do begin ch := Ord(Src[i]); case ch of 8: begin // Backspace if useNumericReference then begin ALStrMove('\u0008', P, 6); Inc(P, 6); end else begin ALStrMove('\b', P, 2); Inc(P, 2); end; end; 9: begin // Tab if useNumericReference then begin ALStrMove('\u0009', P, 6); Inc(P, 6); end else begin ALStrMove('\t', P, 2); Inc(P, 2); end; end; 10: begin // New line if useNumericReference then begin ALStrMove('\u000A', P, 6); Inc(P, 6); end else begin ALStrMove('\n', P, 2); Inc(P, 2); end; end; 11: begin // Vertical tab if useNumericReference then begin ALStrMove('\u000B', P, 6); Inc(P, 6); end else begin ALStrMove('\v', P, 2); Inc(P, 2); end; end; 12: begin // Form feed if useNumericReference then begin ALStrMove('\u000C', P, 6); Inc(P, 6); end else begin ALStrMove('\f', P, 2); Inc(P, 2); end; end; 13: begin // Carriage return if useNumericReference then begin ALStrMove('\u000D', P, 6); Inc(P, 6); end else begin ALStrMove('\r', P, 2); Inc(P, 2); end; end; 34: begin // Double quote if useNumericReference then begin ALStrMove('\u0022', P, 6); Inc(P, 6); end else begin ALStrMove('\"', P, 2); Inc(P, 2); end; end; 38: begin // & ... we need to encode it because in javascript &#39; or &amp; will be converted to ' and error unterminated string ALStrMove('\u0026', P, 6); Inc(P, 6); end; 39: begin // Apostrophe or single quote if useNumericReference then begin ALStrMove('\u0027', P, 6); Inc(P, 6); end else begin ALStrMove('\''', P, 2); Inc(P, 2); end; end; 60: begin // < ... mostly to hide all </script> tag inside javascript. // http://www.wwco.com/~wls/blog/2007/04/25/using-script-in-a-javascript-literal/ ALStrMove('\u003C', P, 6); Inc(P, 6); end; 62: begin // > ... mostly to hide all HTML tag inside javascript. ALStrMove('\u003E', P, 6); Inc(P, 6); end; 92: begin // Backslash character (\). if useNumericReference then begin ALStrMove('\u005C', P, 6); Inc(P, 6); end else begin ALStrMove('\\', P, 2); Inc(P, 2); end; end; else Begin P^ := AnsiChar(ch); Inc(P); end; end; end; SetString(Result, Buf, P - Buf); finally FreeMem(Buf); end; end;
  4. picyka

    UniFileUpload

    @Farshad Mohajeri Could you apply this correction to the source?
  5. picyka

    UniFileUpload

    Version: 68 When you send a file, where its name has blank spaces, unigui is putting %20 in place of the space MultiCompleted Event Object Files Files[0].FileName
  6. perfect, thank you for always helping us.
  7. No, but I can create one, I just attached the error stack
  8. It's not hard to simulate, my case here, when I have a combo connected to a column as a filter
  9. I have these errors every day. Test_WIN-EM5F97TDNDI_20230510090448.el
  10. Could put these properties in the next build
  11. http://unigui.com/doc/online_help/setting-up-a-hyperserver-serve.htm
  12. Could you post an example?
  13. I don't know the degree of difficulty, but it would be great if you could search by the name of the font, to avoid putting duplicates or to know its index...
  14. Hi, it's me again. Does anyone have problems with excel staying in protected mode?
  15. picyka

    ajaxRequest

    Solved, Thanks for the support.
  16. picyka

    ajaxRequest

    Follow the example. Look at the code in the servermodule -> CustomMeta Also note the code in the MainModule ExecuteTimerLigacao Notice the ajax Event on UniFrame1 it never fires demo.zip
  17. picyka

    ajaxRequest

    if (Http.responseText.includes("true")) { alert(top.UniFrameGerDadosLigacoes0.JSName); top.ajaxRequest(top.UniFrameGerDadosLigacoes0.JSName, '_call', ['value=true']); } that doesn't work either..
×
×
  • Create New...