/* ** PROGRAM NAME: Tag-History.CPL ** ------------- ** Program Source Code File (.CPL) ** Concordance EX ** ** COPYRIGHT: (C) Copyright Dataflight Software, Inc. 2003. All Rights Reserved. ** ** SYNOPSIS: This utility program displays the tag history of a document: all tag deletions and additions and the dates. typedef struct { unsigned long days:15; unsigned long seconds:17; } TIMESTAMP; */ main() { int i, db, bt, data; int hours, minutes, seconds; text szText, szUUID; char szEntry[256]; if (ver() < 7.3) return(Message("This program requires Concordance EX V7.30 or later.", 1)); szUUID = getuuid(db); szText = "Record number: "+str(recno(db)) + newline() + "Accession number: "+ str(accession(db)) + newline() + "Serial number: " + szUUID + newline() + newline(); if ((bt = btopen(db.database+".trk")) <> EOF) { szText = szText + "Tags added:" + newline(); szEntry = "+" + szUUID; while(btgt(bt, szEntry, szEntry, data) >= 0) { if (match(szEntry, szUUID, 1) == 0) break; if (szEntry[0] <> '+') break; szText = szText + rtrim(szEntry) + " on " + dtoc(data & 32767); /* Ignore the low 15 bits. */ for(i = 0; i < 15; i = i + 1) { data = data / 2; data = data & 2147483647; } seconds = data mod 60; /* Convert to minutes */ data = data / 60; minutes = data mod 60; hours = data / 60; szText = szText + " " + str(hours,2,0,0) + ":" + str(minutes,2,0,'Z') + ":" + str(seconds,2,0,'Z') + " GMT" + newline(); } szText = szText + newline() + "Tags deleted:" + newline(); szEntry = "-" + szUUID; while(btgt(bt, szEntry, szEntry, data) >= 0) { if (match(szEntry, szUUID, 1) == 0) break; if (szEntry[0] <> '-') break; szText = szText + rtrim(szEntry) + " on " + dtoc(data & 32767); /* Ignore the low 15 bits. */ for(i = 0; i < 15; i = i + 1) { data = data / 2; data = data & 2147483647; } seconds = data mod 60; /* Convert to minutes */ data = data / 60; minutes = data mod 60; hours = data / 60; szText = szText + " " + str(hours,2,0,'Z') + ":" + str(minutes,2,0,'Z') + ":" + str(seconds,2,0,'Z') + " GMT" + newline(); } messageBox(szText, "Tracking file tag information.", MB_OK | MB_ICONINFORMATION); if (isfield(db, "TAGINFO")) db->TAGINFO = szText; btclose(bt); } user("Windows","Browse"); } /* main() */ abs(int d) { if (d < 0) return(d * -1); return(d); } /**************************************************************** * Name: Message * * Synopsis: Displays error message and waits for key. * ****************************************************************/ Message(text message; int wait) { text screen; int key; cursoroff(); if (wait) screen = save(5,13,8,69); box(5,13,8,69, "3D", MenuColor_); puts(6,14,pad(message,'C',53),MenuColor_); if (wait) { key = getkey(); restore(5,13,screen); } return(asc(upper(chr(key)))); } /* Message() */ /**************************************************************** * Name: FileName * * Synopsis: Trims the path from the file name. * ****************************************************************/ FileName(text name) { int i; if (i = match(name,":",1)) name = substr(name,i+1); while(i = match(name,"\",1)) name = substr(name,i+1); return(name); } /* FileName() */ /**************************************************************** * Name: Path * * Synopsis: Trims the file name from the path. * ****************************************************************/ Path(text name) { int i, j; char string[257]; string = name; if (i = match(name,":",1)) j = i; else i = j = 1; while(j = match(name,"\", i)) i = j + 1; string[i - 1] = 0; return(string); } /* Path() */ RGB(char red, grn, blu) { return(((blu & 255) * 65536) | ((grn & 255) * 256) | (red & 255)); }