@@ -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
@@ -561,7 +570,7 @@ ClassMethod Push(remote As %String = "origin", force As %Boolean = 0) As %Status
561
570
562
571
ClassMethod Fetch (ByRef diffFiles ) As %Status
563
572
{
564
- do ..RunGitCommand (" fetch" , .errStream , .outStream )
573
+ do ..RunGitCommand (" fetch" , .errStream , .outStream , " --prune " )
565
574
write !, " Fetch done"
566
575
kill errStream , outStream
567
576
do ..RunGitCommand (" diff" , .errStream , .outStream , " ..origin/" _..GetCurrentBranch (), " --name-only" )
@@ -1615,6 +1624,13 @@ ClassMethod ExportAll(force As %Boolean = 0) As %Status
1615
1624
quit ..ExportRoutines (force )
1616
1625
}
1617
1626
1627
+ ClassMethod ExportSystemDefaults () As %Status
1628
+ {
1629
+ new %SourceControl
1630
+ do ##class (%Studio.SourceControl.Interface ).SourceControlCreate ()
1631
+ quit %SourceControl .OnAfterSave (" Ens.Config.DefaultSettings.ESD" )
1632
+ }
1633
+
1618
1634
/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
1619
1635
ClassMethod ImportAll (force As %Boolean = 0 ) As %Status
1620
1636
{
@@ -1837,7 +1853,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1837
1853
set diffBase = ..GetCurrentBranch ()
1838
1854
}
1839
1855
1840
- do ..RunGitCommand (" fetch" , .errorStream , .outputStream )
1856
+ do ..RunGitCommand (" fetch" , .errorStream , .outputStream , " --prune " )
1841
1857
kill errorStream , outputStream
1842
1858
do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _$Case (diffCompare ," " :" " ,:" .." )_diffCompare , " --name-status" )
1843
1859
do ..ParseDiffStream (outputStream ,,.files )
@@ -2490,28 +2506,32 @@ ClassMethod Localize()
2490
2506
}
2491
2507
}
2492
2508
2493
- ClassMethod GetContexts () As %DynamicArray
2509
+ ClassMethod GetContexts (onlyNamespaces As %Boolean ) As %DynamicArray
2494
2510
{
2495
2511
set contexts = []
2496
2512
set namespaces = ..GetGitEnabledNamespaces ()
2497
2513
set ptr = 0
2498
2514
while $listnext (namespaces ,ptr ,value ) {
2499
- do contexts .%Push (value )
2515
+ if '($FIND (value ," ^^" )){
2516
+ do contexts .%Push (value )
2517
+ }
2500
2518
}
2501
2519
2502
2520
set name = " "
2503
2521
2504
2522
// Using embedded for backwards compatability
2505
- &sql (DECLARE C1 CURSOR FOR SELECT name into :name from %Library .RoutineMgr_StudioOpenDialog (' *.ZPM' ))
2506
- &sql (OPEN C1)
2507
- throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
2508
- &sql (FETCH C1)
2509
- while (SQLCODE = 0 ) {
2510
- set package = name
2511
- do contexts .%Push (package )
2523
+ if '(onlyNamespaces ) {
2524
+ &sql (DECLARE C1 CURSOR FOR SELECT name into :name from %Library .RoutineMgr_StudioOpenDialog (' *.ZPM' ))
2525
+ &sql (OPEN C1)
2526
+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
2512
2527
&sql (FETCH C1)
2528
+ while (SQLCODE = 0 ) {
2529
+ set package = name
2530
+ do contexts .%Push (package )
2531
+ &sql (FETCH C1)
2532
+ }
2533
+ &sql (CLOSE C1)
2513
2534
}
2514
- &sql (CLOSE C1)
2515
2535
2516
2536
return contexts
2517
2537
}
@@ -2583,6 +2603,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
2583
2603
1 : " " )
2584
2604
}
2585
2605
2606
+ XData ProductionConfigScript [ MimeType = text /javascript ]
2607
+ {
2608
+ function checkProductionConfigLoad () {
2609
+ timerState (false );
2610
+ }
2611
+
2612
+ function checkProductionConfigUnload () {
2613
+ timerState (true );
2614
+ }
2615
+
2616
+ function timerState (start ) {
2617
+ if (window .parent && window .parent .opener && window .parent .opener .zenPage ) {
2618
+ if (start && window .parent .opener .zenPage .startTimers ) {
2619
+ window .parent .opener .zenPage .startTimers ();
2620
+ }
2621
+ if (!start && window .parent .opener .zenPage .stopTimers ) {
2622
+ window .parent .opener .zenPage .stopTimers ();
2623
+ }
2624
+ }
2625
+ }
2626
+ }
2627
+
2628
+ ClassMethod ProductionConfigScript () As %String [ CodeMode = objectgenerator ]
2629
+ {
2630
+ do %code .WriteLine (" set html = " " <script type='text/javascript'>" " _$c(13,10)" )
2631
+ set xdata = ##class (%Dictionary.XDataDefinition ).IDKEYOpen (%compiledclass .Name ,%compiledmethod .Name ,,.sc )
2632
+ $$$ThrowOnError(sc )
2633
+ while 'xdata .Data .AtEnd {
2634
+ set line = xdata .Data .ReadLine ()
2635
+ do %code .WriteLine (" set html = html_" _$$Quote ^%qcr (line )_" _$c(13,10)" )
2636
+ }
2637
+ do %code .WriteLine (" set html = html_$c(13,10)_" " </script>" " " )
2638
+ do %code .WriteLine (" quit html" )
2639
+ quit $$$OK
2640
+ }
2641
+
2642
+ ClassMethod ProductionConfigBodyAttributes () As %String [ CodeMode = expression ]
2643
+ {
2644
+ " onload='checkProductionConfigLoad()' onbeforeunload='checkProductionConfigUnload()'"
2645
+ }
2646
+
2586
2647
ClassMethod UncommittedWithAction () As %Library .DynamicObject
2587
2648
{
2588
2649
do ##class (SourceControl.Git.Change ).RefreshUncommitted ()
@@ -2849,4 +2910,55 @@ ClassMethod InDefaultBranchBasicMode() As %Boolean
2849
2910
quit 0
2850
2911
}
2851
2912
2913
+ ClassMethod ConfigureFavoriteNamespaces (username As %String , newNamespaces As %String )
2914
+ {
2915
+ // Delete all the GIT favorite links for the user
2916
+ &sql (DELETE FROM %SYS_Portal .Users WHERE Username = :username AND Page LIKE ' %Git%' )
2917
+
2918
+ set iterator = newNamespaces .%GetIterator ()
2919
+ while iterator .%GetNext (.key , .value ) {
2920
+ set installNamespace = value
2921
+
2922
+ // Insert Git link
2923
+ set caption = " Git: " _ installNamespace
2924
+ set link = " /isc/studio/usertemplates/gitsourcecontrol/webuidriver.csp/" _ installNamespace _ " /"
2925
+ &sql (INSERT OR UPDATE INTO %SYS_Portal .Users (Username, Page, Data) VALUES (:username , :caption , :link ))
2926
+
2927
+ // Insert Git Pull link
2928
+ set caption = " Git Pull: " _ installNamespace
2929
+ set link = " /isc/studio/usertemplates/gitsourcecontrol/pull.csp?$NAMESPACE=" _ installNamespace
2930
+ &sql (INSERT OR UPDATE INTO %SYS_Portal .Users (Username, Page, Data) VALUES (:username , :caption , :link ))
2931
+ }
2932
+ }
2933
+
2934
+ ClassMethod GetFavoriteNamespaces (ByRef favNamespaces As %DynamicArray , ByRef nonFavNamespaces As %DynamicArray )
2935
+ {
2936
+ set allNamespaces = ..GetContexts (1 )
2937
+ set iterator = allNamespaces .%GetIterator ()
2938
+
2939
+ set username = $USERNAME
2940
+ set pagePrefix = " Git:"
2941
+ &sql (DECLARE FavCursor CURSOR FOR SELECT Page into :page from %SYS_Portal .Users where username = :username and page %STARTSWITH :pagePrefix)
2942
+
2943
+ while iterator .%GetNext (.key , .value ) {
2944
+ set foundFlag = 0
2945
+ &sql (OPEN FavCursor)
2946
+ throw :SQLCODE <0 ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE , %msg )
2947
+ &sql (FETCH FavCursor)
2948
+ while (SQLCODE = 0 ) {
2949
+ set pageValue = " Git: " _value
2950
+ if (page = pageValue ) {
2951
+ do favNamespaces .%Push (value )
2952
+ set foundFlag = 1
2953
+ }
2954
+ &sql (FETCH FavCursor)
2955
+ }
2956
+ &sql (CLOSE FavCursor)
2957
+
2958
+ if ('foundFlag ) {
2959
+ do nonFavNamespaces .%Push (value )
2960
+ }
2961
+ }
2962
+ }
2963
+
2852
2964
}
0 commit comments