www.gusucode.com > 站长俱乐部新闻发布系统精简版 1.01源码程序 > default_menu.asp
<td class="ac_menuleftbg" valign="top" height="100%"> <% 'initialise variables Repeat1__numRows = -1 Repeat1__index = 0 Category_numRows = Category_numRows + Repeat1__numRows dim myFirstRow, lowestCatID, myFirstRowTitle lowestCatID = 10000 %> <% 'print category function printCategory(indexVal) 'first category has different style dim catItemStr, printItemStr, printItemStrArray printItemStr = printItemF(indexVal,Repeat1__index) printItemStrArray = Split(printItemStr,"-") 'display if category is a link if (Category.Fields.Item("Type").Value="Link") then %> <tr><td id="catID_<%= cStr(indexVal) %>" colspan="3" class="cell2" onmouseover="this.style.background='<%= Menu_item_over_bg %>'" onmouseout="this.style.background='<%= Menu_item_bg %>'"><a href="<%= Category.Fields.Item("URL").Value %>"><img name="menu_<%= indexVal %>" src="images/spacer.gif" width="178" height="25" alt="" /><div class="text" onmouseover="this.style.color='<%= Item_Font_Color_Over %>'" onmouseout="this.style.color = '<%= Category_Font_Color %>'"><%=(Category.Fields.Item("Name").Value)%></div></a></td></tr> <% end if 'check that the array isn't empty before accessing the array items if (UBound(printItemStrArray) > -1 and Category.Fields.Item("Type").Value<>"Link") then 'category has only one item, so don't display flyout menu. also check category visibility if ((printItemStrArray(0) = "oneItem") and (Category.Fields.Item("VisibleMenu").Value="true")) then %> <tr><td id="catID_<%= cStr(indexVal) %>" colspan="3" class="cell2" onmouseover="this.style.background='<%= Menu_item_over_bg %>'" onmouseout="this.style.background='<%= Menu_item_bg %>'"><a href="#" onclick="javascript:getMenuItem('default.asp?itemID=<%= printItemStrArray(1) %>&itemTitle=<%= myFirstRowTitle %>',<%= printItemStrArray(1) %>);" onmouseout="MM_startTimeout();"><img name="menu_<%= indexVal %>" src="images/spacer.gif" width="178" height="25" alt="" /><div class="text" onmouseover="this.style.color='<%= Item_Font_Color_Over %>'" onmouseout="this.style.color = '<%= Category_Font_Color %>'"><%=(Category.Fields.Item("Name").Value)%></div></a></td></tr> <% 'category has items so generate flyout menu. also check category visibility elseif ((printItemStrArray(0) <> "") and Category.Fields.Item("VisibleMenu").Value="true") then %> <tr><td id="catID_<%= cStr(indexVal) %>" colspan="3" class="cell2" onmouseover="this.style.background='<%= Menu_item_over_bg %>'" onmouseout="this.style.background='<%= Menu_item_bg %>'"><a href="#" onclick="javascript:getMenuItem('default.asp?itemID=<%= myFirstRow %>&itemTitle=<%= myFirstRowTitle %>',<%= myFirstRow %>);" onmouseout="MM_startTimeout();" onmouseover="MM_showMenu(window.mm_menu_<%= indexVal %>,178,0,null,'menu_<%= indexVal %>');"><img name="menu_<%= indexVal %>" src="images/spacer.gif" width="178" height="25" alt="" /><div class="text" onmouseover="this.style.color='<%= Item_Font_Color_Over %>'" onmouseout="this.style.color = '<%= Category_Font_Color %>'"><%=(Category.Fields.Item("Name").Value)%></div></a></td></tr> <% end if end if end function 'returns id of first valid item in category and whether there is only one item 'returns either "id not set", "oneitem-[id]", or "[id]" function printItemF(catID,catIndex) dim JStr2, JStr3, JStr4, JStr5, rowCount, printItemNum, PpublicationCheck1, siteHomeID, siteHomeStr dim JItem, JItem_numRows, myCatID Set JItem = Server.CreateObject("ADODB.Recordset") JItem.ActiveConnection = MM_oConn_STRING myCatID = "SELECT * FROM ac_item WHERE Category_ID = " & catID & " ORDER BY VerticalPosition DESC, Title DESC" JItem.Source = myCatID JItem.CursorType = 0 JItem.CursorLocation = 2 JItem.LockType = 1 JItem.Open() JItem_numRows = 0 'dim JStr2, JStr3, JStr4, JStr5, rowCount, printItemNum, PpublicationCheck1, siteHomeID, siteHomeStr rowCount = 0 'if category has no items printItemF = "id not set" 'if category has items if (JItem.pageSize > 0) then While ((rowCount < JItem.PageSize) and (not JItem.EOF)) 'do visibility and date test dim PstrMenuVis, PstrStartDate, PstrEndDate PstrMenuVis = JItem.Fields.Item("VisibleMenu").Value PstrStartDate = JItem.Fields.Item("StartPub").Value PstrEndDate = JItem.Fields.Item("EndPub").Value PpublicationCheck1 = publicationCheck(PstrMenuVis,PstrStartDate,PstrEndDate) if (PpublicationCheck1 = "true") then JStr4 = CStr(JItem.Fields.Item("ID").Value) JStr5 = CStr(JItem.Fields.Item("Title").Value) printItemNum = JStr4 rowCount = rowCount + 1 siteHomeStr = JItem.Fields.Item("SiteHome").Value if siteHomeStr="true" then siteHomeID = JStr4 end if end if JItem.MoveNext() Wend end if 'if there is only one link return a one item value if (rowCount<2 and rowCount>0) then printItemF = "oneItem-" & printItemNum myFirstRowTitle = Replace(JStr5,"'","") else printItemF = JStr4 myFirstRowTitle = Replace(JStr5,"'","") end if myFirstRow = printItemF 'set default home as first menu item if catID<lowestCatID then lowestCatID = catID Session("myDefaultPage") = JStr4 end if 'set default homepage if item is tagges as SiteHome if (siteHomeID<>"") then Session("myDefaultPage") = siteHomeID end if JItem.Close() end function %> <!-- start menu heading --> <table border="0" cellpadding="0" cellspacing="0" width="188"> <% if ((name="Skin" or name="Acidcat_2") and headingVisibility <> false) then dim Heading_left_image, Heading_right_image %> <tr> <td><img src="admin/<%= Heading_left_image %>" width="16" height="30" alt="" /></td> <td class="ac_header_text_menu"><%= lang_admin_menu_003 %></td> <td><img src="admin/<%= Heading_right_image %>" width="16" height="30" alt="" /></td> </tr> <% elseif ((name="Skin" or name="Acidcat_2") and headingVisibility = false) then %> <tr><td></td></tr> <% elseif headingVisibility <> false then %> <tr> <td><img src="admin/images/heading_<%= Name %>_1.gif" width="16" height="30" alt="" /></td> <td class="ac_header_text_menu"><%= lang_admin_menu_003 %></td> <td><img src="admin/images/heading_<%= Name %>_3.gif" width="16" height="30" alt="" /></td> </tr> <% end if %> </table> <!-- end menu heading --> <!-- start menu --> <table border="0" cellpadding="0" cellspacing="0" width="156" class="table2"> <% While ((Repeat1__numRows <> 0) and (not Category.EOF)) printCategory(Category.Fields.Item("ID").Value) Repeat1__index = Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Category.MoveNext() Wend %> </table> <!-- start menu --> <!-- start space below menu --> <table border="0" cellpadding="0" cellspacing="0" width="156" class="ac_table3"> <tr><td colspan="3" class="ac_menuleftbgbottom"> </td></tr> </table> <!-- end space below menu -->