2020-12-01 15:17:48 +01:00
|
|
|
;********************************
|
|
|
|
;*
|
|
|
|
;* lweb_helper.pbi
|
|
|
|
;*
|
|
|
|
|
|
|
|
Procedure.s mimetype(file.s)
|
2024-03-13 09:23:28 +01:00
|
|
|
; TODO:Mimetype dynamic configurable via XML
|
2023-03-29 10:43:54 +02:00
|
|
|
Select LCase(file)
|
2022-02-17 13:21:13 +01:00
|
|
|
Case "pdf"
|
|
|
|
ProcedureReturn "application/pdf"
|
|
|
|
Case "zip"
|
|
|
|
ProcedureReturn "application/zip"
|
2022-02-17 15:30:17 +01:00
|
|
|
Case "gz"
|
|
|
|
ProcedureReturn "application/gzip"
|
2022-02-17 13:21:13 +01:00
|
|
|
Case "doc"
|
|
|
|
ProcedureReturn "application/msword"
|
|
|
|
Case "xls"
|
|
|
|
ProcedureReturn "application/vnd.ms-excel"
|
|
|
|
Case "ppt"
|
|
|
|
ProcedureReturn "application/vnd.ms-powerpoint"
|
2024-03-13 09:24:00 +01:00
|
|
|
Case "ico"
|
|
|
|
ProcedureReturn "image/vnd.microsoft.icon"
|
2020-12-01 15:17:48 +01:00
|
|
|
Case "png"
|
|
|
|
ProcedureReturn "image/png"
|
|
|
|
Case "gif"
|
|
|
|
ProcedureReturn "image/gif"
|
|
|
|
Case "jpg"
|
|
|
|
ProcedureReturn "image/jpeg"
|
|
|
|
Case "jpeg"
|
|
|
|
ProcedureReturn "image/jpeg"
|
|
|
|
Case "txt"
|
|
|
|
ProcedureReturn "text/plain"
|
|
|
|
Case "html"
|
|
|
|
ProcedureReturn "text/html"
|
|
|
|
Case "htm"
|
|
|
|
ProcedureReturn "text/html"
|
|
|
|
Case "mss"
|
|
|
|
ProcedureReturn "text/html"
|
2022-02-17 13:21:13 +01:00
|
|
|
Case "php"
|
|
|
|
ProcedureReturn "text/html"
|
2020-12-01 15:17:48 +01:00
|
|
|
Case "css"
|
|
|
|
ProcedureReturn "text/css"
|
|
|
|
Case "js"
|
|
|
|
ProcedureReturn "text/javascript"
|
|
|
|
Default
|
2022-02-17 13:21:13 +01:00
|
|
|
ProcedureReturn "application/octet-stream"
|
2020-12-01 15:17:48 +01:00
|
|
|
EndSelect
|
|
|
|
EndProcedure
|
|
|
|
|
|
|
|
|
|
|
|
Procedure.s MapToJSONString(Map ConvertMap.s())
|
|
|
|
Protected MyJSON
|
|
|
|
Protected.s Response
|
|
|
|
MyJSON = CreateJSON(#PB_Any)
|
|
|
|
If MyJSON
|
|
|
|
InsertJSONMap(JSONValue(MyJSON), ConvertMap())
|
|
|
|
Response = ComposeJSON(MyJSON)
|
|
|
|
FreeJSON(MyJSON)
|
|
|
|
ProcedureReturn Response
|
|
|
|
EndIf
|
|
|
|
ProcedureReturn #error_string
|
2023-03-29 10:43:54 +02:00
|
|
|
EndProcedure
|
|
|
|
|
|
|
|
Procedure.s xml_error_debug(XMLHandle)
|
|
|
|
Define Debug_String.s
|
|
|
|
Debug_String = "XML Error:["+XMLError(XMLHandle)+"] At Line:["+Str(XMLErrorLine(XMLHandle))+"] Position:["+Str(XMLErrorPosition(XMLHandle))+"]"
|
|
|
|
ProcedureReturn Debug_String
|
2020-12-01 15:17:48 +01:00
|
|
|
EndProcedure
|