def _addComponents(self): wns = WN.getWNLogin() self.nl() comp = NW.LabelTextbox('PROFID',wns.getAltId('PROFID'), True) self.add(comp) comp = NW.LabelTextbox('PASSWORD',wns.getAltId('PASSWORD'), True) comp.getComponent().setPasswordType() self.add(comp) rememberme = WW.Checkboxes('rememberme',['rememberme'],[UTIL.getText('REMEMBER_ME')]) self.add(rememberme) self.nl() bButton = NW.BusyTableButton(self.getId()+'Button',UTIL.getText('LOGIN')) bButton.setButtonClass('regularbutton') self.add(bButton) self.nl() forgotPwdLink = WW.Hyperlink('http://www.google.com',UTIL.getText('FORGETPASSWORD')) self.add(forgotPwdLink)
def __addLinks1(self, comp): if SESSINFO.getLangId() == "eng": imglink = UTIL.getImageRoot() + "/mal_ReadMal.png" url = UTIL.getURL("changelang") img = WW.ImageLink(url, imglink, "Read in malayalam") comp.add(img) comp.sp(2) url = UTIL.getURL("fontproblem") fp = WW.Hyperlink(url, UTIL.getText("FONT_PROBLEM")) fp.setBlank() comp.add(fp) else: url = UTIL.getURL("changelang") fp = WW.Hyperlink(url, UTIL.getText("READ_IN_ENGLISH")) comp.add(fp) comp.sp(2) imglink = UTIL.getImageRoot() + "/mal_CantRead.png" url = UTIL.getURL("fontproblem") img = WW.ImageLink(url, imglink, "Font problem") img.setBlank() comp.add(img)
def __init__(self, frameId, idPart, tableName, titleList, valueList=None): WW.DivFrame.__init__(self, "iMultiOpt" + idPart) if len(titleList) != len(valueList): raise ValueError("NISERROR: Title list and value list must be equal in length.") dialog = DialogWidget(idPart, [UTIL.getText("OK"), UTIL.getText("CANCEL")]) self.add(dialog) "full frame name" obj = WDB.ChainedDropdownDataWidget(idPart, tableName) self.add(obj) typeLen = obj.getTypeLength() if valueList == None: valueList = [] for i in range(typeLen): "Each div name" div = WW.DivFrame(idPart + str(i)) self.add(div) "Textbox name" txt = WW.Textbox(frameId + "-Name" + idPart + str(i)) defaultTxt = WW.Textbox(idPart + "Default" + str(i)) if len(valueList) > i: txt.setText(valueList[i]) defaultTxt.setText(valueList[i]) defaultTxt.hide() txt.hide() self.add(txt) self.add(defaultTxt) txt = WW.Textbox(idPart + "Heading" + str(i), UTIL.getText(titleList[i])) txt.hide() self.add(txt)
def _addSupportData(self): nodataTextId = 'DATA'+self.nameid+'NodataText' selectoneTextId = 'DATA'+self.nameid+'SelectoneText' tt = WW.Textbox(nodataTextId, UTIL.getText('INFO_NO_DATA')); self.add(tt) tt.hide() tt = WW.Textbox(selectoneTextId, UTIL.getText('INFO_SELECT_ONE')); self.add(tt) tt.hide()
def __init__(self, msg, link=None): WW.DivFrame.__init__(self) self.setClass("errorDivStyle") self.add(UTIL.getText(msg)) self.nl(1) self.add(UTIL.getText("INBOX_ERRORMSG_CLICKLINK")) self.nl() if link != None: l = WW.Hyperlink(link, link) self.add(l)
def _getCopyItemLink(self): ''' May be used later ''' div = WW.DivFrame() div.addStyle('color', 'gray') link = WW.Hyperlink("", UTIL.getText('CLICK_TO_COPY')) link.addId('copyAddrLinkId') div.add(UTIL.getText('IF_LINK_SAME')+',') div.add(link) div.nl(2) return div
def _getAltNamesMessageBox(val): sugg = [] for i in range(1,10): sugg.append(i) sugg.append(i*10+i) v = random.random() sugg.append(int(v*1000)) res = [] for s in sugg: sval = val+str(s) if _isUserNameAvailable(sval): res.append(sval) if len(res) >= 3: break div = WW.DivFrame() if len(res) >0: div.add(UTIL.getText('ERR_TRY_DIFF_UNAME')) div.nl() for s in res: link = WW.Hyperlink('javascript:void',s) link.addClickListener('fillAlternateId(this)') div.add(link) div.sp() return div
def __addItems(self,rowId, colId): ''' We will create table columns for max col items. Will set class only for the allowed tab ''' maxCol = CONST.getMaxColSize() labels = CONST.getColumnItems(rowId) table = WW.Table(1,maxCol) table.setClass('tabNavTable') self.add(table) for i, val in map(None,range(maxCol), labels): tdTag = table.getTdTag(0,i) tdTag.addClass('tabNavTableCell') chf = WW.DivFrame('iSubMenu%s%s'%(rowId, i)) table.add(0,i,chf) if val == None: chf.setClass('tabNavItemEmpty') continue if i == colId: cls = 'tabNavItemHl' else: cls = 'tabNavItem' chf.add(UTIL.getText(val)) chf.setClass(cls)
def addData(self): sessinfo = SESSINFO.getSessionInfo() status = sessinfo.getStatus() t1 = WW.Textbox('iDataStatus', status) t1.hide() self.add(t1) t1 = WW.Textbox('iDataAccessMsg', UTIL.getText('INBOX_ACCESS_ERROR1')) t1.hide() self.add(t1) rItems = CONST.getRowItems() for i in range(len(rItems)): cItems = CONST.getColumnItems(i) for j, val in enumerate(cItems): t1 = WW.Textbox('iDataMenuLabel%s%s'%(i,j), UTIL.getText(val)) t1.hide() self.add(t1)
def __addLinks2(self, comp, showLogout): sessInfo = SESSINFO.getSessionInfo() # Need to clean the following 2 lines of code if sessInfo != None and sessInfo.getName() != None: comp.add("<b>" + sessInfo.getName() + "</b>") comp.sp(2) hl = WW.Hyperlink(UTIL.getURL("help"), UTIL.getText("HELP")) hl.setBlank() comp.add(hl) comp.sp(2) hl = WW.Hyperlink(UTIL.getURL("settings"), UTIL.getText("SETTINGS")) hl.setBlank() comp.add(hl) comp.sp(2) if showLogout: hl = WW.Hyperlink(UTIL.getURL("signout"), UTIL.getText("LOGOUT")) comp.add(hl) comp.sp(2)
def __init__(self): WW.DivFrame.__init__(self) self.setClass('buttonSectionStyle') if SESSINFO.getSessionInfo().getStatus() < 100: textKey = 'SAVE_CONTINUE' else: textKey = 'SAVE' bButton = NW.BusyTableButton(WN.getWidgetIdEditProfile()+'Button',UTIL.getText('SAVE_CONTINUE')) self.add(bButton)
def __init__(self, nameidPrefix, labelList, modelList, selValueList=None, isRequired=False): WW.DivFrame.__init__(self) selValueList = self._getNewSelectedValues(modelList, selValueList) i = 0 for label, model in map(None, labelList, modelList): nameid = nameidPrefix + "Chained" + str(i) if model != None: comp = MLabelDropdown(label, nameid, model, isRequired, True) if selValueList[i] != None: comp.getComponent().setSelectedItem(selValueList[i]) else: itemModel = NM.NisDropdownModelImpl([UTIL.getText("INFO_NO_DATA")], [UTIL.getText("INFO_NO_DATA")]) comp = MLabelDropdown(label, nameid, itemModel, isRequired, False) comp.getComponent().setEnabled(False) self.add(comp) i = i + 1
def _addComponents(self): infonum = 5 table = WW.Table(infonum,2) table.setClass('infoTable') for i in range(5): td = table.getTdTag(i,0) td.setClass('infoTableIcon%d'%(i+1)) td = table.getTdTag(i,1) td.setClass('infoTableText') td.add(UTIL.getText('ADV_CATCH_%d'%(i+1))) self.add(table)
def __addItems(self,rowid): labels = CONST.getRowItems() url = UTIL.getURL('inbox') for i, val in enumerate(labels): divf = WW.DivFrame('iMainMenu%d'%i) divf.setClass('mainNavCell') divf.addClass('mainNavIcon%d'%i) if i == rowid: divf.setBackgroundColor('#abcdab') divf.add(UTIL.getText(val)) self.add(divf)
def _TryLogin(): form = cgi.FieldStorage() widId = WN.getWidgetIdLogin() wns = WN.getWNLogin() pid = form.getvalue(wns.getAltId('PROFID')) pwd = form.getvalue(wns.getAltId('PASSWORD')) if pid == None or pwd == None: return UTIL.getStatusInfoDiv([UTIL.getText('NOUSER_ERROR')], widId, NCONST.ERROR) ret = _LoginAndGetSession(pid, pwd) if ret == False: return UTIL.getStatusInfoDiv([UTIL.getText('NOUSER_ERROR')], widId, NCONST.ERROR) sessinfo = _getSessInfo() statusVal = '%s %s'%(sessinfo[0], sessinfo[1]) return UTIL.getStatusInfoDiv(['Success'], widId, NCONST.SUCCESS, statusVal)
def _registerNew(): form = cgi.FieldStorage() widId = WN.getWidgetIdRegister() val = form.getvalue(_gWns.getAltId('PROFID')) if val == None: errstr = "%s %s"%(UTIL.getText('PROFID'),UTIL.getText('NO_EMPTY')) return UTIL.getStatusInfoDiv([errstr], widId, NCONST.ERROR) ret= _isUserNameAvailable(val) if ret == False: msg = "'%s' %s"%(val,UTIL.getText('ERR_UNAME_NOT_AVAILABLE')) return UTIL.getStatusInfoDiv([msg,_getAltNamesMessageBox(val)], widId, NCONST.ERROR) if form.getvalue(_gWns.getAltId('PASSWORD')) != form.getvalue(_gWns.getAltId('CONFIRMPASSWORD')): return UTIL.getStatusInfoDiv([UTIL.getText('ERR_ORG_CNF_PWD_MISMATCH')], widId, NCONST.ERROR) status = _AddInfo(form) if status != True: errstr = "%s '%s'"%(UTIL.getText('PLEASE_ENTER_VALID'), UTIL.getText(fieldDict[status.getFieldName()])) return UTIL.getStatusInfoDiv([errstr],widId, NCONST.ERROR) sVals = _getSessionInfo() statusVal = "%s %s"%(sVals[0], sVals[1]) return UTIL.getStatusInfoDiv(['Success'],widId, NCONST.SUCCESS, statusVal)
def _addComponents(self): wns = WN.getWNRegister() heading = WW.DivFrame() heading.setClass('heading') heading.add(UTIL.getText('REGISTER_FREE')) self.add(heading) comp = NW.LabelTextbox('PROFID',wns.getAltId('PROFID'), True) self.add(comp) comp = NW.LabelTextbox('NAME',wns.getAltId('NAME'), True) self.add(comp) comp = NW.LabelTextbox('PASSWORD',wns.getAltId('PASSWORD'), True) comp.getComponent().setPasswordType() self.add(comp) comp = NW.LabelTextbox('CONFIRMPASSWORD',wns.getAltId('CONFIRMPASSWORD'), True) comp.getComponent().setPasswordType() self.add(comp) comp = NW.LabelTextbox('EMAIL',wns.getAltId('EMAIL'), True) self.add(comp) comp = NW.LabelDropdown('SEX',UTIL.addSelectOne(UTIL.getTextList('SEX_LIST')),wns.getAltId('SEX'), ['Select one',1,0],True) self.add(comp) comp = NW.DateWidget('DOB',True, [wns.getAltId('DOB_DAY'), wns.getAltId('DOB_MONTH'),wns.getAltId('DOB_YEAR')]) self.add(comp) self.nl() bButton = NW.BusyTableButton(self.getId()+'Button',UTIL.getText('REGISTER')) self.add(bButton)
def __init__(self, label, isRequired=False): if label == None: label = "" WW.BaseTag.__init__(self, "div") starFrame = WW.SpanFrame() self.starFrame = starFrame self.add(starFrame) sf = WW.SpanFrame() sf.add(UTIL.getText(label)) self.add(sf) if isRequired: self.setIsRequired()
def addText(self, textKey): self.add(UTIL.getText(textKey))
def _getClearDiv(self): cleardiv = WW.DivFrame(self._id + "Clear") cleardiv.addStyle("cursor", "pointer") cleardiv.addStyle("text-decoration", "underline") cleardiv.add(UTIL.getText("CLEAR_ALL")) return cleardiv
def __init__(self,header): WW.DivFrame.__init__(self) self.add(UTIL.getText(header)) self.setClass('headerSectionStyle')
def getDayList(): f = UTIL.getText('DAY') l = range(1, 32) l.insert(0,f) return l
def getYearList(): f = UTIL.getText('YEAR') l=range(1947,2012) l.insert(0,f) return l
def getMonthList(): f = UTIL.getText('MONTH') l = ['Jan','Feb', 'Mar', 'Apr', 'May','Jun','July','Aug','Sep','Oct','Nov','Dec'] l.insert(0,f) return l
def getMonthValue(): f = UTIL.getText('MONTH') l =range(1,13) l.insert(0,f) return l