Changeset 1029


Ignore:
Timestamp:
Jun 7, 2017, 5:15:14 PM (8 years ago)
Author:
Herwig Bauernfeind
Message:

EVGSGUI More work on ACLS browser

Location:
trunk/guitools/evfsgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/evfsgui/evfsgui.vrp

    r1026 r1029  
    1212VRXWindow: __VREFileListWindow,1,3300,14695,2665,3358
    1313VRXWindow: __VRESectionListWindow,1,2867,14020,10889,5035
    14 VRXWindow: __VREToolsWindow,1,4011,4963,6986,1661
     14VRXWindow: __VREToolsWindow,1,2867,337,6989,1667
    1515VRXWindow: __VREWindListWindow,1,458,14695,4866,3150
    1616UserFile: 1
    1717UserWindow: Main,1
    18 UserWindow: SW_ACLS,1
     18UserWindow: SW_LOGIN,1
  • trunk/guitools/evfsgui/evfsgui.vrx

    r1026 r1029  
    109109__VXREXX____APPENDS__:
    110110/*
     111#append ..\shared\browse.vrs
    111112#append ..\shared\cltinit.vrs
    112113#append ..\shared\inittempdir.vrs
     
    249250    VolTplRH = VRMethod("CN_CURRENT", 'AddRecord', , 'First', 'Volume template', icons.!template )
    250251    MpTplRH  = VRMethod("CN_CURRENT", 'AddRecord',  VolTplRH, 'First', 'Mountpoint template', icons.!template )
    251 return
    252 
    253 /*:VRX         _BrowseBuildPath
    254 */
    255 _BrowseBuildPath: procedure expose options. icons. samba. sharerh
    256     if options.!debug == 1 then say time()' _BrowseBuildPath started'
    257     rh = arg(1)
    258 
    259     finished = 0
    260     BrowsePathStr = ''
    261 
    262     do while \finished
    263         parentrh = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"Parent")
    264         resname  = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"caption")
    265         userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"userdata")
    266         parse var userdata udatatype '|' udatamsg
    267         parse var resname resname '0D0A'x .
    268         resname = strip(resname)
    269         /* say "  Not connected - cannot open!" */
    270         select
    271             when udatatype = "SERVER" then do
    272                 BrowsePathStr = '\\'resname'\'BrowsePathStr
    273                 finished = 1
    274             end
    275             when udatatype = "DISK" then do
    276                 BrowsePathStr = resname'\'BrowsePathStr
    277                 sharerh =rh
    278                 rh = parentrh
    279             end
    280             otherwise do
    281                 BrowsePathStr = resname'\'BrowsePathStr
    282                 rh = parentrh
    283             end
    284         end
    285         /* say '  BrowsePathStr = "'BrowsePathStr'"' */
    286     end
    287     BrowsePathStr = strip(BrowsePathStr,'T','\')
    288     if options.!debug == 1 then say time()' _BrowseBuildPath done, returning "'BrowsePathStr'"'
    289 return BrowsePathStr
    290 
    291 /*:VRX         _BrowseDirectory
    292 */
    293 _BrowseDirectory: /* This must not be a procedure */
    294     if options.!debug == 1 then say time()' _BrowseDirectory started'
    295 
    296     /* Turn off painting */
    297     ok = VRSet("CN_SMBTREE","Painting", 0 )
    298     call VRSet VRWindow(), 'Pointer', 'Wait'
    299 
    300     /* Make sure credentials are usable */
    301     if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
    302 
    303     /* We have to remove the double % for smbclient.exe - not entirely clear why */
    304     OldUserCred = ""
    305     if pos('%%',UserCred) > 0 & pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0  then do
    306         OldUserCred = UserCred
    307         parse var UserCred '--user='username'%%'password
    308         UserCred = '--user='username'%'password
    309         call lineout "debug", "  Strip double %%!!!"
    310     end
    311 
    312     say '  'samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'"'
    313     address cmd samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'" 'debuglevel' 2>NUL 1>'samba.!msg
    314 
    315     if UserCred   = '-N' then UserCred = ''
    316 
    317     if OldUserCred <> "" then do
    318         UserCred = OldUserCred
    319         OldUserCred = ""
    320         say "  Restore double %%!!!"
    321     end
    322 
    323     I = 0
    324     ok = VRSet("DT_STATUSBAR","Caption", "")
    325     do until lines(samba.!msg) = 0
    326         infoline = linein(samba.!msg)
    327         select
    328             when pos('blocks',infoline) > 0 then do /* Last line */
    329                 /* we should handle size information here */
    330                 iterate
    331             end
    332             when I = 0 & length(infoline) > 0 & left(infoline,2) <> "  " then do /* Login message */
    333                 say '  Login message "'Infoline'"'
    334                 ok = VRMethod("CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Userdata", SMBObj.udatatype'|'infoline )
    335                 ok = VRSet("DT_STATUSBAR","Caption", infoline)
    336             end
    337             when left(infoline,2) = "  " & length(infoline) > 0 then do /* file or DIR */
    338                 wn       = words(infoline)
    339                 fyear    = word(infoline,wn)
    340                 ftime    = word(infoline,wn-1)
    341                 fday     = word(infoline,wn-2)
    342                 fmonth   = word(infoline,wn-3)
    343                 fwday    = word(infoline,wn-4)
    344                 /* FIXME: This is flaky! */
    345                 pos_attr = max(pos(fwday,infoline)-16,4)
    346                 fsize    = word(infoline,wn-5)
    347                 fattr    = substr(infoline,pos_attr,6)
    348                 fname    = strip( substr(infoline,3,pos_attr-3))
    349                 if fname = '.' | fname = '..' then iterate /* we do not display these */
    350                 if pos('H',fattr) > 0  then iterate /* we do not display hidden files */
    351                 if pos('S',fattr) > 0  then iterate /* we do not display system files */
    352                 I = I + 1
    353                 fh.I = VRMethod( "CN_SMBTREE", "AddRecord", SMBObj.rh, , fname)
    354                 if pos('D',fattr) = 0 then do
    355                     Ext = translate(VRParseFIleName(fname,'E'))
    356                     select
    357                         when Ext = 'EXE' then ficon = icons.!exe /* executable */
    358                         when Ext = 'CMD' then ficon = icons.!cmd /* OS/2 or NT batch */
    359                         when Ext = 'BAT' then ficon = icons.!bat /* DOS batch */
    360                         when Ext = 'PDF' then ficon = icons.!pdf /* PDF document */
    361                         when wordpos(Ext, 'XLS SXC ODS') > 0         then ficon = icons.!spreadsheet
    362                         when wordpos(Ext, 'DOC SXW ODT') > 0         then ficon = icons.!textdocument
    363                         when wordpos(Ext, 'FW2 FW3 FW4') > 0         then ficon = icons.!framework
    364                         when wordpos(Ext, 'JPG BMP PNG GIF TIF') > 0 then ficon = icons.!image
    365                         when wordpos(Ext, 'AVI MPG FLV WMV') > 0     then ficon = icons.!movie
    366                         when wordpos(Ext, 'WAV MP3 OGG MID') > 0     then ficon = icons.!sound
    367                         when wordpos(Ext, 'WPI') > 0                 then ficon = icons.!warpin
    368                         when wordpos(Ext, 'ZIP') > 0                 then ficon = icons.!zip
    369                         when wordpos(Ext, 'INF HLP') > 0             then ficon = icons.!view
    370                         when wordpos(Ext, 'TXT') > 0                 then ficon = icons.!plaintext
    371                         otherwise ficon = icons.!defaultfile /* default file icon */
    372                     end
    373                     ftype = 'FILE'
    374                 end
    375                 else do
    376                     ficon = icons.!folder
    377                     ftype = 'DIRECTORY'
    378                 end
    379 
    380                 ok = VRmethod("CN_SMBTREE", "SetRecordAttr", fh.I, "userdata", ftype'|'fsize' Bytes 'fday'-'fmonth'-'fyear' 'ftime,'icon',Ficon)
    381 
    382             end
    383             otherwise nop /* no other line type */
    384         end
    385     end
    386     if I > 0 then ok = VRMethod("CN_SMBTREE","SetRecordAttr",SMBObj.rh, "Icon", icons.!folder_open)
    387     ok = stream(samba.!msg,'c','close')
    388     ok = SysFileDelete(samba.!msg)
    389 
    390     ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh,"Collapsed", 0)
    391     /* Turn on painting */
    392     call VRSet VRWindow(), 'Pointer', '<default>'
    393     ok = VRSet("CN_SMBTREE","Painting", 1 )
    394     if options.!debug == 1 then say time()' _BrowseDirectory done'
    395 return
    396 
    397 /*:VRX         _BrowseObjectOpen
    398 */
    399 _BrowseObjectOpen: procedure expose samba. options. cd. icons.
    400     machine    = arg(1)
    401     sharename  = arg(2)
    402     browsepath = arg(3)
    403 
    404     CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
    405 
    406     OpenOk = 0
    407 
    408     DO i = 1 TO records.0
    409         if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!active then do
    410             if options.!debug == 1 then say '  'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH)
    411             if machine = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH) &,
    412                sharename = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH) then do
    413                 Object = strip(VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH),'T','\')'\'browsepath
    414                 if options.!debug == 1 then say '  Non UNC object: "'Object'"'
    415                 ID = VRMethod( "Application", "StartThread", "wps_open", Object, "DEFAULT" )
    416                 OpenOK = 1
    417             end
    418         end
    419         if OpenOK = 1 then leave
    420     end
    421 return OpenOK
    422 
    423 /*:VRX         _BrowseResetObject
    424 */
    425 _BrowseResetObject: procedure
    426     ok = VRSet("CN_SMBTREE","Painting", 0 )
    427     rh = arg(1)
    428 
    429     /* Remove all files and directories whose parent is our share */
    430     ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "AllRH." )
    431     do I = 1 to AllRH.0
    432         AllParentRH  = VRMethod("CN_SMBTREE","GetRecordAttr",AllRH.I,"Parent")
    433         if AllParentRH = rh then ok = VRMethod( "CN_SMBTREE", "RemoveRecord", AllRH.I )
    434     end
    435     ok = VRSet("CN_SMBTREE","Painting", 1 )
    436252return
    437253
     
    673489RETURN location
    674490
    675 /*:VRX         _dropdeprecated
    676 */
    677 _dropdeprecated:
    678     /* The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
    679        The _dropdeprecated routine will drop any value in order to make sure the stem actually works
    680        If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
    681      */
    682     drop rh
    683     drop parentrh
    684     drop gparentrh
    685     drop icon
    686     drop resname
    687     drop comment
    688     drop udatatype
    689     drop udatamsg
    690 return
    691 
    692491/*:VRX         _Dynamic
    693492*/
     
    883682
    884683    /* Statusbar */
    885     ok = VRSet("DT_STATUSBAR", "Caption", VRGet("Main", "HintText"))
     684    call _StatusBarWrapper VRGet("Main", "HintText")
    886685
    887686    /* Common margin around controls */
     
    15681367    /* preliminary implementation - we just do not ignore it anymore -
    15691368       - ShowMsg from smbmon/smbusers should become a shared library */
    1570     ok = VRSet("DT_StatusBar", "Caption", Msg.Text)
     1369    call _StatusBarWrapper Msg.Text
    15711370return
    15721371
     
    16741473    mtype.5 = NLVGetMessage(110 )
    16751474
    1676     if options.!debug == 1 then say '  initializing icons. '
    1677     icons.!bat              = '#1:PMWP.DLL'
    1678     icons.!cmd              = '#2:PMWP.DLL'
    1679     icons.!exe              = '#3:PMWP.DLL'
    1680     icons.!template         = '#10:PMWP.DLL'
    1681     icons.!drive            = '#16:PMWP.DLL'
    1682     icons.!defaultfile      = '#24:PMWP.DLL'
    1683     icons.!folder           = '#26:PMWP.DLL'
    1684     icons.!folder_open      = '#34:PMWP.DLL'
    1685     icons.!machine_awake    = '#35:PMWP.DLL'
    1686     icons.!machine_sleeping = '#61:PMWP.DLL'
    1687     icons.!workgroup        = '#62:PMWP.DLL'
    1688     icons.!pdc              = '#63:PMWP.DLL'
    1689     icons.!active           = '#64:PMWP.DLL'
    1690     icons.!passive          = '#68:PMWP.DLL'
    1691     icons.!printer          = '#65:PMWP.DLL'
    1692     icons.!drive_inactive   = '#70:PMWP.DLL'
    1693     icons.!pdf              = '#80'
    1694     icons.!spreadsheet      = '#82'
    1695     icons.!textdocument     = '#86'
    1696     icons.!framework        = '#87'
    1697     icons.!image            = '#88'
    1698     icons.!movie            = '#89'
    1699     icons.!sound            = '#90'
    1700     icons.!warpin           = '#91'
    1701     icons.!zip              = '#92'
    1702     icons.!view             = '#93'
    1703     icons.!plaintext        = '#94'
     1475    call _BrowseIconsInit
    17041476
    17051477    p_workgroup             = "Unknown"
     
    20171789*/
    20181790CN_CONDET_Click:
    2019     /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
     1791    /* call _StatusBarWrapper VRGet("Main", "HintText") */
    20201792return
    20211793
     
    20681840CN_CURRENT_Click:
    20691841    if options.!debug == 1 then say time()' CN_CURRENT_Click started'
    2070     /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
     1842    /* call _StatusBarWrapper VRGet("Main", "HintText") */
    20711843
    20721844    /* Herwig B. */
     
    20801852    options.currentdata = data
    20811853
    2082     /* ok = VRset("DT_StatusBar","Caption", data' - 'VRGet("Main", "HintText")) */
     1854    /* call _StatusBarWrapper data' - 'VRGet("Main", "HintText") */
    20831855
    20841856    PARSE VAR data p_node ';' p_mounts ';' p_string
     
    24492221CN_SMBTREE_Click:
    24502222    if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
    2451     /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
     2223    /* call _StatusBarWrapper VRGet("Main", "HintText") */
    24522224
    24532225    call _dropdeprecated
     
    24552227    call _ContextMenuSelectedSet
    24562228
    2457     ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
     2229    call _StatusBarWrapper SMBObj.udatamsg
    24582230
    24592231    if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
     
    24632235CN_SMBTREE_ContextMenu:
    24642236    if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
    2465 
    2466     call _ContextMenuSelectedSet
    2467 
    24682237    call _dropdeprecated
    2469     call _GetSmbObjectProperties VRInfo('Record')
    2470 
    2471     BrowsePath = _browsebuildpath(SMBObj.rh)
    2472 
    2473     call _BrowseResetObject(SmbObj.rh)
    2474 
    2475     parse var browsepath '\\'machine'\'sharename '\' browsepath
    2476 
    2477     ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
     2238    RH = VRInfo('Record')
     2239    if RH <> "" then do
     2240        call _GetSmbObjectProperties RH
     2241        call _ContextMenuSelectedSet
     2242
     2243        BrowsePath = _browsebuildpath(SMBObj.rh)
     2244
     2245        call _BrowseResetObject(SmbObj.rh)
     2246
     2247        parse var browsepath '\\'machine'\'sharename '\' browsepath
     2248
     2249        ok = VRMethod( "Menu_Selected", "Popup", , , "", "PositionOnItem" )
     2250    end
    24782251
    24792252    if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
     
    26132386*/
    26142387DT_STATUSBAR_ContextMenu:
    2615     ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
     2388    call _StatusBarWrapper VRGet("Main", "HintText")
    26162389return
    26172390
     
    43724145
    43734146        if word(ok,1) = "1" then do
    4374             ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
     4147            call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
    43754148            say 'rpc.queryuser.DIR_DRIVE    = "'rpc.queryuser.DIR_DRIVE'"'
    43764149            say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
     
    50934866    end
    50944867
    5095     /* FIXME: We do not show a logon failure - just nothing */
    50964868    say '  'samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred
    5097     address cmd samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred' 'debuglevel' 2>NUL 1>'samba.!msg
    5098 
    5099     do until lines(samba.!msg) = 0
    5100         infoline = linein(samba.!msg)
    5101         parse var infoline aclstype':'aclsvalue
    5102         DummyRH = VRMethod('CN_ACLS', 'AddRecord')
    5103         ok = VRMethod("CN_ACLS", "SetFieldData", DummyRH, ACL.typeFH, aclstype, ACL.valueFH, aclsvalue)
    5104     end
    5105     ok = stream(samba.!msg,'c','close')
    5106     ok = SysFileDelete(samba.!msg)
     4869    address cmd samba.!smbcaclsexe' \\'machine'\'sharename' "'browsepath'" 'UserCred' 'debuglevel' 2>'samba.!error' 1>'samba.!msg
     4870
     4871    ok = file2stem(samba.!error,"aclserror.","DEL")
     4872
     4873    if aclserror.0 = 0 then do
     4874        call _StatusBarWrapper "NT_STATUS_OK"
     4875
     4876        ok = file2stem(samba.!msg,"aclsmsg.","DEL")     
     4877        do I = 1 to aclsmsg.0
     4878            parse var aclsmsg.I aclstype':'aclsvalue
     4879            DummyRH = VRMethod('CN_ACLS', 'AddRecord')
     4880            ok = VRMethod("CN_ACLS", "SetFieldData", DummyRH, ACL.typeFH, aclstype, ACL.valueFH, aclsvalue)
     4881        end
     4882    end
     4883    else do
     4884        call _StatusBarWrapper aclserror.1
     4885        call SW_ACLS_close
     4886    end
    51074887return
    51084888
     
    58735653return
    58745654
     5655/*:VRX         TM_STATUSBAR_Trigger
     5656*/
     5657TM_STATUSBAR_Trigger:
     5658    call _StatusbarReset
     5659return
     5660
    58755661/*:VRX         TM_TheCloser_Trigger
    58765662*/
Note: See TracChangeset for help on using the changeset viewer.