<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Smart DXL</title>
	<atom:link href="http://www.smartdxl.com/content/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.smartdxl.com/content</link>
	<description>DOORS &#38; DXL Consultancy</description>
	<lastBuildDate>Tue, 21 Feb 2012 16:07:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Display Unique IDs</title>
		<link>http://www.smartdxl.com/content/?p=650</link>
		<comments>http://www.smartdxl.com/content/?p=650#comments</comments>
		<pubDate>Thu, 23 Jun 2011 14:53:53 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=650</guid>
		<description><![CDATA[This very simple script displays the Unique ID, type, full path and URL of the items currently selected in the database explorer. To see information for other items, select the item(s) in the database explorer and click on the refresh button.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/uniqueid.bmp"><img class="alignright size-full wp-image-651" title="uniqueid" src="http://www.smartdxl.com/content/wp-content/uploads/2011/06/uniqueid.bmp" alt="" /></a>This very simple script displays the Unique ID, type, full path and URL of the items currently selected in the database explorer. To see information for other items, select the item(s) in the database explorer and click on the refresh button.</p>
<pre class="brush: dxl; title: ; notranslate">
//	Show Unique IDs of selected items

/*

	Change History
	-----------------
	29-DEC-10	Tony Goodman	Initial Version

*/

pragma runLim,0

DB   dbMain        = null
DBE infoTextDBE = null

/******************************
	getInfo
******************************/
void getInfo()
{
	Buffer outputBuf = create
	Skip selectedItems = getSelectedItems() // sneaky undocumented function...
	Item selectedItem
	string uid = &quot;&quot;
	string quid = &quot;&quot;
	string itemType = &quot;&quot;
	string rootOfItem = &quot;&quot;
	string urlOfItem = &quot;&quot;
	string nameOfItem =&quot;&quot;
	bool noItemsSelected = true

	for selectedItem in selectedItems do
	{
		// loop through the list of selected Items via the Skip

		noItemsSelected = false // got at least one Item

		// get required data...
		uid = uniqueID selectedItem
		quid = qualifiedUniqueID selectedItem
		nameOfItem = name(selectedItem)
		itemType = type(selectedItem)
		rootOfItem = rootName_(selectedItem)
		urlOfItem = getURL(selectedItem)

		if( itemType == &quot;Formal&quot; || itemType == &quot;Descriptive&quot; || itemType == &quot;Link&quot; )
		{
			itemType = itemType &quot; Module&quot;
		}

		// Build output buffer...
		outputBuf += &quot;Name: {\\b &quot; nameOfItem &quot;}\n&quot;
		outputBuf += &quot;Unique ID: &quot; uid &quot;\n&quot;
		outputBuf += &quot;Qualified Unique ID: &quot; quid &quot;\n&quot;
		outputBuf += &quot;Type: &quot; itemType &quot;\n&quot;
		outputBuf += &quot;Path: &quot; rootOfItem &quot;\n&quot;
		outputBuf += &quot;URL: &quot; urlOfItem &quot;\n&quot;
		outputBuf += &quot;\n&quot;

	}

	// write out info gathered
	if( noItemsSelected )
	{
		set (infoTextDBE, &quot;No items selected&quot;)
	}
	else
	{
		set (infoTextDBE, stringOf( outputBuf ))
	}

	delete outputBuf
	delete selectedItems
}

/******************************
	getInfo
******************************/
void getInfo(DB db)
{
	getInfo()
} 

/******************************
	showUniqueIDs
******************************/
void showUniqueIDs()
{
	dbMain = create(dbExplorer, &quot;Unique ID of Selected Items&quot;, styleCentered|styleFloating)
	infoTextDBE = richText(dbMain, &quot;&quot;, &quot;&quot;, 500, 150, true)
	apply(dbMain, &quot;Refresh&quot;, getInfo)
	realize(dbMain)
	getInfo()
	show(dbMain)
}

showUniqueIDs()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=650</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export Changes</title>
		<link>http://www.smartdxl.com/content/?p=638</link>
		<comments>http://www.smartdxl.com/content/?p=638#comments</comments>
		<pubDate>Thu, 23 Jun 2011 13:45:57 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Baselines]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Metrics and Reports]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=638</guid>
		<description><![CDATA[This script exports changes between two baselines as red-lined markup in an HTML table. Object Heading and Text are included in the output, with changes highlighted in the newer baseline. You can select the attribute used to identify the objects and an additional attribute can be included in the output.  ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/changesreport2.bmp"><img class="alignright size-full wp-image-646" title="changesreport" src="http://www.smartdxl.com/content/wp-content/uploads/2011/06/changesreport2.bmp" alt="" /></a>This script exports changes between two baselines as red-lined markup in an HTML table. Object Heading and Text are included in the output, with changes highlighted in the newer baseline. You can select the attribute used to identify the objects and an additional attribute can be included in the output.</p>
<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/changesreport1.bmp"></a> </p>
<pre class="brush: dxl; collapse: true; light: false; title: ; toolbar: true; notranslate">
//

/*

*/

pragma runLim, 0

//&lt;  Export Change Report to HTML

/*
	18-MAR-2011		Tony Goodman
*/

Buffer textBuf2 = create
Buffer tempBuf = create

/***********************************
	getAttr
***********************************/
string getAttr(Object o, string attr)
{
	string s = &quot;&quot;

	if (attr == &quot;Identifier&quot;)
	{
		return(identifier(o))
	}

	if (attr == &quot;Level&quot;)
	{
		return(level(o) &quot;&quot;)
	}

	if (attr == &quot;Number&quot;)
	{
		return(number(o) &quot;&quot;)
	}

	s = probeAttr_(o, attr)

	if (s &quot;&quot; == &quot;&quot;)
	{
		return(&quot;&lt;br&gt;&quot;)
	}
	else
	{
		return(s)
	}
}

/***********************************
	emitHeader
***********************************/
void emitHeader(Stream out)
{
	out &lt;&lt; &quot;&lt;!DOCTYPE html PUBLIC \&quot;-//W3C//DTD XHTML 1.0 Transitional//EN\&quot;\n&quot;
	out &lt;&lt; &quot;\&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\&quot;&gt;\n&quot;
	out &lt;&lt; &quot;&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;\n&quot;
	out &lt;&lt; &quot;&lt;head&gt;\n&quot;

	out &lt;&lt; &quot;&lt;style&gt;\n&quot;

	out &lt;&lt; &quot;.myCell {\n&quot;
	out &lt;&lt; &quot;margin: 0px;\n&quot;
	out &lt;&lt; &quot;padding: 5px;\n&quot;
	out &lt;&lt; &quot;vertical-align: top;\n&quot;
	out &lt;&lt; &quot;font: 11px Arial, sans-serif;\n&quot;
	out &lt;&lt; &quot;border: 1px solid #CCCCCC;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myTable {\n&quot;
	out &lt;&lt; &quot;margin: 0px;\n&quot;
	out &lt;&lt; &quot;padding: 0px;\n&quot;
	out &lt;&lt; &quot;vertical-align: top;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myAnchor {\n&quot;
	out &lt;&lt; &quot;text-decoration: none;\n&quot;
	out &lt;&lt; &quot;font: 11px Arial, sans-serif;\n&quot;
	out &lt;&lt; &quot;color: #000000;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myAnchorBold {\n&quot;
	out &lt;&lt; &quot;text-decoration: none;\n&quot;
	out &lt;&lt; &quot;font: bold 11px Arial, sans-serif, bold;\n&quot;
	out &lt;&lt; &quot;color: #000000;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;&lt;/style&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/head&gt;\n&quot;
	out &lt;&lt; &quot;&lt;body&gt;\n&quot;
}

/***********************************
	emitFooter
***********************************/
void emitFooter(Stream out)
{
	out &lt;&lt; &quot;&lt;/body&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/html&gt;\n&quot;
	out &lt;&lt; &quot;\n&quot;
}

/***********************************
	convertRichText
***********************************/
void convertRichText(Buffer&amp; b, string s)
{
	RichTextParagraph rp = null
    RichText rt = null
    bool limitText = false
	int ind = 0
	int i = 0

    setempty(b)

	for rp in s do
	{
		ind = rp.indentLevel

		for (i = 0; i &lt; ind; i += 360) b += &quot;&lt;ul&gt;&quot;

		if (rp.isBullet) b += &quot;&lt;li&gt;&quot;

		for rt in rp do
		{
			setempty(textBuf2)
			textBuf2 += rt.text

			safeHTMLBuffer(textBuf2, true, true)

			if (rt.bold) b += &quot;&lt;b&gt;&quot;

			if (rt.underline)
			{
				b += &quot;&lt;span style='color:blue'&gt;&quot;
				b += &quot;&lt;u&gt;&quot;
			}

			if (rt.italic) b += &quot;&lt;i&gt;&quot;

			if (rt.strikethru)
			{
				b += &quot;&lt;span style='color:red'&gt;&quot;
				b += &quot;&lt;s&gt;&quot;
			}

			if (rt.superscript) b += &quot;&lt;sup&gt;&quot;
			if (rt.subscript) b += &quot;&lt;sub&gt;&quot;
			if (rt.charset == charsetSymbol) b += &quot;&lt;font face=\&quot;Symbol\&quot;&gt;&quot;

			b += textBuf2

			if (rt.charset == charsetSymbol) b += &quot;&lt;/font&gt;&quot;
			if (rt.subscript) b += &quot;&lt;/sub&gt;&quot;
			if (rt.superscript) b += &quot;&lt;/sup&gt;&quot;
			if (rt.strikethru)
			{
				b += &quot;&lt;/s&gt;&quot;
				b += &quot;&lt;/span&gt;&quot;
			}

			if (rt.italic) b += &quot;&lt;/i&gt;&quot;
			if (rt.underline)
			{
				b += &quot;&lt;/u&gt;&quot;
				b += &quot;&lt;/span&gt;&quot;
			}

			if (rt.bold) b += &quot;&lt;/b&gt;&quot;

			if (rt.newline) b += &quot;&lt;br&gt;&quot;
		}

		if (rp.isBullet) b += &quot;&lt;/li&gt;&quot;

		for (i = 0; i &lt; ind; i += 360) b += &quot;&lt;/ul&gt;&quot;
	}
}

/***********************************
	emitFileHeader
***********************************/
void emitFileHeader(Stream out, string moduleName, Skip selectedAttributes)
{
	string attr = &quot;&quot;
	bool doneOne = false

	out &lt;&lt; &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	// header row
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;
	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;

	out &lt;&lt; &quot;&lt;b&gt;Module:&lt;/b&gt; &quot; moduleName &quot;&lt;br&gt;&quot;
	out &lt;&lt; &quot;&lt;b&gt;Exported from DOORS on:&lt;/b&gt; &quot; stringOf(today) &quot;&lt;br&gt;&quot;

	out &lt;&lt; &quot;&lt;b&gt;Showing history of values for attributes:&lt;/b&gt; &quot; 

	for attr in selectedAttributes do
	{
		if (doneOne)
		{
			out &lt;&lt; &quot;, &quot;
		}

		out &lt;&lt; attr &quot;&quot;

		doneOne = true
	}

	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;/table&gt;\n&quot;
}

/***********************************
	emitTableHeader
***********************************/
void emitTableHeader(Stream out, Skip selectedBaselines, string selectedIdentifier, Skip selectedAttributes)
{
	Baseline b = null
	string attr = &quot;&quot;

	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/th&gt;\n&quot;

	for b in selectedBaselines do
	{
		out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot; colspan=\&quot;2\&quot;&gt;&lt;b&gt;&quot; &quot;Baseline &quot; (major b) &quot;.&quot; (minor b) (suffix b &quot;&quot; != &quot;&quot; ? &quot; (&quot; (suffix b) &quot;)&quot; : &quot;&quot;) &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
	}

	out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot; colspan=\&quot;2\&quot;&gt;&lt;b&gt;&quot; &quot;Current version&quot;  &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;

	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; selectedIdentifier &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;

	for b in selectedBaselines do
	{
		for attr in selectedAttributes do
		{
			if (length(attr) &gt; 8 &amp;&amp; attr[0:7] == &quot;DXL for &quot;)
			{
				out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; attr[8:] &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
			}
			else
			{
				out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; attr &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
			}
		}
	}

	for attr in selectedAttributes do
	{
		if (length(attr) &gt; 8 &amp;&amp; attr[0:7] == &quot;DXL for &quot;)
		{
			out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; attr[8:] &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
		}
		else
		{
			out &lt;&lt; &quot;&lt;th class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; attr &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
		}
	}

	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
}

/***********************************
	exportChangeHistory
***********************************/
string exportChangeHistory(Module m, Skip selectedBaselines, string selectedIdentifier, Skip selectedAttributes, string outputFile)
{
	string res = &quot;&quot;
	Module bm = null
	Baseline b = null
	Object o = null
	Object bo = null
	int absno = 0
	string s = &quot;&quot;
	string attr = &quot;&quot;
	AttrDef ad = null
	Skip baselineModules = create

	out = write(outputFile)

	if (null out)
	{
		return(&quot;failed to open file for writing: &quot; outputFile &quot;&quot;)
	}

	for b in selectedBaselines do
	{
		bm = load(m, b, false)

		put(baselineModules, (int key selectedBaselines), bm)
	}

	emitHeader(out)

	emitFileHeader(out, fullName(m), selectedAttributes)

	out &lt;&lt; &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	emitTableHeader(out, selectedBaselines, selectedIdentifier, selectedAttributes)

	for o in document m do
	{
		//if (isDeleted(o2)) continue
		if (table(o)) continue

			out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

			out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot; getAttr(o, selectedIdentifier) &quot;&lt;/td&gt;\n&quot;

			absno = o.&quot;Absolute Number&quot;

			for bm in baselineModules do
			{
				for attr in selectedAttributes do
				{
					out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

					bo = object(absno, bm)

					if (null bo)
					{
						out &lt;&lt; &quot;&lt;br&gt;&quot;
					}
					else
					{
						out &lt;&lt;&quot;&lt;a class=\&quot;myText\&quot;&gt; &quot; 

						if (probeAttr_(bo, attr) == &quot;&quot;)
						{
							out &lt;&lt; &quot;&lt;br&gt;&quot;
						}
						else
						{
							convertRichText(tempBuf, probeRichAttr_(bo, attr))
							out &lt;&lt; tempBuf
						}

						out &lt;&lt; &quot;&lt;/a&gt;\n&quot;
					}

					out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
				}
			}

			for attr in selectedAttributes do
			{
				out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

				out &lt;&lt;&quot;&lt;a class=\&quot;myText\&quot;&gt; &quot; 

				if (probeAttr_(o, attr) == &quot;&quot;)
				{
					out &lt;&lt; &quot;&lt;br&gt;&quot;
				}
				else
				{
					convertRichText(tempBuf, probeRichAttr_(o, attr))
					out &lt;&lt; tempBuf
				}

				out &lt;&lt; &quot;&lt;/a&gt;\n&quot;

				out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
			}

			out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
	}

	out &lt;&lt; &quot;&lt;/table&gt;\n&quot;

	emitFooter(out)

	close(out)

	noError
	for bm in baselineModules do
	{
		close(bm)
	}
	lastError

	return(&quot;&quot;)
}

//&lt;  Export Change History Dialog 

/*

	18-MAR-2011		Tony Goodman
*/

DB   dbMain   = null
DBE dbeLabel = null

DBE dbeFrame = null
DBE dbebaselinesFrame = null
DBE dbeBaselines = null

DBE dbeIdentifierFrame = null
DBE dbeAttributeFrame = null
DBE dbeIdentifier = null
DBE dbeAttributes = null

DBE dbeExportFrame = null
DBE dbeFileName  = null
DBE exportBtn    = null

string dummy[] = { }

Skip skipBaselines = create
Skip skipAttributes = createString

/***********************************
	getBaselines
***********************************/
void getBaselines(Module currMod)
{
	Baseline b = null
	int index = 0

	for b in currMod do
	{
		put(skipBaselines, index, b)

		insert(dbeBaselines, index, major(b) &quot;.&quot; minor(b) &quot; &quot; suffix(b) &quot; &quot; annotation(b), iconNone)

		index++
	}

	put(skipBaselines, index, null)
	//insert(dbeBaselines, index, &quot;Current&quot;, iconNone)

	if (index &gt; 0)
	{
		set(dbeBaselines, index-1, true)
	}
	else
	{
		set(dbeBaselines, index, true)
	}
}

/***********************************
	getAttributes
***********************************/
void getAttributes(Module currMod)
{
	AttrDef ad = null
	string attr = &quot;&quot;
	int index = 0

	for ad in currMod do
	{
		if (!ad.object) continue

		put(skipAttributes, ad.name, ad.name)
	}

	insert(dbeIdentifier, 0, &quot;Identifier&quot;, iconNone)

	index = 1

	for attr in skipAttributes do
	{
		insert(dbeIdentifier, index, attr, iconNone)
		insert(dbeAttributes, index, attr, iconNone)
		index++
	}

	set(dbeIdentifier, 0, true)
	set(dbeAttributes, 0, true)
}

/***********************************
	doExport
***********************************/
void doExport(DB db)
{
	Baseline b = null
	string selectedIdentifier = &quot;&quot;
	string selectedAttribute = null
	string outputFile = &quot;&quot;
	string res = &quot;&quot;
	string attr = &quot;&quot;
	int i = 0
	int j = 0
	Skip selectedBaselines = create
	Skip selectedAttributes = createString

	for (i = 0; i &lt; noElems(dbeBaselines); i++)
	{
		if (getCheck(dbeBaselines, i))
		{
			find(skipBaselines, i, b)
			put(selectedBaselines, j++, b)
		}
	}

	selectedIdentifier = get(dbeIdentifier)

	for (i = 0; i &lt; noElems(dbeAttributes); i++)
	{
		if (getCheck(dbeAttributes, i))
		{
			attr = getColumnValue(dbeAttributes, i, 0)
			put(selectedAttributes, attr, attr)
		}
	}
	//selectedAttribute = get(dbeAttributes)

	outputFile = get(dbeFileName)

	res = exportChangeHistory(current Module, selectedBaselines, selectedIdentifier, selectedAttributes, outputFile)

	if (res &quot;&quot; != &quot;&quot;)
	{
		infoBox(res)
		return
	}
	else
	{
		infoBox(&quot;Export complete\nSee &quot; outputFile)
	}

	release(dbMain)
}

/***********************************
	doClose
***********************************/
void doClose(DB db)
{
	release(dbMain)
}

/***********************************
	buildDialog
***********************************/
void buildDialog(Module currMod)
{
	dbMain = create(currMod, &quot;Export Change History&quot;, styleCentered|styleFixed)

	dbeLabel = label(dbMain, &quot;This utility exports change history for selected attributes to an HTML file.\n&quot; //-
	                                   &quot;The values of the selected attributes are shown in a separate columns for each baseline.&quot;)

	dbeFrame = frame(dbMain, &quot;&quot;, 400, 450)
	dbeFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeLabel
	dbeFrame-&gt;&quot;left&quot;-&gt;&quot;form&quot;
	dbeFrame-&gt;&quot;right&quot;-&gt;&quot;form&quot;
	dbeFrame-&gt;&quot;bottom&quot;-&gt;&quot;form&quot;

	dbeBaselinesFrame = frame(dbMain, &quot;Baselines to include&quot;, 400, 100)
	dbeBaselinesFrame-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;

	dbeBaselines = listView(dbMain, listViewOptionCheckboxes | listViewOptionMultiselect, 390, 5, dummy)
	dbeBaselines-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaselines-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaselines-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaselines-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame

	dbeIdentifierFrame = frame(dbMain, &quot;Identifier for each object&quot;, 400, 100)
	dbeIdentifierFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeBaselinesFrame
	dbeIdentifierFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeIdentifierFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeIdentifierFrame-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;	

	dbeIdentifier = listView(dbMain, 0, 390, 5, dummy)
	dbeIdentifier-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeIdentifierFrame
	dbeIdentifier-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeIdentifierFrame
	dbeIdentifier-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeIdentifierFrame
	dbeIdentifier-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeIdentifierFrame

	dbeAttributeFrame = frame(dbMain, &quot;Attributes to display&quot;, 400, 100)
	dbeAttributeFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeIdentifierFrame
	dbeAttributeFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeAttributeFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeAttributeFrame-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;

	dbeAttributes = listView(dbMain, listViewOptionCheckboxes | listViewOptionMultiselect, 390, 5, dummy)
	dbeAttributes-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributeFrame
	dbeAttributes-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributeFrame
	dbeAttributes-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributeFrame
	dbeAttributes-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributeFrame

	dbeFileName = fileName(dbMain, &quot;Export to:&quot;, &quot;U:\\&quot; name(currMod) &quot;_history.html&quot;, &quot;*.html&quot;, &quot;HTML Files&quot;, false)
	dbeFileName-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeAttributeFrame
	dbeFileName-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeFileName-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeFileName-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame

	exportBtn = apply(dbMain, &quot;Export&quot;, doExport)

	realize(dbMain)

	insertColumn(dbeBaselines, 0, &quot;Baselines&quot;, 350, iconNone)

	insertColumn(dbeIdentifier, 0, &quot;Identifier&quot;, 350, iconNone)
	insertColumn(dbeAttributes, 0, &quot;Attributes&quot;, 350, iconNone)

	getBaselines(currMod)

	getAttributes(currMod)

	block(dbMain)
	destroy(dbMain)
	dbMain = null
}

/***********************************
	exportChangeHistory
***********************************/
void exportChangeHistory()
{
	Module currMod = null

	currMod = current Module

	if (null currMod)
	{
		infoBox(&quot;This utility can only be run from a formal module.&quot;)
		return
	}

	buildDialog(currMod)
}

exportChangeHistory()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=638</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export Baseline Comparison Report</title>
		<link>http://www.smartdxl.com/content/?p=633</link>
		<comments>http://www.smartdxl.com/content/?p=633#comments</comments>
		<pubDate>Thu, 23 Jun 2011 13:29:59 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Baselines]]></category>
		<category><![CDATA[Dialogs]]></category>
		<category><![CDATA[Metrics and Reports]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=633</guid>
		<description><![CDATA[This script allows you to export a baseline comparison report to an HTML file. The dialog allows you to select the baselines to compare, and which attributes to include in the comparison.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/baselinecompare.bmp"><img class="alignright size-full wp-image-634" title="baselinecompare" src="http://www.smartdxl.com/content/wp-content/uploads/2011/06/baselinecompare.bmp" alt="" /></a></p>
<p>This script allows you to export a baseline comparison report to an HTML file.</p>
<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/baselinecompare.bmp"></a></p>
<p>The dialog allows you to select the baselines to compare, and which attributes to include in the comparison.</p>
<pre class="brush: dxl; collapse: true; light: false; title: ; toolbar: true; notranslate">
//

/*

*/

//  Export Baseline Comparison Report

/*

	The values for each selected attribute are compared and included in the report if they
	differ. The export contains a row for each attribute change made between the selected
	baselines. Attributes that do not exist in the older baseline are identified at the top of
	the report. New and deleted objects are identified in the right-hand column.

	Inclusion of tables cells is optional.
	New and deleted cells objcts are identified, but deleted rows are not.

	Change History
	-----------------

	24-MAY-2011		Tony Goodman	Standalone version.

*/

pragma runLim, 0

string OUTPUT_FOLDER = &quot;U:\\&quot;

/**********************************
	Smart DXL logo bitmap file - this is loaded once when first dialog is displayed.
**********************************/
Bitmap smartDxlLogo = null

string SMART_DXL_DB_TITLE      = &quot;Smart DXL&quot;
string SMART_DXL_BANNER_WEBSITE  = &quot;www.smartdxl.com&quot;
string SMART_DXL_BANNER_BITMAP    = &quot;lac\\inc\\tophat.bmp&quot;

DBE smartDxlBanner = null

bool smartDxlLogoFound = false

string smartDxlBannerText = &quot;&quot;

int   smartDxlLogoWidth   = 0
int   smartDxlLogoHeight  = 0

/**********************************
	getAbsolutePath
**********************************/
string getAbsolutePath(string sFileName)
{
	string sResult  = &quot;&quot;

	string sAddinsPathList      = (getenv &quot;ADDINS&quot;) &quot;;&quot;
	string sDoorsAddinsPathList = (getenv &quot;DOORSADDINS&quot;) &quot;;&quot;

	if (sAddinsPathList != sDoorsAddinsPathList)
	{
		sAddinsPathList = sDoorsAddinsPathList &quot;;&quot; sAddinsPathList
	}

	Regexp rPath = regexp &quot;([^;]*);(.*)&quot;

	string sLeft    = &quot;&quot;
	string sRight   = &quot;&quot;

	if (rPath sAddinsPathList)
	{
		// test each path in the semicolon separated list
		while (rPath sAddinsPathList)
		{
			  sLeft  = sAddinsPathList[match 1]
			  sRight = sAddinsPathList[match 2]

			  if (fileExists_ (sLeft &quot;\\&quot; sFileName))
			  {
					sResult  = sLeft &quot;\\&quot; sFileName
					break;
			  }
			  else
			  {
					sAddinsPathList = sRight
			  }
		}
	}
	return(sResult)
}

/***********************************
  smartDrawLogo
***********************************/
void smartDrawLogo(DBE cnvs)
{
	string smartDxlBitmapFile = &quot;&quot;
	Stat   st = null

	if (null smartDxlLogo)
	{
		// bitmap has not been loaded yet, so load it
		smartDxlBitmapFile = getAbsolutePath(SMART_DXL_BANNER_BITMAP)

		// check that the file exists
		st = create(smartDxlBitmapFile)

		if (!null st)
		{
			// file does exist so we can load the bitmap
			delete(st)

			smartDxlLogo = loadBitmap(cnvs, smartDxlBitmapFile, false, smartDxlLogoWidth, smartDxlLogoHeight)
		}
    }

    // draw the bitmap if it was successfully loaded
    if (!null smartDxlLogo)
    {
    	drawBitmap(cnvs, smartDxlLogo, 0, 0)
		smartDxlLogoFound = true
	}
}

/**********************************
	doLogoMouse
**********************************/
void doLogoMouse(DBE cnv, int but, bool ctrl, int x, int y)
{
	if (x &gt; width(cnv) - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5)
	{
		activateURL(SMART_DXL_BANNER_WEBSITE)
	}
}

/**********************************
	doRepaintSmartDxlBanner
**********************************/
void doRepaintSmartDxlBanner(DBE cnv)
{
	int canvasWidth  = width(cnv)
	int titleHeight  = 0
	int y = 0

	realBackground(cnv, realColor_White)

	smartDrawLogo(cnv)

	realColor(cnv, realColor_Black)
	font(cnv, 4, HeadingsFont)

	y = (height(cnv) / 2) + (height(cnv, smartDxlBannerText) / 2) - 3

	draw(cnv, smartDxlLogoWidth + 3, y, smartDxlBannerText)

	realColor(cnv, realColor_Blue)
	font(cnv, 9, HeadingsFont)
	draw(cnv, canvasWidth - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5, y - 1, SMART_DXL_BANNER_WEBSITE)
	line(cnv, canvasWidth - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5, y, canvasWidth - 5, y)
}

/**********************************
	addSmartDxlBanner
**********************************/
void addSmartDxlBanner(DB db)
{
	smartDxlBanner = canvas(db, 0, 32, doRepaintSmartDxlBanner)

	set(smartDxlBanner, doLogoMouse)
}

/**********************************
	showHelp
**********************************/
void showHelp(string helpFile)
{
	system(&quot;\&quot;C:\\Program Files\\Internet Explorer\\iexplore.exe\&quot; -nohome \&quot;&quot; (getAbsolutePath(helpFile)) &quot;\&quot;&quot;)
}

/**********************************
	smartDialog
**********************************/
DB smartDialog(Module mParent, string banner, int options)
{
	DB smartDb = null

	smartDb = create(mParent, SMART_DXL_DB_TITLE, options)

	smartDxlBannerText = banner

	addSmartDxlBanner(smartDb)

    return(smartDb)
}

//&lt;  Export Change Report to HTML

/*
	18-MAR-2011		Tony Goodman
*/

Buffer textBuf2 = create
Buffer tempBuf = create

Buffer bSource = create
Buffer bTarget = create
Buffer bResult = create

/**********************************
	getRedLineMarkup
**********************************/
void getRedLineMarkup()
{
	setempty(bResult)

	diff(bResult, bSource, bTarget)
}

/**********************************
	emitHeader
**********************************/
void emitHeader(Stream out)
{
	out &lt;&lt; &quot;&lt;!DOCTYPE html PUBLIC \&quot;-//W3C//DTD XHTML 1.0 Transitional//EN\&quot;\n&quot;
	out &lt;&lt; &quot;\&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\&quot;&gt;\n&quot;
	out &lt;&lt; &quot;&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;\n&quot;
	out &lt;&lt; &quot;&lt;head&gt;\n&quot;

	out &lt;&lt; &quot;&lt;style&gt;\n&quot;

	out &lt;&lt; &quot;.myCell {\n&quot;
	out &lt;&lt; &quot;margin: 0px;\n&quot;
	out &lt;&lt; &quot;padding: 5px;\n&quot;
	out &lt;&lt; &quot;vertical-align: top;\n&quot;
	out &lt;&lt; &quot;font: 11px Arial, sans-serif;\n&quot;
	out &lt;&lt; &quot;border: 1px solid #CCCCCC;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myTable {\n&quot;
	out &lt;&lt; &quot;margin: 0px;\n&quot;
	out &lt;&lt; &quot;padding: 0px;\n&quot;
	out &lt;&lt; &quot;vertical-align: top;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myAnchor {\n&quot;
	out &lt;&lt; &quot;text-decoration: none;\n&quot;
	out &lt;&lt; &quot;font: 11px Arial, sans-serif;\n&quot;
	out &lt;&lt; &quot;color: #000000;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;.myAnchorBold {\n&quot;
	out &lt;&lt; &quot;text-decoration: none;\n&quot;
	out &lt;&lt; &quot;font: bold 11px Arial, sans-serif, bold;\n&quot;
	out &lt;&lt; &quot;color: #000000;\n&quot;
	out &lt;&lt; &quot;}\n&quot;

	out &lt;&lt; &quot;&lt;/style&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/head&gt;\n&quot;
	out &lt;&lt; &quot;&lt;body&gt;\n&quot;
}

/**********************************
	emitFooter
**********************************/
void emitFooter(Stream out)
{
	out &lt;&lt; &quot;&lt;/body&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/html&gt;\n&quot;
	out &lt;&lt; &quot;\n&quot;
}

/**********************************
	convertRichText
**********************************/
void convertRichText(Buffer&amp; b, string s)
{
	RichTextParagraph rp = null
    RichText rt = null
    bool limitText = false
	int ind = 0
	int i = 0

    setempty(b)

	for rp in s do
	{
		ind = rp.indentLevel

		for (i = 0; i &lt; ind; i += 360) b += &quot;&lt;ul&gt;&quot;

		if (rp.isBullet) b += &quot;&lt;li&gt;&quot;

		for rt in rp do
		{
			setempty(textBuf2)
			textBuf2 += rt.text

			safeHTMLBuffer(textBuf2, true, true)

			if (rt.bold) b += &quot;&lt;b&gt;&quot;

			if (rt.underline)
			{
				b += &quot;&lt;span style='color:blue'&gt;&quot;
				b += &quot;&lt;u&gt;&quot;
			}

			if (rt.italic) b += &quot;&lt;i&gt;&quot;

			if (rt.strikethru)
			{
				b += &quot;&lt;span style='color:red'&gt;&quot;
				b += &quot;&lt;s&gt;&quot;
			}

			if (rt.superscript) b += &quot;&lt;sup&gt;&quot;
			if (rt.subscript) b += &quot;&lt;sub&gt;&quot;
			if (rt.charset == charsetSymbol) b += &quot;&lt;font face=\&quot;Symbol\&quot;&gt;&quot;

			b += textBuf2

			if (rt.charset == charsetSymbol) b += &quot;&lt;/font&gt;&quot;
			if (rt.subscript) b += &quot;&lt;/sub&gt;&quot;
			if (rt.superscript) b += &quot;&lt;/sup&gt;&quot;
			if (rt.strikethru)
			{
				b += &quot;&lt;/s&gt;&quot;
				b += &quot;&lt;/span&gt;&quot;
			}

			if (rt.italic) b += &quot;&lt;/i&gt;&quot;
			if (rt.underline)
			{
				b += &quot;&lt;/u&gt;&quot;
				b += &quot;&lt;/span&gt;&quot;
			}

			if (rt.bold) b += &quot;&lt;/b&gt;&quot;

			if (rt.newline) b += &quot;&lt;br&gt;&quot;
		}

		if (rp.isBullet) b += &quot;&lt;/li&gt;&quot;

		for (i = 0; i &lt; ind; i += 360) b += &quot;&lt;/ul&gt;&quot;
	}
}

/**********************************
	emitFileHeader
**********************************/
void emitFileHeader(Stream out, string moduleName, Skip newAttributes, bool newAttrs)
{
	string attr = &quot;&quot;

	out &lt;&lt; &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	// header row
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;
	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;

	out &lt;&lt; &quot;&lt;h4&gt;Baseline Comparison Report&lt;/h4&gt;&quot;
	out &lt;&lt; &quot;&lt;b&gt;Module:&lt;/b&gt; &quot; moduleName &quot;&lt;br&gt;&quot;
	out &lt;&lt; &quot;&lt;b&gt;Exported from DOORS on:&lt;/b&gt; &quot; stringOf(today) &quot;&lt;br&gt;&quot;

	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;

	if (newAttrs)
	{
		out &lt;&lt; &quot;&lt;tr&gt;\n&quot;
		out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;
		out &lt;&lt; &quot;The following attributes are new since the older baseline, so have not been compared:&lt;br&gt;&quot;

		for attr in newAttributes do
		{
			out &lt;&lt; attr &quot;&lt;br&gt;&quot;
		}

		out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
		out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
	}

	out &lt;&lt; &quot;&lt;/table&gt;\n&quot;
}

/**********************************
	emitTableHeader
**********************************/
void emitTableHeader(Stream out, string ver1, string ver2)
{
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;th width=\&quot;&quot; 10 &quot;%\&quot; class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; &quot;Object ID&quot; &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
	out &lt;&lt; &quot;&lt;th width=\&quot;&quot; 20 &quot;%\&quot; class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; &quot;Change&quot; &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
	out &lt;&lt; &quot;&lt;th width=\&quot;&quot; 35 &quot;%\&quot; class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; ver1 &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
	out &lt;&lt; &quot;&lt;th width=\&quot;&quot; 35 &quot;%\&quot; class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; ver2 &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;

	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
}

/**********************************
	emitNewObject
**********************************/
void emitNewObject(Stream out, Object o)
{
	// new object
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot; identifier(o) &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;span style='color:blue'&gt;NEW OBJECT&lt;/span&gt;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;br&gt;&lt;/td&gt;&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

	if (o.&quot;Object Heading&quot; &quot;&quot; != &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;span style='color:blue'&gt;&quot;
		out &lt;&lt; &quot;&lt;u&gt;&quot;
		out &lt;&lt; &quot;&lt;b&gt;&quot; number(o) &quot; &quot; o.&quot;Object Heading&quot; &quot;&lt;/b&gt;&lt;br&gt;&quot;
		out &lt;&lt; &quot;&lt;/u&gt;&quot;
		out &lt;&lt; &quot;&lt;/span&gt;&quot;
	}

	convertRichText(tempBuf, probeRichAttr_(o, &quot;Object Text&quot;))
	out &lt;&lt; &quot;&lt;span style='color:blue'&gt;&quot;
	out &lt;&lt; &quot;&lt;u&gt;&quot;
	out &lt;&lt;  tempBuf

	if (o.&quot;Object Heading&quot; &quot;&quot; == &quot;&quot; &amp;&amp; o.&quot;Object Text&quot; &quot;&quot; == &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;br&gt;&quot;
	}

	out &lt;&lt; &quot;&lt;/u&gt;&quot;
	out &lt;&lt; &quot;&lt;/span&gt;&quot;

	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;
	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
}

/**********************************
	emitDeletedObject
**********************************/
void emitDeletedObject(Stream out, Object o)
{
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot; identifier(o) &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;span style='color:red'&gt;OBJECT DELETED&lt;/span&gt;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

	if (o.&quot;Object Heading&quot; &quot;&quot; != &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;b&gt;&quot; number(o) &quot; &quot; o.&quot;Object Heading&quot; &quot;&lt;/b&gt;&lt;br&gt;&quot;
	}

	convertRichText(tempBuf, probeRichAttr_(o, &quot;Object Text&quot;))
	out &lt;&lt;  tempBuf

	if (o.&quot;Object Heading&quot; &quot;&quot; == &quot;&quot; &amp;&amp; o.&quot;Object Text&quot; &quot;&quot; == &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;br&gt;&quot;
	}

	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;br&gt;&lt;/td&gt;&quot;

	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
}

/**********************************
	emitChangedObject
**********************************/
void emitChangedObject(Stream out, Object o1, Object o2, string attr)
{
	out &lt;&lt; &quot;&lt;tr&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot; identifier(o2) &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;Attribute &amp;quot;&quot; attr &quot;&amp;quot; Changed&lt;/td&gt;&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

	if (o1.attr &quot;&quot; == &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;br&gt;&quot;
	}
	else
	{
		convertRichText(tempBuf, probeRichAttr_(o1, attr))
		out &lt;&lt;  tempBuf
	}
	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;

	if (o2.attr &quot;&quot; == &quot;&quot;)
	{
		out &lt;&lt; &quot;&lt;br&gt;&quot;
	}
	else
	{
		setempty(bSource)
		setempty(bTarget)

		bSource += o1.attr &quot;&quot;
		bTarget += o2.attr &quot;&quot;
		getRedLineMarkup()
		convertRichText(tempBuf, stringOf(bResult))
		//convertRichText(tempBuf, probeRichAttr_(o2, attr))
		out &lt;&lt;  tempBuf
	}

	out &lt;&lt; &quot;&lt;/td&gt;\n&quot;

	out &lt;&lt; &quot;&lt;/tr&gt;\n&quot;
}

/**********************************
	compareTableCells
**********************************/
void compareTableCells(Stream out, Module bm1, Skip selectedAttributes, Object oTable)
{
	int absno = 0
	Object oRow = null
	Object o2 = null
	Object o1 = null
	string attr = &quot;&quot;

	for oRow in table(oTable) do
	{
		if (isDeleted oRow) continue

		for o2 in row(oRow) do
		{
			if (isDeleted o2) continue

			absno = o2.&quot;Absolute Number&quot;

			o1 = object(absno, bm1)

			if (null o1)
			{
				emitNewObject(out, o2)
				continue
			}

			for attr in selectedAttributes do
			{
				if (o1.attr &quot;&quot; == o2.attr &quot;&quot;) continue

				emitChangedObject(out, o1, o2, attr)
			}
		}
	}
}

/**********************************
	checkDeletedCells
**********************************/
void checkDeletedCells(Stream out, Module bm2, Object oTable)
{
	int absno = 0
	Object oRow = null
	Object o2 = null
	Object o1 = null

	for oRow in table(oTable) do
	{
		if (isDeleted oRow) continue

		for o1 in row(oRow) do
		{
			if (isDeleted o1) continue

			absno = o1.&quot;Absolute Number&quot;

			o2 = object(absno, bm2)

			if (null o2)
			{
				emitDeletedObject(out, o1)
				continue
			}
		}
	}
}

/**********************************
	exportChangeReport
**********************************/
string exportChangeReport(Module m, Baseline b1, Baseline b2, Skip selectedAttributes, bool includeTableCells, string outputFile)
{
	string res = &quot;&quot;
	Module bm1 = null
	Module bm2 = null
	Object o1 = null
	Object o2 = null
	int absno = 0
	string s = &quot;&quot;
	AttrDef ad = null
	string ver1 = &quot;&quot;
	string ver2 = &quot;&quot;
	string attr = &quot;&quot;
	bool newAttrs = false

	Skip newAttributes = createString

	out = write(outputFile)

	if (null out)
	{
		return(&quot;failed to open file for writing: &quot; outputFile &quot;&quot;)
	}

	if (null b1)
	{
		bm1 = m
		ver1 = &quot;Current Version&quot;
	}
	else
	{
		bm1 = load(m, b1, true)
		ver1 = &quot;Baseline &quot; (major b1) &quot;.&quot; (minor b1) (suffix b1 &quot;&quot; != &quot;&quot; ? &quot; (&quot; (suffix b1) &quot;)&quot; : &quot;&quot;)
	}

	if (null bm1)
	{
		return(ver1 &quot; not found for module&quot;)
	}

	if (null b2)
	{
		bm2 = m
		ver2 = &quot;Current Version&quot;
	}
	else
	{
		bm2 = load(m, b2, true)
		ver2 = &quot;Baseline &quot; (major b2) &quot;.&quot; (minor b2) (suffix b2 &quot;&quot; != &quot;&quot; ? &quot; (&quot; (suffix b2) &quot;)&quot; : &quot;&quot;)
	}

	if (null bm2)
	{
		return(ver2 &quot; not found for module.&quot;)
	}

	// check for attributes that do not exist in the first baseline
	for attr in selectedAttributes do
	{
		ad = find(bm1, attr)

		if (null ad)
		{
			put(newAttributes, attr, attr)
			newAttrs = true
		}
	}

	for attr in newAttributes do
	{
		if (find(selectedAttributes, attr))
		{
			delete(selectedAttributes, attr)
		}
	}

	emitHeader(out)

	emitFileHeader(out, fullName(m), newAttributes, newAttrs)

	out &lt;&lt; &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	emitTableHeader(out, ver1, ver2)

	for o2 in document(bm2) do
	{
		if (isDeleted(o2))
		{
			continue
		}

		if (table(o2))
		{
			if (includeTableCells)
			{
				compareTableCells(out, bm1, selectedAttributes, o2)
			}
		}
		else
		{
			// find this object in the older baseline
			absno = o2.&quot;Absolute Number&quot;

			o1 = object(absno, bm1)

			if (null o1)
			{
				emitNewObject(out, o2)
				continue
			}

			for attr in selectedAttributes do
			{
				if (o1.attr &quot;&quot; == o2.attr &quot;&quot;) continue

				emitChangedObject(out, o1, o2, attr)
			}
		}
	}

	// Deleted Objects
	for o1 in document(bm1) do
	{
		if (isDeleted(o1)) continue

		if (table(o1))
		{
			if (includeTableCells)
			{
				checkDeletedCells(out, bm2, o1)
			}
		}
		else
		{
			// find this object in the older baseline
			absno = o1.&quot;Absolute Number&quot;

			o2 = object(absno, bm2)

			if (null o2)
			{
				emitDeletedObject(out, o1)
			}
		}
	}

	out &lt;&lt; &quot;&lt;/table&gt;\n&quot;

	emitFooter(out)

	close(out)

	noError
	close(bm1)

	if (bm2 != m)
	{
		close(bm2)
	}

	lastError

	return(&quot;&quot;)
}

//&lt;  Export Change Report Dialog 

/*

	18-MAR-2011		Tony Goodman
*/

DB   dbMain   = null
DBE dbeLabel = null

DBE dbeFrame = null
DBE dbebaselinesFrame = null
DBE dbeBaseline1 = null
DBE dbeBaseline2 = null

DBE dbeAttributesFrame = null
DBE dbeAttributes = null
DBE dbeSelectAll = null
DBE dbeClearAll = null

DBE dbeIncludeTableCells = null
DBE dbeExportFrame = null
DBE dbeFileName  = null
DBE exportBtn    = null

string dummy[] = { }

Skip skipBaselines = create
Skip skipAttributes = createString

/**********************************
	getBaselines
**********************************/
void getBaselines(Module currMod)
{
	Baseline b = null
	int index = 0

	for b in currMod do
	{
		put(skipBaselines, index, b)

		insert(dbeBaseline1, index, major(b) &quot;.&quot; minor(b) &quot; &quot; suffix(b), iconNone)

		insert(dbeBaseline2, index, major(b) &quot;.&quot; minor(b) &quot; &quot; suffix(b), iconNone)

		index++
	}

	put(skipBaselines, index, null)
	insert(dbeBaseline1, index, &quot;Current&quot;, iconNone)
	insert(dbeBaseline2, index, &quot;Current&quot;, iconNone)

	if (index &gt; 0)
	{
		set(dbeBaseline1, index-1, true)
	}
	else
	{
		set(dbeBaseline1, index, true)
	}

	set(dbeBaseline2, index, true)
}

/**********************************
	getAttributes
**********************************/
void getAttributes(Module currMod)
{
	AttrDef ad = null
	string attr = &quot;&quot;
	int index = 0

	for ad in currMod do
	{
		if (!ad.object) continue

		if (ad.system) continue

		put(skipAttributes, ad.name, ad.name)
	}

	put(skipAttributes, &quot;Object Text&quot;, &quot;Object Text&quot;)
	put(skipAttributes, &quot;Object Heading&quot;, &quot;Object Heading&quot;)

	for attr in skipAttributes do
	{
		insert(dbeAttributes, index, attr, iconNone)

		if (attr == &quot;Object Heading&quot; || attr == &quot;Object Text&quot;)
		{
			setCheck(dbeAttributes, index, true)
		}
		index++
	}
}

/**********************************
	doExport
**********************************/
void doExport(DB db)
{
	Baseline b1 = null
	Baseline b2 = null
	string attr = &quot;&quot;
	string outputFile = &quot;&quot;
	string res = &quot;&quot;
	int i = 0
	bool includeTableCells = false

	Skip selectedAttributes = createString

	includeTableCells = get(dbeIncludeTableCells)

	i = get(dbeBaseline1)
	find(skipBaselines, i, b1)

	i = get(dbeBaseline2)
	find(skipBaselines, i, b2)

	if (b1 == b2)
	{
		infoBox(&quot;Please select two different baselines&quot;)
		return
	}

	for (i = 0; i &lt; noElems(dbeAttributes); i++)
	{
		if (getCheck(dbeAttributes, i))
		{
			attr = getColumnValue(dbeAttributes, i, 0)
			put(selectedAttributes, attr, attr)
		}
	}

	outputFile = get(dbeFileName)

	res = exportChangeReport(current Module, b1, b2, selectedAttributes, includeTableCells, outputFile)

	if (res &quot;&quot; != &quot;&quot;)
	{
		infoBox(res)
		return
	}

	infoBox(&quot;Report complete. See &quot; outputFile)

	release(dbMain)
}

/**********************************
	doSelectAll
**********************************/
void doSelectAll(DBE dbe)
{
	int i = 0

	for (i = 0; i &lt; noElems(dbeAttributes); i++)
	{
		setCheck(dbeAttributes, i, true)
	}
}

/**********************************
	doClearAll
**********************************/
void doClearAll(DBE dbe)
{
	int i = 0

	for (i = 0; i &lt; noElems(dbeAttributes); i++)
	{
		setCheck(dbeAttributes, i, false)
	}
}

/**********************************
	doClose
**********************************/
void doClose(DB db)
{
	release(dbMain)
}

/**********************************
	doHelp
**********************************/
void doHelp(DB db)
{
	showHelp(&quot;SmartDXL/export/exportBaselineComparison.mht&quot;)
} 

/**********************************
	buildDialog
**********************************/
void buildDialog(Module currMod)
{
	dbMain = smartDialog(currMod, &quot;Export Baseline Comparison&quot;, styleCentered|styleFixed)

	dbeLabel = label(dbMain, &quot;This utility exports a baseline comparison report to an HTML file.&quot;)

	dbeFrame = frame(dbMain, &quot;&quot;, 400, 450)
	dbeFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeLabel
	dbeFrame-&gt;&quot;left&quot;-&gt;&quot;form&quot;
	dbeFrame-&gt;&quot;right&quot;-&gt;&quot;form&quot;
	dbeFrame-&gt;&quot;bottom&quot;-&gt;&quot;form&quot;

	dbeBaselinesFrame = frame(dbMain, &quot;Baselines to compare&quot;, 400, 100)
	dbeBaselinesFrame-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeBaselinesFrame-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;

	dbeBaseline1 = listView(dbMain, 0, 190, 5, dummy)
	dbeBaseline1-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaseline1-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaseline1-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeBaseline1-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame

	dbeBaseline2 = listView(dbMain, 0, 190, 5, dummy)
	dbeBaseline2-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaseline2-&gt;&quot;left&quot;-&gt;&quot;flush&quot;-&gt;dbeBaseline1
	dbeBaseline2-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame
	dbeBaseline2-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeBaselinesFrame

	dbeAttributesFrame = frame(dbMain, &quot;Attributes to compare&quot;, 400, 100)
	dbeAttributesFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeBaselinesFrame
	dbeAttributesFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeAttributesFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeAttributesFrame-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;	

	dbeAttributes = listView(dbMain, listViewOptionCheckboxes | listViewOptionMultiselect, 190, 5, dummy)
	dbeAttributes-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame
	dbeAttributes-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame
	dbeAttributes-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame
	dbeAttributes-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame

	dbeSelectAll = button(dbMain, &quot;Select All&quot;, doSelectAll)
	dbeSelectAll-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeAttributes
	dbeSelectAll-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame
	dbeSelectAll-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeSelectAll-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;

	dbeClearAll = button(dbMain, &quot;Clear All&quot;, doClearAll)
	dbeClearAll-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeAttributes
	dbeClearAll-&gt;&quot;left&quot;-&gt;&quot;flush&quot;-&gt;dbeSelectAll
	dbeClearAll-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeClearAll-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeAttributesFrame

	dbeExportFrame = frame(dbMain, &quot;Export options&quot;, 400, 50)
	dbeExportFrame-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeAttributesFrame
	dbeExportFrame-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeExportFrame-&gt;&quot;right&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame
	dbeExportFrame-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeFrame

	dbeIncludeTableCells = toggle(dbMain, &quot;Include Table Cells&quot;, false)
	dbeIncludeTableCells-&gt;&quot;top&quot;-&gt;&quot;inside&quot;-&gt;dbeExportFrame
	dbeIncludeTableCells-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeExportFrame
	dbeIncludeTableCells-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeIncludeTableCells-&gt;&quot;bottom&quot;-&gt;&quot;unattached&quot;

	dbeFileName = fileName(dbMain, &quot;Export to:&quot;, OUTPUT_FOLDER name(currMod) &quot;_baseline_comparison.html&quot;, &quot;*.html&quot;, &quot;HTML Files&quot;, false)
	dbeFileName-&gt;&quot;top&quot;-&gt;&quot;flush&quot;-&gt;dbeIncludeTableCells
	dbeFileName-&gt;&quot;left&quot;-&gt;&quot;inside&quot;-&gt;dbeExportFrame
	dbeFileName-&gt;&quot;right&quot;-&gt;&quot;unattached&quot;
	dbeFileName-&gt;&quot;bottom&quot;-&gt;&quot;inside&quot;-&gt;dbeExportFrame

	exportBtn = apply(dbMain, &quot;Export&quot;, doExport)
	apply(dbMain, &quot;Help&quot;, doHelp)

	realize(dbMain)

	insertColumn(dbeBaseline1, 0, &quot;Older Baseline&quot;, 160, iconNone)
	insertColumn(dbeBaseline2, 0, &quot;Newer Baseline&quot;, 160, iconNone)

	insertColumn(dbeAttributes, 0, &quot; &quot;, 160, iconNone)

	getBaselines(currMod)

	getAttributes(currMod)

	block(dbMain)
	destroy(dbMain)
	dbMain = null
}

/**********************************
	exportBaselineComparison
**********************************/
void exportBaselineComparison()
{
	Module currMod = null

	currMod = current Module

	if (null currMod)
	{
		infoBox(&quot;This utility can only be run from a formal module.&quot;)
		return
	}

	buildDialog(currMod)
}

exportBaselineComparison()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=633</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find Public Views</title>
		<link>http://www.smartdxl.com/content/?p=631</link>
		<comments>http://www.smartdxl.com/content/?p=631#comments</comments>
		<pubDate>Thu, 23 Jun 2011 13:18:18 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=631</guid>
		<description><![CDATA[Public views are a menace. They clutter up the drop down view list and can only be deleted by the owner or the Adminsitrator. This script demonstrates how you can identify public views. Public views can be identified by looking at thier access records. They will have exactly two access records, one will be RMCDA [...]]]></description>
			<content:encoded><![CDATA[<p>Public views are a menace. They clutter up the drop down view list and can only be deleted by the owner or the Adminsitrator. This script demonstrates how you can identify public views.</p>
<p>Public views can be identified by looking at thier access records. They will have exactly two access records, one will be RMCDA for the view owner, and the other will be read-only for everyone else.</p>
<p>This example checks modules in the current folder and gives you the option to send an email to the owners asking that they make their views private.</p>
<pre class="brush: dxl; title: ; notranslate">
// List Public Views

/*
	Lists public views found in modules.

	Reports public views found in modules together with the owner
	and their email address.

	24-MAY-2011		Tony Goodman
*/

pragma runLim, 0

string ccEmail = &quot;yourname@yourdomain.com&quot;

string MESSAGE = &quot;Dear DOORS User,

This \&quot;Public View\&quot; is owned by you. Public views are reserved for project/department-wide purposes and should only be created following agreement with the Requirements Manager. Please can you change the view to a \&quot;Private View\&quot; as soon as possible. This will not impact the view contents in any way, but will mean that only you can see the view.
We need to take this disciplined approach as too many views clutter up the DOORS module and can cause confusion. Unfortunately DOORS defaults new views to public views and this cannot be re-configured, so whenever you create a new view please remember to set it to a private view.

To make a view private:

1. open the module
2. select Views &gt; Manage Views...
3. select the view in the list
4. open the Access tab
5. select Everyone else
6. click on Edit..
7. select None
8. click OK
9. click OK

Many thanks.

Your Name

&quot;

DB  dbMain      = null
DBE dbeResults  = null
DBE dbeSendEmails = null
DBE dbeMessage = null

Buffer buf = create

bool sendEmails = false

targetAddresses = createString
ccAddresses = createString

User u = find()
string myEmail = u.email

/*********************************
	getAccessRecord
*********************************/
string getAccessRecord(AccessRec ar)
{
	string r = ((read ar)    ? &quot;R&quot; : &quot;&quot;)
	string m = ((modify ar)  ? &quot;M&quot; : &quot;&quot;)
	string c = ((create ar)  ? &quot;C&quot; : &quot;&quot;)
	string d = ((delete ar)  ? &quot;D&quot; : &quot;&quot;)
	string a = ((control ar) ? &quot;A&quot; : &quot;&quot;)

	string accessStr =  r m c d a &quot;&quot;

	if (null accessStr)
	{
		accessStr = &quot;None&quot;
	}

	return(accessStr)
}

/*********************************
	isPublic
*********************************/
bool isPublic(View v, string &amp;uName, string &amp;uEmail)
{
	AccessRec ar = null
	User u = null
	int count = 0
	bool def = false

	for ar in v do
	{
		count++
	}

	if (count == 2)
	{
		for ar in v do
		{
			if (getAccessRecord(ar) == &quot;R&quot;)
			{
				def = true
			}
			else if (getAccessRecord(ar) == &quot;RMCDA&quot;)
			{
				uName = username ar

				if (uName &quot;&quot; != &quot;&quot;)
				{
					u = find(uName)
				}

				if (!null u)
				{
					uEmail = u.email
				}
			}
		}

		return(def &amp;&amp; !null u)
	}

	return(false)
}

/*********************************
	getPublicViews
*********************************/
void getPublicViews(string mName, Buffer resBuf)
{
	Module m = null
	string vn = &quot;&quot;
	string uName = &quot;&quot;
	string uEmail = &quot;&quot;
	string res = &quot;&quot;
	string msg = &quot;&quot;
	bool noneFound = true

	m = read(mName, false)

	if (null m)
	{
		resBuf += &quot;ERROR: Failed to open module &quot; mName &quot;.\n&quot;
		return
	}

	(current ModuleRef__) = m

	for vn in views m do
	{
		if (isPublic(view vn, uName, uEmail))
		{
			if (sendEmails)
			{
				if (uEmail &quot;&quot; != &quot;&quot;)
				{
					delete(targetAddresses)
					targetAddresses = createString
					put(targetAddresses, uEmail, uEmail)
					delete(ccAddresses)
					ccAddresses = createString
					put(ccAddresses, ccEmail, ccEmail)

					res = sendEMailMessage(myEmail, targetAddresses, ccAddresses, &quot;Public View \&quot;&quot; vn &quot;\&quot; in DOORS module &quot; name(m), MESSAGE)

					if (res &quot;&quot; == &quot;&quot;)
					{
						msg = &quot;An Email has been sent to &quot; uEmail &quot;&quot;
					}
					else
					{
						msg = &quot;Error sending email to &quot; uEmail &quot;.&quot; res
					}
				}
				else
				{
					msg = &quot;Could not send Email - Email address unknown!&quot;
				}
			}
			else
			{
				msg = uEmail
			}

			resBuf += name(m) &quot; has public view \&quot;&quot; vn &quot;\&quot; owned by &quot; uName &quot; (&quot; msg &quot;).\n&quot;
			noneFound = false
		}
	}

	if (noneFound)
	{
		resBuf += name(m) &quot; does not have any public views.\n&quot;
	}

	close(m)
}

/*********************************
	doRun
*********************************/
void doRun(DB db)
{
	Item i
	setempty(buf)
	int pCount = 0
	int pLimit = 0

	for i in current Folder do
	{
		if (type(i) != &quot;Formal&quot;) continue

		pLimit++
	}

	if (pLimit == 0)
	{
		buf += &quot;No modules found.\n&quot;
	}
	else
	{
		//buf += pLimit &quot; modules found.\n&quot;

		if (!confirm(&quot;You are about to search for public views in &quot; pLimit &quot; modules\nAre you sure you want to continue?&quot;))
		{
			buf += &quot;Command aborted by user.\n&quot;
		}
		else
		{
			progressStart(dbMain, &quot;Checking modules&quot;, &quot;Checking modules&quot;, pLimit)

			for i in current Folder do
			{
				if (type(i) != &quot;Formal&quot;) continue

				pCount++
				progressRange(&quot;Checking module &quot; pCount &quot; of &quot; pLimit &quot;.&quot;, pCount, pLimit)

				getPublicViews(fullName(i), buf)
			}

			progressStop()
		}
	}

	set(dbeResults, buf)
}

/*********************************
	toggleEmails
*********************************/
void toggleEmails(DBE dbe)
{
	sendEmails = get(dbeSendEmails)

	if (sendEmails)
	{
		active(dbeMessage)
	}
	else
	{
		inactive(dbeMessage)
	}
}

/*********************************
	listPublicViews
*********************************/
void listPublicViews()
{
	dbMain = create(dbExplorer, &quot;List Public Views&quot;, styleCentered|styleFloating)

	label(dbMain, &quot;This utility allows you identify public views, and their owners, contained in modules below the current folder.&quot;)

	field(dbMain, &quot;Folder:&quot;, fullName(current Folder), 50, true)

	dbeSendEmails = toggle(dbMain, &quot;Send Emails to View Owners&quot;, sendEmails)

	dbeMessage = text(dbMain, &quot;Message:&quot;, MESSAGE, 600, 100, false)

	dbeResults = text(dbMain, &quot;Results:&quot;, &quot;&quot;, 600, 150, true)

	apply(dbMain, &quot;Run&quot;, doRun)

	realize(dbMain)

	set(dbeSendEmails, toggleEmails)
	inactive(dbeMessage)

	show(dbMain)
}

/*********************************
	MAIN
*********************************/
listPublicViews()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=631</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email Selected Objects</title>
		<link>http://www.smartdxl.com/content/?p=628</link>
		<comments>http://www.smartdxl.com/content/?p=628#comments</comments>
		<pubDate>Thu, 23 Jun 2011 10:44:18 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Export]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=628</guid>
		<description><![CDATA[This script allows you to send selected objects or the current view by email. The view is included in the email body as an HTML table. The following options allow you to send the current object, selected objects or the current view. The following code should be saved in a file and #included before calling [...]]]></description>
			<content:encoded><![CDATA[<p>This script allows you to send selected objects or the current view by email. The view is included in the email body as an HTML table.</p>
<p>The following options allow you to send the current object, selected objects or the current view.</p>
<pre class="brush: dxl; gutter: false; title: ; notranslate">
emailRequirements(current Module, SELECTION)

emailRequirements(current Module, OBJECT)

emailRequirements(current Module, VIEW)
</pre>
<p>The following code should be saved in a file and #included before calling one of the above options.</p>
<pre class="brush: dxl; title: ; notranslate">
//  Email selected objects or view

/*
	02-MAR-2011		Tony Goodman	Initial Version
*/

pragma runLim, 0

int VIEW      = 0
int OBJECT    = 1
int SELECTION = 2

Buffer tb2 = create

/*************************************
	makeEmail
*************************************/
void makeEmail(string subject, Buffer htmlBuffer)
{
	string      res        = null
	OleAutoObj  objOutlook = null
	OleAutoObj  objItem    = null
	OleAutoArgs args       = create

	objOutlook = oleCreateAutoObject(&quot;Outlook.Application&quot;)

	if (null objOutlook)
	{
		return
	}

    	clear args

	if (!null objItem)
	{
		oleCloseAutoObject(objItem)
	}

    	put(args, 0)

    	res = oleMethod(objOutlook, &quot;CreateItem&quot;, args, objItem)

    	if (null objItem)
	{
		ack &quot;Failed to create item&quot;
		return
    	}

   	res = olePut(objItem,&quot;HTMLBody&quot;, stringOf(htmlBuffer))

    	res = olePut(objItem, &quot;Subject&quot;, subject)

    	res = oleMethod(objItem, &quot;Display&quot;)

	if (!null objOutlook)
	{
		oleCloseAutoObject(objOutlook)
	}

}

/*************************************
	escapeQuotes
*************************************/
void escapeQuotes(Buffer buf, Buffer &amp;bTemp) {
	int i = 0

	setempty(bTemp)

	for (i = 0; i &lt; length(buf); i++)
	{
		if (buf[i] == '&quot;')
		{
			bTemp += '&quot;' &quot;&quot;
		}

		bTemp += buf[i] &quot;&quot;
	}
}

/*************************************
	escapeBrackets
*************************************/
void escapeBrackets(string s, Buffer &amp;bTemp) {
	int i = 0

	setempty(bTemp)

	for (i = 0; i &lt; length(s); i++)
	{
		if (s[i] == '&lt;')
		{
			bTemp += &quot;&amp;lt;&quot;
		}
		else if (s[i] == '&gt;')
		{
			bTemp += &quot;&amp;gt;&quot;
		}
		else
		{
			bTemp += s[i] &quot;&quot;
		}
	}
}

/*************************************
	convertRichText
*************************************/
void convertRichText(Buffer&amp; b, string s, int&amp; len, int max)
{
	RichTextParagraph rp = null
    RichText rt = null
    bool     limitText = false
	int ind = 0
	int i = 0

    if (!null len &amp;&amp; !null max)
        limitText = true
    else
        limitText = false

    if (limitText &amp;&amp; len &gt;= max)
        return

    setempty b

	for rp in s do
	{
		ind = rp.indentLevel

		for (i = 0; i &lt; ind; i += 360)
		{
				b += &quot;&lt;ul&gt;&quot;
		}

		if (rp.isBullet)
		{
			b += &quot;&lt;li&gt;&quot;
		}

    for rt in rp do {
        if (limitText &amp;&amp; len &gt;= max)
            break
        setempty tb2
        tb2 += rt.text
        if (limitText)
           // truncateBuffer(tb2, len, max)
        safeHTMLBuffer(tb2, true, true)

        if (rt.bold)
            b += &quot;&lt;b&gt;&quot;
        if (rt.underline)
            b += &quot;&lt;u&gt;&quot;
        if (rt.italic)
            b += &quot;&lt;i&gt;&quot;
        if (rt.strikethru)
            b += &quot;&lt;s&gt;&quot;
        if (rt.superscript)
            b += &quot;&lt;sup&gt;&quot;
        if (rt.subscript)
            b += &quot;&lt;sub&gt;&quot;
        if (rt.charset == charsetSymbol)
            b += &quot;&lt;font face=\&quot;Symbol\&quot;&gt;&quot;

        b += tb2

        if (rt.charset == charsetSymbol)
            b += &quot;&lt;/font&gt;&quot;
        if (rt.subscript)
            b += &quot;&lt;/sub&gt;&quot;
        if (rt.superscript)
            b += &quot;&lt;/sup&gt;&quot;
        if (rt.strikethru)
            b += &quot;&lt;/s&gt;&quot;
        if (rt.italic)
            b += &quot;&lt;/i&gt;&quot;
        if (rt.underline)
            b += &quot;&lt;/u&gt;&quot;
        if (rt.bold)
            b += &quot;&lt;/b&gt;&quot;

		if (rt.newline)
            b += &quot;&lt;br&gt;&quot;
    }

	if (rp.isBullet)
	{
		b += &quot;&lt;/li&gt;&quot;
	}

	for (i = 0; i &lt; ind; i += 360)
	{
			b += &quot;&lt;/ul&gt;&quot;
	}
}

}

/*************************************
	emitHeader
*************************************/
void emitHeader(Buffer htmlBuffer)
{
	htmlBuffer += &quot;&lt;!DOCTYPE html PUBLIC \&quot;-//W3C//DTD XHTML 1.0 Transitional//EN\&quot;\n&quot;
	htmlBuffer += &quot;\&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\&quot;&gt;\n&quot;
	htmlBuffer += &quot;&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;\n&quot;
	htmlBuffer += &quot;&lt;head&gt;\n&quot;

	htmlBuffer += &quot;&lt;style&gt;\n&quot;

	htmlBuffer += &quot;.myCell {\n&quot;
	htmlBuffer += &quot;margin: 0px;\n&quot;
	htmlBuffer += &quot;padding: 5px;\n&quot;
	htmlBuffer += &quot;vertical-align: top;\n&quot;
	htmlBuffer += &quot;font: 11px Arial, sans-serif;\n&quot;
	htmlBuffer += &quot;border: 1px solid #CCCCCC;\n&quot;
	htmlBuffer += &quot;}\n&quot;

	htmlBuffer += &quot;.myTable {\n&quot;
	htmlBuffer += &quot;margin: 0px;\n&quot;
	htmlBuffer += &quot;padding: 0px;\n&quot;
	htmlBuffer += &quot;vertical-align: top;\n&quot;
	htmlBuffer += &quot;}\n&quot;

	htmlBuffer += &quot;.myAnchor {\n&quot;
	htmlBuffer += &quot;text-decoration: none;\n&quot;
	htmlBuffer += &quot;font: 11px Arial, sans-serif;\n&quot;
	htmlBuffer += &quot;color: #000000;\n&quot;
	htmlBuffer += &quot;}\n&quot;

	htmlBuffer += &quot;.myAnchorBold {\n&quot;
	htmlBuffer += &quot;text-decoration: none;\n&quot;
	htmlBuffer += &quot;font: bold 11px Arial, sans-serif, bold;\n&quot;
	htmlBuffer += &quot;color: #000000;\n&quot;
	htmlBuffer += &quot;}\n&quot;

	htmlBuffer += &quot;&lt;/style&gt;\n&quot;
	htmlBuffer += &quot;&lt;/head&gt;\n&quot;
	htmlBuffer += &quot;&lt;body&gt;\n&quot;
}

/*************************************
	emitFooter
*************************************/
void emitFooter(Buffer htmlBuffer)
{
	htmlBuffer += &quot;&lt;/body&gt;\n&quot;
	htmlBuffer += &quot;&lt;/html&gt;\n&quot;
	htmlBuffer += &quot;\n&quot;
}

/*************************************
	emitTableObject
*************************************/
void emitTableObject(Object oTable, int scope, Buffer htmlBuffer)
{
	Buffer tempBuf = create
	string s = &quot;&quot;
	Object oRow = null
	Object oCell = null
	bool 	tableCellsAreVisible = false
	bool tableCellsAreSelected = false

	if (isVisible(oTable))
	{
		if (scope == SELECTION)
		{
			if (!isSelected(oTable))
			{
				return
			}
		}

		htmlBuffer += &quot;&lt;tr&gt;&lt;td class=\&quot;myCell\&quot;/&gt;&lt;td class=\&quot;myCell\&quot;/&gt;&lt;a class=\&quot;myText\&quot;&gt;&gt;&gt; Table&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;\n&quot;
		return
	}

	for oRow in oTable do
	{
		for oCell in oRow do
		{
			if (isVisible(oCell))
			{
				tableCellsAreVisible = true

				if (isSelected(oCell))
				{
					tableCellsAreSelected = true
				}
			}
		}
	}

	if (!tableCellsAreVisible) return

	if (scope == SELECTION &amp;&amp; !tableCellsAreSelected)
	{
		return
	}

	htmlBuffer += &quot;&lt;tr&gt;\n&quot;

	htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;/&gt;\n&quot;

	htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;

	htmlBuffer += &quot;&lt;table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	for oRow in oTable do
	{
		htmlBuffer += &quot;&lt;tr&gt;\n&quot;

		for oCell in oRow do
		{
			if (!isVisible(oCell))
			{
				continue
			}

			htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;
			htmlBuffer += &quot;&lt;a class=\&quot;myText\&quot;&gt; &quot;
			convertRichText(tempBuf, richText(oCell.&quot;Object Text&quot;), i, null)
			htmlBuffer += tempBuf
			htmlBuffer += &quot;&lt;/a&gt;\n&quot;
			htmlBuffer += &quot;&lt;/td&gt;\n&quot;
		}

		htmlBuffer += &quot;&lt;/tr&gt;\n&quot;
	}

	htmlBuffer += &quot;&lt;/table&gt;&quot;

	htmlBuffer += &quot;&lt;/td&gt;\n&quot;

	htmlBuffer += &quot;&lt;/tr&gt;\n&quot;

	delete(tempBuf)
	tempBuf = null
}

/*************************************
	emitView
*************************************/
string emitView(Module m, int scope, Buffer htmlBuffer)
{
	string res          = &quot;&quot;
	Object o            = null
	Object currObj      = null
	Column c            = null
	real   w            = 0.0
	real   myWidth = 0.0
	Buffer tempBuf = create
	int i = 0

	emitHeader(htmlBuffer)

	currObj = current Object

	htmlBuffer += &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	// header row
	htmlBuffer += &quot;&lt;tr&gt;\n&quot;
	htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;\n&quot;

	htmlBuffer += &quot;&lt;b&gt;Exported from DOORS:&lt;/b&gt; &quot; stringOf(dateOf intOf today) &quot;&lt;br&gt;&quot;

	htmlBuffer += &quot;&lt;b&gt;Module:&lt;/b&gt; &quot; fullName(m) &quot; [version &quot; version(m) &quot;]&lt;br&gt;&quot;

	if (scope == VIEW)
	{
		htmlBuffer += &quot;&lt;b&gt;View:&lt;/b&gt; &quot; currentView(m) &quot;&lt;br&gt;&quot;
	}
	else if (scope == SELECTION)
	{
		htmlBuffer += &quot;&lt;b&gt;View:&lt;/b&gt; &quot; currentView(m) &quot; &lt;b&gt;(Selected Objects Only)&lt;/b&gt;&lt;br&gt;&quot;
	}
	else if (scope == OBJECT)
	{
		htmlBuffer += &quot;&lt;b&gt;View:&lt;/b&gt; &quot; currentView(m) &quot; &lt;b&gt;(Single Object Only)&lt;/b&gt;&lt;br&gt;&quot;
	}

	htmlBuffer += &quot;&lt;/td&gt;\n&quot;
	htmlBuffer += &quot;&lt;/tr&gt;\n&quot;
	htmlBuffer += &quot;&lt;/table&gt;\n&quot;

	htmlBuffer += &quot;&lt;table class=\&quot;myTable\&quot; cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; width=\&quot;100%\&quot;&gt;\n&quot;

	for c in m do
	{
		w += realOf(width(c))
	}

	// table header
	htmlBuffer += &quot;&lt;tr&gt;\n&quot;
	for c in m do
	{
		myWidth = (realOf(width(c)) / w) * 100.0
		htmlBuffer += &quot;&lt;th width=\&quot;&quot; (int intOf(myWidth)) &quot;%\&quot; class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; title(c) &quot;&lt;/b&gt;&lt;/th&gt;\n&quot;
	}
	htmlBuffer += &quot;&lt;/tr&gt;\n&quot;

	// standard DOORS module - just export all objects in order.
	for o in document m do
	{
		//print identifier(o) &quot;\n&quot;

		if (table(o))
		{
			emitTableObject(o, scope, htmlBuffer)
		}
		else
		{
			if (!isVisible(o))
			{
				continue
			}

			if (scope == SELECTION)
			{
				if (!(isSelected(o) || o == currObj))
				{
					continue
				}
			}

			// new row in the table for each object in the current entity
			htmlBuffer += &quot;&lt;tr&gt;\n&quot;

			for c in m do
			{
				if (main(c))
				{
					if (o.&quot;Object Heading&quot; &quot;&quot; != &quot;&quot;)
					{
						htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;b&gt;&quot; number(o) &quot; &quot;
						convertRichText(tempBuf, o.&quot;Object Heading&quot; &quot;&quot;, i, null)
						htmlBuffer += tempBuf
						htmlBuffer += &quot;&lt;/b&gt;&lt;/td&gt;\n&quot;
					}
					else if (o.&quot;Object Text&quot; &quot;&quot; != &quot;&quot;)
					{
						htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;
						convertRichText(tempBuf, richText(o.&quot;Object Text&quot;), i, null)
						htmlBuffer += tempBuf
						htmlBuffer += &quot;&lt;/td&gt;\n&quot;
					}
					else
					{
						htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;br&gt;&lt;/td&gt;\n&quot;
					}
				}
				else
				{
					if (text(c, o) == &quot;&quot;)
					{
						htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;&lt;br&gt;&lt;/td&gt;\n&quot;
					}
					else
					{
						htmlBuffer += &quot;&lt;td class=\&quot;myCell\&quot;&gt;&quot;
						convertRichText(tempBuf, richText(c, o), i, null)
						htmlBuffer += tempBuf
						htmlBuffer += &quot; &lt;/td&gt;\n&quot;
					}
				}
			}

			// end of row for the current object
			htmlBuffer += &quot;&lt;/tr&gt;\n&quot;
		}
	}

	htmlBuffer += &quot;&lt;/table&gt;\n&quot;

	emitFooter(htmlBuffer)

	return(res)
}

/*************************************
	emailRequirements (no dialog)
*************************************/
void emailRequirements(Module m, int scope)
{
	string res = &quot;&quot;

	if (null m)
	{
		return
	}

	if (scope == SELECTION)
	{
		if (null current Object)
		{
			return
		}
	}

	Buffer htmlBuffer = create

	res = emitView(m, scope, htmlBuffer)

	if (res != &quot;&quot;)
	{
		warningBox(&quot;ERROR: &quot; res &quot;&quot;)
		return
	}

	makeEmail(fullName(m), htmlBuffer)

	delete(htmlBuffer)
}

//emailRequirements(current Module, SELECTION)
//emailRequirements(current Module, OBJECT)
//emailRequirements(current Module, VIEW)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=628</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create DOORS Links Modules</title>
		<link>http://www.smartdxl.com/content/?p=626</link>
		<comments>http://www.smartdxl.com/content/?p=626#comments</comments>
		<pubDate>Thu, 23 Jun 2011 10:38:37 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=626</guid>
		<description><![CDATA[If you create a link without setting up linkset pairings, DOORS will use the default link module. This causes problems when trying to analyse links if your links are not where you expect them to be. To prevent the default link module being used, you need to place a soft-deleted DOORS Links module in every [...]]]></description>
			<content:encoded><![CDATA[<p>If you create a link without setting up linkset pairings, DOORS will use the default link module. This causes problems when trying to analyse links if your links are not where you expect them to be.</p>
<p>To prevent the default link module being used, you need to place a soft-deleted DOORS Links module in every folder of your project. This will ensure that users can only create links as intended, and specified in your  linkset pairings.</p>
<p>The following script will create, and soft-delete, a DOORS Links module in every folder below the current folder.</p>
<pre class="brush: dxl; title: ; notranslate">
//  Create and Soft delete DOORS Links module in current folder and all sub-folders

/*
	Creates and Soft deletes a &quot;DOORS Links&quot; link module in the current folder and all sub-folders.

	If any DOORS Links modules already exist but are not soft-deleted, these are reported but the modules
	are left untouched. These modules should be renamed manually and then run this script again.

	Reports an error if a module cannot be created due to access permissions.

	Output is to the DXL interaction window.

	Tony Goodman		tony@smartdxl.com
*/

pragma runLim, 0

string DOORS_LINKS = &quot;DOORS Links&quot;

int existsCount = 0
int newCount = 0
int folderCount = 0
int errors = 0

/***********************************
	createDoorsLinksModule
************************************/
void createDoorsLinksModule(Folder f)
{
	Item i

	folderCount++

	if (module(fullName(f) &quot;/&quot; DOORS_LINKS))
	{
		if (!isDeleted(module(fullName(f) &quot;/&quot; DOORS_LINKS)))
		{
			existsCount++
			print(&quot;Already exists (undeleted): &quot; fullName(f) &quot;/&quot; DOORS_LINKS &quot;\n&quot;)
			//softDelete(module(fullName(f) &quot;/DOORS Links&quot;))
		}
		else
		{
			//print &quot;already deleted\n&quot;
		}
	}
	else
	{
		(current FolderRef__) = f

		noError
		Module m = create(DOORS_LINKS, &quot;DO NOT UNDELETE OR PURGE&quot;, manyToMany, false)

		res = lastError

		if (res &quot;&quot; != &quot;&quot;)
		{
			errors++
			print(&quot;Error trying to create &quot; fullName(f) &quot;/&quot; DOORS_LINKS &quot;: &quot; res &quot;\n&quot;)
		}

		if (!null m)
		{
			close(m)
			softDelete(module(fullName(f) &quot;/&quot; DOORS_LINKS))
			newCount++
		}
		else
		{
			errors++
			print(&quot;Failed to create: &quot; fullName(f) &quot;/&quot; DOORS_LINKS &quot;\n&quot;)
		}

	}

	for i in f do
	{
		if (type(i) == &quot;Folder&quot; || type(i) == &quot;Project&quot;)
		{
			createDoorsLinksModule(folder(fullName(i)))
		}
	}
}

/************************************
	MAIN
*************************************/
if (!confirm(&quot;You are about to create and soft-delete \&quot;&quot; DOORS_LINKS &quot;\&quot; modules in all folders below\n&quot; //-
	             fullName(current Folder) &quot;\n&quot; //-
                 &quot;Are you sure you want to continue?&quot;))
{
	halt
}

createDoorsLinksModule(current Folder)

refreshDBExplorer()

print(folderCount &quot; folders checked\n&quot;)
print(newCount &quot; modules created and soft-deleted\n&quot;)
print(existsCount &quot; modules found (undeleted)\n&quot;)
print(errors &quot; errors (unable to create module)\n&quot;)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=626</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Branded Dialogs</title>
		<link>http://www.smartdxl.com/content/?p=621</link>
		<comments>http://www.smartdxl.com/content/?p=621#comments</comments>
		<pubDate>Wed, 22 Jun 2011 14:42:35 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Dialogs]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=621</guid>
		<description><![CDATA[This library file allows you to easily create branded dialog boxes. The dialogs have a canvas across the top with your logo and a link to your website. Include this file and call smartDialog() instead of create() when creating your dialog. Usage: You will need to edit the include file to define your logo bitmap [...]]]></description>
			<content:encoded><![CDATA[<p>This library file allows you to easily create branded dialog boxes. The dialogs have a canvas across the top with your logo and a link to your website.</p>
<p><a href="http://www.smartdxl.com/content/wp-content/uploads/2011/06/branded.bmp"><img class="aligncenter size-full wp-image-623" title="branded" src="http://www.smartdxl.com/content/wp-content/uploads/2011/06/branded.bmp" alt="" /></a></p>
<p>Include this file and call smartDialog() instead of create() when creating your dialog.</p>
<p>Usage:</p>
<pre class="brush: dxl; gutter: false; title: ; notranslate">
DB smartDialog([Module m | DB db,] string title [,int options])
</pre>
<p>You will need to edit the include file to define your logo bitmap file and website URL etc.</p>
<p>Source file:</p>
<pre class="brush: dxl; title: ; notranslate">
//&lt;  Smart DXL Dialog Definitions

/*
    S M A R T   D X L   L I M I T E D

    Copyright:          (c) 2008 Smart DXL Limited.

    The information contained in this document is the property
    of Smart DXL Limited. Transmittal, receipt or possession
    of this information does not express licence or imply any
    rights to use sell or manufacture from this information
    and no reproduction of it in whole or part shall be made
    without the written authorisation from an officer of the company.

	Description:

	Provides smartDialog function to create a dialog box with a Smart DXL
	banner across the top.

	Usage:

		DB smartDialog([Module m | DB db,] string title [,int options])

	Change History:

	25-NOV-2008		Tony Goodman	Initial version.

	24-FEB-2011		Tony Goodman	Locate bitmap from addins path.
											Add banner title and website url.
											Use more complex names for global variables.

*/

/***********************************
	Smart DXL logo bitmap file - this is loaded once when first dialog is displayed.
***********************************/
Bitmap smartDxlLogo = null

string SMART_DXL_DB_TITLE      = &quot;Smart DXL&quot;
string SMART_DXL_BANNER_WEBSITE  = &quot;www.smartdxl.com&quot;
string SMART_DXL_BANNER_BITMAP    = &quot;SmartDXL\\bitmaps\\tophat.bmp&quot;

DBE smartDxlBanner = null

bool smartDxlLogoFound = false

string smartDxlBannerText = &quot;&quot;

int   smartDxlLogoWidth   = 0
int   smartDxlLogoHeight  = 0

/***********************************
	getAbsolutePath
***********************************/
string getAbsolutePath(string sFileName)
{
	string sResult  = &quot;&quot;

	string sAddinsPathList      = (getenv &quot;ADDINS&quot;) &quot;;&quot;
	string sDoorsAddinsPathList = (getenv &quot;DOORSADDINS&quot;) &quot;;&quot;

	if (sAddinsPathList != sDoorsAddinsPathList)
	{
		sAddinsPathList = sDoorsAddinsPathList &quot;;&quot; sAddinsPathList
	}

	Regexp rPath = regexp &quot;([^;]*);(.*)&quot;

	string sLeft    = &quot;&quot;
	string sRight   = &quot;&quot;

	if (rPath sAddinsPathList)
	{
		// test each path in the semicolon separated list
		while (rPath sAddinsPathList)
		{
			  sLeft  = sAddinsPathList[match 1]
			  sRight = sAddinsPathList[match 2]

			  if (fileExists_ (sLeft &quot;\\&quot; sFileName))
			  {
					sResult  = sLeft &quot;\\&quot; sFileName
					break;
			  }
			  else
			  {
					sAddinsPathList = sRight
			  }
		}
	}
	return(sResult)
}

/************************************
  smartDrawLogo
************************************/
void smartDrawLogo(DBE cnvs)
{
	string smartDxlBitmapFile = &quot;&quot;
	Stat   st = null

	if (null smartDxlLogo)
	{
		// bitmap has not been loaded yet, so load it
		smartDxlBitmapFile = getAbsolutePath(SMART_DXL_BANNER_BITMAP)

		// check that the file exists
		st = create(smartDxlBitmapFile)

		if (!null st)
		{
			// file does exist so we can load the bitmap
			delete(st)

			smartDxlLogo = loadBitmap(cnvs, smartDxlBitmapFile, false, smartDxlLogoWidth, smartDxlLogoHeight)
		}
    }

    // draw the bitmap if it was successfully loaded
    if (!null smartDxlLogo)
    {
    	drawBitmap(cnvs, smartDxlLogo, 0, 0)
		smartDxlLogoFound = true
	}
}

/***********************************
	doLogoMouse
***********************************/
void doLogoMouse(DBE cnv, int but, bool ctrl, int x, int y)
{
	if (x &gt; width(cnv) - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5)
	{
		activateURL(SMART_DXL_BANNER_WEBSITE)
	}
}

/***********************************
	doRepaintSmartDxlBanner
***********************************/
void doRepaintSmartDxlBanner(DBE cnv)
{
	int canvasWidth  = width(cnv)
	int titleHeight  = 0
	int y = 0

	realBackground(cnv, realColor_White)

	smartDrawLogo(cnv)

	realColor(cnv, realColor_Black)
	font(cnv, 4, HeadingsFont)

	y = (height(cnv) / 2) + (height(cnv, smartDxlBannerText) / 2) - 3

	draw(cnv, smartDxlLogoWidth + 3, y, smartDxlBannerText)

	realColor(cnv, realColor_Blue)
	font(cnv, 9, HeadingsFont)
	draw(cnv, canvasWidth - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5, y - 1, SMART_DXL_BANNER_WEBSITE)
	line(cnv, canvasWidth - width(cnv, SMART_DXL_BANNER_WEBSITE) - 5, y, canvasWidth - 5, y)
}

/***********************************
	addSmartDxlBanner
***********************************/
void addSmartDxlBanner(DB db)
{
	smartDxlBanner = canvas(db, 0, 32, doRepaintSmartDxlBanner)

	set(smartDxlBanner, doLogoMouse)
}

/***********************************
	showHelp
***********************************/
void showHelp(string helpFile)
{
	system(&quot;\&quot;C:\\Program Files\\Internet Explorer\\iexplore.exe\&quot; -nohome \&quot;&quot; (getAbsolutePath(helpFile)) &quot;\&quot;&quot;)
}

/***********************************
	smartDialog
***********************************/
DB smartDialog(string banner, int options)
{
	DB smartDb = null

	smartDb = create(SMART_DXL_DB_TITLE, options)

	smartDxlBannerText = banner

	addSmartDxlBanner(smartDb)

    return(smartDb)
}

/***********************************
	smartDialog
***********************************/
DB smartDialog(string dbTitle)
{
	return(smartDialog(dbTitle, styleCentered|styleFloating))
}	

/***********************************
	smartDialog
***********************************/
DB smartDialog(Module mParent, string banner, int options)
{
	DB smartDb = null

	smartDb = create(mParent, SMART_DXL_DB_TITLE, options)

	smartDxlBannerText = banner

	addSmartDxlBanner(smartDb)

    return(smartDb)
}

/***********************************
	smartDialog
***********************************/
DB smartDialog(Module mParent, string dbTitle)
{
	return(smartDialog(mParent, dbTitle, styleCentered|styleFloating))
}

/***********************************
	smartDialog
***********************************/
DB smartDialog(DB dbParent, string banner, int options)
{
	DB  smartDb     = null

	smartDb = create(dbParent, SMART_DXL_DB_TITLE, options)

	smartDxlBannerText = banner

	addSmartDxlBanner(smartDb)

    return(smartDb)
}

/***********************************
	smartDialog
***********************************/
DB smartDialog(DB dbParent, string banner)
{
	return(smartDialog(dbParent, banner, styleCentered|styleFloating))
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=621</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Folder Browser DBE</title>
		<link>http://www.smartdxl.com/content/?p=618</link>
		<comments>http://www.smartdxl.com/content/?p=618#comments</comments>
		<pubDate>Wed, 22 Jun 2011 14:31:50 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Dialogs]]></category>
		<category><![CDATA[Files and Directories]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=618</guid>
		<description><![CDATA[This function implements a folder browser dialog element. Use it in a similar fashion to the builtin fileName() function. Usage: Source file:]]></description>
			<content:encoded><![CDATA[<p>This function implements a folder browser dialog element. Use it in a similar fashion to the builtin fileName() function.</p>
<p>Usage:</p>
<pre class="brush: dxl; gutter: false; title: ; notranslate">
DBE foldername = smartFolderBrowser(DB dbParent, string label, bool readOnly)
</pre>
<p>Source file:</p>
<pre class="brush: dxl; title: ; notranslate">
//&lt;  Smart Folder Browser

/*
    S M A R T   D X L   L I M I T E D

    Copyright:          (c) 2008 Smart DXL Limited.

	Description:

	Folder Browser Facility. 

    provides smartFolderBrowser() which may be used in place of fileName()
    when browsing for a folder rather than a file.

    Uses COM to invoke windows folder browser.

	Change History:

	25-NOV-2008		Tony Goodman	

*/

/************************************
	Field and Browse button that are created on the parent dialog box.
*************************************/
DBE dbeBrowse         = null
DBE dbeDirectory      = null

/************************************
	getWindowsFolder
*************************************/
string getWindowsFolder(string &amp;dirPath)
{
	OleAutoObj  objDialog     = null
	OleAutoObj  objFolder     = null
	OleAutoObj  objFolderItem = null
	OleAutoArgs args          = create
	string      folderPath    = &quot;&quot;
	string      res           = &quot;&quot;

	dirPath = &quot;&quot;

	objDialog = oleCreateAutoObject(&quot;Shell.Application&quot;)

	if (null objDialog)
	{
		return(&quot;Failed to create dialog object&quot;)
	}

	put(args, 0)                         // always zero
	put(args, &quot;Please select a folder&quot;)  // title
	put(args, 0)                         // options
	//put(args, &quot;c:\\temp&quot;)              // root folder

	res = oleMethod(objDialog, &quot;BrowseForFolder&quot;, args, objFolder)

	if (null objFolder)
	{
		if (res &quot;&quot; != &quot;&quot;)
		{
			return(&quot;Failed to launch browser: &quot; res)
		}
		else
		{
			return(&quot;&quot;)
		}
	}

	res = oleGet(objFolder, &quot;Self&quot;, objFolderItem)

	if (null objFolderItem)
	{
		return(&quot;Failed to get folder item: &quot; res)
	}

	oleGet(objFolderItem, &quot;Path&quot;, folderPath)

	dirPath = folderPath

	return(res)
}

/************************************
	doBrowse
*************************************/
void doBrowse(DBE dbe)
{
	string res           = &quot;&quot;
	string directoryName = &quot;&quot;

	res = getWindowsFolder(directoryName)

	if (res == &quot;&quot;)
	{
		set(dbeDirectory, directoryName)
	}
	else
	{
		infoBox(&quot;Error: &quot; res)
	}
}

/************************************
	smartFolderBrowser
*************************************/
DBE smartFolderBrowser(DB     dbParent,
                     string sLabel,
                     bool   readOnly)
{
    // use default if parameter is null
    if (dbParent == null)
    {
        dbParent = dbExplorer
    }

    // Create Field and Browse button on parent dialog
    dbeDirectory = field(dbParent, sLabel, &quot;&quot;, 40, readOnly)
    beside(dbParent)
   	dbeBrowse = button(dbParent, &quot;Browse...&quot;, doBrowse)
   	left(dbParent)

    // return handle on directory field dbe
    return(dbeDirectory)
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=618</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List Linked Modules</title>
		<link>http://www.smartdxl.com/content/?p=616</link>
		<comments>http://www.smartdxl.com/content/?p=616#comments</comments>
		<pubDate>Wed, 22 Jun 2011 08:56:42 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=616</guid>
		<description><![CDATA[This simple script creates a dialog box showing a list of all modules that are linked to the current module. It also includes the name of the link module used and a count of the number of links.]]></description>
			<content:encoded><![CDATA[<p>This simple script creates a dialog box showing a list of all modules that are linked to the current module. It also includes the name of the link module used and a count of the number of links.</p>
<pre class="brush: dxl; title: ; notranslate">
//   List Linked Modules

/*
	02-MAR-2011		Tony Goodman	Initial Version
*/

// List Linked Modules

/*
   Lists modules that are linked to from the current module, together with a count of links.
*/

pragma runLim, 0

DB dbMain = null
DBE dbeResults = null

Module m = null

/***********************
	populateBuffer
************************/
void populateBuffer(Buffer &amp;b)
{
	Object o = null
	Link l = null
	LinkRef lr = null
	ModName_ mn = null
	int count = 0
	int outTotal = 0
	int inTotal = 0 

	Skip inLinks = createString
	Skip outLinks = createString

	string s = &quot;&quot;

	for o in m do
	{
		for l in o -&gt; &quot;*&quot; do
		{
			mn = target(l)

			s = fullName(mn) &quot; [&quot; fullName(module(l)) &quot;]&quot;

			if (find(outLinks, s, count))
			{
				delete(outLinks, s)
				put(outLinks, s, count + 1)
			}
			else
			{
				put(outLinks, s, 1)
			}
			outTotal++
		}
	}

	b += fullName(m) &quot;\n\n&quot;

	if (outTotal == 0)
	{
		b += &quot;has no outgoing links\n&quot;
	}
	else
	{
		b += &quot;has outgoing links to:\n&quot;

		for count in outLinks do
		{
			b += (string key outLinks) &quot; - &quot; count &quot; links\n&quot;
		}
	}

	for o in (m) do
	{
		for lr in o &lt;- &quot;*&quot; do
		{
			mn = source(lr)

			s = fullName(mn) &quot; [&quot; fullName(module(lr)) &quot;]&quot;

			if (find(inLinks, s, count))
			{
				delete(inLinks, s)
				put(inLinks, s, count + 1)
			}
			else
			{
				put(inLinks, s, 1)
			}
			inTotal++
		}
	}

	if (inTotal == 0)
	{
		b += &quot;has no incoming links\n&quot;
	}
	else
	{
		b += &quot;\nhas incoming links from:\n&quot;

		for count in inLinks do
		{
			b += (string key inLinks) &quot; - &quot; count &quot; links\n&quot;
		}
	}

	b += &quot;\n&quot;
}

/*******************************
	listLinkedModules
********************************/
void buildDialog()
{
	Buffer b = create
	populateBuffer(b)

	dbMain = create(m, &quot;Linked Modules&quot;, styleFloating|styleCentered)
	dbeResults = text(dbMain, &quot;&quot;, &quot;&quot;, 800, 250, false)

	realize(dbMain)
	set(dbeResults, b)

	delete(b)
	b = null

	show(dbMain)
}

/*******************************
	listLinkedModules
********************************/
void listLinkedModules()
{
	m = current Module

	buildDialog()
}

listLinkedModules()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=616</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export Attribute Definitions</title>
		<link>http://www.smartdxl.com/content/?p=590</link>
		<comments>http://www.smartdxl.com/content/?p=590#comments</comments>
		<pubDate>Fri, 17 Jun 2011 14:23:49 +0000</pubDate>
		<dc:creator>Tony Goodman</dc:creator>
				<category><![CDATA[Attributes]]></category>
		<category><![CDATA[Export]]></category>

		<guid isPermaLink="false">http://www.smartdxl.com/content/?p=590</guid>
		<description><![CDATA[This utility allows you to export attribute definitions from the current Module to a CSV file.]]></description>
			<content:encoded><![CDATA[<p>This utility allows you to export attribute definitions from the current Module to a CSV file.</p>
<pre class="brush: dxl; title: ; notranslate">
// Export Attributes

/*

*/

DB dbMain = null
DBE dbeFileName = null

Module m = null
string outputFile = &quot;&quot;

/************************************
	doExport
*************************************/
void doExport(DB db)
{
	AttrDef ad = null
	AttrType at = null
	string existsForObject = &quot;&quot;
	string existsForModule = &quot;&quot;
	string inheritValue = &quot;&quot;
	string defVal = &quot;&quot;
	AttrBaseType abt = null
	string isDxl = &quot;&quot;
	string hasHistory = &quot;&quot;
	string hasBars = &quot;&quot;
	string hasDates = &quot;&quot;
	string minVal = &quot;&quot;
	string maxVal = &quot;&quot;
	string isMulti = &quot;&quot;
	Stream st = null
	Buffer enumerations = create
	int enumSize = 0
	int i = 0
	bool isHidden = false
	bool isSystem = false

	outputFile = get(dbeFileName)

	st = write(outputFile)

	if (null st)
	{
		infoBox(&quot;failed to open file for writing: &quot; outputFile)
		return
	}

	st &lt;&lt; &quot;Name,&quot;
	st &lt;&lt; &quot;Description,&quot;
	st &lt;&lt; &quot;Type,&quot; 

	st &lt;&lt; &quot;Exists For Object,&quot;
	st &lt;&lt; &quot;Exists For Module,&quot;  

	st &lt;&lt; &quot;Generates History,&quot;
	st &lt;&lt; &quot;Affects Change Bars,&quot;
	st &lt;&lt; &quot;Affects Change Dates,&quot; 

	st &lt;&lt; &quot;DXL Attribute,&quot;
	st &lt;&lt; &quot;Inherits Value,&quot;
	st &lt;&lt; &quot;Default Value,&quot; 

	st &lt;&lt; &quot;Base Type,&quot;
	st &lt;&lt; &quot;Enumerations,&quot; 

	st &lt;&lt; &quot;Multi Valued,&quot;
	st &lt;&lt; &quot;Min Value,&quot;
	st &lt;&lt; &quot;Max Value\n&quot;  

	for ad in m do
	{
		isSystem = ad.system

		if (ad.system) continue

		isHidden = ad.hidden

		if (ad.hidden) continue

		if (ad.module)
		{
			existsForModule = &quot;Y&quot;
		}
		else
		{
			existsForModule = &quot;&quot;
		}

		if (ad.object)
		{
			existsForObject = &quot;Y&quot;
		}
		else
		{
			existsForObject = &quot;&quot;
		}	

		if (ad.inherit)
		{
			inheritValue = &quot;Y&quot;
		}
		else
		{
			inheritValue = &quot;&quot;
		}

		defVal = &quot;&quot;

		if (ad.defval)
		{
			defVal = plainText(ad.defval)
		}

		at = ad.type

		abt = at.type

		isMulti = &quot;&quot;

		if (abt == attrEnumeration)
		{
			if (ad.multi)
			{
				isMulti = &quot;Y&quot;
			}

			setempty(enumerations)

			enumSize = at.size

			for (i = 0; i &lt; enumSize; i++)
			{
				enumerations += at.strings[i] &quot;\n&quot;
			}
		}

		if (ad.dxl)
		{
			isDxl = &quot;Y&quot;
		}
		else
		{
			isDxl = &quot;&quot;
		}

		if (!ad.nohistory)
		{
			hasHistory = &quot;Y&quot;
		}
		else
		{
			hasHistory = &quot;&quot;
		}

		if (!ad.nochanges)
		{
			hasDates = &quot;Y&quot;
		}
		else
		{
			hasDates = &quot;&quot;
		}

		if (!ad.nobars)
		{
			hasBars = &quot;Y&quot;
		}
		else
		{
			hasBars = &quot;&quot;
		}

		minVal = &quot;&quot;
		maxVal = &quot;&quot;

		if (abt == attrInteger)
		{
			if (at.minValue)
			{
				minVal = (int at.minValue) &quot;&quot;
			}

			if (at.maxValue)
			{
				maxVal = (int at.maxValue) &quot;&quot;
			}
		}
		else if (abt == attrDate)
		{
			if (at.minValue)
			{
				minVal = (Date at.minValue) &quot;&quot;
			}

			if (at.maxValue)
			{
				maxVal = (Date at.maxValue) &quot;&quot;
			}
		}
		else if (abt == attrReal)
		{
			if (at.minValue)
			{
				minVal = (real at.minValue) &quot;&quot;
			}

			if (at.maxValue)
			{
				maxVal = (real at.maxValue) &quot;&quot;
			}
		}

		st &lt;&lt; &quot;\&quot;&quot; ad.name &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; ad.description &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; ad.typeName &quot;\&quot;,&quot;

		st &lt;&lt; &quot;\&quot;&quot; existsForObject &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; existsForModule &quot;\&quot;,&quot;

		st &lt;&lt; &quot;\&quot;&quot; hasHistory &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; hasBars &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; hasDates &quot;\&quot;,&quot;

		st &lt;&lt; &quot;\&quot;&quot; isDxl &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; inheritValue &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; defVal &quot;\&quot;,&quot;

		st &lt;&lt; &quot;\&quot;&quot; abt &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; stringOf(enumerations) &quot;\&quot;,&quot;

		st &lt;&lt; &quot;\&quot;&quot; isMulti &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; minVal &quot;\&quot;,&quot;
		st &lt;&lt; &quot;\&quot;&quot; maxVal &quot;\&quot;\n&quot;

	}

	close(st)

	infoBox(&quot;Export complete!&quot;)

	release(dbMain)
}

/***************************************
	doHelp
***************************************/
void doHelp(DB db)
{
	showHelp(&quot;SmartDXL/export/exportAttributesCsv.mht&quot;)
} 

/***********************************
	buildDialog
***********************************/
void buildDialog()
{
	dbMain = create(m, &quot;Export Attributes to CSV&quot;, styleCentered)

	label(dbMain, &quot;This utility exports attribute details to a CSV file.\n\n&quot;)

	dbeFileName = fileName(dbMain, &quot;Export to:&quot;, &quot;U:\\&quot; name(m) &quot;.csv&quot;, &quot;*.csv&quot;, &quot;CSV Files&quot;, false)

	apply(dbMain, &quot;Export&quot;, doExport)
	apply(dbMain, &quot;Help&quot;, doHelp)

	realize(dbMain)

	block(dbMain)
	destroy(dbMain)
	dbMain = null
}

/************************************
	exportAttributes
************************************/
void exportAttributes()
{
	m = current Module

	buildDialog()
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smartdxl.com/content/?feed=rss2&#038;p=590</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

