From: <aut...@us...> - 2013-04-08 23:39:41
|
Revision: 496 http://upstage.svn.sourceforge.net/upstage/?rev=496&view=rev Author: aut-upstage Date: 2013-04-08 23:39:33 +0000 (Mon, 08 Apr 2013) Log Message: ----------- 09/04/2013 Craig Farrell : - added new editable stage list feature in the edit stage page. and home&stages page - fixed the bug with the edit stages buttons eg save,reset, cancel, delete . - changed the name of a method so it is more understandable Modified Paths: -------------- branches/2.4.2/config/templates/stageedit.xhtml branches/2.4.2/html/masterpage.js branches/2.4.2/html/stageedit.js branches/2.4.2/upstage/pages.py branches/2.4.2/upstage/stage.py Modified: branches/2.4.2/config/templates/stageedit.xhtml =================================================================== --- branches/2.4.2/config/templates/stageedit.xhtml 2013-04-07 22:33:07 UTC (rev 495) +++ branches/2.4.2/config/templates/stageedit.xhtml 2013-04-08 23:39:33 UTC (rev 496) @@ -13,6 +13,10 @@ Modified by Craig Farrell 02/10/2012 - changed butten layout so it is clearer to read and understand, fixed typos, changed text of headings and buttons. Modified by Scott/Gavin/Craig 10/10/2012 - Added stage_saved python variable and successMsg div Modified by Daniel 10/10/2012 - Removed divMessage and relocated successMsg div to come below the stageselection. +Modified by Craig Farrell 08/04/2013 - changed all the butten warn() numbers to do what they are meant to. eg save,delete,reset,cancel + - added the onstagelist checkbox, added text for it, added a heading for it as well. + - added an hidden input for the onstagelistMsg. + - added methods to the checkbox to call stageedit.js , so it can send message to server. --> <!include workshop_nav.inc> <script type="text/javascript"> @@ -60,6 +64,10 @@ <input type="checkbox" id="debug" name="debug" onclick="if (this.checked) {debugChecked()}else{debugUnChecked()}"/> Print debug messages on the backdrop? <br /> <br /> + <h1>Stage list</h1> <!--#(08/04/2013)Craig--> + <input type="checkbox" id="onstagelist" name="onstagelist" onclick="if (this.checked) {onStageListChecked()}else{onStageListUnChecked()}"/> + Show this stage on stage list? + <br /> <br /> <h1>Background colour</h1> <table style="padding:5px"> <tr> @@ -134,9 +142,11 @@ </td> </tr> <tr> - <td> + <td><!--#(08/04/2013)Craig--> + <input type="hidden" name="onstagelistMsg" id="onstagelistMsg" class="onstageMsg" value="%(onStageList)s"/> <input type="hidden" name="debugTextMsg" id="debugTextMsg" class="debugMsg" value="%(debugMessages)s" /> <input type="hidden" name="colors" id="colorvals" value="%(colours)s"></input> + </td> </tr> </table> @@ -147,8 +157,8 @@ <div id="submit"> <input type="hidden" name="action" value=""></input> <table> - <tr> - <td style="width:0%;"><input type="button" onclick="embedsMessage();" value="Save stage "></input></td> + <tr><!--#(08/04/2013)Craig--> + <td style="width:0%;"><input type="button" onclick="seSaveOnly();" value="Save stage "></input></td> <td style="width:0%;"><input type="button" onclick="saveStage(0);" value="Save and reload stage"></input></td> <td colspan="3" style="width:50%;"><span id="warning">Warning: This will cause the stage to reload for everyone currently on it, and you will lose the chat log.</span></td> </tr> Modified: branches/2.4.2/html/masterpage.js =================================================================== --- branches/2.4.2/html/masterpage.js 2013-04-07 22:33:07 UTC (rev 495) +++ branches/2.4.2/html/masterpage.js 2013-04-08 23:39:33 UTC (rev 496) @@ -31,6 +31,8 @@ Modified by Scott (10/10/2012) -Added navHomeUser() method, so when the user logs out it redirects to /home instead of /admin/home Modified by Scott/Craig/Gavin (10/10/2012) -Added embsMessage method to embbed the stage save success message into stageedit.xhtml Modified by Gavin (6/3/2013): Changed actions[type] to actions[5] to also delete the media on warn(type) function. + Modified by Craig Farrell (09/04/2013) - changed back to actions[type] so all the stageEdit buttens work again + - changed embedmessage method name so it is more understandable. called it seSaveOnly(); */ //Instance type variables @@ -842,7 +844,7 @@ // Gavin (6/3/13): Changed actions[type] to actions[5] to also delete the media document.getElementById("status").innerHTML = 'Sending to server, please wait...'; document.getElementById("status").style.display = "inline"; - document.rupert.action.value = actions[5]; + document.rupert.action.value = actions[type];// 09/04/2013 Craig - changed back to type so all the stageEdit buttens work again requestPage("POST", buildRequest(2),fillPage); //18/05/2011 Navigates back to stage workshop page (Vibhu Patel) /* @@ -854,7 +856,7 @@ } } -function embedsMessage() +function seSaveOnly() //09/04/2013 Craig - changed embedmessage method name so it is more understandable { doIt=confirm(warningMessages[6]); if(doIt) Modified: branches/2.4.2/html/stageedit.js =================================================================== --- branches/2.4.2/html/stageedit.js 2013-04-07 22:33:07 UTC (rev 495) +++ branches/2.4.2/html/stageedit.js 2013-04-08 23:39:33 UTC (rev 496) @@ -19,10 +19,12 @@ add a validator for the "#" key that removes "#" when the user enters it in the stage name - Created a function saveStage() that is called when the user edits the stage page and confirms, it trims the stage name value and add a alert for the "#" key - - Modified by Daniel Han 18/09/2012 - added stateNum parameter on saveStage for refresh stage or not. - + * Modified by Daniel Han 18/09/2012 - added stateNum parameter on saveStage for refresh stage or not. + + * Modified by Craig Farrell (CF) 08/04/2013 - add new methods for checking a checkbox named onstagelist(onStagelistToBeChecked(),onStageListChecked(),onStageListUnChecked() ) + - add new component(the onstagelist checkbox) which needs to be saved and restored in the state methods. + - add to the load method so it check the checkbox if stage is on then stage list */ //Instance based variables @@ -43,7 +45,7 @@ genColorTable("colorpicker"); displayAccess(); debugToBeChecked(document.rupert.debugTextMsg.value); - + var cols = document.rupert.colorvals.value; if(cols!='No stage selected') { @@ -64,6 +66,7 @@ //rm = document.getElementById("submit"); //rm.parentNode.removeChild(rm); } + onStagelistToBeChecked(document.rupert.onstagelistMsg.value);//CF: on load it checks if the stage is on the stagelist. } /** @@ -285,6 +288,7 @@ state[i+1] = document.getElementById("splash_message").value; state[i+2] = document.getElementById("debug").checked; state[i+3] = selector; + state[i+4] = document.getElementById("onstagelist").checked;//08/04/2013 -CF- add new component for the state to save } /** * Put the page back as it was. @@ -305,6 +309,7 @@ document.getElementById("debug").checked = state[i+2]; selector = state[i+3]; selectColoring(selector); + document.getElementById("onstagelist").checked = state[i+4];//08/04/2013 -CF- add new component for the state to load //alert(selector); 07/11/20101 PR - Removed, because I couldn't see the point in this state = undefined; } @@ -350,7 +355,35 @@ { document.getElementById("debugTextMsg").value='normal'; } + /** +* 08/04/2013 - by Craig Farrell. +* this method checks the onstagelist checkbox if iss is equal to 'on' +*/ +function onStagelistToBeChecked(iss){ + if(iss == 'on') + { + document.getElementById("onstagelist").checked = 'checked'; + } +} + +/** +* 08/04/2013 - by Craig Farrell. +* this method checks the onstagelist checkbox +*/ +function onStageListChecked(){ + document.getElementById("onstagelistMsg").value='on'; +} + +/** +* 08/04/2013 - by Craig Farrell. +* this method unchecks the onstagelist checkbox +*/ +function onStageListUnChecked(){ + document.getElementById("onstagelistMsg").value='off'; +} + +/** * Legacy method - Doesnt work with the new version of the site, * just left in to remind us to add in a warning if the client wants it. * @return Modified: branches/2.4.2/upstage/pages.py =================================================================== --- branches/2.4.2/upstage/pages.py 2013-04-07 22:33:07 UTC (rev 495) +++ branches/2.4.2/upstage/pages.py 2013-04-08 23:39:33 UTC (rev 496) @@ -75,7 +75,10 @@ Modified by: Daniel 17/09/2012 - Added bgcolor and stage_message on stage page to display. Modified by: Daniel 18/09/2012 - Added Save only on EditStage Modified by: Gavin 5/10/2012 - Added errorMsg variable for different error titles -Modified by: Scott/Craig/Gavin 10/10/2012 - Added stage_saved variable for saved message confirmation +Modified by: Scott/Craig/Gavin 10/10/2012 - Added stage_saved variable for saved message confirmation +Modified by: Craig Farrell 08/04/2013 - added new stagelist to home.xhtml page. + - added new stagelist to stages.xhtml page. + - added new text_onStageList. """ #standard lib @@ -563,7 +566,8 @@ def text_list(self, request): html_list = '<table id="playerAudience" class="stage_list" cellspacing="0"><tr><th> Name (url)</th><th>Players</th><th>Audience</th><th>Your Access</th></tr>' - html_list += self.collection.html_list(self.text_username(request)) + #slist = self.collection.load_StageList()#(08/04/2013) Craig + html_list += self.collection.html_list(self.text_username(request))#,slist) html_list += '</table>' return html_list @@ -603,7 +607,8 @@ def text_list(self, request): html_list = '<table id="playerAudience" class="stage_list" cellspacing="0"><tr><th> Name (url)</th><th>Players</th><th>Audience</th><th>Your Access</th></tr>' - html_list += self.collection.html_list(self.text_username(request)) + slist = self.collection.load_StageList()#(08/04/2013) Craig + html_list += self.collection.html_list(self.text_username(request),slist) html_list += '</table>' return html_list @@ -691,6 +696,12 @@ return self.stage.debugMessages else: return self.no_stage + + def text_onStageList(self, request):#(08/04/2013) Craig + if self.stage: + return self.stage.onStageList + else: + return self.no_stage def text_name(self, request): if self.stage: @@ -1612,7 +1623,8 @@ return html_list(self.childClass.list_template) html_list_text = '<table id="playerAudience" class="stage_list" cellspacing="0"><tr><th> Name (url)</th><th>Players</th><th>Audience</th><th>Your Access</th></tr>' - html_list_text += html_list(self.text_username(request)) + slist = self.collection.load_StageList()#(08/04/2013) Craig + html_list_text += html_list(self.text_username(request),slist) html_list_text += '</table>' return html_list_text Modified: branches/2.4.2/upstage/stage.py =================================================================== --- branches/2.4.2/upstage/stage.py 2013-04-07 22:33:07 UTC (rev 495) +++ branches/2.4.2/upstage/stage.py 2013-04-08 23:39:33 UTC (rev 496) @@ -35,6 +35,14 @@ Modified by: Daniel Han 11/09/2012 - Added Stage Access Checking. Modified by: Daniel 18/09/2012 - Added Save only without refreshing. Modified by: Craig Farrell 18/09/2012 - removed method call, so when set to defealt is called it doesn't unassign the media from stage. +Modified by: Craig Farrell 08/04/2013 - added new onStageList = 'on' variable && new onStageList varible to set_default() + - added new onstagelist node to load() && new onstagelist to the tree in save(). + - added new onstagelistMsg to form in the update_from_form() + - added two new methods : set_ifOnStageList() && get_ifOnStageList() + - changed parse_element to include the new onStageList Attribute. + - added new onstaglist node to write_element() + - added new load_StageList() method to make list of stage that are set to be visable on stagelist. + - changed html_list so it includes the new stagelist as well as the old && it has a save call now to update stages.xml """ #std lib @@ -78,6 +86,7 @@ toolsBgColour = '0xFFFFFF' pageBgColour = '0xFFFFFF' debugMessages = 'normal'#(12/11/08)Aaron added to displays debug messages or not 'Normal' or 'DEBUG' + onStageList = 'on'#(08/04/2013)Craig added to displays onStageList or not : 'on' or 'off' def __init__(self, ID, name=None, owner=None): @@ -116,6 +125,7 @@ self.toolsBgColour = '0xFFFFFF' self.pageBgColour = '0xFFFFFF' self.debugMessages = 'normal'#(12/11/08)Aaron added to displays debug messages or not 'Normal' or 'DEBUG' + self.onStageList = 'on'#(08/04/2013)Craig added to displays onStageList or not : 'on' or 'off' def reset(self): @@ -170,6 +180,7 @@ accessTwoNodes = tree.getElementsByTagName('access_two') accessThreeNodes = tree.getElementsByTagName('access_three') debugScreenNodes = tree.getElementsByTagName('showDebugScreen') + onStageListNodes = tree.getElementsByTagName('onstageList')#(08/04/2013)Craig try: #Heath Behrens 10/08/2011 - changed the if statements so they now check for none and process each @@ -198,6 +209,8 @@ self.access_level_three.append(x) # Heath Behrens 10/08/2011 - append the item to the list if debugScreenNodes and debugScreenNodes[0].firstChild() is not None: self.debugMessages = debugScreenNodes[0].firstChild().toxml() + if onStageListNodes and onStageListNodes[0].firstChild() is not None:#(08/04/2013)Craig + self.onStageList = onStageListNodes[0].firstChild().toxml() except Exception, e: print "Couldn't set splash message for '%s', because '%s'" % (self, e) @@ -239,6 +252,7 @@ tree['name'] = self.name tree['id'] = self.ID tree['created'] = self.created + tree['onstagelist'] =self.onStageList #(08/04/2013)Craig if self.active: tree['active'] = 'active' if self.splash_message != self.__class__.splash_message: @@ -252,6 +266,9 @@ if self.debugMessages != self.__class__.debugMessages: showDebugScreen = tree.add('showDebugScreen') showDebugScreen.text(self.debugMessages) + if self.onStageList != self.__class__.onStageList:#(08/04/2013)Craig + onstageList = tree.add('onstageList') + onstageList.text(self.onStageList) for x in self.get_avatar_list(): # log.msg("Voices: %s %s " %(x.voice,x.media.voice)) tree.add(self.avatars.typename, media=x.media.file, showname=x.show_name, @@ -294,6 +311,8 @@ nodeToolsBgColour.text(self.toolsBgColour) nodePageBgColour = tree.add('pageBgColour') nodePageBgColour.text(self.pageBgColour) + nodeOnStageList = tree.add('onStageList')#(08/04/2013)Craig + nodeOnStageList.text(self.onStageList) save_xml(tree.node, config_file) del tree @@ -455,6 +474,9 @@ if 'debugTextMsg' in form: self.debugMessages = form['debugTextMsg'][0] log.msg(self.debugMessages) + if 'onstagelistMsg' in form: #(08/04/2013)Craig + self.onStageList = form['onstagelistMsg'][0] + log.msg(self.onStageList) #log.msg('FORM: %s' %form) uploaders_collection = {} @@ -598,8 +620,15 @@ return "Player" else: return "Audience" - + #added by Craig (08/04/2013) - sets the onstagelist on or off + def set_ifOnStageList(self,iss): + if iss == 'on' or iss == 'off': + self.onStageList = iss + #added by Craig (08/04/2013) - gets the onstagelist on or off + def get_ifOnStageList(self): + return self.onStageList + # Added by Daniel (11/09/2012) - check if player is audience def isPlayerAudience(self, player): @@ -960,6 +989,7 @@ ID = node.getAttribute('id') name = node.getAttribute('name') s = _Stage(ID, name, self) + s.set_ifOnStageList((node.getAttribute('onstagelist'))) #(08/04/2013)Craig dict.__setitem__(self, ID, s) if active: s.wake() @@ -979,8 +1009,8 @@ node = root.add(self.element, id=ID, name=stage.name) if stage.active: node['active']='active' + node['onstagelist']= stage.get_ifOnStageList() #(08/04/2013)Craig - def update_from_form(self, form, player): """Delete selected stages""" log.msg("Dict (Delete) update from form called") @@ -1042,12 +1072,42 @@ def log_stage_message(self): log.msg("TRYING TO GET STAGE ID: %s" % self['id']) - - def html_list(self, playerName='', include='stage_item_set.inc'): + + #added by Craig (08/04/2013) - this gets all the stages which have been set to be on the stagelist + def load_StageList(self, xmlfile = config.STAGES_XML, element = 'stage', root = 'stages'): + log.msg("TRYING TO LOAD STAGELIST: ") + self.save() + sL = dict() + tree = microdom.parse(xmlfile)# gets tree from xml file + nodes = tree.getElementsByTagName(element) + for node in nodes: + active = node.getAttribute('active') + ID = node.getAttribute('id') + name = node.getAttribute('name') + s = _Stage(ID, name, self) + onSList = node.getAttribute('onstagelist') + if onSList == 'on':# if onstagelist is 'on', put in list. + sL[ID] = s + if active: + s.wake() + else: + s.sleep() + del tree + return sL + + + def html_list(self, playerName='',onStaList =None, include='stage_item_set.inc'): """make a list of stages as a set of table rows""" - things = [(ID.lower(), {'name': stage.name, + self.save();#(08/04/2013)Craig- makes sure the stages.xml is up to date + if onStaList != None:#(08/04/2013)Craig - change to list which is needed + things = [(ID.lower(), {'name': stage.name, 'ID': ID }) + for ID, stage in onStaList.items()] + else: + things = [(ID.lower(), {'name': stage.name, + 'ID': ID + }) for ID, stage in self.items()] things.sort() # alphabetical (note: things is schwartzian) tmpl = get_template(include) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |