Esempio n. 1
0
def dialogaction(action,var) :
  printVar("packenum",action,var)
    
  if action == "before" :
     var['combof'] = "3"
     var['JCOPY_combof'] = True
     return  
     
  if action == "testcombo" :
    return   
    
  if action == "signalchange" and var["changefield"] == "combof" :
    s = var["combof"]
    setCopyF(var,"outcombof",s)
    return  

  if action == "signalchange" and var["changefield"] == "combome" :
    s = var["combome"]
    setCopyF(var,"outcombom",s)
    return  
    
  seq = []
  for i in range(100) :
        rec = {}
        rec['id'] = str(i)
        rec['name'] = 'name' + str(i)
        seq.append(rec)
        
  map = {}
  map[action] = seq
  var["JLIST_MAP"] = map  
Esempio n. 2
0
def dialogaction(action,var):
    
    cutil.printVar("test42",action,var)
    
    if action == "test1" :
       xml = xmlutil.fileToS("xslt/data1/data.xml")              
       html = pdfutil.xsltHtmlS("xslt/data1/data.xslt",xml)
       assert html != None

       print html
       i = html.find("English")
       print i       
       assert i != -1
       var["OK"] = True     

    if action == "test2" :
       xml = xmlutil.fileToS("xslt/data1/data.xml")              
       html = pdfutil.xsltHtmlS("xslt/data1/data.xslt",xml)
       assert html != None

       print html
       i = html.find("Polish")
       print i
       assert i != -1       
       var["OK"] = True     
Esempio n. 3
0
def dialogaction(action,var):
    cutil.printVar("runpdf",action,var)
    
    if action == "runpdf" :
      s = "<H1> Hello </H1>"
      b = pdfutil.createPDFH(s)
      assert b != None

    if action == "runpdf1" :
      s = "<H1> Hello </H1>"
      map={}
      map[pdfutil.CREATOR] = "I am"
      map[pdfutil.PRODUCER] = ""
      map[pdfutil.AUTHOR] = "Author"
      map[pdfutil.TITLE] = "Title"
      b = pdfutil.createPDFH(s,map)
      assert b != None
      
    if action == "createxml" :
        s = "<?xml version=\"1.0\" ?>"
        s = s +  "<persons>"
        s = s +  "<person username=\"JS1\">"
        s = s + "<name>John</name>"
        s = s + "<family-name>Smith</family-name>"
        s = s + "</person>"
        s = s + "<person username=\"MI1\">"
        s = s + "<name>Morka</name>"
        s = s + "<family-name>Ismincius</family-name>"
        s = s + "</person>"
        s = s + "</persons>"
          
        
    if action == "runxslt" :
#       iS = Holder.getIJython().getResource().getRes("dialogs/data.xml")
#       s = s + "/data.xml"
#       inS = FileInputStream(iS)
#       print inS
#       xml = Util.readFromFileInput(iS)
       xml = xmlutil.fileToS("dialogs/data.xml")
       print xml
               
       b = pdfutil.xsltHtml("dialogs/template.xsl",xml)
       assert b != None
       
       print b.toString()
       
    if action == "runxsltpdf" :   
#       s = Util.getResourceAsDirectory("dialogs")
#       s = Holder.getIJython().getResourceDirectory() + "/dialogs";
#       print s
#       s = s + "/data.xml"
#       print s
#       inS = FileInputStream(s)
#       print inS
#       xml = Util.readFromFileInput(inS)
       xml = xmlutil.fileToS("dialogs/data.xml")
       print xml
               
       b = pdfutil.createPDFXSLT("dialogs/template.xsl",xml)
       assert b != None
Esempio n. 4
0
def dialogaction(action,var):
    cutil.printVar("testbill",action,var)
    
    if action == "testbill" :
        bname = var["billno"]
        print bname
        bb = util.BILLLIST(var).findElem(bname)
        resname = bb.getReseName()
        print resname
        RE = util.RESFORM(var).findElem(resname)
        print RE
        rlist = RE.getResDetail()
        for r in rlist:
            print r.getId()
            print type(r.getId())
            
        b = util.newBill(var)
#        b.setGensymbol(True);
        b.setPayer(bb.getPayer());
        b.setReseName(resname)
        dat = datetime.date(2010,1,2)
        b.setIssueDate(con.toDate(dat))
        for r in rlist:
           b.getPayList().add(r.getId());
        b1 = util.BILLLIST(var).addElem(b)
        assert b1 != None
        print b1.getName()    
        var["OK"] = True
Esempio n. 5
0
def dialogaction(action,var) :
  cutil.printVar("binder32",action,var)

  if action == "before" :
      cutil.setCopy(var,"datePicker")
      var["datePicker"] = con.jDate(2016,3,5)
      
