* =============================================================================
* 
* Component   : UF_SYSTM
* Type        : Reusable Component
* Ancestor    : VF_AC011
* 
* PLEASE NOTE:  This UF_ (User Framework) component is the shipped version. You
* may choose to modify it. You should do this by copying the source
* code of this component into your own component and then change
* the copied version. This will prevent the accidental loss of your
* changes if you upgrade your Visual LANSA framework version. Refer
* to the end of this component for more details about making your
* own version of this component.
* 
* =============================================================================
* 
* This is the shipped User Imbedded Interface Point (IIP)
* 
* It has ancestor class VF_AC011. It is used to provide a standardized
* place in which imbedded interfaces points (IIPs) can be defined and
* changed for user applications. The most common method used to acheive
* this is to allow the methods contained in the ancestor class VF_AC011
* to be redefined.
* 
* The * ==> commented Define_Map commands show the arguments input
* to and returned by this method. They are actually defined in the
* ancestor class, but they are reproduced here as comments to aid
* your understanding.
* 
* =============================================================================

FUNCTION OPTIONS(*DIRECT)
BEGIN_COM ROLE(*EXTENDS #VF_AC011)

DEFINE_COM CLASS(#LOGONWIN) NAME(#LOGONWIN) COMPONENTVERSION(1)

* =============================================================================
* Component definitions
* =============================================================================

* =============================================================================
* Field Definitions
* =============================================================================

* =============================================================================
* Events Definitions
* =============================================================================

* =============================================================================
* Property Definitions
* =============================================================================

PTYROUTINE NAME(GavUsePrivateConnect) OPTIONS(*Redefine)
* ==> Define_map *output #vf_elBool #PavUsePrivateConnect
* Set #PavUsePrivateConnect Value(FALSE)

* Enhanced Framework Log-on window
SET COM(#PavUsePrivateConnect) VALUE(TRUE)

* USE BUILTIN(set_session_value) WITH_ARGS(ITRO 'Y')
* USE BUILTIN(set_session_value) WITH_ARGS(ITRM '20000000')
* USE BUILTIN(set_session_value) WITH_ARGS(ITRL '4')
* USE BUILTIN(set_session_value) WITH_ARGS(ITRC 'ALL')
ENDROUTINE

PTYROUTINE NAME(GavUseInstanceAuth) OPTIONS(*Redefine)
* ==> Define_map *output #vf_elBool #PavUseInstanceAuth
SET COM(#PavUseInstanceAuth) VALUE(FALSE)
ENDROUTINE


* =============================================================================
* Method Definitions
* =============================================================================

* This IIP method (avValidateUser) validates the user profile
* and password. Set the return code to OK or ER to indicate the
* validity of the user profile and password. The user profile
* and password values are in the exact case that they were
* entered by the user.
* 

MTHROUTINE NAME(avValidateUser) OPTIONS(*Redefine)
* ==> Define_map *input  #std_obj  #UserProfile
* ==> Define_map *input  #std_obj  #Password
* ==> Define_map *output #std_Bool #ReturnCode

SET COM(#ReturnCode) VALUE(OK)

ENDROUTINE

* This IIP method (avPasswordRules) checks whether a password
* obeys the site rules for password creation. Set the return code to OK or ER
* to indicate whether the password obeys the rules

MTHROUTINE NAME(avPasswordRules) OPTIONS(*Redefine)
* ==> Define_Map For(*input) Class(#std_obj) Name(#Password)
* ==> Define_Map For(*output) Class(#std_Bool) Name(#ReturnCode)

SET COM(#ReturnCode) VALUE(OK)

ENDROUTINE

* This IIP method (avSetSessionValues) sets session values
* for the specified user profile

MTHROUTINE NAME(avSetSessionValues) OPTIONS(*Redefine)
* ==> Define_map *input  #std_obj  #UserProfile

USE BUILTIN(UpperCase) WITH_ARGS(#UserProfile.Value) TO_GET(#User)

USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('USER=' #User)

USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('PPTH=' #uSystem.uUser.uTempDirectory)
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('DPTH=' #uSystem.uUser.uTempDirectory)

* Enable windows printing
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('WPEN=' Y)
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('PRTR=' WINDOWS)

* Set the default font to the framework default
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('WPDF=' #UFRAMEWORK.UDEFAULTREPORTFONT)

* Use the default font - don't prompt the user for the font
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('WPFD=' 'D')

* The default font size is 8

* Use windows stretching to fit the report to the paper
USE BUILTIN(SET_SESSION_VALUE) WITH_ARGS('WPAS=' 'Y')


ENDROUTINE

* This IIP method (avConnectFiles) connects up files to a remote
* server system for the specified user profile

MTHROUTINE NAME(avConnectFiles) OPTIONS(*Redefine)
* ==> Define_map *input  #std_obj  #UserProfile
* ==> Define_map *input #vf_elnum #DftBlockSize
* ==> Define_map *input #vf_elnum #DftMaxRecSel

* CHANGE FIELD(#STD_COD30) TO(*SSERVER_SSN )

USE BUILTIN(CONNECT_FILE) WITH_ARGS('*' *SSERVER_SSN #DftBlockSize.Value #DftMaxRecSel.Value)

ENDROUTINE

* This IIP method (avDisConnectFiles) disconnects files from a remote
* server system

MTHROUTINE NAME(avDisConnectFiles) OPTIONS(*Redefine)

USE BUILTIN(DISCONNECT_FILE) WITH_ARGS('*' *SSERVER_SSN)

ENDROUTINE

* This IIP method (avPrivateConnect) replaces the standard
* framework logon / connection process with a private version.
* Also see avPrivateConnect for details of disconnections.
* To cause this routine to be invoked you need to alter the
* preceding GavUsePrivateConnect property get routine to return
* TRUE (in uppercase) instead of FALSE.

MTHROUTINE NAME(avPrivateConnect) OPTIONS(*Redefine)
* ==> Define_map *Both   #std_obj  #UserProfile
* ==> Define_map *Output #std_Bool #ReturnCode

* Show a message box when this routine is invoked. If required
* remove the code and replace with your own private connection
* logic.

* Use Message_Box_Show (OKCANCEL OK INFO *Component 'avPrivateConnect invoked') (#Std_Bool)

* Show Logon Window
#SERVERNME := #uSystem.uServer.uServerLUNAME
#LOGONWIN.umOpenForm( #uSystem.uServer.uServerLUNAME )


IF (#LOGONWIN.upConnectionResult = OK)
* Connect to the Server
#uSystem.uServer.uconnect( #LOGONWIN.upUserProfile #LOGONWIN.upPassword #Returncode )
SET COM(#UserProfile) VALUE(#LOGONWIN.upUserProfile)
ELSE
SET COM(#ReturnCode) VALUE(ER)
ENDIF

* If '#Std_Bool = OK'
* Set #ReturnCode Value(OK)
* else
* Set #ReturnCode Value(ER)
* Endif

ENDROUTINE

* This IIP method (avPrivateDisconnect) replaces the standard
* framework disconnection with a private version. Also see
* avPrivateConnect. To cause this routine to be invoked you need
* to alter the preceding GavUsePrivateConnect property get routine
* to return TRUE (in uppercase) instead of FALSE.

MTHROUTINE NAME(avPrivateDisconnect) OPTIONS(*Redefine)

* Show a message box when this routine is invoked. If required
* remove the code and replace with your own private connection
* logic.

* Use Message_Box_Show (OKCANCEL OK INFO *Component 'avPrivateDisconnect invoked') (#Std_Bool)
INVOKE METHOD(#com_owner.avDisConnectFiles)
USE BUILTIN(DISCONNECT_SERVER) WITH_ARGS(#SERVERNME) TO_GET(#RETCODE)

#uSystem.uServer.udisconnect

ENDROUTINE

* This IIP method (avCheckUserLicense) validates the user's license.
* Set the return code to OK or ER to indicate the validity of the
* the user's license. If the license check fails, the framework will close down.

MTHROUTINE NAME(avCheckUserLicense) OPTIONS(*REDEFINE)
* ==> Define_Map For(*output) Class(#std_Bool) Name(#ReturnCode)

SET COM(#ReturnCode) VALUE(OK)

* If this license check fails, this method should include notification
* to the user that their license is invalid. This could be done using
* MESSAGE_BOX_SHOW.

ENDROUTINE

* This IIP method (avCheckAuth) validates whether the user
* is allowed to use an object within the framework.
* The  user  is identified by their User Profile
* The Object Type is the type of framework object being validated
* The types are:
* FRAMEWORK
* APPLICATION
* APPLICATION_VIEW
* BUSINESS_OBJECT
* COMMAND_REFERENCE
* SERVER

* If the object type is not COMMAND_REFERENCE, there is only one Object Name.
* The Object Name is found on the "Identification Properties" tab for the
* Object. It is the parameter called "User Object Name / Type".

* If the object type is COMMAND_REFERENCE, there are two object names:
* The Object Name is found on the "Identification Properties" tab for the
* Framework/Application/Business Object. (depending on what the Command acts upon)
* It is the parameter called "User Object Name / Type".
* The Object Name 2 is found on the "Identification Properties" tab for the
* Command. It is the parameter called "User Object Name / Type".
* 
* This check is additive with the framework authority checking. If either the IIP check,
* or the framework authority check fail the user, the user will not be able to use the object.
* Set the return code to OK or ER to indicate whether the User is allowed
* to use the object.

MTHROUTINE NAME(avCheckAuth) OPTIONS(*REDEFINE)
* ==> Define_Map For(*input)  Class(#std_obj) Name(#UserProfile)
* ==> Define_Map for(*input) class(#vf_eltxts) Name(#ObjectType)
* ==> Define_Map For(*input)  Class(#vf_elidn) Name(#ObjectName)
* ==> Define_Map For(*input)  Class(#vf_elidn) Name(#ObjectName2) mandatory(' ')
* ==> Define_Map For(*output) Class(#std_Bool) Name(#ReturnCode)
* ==> Define_Map for(*both) class(#std_TextL) Name(#UserAuthInformation) mandatory(' ')

SET COM(#ReturnCode) VALUE(OK)
DEFINE FIELD(#vf_wkName) TYPE(*char) LENGTH(32)
DEFINE FIELD(#vf_wknam2) TYPE(*char) LENGTH(32)
CHANGE FIELD(#vf_wkName) TO(#ObjectName)
CHANGE FIELD(#vf_wkNam2) TO(#ObjectName2)

IF ('#ObjectType *eq COMMAND_REFERENCE')
IF ('#ObjectName *eq CRUD_BOB')
IF ('#ObjectName2 *eq ACCOUNTS')
SET COM(#ReturnCode) VALUE(ER)
ENDIF
ENDIF
ENDIF


ENDROUTINE

* This IIP method (avCheckInstanceAuth) validates whether the user
* is allowed to use a command with an instance of a business object.
* The  user  is identified by their User Profile
* The Object Type can be
* 
* BUSINESS_OBJECT

* The Business Object Name is found on the "Identification Properties" tab for the
* Business Object. It is the parameter called "User Object Name / Type".
* 
* The Command Object Name is found on the "Identification Properties" tab for the
* Command. It is the parameter called "User Object Name / Type". It will be blank if
* avCheckInstanceAuth is invoked from a filter. It will be non-blank if avCheckInstanceAuth
* is invoked by the framework to determine whether a command tab should be displayed,
* or from a command handler to get additional security information (UserAuthInformation)
* prior to display of the command handler.

* If this check fails, the command tab will not be visible when this
* instance of the business object is the current instance.

* If multiple instances are selected and a command is invoked that processes the
* selected instances, if this check fails for a particular instance, the instance will not get
* returned to the command handler for processing.

* This check is additive with the framework authority checking. If any of avCheckAuth,
* avCheckInstanceAuth or the framework authority check, fail the user, the user will not
* be able to use the command.

* Set the return code to OK or ER to indicate whether the User is allowed
* to use the object.

* UserAuthInformation can be used to return information to command handlers or filters that invoke
* avCheckInstanceAuth. This could be used by the command handler to decide (for example)
* whether the user is allowed to make changes to a screen, or merely to view it. Or it could be
* used by a filter to decide whether to add an instance of a business object to the instance
* list or not.

* To cause this routine to be invoked you need to alter the
* preceding GavUserInstanceAuth property get routine to return
* TRUE (in uppercase) instead of FALSE.


MTHROUTINE NAME(avCheckInstanceAuth) OPTIONS(*Redefine)
* ==> Define_Map For(*input)  Class(#std_obj) Name(#UserProfile)
* ==> Define_Map for(*input) class(#vf_eltxts) Name(#ObjectType)
* ==> Define_Map For(*input)  Class(#vf_elidn) Name(#BusObjectName)
* ==> Define_Map For(*input)  Class(#vf_elidn) Name(#CmdObjectName) mandatory(' ')
* ==> Define_Map For(*output) Class(#std_Bool) Name(#ReturnCode)
* ==> Define_Map for(*output) class(#std_TextL) Name(#UserAuthInformation) mandatory(' ')

* ==> Define_map for(*input) class(#vf_elXAK1) Name(#AKey1)
* ==> Define_map for(*input) class(#vf_elXAK2) Name(#AKey2)
* ==> Define_map for(*input) class(#vf_elXAK3) Name(#AKey3)
* ==> Define_map for(*input) class(#vf_elXAK4) Name(#AKey4)
* ==> Define_map for(*input) class(#vf_elXAK5) Name(#AKey5)
* ==> Define_map for(*input) class(#vf_elXNK1) Name(#NKey1)
* ==> Define_map for(*input) class(#vf_elXNK2) Name(#NKey2)
* ==> Define_map for(*input) class(#vf_elXNK3) Name(#NKey3)
* ==> Define_map for(*input) class(#vf_elXNK4) Name(#NKey4)
* ==> Define_map for(*input) class(#vf_elXNK5) Name(#NKey5)

SET COM(#ReturnCode) VALUE(OK)

ENDROUTINE




* This IIP method (avEnrollVisualStyles) enroll all framework user
* visual styles. To use this routine define the visual style into the LANSA
* repository in the usual manner and then add a new invocation of
* avEnrollVisualStyle to the following routine. If the visual style is
* subsequently changed only this component needs to be recompiled to
* effect the change into all other components.

MTHROUTINE NAME(avEnrollVisualStyles) OPTIONS(*REDEFINE)

* VL Shipped style - VS_NORM
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#VS_norm) CAPTION(*mtxtuf_style_norm)
* VL Shipped style - VS_PANEL
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#VS_panel) CAPTION(*mtxtuf_style_panel)
* VL Shipped style - VS_GROUP
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#VS_group) CAPTION(*mtxtuf_style_group)
* VL Shipped style - VS_EMPH
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#VS_emph) CAPTION(*mtxtuf_style_emph)

* Blue Background (Small Font) - UF_VS001
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs001) CAPTION(*mtxtuf_style_blusma)
* Blue Background (Large Font) - UF_VS002
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs002) CAPTION(*mtxtuf_style_blulge)

* Pale Background (Small Font) - UF_VS003
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs003) CAPTION(*mtxtuf_style_palsma)
* Pale Background (Large Font) - UF_VS004
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs004) CAPTION(*mtxtuf_style_pallge)

* Newlook background colour
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs006) CAPTION(*mtxtuf_style_NL)
* Script Editing - Small font
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs007) CAPTION(*mtxtuf_style_scrsma)
* Script Editing - Medium font
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs008) CAPTION(*mtxtuf_style_scrmed)
* Script Editing - Large font
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#uf_vs009) CAPTION(*mtxtuf_style_scrlge)

* test
INVOKE METHOD(#Com_Owner.avEnrollVisualStyle) STYLE(#VF_vs107X) CAPTION('test steven')
ENDROUTINE

* =============================================================================
* Event Handlers
* =============================================================================

* =============================================================================
* Subroutines
* =============================================================================

* =============================================================================
* MAKING YOUR OWN VERSION OF THIS COMPONENT
* =============================================================================
* 
* 
* (1). Create a new resuable component with some unique name, say, MYSYSTM.
* 
* (2). Copy the shipped UF_SYSTM code into MYSYSTM.
* 
* (3). Change MYSYSTM to have ancestor class VF_AC011.
* 
* (4). Compile MYSYSTM.
* 
* (5). Modify the definition of the framework's User Imbedded Interface Point
* name (in the framework details tabsheet) to MYSYSTM (rather than the shipped name UF_SYSTM).
* 

END_COM

