def doaction(action,var): printVar("dialogres",action,var) op = ServiceInjector.constructPersonOp() if action == "before" : __create_list(op,var) setAddEditMode(var,"list",["pname,pnumber"]) if action == "run1" : var["JUP_DIALOG"] = "resdialog.xml" var['JAFTERDIALOG_ACTION'] = "actionres" var["JUPDIALOG_START"] = "Hello from script" if action == "editlistrowaction" : var["JLIST_EDIT_ACTIONOK_list"] = True if action == "selectvar" : var["JUP_DIALOG"] = "resdialog.xml" var['JAFTERDIALOG_ACTION'] = "selectrowvalue" if action == "selectrowvalue" : setCopy(var,["key","pname","pnumber"],"list") var["pname"] = var["JUPDIALOG_BUTTON"] var["pnumber"] = var["JUPDIALOG_RES"] var["key"] = 999 if action == "actionres" : setCopy(var,["buttonres","stringres"]) var["buttonres"] = var["JUPDIALOG_BUTTON"] var["stringres"] =var["JUPDIALOG_RES"]
def doaction(action, var): printVar("dialogres", action, var) op = ServiceInjector.constructPersonOp() if action == "before": __create_list(op, var) setAddEditMode(var, "list", ["pname,pnumber"]) if action == "run1": var["JUP_DIALOG"] = "resdialog.xml" var['JAFTERDIALOG_ACTION'] = "actionres" var["JUPDIALOG_START"] = "Hello from script" if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_list"] = True if action == "selectvar": var["JUP_DIALOG"] = "resdialog.xml" var['JAFTERDIALOG_ACTION'] = "selectrowvalue" if action == "selectrowvalue": setCopy(var, ["key", "pname", "pnumber"], "list") var["pname"] = var["JUPDIALOG_BUTTON"] var["pnumber"] = var["JUPDIALOG_RES"] var["key"] = 999 if action == "actionres": setCopy(var, ["buttonres", "stringres"]) var["buttonres"] = var["JUPDIALOG_BUTTON"] var["stringres"] = var["JUPDIALOG_RES"]
def doaction(action,var): printVar("do action",action,var) F = LISTREGISTRY() if action == "before" : F.readList(var) setAddEditMode(var,"listda",["date1","nameid","comboid","helperid"]) if action == "clearaction" : F.removeAll() F.readList(var) if action == "editlistrowaction" and var["JLIST_EDIT_ACTION_listda"] == "REMOVE" : F.removeMap(var) var["JLIST_EDIT_ACTIONOK_listda"] = True if action == "editlistrowaction" : key = F.nextKey() var['id'] = key var['JCOPY_id'] = True var["JLIST_EDIT_ACTIONOK_listda"] = True if action == "aftereditrow" : var["JEDIT_ROW_OK_listda"] = False if cutil.checkEmpty(var,["comboid","nameid"]) : return F.addMap(var) cutil.setCopy(var,"coladd","listda") var["coladd"] = "Hello " + var["helperid"] var["JEDIT_ROW_OK_listda"] = True if action == "helper" : var["JUP_DIALOG"] = "selectfromlist.xml"
def dialogaction(action, var): cutil.printVar("chart action", action, var) if action == "before": seq = [] seq.append({"id": 10, "name": "Hello"}) seq.append({"id": 20, "name": "Wow"}) seq.append({"id": 40, "name": "Ough"}) cutil.setJChartList(var, LI, seq) cutil.setJMapList(var, ELI, seq) cutil.setAddEditMode(var, ELI, ["id", "name"]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + ELI] = True if action == "refresh": seq = var["JLIST_MAP"][ELI] cutil.setJChartList(var, LI, seq)
def dialogaction(action,var) : cutil.printVar("chart action",action,var) if action == "before" : seq = [] seq.append({ "id" : 10,"name" : "Hello"}) seq.append({ "id" : 20,"name" : "Wow"}) seq.append({ "id" : 40,"name" : "Ough"}) cutil.setJChartList(var,LI,seq) cutil.setJMapList(var,ELI,seq) cutil.setAddEditMode(var,ELI,["id","name"]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + ELI] = True if action == "refresh" : seq = var["JLIST_MAP"][ELI] cutil.setJChartList(var,LI,seq)
def dialogaction(action, var): cutil.printVar("scatter chart", action, var) if action == "before": seq = [] seq.append({"num1": 10, "num2": 50}) seq.append({"num1": 12, "num2": 55}) seq.append({"num1": 6, "num2": 40}) seq.append({"num1": 3, "num2": 66}) seq.append({"num1": 2, "num2": 15}) cutil.setJChartList(var, CHART, seq) cutil.setJMapList(var, EDIT, seq) cutil.setAddEditMode(var, EDIT, ["num1", "num2"]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + EDIT] = True if action == "refresh": seq = var["JLIST_MAP"][EDIT] cutil.setJChartList(var, CHART, seq) cutil.setJMapList(var, EDIT, seq)
def dialogaction(action,var) : cutil.printVar("edit list spinner",action,var) if action == "before" : F.readList(var) cutil.setAddEditMode(var,LI,["pnumber","pname"]) if action == "editlistrowaction" : var["JLIST_EDIT_ACTIONOK_" + LI] = True if var["JLIST_EDIT_ACTION_"+LI] == "ADDBEFORE" or var["JLIST_EDIT_ACTION_" + LI ] == "ADD" : key = F.nextKey() var[ID] = key var["pnumber"] = 2 cutil.setCopy(var,[ID,"pnumber"],LI) if var["JLIST_EDIT_ACTION_"+LI] == "REMOVE" : F.removeMap(var) if action == "aftereditrow" : F.addMap(var) var["JEDIT_ROW_OK_" + LI] = True
def dialogaction(action, var): cutil.printVar("edit list spinner", action, var) if action == "before": F.readList(var) cutil.setAddEditMode(var, LI, ["pnumber", "pname"]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + LI] = True if var["JLIST_EDIT_ACTION_" + LI] == "ADDBEFORE" or var["JLIST_EDIT_ACTION_" + LI] == "ADD": key = F.nextKey() var[ID] = key var["pnumber"] = 2 cutil.setCopy(var, [ID, "pnumber"], LI) if var["JLIST_EDIT_ACTION_" + LI] == "REMOVE": F.removeMap(var) if action == "aftereditrow": F.addMap(var) var["JEDIT_ROW_OK_" + LI] = True
def dialogaction(action,var) : cutil.printVar("scatter chart",action,var) if action == "before" : seq = [] seq.append({"num1" : 10,"num2" : 50}) seq.append({"num1" : 12,"num2" : 55}) seq.append({"num1" : 6,"num2" : 40}) seq.append({"num1" : 3,"num2" : 66}) seq.append({"num1" : 2,"num2" : 15}) cutil.setJChartList(var,CHART,seq) cutil.setJMapList(var,EDIT,seq) cutil.setAddEditMode(var,EDIT,["num1","num2" ]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + EDIT] = True if action == "refresh" : seq = var["JLIST_MAP"][EDIT] cutil.setJChartList(var,CHART,seq) cutil.setJMapList(var,EDIT,seq)
def doaction(action, var): printVar("footeredit", action, var) if action == "before": # cutil.setJMapList(var,"list",[]) cutil.setAddEditMode(var, "list", ["leftk", "amount", "rightk"]) li = F.readList(var) leftf = None rightf = None for l in li: if l["leftk"]: leftf = cutil.addDecimal(leftf, l["amount"]) if l["rightk"]: rightf = cutil.addDecimal(rightf, l["amount"]) cutil.setFooter(var, "list", "leftk", leftf) cutil.setFooter(var, "list", "rightk", rightf) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_list"] = True if var["JLIST_EDIT_ACTION_list"] == "REMOVE": cutil.removeTextFooter(var, "list", "leftk", "amount") cutil.removeTextFooter(var, "list", "rightk", "amount") if action == "save": li = var["JLIST_MAP"]["list"] k = 0 for m in li: m["id"] = k k = k + 1 F.saveList(var) if action == "columnchangeaction" and ( (var["changefield"] == "leftk" or var["changefield"] == "rightk")): cutil.modifTextFooter(var, "list", var["changefield"], "amount") if action == "columnchangeaction" and var["changefield"] == "amount": cutil.modifTextDecimalFooter(var, "list", "leftk", "amount") cutil.modifTextDecimalFooter(var, "list", "rightk", "amount")
def doaction(action,var) : printVar("footeredit",action,var) if action == "before" : # cutil.setJMapList(var,"list",[]) cutil.setAddEditMode(var,"list",["leftk","amount","rightk"]) li = F.readList(var) leftf = None rightf = None for l in li : if l["leftk"] : leftf = cutil.addDecimal(leftf,l["amount"]) if l["rightk"] : rightf = cutil.addDecimal(rightf,l["amount"]) cutil.setFooter(var,"list","leftk",leftf) cutil.setFooter(var,"list","rightk",rightf) if action == "editlistrowaction" : var["JLIST_EDIT_ACTIONOK_list"] = True if var["JLIST_EDIT_ACTION_list"] == "REMOVE" : cutil.removeTextFooter(var,"list","leftk","amount") cutil.removeTextFooter(var,"list","rightk","amount") if action == "save" : li = var["JLIST_MAP"]["list"] k = 0 for m in li : m["id"] = k k = k + 1 F.saveList(var) if action == "columnchangeaction" and ((var["changefield"] == "leftk" or var["changefield"] == "rightk")) : cutil.modifTextFooter(var,"list",var["changefield"],"amount") if action == "columnchangeaction" and var["changefield"] == "amount" : cutil.modifTextDecimalFooter(var,"list","leftk","amount") cutil.modifTextDecimalFooter(var,"list","rightk","amount")
def dialogaction(action,var) : cutil.printVar("chart action",action,var) if action == "before" : seq = [] seq.append({ "id" : 100,"id1" : 50, "id2" : 10, "name" : "Morning"}) seq.append({ "id" : 90,"id1" : 60, "id2" : 15, "name" : "Afternoon"}) seq.append({ "id" : 80,"id1" : 70, "id2" : 10, "name" : "Evening"}) cutil.setJChartList(var,LI,seq) cutil.setJChartList(var,LI1,seq) cutil.setJChartList(var,LI2,seq) cutil.setJChartList(var,LI3,seq) cutil.setJMapList(var,ELI,seq) cutil.setAddEditMode(var,ELI,["id","name","id1","id2" ]) if action == "editlistrowaction": var["JLIST_EDIT_ACTIONOK_" + ELI] = True if action == "refresh" : seq = var["JLIST_MAP"][ELI] cutil.setJChartList(var,LI,seq) cutil.setJChartList(var,LI1,seq) cutil.setJChartList(var,LI2,seq) cutil.setJChartList(var,LI3,seq)
def editlistaction(action,var): printVar("editlistaction",action,var) op = ServiceInjector.constructPersonOp() dOp = ServiceInjector.constructDateRecordOp() if action == "clear1action" : if not var['JYESANSWER'] : return op.clearAll() __create_list(op,var) return if action == "clear2action" : if not var['JYESANSWER'] : return dOp.clearAll() __create_listda(dOp,var) return if action == "before" : __create_list(op,var) var["JLIST_EDIT_list_pname"] = "" var["JLIST_EDIT_list_pnumber"] = "" # var["JLIST_EDIT_list_MODE"] = "NORMALMODE" # var["JLIST_EDIT_list_MODE"] = "CHANGEMODE" var["JLIST_EDIT_list_MODE"] = "ADDCHANGEDELETEMODE" __create_listda(dOp,var) # var["JLIST_EDIT_listda_date1"] = "" # var["JLIST_EDIT_listda_date2"] = "" # var["JLIST_EDIT_listda_vals"] = "" # var["JLIST_EDIT_listda_MODE"] = "CHANGEMODE" # var["JLIST_EDIT_listda_MODE"] = "NORMALMODE" # var["JLIST_EDIT_listda_MODE"] = "ADDCHANGEDELETEMODE" setAddEditMode(var,"listda",["date1","date2","vals"]) # cutil.setChangeEditMode(var,"listda",["date1","date2","vals"]) # cutil.setStandEditMode(var,"listda",["date1","date2","vals"]) __create_listb(var) # setAddEditMode(var,"listb",["id","name","check"]) cutil.setChangeEditMode(var,"listb",["id","name","check"]) # cutil.setStandEditMode(var,"listb",["id","name","check"]) # setAddEditMode(var,"listb",["id","name","check"]) return if action == "vali" : return if var["JLIST_NAME"] == "list" : if action == "editlistrowaction" : var["JYESNO_MESSAGE"] = "Are you ready to add new elem ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "afteryesno" if action == "afteryesno" and var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_list"] = True var["pname"] = "xxxx" var["JCOPY_pname"] = True var["pnumber"] = "1" var["JCOPY_pnumber"] = True if action == "columnchangeaction" and var["changefield"] == "pnumber" : val = var["pnumber"] print "val",val,"!" if val == None or val == "" : print "===============" # var["JERROR_pnumber"] = "Cannot be empty" if var["JLIST_NAME"] == "listb" : var["JLIST_EDIT_ACTIONOK_listb"] = True if var["JLIST_NAME"] == "listda" : if action == "afteryesno" and var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_listda"] = True if action == "editlistrowaction" and (var["JLIST_EDIT_ACTION_listda"] == "ADDBEFORE" or var["JLIST_EDIT_ACTION_listda"] == "ADD") : var["JYESNO_MESSAGE"] = "Are you ready to add new empty date elem ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "afteryesno" if action == "editlistrowaction" and var["JLIST_EDIT_ACTION_listda"] == "REMOVE" : if var["date1"] == None and var["date2"] == None : dOp.removeRecord(var["id"]) var["JLIST_EDIT_ACTIONOK_listda"] = True print "REMOVE --------------" return var["JYESNO_MESSAGE"] = "Do you want to remove this line ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "removeyesno" if action == "afteryesno" and var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_listda"] = True iRec = dOp.construct() var["id"] = dOp.addRecord(iRec) var["JCOPY_id"] = True if action == "afteryesno" and not var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_listda"] = False if action == "removeyesno" and var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_listda"] = True dOp.removeRecord(var["id"]) print "REMOVE -----------------" if action == "removeyesno" and not var["JYESANSWER"] : var["JLIST_EDIT_ACTIONOK_listda"] = False if action == "aftereditrow" : d1 = toDate(var["date1"]) d2 = toDate(var["date2"]) iRec = dOp.findRecord(var["id"]) if iRec != None : iRec.setDates(d1,d2) dOp.changeRecord(iRec) var["JEDIT_ROW_OK_listda"] = True
def editlistaction(action, var): printVar("editlistaction", action, var) op = ServiceInjector.constructPersonOp() dOp = ServiceInjector.constructDateRecordOp() if action == "clear1action": if not var['JYESANSWER']: return op.clearAll() __create_list(op, var) return if action == "clear2action": if not var['JYESANSWER']: return dOp.clearAll() __create_listda(dOp, var) return if action == "before": __create_list(op, var) var["JLIST_EDIT_list_pname"] = "" var["JLIST_EDIT_list_pnumber"] = "" # var["JLIST_EDIT_list_MODE"] = "NORMALMODE" # var["JLIST_EDIT_list_MODE"] = "CHANGEMODE" var["JLIST_EDIT_list_MODE"] = "ADDCHANGEDELETEMODE" __create_listda(dOp, var) # var["JLIST_EDIT_listda_date1"] = "" # var["JLIST_EDIT_listda_date2"] = "" # var["JLIST_EDIT_listda_vals"] = "" # var["JLIST_EDIT_listda_MODE"] = "CHANGEMODE" # var["JLIST_EDIT_listda_MODE"] = "NORMALMODE" # var["JLIST_EDIT_listda_MODE"] = "ADDCHANGEDELETEMODE" setAddEditMode(var, "listda", ["date1", "date2", "vals"]) # cutil.setChangeEditMode(var,"listda",["date1","date2","vals"]) # cutil.setStandEditMode(var,"listda",["date1","date2","vals"]) __create_listb(var) # setAddEditMode(var,"listb",["id","name","check"]) cutil.setChangeEditMode(var, "listb", ["id", "name", "check"]) # cutil.setStandEditMode(var,"listb",["id","name","check"]) # setAddEditMode(var,"listb",["id","name","check"]) return if action == "vali": return if var["JLIST_NAME"] == "list": if action == "editlistrowaction": var["JYESNO_MESSAGE"] = "Are you ready to add new elem ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "afteryesno" if action == "afteryesno" and var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_list"] = True var["pname"] = "xxxx" var["JCOPY_pname"] = True var["pnumber"] = "1" var["JCOPY_pnumber"] = True if action == "columnchangeaction" and var["changefield"] == "pnumber": val = var["pnumber"] print "val", val, "!" if val == None or val == "": print "===============" # var["JERROR_pnumber"] = "Cannot be empty" if var["JLIST_NAME"] == "listb": var["JLIST_EDIT_ACTIONOK_listb"] = True if var["JLIST_NAME"] == "listda": if action == "afteryesno" and var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_listda"] = True if action == "editlistrowaction" and ( var["JLIST_EDIT_ACTION_listda"] == "ADDBEFORE" or var["JLIST_EDIT_ACTION_listda"] == "ADD"): var["JYESNO_MESSAGE"] = "Are you ready to add new empty date elem ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "afteryesno" if action == "editlistrowaction" and var[ "JLIST_EDIT_ACTION_listda"] == "REMOVE": if var["date1"] == None and var["date2"] == None: dOp.removeRecord(var["id"]) var["JLIST_EDIT_ACTIONOK_listda"] = True print "REMOVE --------------" return var["JYESNO_MESSAGE"] = "Do you want to remove this line ?" var["JMESSAGE_TITLE"] = "Ask for something" var["JAFTERDIALOG_ACTION"] = "removeyesno" if action == "afteryesno" and var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_listda"] = True iRec = dOp.construct() var["id"] = dOp.addRecord(iRec) var["JCOPY_id"] = True if action == "afteryesno" and not var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_listda"] = False if action == "removeyesno" and var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_listda"] = True dOp.removeRecord(var["id"]) print "REMOVE -----------------" if action == "removeyesno" and not var["JYESANSWER"]: var["JLIST_EDIT_ACTIONOK_listda"] = False if action == "aftereditrow": d1 = toDate(var["date1"]) d2 = toDate(var["date2"]) iRec = dOp.findRecord(var["id"]) if iRec != None: iRec.setDates(d1, d2) dOp.changeRecord(iRec) var["JEDIT_ROW_OK_listda"] = True