@@ -72,6 +72,13 @@ ClassMethod SettingsUIReadOnly() As %Status [ CodeMode = expression ]
7272$Get (@..#Storage@(" settings" ," settingsUIReadOnly" ), 0 )
7373}
7474
75+ ClassMethod FavoriteNamespaces () As %String
76+ {
77+ set favNamespaces = []
78+ do ..GetFavoriteNamespaces (.favNamespaces ,[])
79+ return favNamespaces
80+ }
81+
7582/// Returns the current (or previous) value of the flag.
7683ClassMethod Locked (newFlagValue As %Boolean ) As %Boolean
7784{
@@ -251,6 +258,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
251258 if ec {
252259 write !," ==export done==" ,!
253260 }
261+ } elseif (menuItemName = " ExportSystemDefaults" ) {
262+ set ec = ..ExportSystemDefaults ()
254263 } elseif (menuItemName = " Import" ) {
255264 set ec = ..ImportAll ()
256265 set Reload = 1
@@ -576,7 +585,7 @@ ClassMethod Push(remote As %String = "origin", force As %Boolean = 0) As %Status
576585
577586ClassMethod Fetch (ByRef diffFiles ) As %Status
578587{
579- do ..RunGitCommand (" fetch" , .errStream , .outStream )
588+ do ..RunGitCommand (" fetch" , .errStream , .outStream , " --prune " )
580589 write !, " Fetch done"
581590 kill errStream , outStream
582591 do ..RunGitCommand (" diff" , .errStream , .outStream , " ..origin/" _..GetCurrentBranch (), " --name-only" )
@@ -1630,6 +1639,13 @@ ClassMethod ExportAll(force As %Boolean = 0) As %Status
16301639 quit ..ExportRoutines (force )
16311640}
16321641
1642+ ClassMethod ExportSystemDefaults () As %Status
1643+ {
1644+ new %SourceControl
1645+ do ##class (%Studio.SourceControl.Interface ).SourceControlCreate ()
1646+ quit %SourceControl .OnAfterSave (" Ens.Config.DefaultSettings.ESD" )
1647+ }
1648+
16331649/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
16341650ClassMethod ImportAll (force As %Boolean = 0 ) As %Status
16351651{
@@ -1852,7 +1868,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
18521868 set diffBase = ..GetCurrentBranch ()
18531869 }
18541870
1855- do ..RunGitCommand (" fetch" , .errorStream , .outputStream )
1871+ do ..RunGitCommand (" fetch" , .errorStream , .outputStream , " --prune " )
18561872 kill errorStream , outputStream
18571873 do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _$Case (diffCompare ," " :" " ,:" .." )_diffCompare , " --name-status" )
18581874 do ..ParseDiffStream (outputStream ,,.files )
@@ -2505,28 +2521,32 @@ ClassMethod Localize()
25052521 }
25062522}
25072523
2508- ClassMethod GetContexts () As %DynamicArray
2524+ ClassMethod GetContexts (onlyNamespaces As %Boolean ) As %DynamicArray
25092525{
25102526 set contexts = []
25112527 set namespaces = ..GetGitEnabledNamespaces ()
25122528 set ptr = 0
25132529 while $listnext (namespaces ,ptr ,value ) {
2514- do contexts .%Push (value )
2530+ if '($FIND (value ," ^^" )){
2531+ do contexts .%Push (value )
2532+ }
25152533 }
25162534
25172535 set name = " "
25182536
25192537 // Using embedded for backwards compatability
2520- &sql (DECLARE C1 CURSOR FOR SELECT name into :name from %Library .RoutineMgr_StudioOpenDialog (' *.ZPM' ))
2521- &sql (OPEN C1)
2522- throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
2523- &sql (FETCH C1)
2524- while (SQLCODE = 0 ) {
2525- set package = name
2526- do contexts .%Push (package )
2538+ if '(onlyNamespaces ) {
2539+ &sql (DECLARE C1 CURSOR FOR SELECT name into :name from %Library .RoutineMgr_StudioOpenDialog (' *.ZPM' ))
2540+ &sql (OPEN C1)
2541+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
25272542 &sql (FETCH C1)
2543+ while (SQLCODE = 0 ) {
2544+ set package = name
2545+ do contexts .%Push (package )
2546+ &sql (FETCH C1)
2547+ }
2548+ &sql (CLOSE C1)
25282549 }
2529- &sql (CLOSE C1)
25302550
25312551 return contexts
25322552}
@@ -2598,6 +2618,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
25982618 1 : " " )
25992619}
26002620
2621+ XData ProductionConfigScript [ MimeType = text /javascript ]
2622+ {
2623+ function checkProductionConfigLoad () {
2624+ timerState (false );
2625+ }
2626+
2627+ function checkProductionConfigUnload () {
2628+ timerState (true );
2629+ }
2630+
2631+ function timerState (start ) {
2632+ if (window .parent && window .parent .opener && window .parent .opener .zenPage ) {
2633+ if (start && window .parent .opener .zenPage .startTimers ) {
2634+ window .parent .opener .zenPage .startTimers ();
2635+ }
2636+ if (!start && window .parent .opener .zenPage .stopTimers ) {
2637+ window .parent .opener .zenPage .stopTimers ();
2638+ }
2639+ }
2640+ }
2641+ }
2642+
2643+ ClassMethod ProductionConfigScript () As %String [ CodeMode = objectgenerator ]
2644+ {
2645+ do %code .WriteLine (" set html = " " <script type='text/javascript'>" " _$c(13,10)" )
2646+ set xdata = ##class (%Dictionary.XDataDefinition ).IDKEYOpen (%compiledclass .Name ,%compiledmethod .Name ,,.sc )
2647+ $$$ThrowOnError(sc )
2648+ while 'xdata .Data .AtEnd {
2649+ set line = xdata .Data .ReadLine ()
2650+ do %code .WriteLine (" set html = html_" _$$Quote ^%qcr (line )_" _$c(13,10)" )
2651+ }
2652+ do %code .WriteLine (" set html = html_$c(13,10)_" " </script>" " " )
2653+ do %code .WriteLine (" quit html" )
2654+ quit $$$OK
2655+ }
2656+
2657+ ClassMethod ProductionConfigBodyAttributes () As %String [ CodeMode = expression ]
2658+ {
2659+ " onload='checkProductionConfigLoad()' onbeforeunload='checkProductionConfigUnload()'"
2660+ }
2661+
26012662ClassMethod UncommittedWithAction () As %Library .DynamicObject
26022663{
26032664 do ##class (SourceControl.Git.Change ).RefreshUncommitted ()
@@ -2864,4 +2925,55 @@ ClassMethod InDefaultBranchBasicMode() As %Boolean
28642925 quit 0
28652926}
28662927
2928+ ClassMethod ConfigureFavoriteNamespaces (username As %String , newNamespaces As %String )
2929+ {
2930+ // Delete all the GIT favorite links for the user
2931+ &sql (DELETE FROM %SYS_Portal .Users WHERE Username = :username AND Page LIKE ' %Git%' )
2932+
2933+ set iterator = newNamespaces .%GetIterator ()
2934+ while iterator .%GetNext (.key , .value ) {
2935+ set installNamespace = value
2936+
2937+ // Insert Git link
2938+ set caption = " Git: " _ installNamespace
2939+ set link = " /isc/studio/usertemplates/gitsourcecontrol/webuidriver.csp/" _ installNamespace _ " /"
2940+ &sql (INSERT OR UPDATE INTO %SYS_Portal .Users (Username, Page, Data) VALUES (:username , :caption , :link ))
2941+
2942+ // Insert Git Pull link
2943+ set caption = " Git Pull: " _ installNamespace
2944+ set link = " /isc/studio/usertemplates/gitsourcecontrol/pull.csp?$NAMESPACE=" _ installNamespace
2945+ &sql (INSERT OR UPDATE INTO %SYS_Portal .Users (Username, Page, Data) VALUES (:username , :caption , :link ))
2946+ }
2947+ }
2948+
2949+ ClassMethod GetFavoriteNamespaces (ByRef favNamespaces As %DynamicArray , ByRef nonFavNamespaces As %DynamicArray )
2950+ {
2951+ set allNamespaces = ..GetContexts (1 )
2952+ set iterator = allNamespaces .%GetIterator ()
2953+
2954+ set username = $USERNAME
2955+ set pagePrefix = " Git:"
2956+ &sql (DECLARE FavCursor CURSOR FOR SELECT Page into :page from %SYS_Portal .Users where username = :username and page %STARTSWITH :pagePrefix)
2957+
2958+ while iterator .%GetNext (.key , .value ) {
2959+ set foundFlag = 0
2960+ &sql (OPEN FavCursor)
2961+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
2962+ &sql (FETCH FavCursor)
2963+ while (SQLCODE = 0 ) {
2964+ set pageValue = " Git: " _value
2965+ if (page = pageValue ) {
2966+ do favNamespaces .%Push (value )
2967+ set foundFlag = 1
2968+ }
2969+ &sql (FETCH FavCursor)
2970+ }
2971+ &sql (CLOSE FavCursor)
2972+
2973+ if ('foundFlag ) {
2974+ do nonFavNamespaces .%Push (value )
2975+ }
2976+ }
2977+ }
2978+
28672979}
0 commit comments