@@ -72,6 +72,13 @@ ClassMethod SettingsUIReadOnly() As %Status [ CodeMode = expression ]
72
72
$Get (@..#Storage@(" settings" ," settingsUIReadOnly" ), 0 )
73
73
}
74
74
75
+ ClassMethod FavoriteNamespaces () As %String
76
+ {
77
+ set favNamespaces = []
78
+ do ..GetFavoriteNamespaces (.favNamespaces ,[])
79
+ return favNamespaces
80
+ }
81
+
75
82
/// Returns the current (or previous) value of the flag.
76
83
ClassMethod Locked (newFlagValue As %Boolean ) As %Boolean
77
84
{
@@ -251,6 +258,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
251
258
if ec {
252
259
write !," ==export done==" ,!
253
260
}
261
+ } elseif (menuItemName = " ExportSystemDefaults" ) {
262
+ set ec = ..ExportSystemDefaults ()
254
263
} elseif (menuItemName = " Import" ) {
255
264
set ec = ..ImportAll ()
256
265
set Reload = 1
@@ -576,7 +585,7 @@ ClassMethod Push(remote As %String = "origin", force As %Boolean = 0) As %Status
576
585
577
586
ClassMethod Fetch (ByRef diffFiles ) As %Status
578
587
{
579
- do ..RunGitCommand (" fetch" , .errStream , .outStream )
588
+ do ..RunGitCommand (" fetch" , .errStream , .outStream , " --prune " )
580
589
write !, " Fetch done"
581
590
kill errStream , outStream
582
591
do ..RunGitCommand (" diff" , .errStream , .outStream , " ..origin/" _..GetCurrentBranch (), " --name-only" )
@@ -1630,6 +1639,13 @@ ClassMethod ExportAll(force As %Boolean = 0) As %Status
1630
1639
quit ..ExportRoutines (force )
1631
1640
}
1632
1641
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
+
1633
1649
/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
1634
1650
ClassMethod ImportAll (force As %Boolean = 0 ) As %Status
1635
1651
{
@@ -1852,7 +1868,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1852
1868
set diffBase = ..GetCurrentBranch ()
1853
1869
}
1854
1870
1855
- do ..RunGitCommand (" fetch" , .errorStream , .outputStream )
1871
+ do ..RunGitCommand (" fetch" , .errorStream , .outputStream , " --prune " )
1856
1872
kill errorStream , outputStream
1857
1873
do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _$Case (diffCompare ," " :" " ,:" .." )_diffCompare , " --name-status" )
1858
1874
do ..ParseDiffStream (outputStream ,,.files )
@@ -2505,28 +2521,32 @@ ClassMethod Localize()
2505
2521
}
2506
2522
}
2507
2523
2508
- ClassMethod GetContexts () As %DynamicArray
2524
+ ClassMethod GetContexts (onlyNamespaces As %Boolean ) As %DynamicArray
2509
2525
{
2510
2526
set contexts = []
2511
2527
set namespaces = ..GetGitEnabledNamespaces ()
2512
2528
set ptr = 0
2513
2529
while $listnext (namespaces ,ptr ,value ) {
2514
- do contexts .%Push (value )
2530
+ if '($FIND (value ," ^^" )){
2531
+ do contexts .%Push (value )
2532
+ }
2515
2533
}
2516
2534
2517
2535
set name = " "
2518
2536
2519
2537
// 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 )
2527
2542
&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)
2528
2549
}
2529
- &sql (CLOSE C1)
2530
2550
2531
2551
return contexts
2532
2552
}
@@ -2598,6 +2618,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
2598
2618
1 : " " )
2599
2619
}
2600
2620
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
+
2601
2662
ClassMethod UncommittedWithAction () As %Library .DynamicObject
2602
2663
{
2603
2664
do ##class (SourceControl.Git.Change ).RefreshUncommitted ()
@@ -2864,4 +2925,55 @@ ClassMethod InDefaultBranchBasicMode() As %Boolean
2864
2925
quit 0
2865
2926
}
2866
2927
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
+
2867
2979
}
0 commit comments