def go(self, command, args): self.data.stateChange("feedback_start") self.data.stateChange("feedback_promptstart") print "\nFeeeeeeeeeeeedback, man." confirm = self.data.util.prompt("Send note to system guru (y/n)? ") self.data.stateChange("feedback_promptend") confirm = confirm.strip() if confirm == "y": self.data.stateChange("feedback_yesstart") self.data.stateChange("feedback_subjectpromptstart") subject = self.data.util.prompt("\nSubject: ") self.data.stateChange("feedback_subjectpromptend") self.data.stateChange("feedback_editstart") editor = Editor() theText = editor.getText() self.data.stateChange("feedback_editend") destination = self.data.getSysopId() sentId = self.data.createMessage(self.currentUser.username, destination.strip(), subject.strip(), theText) self.data.util.println("Letter saved.") self.data.stateChange("feedback_sent") self.data.stateChange("feedback_yesend") else: self.data.stateChange("feedback_declined") self.data.stateChange("feedback_end")
def post(self,subject=None,theText=None): ## Get the board object for the currently selected board board = self.data.getBoardByName(self.data.getCurrentBoard()) ## Check that we're allowed to post on it if self.data.srmcheck(board.aclid,self.currentUser.username,"POST",minlevel=board.minpostlevel): ## Get the subject of the post from the user if subject == None: subject = self.data.util.prompt("\nSubject: ") ## Launch an editor for the user and get the message text if theText == None: theText = "" editor = Editor() theText = editor.getText(text=theText) ## Confirm the user wants to go through with the posting confirm = self.data.util.yesnoprompt("Proceed? ") if confirm: ## They do, create the message sentId = self.data.createMessage(self.currentUser.username,None,subject.strip(),theText,board=self.data.getCurrentBoard()) ## Let the user know it was succesful self.data.util.println("Message posted.") ## Update the user's posting stats self.data.updateUserPosts() ## Display a cookie (it's what the old Waffle used to) cookieModule = __import__("pyffle_cookie") cookieInstance = cookieModule.PyffleModule() cookieInstance.data = self.data cookieInstance.currentUser = self.currentUser cookieInstance.go("justacookie",["justacookie"]) else: ## Secure failure self.data.util.println("Sorry, you are not allowed post on this board.")
def go(self, command, args): self.data.stateChange("feedback_start") self.data.stateChange("feedback_promptstart") print "\nFeeeeeeeeeeeedback, man." confirm = self.data.util.prompt("Send note to system guru (y/n)? ") self.data.stateChange("feedback_promptend") confirm = confirm.strip() if confirm == "y": self.data.stateChange("feedback_yesstart") self.data.stateChange("feedback_subjectpromptstart") subject = self.data.util.prompt("\nSubject: ") self.data.stateChange("feedback_subjectpromptend") self.data.stateChange("feedback_editstart") editor = Editor() theText = editor.getText() self.data.stateChange("feedback_editend") destination = self.data.getSysopId() sentId = self.data.createMessage(self.currentUser.username,destination.strip(),subject.strip(),theText) self.data.util.println("Letter saved.") self.data.stateChange("feedback_sent") self.data.stateChange("feedback_yesend") else: self.data.stateChange("feedback_declined") self.data.stateChange("feedback_end")
def sendMail(self, toname=None, subject=None, text=None): destination = toname if destination == None: self.data.stateChange("mail_sendtopromptstart") destination = self.data.util.prompt("Send MAIL to: ") self.data.stateChange("mail_sendtopromptend") if destination.strip() == "": self.data.stateChange("mail_cancelnotostart") self.data.util.println("Message cancelled") self.data.stateChange("mail_cancelnotoend") return if subject == None: self.data.stateChange("mail_sendsubjectpromptstart") subject = self.data.util.prompt("\nSubject: ") self.data.stateChange("mail_sendsubjectpromptend") if subject.strip() == "": self.data.stateChange("mail_cancelnosubjectstart") self.data.util.println("Message cancelled") self.data.stateChange("mail_cancelnosubjectend") return self.data.stateChange("mail_sendeditstart") editor = Editor() if text == None: text = "" else: print "TEXT=" + str(text) theText = editor.getText(text=text) self.data.stateChange("mail_sendeditend") sentId = self.data.createMessage(self.currentUser.username, destination.strip(), subject.strip(), theText) if sentId == None: self.data.stateChange("mail_notsentstart") self.data.util.println("Message not sent - invalid recipient") self.data.stateChange("mail_notsentend") else: self.data.stateChange("mail_sentstart") self.data.util.println("Letter saved.") self.data.stateChange("mail_sentend")
def post(self, subject=None, theText=None): ## Get the board object for the currently selected board board = self.data.getBoardByName(self.data.getCurrentBoard()) ## Check that we're allowed to post on it if self.data.srmcheck(board.aclid, self.currentUser.username, "POST", minlevel=board.minpostlevel): ## Get the subject of the post from the user if subject == None: subject = self.data.util.prompt("\nSubject: ") ## Launch an editor for the user and get the message text if theText == None: theText = "" editor = Editor() theText = editor.getText(text=theText) ## Confirm the user wants to go through with the posting confirm = self.data.util.yesnoprompt("Proceed? ") if confirm: ## They do, create the message sentId = self.data.createMessage( self.currentUser.username, None, subject.strip(), theText, board=self.data.getCurrentBoard()) ## Let the user know it was succesful self.data.util.println("Message posted.") ## Update the user's posting stats self.data.updateUserPosts() ## Display a cookie (it's what the old Waffle used to) cookieModule = __import__("pyffle_cookie") cookieInstance = cookieModule.PyffleModule() cookieInstance.data = self.data cookieInstance.currentUser = self.currentUser cookieInstance.go("justacookie", ["justacookie"]) else: ## Secure failure self.data.util.println( "Sorry, you are not allowed post on this board.")
def sendMail(self,toname = None,subject = None,text = None): destination = toname if destination == None: self.data.stateChange("mail_sendtopromptstart") destination = self.data.util.prompt("Send MAIL to: ") self.data.stateChange("mail_sendtopromptend") if destination.strip() == "": self.data.stateChange("mail_cancelnotostart") self.data.util.println("Message cancelled") self.data.stateChange("mail_cancelnotoend") return if subject == None: self.data.stateChange("mail_sendsubjectpromptstart") subject = self.data.util.prompt("\nSubject: ") self.data.stateChange("mail_sendsubjectpromptend") if subject.strip() == "": self.data.stateChange("mail_cancelnosubjectstart") self.data.util.println("Message cancelled") self.data.stateChange("mail_cancelnosubjectend") return self.data.stateChange("mail_sendeditstart") editor = Editor() if text == None: text = "" else: print "TEXT=" + str(text) theText = editor.getText(text=text) self.data.stateChange("mail_sendeditend") sentId = self.data.createMessage(self.currentUser.username,destination.strip(),subject.strip(),theText) if sentId == None: self.data.stateChange("mail_notsentstart") self.data.util.println("Message not sent - invalid recipient") self.data.stateChange("mail_notsentend") else: self.data.stateChange("mail_sentstart") self.data.util.println("Letter saved.") self.data.stateChange("mail_sentend")
def plan(self): board = self.data.getBoardByName('__pyffle_plan') if self.data.srmcheck(board.aclid,self.currentUser.username,"POST",minlevel=board.minpostlevel): ## Retrieve the existing plan, if any messageIds = self.data.getMessagesByBoardByUsername(board,currentUser.username) s = None for msgid in messageIds: for msgtext in self.data.getMessagetexts(msgid): s = s + msgtext ## Pass any existing message text to the editor editor = Editor() theText = editor.getText(text=s) confirm = self.data.util.yesnoprompt("Proceed? ") if confirm: ## delete any old plans for msgid in messageIds: self.data.deleteMessage(msgid) ## post the new plan sentId = self.data.createMessage(self.currentUser.username,currentUser.username,subject.strip(),theText,board=board) self.data.util.println("Plan posted.") else: self.data.util.println("Sorry, you are not allowed to post a plan.")