<%@ LANGUAGE="Javascript" CODEPAGE="1255"%> <%=HTMLTag()%> <% // ********* VARIABLES FROM REQUEST OBJECT ************ // wanted category. var iCatId = (parseInt(Request.QueryString("cat")()))?(parseInt(Request.QueryString("cat")())):(5); // wanted status ("completed", "cancelled", "future" etc.) var strStatus = (Request.QueryString("status")())?(Request.QueryString("status")()):("completed"); // wanted order criterion, to order by ("name","endyear", "status", "height" etc.) var strOrderBy; var arrOrderBy = ["name","height", "status","endyear","description","lastupdate", "use"]; if ((Request.QueryString("orderby")())&&(arrOrderBy.indexOf(Request.QueryString("orderby")())>-1)){ // wanted order critetion is valid strOrderBy = Request.QueryString("orderby")(); } else { // if wanted order critetion isn't valid (inc. empty) if (iCatId==1){strOrderBy = "height"; strOrder = "desc";} else {strOrderBy = "name";} } // wanted order (ascending or descending) var strOrder if (Request.QueryString("order")()) {strOrder=Request.QueryString("order")();} else { if (strOrderBy=="height"){strOrder = "desc"} else {strOrder = "asc"} }; // wanted page number. var iPage = (parseInt(Request.QueryString("page")()))?(parseInt(Request.QueryString("page")())):(1); // taking care of page size according to querystring and cookies. var iPageSize; var arrPageSizes = [8, 12, 20, 40]; if ((parseInt(Request.QueryString("pagesize")()))&&(arrPageSizes.indexOf(Request.QueryString("pagesize")())>-1)) { // wanted page size is valid iPageSize = parseInt(Request.QueryString("pagesize")()); if(iPageSize!=parseInt(Request.Cookies("Tainf")("PreferredInfoItemsPageSize"))) /* save wanted page size as cookie*/ {Response.Cookies("Tainf")("PreferredInfoItemsPageSize")=iPageSize; Response.Cookies("Tainf").Expires="18/01/2038";} } else { // if wanted page size isn't valid (inc. empty) if(parseInt(Request.Cookies("Tainf")("PreferredInfoItemsPageSize"))) /*load wanted page size from cookie */{iPageSize=parseInt(Request.Cookies("Tainf")("PreferredInfoItemsPageSize"));} else {iPageSize = 12;} } var iLastItemId = 0; var iLastItemFatherId = 0; var iPageCount; var lstCriteriaList = GetCriteriaList(iCatId, strStatus); var arrImgDimensions; // ************************************************************************* // ******************** DB RETRIEVAL ******************************* var strSql; var strSql2; var conn = Server.CreateObject("ADODB.Connection"); var rs = Server.CreateObject("ADODB.Recordset"); var rs2 = Server.CreateObject("ADODB.Recordset"); conn.Open(strConn); %> <%Response.Write((PageTitle()?(PageTitle()+" - "):("")) + SiteName())%>

<% if (((iCatId==3)&&(strStatus=="completed"))||((iCatId==4)&&(strStatus=="completed"))) { Response.write(PageTitle()); } else { Response.write(""); } %>

<%=PageDescription()%>

<% WriteLinksToAlternativePages(); WriteLastUpdatedItems(); // get Query from external file strSql = "SELECT "; // Item Id strSql+= " [Info_Items.ItemId]"; //Father Id strSql+= ", [Info_Items.FatherId]"; //Item's name in current language strSql+= ", [Info_Items."+strLang+"Name]"; // the last date when this item has been updated strSql+= ", [Info_Items.LastUpdate]"; // additional fields to retrieve according to out criterias strSql+= AdditionalFieldsToRetrieve(); strSql+= " FROM " strSql+= TablesToRetrieve(); strSql+= " WHERE" // category selection strSql+= " (Info_Items.CatId="+iCatId+")"; // only children items /*strSql+= " AND (SELECT COUNT(ItemId) FROM Info_Items AS Info_Items2"; strSql+= " WHERE Info_Items2.FatherId=Info_Items.ItemId) = 0";*/ // with the corresponding status strSql+= " AND (Info_Items.StatusId IN ("+FindStatusesToRetrieve(strStatus)+"))"; strSql+= AdditionalConditions(); // order by strSql+= " ORDER BY Info_Items.ItemId"+((lstCriteriaList.indexOf("use")>-1)?(", Building_Uses."+strLang+"Name"):("")); //Response.Write("

"+strSql+"

"); // open connection to Db and Execute query. rs.CursorLocation = 3; rs.LockType = 4; rs.CursorType = 3; rs.open(strSql, conn); if (!rs.EOF) //if items were found { RemoveDoubleItems(); rs.Sort = OrderToRetrieve(strOrderBy, strOrder); // SERVER-SIDE PAGING rs.PageSize = iPageSize; iPageCount = rs.PageCount; if (iPage<1) {iPage=1}; if (iPage > iPageCount) {iPage= iPageCount}; rs.AbsolutePage = iPage; %>
<%=HebOrEng("סדר לפי:","Order By:")%>
<% PrintNavTools();%>
<% Response.Write(""); CreateHeaders(); while ((rs.AbsolutePage==iPage)&&(!rs.EOF)) { iLastItemId=rs("Info_Items.ItemId").value; iLastItemFatherId=rs("Info_Items.FatherId").value; CreateAndFillInfoItemRow(); rs.MoveNext(); } %>

<% PrintNavTools(); %>
<% // delete db objects. delete rs2; rs2 = null; rs.close(); delete rs; rs = null; conn.close(); delete conn; conn = null; } else //no items were found { // delete db objects. rs.close(); delete rs; conn.close(); delete conn; %> <%=HebOrEng("פריטים לא נמצאו","Items not found.")%> <% Response.end(); } // ************************************************************************* %>