Category=Documents
Name=Show Document Pages
Description=This script shows all document pages

Heading=Select a document
SQL=SELECT * FROM DOCUMENT
LinkColumn=DOCUMENTID
Heading2=Select a Page to View Surrogates
LinkColumn2=PAGEID
SQL2=SELECT T2.*, T4.*, T5.* FROM ( SELECT S1.DOCUMENTID, S1.PAGEID, min(S2.SHELFID) as FIRSTSHELFID FROM PAGE S1 LEFT OUTER JOIN SHELFINSTANCEPAGES S2 ON (S1.DOCUMENTID=S2.DOCUMENTID and S1.PAGEID=S2.PAGEID) GROUP BY DOCUMENTID,PAGEID) T1 JOIN PAGE T2 ON (T1.DOCUMENTID=T2.DOCUMENTID and T1.PAGEID=T2.PAGEID) LEFT OUTER JOIN SHELFINSTANCE T4 ON T4.SHELFID=T1.FIRSTSHELFID LEFT OUTER JOIN INSTITUTION T5 ON T5.INSTITUTIONID=T4.INSTITUTIONID WHERE T1.DOCUMENTID={0} ORDER BY T2.SORTORDER
SQL3=SELECT concat('<a href="',SURROGATEURI,'"><img src="',THUMBNAILURI,'"/></a>') FROM SURROGATEIMAGE WHERE DOCUMENTID={1} and PAGEID={0}
SQL4=SELECT concat('<a href="',SURROGATEURI,'">Transcription</a>') FROM SURROGATETRANSCRIPTION WHERE DOCUMENTID={1} and PAGEID={0}
