Created
April 25, 2018 13:52
-
-
Save isc-bspead/54482ebb89be2c4c0f13e671e3ffb7a4 to your computer and use it in GitHub Desktop.
Handling Many Caché Environments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2014.1 (Build 602U)" ts="2014-03-17 10:14:13"> | |
<Class name="CCR.Environment"> | |
<Description> | |
An Environment is defined as a single instance of an InterSystems product, and all associated hardware and software supporting that instance; 4 environments make up a System</Description> | |
<Super>%SerialObject</Super> | |
<TimeChanged>63262,54472.371963</TimeChanged> | |
<TimeCreated>61614,74776.418106</TimeCreated> | |
<Property name="HomePageLink"> | |
<Description> | |
hyperlink to the homepage of this environment</Description> | |
<Type>%String</Type> | |
<Parameter name="MAXLEN" value="250"/> | |
</Property> | |
<Property name="Namespace"> | |
<Description> | |
Namespace containing the customizations for this Environment</Description> | |
<Type>%String</Type> | |
</Property> | |
<Property name="SMPLink"> | |
<Description> | |
Link to the SMP for this Environment</Description> | |
<Type>%String</Type> | |
<Parameter name="MAXLEN" value="250"/> | |
</Property> | |
<Property name="SuperServer"> | |
<Type>%String</Type> | |
</Property> | |
<Property name="TerminalPort"> | |
<Type>%String</Type> | |
</Property> | |
<Method name="%OnAddToSaveSet"> | |
<Description><![CDATA[ | |
This callback method is invoked when the current object is added to the SaveSet, | |
either because %Save() was invoked on this object or on an object that references this object. | |
%OnAddToSaveSet can modify the current object. It can also add other objects to the current | |
SaveSet by invoking %AddToSaveSet or remove objects by calling %RemoveFromSaveSet. | |
<P>If this method returns an error status then %Save() will fail and the transaction | |
will be rolled back.]]></Description> | |
<FormalSpec>depth:%Integer=3,insert:%Integer=0,callcount:%Integer=0</FormalSpec> | |
<Private>1</Private> | |
<ReturnType>%Status</ReturnType> | |
<ServerOnly>1</ServerOnly> | |
<Implementation><![CDATA[ | |
Set ..Namespace=$ZConvert(..Namespace,"U") | |
If (..SMPLink'="")&&($zconvert($extract(..SMPLink,1,4),"L")'="http") { | |
Set ..SMPLink="http://"_..SMPLink | |
} | |
If (..HomePageLink'="")&&($zconvert($extract(..HomePageLink,1,4),"L")'="http") { | |
Set ..HomePageLink="http://"_..HomePageLink | |
} | |
Quit $$$OK | |
]]></Implementation> | |
</Method> | |
<Storage name="Default"> | |
<Type>%Library.CacheSerialState</Type> | |
<State>EnvironmentState</State> | |
<StreamLocation>^CCR.EnvironmentS</StreamLocation> | |
<Data name="EnvironmentState"> | |
<Value name="1"> | |
<Value>HomePageLink</Value> | |
</Value> | |
<Value name="2"> | |
<Value>Namespace</Value> | |
</Value> | |
<Value name="3"> | |
<Value>SMPLink</Value> | |
</Value> | |
<Value name="4"> | |
<Value>SuperServer</Value> | |
</Value> | |
<Value name="5"> | |
<Value>TerminalPort</Value> | |
</Value> | |
</Data> | |
</Storage> | |
</Class> | |
<Class name="CCR.System"> | |
<Description> | |
A System is defined as an installation of a product, and all associated hardware and software supporting that product, including up to 4 operating Environments</Description> | |
<Super>%Persistent</Super> | |
<TimeChanged>63262,54208.782166</TimeChanged> | |
<TimeCreated>61613,51004.920494</TimeCreated> | |
<Property name="Description"> | |
<Description> | |
optional description of this System</Description> | |
<Type>%String</Type> | |
<Parameter name="MAXLEN" value="500"/> | |
</Property> | |
<Property name="DisplayName"> | |
<Description> | |
display of the name and the system code</Description> | |
<Type>%String</Type> | |
<Calculated>1</Calculated> | |
<SqlComputeCode>s {*}=##class(CCR.System).getDisplayName({ID})</SqlComputeCode> | |
<SqlComputed>1</SqlComputed> | |
</Property> | |
<Property name="EnvBASE"> | |
<Description> | |
Boolean indication that this System uses BASE</Description> | |
<Type>%Boolean</Type> | |
<InitialExpression>1</InitialExpression> | |
</Property> | |
<Property name="EnvTEST"> | |
<Description> | |
Boolean indication that this System uses TEST</Description> | |
<Type>%Boolean</Type> | |
<InitialExpression>1</InitialExpression> | |
</Property> | |
<Property name="EnvUAT"> | |
<Description> | |
Boolean indication that this System uses UAT</Description> | |
<Type>%Boolean</Type> | |
<InitialExpression>1</InitialExpression> | |
</Property> | |
<Property name="EnvLIVE"> | |
<Description> | |
Boolean indication that this System uses LIVE</Description> | |
<Type>%Boolean</Type> | |
<InitialExpression>1</InitialExpression> | |
</Property> | |
<Property name="EnvList"> | |
<Description> | |
Displays a list of current systems</Description> | |
<Type>%List</Type> | |
<Calculated>1</Calculated> | |
</Property> | |
<Property name="Name"> | |
<Description> | |
unique name for this System; this should include (at a minimum) an indicator of the of the InterSystems Product and the version number</Description> | |
<Type>%String</Type> | |
<Required>1</Required> | |
</Property> | |
<Property name="SystemCode"> | |
<Description> | |
abbeviated code for this system which will be used as the basis for the Perforce branch definition; it must be unique it must be alphanumeric</Description> | |
<Type>%String</Type> | |
<Required>1</Required> | |
<Parameter name="PATTERN" value=".(1A,1N)"/> | |
</Property> | |
<Property name="BASE"> | |
<Description> | |
BASE Environment details</Description> | |
<Type>CCR.Environment</Type> | |
</Property> | |
<Property name="TEST"> | |
<Description> | |
TEST Environment details</Description> | |
<Type>CCR.Environment</Type> | |
</Property> | |
<Property name="UAT"> | |
<Description> | |
UAT Environment details</Description> | |
<Type>CCR.Environment</Type> | |
</Property> | |
<Property name="LIVE"> | |
<Description> | |
LIVE Environment details</Description> | |
<Type>CCR.Environment</Type> | |
</Property> | |
<Property name="SiteCode"> | |
<Type>%String</Type> | |
<Required>1</Required> | |
<Parameter name="MAXLEN" value="4"/> | |
</Property> | |
<Property name="Deprecated"> | |
<Description> | |
Boolean determining if System is Deprecated or not</Description> | |
<Type>%Boolean</Type> | |
<InitialExpression>0</InitialExpression> | |
</Property> | |
<Method name="ExportEnvToRegFile"> | |
<ClassMethod>1</ClassMethod> | |
<FormalSpec>pSysID</FormalSpec> | |
<ReturnType>%Status</ReturnType> | |
<Implementation><![CDATA[ | |
Set system=##class(CCR.System).%OpenId(pSysID) | |
Set stream=##class(%Library.GlobalBinaryStream).%New() | |
Do stream.WriteLine("Windows Registry Editor Version 5.00") | |
Do stream.WriteLine() | |
Set servernames="" | |
For env=system.BASE,system.TEST,system.UAT,system.LIVE { | |
Set isNotEmpty=$CASE(env.SMPLink,"":0,:1) | |
Set serverName="" | |
If (isNotEmpty) { | |
If ((env=system.BASE)&&(system.EnvBASE)) { | |
Set serverName=system.SiteCode_"-"_system.SystemCode_"-BASE" | |
} | |
ElseIf ((env=system.UAT)&&(system.EnvUAT)) { | |
Set serverName=system.SiteCode_"-"_system.SystemCode_"-UAT" | |
Set servernames("UAT")=serverName | |
} | |
ElseIf ((env=system.TEST)&&(system.EnvTEST)) { | |
Set serverName=system.SiteCode_"-"_system.SystemCode_"-TEST" | |
Set servernames("TEST")=serverName | |
} | |
ElseIf ((env=system.LIVE)&&(system.EnvLIVE)) { | |
Set serverName="LIVE-"_system.SiteCode_"-"_system.SystemCode | |
Set servernames("LIVE")=serverName | |
} | |
} | |
If (serverName'="") { | |
Set url=env.SMPLink | |
Set port="" | |
Set address="" | |
Kill components | |
If (url'="") | |
{ | |
Do ##class(%Net.URLParser).Parse(url,.components) | |
If ($data(components("port"))) { | |
Set port=components("port") | |
} | |
Else { | |
If ($zconvert(components("scheme"),"L")="http") { | |
Set port=80 | |
} | |
ElseIf ($zconvert(components("scheme"),"L")="https") { | |
Set port=443 | |
} | |
} | |
If ($data(components("netloc"))#2) { | |
Set address=components("netloc") | |
Set address=$piece(address,":",1) | |
} | |
} | |
//include keys for 32-bit and 64-bit Windows registry structures (unused keys will be ignored when downloaded) | |
For keyname="[HKEY_LOCAL_MACHINE\SOFTWARE\InterSystems\Cache\Servers\","[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\InterSystems\Cache\Servers\" { | |
Do stream.WriteLine(keyname_serverName_"]") | |
Do stream.WriteLine("""Address""="""_address_"""") | |
Do stream.WriteLine("""AuthenticationMethod""="""_"0"_"""") | |
Do stream.WriteLine("""Comment""="""_"This has been created by the System Details export."_"""") | |
Do stream.WriteLine("""ConnectionSecurityLevel""="""_""_"""") | |
Do stream.WriteLine("""LastNamespace""="""_env.Namespace_"""") | |
Do stream.WriteLine("""Port""="""_env.SuperServer_"""") | |
Do stream.WriteLine("""ServerType""="""_""_"""") | |
Do stream.WriteLine("""ServerPrincipalName""="""_""_"""") | |
Do stream.WriteLine("""Telnet""="""_env.TerminalPort_"""") | |
Do stream.WriteLine("""WebServerAddress""="""_""_"""") | |
Do stream.WriteLine("""WebServerInstanceName""="""_""_"""") | |
Do stream.WriteLine("""WebServerPort""="""_port_"""") | |
Do stream.WriteLine() | |
} | |
} | |
} | |
Do stream.WriteLine("[HKEY_CURRENT_USER\Software\InterSystems\Cache Studio\Editor\Server Background Color]") | |
For env="TEST","UAT","LIVE" { | |
Do:$data(servernames(env)) stream.WriteLine(""""_servernames(env)_"""=dword:"_$case(env,"TEST":"00a0ffff","UAT":"00a0ffff","LIVE":"00a0a0ff")) | |
} | |
Do stream.WriteLine() | |
Do stream.WriteLine("[HKEY_CURRENT_USER\Software\InterSystems\Cache Studio\Editor\Status Bar Color]") | |
For env="TEST","UAT","LIVE" { | |
Do:$data(servernames(env)) stream.WriteLine(""""_servernames(env)_"""=dword:"_$case(env,"TEST":"0057ffff","UAT":"0057ffff","LIVE":"005757ff")) | |
} | |
Do stream.SetAttribute("ContentType","application/octet-stream") | |
Do stream.SetAttribute("ContentDisposition","attachment; filename="_system.SiteCode_"-"_system.SystemCode_".reg") | |
Do stream.SetAttribute("Expires",600) | |
Do stream.%Save() | |
Set streamOID = stream.%Oid() | |
Set href = "%25CSP.StreamServer.cls?STREAMOID="_##class(%CSP.Page).Encrypt(streamOID) | |
Quit href | |
]]></Implementation> | |
</Method> | |
<Method name="getDisplayName"> | |
<ClassMethod>1</ClassMethod> | |
<FormalSpec>pID</FormalSpec> | |
<ReturnType>%String</ReturnType> | |
<Implementation><![CDATA[ | |
Set s=..%OpenId(pID) | |
Set name="" | |
If s.Deprecated=1 { | |
Set name="[Deprecated] " | |
} | |
Set name=name_s.Name_" ("_s.SystemCode_") " | |
Quit name | |
]]></Implementation> | |
</Method> | |
<Query name="Systems"> | |
<Description><![CDATA[ | |
Returns a list of all Systems | |
Optional withNull parameter will control the behavior as follows: | |
0 - [default] will return only rows that exist in this table | |
1 - in addition to the default resultset, a row with all null values will be returned. | |
This can be used for a blank <OPTION> in a <SELECT> control | |
2 - in addition to the default resultset, a row with an ID of 'invalid' and all null values will be returned | |
This can be used for a blank but unsavable <OPTION> in a <SELECT> control (should fail CSP:Form validation) | |
Optional showDeprecated parameter will determine inclusion of Deprecated systems | |
0 - [default] will NOT include deprecated systems in query | |
1 - will include deprecated systems in query]]></Description> | |
<Type>%SQLQuery</Type> | |
<FormalSpec>withNull:%Integer=0,showDeprecated:%Integer=0</FormalSpec> | |
<SqlQuery>SELECT 'invalid' AS ID,'' AS Name,'' AS DisplayName FROM System WHERE 2=:withNull UNION | |
SELECT '' AS ID,'' AS Name,'' AS DisplayName FROM System WHERE 1=:withNull UNION | |
SELECT ID, %SQLUPPER(Name), DisplayName FROM System | |
WHERE (:showDeprecated=1 OR ((:showDeprecated=0 OR :showDeprecated IS NULL) AND (Deprecated=0 OR Deprecated IS NULL))) | |
ORDER BY Name</SqlQuery> | |
<Parameter name="CONTAINID" value="1"/> | |
</Query> | |
<Method name="EnvListGet"> | |
<ReturnType>%List</ReturnType> | |
<ServerOnly>1</ServerOnly> | |
<Implementation><![CDATA[ | |
set outlist="" | |
if (..EnvBASE) { | |
set outlist=outlist_$listbuild("BASE") | |
} | |
if (..EnvTEST) { | |
set outlist=outlist_$listbuild("TEST") | |
} | |
if (..EnvUAT) { | |
set outlist=outlist_$listbuild("UAT") | |
} | |
if (..EnvLIVE) { | |
set outlist=outlist_$listbuild("LIVE") | |
} | |
Quit outlist | |
]]></Implementation> | |
</Method> | |
<Method name="%OnValidateObject"> | |
<Description><![CDATA[ | |
This callback method is invoked by the <METHOD>%ValidateObject</METHOD> method to | |
provide notification that the current object is being validated. | |
<P>If this method returns an error then <METHOD>%ValidateObject</METHOD> will fail.]]></Description> | |
<Private>1</Private> | |
<ReturnType>%Status</ReturnType> | |
<ServerOnly>1</ServerOnly> | |
<Implementation><![CDATA[ | |
set envs=..EnvList | |
if ($listlength(envs)=1) { | |
if ($list(envs,1)'="LIVE") { | |
Quit $$$ERROR($$$GeneralError,"If only 1 environment is selected, it must be LIVE") | |
} | |
} elseif ($listlength(envs)>1) { | |
if ($list(envs,1)'="BASE") { | |
Quit $$$ERROR($$$GeneralError,"If there is more than 1 environment, BASE must be included") | |
} | |
} else { | |
Quit $$$ERROR($$$GeneralError,"There must be at least 1 environment selected") | |
} | |
Quit $$$OK | |
]]></Implementation> | |
</Method> | |
<Storage name="Default"> | |
<Type>%Library.CacheStorage</Type> | |
<DataLocation>^CCR.SystemD</DataLocation> | |
<DefaultData>SystemDefaultData</DefaultData> | |
<IdLocation>^CCR.SystemD</IdLocation> | |
<IndexLocation>^CCR.SystemI</IndexLocation> | |
<StreamLocation>^CCR.SystemS</StreamLocation> | |
<ExtentSize>100000</ExtentSize> | |
<Data name="SystemDefaultData"> | |
<Value name="1"> | |
<Value>%%CLASSNAME</Value> | |
</Value> | |
<Value name="2"> | |
<Value>Description</Value> | |
</Value> | |
<Value name="3"> | |
<Value>EnvBASE</Value> | |
</Value> | |
<Value name="4"> | |
<Value>EnvTEST</Value> | |
</Value> | |
<Value name="5"> | |
<Value>EnvUAT</Value> | |
</Value> | |
<Value name="6"> | |
<Value>EnvLIVE</Value> | |
</Value> | |
<Value name="7"> | |
<Value>Name</Value> | |
</Value> | |
<Value name="8"> | |
<Value>SystemCode</Value> | |
</Value> | |
<Value name="9"> | |
<Value>BASE</Value> | |
</Value> | |
<Value name="10"> | |
<Value>TEST</Value> | |
</Value> | |
<Value name="11"> | |
<Value>UAT</Value> | |
</Value> | |
<Value name="12"> | |
<Value>LIVE</Value> | |
</Value> | |
<Value name="13"> | |
<Value>SiteCode</Value> | |
</Value> | |
<Value name="14"> | |
<Value>Deprecated</Value> | |
</Value> | |
</Data> | |
</Storage> | |
</Class> | |
<Routine name="Config" type="MAC" languagemode="0" timestamp="63262,48138.292716"><![CDATA[ | |
Config ; Environment initialization routine for setting environment flags | |
#include %occInclude | |
#define ClearText $c(27,91,109) | |
#define BoldText $c(27,91,49,109) | |
#define UnderlineText $c(27,91,52,109) | |
#define BlinkingText $c(27,91,53,109) | |
#define HighlightText $c(27,91,55,109) | |
Org() Quit $get(^SYS("SourceControl","ItemSetConfig","Org")) | |
Sys() Quit $get(^SYS("SourceControl","ItemSetConfig","System")) | |
;# returns the configured Environment name | |
Env() Quit $get(^SYS("SourceControl","ItemSetConfig","Environment")) | |
;# returns the custom Environment name stored in ^SYS("SourceControl","Misc","EnvName"); if not defined, it returns the configured Environment name | |
EnvName() Quit $get(^SYS("SourceControl","Misc","EnvName"),$$Env()) | |
IsLIVE() Quit ($$Env="LIVE") | |
Configure | |
Write !,$$$BoldText,"Environment initialization method",$$$ClearText,! | |
Set prompt="What is your SiteCode (e.g. LAB1)? " | |
Set ans=$get(^SYS("SourceControl","ItemSetConfig","Org")) | |
Do ##class(%Prompt).GetString(prompt, .ans, 2, 8) | |
Set ^SYS("SourceControl","ItemSetConfig","Org") = ans | |
Set prompt="What is your SystemCode (e.g. APP1)? " | |
Set ans=$get(^SYS("SourceControl","ItemSetConfig","System")) | |
Do ##class(%Prompt).GetString(prompt, .ans, 2, 12) | |
Set ^SYS("SourceControl","ItemSetConfig","System") = ans | |
Write ! | |
Set validEnv=0 | |
do { | |
Set default=$S($D(^SYS("SourceControl","ItemSetConfig","Environment")):^SYS("SourceControl","ItemSetConfig","Environment"),1:"B") | |
Write "Select Environment - (B)ASE/(T)EST/(U)AT/(L)IVE: ["_default_"] " | |
Read ans i ans="" Set ans=default | |
Set ans=$ZConvert(ans,"U") | |
Set ans=$CASE(ans, | |
"B":"BASE", | |
"T":"TEST", | |
"U":"UAT", | |
"L":"LIVE", | |
:ans) | |
Set validEnv=$CASE(ans, | |
"BASE":1, | |
"TEST":1, | |
"UAT":1, | |
"LIVE":1, | |
:0) | |
} while ('validEnv) | |
Set ^SYS("SourceControl","ItemSetConfig","Environment")=ans | |
Do InitializeStandardSettings() | |
Set env=$$Env | |
Set locked=##class(%Studio.SourceControl.ISC).Locked() | |
If ((env="TEST")||(env="UAT")||(env="LIVE")) { | |
#; if the locked global wasn't set, then default to "yes" for TEST, UAT and LIVE | |
If locked="" Set locked=1 | |
Set default=$select(locked:"yes",1:"no") | |
Write !,"Do you want to Lock this environment to prevent changes? ["_default_"] " | |
Read ans If ans="" Set ans=default | |
If $E($ZCVT(ans,"U"))="Y" { | |
Set default=$select(locked=2:"yes",1:"no") | |
Write !,"Do you want to AdminLock this environment to prevent the lock from being turned" | |
Write !,"off via user UIs? ["_default_"] " | |
Read ans If ans="" Set ans=default | |
If $E($ZCVT(ans,"U"))="Y" { | |
Do ##class(%Studio.SourceControl.ISC).Lock(1) | |
} Else { | |
Do ##class(%Studio.SourceControl.ISC).Lock() | |
} | |
} Else { | |
Do ##class(%Studio.SourceControl.ISC).Unlock() | |
} | |
} ElseIf (locked) { | |
Write !,"This environment is currently Locked to prevent changes" | |
Set default="no" | |
Write !,"Do you want to Unlock this environment? ["_default_"] " | |
Read ans If ans="" Set ans=default | |
If $E($ZCVT(ans,"U"))="Y" { | |
Do ##class(%Studio.SourceControl.ISC).Unlock() | |
} | |
} | |
Summary | |
Write !,"Configuration Summary for "_$zu(5)_":",! | |
Write $ZV,! | |
Write "Environment Details:",! | |
Write " ^SYS(""SourceControl"",""ItemSetConfig"",""Org""): ",$$Org,! | |
Write " ^SYS(""SourceControl"",""ItemSetConfig"",""System""): ",$$Sys,! | |
Write " ^SYS(""SourceControl"",""ItemSetConfig"",""Environment""): ",$$Env,! | |
Try { | |
Set locked=##class(%Studio.SourceControl.ISC).Locked() | |
If (locked) { | |
Write " Configuration is "_$select(locked=2:"ADMINLOCKED",1:"LOCKED")_" [^SYS(""SourceControl"",""Locked"")]",! | |
} | |
} Catch {} | |
Quit | |
InitializeStandardSettings() Public | |
{ | |
//configure the System Mode so the SMP gives appropriate warning as to the type of System | |
Set SMPSystemMode=$get(^%SYS("SystemMode")) | |
Set newSMPSystemMode=$case($$Env, | |
"LIVE":"LIVE", | |
"UAT":"TEST", | |
"TEST":"TEST", | |
"BASE":"DEVELOPMENT", | |
:"") | |
If (SMPSystemMode'="")&&(SMPSystemMode'=newSMPSystemMode) { | |
If (SMPSystemMode="LIVE") { | |
// check the other namespaces to see if any other LIVE instances are defined | |
Set rset=##class(%ResultSet).%New("%SYS.Namespace:List") | |
Set sc=rset.Prepare() | |
Set sc=rset.Execute() | |
While (rset.Next()) { | |
Set namespace=rset.Data("Nsp") | |
Try { | |
If $get(^|namespace|SYS("SourceControl","ItemSetConfig","Environment"))="LIVE" { | |
Write !,$$$HighlightText,"NOTICE:",$$$ClearText," System Mode is left as 'LIVE', because "_namespace_" namespace is configured as 'LIVE'" | |
Set newSMPSystemMode=SMPSystemMode | |
Quit | |
} | |
} Catch (err) { /*ignore errors from unmounted DBs */ } | |
} | |
} ElseIf (SMPSystemMode="TEST")&&(newSMPSystemMode'="LIVE") { | |
// check the other namespaces to see if any other UAT/TEST instances are defined | |
Set rset=##class(%ResultSet).%New("%SYS.Namespace:List") | |
Set sc=rset.Prepare() | |
Set sc=rset.Execute() | |
While (rset.Next()) { | |
Set namespace=rset.Data("Nsp") | |
Try { | |
Set otherEnv=$get(^|namespace|SYS("SourceControl","ItemSetConfig","Environment")) | |
If (otherEnv="UAT")||(otherEnv="TEST") { | |
Write !,$$$HighlightText,"NOTICE:",$$$ClearText," System Mode is left as 'TEST', because "_namespace_" namespace is configured as '"_otherEnv_"'" | |
Set newSMPSystemMode=SMPSystemMode | |
Quit | |
} | |
} Catch (err) { /*ignore errors from unmounted DBs */ } | |
} | |
} | |
} | |
Try { | |
Set ^%SYS("SystemMode")=newSMPSystemMode | |
} Catch err { | |
Write !,$$$HighlightText,"ERROR:",$$$ClearText," Cannot set System Mode (insufficient privileges); please do so through the SMP" | |
} | |
Do UpdateZWELCOME() | |
Quit | |
} | |
UpdateZWELCOME() PUBLIC | |
{ | |
Set oldNS=$zu(5), env=$$Env, sys=$$Sys, org=$$Org | |
Try { | |
Do $zu(5,"%SYS") | |
Set rtnName="ZWELCOME.MAC", pre=" Write !,/*info*/"" ", sep=": " | |
If ##class(%Routine).Exists(rtnName) { | |
Set r = ##class(%Routine).%OpenId(rtnName) | |
Set header=r.ReadLine() | |
If (header'["automatically generated") { | |
Set err=##class(%Exception.SystemException).%New() | |
Set $ECODE=",UCUSTOMZWELCOME" | |
} | |
While ('r.AtEnd) { | |
Set line=r.ReadLine() | |
If (line[pre) { | |
Set ns=$piece($piece(line,pre,2),sep,1) ; format is pre_ns_sep_data | |
Set data=$piece($piece(line,pre,2),sep,2) | |
If (ns'="") { Set info(ns)=data } | |
} | |
} | |
Do r.Clear() | |
} Else { | |
Set r = ##class(%Routine).%New(rtnName) | |
} | |
Set info(oldNS) = org_"/"_sys_"/"_env_"""" | |
If (env="LIVE") { | |
Set info(oldNS) = info(oldNS)_","" [This is a LIVE environment; "",$c(27,91,55,109),""Use caution!"",$c(27,91,109),""]""" | |
} | |
Do r.WriteLine(" ; ZWELCOME automatically generated by Environment Configurator") | |
Do r.WriteLine("ZWELCOME") | |
Do r.WriteLine(" Write ""Environments are configured in the following namespace(s): [org/sys/env]""") | |
Set ns=$order(info("")) | |
While (ns'="") { | |
Do r.WriteLine(pre_ns_sep_info(ns)) | |
Set ns=$order(info(ns)) | |
} | |
Do r.WriteLine(" Write !") | |
Do r.WriteLine(" Quit") | |
Do r.Save() | |
Do r.Compile() | |
} Catch err { | |
Set $ECODE="" | |
Set msg=$case(err.Name, | |
"<PROTECT>":"Access to %SYS is not allowed; ZWELCOME could not be created", | |
"<ECODETRAP>":"A custom ZWELCOME exists; no action taken", | |
:"An error occurred: "_$system.Status.GetErrorText(err.AsStatus())) | |
Write !,msg | |
} | |
Do $ZU(5,oldNS) | |
Quit | |
} | |
]]></Routine> | |
<Project name="HandlingEnvironments" LastModified="2014-03-17 10:14:13.718784"> | |
<Items> | |
<ProjectItem name="CCR.Environment" type="CLS"></ProjectItem> | |
<ProjectItem name="CCR.System" type="CLS"></ProjectItem> | |
<ProjectItem name="csp/samples/SystemView.csp" type="CSP"></ProjectItem> | |
<ProjectItem name="Config.MAC" type="MAC"></ProjectItem> | |
</Items> | |
</Project> | |
<CSP name="SystemView.csp" application="/csp/samples/" default="1"><![CDATA[ | |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
<html> <head> | |
<title>System Details</title> | |
<!--link rel="stylesheet" type="text/css" href="scripts/ccrStyle.css"> | |
<script language="javascript" src="scripts/ccrScripts.js"></script--> | |
<style type='text/css'> | |
.headerInfo{ | |
background:greenyellow; | |
cursor:pointer; | |
} | |
.readonly{ | |
background: gainsboro; | |
} | |
body > div > table { | |
-webkit-border-radius: 10px; | |
border-radius: 10px; | |
-webkit-box-shadow: 3px 3px 10px 3px #14991C; | |
box-shadow: 3px 3px 10px 3px #14991C; | |
} | |
</style> | |
</head> | |
<body> | |
<div align="center"> | |
<table cellpadding="4" cellspacing="1" border="0"> | |
<tr class="header"><td align='center'><h1>System Details</h1></td> | |
<tr><td valign="top" align="center" > | |
<csp:object name='SystemObj' classname='CCR.System' OBJID='#(requestSysID)#'> | |
<table cellspacing="2" cellpadding="2" border="0" style="border-bottom: 1px solid black; width: 100%;"> | |
<tr> | |
<form name='form' cspbind='SystemObj' cspjs='All'> | |
<td align='center'> | |
<table cellspacing="2" cellpadding="2" border="0"> | |
<csp:if condition="newSystem"> | |
<tr> | |
<td colspan='3' align='center'><strong>Create a new System</strong></td> | |
</tr> | |
<tr> | |
<td colspan='3' align='center' class='required'>(*) indicated a required field</td> | |
</tr> | |
<csp:else> | |
<tr> | |
<td><strong>Select System:</strong></td> | |
<td> | |
<select name='ID' onchange='javascript:update(this.value);' cspbind='ID' readonly> | |
<script language='cache' runat='server'> | |
Set query2 = ##class(%ResultSet).%New("CCR.System:Systems") | |
set sc = query2.Execute(0,currentDep) | |
While (query2.Next()) { | |
Set id = query2.Get("ID") | |
If requestSysID="" Set requestSysID=id | |
Set name = query2.Get("DisplayName") | |
Set selected = $S(id=requestSysID:"selected",1:"") | |
&html<<option value='#(id)#' #(selected)#>#(name)#</option>> | |
} | |
</script> | |
</select> | |
</td> | |
<td align='right'><a href='javascript:createNew();'>[create System]</a></td> | |
</tr> | |
<csp:if condition='currentDep'> | |
<tr> | |
<td colspan='3' align='right'> | |
<a href="#(..CreateDetailsLink(requestSysID,0))#">[Hide Deprecated]</a> | |
</td> | |
</tr> | |
<csp:else> | |
<tr> | |
<td colspan='3' align='right'> | |
<a href="#(..CreateDetailsLink(requestSysID,1))#">[Show Deprecated]</a> | |
</td> | |
</tr> | |
</csp:if> | |
</csp:if> | |
</table> | |
</td> | |
</tr> | |
</table> | |
<table cellspacing="2" cellpadding="2" border="0"> | |
<tr> | |
<td colspan='3'> | |
<center> | |
<table class='formTable'> | |
<tr valign='top'> | |
<td> | |
<table> | |
<csp:if condition="newSystem"> | |
<tr title='Descriptive Name for System, usually indicating product and version'> | |
<td><strong><div align='right' class='required'>*System Name:</div></strong></td> | |
<td><input type='text' name='NewName' cspbind='Name' size='20'> | |
<input type='hidden' name='Org' cspbind='Org'></td> | |
</tr> | |
<tr title='abbreviated code for the site where this system is installed'> | |
<td><strong><div align='right' class='required'>*Site Code:</div></strong></td> | |
<td><input type='text' name='NewSiteCode' cspbind='SiteCode' size='10'></td> | |
</tr> | |
<tr title='abbreviated code for this system; it must be unique within an organization and it must be alphanumeric'> | |
<td><strong><div align='right' class='required'>*System Code:</div></strong></td> | |
<td><input type='text' name='NewSystemCode' cspbind='SystemCode' size='10'></td> | |
</tr> | |
<csp:else> | |
<tr> | |
<td><strong><div align='right'>System Name:</div></strong></td> | |
<td><input type='text' name='Name' id='Name' cspbind='Name' size='20'> | |
</tr> | |
<tr> | |
<td class='readonly'><strong><div align='right'>Site Code:</div></strong></td> | |
<td class='readonly'><input type='text' name='SiteCode' id='SiteCode' cspbind='SiteCode' size='20' readonly> | |
</tr> | |
<tr title='abbeviated code for this system; it must be unique within an organization and it must be alphanumeric'> | |
<td class='readonly'><strong><div align='right'>System Code:</div></strong></td> | |
<td class='readonly'><input type='text' name='SystemCode' cspbind='SystemCode' size='20' readonly> | |
<right><a href='#(..CreateDetailsLink(requestSysID,currentDep))#'>[direct link]</a></right> | |
</tr> | |
</csp:if> | |
<tr> | |
<td><strong><div align='right'>Description:</div></strong></td> | |
<td><textarea name='Description' cspbind='Description' rows="3" cols="50"></textarea></td> | |
</tr> | |
<csp:if condition="'newSystem"> | |
<tr title='List of flags impacting the workflow of CCRs for this System'> | |
<td class='readonly'><strong><div align='right'>Workflow Flags:</div></strong></td> | |
<td class='readonly'><input type='text' name='Flags' size='60' readonly></td> | |
</tr> | |
<tr id="advancedLabel" title='advanced controls for changes to System'> | |
<td colspan='2'><a href="javascript:toggleTRs('advancedLabel','advancedControls');">[show Advanced controls]</a></td> | |
</tr> | |
<tr id="advancedControls" style='display: none' title='advanced controls for changes to System'> | |
<td> | |
<table> | |
<tr> | |
<td><a href="javascript:toggleTRs('advancedControls','advancedLabel');">[hide Advanced controls]</a></td> | |
</tr> | |
<tr title='Check this box if there is a BASE environment for this System'> | |
<td><strong><div align='right'>BASE:</div></strong></td> | |
<td><input type='checkbox' id='EnvBASE' name='EnvBASE' cspbind='EnvBASE'> | |
</td> | |
</tr> | |
<tr title='Check this box if there is a TEST environment for this System'> | |
<td><strong><div align='right'>TEST:</div></strong></td> | |
<td><input type='checkbox' id='EnvTEST' name='EnvTEST' cspbind='EnvTEST'> | |
</td> | |
</tr> | |
<tr title='Check this box if there is a UAT environment for this System'> | |
<td><strong><div align='right'>UAT:</div></strong></td> | |
<td><input type='checkbox' id='EnvUAT' name='EnvUAT' cspbind='EnvUAT'> | |
</td> | |
</tr> | |
<tr title='Check this box if there is a LIVE environment for this System'> | |
<td><strong><div align='right'>LIVE:</div></strong></td> | |
<td><input type='checkbox' id='EnvLIVE' name='EnvLIVE' cspbind='EnvLIVE'> | |
</td> | |
</tr> | |
<tr title='Check this box if System is Deprecated; this will prevent CCRs from being created, but does not affect prior CCRs'> | |
<td><strong><div align='right'>System is Deprecated:</div></strong></td> | |
<td><input type='checkbox' id='Deprecated' name='Deprecated' cspbind='Deprecated'/> | |
</td> | |
</table> | |
</td> | |
</tr> | |
<csp:else> | |
<tr> | |
<td><input type='hidden' id='EnvBASE' name='EnvBASEHidden' cspbind='EnvBASE'></td> | |
<td><input type='hidden' id='EnvTEST' name='EnvTESTHidden' cspbind='EnvTEST'></td> | |
<td><input type='hidden' id='EnvUAT' name='EnvUATHidden' cspbind='EnvUAT'></td> | |
<td><input type='hidden' id='EnvLIVE' name='EnvLIVEHidden' cspbind='EnvLIVE'></td> | |
<td><input type='hidden' id='Deprecated' name='DeprecatedHidden' cspbind='Deprecated'></td> | |
</tr> | |
</csp:if> | |
</table> | |
</td> | |
<td bgcolor="#e0e0ff"></td> | |
<td style="min-width: 350px;"> | |
<table style="width: 100%;"> | |
<tr> | |
<td> | |
<span style="font-size: larger;"><strong>Environment Details:</strong></span> | |
<a title='Export environment details to a registry file that automatically configures Cache Server Manager' href='javascript:exportReg("#(requestSysID)#");'> | |
[export definitions] | |
</a> | |
</td> | |
</tr> | |
<tr id='BASEheader'> | |
<td> | |
<table width="100%"> | |
<tr class='headerInfo' onclick="showHideItems('BASEcontents', 'BASEBtn');"> | |
<td colspan='2' title="Show/hide Environment Details"> | |
<strong>BASE Environment Settings</strong> | |
</td> | |
</tr> | |
<tr id='BASEcontents' style="display:none"> | |
<td> | |
<table> | |
<tr title='Primary Namespace for this Environment'> | |
<td><strong><div align='right'>Namespace:</div></strong></td> | |
<td><input type='text' name='BASENamespace' cspbind='BASE.Namespace' size='20'></td> | |
</tr> | |
<tr title='Home Page for this Environment'> | |
<td><strong><div align='right'>Home Page:</div></strong></td> | |
<td><input type='text' name='BASEHomePage' id='BASEHomePage' cspbind='BASE.HomePageLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='BASEHomePageLink' href='javascript:viewlink("BASEHomePage");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Link to System Management Portal for this Environment'> | |
<td><strong><div align='right'>SMP:</div></strong></td> | |
<td><input type='text' name='BASESMP' id='BASESMP' cspbind='BASE.SMPLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='BASESMPLink' href='javascript:viewlink("BASESMP");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Super Server port to connect through'> | |
<td><strong><div align='right'>Super Server:</div></strong></td> | |
<td><input type='text' name='SuperServer' id='SuperServer' cspbind='BASE.SuperServer' size='20'> | |
</tr> | |
<tr title='Terminal port to connect through'> | |
<td><strong><div align='right'>Terminal Port:</div></strong></td> | |
<td><input type='text' name='TerminalPort' id='TerminalPort' cspbind='BASE.TerminalPort' size='20'> | |
<csp:if condition=(SystemObj.BASE.SMPLink'="")> | |
<script language='cache' runat='server'> | |
do ##class(%Net.URLParser).Parse(SystemObj.BASE.SMPLink,.components) | |
if $find(components("netloc"),":")'=0 { | |
w "<a href='telnet://"_$extract(components("netloc"),1,$find(components("netloc"),":")-2)_"'> [telnet]</a>" | |
} | |
else { | |
w "<a href='telnet://"_components("netloc")_"'> [telnet]</a>" | |
} | |
</script> | |
</csp:if> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr id='TESTheader'> | |
<td> | |
<table width="100%"> | |
<tr class='headerInfo' onclick="showHideItems('TESTcontents', 'TESTBtn');"> | |
<td colspan='2' title="Show/hide Environment Details"> | |
<strong>TEST Environment Settings</strong> | |
</td> | |
</tr> | |
<tr id='TESTcontents' style="display:none"> | |
<td> | |
<table> | |
<tr title='Primary Namespace for this Environment'> | |
<td><strong><div align='right'>Namespace:</div></strong></td> | |
<td><input type='text' name='TESTNamespace' cspbind='TEST.Namespace' size='20'></td> | |
</tr> | |
<tr title='Home Page for this Environment'> | |
<td><strong><div align='right'>Home Page:</div></strong></td> | |
<td><input type='text' name='TESTHomePage' id='TESTHomePage' cspbind='TEST.HomePageLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='TESTHomePageLink' href='javascript:viewlink("TESTHomePage");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Link to System Management Portal for this Environment'> | |
<td><strong><div align='right'>SMP:</div></strong></td> | |
<td><input type='text' name='TESTSMP' id='TESTSMP' cspbind='TEST.SMPLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='TESTSMPLink' href='javascript:viewlink("TESTSMP");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Super Server port to connect through'> | |
<td><strong><div align='right'>Super Server:</div></strong></td> | |
<td><input type='text' name='SuperServer' id='SuperServer' cspbind='TEST.SuperServer' size='20'> | |
</tr> | |
<tr title='Terminal port to connect through'> | |
<td><strong><div align='right'>Terminal Port:</div></strong></td> | |
<td><input type='text' name='TerminalPort' id='TerminalPort' cspbind='TEST.TerminalPort' size='20'> | |
<csp:if condition=(SystemObj.TEST.SMPLink'="")> | |
<script language='cache' runat='server'> | |
do ##class(%Net.URLParser).Parse(SystemObj.TEST.SMPLink,.components) | |
if $find(components("netloc"),":")'=0 { | |
w "<a href='telnet://"_$extract(components("netloc"),1,$find(components("netloc"),":")-2)_"'> [telnet]</a>" | |
} | |
else { | |
w "<a href='telnet://"_components("netloc")_"'> [telnet]</a>" | |
} | |
</script> | |
</csp:if> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr id='UATheader'> | |
<td> | |
<table width="100%"> | |
<tr class='headerInfo' onclick="showHideItems('UATcontents', 'UATBtn');"> | |
<td colspan='2' title="Show/hide Environment Details"> | |
<strong>UAT Environment Settings</strong> | |
</td> | |
</tr> | |
<tr id='UATcontents' style="display:none"> | |
<td> | |
<table> | |
<tr title='Primary Namespace for this Environment'> | |
<td><strong><div align='right'>Namespace:</div></strong></td> | |
<td><input type='text' name='UATNamespace' cspbind='UAT.Namespace' size='20'></td> | |
</tr> | |
<tr title='Home Page for this Environment'> | |
<td><strong><div align='right'>Home Page:</div></strong></td> | |
<td><input type='text' name='UATHomePage' id='UATHomePage' cspbind='UAT.HomePageLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='UATHomePageLink' href='javascript:viewlink("UATHomePage");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Link to System Management Portal for this Environment'> | |
<td><strong><div align='right'>SMP:</div></strong></td> | |
<td><input type='text' name='UATSMP' id='UATSMP' cspbind='UAT.SMPLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='UATSMPLink' href='javascript:viewlink("UATSMP");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Super Server port to connect through'> | |
<td><strong><div align='right'>Super Server:</div></strong></td> | |
<td><input type='text' name='SuperServer' id='SuperServer' cspbind='UAT.SuperServer' size='20'> | |
</tr> | |
<tr title='Terminal port to connect through'> | |
<td><strong><div align='right'>Terminal Port:</div></strong></td> | |
<td><input type='text' name='TerminalPort' id='TerminalPort' cspbind='UAT.TerminalPort' size='20'> | |
<csp:if condition=(SystemObj.UAT.SMPLink'="")> | |
<script language='cache' runat='server'> | |
do ##class(%Net.URLParser).Parse(SystemObj.UAT.SMPLink,.components) | |
if $find(components("netloc"),":")'=0 { | |
w "<a href='telnet://"_$extract(components("netloc"),1,$find(components("netloc"),":")-2)_"'> [telnet]</a>" | |
} | |
else { | |
w "<a href='telnet://"_components("netloc")_"'> [telnet]</a>" | |
} | |
</script> | |
</csp:if> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr id='LIVEheader'> | |
<td> | |
<table width="100%"> | |
<tr class='headerInfo' onclick="showHideItems('LIVEcontents', 'LIVEBtn');"> | |
<td colspan='2' title="Show/hide Environment Details"> | |
<strong>LIVE Environment Settings</strong> | |
</td> | |
</tr> | |
<tr id='LIVEcontents' style="display:none"> | |
<td> | |
<table> | |
<tr title='Primary Namespace for this Environment'> | |
<td><strong><div align='right'>Namespace:</div></strong></td> | |
<td><input type='text' name='LIVENamespace' cspbind='LIVE.Namespace' size='20'></td> | |
</tr> | |
<tr title='Home Page for this Environment'> | |
<td><strong><div align='right'>Home Page:</div></strong></td> | |
<td><input type='text' name='LIVEHomePage' id='LIVEHomePage' cspbind='LIVE.HomePageLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='LIVEHomePageLink' href='javascript:viewlink("LIVEHomePage");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Link to System Management Portal for this Environment'> | |
<td><strong><div align='right'>SMP:</div></strong></td> | |
<td><input type='text' name='LIVESMP' id='LIVESMP' cspbind='LIVE.SMPLink' size='20'> | |
<csp:if condition="'newSystem"> | |
<a id='LIVESMPLink' href='javascript:viewlink("LIVESMP");'>[view]</a> | |
</csp:if> | |
</td> | |
</tr> | |
<tr title='Super Server port to connect through'> | |
<td><strong><div align='right'>Super Server:</div></strong></td> | |
<td><input type='text' name='SuperServer' id='SuperServer' cspbind='LIVE.SuperServer' size='20'> | |
</tr> | |
<tr title='Terminal port to connect through'> | |
<td><strong><div align='right'>Terminal Port:</div></strong></td> | |
<td><input type='text' name='TerminalPort' id='TerminalPort' cspbind='LIVE.TerminalPort' size='20'> | |
<csp:if condition=(SystemObj.LIVE.SMPLink'="")> | |
<script language='cache' runat='server'> | |
do ##class(%Net.URLParser).Parse(SystemObj.LIVE.SMPLink,.components) | |
if $find(components("netloc"),":")'=0 { | |
w "<a href='telnet://"_$extract(components("netloc"),1,$find(components("netloc"),":")-2)_"'> [telnet]</a>" | |
} | |
else { | |
w "<a href='telnet://"_components("netloc")_"'> [telnet]</a>" | |
} | |
</script> | |
</csp:if> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr> | |
<td><div align='right'> | |
<a href="javascript:telnetRegistry()" title="Downloads a .reg file to be ran that creates a registry key to allow the use of the telnet protocol">Update Telnet Registry Keys</a><br> | |
</div></td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr> | |
<td colspan='3' align='right'><input type='button' name='btnSave' value='Save' onclick='saveSystem();'></td> | |
</tr> | |
</form> | |
</td> | |
</tr> | |
</csp:if> | |
</table></td> | |
</tr> | |
</table> | |
<br> | |
<csp:if condition="newSystem"> | |
<a href='javascript:history.go(-1)'>cancel</a><BR><BR> | |
</csp:if> | |
</div></body> </html> | |
<SCRIPT Language=JavaScript> | |
if (document.form.ID) { | |
var ID=document.form.ID.value; | |
#server(..formCheckAndLoad(ID))#; | |
document.form.Flags.value=''; | |
if (document.getElementById('EnvBASE').checked) { | |
document.form.Flags.value=document.form.Flags.value+'BASE; '; | |
show('BASEheader'); | |
if (document.getElementById('BASEprofiler')) { hide('BASEprofiler'); } | |
} else { | |
hide('BASEheader'); | |
if (document.getElementById('BASEprofiler')) { show('BASEprofiler'); } | |
} | |
if (document.getElementById('EnvTEST').checked) { | |
document.form.Flags.value=document.form.Flags.value+'TEST; ' | |
show('TESTheader'); | |
if (document.getElementById('TESTprofiler')) { hide('TESTprofiler'); } | |
} else { | |
hide('TESTheader'); | |
if (document.getElementById('TESTprofiler')) { show('TESTprofiler'); } | |
} | |
if(document.getElementById('EnvUAT').checked) { | |
document.form.Flags.value=document.form.Flags.value+'UAT; ' | |
show('UATheader'); | |
if (document.getElementById('UATprofiler')) { hide('UATprofiler'); } | |
} else { | |
hide('UATheader'); | |
if (document.getElementById('UATprofiler')) { show('UATprofiler'); } | |
} | |
if(document.getElementById('EnvLIVE').checked) { | |
document.form.Flags.value=document.form.Flags.value+'LIVE; ' | |
show('LIVEheader'); | |
if (document.getElementById('LIVEprofiler')) { hide('LIVEprofiler'); } | |
} else { | |
hide('LIVEheader'); | |
if (document.getElementById('LIVEprofiler')) { show('LIVEprofiler'); } | |
} | |
} | |
function update(ID) { | |
self.document.location=#server(..CreateDetailsLink(ID,'#(currentDep)#'))# | |
} | |
function createNew() { | |
self.document.location=#server(..CreateDetailsLink('new'))#; | |
} | |
function exportReg(sysID) { | |
self.document.location=#server(..ExportEnvToRegFile(sysID))#; | |
} | |
function saveSystem() { | |
if (form_save()) { | |
if ('#(newSystem)#'==1) { | |
self.document.location=#server(..CreateDetailsLink())#; | |
} else { | |
alert('System saved successfully'); | |
update(document.form.ID.value); | |
} | |
return true; | |
} | |
else { | |
alert('Error saving System'); | |
return false; | |
} | |
} | |
function telnetRegistry() { | |
var filepath=prompt("Please enter the full path of PuTTY. This will act as the default program for opening telnet links. Please save and run the generated Registry file.","C:\\Program Files (x86)\\PuTTY\\putty.exe"); | |
if (filepath!=null && filepath!="") { | |
self.document.location=#server(..telnetRegistry(filepath))#; | |
} | |
} | |
function viewlink(id) { | |
if (document.getElementById(id)) { | |
var url=document.getElementById(id).value; | |
if (url.indexOf("http")!=0) { | |
url="http://"+url; | |
} | |
window.open(url); | |
} | |
} | |
function hide(obj) { | |
var el = document.getElementById(obj); | |
el.style.display = 'none'; | |
} | |
function show(obj) { | |
var el = document.getElementById(obj); | |
el.style.display = ''; | |
} | |
function showHideItems(myItem, myButton){ | |
//this is the ID of the plus/minus button image | |
var el = document.getElementById(myItem); | |
if (el.style.display != "none") { | |
//items are currently displayed, so hide them | |
el.style.display = "none" | |
} | |
else { | |
//items are currently hidden, so display them | |
el.style.display = "" | |
} | |
} | |
function toggleTRs(div1,div2){ | |
toggleView(div1); | |
toggleView(div2); | |
} | |
function toggleView(myItem){ | |
var el = document.getElementById(myItem); | |
if (el.style.display != "none") { | |
//items are currently displayed, so hide them | |
el.style.display = "none" | |
} | |
else { | |
//items are currently hidden, so display them | |
el.style.display = "" | |
} | |
} | |
</script> | |
<SCRIPT language='cache' runat='server' method='telnetRegistry' arguments="filepath"> | |
Try { | |
Set stream=##class(%Library.GlobalBinaryStream).%New() | |
Do stream.WriteLine("Windows Registry Editor Version 5.00") | |
Do stream.WriteLine() | |
Do stream.WriteLine("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_TELNET_PROTOCOL]") | |
Do stream.WriteLine("""iexplore.exe""=dword:0") | |
Do stream.WriteLine() | |
Do stream.WriteLine("[HKEY_LOCAL_MACHINE\SOFTWARE\WoW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_TELNET_PROTOCOL]") | |
Do stream.WriteLine("""iexplore.exe""=dword:0") | |
Do stream.WriteLine() | |
Do stream.WriteLine("[HKEY_CLASSES_ROOT\telnet\shell\open\command]") | |
Do stream.WriteLine("@ = ""\"""_$replace(filepath,"\","\\")_"\"" \""%l\""""") | |
Do stream.SetAttribute("ContentType","application/octet-stream") | |
Do stream.SetAttribute("ContentDisposition","attachment; filename=telnetEdit.reg") | |
Do stream.SetAttribute("Expires",600) | |
Do stream.%Save() | |
Set streamOID = stream.%Oid() | |
Set href = "%25CSP.StreamServer.cls?STREAMOID="_##class(%CSP.Page).Encrypt(streamOID) | |
} Catch ex { | |
Do LOG^%ETN | |
} | |
Quit $get(href) | |
</script> | |
<SCRIPT language='cache' runat='server' method='ExportEnvToRegFile' arguments='pSysID'> | |
Set status = ##class(CCR.System).ExportEnvToRegFile(pSysID) | |
Quit ..Link(status) | |
</script> | |
<SCRIPT language='cache' runat='server' method='formCheckAndLoad' arguments='pID'> | |
Set requestedSystem=##class(CCR.System).%OpenId(pID) | |
If ('$isobject(requestedSystem)) { | |
//not a valid requested user for loading | |
Quit 0 | |
} | |
Quit ..formLoad(pID) | |
</script> | |
<SCRIPT language='cache' runat='server' method='CreateDetailsLink' arguments='pSysID,pShowDep=0,pShowChildDep=0'> | |
If ($get(pSysID)="new") { | |
Set urldata("new")=1 | |
} Else { | |
Set urldata("SysID")=$get(pSysID) | |
} | |
If ($get(pShowDep)=1) { | |
Set urldata("showDep")=1 | |
} Else { | |
Set urldata("showDep")=0 | |
} | |
If ($get(pShowChildDep)=1) { | |
Set urldata("showChildDep")=1 | |
} Else { | |
Set urldata("showChildDep")=0 | |
} | |
Quit ..Link("SystemView.csp",.urldata) | |
</script> | |
<script Method='OnPreHTTP' Language='cache' Runat='server' ReturnType='%Boolean'> | |
// Quick checck to see if there is already any System data; if not then create an example System | |
&sql(Select COUNT(ID) INTO :SysCount FROM CCR.System) | |
If ($get(SysCount) < 1) { | |
Set sys=##class(CCR.System).%New() | |
Set sys.EnvUAT=0 | |
Set sys.Description = "Dummy System Definition just for demonstration purposes" | |
Set sys.Name = "Test System" | |
Set sys.SiteCode = "GS14" | |
Set sys.SystemCode = "TESTSYS" | |
Set env=##class(CCR.Environment).%New() | |
Set env.Namespace="SAMPLES" | |
Set env.HomePageLink="http://localhost:57772/csp/samples/SystemView.csp" | |
Set env.SMPLink="http://localhost:57772/csp/sys/%25CSP.Portal.Home.zen" | |
Set env.SuperServer=1972 | |
Set env.TerminalPort=23 | |
Set sys.BASE=env | |
Set sys.TEST=env | |
Set sys.LIVE=env | |
Set sc=sys.%Save() | |
If $$$ISERR(sc) { | |
Set err=$System.Status.GetErrorText(sc) | |
DO LOG^%ETN | |
} | |
} Else { | |
DO LOG^%ETN | |
} | |
If (%request.Get("showDep")'=1 && %request.Get("showDep")'=0) { | |
set %request.Get("showDep")=0 | |
} | |
Set currentDep=%request.Get("showDep") | |
Set:currentDep="" currentDep=0 | |
Set currentChildDep=%request.Get("showChildDep") | |
Set:currentChildDep="" currentChildDep=0 | |
Set requestSysID=%request.Get("SysID") | |
Set newSystem=%request.Get("new") | |
If (requestSysID="")&&(newSystem="") { | |
If (requestSysID="") { | |
Set query = ##class(%ResultSet).%New("CCR.System:Systems") | |
Set sc = query.Execute() | |
//default to loading the first System | |
If query.Next() Set requestSysID = query.Get("ID") | |
Do query.Close() | |
} | |
} | |
Set tempSys=##class(CCR.System).%OpenId(requestSysID) | |
Set isDep=0 | |
If ($isobject(tempSys)) { | |
Set isDep=tempSys.Deprecated | |
If (isDep) { | |
Set currentDep=isDep | |
} | |
} | |
Quit 1 | |
</script> | |
]]></CSP> | |
</Export> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment