Jump to content

mhmda

uniGUI Subscriber
  • Posts

    1141
  • Joined

  • Last visited

  • Days Won

    157

Posts posted by mhmda

  1.  

     

    But I really love when I do everything using only Delphi.

     

    Well I would love that too, but doing things in client side (at least for me) has two advantages:

     

    1. Knowing better how extjs works.

    2. Less connections to the Server (saving bandwidth and delay)

     

    Also validating things that could be done in client side I do in client side for example:

     /* regex for email validation */
      var ereg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    
      if(!ereg.test(frmSignUP.edtEmail.getValue())) {
        Ext.Msg.alert('Invalid email address');
      }   
    

    If I do that in delphi I would send all data to server and do validation there:

    //------------------------------------------------------------------------------
    function IsValidEmail(const Value: string): Boolean;
    function CheckAllowed(const s: string): Boolean;
      var i: Integer;
      begin
        Result:= false;
        for i:= 1 to Length(s) do
          if not (s[i] in ['a'..'z',
                           'A'..'Z',
                           '0'..'9',
                           '_',
                           '-',
                           '.']) then Exit;
        Result:= true;
      end;
    var
      i: Integer;
      NamePart, ServerPart: string;
    begin
      Result:= False;
      i:=Pos('@', Value);
      if i=0 then Exit;
      NamePart:=Copy(Value, 1, i-1);
      ServerPart:=Copy(Value, i+1, Length(Value));
      if (Length(NamePart)=0) or ((Length(ServerPart)<5)) then Exit;
      i:=Pos('.', ServerPart);
      if (i=0) or (i>(Length(serverPart)-2)) then Exit;
      Result:= CheckAllowed(NamePart) and CheckAllowed(ServerPart);
    end;
    
    if not IsValidEmail(edtEmail.Text) then
     begin
       ShowMessage('Invalid email address');
     end
    

    Using client side is more efficient, faster and less code.

  2. Yes you can, here is how to do it:

     

    Calendar event color depends on EventID.

     

    id1=.ext-color-1

    id2=.ext-color-2

    id3=.ext-color-3... and so on...

     

    So I add js code, for ecample: Form->UniEvents->beforeinit:

    function randomColor() {
        var rgb = [];
        for(var i = 0; i < 3; i++) {
         if(i==1) rgb.push(Math.floor(Math.random() * 50));
         else rgb.push(Math.floor(Math.random() * 255));
        } 
         return 'rgb('+ rgb.join(',') + ')';
      }
      
      for(var i=1;i<200;i++) {
       $("<style type='text/css'> .ext-color-"+i.toString()+"{ color:"+randomColor()+";} </style>").appendTo("head");
      }    
    
    • Upvote 1
  3. Unigui can't implement this (not every VCL event can be done in web app.), Please refer to Extjs doc. and how it works, it is not so easy as we think as implementing this for VCL.

     

    For me the best solution for this (and it works just fine) is by triggering the Fields-->OnGetText and here you can do whatever you want, change font: family, size, color, insert image.....

  4.  

    estrify, on 01 Sept 2015 - 08:57 AM, said:

    snapback.png

    Dear Farshad,

     

    The following was working ok until build 1197. Please, could you tell me how I have to manage it from now?.

     

    ASessionList:=UniServerModule.SessionManager.Sessions.SessionList.LockList;

    ...

    UniServerModule.SessionManager.Sessions.SessionList.UnlockList;

    Thx.

     

     

     

     

     

    Farshad: Session Manager is redesigned. I will try to find a workaround for developer access to Sessions in next build.

     

    Any solution for this?

  5. Farshad in mobile session you don't load jquery but in desktop session you load it, please add it also to mobile session sometimes we need to use jquery functions....

     

    For now I add it manually I hope it will NOT make a duplicate in desktop sessions.

     

    Thank you....

  6. I thought it happens to me only, the 'Yes' 'No' of the confirm dialog disappears.

     

    I use client side code, I thing that it maybe related to z-order of the mask screen?

    Ext.Msg.confirm('xxxxxxxxx', 'xxxxxxxxxxx'+selectedRecord.get('1')+'?', function(btn){
                         if (btn == 'yes'){
                            frmMngSchedules.grdSchedule.showMask('Please wait');                    
                            ajaxRequest(frmMngSchedules.window, 'removeStudent',["id="+selectedRecord.get('0')]);
                            return true; 
                         }
                         else if (btn=='no') {
                            return false;
                         }
                        }); 
    

    Any idea?

×
×
  • Create New...