Ao full intray projects.mmbas

From ActivityOwnerWiki
Jump to: navigation, search
<nowiki>
'ao_full_intray_projects 21Aug07 http://activityowner.com http://creativecommons.org/licenses/by-sa/2.5/
'run on sweep and review dashboard to enumerate projects with full in-trays
Option Explicit
Sub Main
Dim d As Topic
Dim c As Topic
Dim t As Topic
Dim a As Topic
Set c=ActiveDocument.CentralTopic
Set d=c.AddSubTopic("Projects with In-tray Items")
For Each t In c.AllSubTopics
  If t.Text="My In-tray Activities for processing" Then
		For Each a In t.AllSubTopics
			createtopic(d, a.CalloutTopics(True).Item(1))
		Next
  End If
Next
End Sub
Function createtopic(parent As Topic,newtopic As Topic)
	Dim stopic As Topic
	Dim found As Boolean
	found=False
	For Each stopic In parent.AllSubTopics
		If stopic.Hyperlink.Address=newtopic.Hyperlink.Address Then
			found=True
			Set createtopic=stopic
		End If
	Next
	If Not found Then
		Set createtopic = parent.AddSubTopic("")
		createtopic.Xml = newtopic.Xml
	End If
End Function
</nowiki