I'm not an expert coder by any means, but I am confused by the fact that it works fine most of the time, then doesn't. Any thoughts?
Thanks,
JT
Code: Select all
%code
const
cName = 'RESTRICTED';
xPA = 'X-PA';
xHR = 'X-HR';
xEHS = 'X-EHS';
fID = 'FULL ID';
var
AProp: TCatalogItemProp;
ACatItem: TCatalogItem;
AVersionColor: String;
AVersionShape: String;
ARatingColor: String;
ARatingStar: String;
ARatingOnStar: String;
ARatingOffStar: String;
i: Integer;
begin
result := '';
ARatingColor := '#CCCCCCCC';
ARatingStar := 'M 3.03,4.19883 L 2.996,4.22354 L 3.00909,4.26369 L 2.97501,4.2389 L 2.94086,4.26369 L 2.95394,4.22354 L 2.92,4.19883 L 2.96193,4.19883 L 2.97501,4.1589 L 2.98801,4.19883 L 3.03,4.19883 Z ';
ARatingOnStar := '<img size="22" path="' + ARatingStar + '" pathfillcolor="' + ARatingColor + '">';
ARatingOffStar := '<img size="19" path="' + ARatingStar + '" pathfillstyle="none" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';
AVersionShape := 'M 1,1 L 2,2 L 1,2 L 1,1 Z';
AProp := TCatalogItemProp.Create(nil);
if Catalog.FindPropByName(xPA, AProp, '', False) then begin
AVersionColor := '#3FCCCCCC';
if Catalog.ImageHasProp(ImageItem, AProp, False) then
AVersionColor := '#FFFF4040';
else
if Catalog.FindPropByName(xHR, AProp, '', False) then
AVersionColor := '#3FCCCCCC';
if Catalog.ImageHasProp(ImageItem, AProp, False) then
AVersionColor := '#FFFF4040';
else
if Catalog.FindPropByName(xEHS, AProp, '', False) then
AVersionColor := '#3FCCCCCC';
if Catalog.ImageHasProp(ImageItem, AProp, False) then
AVersionColor := '#FFFF4040';
//#### Show Marker
result := result + '<font size="08" color="'+ AVersionColor +'"><ind y="2">';
result := result + '<img size="18" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
result := result + '</ind></font>';
//#### Show Flags
if Catalog.FindPropByName(xEHS, AProp, '', False) then
if Catalog.ImageHasProp(ImageItem, AProp, False) then
result := result + '<FONT size="08" color="#FFFF4040"><ind y="3">EHS '
else
result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">EHS ';
if Catalog.FindPropByName(xHR, AProp, '', False) then
if Catalog.ImageHasProp(ImageItem, AProp, False) then
result := result + '<FONT size="08" color="#FFFF4040"><ind y="3">HR '
else
result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">HR ';
if Catalog.FindPropByName(xPA, AProp, '', False) then
if Catalog.ImageHasProp(ImageItem, AProp, False) then
result := result + '<FONT size="08" color="#FFFF4040"><ind y="3">PA '
else
result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">PA ';
if Catalog.FindPropByName(fID, AProp, '', False) then
if Catalog.ImageHasProp(ImageItem, AProp, False) then
result := result + '<FONT size="08" color="#3BB9FF"><ind y="3">Full ID '
else
result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">Full ID ';
if Catalog.ImageIsVersion(ImageItem) then
result := result + '<FONT size="08" color="#FF40FF40"><ind y="3">Versions'
else if Catalog.ImageHasVersions(ImageItem) then
result := result + '<FONT size="08" color="#FF40FF40"><ind y="3">Versions'
else
result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">Versions';
end;
ACatItem.Free;
end;
%/code