Esempio n. 6
0
def dialogaction(action,var) :
    cutil.printVar("send mail list",action,var)
    
    if action == "before" or action == "crud_readlist" :
      M = cmail.CMAIL(var)
      li = M.getList()
      seq = []
      for l in li :
        fromm = l.getFrom()
        recipient = l.getRecipient()
        subject = l.getDescription()
        content = l.getContent()
        res = l.getSendResult()
        noa = None
        if cutil.emptyS(res) : res = None
        if len(l.getaList()) > 0 : noa = len(l.getaList())
        seq.append({ "subject" : subject,"to" : recipient, "from" : fromm, "content": content, "res" : res, "name" : l.getName(), "noattach" : noa })
      cutil.setJMapList(var,LI,seq)  
      
    if action == "attachlist" :
        M = cmail.CMAIL(var)
        note = M.findElem(var["name"])
        l = note.getaList()
        if len(l) == 0 :
    	  var["JOK_MESSAGE"] = "@noattachmentsmessage"
          return
        var["JUP_DIALOG"] = "?mailattachments.xml"
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 dialinfo(action,var) :
  cutil.printVar("customer stat",action,var)
  
  if action == "before" :
      custid = var["JUPDIALOG_START"]
      custR = util.CUSTOMERLIST(var).findElem(custid)
      cust.customerToVar(var,custR,CUST)
      cust.setCustVarCopy(var,CUST)
      l = util.RESOP(var).getReseForCustomer(custid)
      l1 = util.RESOP(var).getReseForGuest(custid)
      l2 = util.RESOP(var).getReseForPayer(custid)      
      _createListOfRes(var,l,CLIST)
      _createListOfRes(var,l1,GLIST)
      _createListOfRes(var,l2,PLIST)
      l3 = _createListOfMail(var)

      m = {"nofcustomer" : len(l), "nofguest" : len(l1), "nofpayer" : len(l2), "nomails" : len(l3) }
      s = util.transformXMLFromMap("custinfo.xslt",m)
      var["i_custinfo"] = s      
#      var["i_custinfo"] = M("custinfo").format(len(l),len(l1),len(l2))
      cutil.setCopy(var,"i_custinfo")

      
  if action == "shownote" :
     diallaunch.showmailnote(var,var["mailname"])      
def dialogaction(action,var) :
     printVar("doaction",action,var)

     if action == "addpayment" :
         op = H.getResOp()
         custOp = H.getHotelCustomers()
         add = ReservationPaymentDetail()
#         ho = ServiceInjector.getInstanceHotel()

         ho = H.getInstanceObjectId()
         hins = ho.getOObject("AppInstanceTest","hotel","user")
         
         print hins
         cust = HotelCustomer()
         cust.setName("guest")
         custOp.addElem(hins,cust)
         
         add.setDescription("Beverage")
         add.setGuestName("guest")
         add.setPrice(toB(1))
         add.setPriceList(toB(155))
         # important: after decimal point !!!
         add.setPriceTotal(toB(1.1))
         add.setQuantity(2)
         add.setRoomName("P10")
         da = datetime.date(2013, 3, 2)
         add.setServDate(toDate(da))
         add.setVat("7%")
         op.addResAddPayment(hins, "2013/R/2", add)

         
Esempio n. 10
0
def dialogaction(action,var) :

  printVar("list",action,var)
    
  op = ServiceInjector.constructPersonOp()
          
  if action == "before" or action == "crud_readlist" :
    __create_list(op,var)
    return
    
  if action == "clearpersons" :
     yes = var['JYESANSWER']
     if not yes : return
     op.clearAll()
     for i in range(100) :
       numb = str(i)
       name = 'NAME ' + numb
       p = op.construct()
       p.setPersonNumb(numb)
       p.setPersonName(name)
       op.savePerson(p)
     __create_list(op,var)  
     return
     
      
  pname = var["pname"]
  pnumb = var["pnumber"]
  print pname," ",pnumb
    
  if action == "crud_add"  :
    pname = var["pname"]
    pnumb = var["pnumber"]
    print pname," ",pnumb
    if action == "crud_add" :
       p = op.findPersonByNumb(pnumb)
       if p != None :
         var["JERROR_pnumber"] = "Duplicated number, person number should be unique"
         return  
       if not var["JCRUD_AFTERCONF"] :
         var["JYESNO_MESSAGE"] = "Are you ready to add new elem ?"
         var["JMESSAGE_TITLE"] = "Ask for something"
         print "var kom ",var["JYESNO_MESSAGE"]
         return
       p = op.construct()
       p.setPersonNumb(pnumb)
       p.setPersonName(pname)
       op.savePerson(p)
       var["JCLOSE_DIALOG"] = True
       return

  key = var["key"]      
  if action == "crud_remove" or action == "crud_change" :
       p = op.construct()
       print key,pnumb,pname
       p.setId(key)
       p.setPersonNumb(pnumb)
       p.setPersonName(pname)
       if action == "crud_remove" : op.removePerson(p)
       else : op.changePerson(p)
       var["JCLOSE_DIALOG"] = True
Esempio n. 11
0
def billdesc(action,var) :
   cutil.printVar("bill desc",action,var)
   
   if action == "before" :
     payername = var["payer_name"]
     cust.setCustData(var,payername,"payer_")
     LI = cbill.BILLPOSADD(var,LIS)
     billname = var["billname"]
     b = util.BILLLIST(var).findElem(billname)
     
     B = _BS(b,LI)
     B.scan( rutil.getPayments(var))
     LI.close()     
     
   if action == "crud_remove"  and not var["JCRUD_AFTERCONF"] :
      var["JYESNO_MESSAGE"] = "@doyouwantremovebill"
      return

   if action == "crud_remove"  and var["JCRUD_AFTERCONF"] :
     billname = var["billname"]
     util.BILLLIST(var).deleteElemByName(billname)
     var["JCLOSE_DIALOG"] = True      
     
   if action == "guestdetail" :
       cust.showCustomerDetails(var,var["guest_name"])
