def addgroup_action(self, request): game = datagate.get_item(request.getvalue('itemid')) teams = game.search1(name='groups') chats = game.search1(name='chats') board = game.search1(name='board') name = request.getvalue('name', '') if name: group = datagate.create_item(creatorid=request.session.user.id, parentid=teams.id) group.name = name group.save() teamchat = datagate.create_item(creatorid=request.session.user.id, parentid=chats.id) teamchat.name = name teamchat.save() BaseView.get_view('strikecomcommenter').initialize_activity(request, teamchat)
def send_admin_page(self, request): '''Called from the administrator to allows customization of the activity''' activity = datagate.get_item(request.getvalue('itemid', '')) # the change form request.writeln('<center>') request.writeln(request.cgi_form(gm_action="GridView.rowscols", Rows=None, Columns=None, itemid=request.getvalue('itemid', ''))) request.writeln('<b>Grid Size</b>:') request.writeln('<table border=0>'); for axis, val in [ ('Rows', activity.getvalue('rows', 1)), ('Columns', activity.getvalue('cols', 1)) ]: request.writeln('<tr>') request.writeln('<td>' + axis + ':</td>') request.writeln('<td><select name="' + axis + '" onchange="javascript:form.submit()">') for i in range(1, 11): request.write('<option') if i == val: request.write(' selected') request.writeln('>' + str(i) + '</option>') request.writeln('</select></td>') request.writeln('</tr>') request.writeln('</table>') request.writeln('</form>') # display the grid for the subviews request.writeln('<p> </p>') request.writeln('<b>Grid View Types</b>') request.writeln('<table border=1 cellspacing=0 cellpadding=2>') for row in range(1, activity.getvalue('rows', 1) + 1): request.writeln('<tr>') for col in range(1, activity.getvalue('cols', 1) + 1): child = self.getview(request, activity, row, col) request.writeln('<td>') request.writeln(request.cgi_form(gm_action="GridView.changeview", childview=None, row=row, col=col, itemid=request.getvalue('itemid', ''))) request.writeln('<select name="childview" onchange="javascript:form.submit()">') for view in MeetingHome.meeting_components: comp = BaseView.get_view(view) request.write('<option') if view == child.view: request.writeln(' selected') request.writeln(' value="' + view + '">' + comp.NAME + '</option>') request.writeln('</select>') request.writeln('<br>') request.write('<center><font size="1">[ <a href="' + request.cgi_href(itemid=child.id, gm_action=None, view='Administrator', global_adminview=child.view) + '">Edit</a> ]</font></center>') request.writeln('</form>') request.writeln('</td>') request.writeln('</tr>') request.writeln('</table>') # footer request.writeln('<p><i>(Changes are saved automatically)</i><p>') request.writeln('</center>')
def send_admin_page(self, request): '''Called from the administrator to allows customization of the activity''' BaseView.get_view('rating').send_admin_page(request)
def initialize_activity(self, request, root): '''Initializes this item''' BaseView.get_view('rating').initialize_activity(request, root)