Post by Robert on Jul 11, 2023 12:51:45 GMT -5
This is an outgrowth of a comment in the current "EFT Extension" forum thread.
When users have files that are important and need to be protected from inadvertent modification, but you still want to see them with SPFLite, there are currently a few choices you have:
1. Go into Windows File Explorer and set the file's attribute to Read Only. SPFLite will respect R/O files and won't modify them. However, most other software won't modify them either, and that might end up being "too much protection".
2. Always remember to use VIEW or BROWSE primary commands, or else use the V or B line commands in FM. The problem with doing this is that it's just so easy to forget and simply click on a file name - because the only step you have to do is to click on the mouse. One you do that, you have to be careful not to modify anything, or else if you do you have to remember to say CANCEL and never save any changes you might make (accidental or otherwise).
Devising a software solution for this would have been difficult, prior to the creation of the EFT feature, and the EFT Extension work being done to enable profile settings to be overridden on the EFT line.
I recently posted a comment about allowing VIEW and BROWSE as keywords on an EFT line, but I withdrew that because it wasn't a complete solution. Further, it doesn't address cases where EFT might not be involved, when a file is edited under the direct control of a regular Profile with no EFT specification for it.
The solution I am proposing involves a refinement of the SELECT command for opening files. Right now, there is only an FM line command of S/SEL/SELECT. The SPFLite Help for this Select tells us this:
Select the file. For data files, Select is the same as Edit. Clicking on a file name is the same as entering the E or S line command, and causes the file to be edited.
For directories and File Lists, Select will open the directory or File List and its contents will replace the currently displayed list. Thus, for a File List, Select and Edit are not the same thing, whereas for regular files, they are.
For directories and File Lists, Select will open the directory or File List and its contents will replace the currently displayed list. Thus, for a File List, Select and Edit are not the same thing, whereas for regular files, they are.
1. A new PROFILE setting of SELECT will be defined. SELECT must have one of three "select-mode" settings: EDIT, VIEW or BROWSE. In handling older profile entries that did not have this setting previously, the default for SELECT will be EDIT.
2. A new primary edit command of PROFILE SELECT [select-mode] will be defined.
2.1. If no select-mode setting is specified, the current select mode is shown.
2.2. If the command is specified as PROFILE SELECT 'select-mode' then that becomes the new default select mode. 'Select-mode' must be EDIT, VIEW or BROWSE.
2.3. When the select-mode of a profile is changed during an edit session, that becomes the new mode of that session. For instance, if the file was opened for EDIT, and PROFILE SELECT VIEW or PROFILE SELECT BROWSE is issued, the EDIT session becomes a VIEW or BROWSE session. If there were ANY unsaved changes, the user would have to resolve them before VIEW or BROWSE were entered.
3. A new FM primary command of SELECT will be defined. This will use the same syntax as the current FM EDIT/BROWSE/VIEW command.
4. For consistency, there should also be a new Edit SELECT primary command, with same syntax as the current edit-mode EDIT/BROWSE/VIEW primary command.
5. When a file is opened using SELECT rather than EDIT/VIEW/BROWSE, the profile is inspected to see its select-mode. Whatever that mode is, that is how the file gets opened.
6. When a file name is clicked-on in FM, it will be treated the same as SELECT. That represents a change from current logic, which right now treats Edit and Select as the same thing. Going forward, they would no longer be the same thing.
7. Because SELECT will now be a proper PROFILE setting, it will subject to being overridden, just as any other setting that can be overridden via EFT.
8. The SELECT option ONLY affects the SELECT command (line or primary) and the way in which files are opened in response to a mouse-click. When an explicit EDIT/VIEW/BROWSE command is issued, that command is respected, and the SELECT option is IGNORED.
9. EFT example:
"*.prod.data" = txt,select browse,eol lf
10. I believe the way this could be implemented is that a file would be initially opened by default in edit mode, and then the SELECT setting would be inspected. That setting might be from the profile itself, or from an EFT override parameter of SELECT xxx. If the effective SELECT mode were other than EDIT, the protections afforded by BROWSE or VIEW would be established at the beginning of the edit session, and visible markers like the "Edit" keyword on the Windows title bar and the SPFLite status line would be replaced by View or Browse.
11. I believe that the PROFILE SELECT edit primary command would NOT cause the SELECT profile setting to be permanently changed. The only way you could do a permanent change to this would be by using the PROFILE EDIT command and then changing the setting in the Profile Edit GUI. It is unlikely that users would want to frequently change this, and making most uses of it as temporary would be the safest way to handle it.
That basically describes the key features of the SELECT concept.
Comments invited.
R