Esempio n. 12
0
def dialogaction(action,var):
    
    cutil.printVar("test39",action,var)
    
    if action == "test1" :
        rese = var["rese"]
        r = util.RESFORM(var).findElem(rese)
        RR = resstat.getResStatusR(var,r)
        print RR
        print RR.arrival,RR.departure
        print RR.sumcost,RR.sumpay
        assert 400.00 == RR.sumcost

    if action == "test2" :
        rese = var["rese"]
        r = util.RESFORM(var).findElem(rese)
        RR = resstat.getResStatusR(var,r)
        print RR
        print RR.arrival,RR.departure
        print RR.sumcost,RR.sumpay
        print RR.advancepaymentused
        assert 400.00 == RR.sumcost
        assert 300.00 == RR.sumpay
        assert 90.0 == RR.advancepaymentused

    var["OK"] = True
Esempio n. 13
0
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 dialogaction(action,var) :
  
  cutil.printVar("reservation",action,var)
  
  if action == "before" :
    R = util.RESFORM(var)
    C = util.CUSTOMERLIST(var)
    seq = R.getList()
    list = []
    for s in seq :
       sta = resstat.getResStatus(var,s)
       statuS = resstat.getStatusS(sta)       
       (arrival,departure,roomname,rate,nog) = rutil.getReseDate(var,s)
       ma = {"name" : s.getName(),"resdate" : s.getCreationDate(), "checkin" : arrival, "checkout" : departure, "roomname" : roomname, "resestatus" : M(statuS) }
       cu = C.findElem(s.getCustomerName())
       cust.toCustomerVar(ma,cu,PREC,CULIST)
       list.append(ma)
       
    cutil.setJMapList(var,LIST,list)   
    
  if action == "showrese" :
    resename = var["name"]
#    (room,day) = rutil.getRoomDateFromVar(var)
    diallaunch.reservationdialogaction(var,resename,var["roomname"],var["checkin"])

    
  if action == "showmails" :
    rename = var["name"]
    diallaunch.showlistofmail(var,rename)
def dialogaction(action,var) :
   
   cutil.printVar("Column list",action,var)
   
   if action == "before" :
     cutil.setStandEditMode(var,LIST,["visible","columnname"])
     
Esempio n. 16
0
def dialogaction(action,var) :
  
  cutil.printVar("focus",action,var)
  
  if action == "fo1" :
    cutil.setFocus(var,"focus")
    
  if action == "fo2" :
    cutil.setFocus(var,"focus1")

  if action == "fo3" :
    cutil.setFocus(var,"focus3")
    
  if action == "fo4" :
    cutil.setFocus(var,"focus4")
    
  if action == "fo5" :
    cutil.setFocus(var,"focus5")

    
  if action == "signalchange" :  
      var["JYESNO_MESSAGE"] = "Set focus to FocusText1 ?"
      var["JAFTERDIALOG_ACTION"] = "setfocus1"      
      
  if action == "setfocus1" and var["JYESANSWER"] :  
      cutil.setFocus(var,"focus")
Esempio n. 17
0
def dialogaction(action,var) :
  cutil.printVar("listattach",action,var)
  
  if action == "upload" and var["list_lineset"] :
     var["JUP_DIALOG"] = "attachsomething.xml"
    
  
  if action == "before" or action == "crud_readlist" :
       F.readList(var)
       readFileList(var)

  if action == "clearrecords" :
       F.removeAll()
       readFileList(var)
       
  if action == "attach" :
     var["JUP_DIALOG"] = "attachsomething.xml"
     
  if action == "download" :
     if var["realm"] : var["JUP_DIALOG"] = "download.xml"
       
  if action == "crud_add" :
      key = F.nextKey()
      var["id"] = key
      F.addMap(var)
      var["JCLOSE_DIALOG"] = True
       
  if action == "crud_change" :
      F.addMap(var)
      var["JCLOSE_DIALOG"] = True
                                        #<td><a class="attachment" href="/attach/Test/Zalozenia%20akcji%20Konspiratorze%20-%20odbierz%20swiadectwo%20pracy.odt" accesskey="" title="Zalozenia akcji Konspiratorze - odbierz swiadectwo pracy.odt">Zalozenia akcji Konspiratorze ...</a></td>

  if action == "crud_remove" :
     F.removeMap(var)
     var["JCLOSE_DIALOG"] = True
Esempio n. 18
0
def dialogaction(action,var) :
  cutil.printVar("show note",action,var)
  
  if action == "before" :
    mnote = var["JUPDIALOG_START"]
    H = hmail.HotelMail(var)
    hma = H.findElem(mnote)
    note = H.getCMail(mnote)
    var["n_subject"] = note.getDescription()
    var["n_to"] = note.getRecipient()
    var["n_from"] = note.getFrom()
    var["n_content"] = note.getContent()
    var["n_resename"] = hma.getReseName()
    
    l = note.getaList()
    seq = []
    for a in l : seq.append({ "filename" : a.getFileName(), "realm" : a.getRealm(), "key" : a.getBlobKey() })
    cutil.setJMapList(var,ATALIST,seq)  
    
    cutil.setCopy(var,["n_subject","n_to","n_from","n_content","n_resename"])
    
  if action == "download" : 
    cdial.downloadObj(var,"",var["filename"],[var["realm"],var["key"]])


    
Esempio n. 19
0
def dialogaction(action,var) :

  cutil.printVar("alertp",action,var)

  if action == "before" :
      cutil.copyField(var,"message","Hello, I am who I am")

  if action == "click" :
      cutil.setOkMessage(var,var["message"], var["title"],"afterok")

  if action == "clickyesno" :
      cutil.setYesNoMessage(var,var["message"], var["title"],"afteryesno")

  if action == "clickerror" :
      cutil.setErrorMessage(var,var["message"], var["title"],"aftererror")

  if action == "copyfield" :
      cutil.copyField(var,"dispmessage",var["copymessage"])

  if action == "afterok" :
      cutil.copyField(var,"dispmessage","You click OK")

  if action == "afteryesno" :
      if var["JYESANSWER"] : s = "Yes click YES"
      else : s = "You click NO"
      cutil.copyField(var,"dispmessage",s)

  if action == "aftererror" :
      cutil.copyField(var,"dispmessage","You click OK error message")
