Changeset 566


Ignore:
Timestamp:
Mar 6, 2011, 11:48:47 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

GUI-Tools: EVFSGUI 2.1: Attempt to finally fix the wrong workgroup issue

Location:
branches/guitools-2.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/guitools-2.0/evfsgui/evfsgui.VRP

    r558 r566  
    1010VRXWindow: __VREFileListWindow,1,807,11033,1590,3358
    1111VRXWindow: __VRESectionListWindow,1,2674,10648,8696,4794
    12 VRXWindow: __VREToolsWindow,1,2517,7082,6483,1663
     12VRXWindow: __VREToolsWindow,1,2517,7082,6486,1665
    1313VRXWindow: __VREWindListWindow,1,542,8721,2650,3150
    1414UserFile: 1
    1515UserWindow: Main,1
    16 UserWindow: SW_ADVANCED,1
    17 UserWindow: SW_LOGIN,1
    18 UserWindow: SW_MOUNTPOINT,1
     16UserWindow: SW_INFO,1
  • branches/guitools-2.0/evfsgui/evfsgui.VRX

    r558 r566  
    14411441    end
    14421442    if Foundserver = 0 then do
     1443        call _RefreshWorkgroups
    14431444        machine = VRGet("EF_SERVER","value")
    14441445        smbtree.!machine = VRMethod( "CN_SMBTREE", "AddRecord",,, machine)
     
    14491450        call _UserCredUpdate
    14501451        call _RefreshShares
     1452        ok = VRSet( "CN_smbtree", "Painting", 1  )
     1453
     1454        ok = VRSet("Main", 'Pointer', '<default>' )
     1455        ok = VRSet("CN_smbtree","Enabled", 1)
     1456        ok = VRSet("TM_Throbber","Enabled", 0)
     1457        ok = VRSet("Pict_Throbber","Visible", 0)
    14511458    end
    14521459return
  • branches/guitools-2.0/shared/smbtree.vrs

    r558 r566  
    232232        stat = stream(smbmachine.I,'c','open read')
    233233        if stat = "READY:" then do /* we found a readable output file */
     234            OneWorkGroupOnly = 0
    234235            /* Machine = VRParseFilename(smbmachine.I,'E') */
    235236            Machine = substr(smbmachine.I,pos('.',smbmachine.I)+1)
     
    303304            end
    304305            line = linein(smbmachine.I)
    305             /* Reading workgroup and master - eventually both empty */
     306            /* Reading FIRST workgroup and master - eventually both empty */
    306307            line = linein(smbmachine.I)
     308
     309            /* Multiple workgroups? */
     310            if lines(smbmachine.I) = 0 then OneWorkGroupOnly = 1
     311                                       else OneWorkGroupOnly = 0
     312            say "  OneWorkGroupOnly = "OneWorkGroupOnly
     313
    307314            parse var line '09'x workgroup master
    308315            master = strip(master)
    309316
    310             /* we use this to set the workgroup for manually added servers */
    311             if workgroup <> "" then do
     317            /* we use this to set the workgroup for manually added servers - if there is ONLY ONE workgroup */
     318            if workgroup <> "" & OneWorkGroupOnly = 1 then do
    312319                wgh = _GetMachinehandle(workgroup)
    313                 if wgh = "" then do /* This machine appears to be in a new workgroup - add it as well */
     320                if wgh = "" then do /* The machine appears to be in a new workgroup - add it as well */
     321                    /* NOTE: This should be obsolete now because the list of available
     322                       workgroups should always have been updated before we get here */
    314323                    wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
    315324                    ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup)
     
    319328                end
    320329                /* we only do this for machines with empty parent (=workgroup) handle */
    321                 /* this might not be good enough yet - verifictaion required          */
     330                /* IF there is only one workgroup */
     331                if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do
     332                    ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh)
     333                end
     334            end
     335            else do /* There are multiple workgroups, we need additional */
     336                    /* measures tofind out which is our workgroup */
     337                say     '  'samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
     338                address cmd samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
     339                infoline = linein(samba.!msg)
     340                if word(infoline,1) = "creating" then do /* upcase tables are missing */
     341                    say "Missing upcase tables detected!"
     342                    infoline = linein(samba.!msg)
     343                    infoline = linein(samba.!msg)
     344                end
     345                IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
     346                ok = stream(samba.!msg,'c','close')
     347                ok = SysFileDelete(samba.!msg)
     348
     349                parse var infoline "Domain=["WorkGroup"] "Rest
     350                wgh = _GetMachinehandle(workgroup)
    322351                if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do
    323352                    ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh)
     
    360389    if match = 0 then rh.I = "" /* return an empty handle, if there was no match */
    361390return rh.I
     391
     392/*:VRX         _RefreshWorkgroups
     393*/
     394_RefreshWorkgroups:
     395    say time()' _RefreshWorkgroups() started'
     396    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
     397    if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
     398
     399    say         samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
     400    address cmd samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
     401
     402    if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0
     403    if UserCred = '-N' then UserCred = ''
     404
     405    drop wgline.
     406
     407    sl = 0
     408
     409    do until lines(samba.!msg) = 0
     410        sl = sl + 1
     411        wgline.sl = linein(samba.!msg)
     412    end
     413    wgline.0 = sl
     414    ok = stream(samba.!msg,'c','close')
     415    ok = SysFileDelete(samba.!msg)
     416
     417    do sl = 1 to wgline.0
     418       if pos("RECEIVING",translate(wgline.sl)) > 0 | pos("TDB(",translate(wgline.sl)) > 0 then do
     419            iterate /* We ignore errors here */
     420        end
     421        workgroup = wgline.sl
     422        wgh = _GetMachinehandle(workgroup)
     423        if wgh = "" then do /* A new workgroup was found -- add it */
     424            wgh = VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
     425            ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup)
     426            ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0)
     427            ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
     428            ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
     429        end
     430    end
     431    say time()' _RefreshWorkgroups() done'
     432return
     433
Note: See TracChangeset for help on using the changeset viewer.