@@ -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
@@ -561,7 +570,7 @@ ClassMethod Push(remote As %String = "origin", force As %Boolean = 0) As %Status
561570
562571ClassMethod Fetch (ByRef diffFiles ) As %Status
563572{
564- do ..RunGitCommand (" fetch" , .errStream , .outStream )
573+ do ..RunGitCommand (" fetch" , .errStream , .outStream , " --prune " )
565574 write !, " Fetch done"
566575 kill errStream , outStream
567576 do ..RunGitCommand (" diff" , .errStream , .outStream , " ..origin/" _..GetCurrentBranch (), " --name-only" )
@@ -1615,6 +1624,13 @@ ClassMethod ExportAll(force As %Boolean = 0) As %Status
16151624 quit ..ExportRoutines (force )
16161625}
16171626
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+
16181634/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
16191635ClassMethod ImportAll (force As %Boolean = 0 ) As %Status
16201636{
@@ -1837,7 +1853,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
18371853 set diffBase = ..GetCurrentBranch ()
18381854 }
18391855
1840- do ..RunGitCommand (" fetch" , .errorStream , .outputStream )
1856+ do ..RunGitCommand (" fetch" , .errorStream , .outputStream , " --prune " )
18411857 kill errorStream , outputStream
18421858 do ##class (SourceControl.Git.Utils ).RunGitCommandWithInput (" diff" ,,.errorStream ,.outputStream , diffBase _$Case (diffCompare ," " :" " ,:" .." )_diffCompare , " --name-status" )
18431859 do ..ParseDiffStream (outputStream ,,.files )
@@ -2490,28 +2506,32 @@ ClassMethod Localize()
24902506 }
24912507}
24922508
2493- ClassMethod GetContexts () As %DynamicArray
2509+ ClassMethod GetContexts (onlyNamespaces As %Boolean ) As %DynamicArray
24942510{
24952511 set contexts = []
24962512 set namespaces = ..GetGitEnabledNamespaces ()
24972513 set ptr = 0
24982514 while $listnext (namespaces ,ptr ,value ) {
2499- do contexts .%Push (value )
2515+ if '($FIND (value ," ^^" )){
2516+ do contexts .%Push (value )
2517+ }
25002518 }
25012519
25022520 set name = " "
25032521
25042522 // 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 )
25122527 &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)
25132534 }
2514- &sql (CLOSE C1)
25152535
25162536 return contexts
25172537}
@@ -2583,6 +2603,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
25832603 1 : " " )
25842604}
25852605
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+
25862647ClassMethod UncommittedWithAction () As %Library .DynamicObject
25872648{
25882649 do ##class (SourceControl.Git.Change ).RefreshUncommitted ()
@@ -2849,4 +2910,55 @@ ClassMethod InDefaultBranchBasicMode() As %Boolean
28492910 quit 0
28502911}
28512912
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+
28522964}
0 commit comments