Esempio n. 20
0
def dialogaction(action,var) :
  cutil.printVar("chart",action,var)
  
  if action == "before" :
      seq = []
      seq.append({ "id" : 5, "name" : "hello"})
      cutil.setJChartList(var,"chart",seq)
Esempio n. 21
0
def dialogaction(action,var):
    cutil.printVar("testset",action,var)
    
    if action == "set" :
        var["glob1"] = "Hello"
        var["globint"] = None
        var["id"] = None
        
    if action == "setmap" :
        map = {}
        map['d1'] = datetime.date(2014,5,6)
        map['i1'] = 555
        map['null'] = None
        map['h1'] = 'Hello'
        map['b1'] = con.toB(5)
        R.saveMap(var,map)
        
    
    if action == "getmap" :
        map = R.getMap(var)
        print map
        d = map['d1']
        print d,type(d)
        assert datetime.date == type(d)
        l = map['i1']
        print l,type(l)
        assert long == type(l)
        bb = map['b1']
        print bb,type(bb)
        assert float == type(bb)
        var["OK"] = True
Esempio n. 22
0
def dialogaction(action,var) :

    cutil.printVar("main",action,var)

    if action == "click" :
        s = _addval(var,"vstring") + _addval(var,"vpassword") + _addval(var,"vnumb") + _addval(var,"vchecked") + _addval(var,"vdate1") + _addval(var,"vdate2")
        cutil.copyField(var,"vresult",s)
Esempio n. 23
0
def custdetails(action,var):
  cutil.printVar ("custdetails", action,var)
  
  if action == "before" :
      xml = var["JUPDIALOG_START"]
      util.xmlToVar(var,xml,CLIST + [cust.CUSTACTION],DE)
      action = var[DE + cust.CUSTACTION]
      if action == cust.CUSTSHOWTOACTIVE or action == cust.CUSTSHOWONLY :
        custid = var[DE + "name"]
        custR = util.CUSTOMERLIST(var).findElem(custid)
        assert custR != None
        cust.customerToVar(var,custR,DE)
        cust.setCustVarCopy(var,DE)
        if action == cust.CUSTSHOWTOACTIVE : cutil.hideButton(var,["accept","ok"])
        else : 
          cutil.hideButton(var,["accept","acceptask","resign","find"])
          cust.enableCust(var,DE,False)
      else:
        cust.setCustVarCopy(var,DE)
        cutil.hideButton(var,["acceptask","ok"])
      
  if action == "accept" :
      var["JCLOSE_DIALOG"] = util.mapToXML(var,CLIST,DE)

  if action == "acceptask" and var["JYESANSWER"] :
      util.CUSTOMERLIST(var).changeElem(cust.customerFromVar(var,DE))
      var["JCLOSE_DIALOG"] = util.mapToXML(var,CLIST,DE)
      
  if action == "selectcustomer" :
      c_name = var["JUPDIALOG_RES"]
      if c_name == None : return      
      cust.setCustData(var,c_name,DE)
Esempio n. 24
0
def dialogaction(action,var) :
  cutil.printVar("dialog action",action,var)
  
  if action == "res" :
    e = var["enter"]
    var["start"] = e
    cutil.setCopy(var,"start")
    
Esempio n. 25
0
def dialogaction(action,var) :
  cutil.printVar("helperpa",action,var)
  
  
  if action == "copy" :
      var['helpid'] = var['fieldid']
      var['JCOPY_helpid'] = True
      var["JCLOSE_DIALOG"] = True
Esempio n. 26
0
def uptextaction(action,var) :
  printVar("uptextaction",action,var)
  seq = []
  for i in getTypeUpList() :
        rec = {'id' : i, "name" : i }
        seq.append(rec)
 
  setJMapList(var,action,seq)    
Esempio n. 27
0
def dialogaction(action,var) :
  cutil.printVar("binder1",action,var)
  
  if action == "button1" :
    cutil.setBinderOpen(var,"toast1")

  if action == "button2" :
    cutil.setBinderOpen(var,"toast2")
def dialogaction(action,var) :

  cutil.printVar("signal change",action,var)

  if action == "signalchange" :
      v = var["changefield"]
      s = v + " = " + str(var[v])
      cutil.copyField(var,"vresult",s)
Esempio n. 29
0
def dialogaction(action,var):
    
    cutil.printVar("test63",action,var)
    
    if action == "before" :
        if var.has_key("JCOPY_glob1") :
            assert "hello" == var["glob1"]
            var["OK"] = True
Esempio n. 30
0
def dialogaction(action,var) :
  cutil.printVar("title dialog",action,var)
  
  if action == "before" :
    cutil.cellTitle(var,"title2","Hello from Jython")
    
  if action == "res" :
    cutil.cellTitle(var,"title3","Now set " + var["title2"])
