www.gusucode.com > 站长俱乐部新闻发布系统精简版 1.01源码程序 > admin/admin_menu.asp
<script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <% dim Repeat1__numRows, Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 Category_numRows = Category_numRows + Repeat1__numRows dim Repeat2__numRows, Repeat2__index Repeat2__numRows = -1 Repeat2__index = 0 Item_numRows = Item_numRows + Repeat2__numRows 'print menu items text, edit icon and delete icon sub printItem() %> <tr> <% 'normal page link if (Item.Fields.Item("Type").Value="Page") then %> <% 'administrator and editor rights if ((Session("MM_UserAuthorization") = 1) OR (Session("MM_UserAuthorization") = 2)) then %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><a href="#" onclick="javascript:getMenuItem('admin_item_edit.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/document_edit.gif" name="e<%=(Item.Fields.Item("ID").Value)%>e" width="16" height="16" id="e<%=(Item.Fields.Item("ID").Value)%>e" onmouseover="MM_swapImage('e<%=(Item.Fields.Item("ID").Value)%>e','','icons/document_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcelladmin_r"><a href="#" onclick="javascript:getMenuItem('admin_item_delete.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/garbage.gif" name="d<%=(Item.Fields.Item("ID").Value)%>d" width="16" height="16" id="d<%=(Item.Fields.Item("ID").Value)%>d" onmouseover="MM_swapImage('d<%=(Item.Fields.Item("ID").Value)%>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% 'publisher rights elseif (Session("MM_UserAuthorization") = 3) then %> <% 'if publisher created page, allow editing if (Item.Fields.Item("User_ID").Value) = (Session("MM_UserID")) then %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><a href="#" onclick="javascript:getMenuItem('admin_item_edit.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/document_edit.gif" name="e<%=(Item.Fields.Item("ID").Value)%>e" width="16" height="16" id="e<%=(Item.Fields.Item("ID").Value)%>e" onmouseover="MM_swapImage('e<%=(Item.Fields.Item("ID").Value)%>e','','icons/document_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcelladmin_r"><a href="#" onclick="javascript:getMenuItem('admin_item_delete.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/garbage.gif" name="d<%=(Item.Fields.Item("ID").Value)%>d" width="16" height="16" id="d<%=(Item.Fields.Item("ID").Value)%>d" onmouseover="MM_swapImage('d<%=(Item.Fields.Item("ID").Value)%>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% 'if not publisher view only else %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><img src="images/blank.gif" width="16" height="16"></td> <td width="19" class="menuleftcelladmin_r"> </td> <% end if %> <% end if %> <% 'link to external page elseif (Item.Fields.Item("Type").Value="Link") or (Item.Fields.Item("Type").Value="Iframe") or (Item.Fields.Item("Type").Value="rss") then %> <% 'administrator and editor rights if ((Session("MM_UserAuthorization") = 1) OR (Session("MM_UserAuthorization") = 2)) then %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><a href="#" onclick="javascript:getMenuItem('admin_item_edit_link.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/document_edit.gif" name="e<%=(Item.Fields.Item("ID").Value)%>e" width="16" height="16" id="e<%=(Item.Fields.Item("ID").Value)%>e" onmouseover="MM_swapImage('e<%=(Item.Fields.Item("ID").Value)%>e','','icons/document_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcelladmin_r"><a href="#" onclick="javascript:getMenuItem('admin_item_delete.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/garbage.gif" name="d<%=(Item.Fields.Item("ID").Value)%>d" width="16" height="16" id="d<%=(Item.Fields.Item("ID").Value)%>d" onmouseover="MM_swapImage('d<%=(Item.Fields.Item("ID").Value)%>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% 'publisher rights elseif (Session("MM_UserAuthorization") = 3) then %> <% 'if publisher created link, allow editing if (Item.Fields.Item("User_ID").Value) = (Session("MM_UserID")) then %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><a href="#" onclick="javascript:getMenuItem('admin_item_edit_link.asp',<%=(Item.Fields.Item("ID").Value)%>);"><img src="icons/document_edit.gif" name="e<%=(Item.Fields.Item("ID").Value)%>e" width="16" height="16" id="e<%=(Item.Fields.Item("ID").Value)%>e" onmouseover="MM_swapImage('e<%=(Item.Fields.Item("ID").Value)%>e','','icons/document_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcelladmin_r"><a href="admin_item_delete.asp?ID=<%=(Item.Fields.Item("ID").Value)%>"><img src="icons/garbage.gif" name="d<%=(Item.Fields.Item("ID").Value)%>d" width="16" height="16" id="d<%=(Item.Fields.Item("ID").Value)%>d" onmouseover="MM_swapImage('d<%=(Item.Fields.Item("ID").Value)%>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% 'if not publisher view only else %> <td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_main.asp',<%=(Item.Fields.Item("ID").Value)%>);"><%=(Item.Fields.Item("Title").Value)%></a></td> <td width="19" class="menuleftcelladmin"><img src="images/blank.gif" width="16" height="16"></td> <td width="19" class="menuleftcelladmin_r"> </td> <% end if %> <% end if %> <% end if %> </tr> <% end sub %> <form name="form1" method="post" action=""> <table border="0" cellspacing="0"> <tr><td colspan="4"><img src="images/blank.gif" width="100" height="6" alt="" /></td></tr> <tr> <td><img src="<%= imageLeft %>" width="16" height="30" border="0" alt="" /></td> <td colspan="1" class="menu_header_icon"><img src="icons/window_sidebar_24.gif" width="24" height="24" border="0" alt="" /></td> <td class="menu_header_text"> <%= lang_admin_menu_003 %></td> <td><img src="<%= imageRight %>" width="16" height="30" border="0" alt="" /></td> </tr> </table> <table class="menuleftadmin"> <% 'loop through categories While ((Repeat1__numRows <> 0) and (not Category.EOF)) dim myCat, myCatID 'fix problem with displaying apostrophes myCat = Category.Fields.Item("Name").Value myCat = Replace(myCat,"'","x") myCatID = Category.Fields.Item("ID").Value %> <% 'normal category containing items if (Category.Fields.Item("Type").Value="Normal") then %> <tr> <td class="cellheaderleftadmin"><a href="#" onclick="javascript:getMenuItem('admin_cat_view.asp',<%=(Category.Fields.Item("ID").Value)%>);"><%= Category.Fields.Item("Name").Value %></a></td> <% if ((Session("MM_UserAuthorization") = 1) OR (Session("MM_UserAuthorization") = 2)) then %> <td width="19" class="menuleftcellheaderadmin"><a href="#" onclick="javascript:getMenuItem('admin_cat_edit.asp',<%=(Category.Fields.Item("ID").Value)%>);"><img src="icons/window_edit.gif" name="c<%= myCatID %>e" width="16" height="16" id="c<%= myCatID %>e" onmouseover="MM_swapImage('c<%= myCatID %>e','','icons/window_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcellheaderadmin_r"><a href="#" onclick="javascript:getMenuItem('admin_cat_delete.asp',<%=(Category.Fields.Item("ID").Value)%>);"><img src="icons/garbage.gif" name="c<%= myCatID %>d" width="16" height="16" id="c<%= myCatID %>d" onmouseover="MM_swapImage('c<%= myCatID %>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% else %> <td width="19" class="menuleftcellheaderadmin"><img src="images/blank.gif" width="16" height="16"></td> <td width="19" class="menuleftcellheaderadmin_r"></td> <% end if %> </tr> <% 'category that is a link elseif (Category.Fields.Item("Type").Value="Link") then %> <tr> <td class="cellheaderleftadmin"><a href="#" onclick="javascript:getMenuItem('admin_cat_view.asp',<%=(Category.Fields.Item("ID").Value)%>);"><%= Category.Fields.Item("Name").Value %></a></td> <% 'administrator and editor rights if ((Session("MM_UserAuthorization") = 1) OR (Session("MM_UserAuthorization") = 2)) then %> <td width="19" class="menuleftcellheaderadmin"><a href="#" onclick="javascript:getMenuItem('admin_cat_edit_link.asp',<%=(Category.Fields.Item("ID").Value)%>);"><img src="icons/window_edit.gif" name="c<%= myCatID %>e" width="16" height="16" id="<%= myCat %>e" onmouseover="MM_swapImage('c<%= myCatID %>e','','icons/window_edit_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_001 %>" /></a></td> <td width="19" class="menuleftcellheaderadmin_r"><a href="#" onclick="javascript:getMenuItem('admin_cat_delete.asp',<%=(Category.Fields.Item("ID").Value)%>);"><img src="icons/garbage.gif" name="c<%= myCatID %>d" width="16" height="16" id="<%= myCat %>d" onmouseover="MM_swapImage('c<%= myCatID %>d','','icons/garbage_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_002 %>" /></a></td> <% 'if publisher view only else %> <td width="19" class="menuleftcellheaderadmin"><img src="images/blank.gif" width="16" height="16"></td> <td width="19" class="menuleftcellheaderadmin_r"></td> <% end if %> </tr> <% end if %> <% dim Item, Item_numRows, LeftHasCategory set Item = Server.CreateObject("ADODB.Recordset") Item.ActiveConnection = MM_oConn_STRING Item.Source = "SELECT * FROM ac_item WHERE Category_ID = " & Category.Fields.Item("ID").Value & " ORDER BY VerticalPosition ASC, Title ASC" Item.CursorType = 0 Item.CursorLocation = 2 Item.LockType = 1 Item.Open() Item_numRows = 0 LeftHasCategory = 0 %> <% While ((Repeat2__numRows <> 0) and (not Item.EOF)) LeftHasCategory = 1 printItem() Repeat2__index = Repeat2__index+1 Repeat2__numRows=Repeat2__numRows-1 Item.MoveNext() Wend %> <% 'add item if (Category.Fields.Item("Type").Value<>"Link") then %> <tr><td class="outadmin"><a href="#" onclick="javascript:getMenuItem('admin_item_add_pre.asp',<%=(Category.Fields.Item("ID").Value)%>);">+ <%= lang_admin_menu_004 %></a> </td> <td width="19" class="menuleftcelladmin"><a href="#" onclick="javascript:getMenuItem('admin_item_add_pre.asp',<%=(Category.Fields.Item("ID").Value)%>);"><img src="icons/document_add.gif" name="c<%= myCatID %>ie" width="16" height="16" id="c<%= myCatID %>ie" onmouseover="MM_swapImage('c<%= myCatID %>ie','','icons/document_add_shadow.gif',1)" onmouseout="MM_swapImgRestore()" alt="<%= lang_admin_menu_004 %>" /></a></td> <td width="19" class="menuleftcelladmin_r"> </td></tr> <% end if %> <% Repeat1__index = Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Category.MoveNext() Wend %> </table> <% if (LeftHasCategory > 0) then Item.Close() end if %> <% 'add category if ((Session("MM_UserAuthorization") = 1) OR (Session("MM_UserAuthorization") = 2)) then %> <table class="menuleftadmin"> <td width="19" class="menuleftcellheaderadmin_r"><img src="images/blank.gif" width="16" height="16" alt=""></td></tr> </table> <% else %> <table class="menuleftadmin"> <tr><td class="cellheaderleftadmintype3" colspan="3"></td></tr> </table> <% end if %> </form> <br />