Welcome to the Photo Gallery Demo, built with WebSnap!


<% data = Modules.PhotoData; // shortcut to the data module PicturesIterator = data.PicturesIterator; Categories = data.Categories; VoteAdapter = data.VoteAdapter; viewMode = PicturesIterator.ViewMode.Value; %>
<% // If the iterator PicturesIterator. raises any errors, it // will not "announce" them on top. This will force them // on top. picture = new Enumerator(PicturesIterator.Records); // Display server-side errors that may have occured. var e = new Enumerator(PicturesIterator.Errors) if (!e.atEnd()) Response.Write('

The following error(s) happened:'); for (; !e.atEnd(); e.moveNext()) Response.Write('

  • ' + e.item().Message) function roundIt(number,X) { // rounds number to X decimal places, defaults to 1 X = (!X ? 1 : X); return Math.round(number*Math.pow(10,X))/Math.pow(10,X); } function formatBytes(b) { if (Math.round(10*b/1024/1024) > 10) return roundIt(b/1024/1024) + ' MB'; // MB else if (Math.round(10*b/1024) > 10) return roundIt(b/1024) + ' KB'; //KB else return b + ' bytes'; } %> <% count = 0; i = 1; for (; !picture.atEnd(); !picture.moveNext()) { count++ %> <% if (i % PicturesIterator.MaxPicsPerRow.Value == 0) { %> <% } i++ } %>
    Category: <%=PicturesIterator.CAT_NAME.DisplayText%>    ID: <%=PicturesIterator.IMG_ID.DisplayText%>
    <%=PicturesIterator.IMG_TITLE.DisplayText%>


    <%=PicturesIterator.IMG_DATE.DisplayText%>
    <%=PicturesIterator.IMG_DESCRIPTION.DisplayText%>
    Rating: <%=PicturesIterator.ActualRating.Value%> [<%=PicturesIterator.IMG_VOTE_COUNT.DisplayText%> votes] Views: <%=PicturesIterator.IMG_VIEW_COUNT.Value%>
    Size: <%=formatBytes(PicturesIterator.IMG_SIZE.Value)%>
    <% vVote = VoteAdapter.VoteForPicture; vNewVote = VoteAdapter.NewVote; if (vVote.Enabled) { for (j = 1; j < 6; j++) Response.Write(' ' + j); %> <% } %>

    <% vDel = PicturesIterator.DeletePicture; if (vDel.Enabled) { %> <% } %>

    <% if (count == 0) Response.Write('You have no pictures - first upload some pictures, or view all pictures'); else if (count > 0) { var picGoto = PicturesIterator.GotoPage; var count = 0; var e = new Enumerator(picGoto.Array) if (!e.atEnd()) Response.Write('Page '); for (; !e.atEnd(); e.moveNext()) { if (count != 0) Response.Write(' | '); if (picGoto.Enabled) { %> <%=picGoto.DisplayLabel%> <% } else {%> <%=picGoto.DisplayLabel%> <%} count++; } } %>