Esempio n. 31
0
def dialogaction(action, var):
    printVar("test60", action, var)
    if action == "before":
        var["glob1"] = "Hello"
        var["globbool"] = True
        var["globint"] = 123
        var["globcust"] = "abc"
        var["globdec"] = 12.5612
        #      var["globdate"] = datetime.date(2001,10,2)
        #      var["globtime"] = datetime.datetime(2001, 10, 2, 23, 4, 6)
        da = con.jDate(2001, 10, 2)
        print da, da.day
        var["globdate"] = da
        var["globtime"] = con.jDate(2001, 10, 2, 23, 4, 6)
        seq = []
        for i in range(10):
            seq.append({"id": i, "name": "name" + str(i)})
        var["JLIST_MAP"] = {"lista": seq}
        print "****************"

    if action == "setxml":
        var["JXMLCONTENT"] = var["XML"]
        var["JXMLCONTENTSET"] = True

    if action == "checkxml":
        xml = var["XML"]
        dname = var["J_DIALOGNAME"]
        map = {}
        getVar(map, dname, xml, [
            "glob1", "globbool", "globint", "globdec", "globdate", "globtime"
        ])
        print map
        assert "Hello" == map["glob1"]
        assert map["globbool"]
        assert 123 == map["globint"]
        assert 12.5612 == map["globdec"]
        #      assert datetime.date(2001,10,2) == map["globdate"]
        #      assert datetime.datetime(2001,10,2,23,4,6) == map["globtime"]
        assert con.jDate(2001, 10, 2) == map["globdate"]
        assert con.jDate(2001, 10, 2, 23, 4, 6) == map["globtime"]

    if action == "testglobdate":
        var["globdate"] = con.jDate(2001, 10, 2)
Esempio n. 32
0
def dialogaction(action, var):

    cutil.printVar("send mail", action, var)

    if action == "send" and var['JYESANSWER']:
        if var["attach"]:
            res = cmail.sendMailSingleAttach(var["subject"], var["content"],
                                             var["to"], var["from"],
                                             var["realm"], var["blobkey"],
                                             var["attach"])
        else:
            res = cmail.sendMail(var["subject"], var["content"], var["to"],
                                 var["from"])
        print res
        if cutil.emptyS(res):
            var["JOK_MESSAGE"] = "Note was sent (but does not mean that will get through)"
        else:
            var["JERROR_MESSAGE"] = res
            var["JMESSAGE_TITTLE"] = "Not was not sent"
Esempio n. 33
0
def dialogaction(action, var):

    cutil.printVar("dialogtypes", action, var)

    if action == "before":
        cutil.setCopy(var, [
            "vstring", "vpassword", "vint", "vdec0", "vdec1", "vdec2", "vdec3",
            "vdec4", "vchecked", "vdate1", "vtext"
        ])
        var["vstring"] = u"Hello, I'm string. Do you like ąę ?"
        var["vpassword"] = "******"
        var["vint"] = 123
        var["vdec0"] = 123.0
        var["vdec1"] = 123.5
        var["vdec2"] = 123.56
        var["vdec3"] = 123.567
        var["vdec4"] = 123.5678
        var["vchecked"] = True
        var["vdate1"] = con.jDate(2017, 6, 7)
        var["vtext"] = "First line\nSecond line\nThird line"
Esempio n. 34
0
def dialogaction(action, var):

    printVar("dialog action", action, var)
    if action == "test1":
        li = var["JLIST_MAP"]["list"]
        assert len(li) == 1
        rec = li[0]
        assert rec["id_name"] == 5
        assert rec["name"] == "hello"
        #        da = datetime.date(2013,10,3)
        da = con.jDate(2013, 10, 3)
        assert rec["date"] == da

    if action == "test2":
        li = var["JLIST_MAP"]["list"]
        assert len(li) == 100
        i = 0
        for rec in li:
            assert rec["id_name"] == i
            i = i + 1
Esempio n. 35
0
def dialogaction(action, var):
    printVar("listicon", action, var)

    if action == "before" or action == "crud_readlist":
        F.readList(var)
        seq = var["JLIST_MAP"]["list"]
        dname = "listxml.xml"
        for m in seq:
            m["image"] = str(m["credit"])

    if action == "clearrecords":
        F.removeAll()
        F.readList(var)

    if action == "clickimage":
        no = var["imagecolumn"]
        if no == 0:
            var["JOK_MESSAGE"] = "Less or greater then 0"
        else:
            var["JOK_MESSAGE"] = "Odd or even"
Esempio n. 36
0
def dialogaction(action, var):
    cutil.printVar("search", action, var)

    if action == "testsearch":
        dfrom = datetime.date(2014, 2, 1)
        dto = datetime.date(2014, 2, 5)
        l = rutil.searchForRooms(var, dfrom, dto)
        for r in l:
            assert r != None
            print r
        assert len(l) == 2
        dto = con.incDays(dfrom)
        l = rutil.searchForRooms(var, dfrom, dto)
        print l
        assert len(l) == 3
        dto = con.incDays(dfrom, 2)
        l = rutil.searchForRooms(var, dfrom, dto)
        print l
        assert len(l) == 2
        var["OK"] = True
Esempio n. 37
0
def dialogaction12(action, var):

    cutil.printVar("binder12", action, var)

    if action == "before":
        #    cutil.setCopy(var,["elevation","up"],)
        setTap(var, 0, True, VAR)
        setTap(var, 0, True, VAR1)

    v = VAR
    if action == "material": v = VAR1

    if action == "material" or action == "fabMaterial":
        ele = var[v[0]]
        up = var[v[1]]
        if ele == 5: up = False
        elif ele == 0: up = True
        if up: ele = ele + 1
        else: ele = ele - 1
        setTap(var, ele, up, v)
        cutil.setElevationAttr(var, action, ele)
