From OpenSCADAWiki
Jump to: navigation, search

User programming API

Input part of the module object (SYS.Protocol.HTTP.{In})

  • bool setUser( string user ) — changes the user linked to the authentication session ID.
    • user — user to change.
  • bool pgAccess(string URL) — checks for accessing the page, pointed by the URL.
    • URL — URL of the checking page.
  • string pgCreator(string cnt, string rcode = "", string httpattrs = "Content-Type: text/html;charset={SYS}", string htmlHeadEls = "", string forceTmplFile = "" ) — forms for a page or a resource from the content cnt, wrapped to HTTP with the result rcode, with HTTP additional attributes httpattrs, HTML additional head's element htmlHeadEls, forced to template file forceTmplFile.
    • cnt — content of the page or the resource (images, XML, CSS, JavaScript, ...) ;
    • rcode — HTTP result code, like to "200 OK"; empty value there disables addition of the HTTP header;
    • httpattrs — additional HTTP-attributes, mostly this is "Content-Type" which by default sets to "text/html;charset={SYS}"; only for "Content-Type: text/html" will be wrapped to internal/service or force forceTmplFile HTML-template;
    • htmlHeadEls — additional HTML-header's tag, it's mostly META with "Refresh" to the specified URL;
    • forceTmplFile — force template file to override the internal/service or the main-page template.