📄 正在查看:admin/view/default/theme_index.htm
大小:3,512 字节 · 修改:2014-01-24 01:15:24 · 行数:117
1{inc:header.htm}
2
3<div class="m">
4 <div class="head">
5 <dl>
6 <dd class="on">主题管理</dd>
7 <dd>在线获取</dd>
8 </dl>
9 </div>
10
11 <div class="p c2">
12 <div class="cc" style="padding-top:0">
13 {if:!$themes}
14 <div class="sky warning bnote"><i></i><b>暂无主题</b></div>
15 {else}
16 {loop:$themes $v $k}
17 {php} $enable = ($k == $theme); {/php}
18 <div class="thm{if:$enable} thmon{/if}">
19 <div class="to">
20 <p class="tu" style="background:url(../{$core}/view/{$k}/show.jpg)"></p>
21 <p class="full"><b>版本号:{$v[version]}</b><b>更新于:{$v[update]}</b>{$v[brief]}</p>
22 </div>
23 <h1>{$v[name]}({$k})</h1>
24 <p class="author">作者: <a target="_blank" href="{$v[authorurl]}">{$v[author]}</a></p>
25 <p class="gsm" theme="{$k}">
26 {if:$enable}<b>当前使用</b>{else}<a class="enable but2">启用</a><a class="del but2">删除</a>{/if}
27 </p>
28 </div>
29 {/loop}
30 {/if}
31 </div>
32 <div class="cc un" id="twcms_app">
33 <div class="sky warning bnote"><i></i><b>玩命加载中<font id="loading">...</font></b></div>
34 </div>
35 </div>
36</div>
37<script type="text/javascript">
38function load() {
39 $(".gsm>a").attr("href","javascript:;");
40
41 $(".thm").off("hover").hover(function(){
42 $(this).addClass("thm_x");
43 }, function(){
44 $(this).removeClass("thm_x");
45 });
46
47 $(".to").off("hover").hover(function(){
48 $(this).children(".tu").hide();
49 $(this).children(".full").show();
50 },function(){
51 $(this).children(".tu").show();
52 $(this).children(".full").hide();
53 });
54 //启用
55 $(".enable").off("click").click(function(){ enable($(this).parent().attr("theme")); });
56
57 //删除
58 $(".del").off("click").click(function(){
59 var theme = $(this).parent().attr("theme");
60 twAjax.confirm("删除不可恢复,确定删除“<font color='red'>"+$(this).parent().parent().children("h1").html()+"</font>”?", function(){
61 twAjax.postd("index.php?u=theme-delete-ajax-1", {"theme" : theme}, function(data){
62 window.twErr = true;
63 twAjax.alert(data);
64 $(".ajaxtips u").click(function(){window.location.reload();});
65 if(window.twData.err==0) setTimeout(function(){window.location.reload();}, 1000);
66 });
67 });
68 });
69}
70
71load();
72
73//在线获取
74$(".head dd:eq(1)").one("click", function() {
75 loading();
76 $.getScript("http://www.twcms.com/app/?go=theme");
77});
78
79//在线安装
80function install_theme(dir) {
81 twAjax.confirm("玩命下载 <font color='red'>"+dir+"</font> 中<font id='loading'>......</font>", function(){});
82 loading();
83 $("#okA").remove();
84
85 $.getScript("index.php?u=theme-install_theme-dir-" + dir, function(){
86 clearInterval(int);
87 if(typeof err == 'number' && !err && $("#install_enable").length == 0) {
88 $("#noA").after('<a id="install_enable" class="but3" href="javascript:;">启用</a>');
89 $("#install_enable").click(function() { enable(dir); });
90 }
91 //只要在线安装过都重新加载一下
92 $(".head dd:eq(0)").click(function(){ window.location.reload(); });
93 });
94}
95
96//加载效果
97var int;
98function loading() {
99 var dot = '';
100 int = setInterval(function(){
101 dot += '.';
102 if(dot.length > 6) dot = '.';
103 $("#loading").html(dot);
104 }, 50);
105}
106
107// 启用
108function enable(theme) {
109 twAjax.postd("index.php?u=theme-enable-ajax-1", {"theme" : theme}, function(data){
110 twAjax.alert(data);
111 if(window.twData.err==0) setTimeout(function(){window.location.reload();}, 1000);
112 });
113}
114</script>
115</body>
116</html>
117