lweb/inc/lweb_helper.pbi

45 lines
999 B
Text
Raw Normal View History

;********************************
;*
;* lweb_helper.pbi
;*
Procedure.s mimetype(file.s)
Select file
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"
Case "css"
ProcedureReturn "text/css"
Case "js"
ProcedureReturn "text/javascript"
Default
ProcedureReturn "text/html"
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
EndProcedure