/*
* Lots of different room-related operations.
*
- * Copyright (c) 1996-2010 by the citadel.org team
+ * Copyright (c) 1996-2012 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * modify it under the terms of the GNU General Public License, version 3.
*
* This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "webcit.h"
}
StrBufPrintf(WCC->Hdr->this_page, "dotskip?room=%s", ChrPtr(WC->CurRoom.name));
- do_template("roombanner", NULL);
-
- /* roombanner contains this for mobile */
- if (WC->is_mobile)
- return;
+ do_template("roombanner");
- do_template("navbar", NULL);
+ do_template("navbar");
wc_printf("</div>\n");
}
/****** Properties ******/
+int ConditionalRoom_MayEdit(StrBuf *Target, WCTemplputParams *TP)
+{
+ wcsession *WCC = WC;
+
+ LoadRoomXA ();
+
+ return WCC->CurRoom.XALoaded == 1;
+}
+
int ConditionalThisRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
{
long QR_CheckFlag;
{
wcsession *WCC = WC;
- return ( (WCC!= NULL) &&
- ((WCC->axlevel >= 6) ||
- ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
- (WCC->CurRoom.is_inbox) ));
+ return ( (WCC != NULL)
+ && (WCC->logged_in)
+ && (
+ (WCC->axlevel >= 6)
+ || ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0)
+ || (WCC->CurRoom.is_inbox)
+ )
+ );
}
}
+int ConditionalIsThisThatRoom(StrBuf *Target, WCTemplputParams *TP)
+{
+ folder *Folder = (folder *)CTX;
+ wcsession *WCC = WC;
+
+ if (WCC == NULL)
+ return 0;
+
+ return Folder == WCC->ThisRoom;
+}
+
+
void
InitModule_ROOMTOKENS
(void)
/**** Room... ******/
/**** Name ******/
RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
- RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
+ RegisterNamespace("THISROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
RegisterNamespace("ROOM:INFO:PRINT_NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_NONE);
RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
/****** Properties ******/
RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalThisRoomHas_QRFlag, CTX_NONE);
+ RegisterConditional(HKEY("COND:THISROOM:EDIT"), 0, ConditionalRoom_MayEdit, CTX_NONE);
RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalThisRoomHas_QRFlag2, CTX_NONE);
RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_ThisRoomDirectory, NULL, CTX_NONE);
RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, NULL, CTX_ROOMS);
+ RegisterConditional(HKEY("COND:THIS:THAT:ROOM"), 0, ConditionalIsThisThatRoom, CTX_ROOMS);
}