public override void init(UserSession us) { //at the moment leaving this variable in the session even if user returns to main menu. We should remove it then also. if (us.getVariableObject(SearchTestamentHandler.SEARCH_TESTAMENT_VAR_NAME) != null) { us.deleteVariable(SearchTestamentHandler.SEARCH_TESTAMENT_VAR_NAME); } if (us.getVariableObject(SearchHandler.BOOK_SEARCH_VAR_NAME) != null) { us.deleteVariable(SearchHandler.BOOK_SEARCH_VAR_NAME); } }
public override void init(UserSession us) { if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT)) { us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT); } if (us.hasVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID)) { us.deleteVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID); } if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT)) { us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT); } }
public override void init(UserSession us) { if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT)) { us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT); } if (us.hasVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID)) { us.deleteVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID); } if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT)) { us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT); } if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST)) { us.deleteVariable(ChooseFriendHandler.RECIPIENT_LIST); } if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST)) us.removeVariable(ChooseFriendHandler.RECIPIENT_LIST); }
public override void init(UserSession us) { if (us.getVariableObject("Browse.verse_section") != null) { us.deleteVariable("Browse.verse_section"); } }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); //Console.WriteLine("in input handler: " + input); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; InputHandlerResult output = handleStdNavLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; MenuManager mm = MenuManager.getInstance(); //for now we assume this. must correct this later VerseMenuPage vmp = (VerseMenuPage)mm.menu_def.getMenuPage(curr_user_page); List<MenuOptionItem> options = vmp.options; foreach (MenuOptionItem option in options) { if (option.link_val.Equals(input)) return new InputHandlerResult( InputHandlerResult.NEW_MENU_ACTION, option.select_action, InputHandlerResult.DEFAULT_PAGE_ID); } //now handle input input = input.Trim(); if (input.Equals("")) { return new InputHandlerResult( "Invalid entry...Please enter a valid input (e.g. 'John 3:16' or '1 John 1:9' or read the help section for more information"); //invalid choice } input = input.Replace('.', ':'); Verse start_verse = null; Verse end_verse = null; if (input.Contains('-')) { String[] start_end = input.Split('-'); start_verse = getStartingVerse(user_session.user_profile.getDefaultTranslationId(), start_end[0]); if (start_verse == null) { return new InputHandlerResult( "Invalid entry...Please enter a valid input (e.g. 'John 3:16' or '1 John 1:9'"); //invalid choice } if (start_end.Count() >= 2) { end_verse = getEndingVerse(user_session.user_profile.getDefaultTranslationId(), start_verse, start_end[1]); } } else { start_verse = getStartingVerse(user_session.user_profile.getDefaultTranslationId(), input); } user_session.deleteVariable("Browse.verse_section"); try { if (end_verse == null) end_verse = start_verse; VerseSection vs = new VerseSection(start_verse, end_verse); user_session.setVariable("Browse.verse_section", vs); //now this is one big hack user_session.setVariable("Browse.directSelect", true); } catch (XInvalidVerseSection e) { return new InputHandlerResult(e.Message); //invalid choice } return new InputHandlerResult( InputHandlerResult.NEW_MENU_ACTION, vmp.input_item.target_page, InputHandlerResult.DEFAULT_PAGE_ID); }