def elemaction(action, var):
    cutil.printVar("elem action", action, var)

    if action == "before":
        if var["JCRUD_DIALOG"] == "crud_change" or var[
                "JCRUD_DIALOG"] == "crud_remove":
            setCopy(var, ["id", "number", "dic"])

    if action == "crud_add":
        key = F.nextKey()
        var["id"] = key
        F.addMap(var)
        var["JCLOSE_DIALOG"] = True

    if action == "crud_change":
        F.addMap(var)
        var["JCLOSE_DIALOG"] = True

    if action == "crud_remove":
        F.removeMap(var)
        var["JCLOSE_DIALOG"] = True
Esempio n. 39
0
def dialogactionpoly(action, var):
    cutil.printVar("main poly", action, var)

    if action == "before":
        cutil.setCopy(var, "glob1")
        var["glob1"] = "Hello, I'm here"

    if action == "seterror":
        cutil.setErrorField(var, "glob1", "@cannotbeempty")

    if action == "setenable":
        cutil.enableField(var, "glob1", True)

    if action == "setdisable":
        cutil.enableField(var, "glob1", False)

    if action == "sethidden":
        cutil.hideButton(var, "seterror")

    if action == "setvisible":
        cutil.hideButton(var, "seterror", False)
Esempio n. 40
0
def dialogaction(action, var):

    cutil.printVar("show doc", action, var)

    if action == "before":
        xml = var["JUPDIALOG_START"]
        okonly = var["JUPDIALOG_STARTPAR"] == "1"
        if okonly:
            cutil.hideButton(var, ["accept", "resign"])
            cutil.hideButton(var, "ok", False)

        reseparam.setXMLParam(var, xml)
        (va, li) = xmlutil.toMap(xml)
        for l in LI:
            var[l] = va[l]
        cutil.setCopy(var, LI)
        cutil.setJMapList(var, LIST, li)
        cutil.setFooter(var, LIST, T, va[T])

    if action == "accept" and var["JYESANSWER"]:
        var["JCLOSE_DIALOG"] = reseparam.getXMLParam(var)
Esempio n. 41
0
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 elempayment(action, var):
    cutil.printVar("elempayment", action, var)

    if action == "before" and var["JCRUD_DIALOG"] == "crud_add":
        var["paymentdate"] = cutil.today()
        b = BILLLIST(var).findElem(_getPayName(var))
        sumtotal = rutil.countTotal(var, b, rutil.getPayments(var))
        sumpay = rutil.countPayments(var, _getPayName(var))
        acc = con.minusDecimal(sumtotal, sumpay)
        if acc < 0: acc = None
        var["paymenttotal"] = acc
        cutil.setCopy(var, ["paymentdate", "paymenttotal"])

    if action == "crud_add" and not var["JCRUD_AFTERCONF"]:
        var["JYESNO_MESSAGE"] = "Do you want to add payment to this bill ?"
        var["JMESSAGE_TITLE"] = ""
        return

    if action == "crud_add" and var["JCRUD_AFTERCONF"]:
        p = util.newBillPayment()
        p.setBillName(_getPayName(var))
        p.setPaymentMethod(var["paymethod"])
        p.setDateOfPayment(con.toDate(con.today()))
        p.setPaymentTotal(con.toB(var["paymenttotal"]))
        PAYMENTOP(var).addPaymentForBill(_getPayName(var), p)
        var["JCLOSE_DIALOG"] = True
        _setChanged(var)
        return

    if action == "crud_remove" and not var["JCRUD_AFTERCONF"]:
        var["JYESNO_MESSAGE"] = "Are you sure to remove payment to this bill ?"
        var["JMESSAGE_TITLE"] = ""
        return

    if action == "crud_remove" and var["JCRUD_AFTERCONF"]:
        id = var["id"]
        PAYMENTOP(var).removePaymentForBill(_getPayName(var), id)
        _setChanged(var)
        var["JCLOSE_DIALOG"] = 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
Esempio n. 44
0
def spinneraction(action, var):
    cutil.printVar("spinner action", action, var)

    if action == "before":
        cutil.setCopy(var, ["toggle1", "toggle2"])
        var["toggle1"] = True
        var["toggle2"] = True
        return

    V = None
    if action == "toggleBtn1":
        V = VALS1
        to = "toggle1"
    if action == "toggleBtn2":
        V = VALS2
        to = "toggle2"
    if V == None: return
    active = not var[to]
    for v in V:
        cutil.setSpinnerActive(var, v, active)
    cutil.setCopy(var, to)
    var[to] = active
Esempio n. 45
0
def elemaction(action, var):

    printVar("elem action", action, var)

    if action == "before":
        if var["JCRUD_DIALOG"] == "crud_change" or var[
                "JCRUD_DIALOG"] == "crud_remove":
            setCopy(var, ["id", "firstname", "lastname", "credit"])

    if action == "crud_add":
        key = F.nextKey()
        var["id"] = key
        F.addMap(var)
        var["JCLOSE_DIALOG"] = True

    if action == "crud_change":
        F.addMap(var)
        var["JCLOSE_DIALOG"] = True

    if action == "crud_remove":
        F.removeMap(var)
        var["JCLOSE_DIALOG"] = True
