<?php
/**
 * 菜單地圖
 *
 * @version        $Id: inc_menu_map.php 1 10:32 2010年7月21日Z tianya $
 * @package        DedeCMS.Administrator
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
require_once(dirname(__FILE__)."/../config.php");

$maparray = array(1=>'文檔相關',2=>'系統設置',3=>'必須輔助功能',4=>'網站更新操作',5=>'會員相關',6=>'基本模塊插件');

//載入可發佈頻道
$addset = '';

//檢測可用的內容模型
if($cfg_admin_channel = 'array' && count($admin_catalogs) > 0)
{
    $admin_catalog = join(',', $admin_catalogs);
    $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` WHERE id IN({$admin_catalog}) GROUP BY channeltype ");
}
else
{
    $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` GROUP BY channeltype ");
}
$dsql->Execute();
$candoChannel = '';
while($row = $dsql->GetObject())
{
    $candoChannel .= ($candoChannel=='' ? $row->channeltype : ','.$row->channeltype);
}
if(empty($candoChannel)) $candoChannel = 1;
$dsql->SetQuery("SELECT id,typename,addcon,mancon FROM `#@__channeltype` WHERE id IN({$candoChannel}) AND id<>-1 AND isshow=1 ORDER BY id ASC");
$dsql->Execute();
while($row = $dsql->GetObject())
{
    $addset .= "  <m:item name='{$row->typename}' ischannel='1' link='{$row->mancon}?channelid={$row->id}' linkadd='{$row->addcon}?channelid={$row->id}' channelid='{$row->id}' rank='' target='main' />\r\n";
}
//////////////////////////
$menusMain = "
-----------------------------------------------

<m:top mapitem='1' item='1_' name='常用操作' display='block'>
  <m:item name='網站欄目管理' link='catalog_main.php' ischannel='1' addalt='創建欄目' linkadd='catalog_add.php?listtype=all' rank='t_List,t_AccList' target='main' />
  <m:item name='所有檔案列表' link='content_list.php' rank='a_List,a_AccList' target='main' />
  <m:item name='等審核的檔案' link='content_list.php?arcrank=-1' rank='a_Check,a_AccCheck' target='main' />
  <m:item name='我發佈的文檔' link='content_list.php?mid=".$cuserLogin->getUserID()."' rank='a_List,a_AccList,a_MyList' target='main' />
  <m:item name='評論管理' link='feedback_main.php' rank='sys_Feedback' target='main' />
  <m:item name='內容回收站' link='recycling.php' ischannel='1' addalt='清空回收站' addico='img/gtk-del.png' linkadd='archives_do.php?dopost=clear&aid=no' rank='a_List' target='main' />
</m:top>

<m:top mapitem='1' item='1_' name='內容管理' display='block'>
  $addset
  <m:item name='專題管理' ischannel='1' link='content_s_list.php' linkadd='spec_add.php' channelid='-1' rank='spec_New' target='main' />
</m:top>

<m:top mapitem='1' item='1_' name='頻道模型' display='block' rank='t_List,t_AccList,c_List,temp_One'>
  <m:item name='內容模型管理' link='mychannel_main.php' rank='c_List' target='main' />
  <m:item name='單頁文檔管理' link='templets_one.php' rank='temp_One' target='main'/>
  <m:item name='聯動類別管理' link='stepselect_main.php' rank='c_Stepseclect' target='main' />
  <m:item name='自由列表管理' link='freelist_main.php' rank='c_List' target='main' />
  <m:item name='自定義表單' link='diy_main.php' rank='c_List' target='main' />
</m:top>

<m:top mapitem='3' item='3_' name='採集管理' display='none' rank='co_NewRule,co_ListNote,co_ViewNote,co_Switch,co_GetOut'>
  <m:item name='採集節點管理' link='co_main.php' rank='co_ListNote' target='main' />
  <m:item name='臨時內容管理' link='co_url.php' rank='co_ViewNote' target='main' />
  <m:item name='導入採集規則' link='co_get_corule.php' rank='co_GetOut' target='main'/>
  <m:item name='監控採集模式' link='co_gather_start.php' rank='co_GetOut' target='main'/>
  <m:item name='採集未下載內容' link='co_do.php?dopost=coall' rank='co_GetOut' target='main'/>
</m:top>

<m:top mapitem='3' item='1_3_3' name='批量維護' display='block'>
  <m:item name='更新系統緩存' link='sys_cache_up.php' rank='sys_ArcBatch' target='main' />
  <m:item name='文檔批量維護' link='content_batch_up.php' rank='sys_ArcBatch' target='main' />
  <m:item name='搜索關鍵詞維護' link='search_keywords_main.php' rank='sys_Keyword' target='main' />
  <m:item name='文檔關鍵詞維護' link='article_keywords_main.php' rank='sys_Keyword' target='main' />
  <m:item name='自動摘要|分頁' link='article_description_main.php' rank='sys_Keyword' target='main' />
  <m:item name='TAG標籤管理' link='tags_main.php' rank='sys_Keyword' target='main' />
  <m:item name='數據庫內容替換' link='sys_data_replace.php' rank='sys_ArcBatch' target='main' />
</m:top>

<m:top mapitem='4' item='5_' name='自動任務' notshowall='1'  display='block' rank='sys_MakeHtml'>
  <m:item name='一鍵更新網站' link='makehtml_all.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新系統緩存' link='sys_cache_up.php' rank='sys_ArcBatch' target='main' />
</m:top>

<m:top mapitem='4' item='5_' name='HTML更新' notshowall='1' display='none' rank='sys_MakeHtml'>
  <m:item name='更新主頁HTML' link='makehtml_homepage.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新欄目HTML' link='makehtml_list.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新文檔HTML' link='makehtml_archives.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新網站地圖' link='makehtml_map_guide.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新RSS文件' link='makehtml_rss.php' rank='sys_MakeHtml' target='main' />
  <m:item name='獲取JS文件' link='makehtml_js.php' rank='sys_MakeHtml' target='main' />
  <m:item name='更新專題HTML' link='makehtml_spec.php' rank='sys_MakeHtml' target='main' />
</m:top>

<m:top mapitem='3' item='1_6_' name='附件管理' display='none' rank='sys_Upload,sys_MyUpload,plus_文件管理器'>
  <m:item name='上傳新文件' link='media_add.php' rank='' target='main' />
  <m:item name='附件數據管理' link='media_main.php' rank='sys_Upload,sys_MyUpload' target='main' />
  <m:item name='文件式管理器' link='media_main.php?dopost=filemanager' rank='plus_文件管理器' target='main' />
</m:top>

<m:top mapitem='5' item='6_' name='會員管理' display='none' rank='member_List,member_Type'>
  <m:item name='註冊會員列表' link='member_main.php' rank='member_List' target='main' />
  <m:item name='會員級別設置' link='member_rank.php' rank='member_Type' target='main' />
  <m:item name='積分頭銜設置' link='member_scores.php' rank='member_Type' target='main' />
  <m:item name='會員模型管理' link='member_model_main.php' rank='member_Type' target='main' />
  <m:item name='會員短信管理' link='member_pm.php' rank='member_Type' target='main' />
  <m:item name='會員留言管理' link='member_guestbook.php' rank='member_Type' target='main' />
  <m:item name='會員動態管理' link='member_info_main.php?type=feed' rank='member_Type' target='main' />
  <m:item name='會員心情管理' link='member_info_main.php?type=mood' rank='member_Type' target='main' />
</m:top>

<m:top mapitem='2' item='10_' name='系統設置' display='none' rank='sys_User,sys_Group,sys_Edit,sys_Log,sys_Data'>
  <m:item name='系統基本參數' link='sys_info.php' rank='sys_Edit' target='main' />
  <m:item name='系統用戶管理' link='sys_admin_user.php' rank='sys_User' target='main' />
  <m:item name='用戶組設定' link='sys_group.php' rank='sys_Group' target='main' />
  <m:item name='服務器分佈/遠程' link='sys_multiserv.php' rank='sys_Group' target='main' />
  <m:item name='系統日誌管理' link='log_list.php' rank='sys_Log' target='main' />
  <m:item name='驗證安全設置' link='sys_safe.php' rank='sys_verify' target='main' />
  <m:item name='圖片水印設置' link='sys_info_mark.php' rank='sys_Edit' target='main' />
  <m:item name='自定義文檔屬性' link='content_att.php' rank='sys_Att' target='main' />
  <m:item name='軟件頻道設置' link='soft_config.php' rank='sys_SoftConfig' target='main' />
  <m:item name='防採集串混淆' link='article_string_mix.php' rank='sys_StringMix' target='main' />
  <m:item name='隨機模板設置' link='article_template_rand.php' rank='sys_StringMix' target='main' />
  <m:item name='計劃任務管理' link='sys_task.php' rank='sys_Task' target='main' />
  <m:item name='數據庫備份/還原' link='sys_data.php' rank='sys_Data' target='main' />
  <m:item name='SQL命令行工具' link='sys_sql_query.php' rank='sys_Data' target='main' />
  <m:item name='文件校驗[S]' link='sys_verifies.php' rank='sys_verify' target='main' />
  <m:item name='病毒掃瞄[S]' link='sys_safetest.php' rank='sys_verify' target='main' />
  <m:item name='系統錯誤修復[S]' link='sys_repair.php' rank='sys_verify' target='main' />
</m:top>

<m:top mapitem='5' item='10_6_' name='支付工具' display='none' rank='sys_Data'>
  <m:item name='點卡產品分類' link='cards_type.php' rank='sys_Data' target='main' />
  <m:item name='點卡產品管理' link='cards_manage.php' rank='sys_Data' target='main' />
  <m:item name='會員產品分類' link='member_type.php' rank='sys_Data' target='main' />
  <m:item name='會員消費記錄' link='member_operations.php' rank='sys_Data' target='main' />
  <m:item name='商店訂單記錄' link='shops_operations.php' rank='sys_Data' target='main' />
  <m:item name='支付接口設置' link='sys_payment.php' .php' rank='sys_Data' target='main' />
  <m:item name='配貨方式設置' link='shops_delivery.php' rank='sys_Data' target='main' />
</m:top>

<m:top mapitem='2' item='10_7_' name='模板管理' display='none' rank='temp_One,temp_Other,temp_MyTag,temp_test,temp_All'>
  <m:item name='默認模板管理' link='templets_main.php' rank='temp_All' target='main'/>
  <m:item name='標籤源碼管理' link='templets_tagsource.php' rank='temp_All' target='main'/>
  <m:item name='自定義宏標記' link='mytag_main.php' rank='temp_MyTag' target='main'/>
  <m:item name='智能標記嚮導' link='mytag_tag_guide.php' rank='temp_Other' target='main'/>
  <m:item name='全局標記測試' link='tag_test.php' rank='temp_Test' target='main'/>
</m:top>

";

//載入插件菜單
$plusset = '';
$dsql->SetQuery("SELECT * FROM `#@__plus` WHERE isshow=1 ORDER BY aid ASC");
$dsql->Execute();
while($row = $dsql->GetObject()) 
{
    $plusset .= $row->menustring."\r\n";
}

$menusMain .= "
<m:top mapitem='6' name='模塊管理' c='6,' display='block'>
  <m:item name='模塊管理' link='module_main.php' rank='sys_module' target='main' />
  <m:item name='上傳新模塊' link='module_upload.php' rank='sys_module' target='main' />
  <m:item name='模塊生成嚮導' link='module_make.php' rank='sys_module' target='main' />
</m:top>

<m:top mapitem='6' item='7' name='輔助插件' display='block'>
  <m:item name='插件管理器' link='plus_main.php' rank='10' target='main' />
  $plusset
</m:top>
";

$mapstring = '';
$dtp = new DedeTagparse();
$dtp->SetNameSpace('m','<','>');
$dtp->LoadString($menusMain);

foreach($maparray as $k=>$bigname)
{
    $mapstring .= "<dl class='maptop'>\r\n";
    $mapstring .= "<dt class='bigitem'>$bigname</dt>\r\n";
    $mapstring .= "<dd>\r\n";
    foreach($dtp->CTags as $ctag)
    {
        if($ctag->GetAtt('mapitem') == $k)
        {
            $mapstring .= "<dl class='mapitem'>\r\n";
            $mapstring .= "<dt>".$ctag->GetAtt('name')."</dt>\r\n";
            $mapstring .= "<dd>\r\n<ul class='item'>\r\n";
            $dtp2 = new DedeTagParse();
            $dtp2->SetNameSpace('m', '<', '>');
            $dtp2->LoadSource($ctag->InnerText);
            foreach($dtp2->CTags as $j=>$ctag2)
            {
                $mapstring .= "<li><a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a></li>\r\n";
            }
            $mapstring .= "</ul>\r\n</dd>\r\n</dl>\r\n";
        }
    }
    $mapstring .= "</dd>\r\n</dl>\r\n";
}