Dovetail Agent includes two sample pages that show how to implement flash viewing. The samples are based on the Site Part and Site forms.
When the Site Part page is opened, the page attempts to find any flashes related to the site part. If it finds any, the flashes are displayed in the pop-up Flash List window, and a link is added to the Site Part form for future viewing. In both samples, the sample page can be easily compared to the baseline page to see how the modifications were applied.
Note: The example assumes that the Dovetail Admin Flash Tables page was used to create a flash-enabled object for the site_part table.
The sample code shown below is also included in sample/sample_site_part.asp. The code can be imported into the site_part.asp page if Flashes are set up for Site Parts. This functionality can be added to almost any page in Dovetail Agent.
Example: Adding a new flash
<!--#include file="../include/inc_flash.asp"-->
var boFlash = FCSession.CreateGeneric("alert_to_other");
var boAlert = FCSession.CreateGeneric("alert");
var alert_object = 45;
var alert_count = get_flashes(boFlash, boAlert, alert_object, strObjid);
// get flash style
// to overide config_itm,
// set flash_type = 0 for classic style
// set flash_type = 1 for anywhere style
var flash_type = FCSession.Item("config_itm.flash_style.i_value");
if(flash_type == "" || !FCApp.is_it_a_field('alert','x_active')) flash_type = 0;
// set flag for Flashes link
var bFlashAnywhere = false;
var bFlashClassic = false;
if(FCApp.GetTableID('alert_table') > 0 && flash_type == 1) {
var boFlash = FCSession.CreateGeneric('alert_table');
boFlash.AppendFilter('table_or_view', '=', 'site_part');
boFlash.Query();
if(boFlash.Count() > 0) bFlashAnywhere = true;
try{boFlash.CloseGeneric();}catch(e){}
} else {
bFlashClassic = true;
}
var flash_count = flash_count(strObjid, 15, "");
<script language=javascript src="../flash/open_flash.js"></script>
function flash_pop(){
if(<%=flash_count%> > 0) {
OpenFlashAnywhereWindow(<%=strObjid%>, 15, '', <%=flash_type%>);
}
}
<body onload="AttachChangeEvent();ColorRequired();flash_pop();">
<tr>
<td height=30> </td>
</tr>
<tr>
<% if(bFlashClassic || bFlashAnywhere) { %>
<td align="center"><a id="flash" href="" onclick="OpenFlashAnywhereWindow(<% =boSitePart.id %>, 15, '', <% =flash_type %>);return false;">Flashes</a></td>
<% } else { %>
<td> </td>
<% } %>
</tr>
<tr>
<td> </td>
</tr>
Example: Add the ability to view the Site Part Flash from a parent object's form
The sample code shown below is also included in sample/sample_site.asp. With these changes, the Flash List window will now list both the Site flashes and Site Part flashes.
boFlash.Query();
to this section:
boFlash.BulkName = "flash";
// Get the site_part records related to this site
var boSitePart = FCSession.CreateGeneric('site_part');
boSitePart.DataFields = 'objid';
boSitePart.BulkName = "flash";
boSitePart.TraverseFromRoot(boSite.id,'site','site2all_site_part');
boFlash.Bulk.Query();
// add flash objects
var strFlashArray = new Array();
if(!bNew && bFlashAnywhere) {
strFlashArray[strFlashArray.length] = "52|" + boSite.id;
while(!boSitePart.EOF) {
strFlashArray[strFlashArray.length] = "15|" + boSitePart.id;
boSitePart.MoveNext();
}
}
try {boSitePart.CloseGeneric();}catch(e){}
See Also |
Next |