Esempio n. 46
0
def dialogaction(action,var) :
  cutil.printVar("jaction",action,var)
  
  if action == "testmap" :
    l = miscutil.getMapFieldList("test85.xml")
    print l
    assert "glob1" in l
    assert not ("xxx" in l)
    
  if action == "testlistmap" :
    l = miscutil.getMapFieldList("test85.xml","reslist")
    print l
    assert "avail" in l
    assert len(l) == 4
    assert not ("xxx" in l)
    
  if action == "testxmllist" :
      li = []
      for i in range(1,20) :
          ma = {}
          ma["avail"] = True
          ma["resday"] = datetime.date(2014,2,1)
          ma["chooseroom"] = 'X'
          ma["resroomname"] = "Hello"
          ma["add"] = 345
          li.append(ma) 
          
      xml = xmlutil.toXML({},li)
      assert xml != None
      print xml
      (ma,li) = xmlutil.toMap(xml)
      print li
      for l in li :
          assert l.has_key("add")
      (ma,li1)  = xmlutil.toMapFiltrDialL(xml,"test85.xml","reslist")
      print li1
      assert len(li) == len(li1)
      for l in li1 :
          assert not l.has_key("add")
Esempio n. 47
0
def attachaction(action,var) :
  cutil.printVar("attach action",action,var)
  
  if action == "submitaction" :
     var["JYESNO_MESSAGE"] = "Do you really want to submit this file ?"
     var["JMESSAGE_TITLE"] = "Confirm"
     var["JAFTERDIALOG_ACTION"] = "afteryesnosubmit"
     return
   
  if action == "afteryesnosubmit" and var["JYESANSWER"] :
     var["J_SUBMIT"] = True
     
  if action == "aftersubmit" :
    files = var["JSUBMITRES"]    
    elems = files.split(":")
    realm = elems[0]
    key = elems[1]
    filename = elems[2]
    _setVals(var,realm,key,filename)
    
  if action == "addpdf" and var["JYESANSWER"] :
    b = createPDF(var)
#    print "dok=",b.length
    i = SHolder.getAddBlob()
    realm = "TESTPDF"
    key = "PDF"
    bkey = i.addNewBlob(realm,key,b)
    _setVals(var,realm,bkey,"test.pdf")

  if (action == "addpdf1" or action == "addpdf2") and var["JYESANSWER"] :
    if action == "addpdf1" : b = createPDF1(var)
    else : b = createPDF2(var)
#    print "dok=",b.length
    i = SHolder.getAddBlob()
    realm = "TESTPDF"
    key = "PDF"
    bkey = i.addNewBlob(realm,key,b)
    _setVals(var,realm,bkey,"test.pdf")       
def dialogaction(action, var):

    cutil.printVar("reservation", action, var)

    if action == "before":
        R = util.RESFORM(var)
        C = util.CUSTOMERLIST(var)
        seq = R.getList()
        list = []
        for s in seq:
            sta = resstat.getResStatus(var, s)
            statuS = resstat.getStatusS(sta)
            (arrival, departure, roomname, rate,
             nog) = rutil.getReseDate(var, s)
            ma = {
                "name": s.getName(),
                "resdate": s.getCreationDate(),
                "checkin": arrival,
                "checkout": departure,
                "roomname": roomname,
                "resestatus": M(statuS)
            }
            cu = C.findElem(s.getCustomerName())
            cust.toCustomerVar(ma, cu, PREC, CULIST)
            list.append(ma)

        cutil.setJMapList(var, LIST, list)

    if action == "showrese":
        resename = var["name"]
        #    (room,day) = rutil.getRoomDateFromVar(var)
        diallaunch.reservationdialogaction(var, resename, var["roomname"],
                                           var["checkin"])

    if action == "showmails":
        rename = var["name"]
        diallaunch.showlistofmail(var, rename)
Esempio n. 49
0
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")
Esempio n. 50
0
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)
Esempio n. 51
0
def dialogaction(action, var):
    cutil.printVar("test big", action, var)

    if action == "run":
        f = var["bignumber"]
        print f
        var["out"] = f

    if action == "save":
        F.removeAll()
        key = F.nextKey()
        var["id"] = key
        F.addMap(var)

    if action == "restore":
        seq = F.readList(var, False)
        ma = seq[0]
        f = ma["bignumber"]
        print f
        var["out"] = f

    if action == "runthread":
        for i in range(10):
            print var["no"], " -----------------------"
Esempio n. 52
0
def dialogaction(action, var):

    cutil.printVar("test49", action, var)

    if action == "test1":
        #        s = "I'm your attachment sent from Jython code.\n What do you think about it ?\n Do you like me ?"
        #        key = ADDBLOB.addNewBlob(cutil.PDFTEMPORARY,"TESTJ",StringUtil.toBytes(s))
        #        print key
        billno = "BBB"
        comment = "Hello"
        tempkey = "T_KEY"
        B = _constructB(billno)
        B.removeBlob(var)
        B.readBlobList(var)
        li = var["JLIST_MAP"][LIST]
        assert 0 == len(li)
        B.addBlob(var, comment, tempkey)
        B.readBlobList(var)
        li = var["JLIST_MAP"][LIST]
        print len(li)
        for l in li:
            print l
        assert 1 == len(li)
        var["OK"] = True
Esempio n. 53
0
def returnaction(action,var) :
   cutil.printVar("return action",action,var)
   
   if action == "resign" : var["JCLOSE_DIALOG"] = True
   if action == "accept" and var['JYESANSWER'] : var["JCLOSE_DIALOG"] = True
     
Esempio n. 54
0
def pricelistaction(action, var):

    cutil.printVar("price list action", action, var)

    if action == "before" or action == "crud_readlist":
        _createList(var)
Esempio n. 55
0
def dialogaction(action, var):
    cutil.printVar("binder32", action, var)

    if action == "before":
        cutil.setCopy(var, "datePicker")
        var["datePicker"] = con.jDate(2016, 3, 5)
