aqhome-cgi: more work

This commit is contained in:
Martin Preuss
2025-09-15 18:47:16 +02:00
parent 8f2bd23dc5
commit 7f301d271b
4 changed files with 358 additions and 430 deletions

View File

@@ -163,10 +163,6 @@ int _handleRequest(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session, const
_handleRqIndex(m, rq, session, dbuf);
else if (strcasecmp(sLastPathElem, "editmodule.html")==0)
_handleRqEditMod(m, rq, session, dbuf);
#if 0
else if (strcasecmp(sLastPathElem, "editperm.html")==0)
_handleRqEditPerm(m, rq, session, dbuf);
#endif
else if (strcasecmp(sLastPathElem, "addrole.html")==0)
_handleRqAddRole(m, rq, session, dbuf);
else if (strcasecmp(sLastPathElem, "editrole.html")==0)
@@ -353,19 +349,6 @@ void _writeEditModForm(const AQH_MODULE *currentMod, const char *sModName, GWEN_
GWEN_Buffer_AppendArgs(dbuf, "<input type=\"hidden\" name=\"module\" value=\"%s\">\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf, "<input type=\"submit\" value=\"Save\">\n</form>\n\n");
#if 0
/* write permission def list */
GWEN_Buffer_AppendString(dbuf, "<h2>Permission Definitions</h2>\n");
if (permDefList)
_writePermDefListToForm(permDefList, sModName, dbuf);
else
GWEN_Buffer_AppendString(dbuf, "<p>none</p>");
GWEN_Buffer_AppendArgs(dbuf,
"<a href=\"addperm.html?mod=%s\">"
"<img src=\"/pics/plus.png\">Add Permission</a>\n",
sModName?sModName:"");
#endif
/* write role list */
GWEN_Buffer_AppendString(dbuf, "<h2>User Roles</h2>\n");
if (roleList)
@@ -380,55 +363,6 @@ void _writeEditModForm(const AQH_MODULE *currentMod, const char *sModName, GWEN_
#if 0
void _writePermDefListToForm(const AQH_PERMDEF_LIST *permDefList, const char *sModName, GWEN_BUFFER *dbuf)
{
const AQH_PERMDEF *permDef;
GWEN_Buffer_AppendString(dbuf,
"<table class=\"datatable\">\n"
"<thead>"
"<tr><th>Id</th><th>Mask</th><th>Description</th><th>Actions</th></tr>\n"
"</thead>\n"
"<tbody>\n");
permDef=AQH_PermDef_List_First(permDefList);
while(permDef) {
const char *sId;
const char *s;
GWEN_Buffer_AppendString(dbuf, "<tr>");
/* id */
sId=AQH_PermDef_GetId(permDef);
GWEN_Buffer_AppendArgs(dbuf, "<td>%s</td>", sId?sId:"");
/* mask */
GWEN_Buffer_AppendArgs(dbuf, "<td>0x%x</td>", AQH_PermDef_GetMask(permDef));
/* description */
s=AQH_PermDef_GetDescr(permDef);
GWEN_Buffer_AppendArgs(dbuf, "<td>%s</td>", s?s:"");
/* actions */
GWEN_Buffer_AppendArgs(dbuf, "<td>");
GWEN_Buffer_AppendArgs(dbuf,
"<a href=\"editperm.html?mod=%s&id=%s\">"
"<img src=\"/pics/edit.png\"></a>",
sModName?sModName:"", sId?sId:"");
GWEN_Buffer_AppendArgs(dbuf,
"<a href=\"deleteperm.html?mod=%s&id=%s\">"
"<img src=\"/pics/minus.png\"></a>",
sModName?sModName:"", sId?sId:"");
GWEN_Buffer_AppendArgs(dbuf, "</td>");
GWEN_Buffer_AppendString(dbuf, "</tr>\n");
permDef=AQH_PermDef_List_Next(permDef);
}
GWEN_Buffer_AppendString(dbuf,
"</tbody>\n"
"</table>\n");
}
#endif
void _writeRoleListToForm(const AQH_ROLE_LIST *roleList,
const char *sModName,
const AQH_PERMDEF_LIST *permDefList,
@@ -520,6 +454,7 @@ int _handleRqEditModPost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
DBG_ERROR(NULL, "Could not save module \"%s\"", sModName);
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
AQH_Module_free(currentMod);
return 0;
}
DBG_ERROR(NULL, "Module \"%s\" saved", sModName);
@@ -538,154 +473,6 @@ int _handleRqEditModPost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
}
#if 0
int _handleRqEditPerm(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session, GWEN_BUFFER *dbuf)
{
uint32_t perms;
perms=AQH_ModService_GetUserPerms(m);
DBG_ERROR(NULL, "Perms=%08x", perms);
if (perms & AQH_MODADMMODULES_PERMS_MODULESWRITE) {
if (AQCGI_Request_GetRequestMethod(rq)==AQCGI_REQUEST_METHOD_GET)
return _handleRqEditPermGet(m, rq, session, dbuf);
else if (AQCGI_Request_GetRequestMethod(rq)==AQCGI_REQUEST_METHOD_POST)
return _handleRqEditPermPost(m, rq, session, dbuf);
else {
DBG_ERROR(NULL, "Invalid request method %d", AQCGI_Request_GetRequestMethod(rq));
AQCGI_SendResponseWithStatus(rq, 405, "Method Not Allowed");
AQCGI_Request_SetResponseCode(rq, 405);
AQCGI_Request_SetResponseText(rq, "Method Not Allowed");
}
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>No permissions to edit modules.</p>");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}
return 0;
}
int _handleRqEditPermGet(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session, GWEN_BUFFER *dbuf)
{
AQH_SERVICE *sv;
GWEN_DB_NODE *dbQuery;
const char *sModName;
const char *sId;
const char *sDescr;
uint32_t mask;
AQH_MODULE *currentMod;
const AQH_PERMDEF_LIST *permDefList;
const AQH_PERMDEF *permDef;
sv=AQH_ModService_GetService(m);
dbQuery=AQCGI_Request_GetDbQuery(rq);
sModName=dbQuery?GWEN_DB_GetCharValue(dbQuery, "mod", 0, NULL):NULL;
sId=dbQuery?GWEN_DB_GetCharValue(dbQuery, "id", 0, NULL):NULL;
currentMod=(sModName && *sModName)?AQH_Service_LoadModule(sv, sModName):NULL;
permDefList=currentMod?AQH_Module_GetPermDefList(currentMod):NULL;
permDef=(permDefList && sId && *sId)?AQH_PermDef_List_GetById(permDefList, sId):NULL;
sDescr=permDef?AQH_PermDef_GetDescr(permDef):NULL;
mask=permDef?AQH_PermDef_GetMask(permDef):0;
if (permDef) {
GWEN_Buffer_AppendArgs(dbuf, "<h2>Edit Permission Definition for Module %s</h2>\n", sModName?sModName:"");
GWEN_Buffer_AppendArgs(dbuf,
"<form action=\"editperm.html\" method=\"post\">\n"
"<table class=\"formtable\">\n"
"<tr>"
"<td><label for=\"id\">Id:</label></td>"
"<td><input type=\"text\" name=\"id\" value=\"%s\"></td>"
"</tr>\n"
"<tr>\n"
"<td><label for=\"mask\">Mask:</label></td>"
"<td><input type=\"text\" name=\"mask\" value=\"0x%lx\"></td>"
"</tr>\n"
"<tr>"
"<td><label for=\"descr\">Description:</label></td>"
"<td><input type=\"text\" name=\"descr\" value=\"%s\"></td>"
"</tr>\n",
sId, (unsigned long int) mask, sDescr?sDescr:"");
GWEN_Buffer_AppendString(dbuf, "</table>\n");
GWEN_Buffer_AppendArgs(dbuf, "<input type=\"hidden\" name=\"mod\" value=\"%s\">\n", sModName?sModName:"");
GWEN_Buffer_AppendArgs(dbuf, "<input type=\"hidden\" name=\"oldId\" value=\"%s\">\n", sId?sId:"");
GWEN_Buffer_AppendString(dbuf, "<input type=\"submit\" value=\"Save\">\n");
GWEN_Buffer_AppendString(dbuf, "</form>\n\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
return 0;
}
else {
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
return 0;
}
}
int _handleRqEditPermPost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session, GWEN_BUFFER *dbuf)
{
AQH_SERVICE *sv;
GWEN_DB_NODE *dbPost;
const char *sModName;
AQH_MODULE *currentMod;
const char *sOldId;
const char *sNewId;
const char *sDescr;
const char *sMask;
uint32_t mask=0;
AQH_PERMDEF_LIST *permDefList;
AQH_PERMDEF *permDef;
long int i;
int rv;
/* sample data */
sv=AQH_ModService_GetService(m);
dbPost=AQCGI_Request_GetDbPostBody(rq);
sModName=dbPost?GWEN_DB_GetCharValue(dbPost, "mod", 0, NULL):NULL;
currentMod=(sModName && *sModName)?AQH_Service_LoadModule(sv, sModName):NULL;
sOldId=dbPost?GWEN_DB_GetCharValue(dbPost, "oldId", 0, NULL):NULL;
sNewId=dbPost?GWEN_DB_GetCharValue(dbPost, "id", 0, NULL):NULL;
sDescr=dbPost?GWEN_DB_GetCharValue(dbPost, "descr", 0, NULL):NULL;
sMask=dbPost?GWEN_DB_GetCharValue(dbPost, "mask", 0, NULL):NULL;
if (sMask && *sMask && 1==sscanf(sMask, "%li", &i))
mask=i;
permDefList=currentMod?AQH_Module_GetPermDefList(currentMod):NULL;
permDef=(permDefList && sOldId)?AQH_PermDef_List_GetById(permDefList, sOldId):NULL;
/* validate */
if (mask==0) {
DBG_ERROR(NULL, "Invalid value for mask");
}
if (permDef==NULL) {
DBG_ERROR(NULL, "PermDef %s not found", sOldId?sOldId:NULL);
}
/* set new values */
AQH_PermDef_SetId(permDef, sNewId);
AQH_PermDef_SetMask(permDef, mask);
AQH_PermDef_SetDescr(permDef, sDescr);
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<h2>Error</h2><p>Error saving module</p>");
DBG_ERROR(NULL, "Could not save module \"%s\"", sModName);
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
return 0;
}
#endif
int _handleRqAddRole(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session, GWEN_BUFFER *dbuf)
{
@@ -731,43 +518,52 @@ int _handleRqAddRoleGet(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
guestPerms=currentMod?AQH_Module_GetGuestPerms(currentMod):0;
permDefList=currentMod?AQH_Module_GetPermDefList(currentMod):NULL;
if (permDefList) {
GWEN_Buffer_AppendArgs(dbuf, "<h2>Add Role for Module %s</h2>\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf,
"<form action=\"addrole.html\" method=\"post\">\n"
"<table class=\"formtable\">\n"
"<tr>"
"<td><label for=\"name\">Name:</label></td>"
"<td><input type=\"text\" name=\"name\"></td>"
"<tr>"
"<td><label for=\"descr\">Description:</label></td>"
"<td><input type=\"text\" name=\"descr\"></td>"
"</tr>\n");
if (currentMod) {
if (permDefList) {
GWEN_Buffer_AppendArgs(dbuf, "<h2>Add Role for Module %s</h2>\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf,
"<form action=\"addrole.html\" method=\"post\">\n"
"<table class=\"formtable\">\n"
"<tr>"
"<td><label for=\"name\">Name:</label></td>"
"<td><input type=\"text\" name=\"name\"></td>"
"<tr>"
"<td><label for=\"descr\">Description:</label></td>"
"<td><input type=\"text\" name=\"descr\"></td>"
"</tr>\n");
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Permissions:</label></td><td>");
_writePermissionsToForm(permDefList, guestPerms, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Permissions:</label></td><td>");
_writePermissionsToForm(permDefList, guestPerms, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
#if 0
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Explicitly add permissions:</label></td><td>");
_writePermissionsToForm(permDefList, 0, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Explicitly add permissions:</label></td><td>");
_writePermissionsToForm(permDefList, 0, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Explicitly sub permissions:</label></td><td>");
_writePermissionsToForm(permDefList, 0, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
GWEN_Buffer_AppendString(dbuf, "<tr><td><label>Explicitly sub permissions:</label></td><td>");
_writePermissionsToForm(permDefList, 0, dbuf);
GWEN_Buffer_AppendString(dbuf, "</td></tr>\n");
#endif
GWEN_Buffer_AppendString(dbuf, "</table>\n");
GWEN_Buffer_AppendArgs(dbuf, "<input type=\"hidden\" name=\"mod\" value=\"%s\">\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf, "<input type=\"submit\" value=\"Add\">\n");
GWEN_Buffer_AppendString(dbuf, "</form>\n\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
GWEN_Buffer_AppendString(dbuf, "</table>\n");
GWEN_Buffer_AppendArgs(dbuf, "<input type=\"hidden\" name=\"mod\" value=\"%s\">\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf, "<input type=\"submit\" value=\"Add\">\n");
GWEN_Buffer_AppendString(dbuf, "</form>\n\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Please add permission definitions first.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}
AQH_Module_free(currentMod);
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Please add permission definitions first.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf, "<p>Error loading module.</p>\n");
GWEN_Buffer_AppendString(dbuf, "<p><a href=\"index.html\"> back to module list</p>\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}
@@ -792,7 +588,6 @@ int _handleRqAddRolePost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
#endif
AQH_PERMDEF_LIST *permDefList;
AQH_ROLE_LIST *roleList;
AQH_ROLE *role;
int rv;
/* sample data */
@@ -809,7 +604,7 @@ int _handleRqAddRolePost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
sDescr=dbPost?GWEN_DB_GetCharValue(dbPost, "descr", 0, NULL):NULL;
perms=(dbPost && permDefList)?_readPermissionsFromForm(dbPost, permDefList):0;
/* validate */
/* validate */
if (!(sName && *sName)) {
DBG_ERROR(NULL, "Missing value for \"name\"");
GWEN_Buffer_AppendString(dbuf, "<p>Missing name.</p>\n");
@@ -819,32 +614,44 @@ int _handleRqAddRolePost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
return 0;
}
/* set new values */
role=AQH_Role_new();
AQH_Role_SetId(role, newId);
AQH_Role_SetName(role, sName);
AQH_Role_SetDescr(role, sDescr);
AQH_Role_SetPerms(role, perms);
/* add role */
if (roleList==NULL) {
roleList=AQH_Role_List_new();
AQH_Module_SetRoleList(currentMod, roleList);
}
AQH_Role_List_Add(role, roleList);
if (currentMod) {
AQH_ROLE *role;
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
/* set new values */
role=AQH_Role_new();
AQH_Role_SetId(role, newId);
AQH_Role_SetName(role, sName);
AQH_Role_SetDescr(role, sDescr);
AQH_Role_SetPerms(role, perms);
/* add role */
if (roleList==NULL) {
roleList=AQH_Role_List_new();
AQH_Module_SetRoleList(currentMod, roleList);
}
AQH_Role_List_Add(role, roleList);
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
AQH_Module_free(currentMod);
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
AQH_Module_free(currentMod);
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Error loading module.</p>\n");
GWEN_Buffer_AppendString(dbuf, "<p><a href=\"index.html\"> back to module list</p>\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
return 0;
}
@@ -1030,24 +837,34 @@ int _handleRqEditRolePost(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session
return 0;
}
/* set new values */
AQH_Role_SetName(role, sName);
AQH_Role_SetDescr(role, sDescr);
AQH_Role_SetPerms(role, perms);
if (currentMod) {
/* set new values */
AQH_Role_SetName(role, sName);
AQH_Role_SetDescr(role, sDescr);
AQH_Role_SetPerms(role, perms);
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
AQH_Module_free(currentMod);
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
AQH_Module_free(currentMod);
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Error loading module.</p>\n");
GWEN_Buffer_AppendString(dbuf, "<p><a href=\"index.html\"> back to module list</p>\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
return 0;
}
@@ -1073,32 +890,41 @@ int _handleRqDeleteRole(AQH_MODULE *m, AQCGI_REQUEST *rq, AQH_SESSION *session,
sModName=dbQuery?GWEN_DB_GetCharValue(dbQuery, "mod", 0, NULL):NULL;
id=dbQuery?GWEN_DB_GetIntValue(dbQuery, "id", 0, 0):0;
currentMod=(sModName && *sModName)?AQH_Service_LoadModule(sv, sModName):NULL;
roleList=currentMod?AQH_Module_GetRoleList(currentMod):NULL;
role=roleList?AQH_Role_List_GetById(roleList, id):NULL;
if (currentMod) {
roleList=currentMod?AQH_Module_GetRoleList(currentMod):NULL;
role=roleList?AQH_Role_List_GetById(roleList, id):NULL;
if (role) {
int rv;
if (role) {
int rv;
AQH_Role_List_Del(role);
AQH_Role_free(role);
AQH_Role_List_Del(role);
AQH_Role_free(role);
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
AQH_Module_free(currentMod);
return 0;
}
/* save module */
rv=AQH_Service_SaveModule(sv, currentMod);
if (rv<0) {
GWEN_Buffer_AppendString(dbuf, "<p>Error saving module.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
return 0;
}
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
_setLocationHeaderForMod(rq, "editmodule.html", sModName);
AQCGI_Request_SetResponseCode(rq, 303);
AQCGI_Request_SetResponseText(rq, "See Other");
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Role not found.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}
AQH_Module_free(currentMod);
}
else {
GWEN_Buffer_AppendString(dbuf, "<p>Role not found.</p>\n");
GWEN_Buffer_AppendArgs(dbuf, "<p><a href=\"editmodule.html?name=\"%s\"> back to module</p>\n", sModName?sModName:"");
GWEN_Buffer_AppendString(dbuf, "<p>Error loading module.</p>\n");
GWEN_Buffer_AppendString(dbuf, "<p><a href=\"index.html\"> back to module list</p>\n");
AQCGI_Request_SetResponseCode(rq, 200);
AQCGI_Request_SetResponseText(rq, "Ok");
}