/* GSWTemplates.c - GSWeb: GSWTemplates Copyright (C) 2000 Free Software Foundation, Inc. Written by: Manuel Guesdon Date: March 2000 This file is part of the GNUstep Web Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include "config.h" #include "GSWConfig.h" #include "GSWUtil.h" #include "GSWTemplates.h" //-------------------------------------------------------------------- const char* g_szErrorResponseTextTemplate[2]={ "##TEXT##", "\n" "

##TEXT##

\n" "
\n" "
\"Powered
\n" "\n"}; //-------------------------------------------------------------------- const char* g_szErrorNoResponseMessageTemplate[2]={ "##APP_NAME##:##APP_INSTANCE## (##APP_HOST##:##APP_PORT##) doesn't repond", "##APP_NAME##:##APP_INSTANCE## (##APP_HOST##:##APP_PORT##) doesn't repond"}; //-------------------------------------------------------------------- const char* g_szStatusResponseAllowedTemplate[2]={ "Server Status\n" "##SERVER_INFO## ##SERVER_URL##\n" "##ADAPTOR_INFO## ##ADAPTOR_URL##\n" "##HEADERS##\n", "Server Status\n" "\n" "
Server Adaptor:
" "

Server = ##SERVER_INFO##
\n" "Adaptor = ##ADAPTOR_INFO##

\n" "

Headers:
\n" "##HEADERS##\n" "
\n" "

\"Powered
\n" "\n"}; //-------------------------------------------------------------------- const char* g_szStatusResponseDeniedTemplate[2]={ "Don't play with me ##REMOTE_ADDR## ##REMOTE_HOST##, I'll win!\n", "Server Status\n" "\n" "

Don't play with me ##REMOTE_ADDR## ##REMOTE_HOST##, I'll win!

" "
\n" "
\"Powered
\n" "\n"}; //-------------------------------------------------------------------- const char* g_szDump_HeadTemplate[2]={ "GNUstepWeb Application\n", "Index of GNUstepWeb Applications\n" "" "

Could not find the application specified in the URL (##APP_NAME##).

\n" "

Index of GNUstepWeb Applications in ##CONF_FILE## (some applications may be down)

\n" "" "\n" "" "" "" "\n" "\n" "" "" "" "\n"}; //-------------------------------------------------------------------- const char* g_szDump_FootTemplate[2]={ "", "
NameApplication AccessInstances
#HostPort
\n" "
\n" "
\"Powered
\n" ""}; //-------------------------------------------------------------------- char* g_szDump_AppTemplate[2]={ "AppName: ##NAME##\n" "URL: ##URL##\n" "Instances:\n" "##INSTANCES##\n", "\n" "##NAME##\n" "##URL##\n" "\n" "##INSTANCES##\n" "
\n" "\n"}; //-------------------------------------------------------------------- char* g_szDump_AppInstanceTemplate[2]={ "Instance ##NUM##\n" "URL: ##URL##\n" "HOST: ##HOST##\n" "PORT: ##PORT##\n", "\n" "##NUM##\n" "##HOST##\n" "##PORT##\n" ""}; //-------------------------------------------------------------------- CONST char* GSWTemplate_ErrorResponseText(BOOL p_fHTML) { return g_szErrorResponseTextTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_ErrorNoResponseMessage(BOOL p_fHTML) { return g_szErrorNoResponseMessageTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_StatusAllowedResponse(BOOL p_fHTML) { return g_szStatusResponseAllowedTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_StatusDeniedResponse(BOOL p_fHTML) { return g_szStatusResponseDeniedTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_GetDumpHead(BOOL p_fHTML) { return g_szDump_HeadTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_GetDumpFoot(BOOL p_fHTML) { return g_szDump_FootTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_GetDumpApp(BOOL p_fHTML) { return g_szDump_AppTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- CONST char* GSWTemplate_GetDumpAppInstance(BOOL p_fHTML) { return g_szDump_AppInstanceTemplate[p_fHTML ? 1 : 0]; }; //-------------------------------------------------------------------- void GSWTemplate_ReplaceStd(GSWString* p_pString,GSWApp* p_pApp) { GSWString_SearchReplace(p_pString,"##CONF_FILE##",GSWConfig_GetConfigFilePath()); if (p_pApp) { GSWString_SearchReplace(p_pString,"##APP_NAME##",p_pApp->pszName); }; if (p_pApp && p_pApp->pszGSWExtensionsFrameworkWebServerResources) GSWString_SearchReplace(p_pString,"##GSWEXTFWKWSR##", p_pApp->pszGSWExtensionsFrameworkWebServerResources); else GSWString_SearchReplace(p_pString,"##GSWEXTFWKWSR##", GSWConfig_GetConfig()->pszGSWExtensionsFrameworkWebServerResources); };