Esempio n. 56
0
def dialogaction(action, var):

    cutil.printVar("test46", action, var)

    if action == "test1":
        li = cutil.JOURNAL(var).getList()
        for j in li:
            print j.getCreationPerson(), j.getJournalType(), j.getOObjectId()
            da = j.getCreationDate()
            print da, type(da)
            assert "user" == j.getCreationPerson()
        assert 1 == len(li)
        var["OK"] = True

    if action == "test2":
        li = cutil.JOURNAL(var).getList()
        logout = False
        for j in li:
            print j.getCreationPerson(), j.getJournalType()
            assert "user" == j.getCreationPerson()
            if j.getJournalType() == "LOGOUT": logout = True
        assert 3 == len(li)
        assert logout
        var["OK"] = True

    if action == "test3":
        jou = cutil.JOURNAL(var).getList()
        print len(jou)
        li = []
        for j in jou:
            ma = {
                "name": j.getName(),
                "date": j.getCreationDate(),
                "hotelname": j.getOObjectId(),
                "journaltype": j.getJournalType(),
                "user": j.getCreationPerson()
            }
            li.append(ma)
        cutil.setJMapList(var, "list", li)
        assert 3 == len(li)
        var["OK"] = True

    if action == "test4":
        jou = cutil.JOURNAL(var).getList()
        print len(jou)
        li = []
        for j in jou:
            da = j.getCreationDate()
            print da, type(da)
            jda = con.toJDateTime(da)
            #            jda = jd.replace(tzinfo=l)
            #           print "jda=",jda,type(jda)
            tda = time.time()
            print tda, type(tda)
            jjda = datetime.datetime.fromtimestamp(time.time())
            print jjda, type(jjda)
            ma = {
                "name": j.getName(),
                "date": da,
                "hotelname": j.getOObjectId(),
                "journaltype": j.getJournalType(),
                "user": j.getCreationPerson(),
                "jdate": jda
            }
            li.append(ma)
        cutil.setJMapList(var, "list1", li)
        #        assert 3 == len(li)
        var["OK"] = True
Esempio n. 57
0
def dialogaction(action, var):

    cutil.printVar("Column list", action, var)

    if action == "before":
        cutil.setStandEditMode(var, LIST, ["visible", "columnname"])
Esempio n. 58
0
def reservationaction(action, var):
    cutil.printVar("reservation", action, var)

    if action == "before":
        list = _getList(var)
        var["JDATELINE_MAP"] = {"reservation": {"linedef": list}}

    if action == "datelineaction":
        (room, day) = rutil.getRoomDateFromVar(var)
        R = util.RESOP(var)
        RO = util.ROOMLIST(var)
        RFORM = util.RESFORM(var)
        services = RO.getRoomServices(room)
        if len(services) == 0:
            var['JERROR_MESSAGE'] = "@noserviceassigned"
            var['JMESSAGE_TITLE'] = "@incompleteconfiguration"
            return
        li = util.getServicesForRoom(var, room)
        if li == None:
            var['JERROR_MESSAGE'] = "@nopricelistforthisservice"
            var['JMESSAGE_TITLE'] = "@incompleteconfiguration"
            return

        res = rutil.getReservForDay(var, room, day)

        if res.isEmpty():
            diallaunch.newreservation(var, room, day, 1, 1)
        else:
            ares = res.get(0)
            resid = ares.getResId()
            (room, day) = rutil.getRoomDateFromVar(var)
            diallaunch.reservationdialogaction(var, resid, room, day)

    if action == "datelinevalues":
        seq = var["JDATELINE_QUERYLIST"]
        vals = []
        query = cutil.createArrayList()
        R = util.RESOP(var)
        RFORM = util.RESFORM(var)
        for s in seq:
            dfrom = s["JDATELINE_FROM"]
            dto = s["JDATELINE_TO"]
            name = s["name"]
            q = rutil.createResQueryElem(name, dfrom, dto)
            query.add(q)

        resList = R.queryReservation(query)
        vals = []

        dl = datetime.timedelta(1)
        for s in seq:
            dfrom = s["JDATELINE_FROM"]
            dto = s["JDATELINE_TO"]
            name = s["name"]
            dt = dfrom
            prevres = None
            prevmap = None
            while dt <= dto:
                resid = None
                for ans in resList:
                    aname = ans.getRoomName()
                    dres = ans.getResDate()
                    if con.eqDate(dt, dres) and aname == name:
                        resid = ans.getResId()
                        break

                if resid != None:
                    if resid == prevres:
                        prevmap["colspan"] = prevmap["colspan"] + 1
                    else:
                        if prevmap: vals.append(prevmap)
                        rform = RFORM.findElem(resid)
                        sta = resstat.getResStatus(var, rform)
                        form = "resroom"
                        map = {
                            "name": name,
                            "datecol": dt,
                            "colspan": 1,
                            "form": form,
                            "0": _resInfo(var, resid),
                            "1": resstat.COLORS[sta],
                            "hint": "@" + resstat.getStatusS(sta)
                        }
                        prevmap = map
                        prevres = resid
                dt = dt + dl
            if prevmap: vals.append(prevmap)

        var["JDATELINE_MAP"] = {"reservation": {"values": vals}}
Esempio n. 59
0
def dialogaction(action, var):

    cutil.printVar("helperstring", action, var)
Esempio n. 60
0
def dialogaction(action, var):
    printVar("changestatus", action, var)
    if action == "change1":
        setStatusMessage(var, var["combof"], var["textf"])