修改后台部分模板,修改前台可视化数据列表中得bug

This commit is contained in:
Li Jianxuan 2014-06-11 01:22:47 +00:00
parent 697dbe4529
commit 3db3e3d690
7 changed files with 2685 additions and 2740 deletions

View File

@ -1,49 +1,37 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>'); $this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>'); ?>
?> <div class="row-fluid">
<style> <div class="span3">
.listingDetails{position:absolute;width:650px; z-index:999;} <?= $this->partial('news/left.phtml'); ?>
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;} </div>
</style> <div class="span9">
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?> <h3>统计</h3>
</div> <hr/>
<div id="rightPanel"> <ul>
<?php if ($this->msg or $this->messages) :?> <li><?php echo $this->totle['c'];?> 条档案</li>
<div id="message"> <li>栏目 <?php echo $this->typec['c'];?></li>
<?php if ($this->msg) : ?> </ul>
<p><?php echo $this->msg; ?></p> </div>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?> </div>
<p><?php echo $msg; ?></p> <script type="text/javascript">
<?php endforeach;endif; ?> $(document).ready(function(){
</div> $('.title').bind('click', function() {
<?php endif; ?> $('.pad').css('display','none');
$(this).next('.listingDetails').children('.pad').show();
<h3>统计</h3> });
<hr/> $('.closepad').bind('click', function() {
<ul> $('.pad').css('display','none');
<li><?php echo $this->totle['c'];?> 条档案</li> });
<li>栏目 <?php echo $this->typec['c'];?></li> });
</ul> function showpad(id){
</div> $('#titlebtn'+id).click();
<script type="text/javascript"> }
$(document).ready(function(){
$('.title').bind('click', function() {
$('.pad').css('display','none');
$(this).next('.listingDetails').children('.pad').show();
});
$('.closepad').bind('click', function() {
$('.pad').css('display','none');
});
});
function showpad(id){
$('#titlebtn'+id).click();
}
</script> </script>

View File

@ -1,132 +1,110 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('后台管理'); $this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('<a href="/">首页</a>');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->headLink()->appendStylesheet('/css/author.css'); $this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->headLink()->appendStylesheet('/css/colorbox.css'); $this->breadcrumb('新闻列表');
$this->breadcrumb('<a href="/">首页</a>'); ?>
$this->breadcrumb('<a href="/admin">后台首页</a>'); <div class="row-fluid">
$this->breadcrumb('<a href="/admin/news">新闻中心</a>'); <div class="span3">
$this->breadcrumb('新闻列表'); <?= $this->partial('news/left.phtml'); ?>
?> </div>
<style>
.listingDetails{position:absolute;width:650px;} <div class="span9">
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;z-index:9999;} <?php if ($this->msg or $this->messages) :?>
</style> <div id="message">
<script> <?php if ($this->msg) : ?>
$('#divFooter').css('position','absolute'); <p><?php echo $this->msg; ?></p>
</script> <?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<div id="leftPanel"> <p><?php echo $msg; ?></p>
<?= $this->partial('news/left.phtml'); ?> <?php endforeach;endif; ?>
</div> </div>
<div id="rightPanel"> <?php endif; ?>
<?php if ($this->msg or $this->messages) :?> <div>
<div id="message"> <select id="navigation">
<?php if ($this->msg) : ?> <option>按栏目查看</option>
<p><?php echo $this->msg; ?></p> <?php
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?> if(count($this->types))
<p><?php echo $msg; ?></p> {
<?php endforeach;endif; ?> foreach($this->types as $v)
</div> {
<?php endif; ?> if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);}
<div> if($this->type == $v['id'])
<select id="navigation"> echo '<option value="/admin/news/newslist/type/'.$v['id'].'" selected="selected">'
<option>按栏目查看</option> .$haed
<?php .$v['title'].'</option>';
if(count($this->types)) else
{ echo '<option value="/admin/news/newslist/type/'.$v['id'].'">'.$haed.$v['title'].'</option>';
foreach($this->types as $v) }
{ }
if(!empty($v[$this->deepField])) {$haed = str_repeat('-',$v[$this->deepField]);} ?>
if($this->type == $v['id']) </select>
echo '<option value="/admin/news/newslist/type/'.$v['id'].'" selected="selected">' &nbsp;
.$haed <a href="/admin/news/newslist">所有新闻列表</a>
.$v['title'].'</option>'; </div>
else <table id="report" class="table table-hover">
echo '<option value="/admin/news/newslist/type/'.$v['id'].'">'.$haed.$v['title'].'</option>'; <thead>
} <tr>
} <th width="50%">新闻标题</th>
?> <th width="15%">栏目</th>
</select> <th width="15%">状态</th>
&nbsp; <th width="20%">新闻管理</th>
<a href="/admin/news/newslist">所有新闻列表</a> </tr>
</div> </thead>
<table id="report" class="stylized full"> <tbody>
<thead> <?php
<tr> if(count($this->paginator))
<th width="50%">新闻标题</th> {
<th width="15%">栏目</th> $list = "";
<th width="15%">状态</th> foreach ($this->paginator as $v)
<th width="20%">新闻管理</th> {
</tr> $list .= '
</thead> <tr>
<tbody> <td>
<?php <a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a>
if(count($this->paginator)) </td>
{ <td>
$list = ""; <a href="'.$v['type_url'].'"><b>'.$v['type_title'].'</b></a>
foreach ($this->paginator as $v) </td>
{ <td>';
$list .= ' if($v['ts_published']<time() and $v['is_pub']>0)
<tr> {
<td> $list.="已发布";
<a id="titlebtn'.$v['id'].'" class="title"><b>'.$v['title'].'</b></a> }
</td> if($v['ts_published']>time() and $v['is_pub']>0)
<td> {
<a href="'.$v['type_url'].'"><b>'.$v['type_title'].'</b></a> $list.= date('Y-m-d H:i',$v['ts_published']) . '发布';
</td> }
<td>'; if($v['is_pub']==0)
if($v['ts_published']<time() and $v['is_pub']>0) {
{ $list.="草稿";
$list.="已发布"; }
} if($v['is_pub']<0)
if($v['ts_published']>time() and $v['is_pub']>0) {
{ $list.="未发布";
$list.= date('Y-m-d H:i',$v['ts_published']) . '发布'; }
} $list .= '</td>
if($v['is_pub']==0) <td>
{ <a href="'.$v['url'].'">浏览</a>
$list.="草稿"; <a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a>
} <a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td>
if($v['is_pub']<0) </tr>
{ ';
$list.="未发布"; }
} echo $list;
$list .= '</td> }
<td> else
<a href="'.$v['url'].'">浏览</a> {
<a href="/admin/news/newsedit/id/'.$v['id'].'"><b>编辑</b></a> echo '
<a href="/admin/news/delete/id/'.$v['id'].'" onclick="return confirm(\'是否确定删除该文章\')">删除</a></td> <tr><td>暂无数据</td><td></td></tr>
</tr> ';
'; }
} ?>
echo $list;
} </tbody>
else </table>
{ <div class="pagenavi"><?= $this->paginator; ?></div>
echo ' </div>
<tr><td>暂无数据</td><td></td></tr> </div>
';
}
?>
</tbody>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.title').bind('click', function() {
$.colorbox({'innerWidth':'50%','html':$(this).next('.listingDetails').children('.pad').html()});
});
$("#navigation").change(function()
{
window.location.href = $(this).val();
});
});
function showpad(id){
$('#titlebtn'+id).click();
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +1,58 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle('用户登录'); $this->headTitle('用户登录');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/account/login">用户登录</a>'); $this->breadcrumb('<a href="/account/login">用户登录</a>');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
?> ?>
<div class="row-fluid"> <div class="row-fluid">
<form class="form-horizontal" method="post"> <form class="form-horizontal" method="post">
<?php if(empty($this->error)) { ?> <?php if(empty($this->error)) { ?>
<div class="alert alert-info alert-login"> <div class="alert alert-info alert-login">
请输入用户名和密码登录 请输入用户名和密码登录
</div> </div>
<? }else{ ?> <? }else{ ?>
<?= $this->error ?> <div class="alert alert-error">
<?php } ?> <?= $this->error ?>
<div class="control-group"> </div>
<label class="control-label" for="username">用户名</label> <?php } ?>
<div class="controls"> <div class="control-group">
<input id="username" type="text" value="" name="username" /> <label class="control-label" for="username">用户名</label>
</div> <div class="controls">
</div> <input id="username" type="text" value="" name="username" />
<div class="control-group"> </div>
<label class="control-label" for="password">密码</label> </div>
<div class="controls"> <div class="control-group">
<input id="password" type="password" value="" name="password" /> <label class="control-label" for="password">密码</label>
</div> <div class="controls">
</div> <input id="password" type="password" value="" name="password" />
<div class="control-group"> </div>
<div class="controls"> </div>
<input type="hidden" name="submit" value="1" /> <div class="control-group">
<?php if(!empty($this->href)){?> <div class="controls">
<input type="hidden" name="href" value="<?= $this->href ?>" /> <input type="hidden" name="submit" value="1" />
<?php }?> <?php if(!empty($this->href)){?>
<label class="checkbox"><input id="remember" type="checkbox" value="1" name="remember">记住我</label> <input type="hidden" name="href" value="<?= $this->href ?>" />
<button type="submit" class="btn">登录</button> <?php }?>
<a href="/account/fetchpwd">忘记密码?</a> <label class="checkbox"><input id="remember" type="checkbox" value="1" name="remember">记住我</label>
</div> <button type="submit" class="btn">登录</button>
</div> <a href="/account/fetchpwd">忘记密码?</a>
</form> </div>
</div> </div>
<script> </form>
$('#captcha_img').click(function(e) { </div>
changecaptcha(); <script>
}); $('#captcha_img').click(function(e) {
function changecaptcha(){ changecaptcha();
$.ajax({ });
url:"/account/captcha", function changecaptcha(){
data:"<?= time() ?>", $.ajax({
success: function(src){ url:"/account/captcha",
document.getElementById('captcha_img').src = src; data:"<?= time() ?>",
} success: function(src){
}); document.getElementById('captcha_img').src = src;
} }
});
}
</script> </script>

View File

@ -1,11 +1,12 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="nav-header">特色导航方式</li> <li class="nav-header">特色导航方式</li>
<li><a href="/data/tag"><i class="icon-tags"></i>关键词浏览</a></li> <li><a href="/data/tag"><i class="icon-tags"></i>关键词浏览</a></li>
<li><a href="/data/series"><i class="icon-th-list"></i>序列浏览</a></li> <li><a href="/data/series"><i class="icon-th-list"></i>序列浏览</a></li>
<li><a href="/data/category"><i class="icon-th"></i>分类浏览</a></li> <li><a href="/data/category"><i class="icon-th"></i>分类浏览</a></li>
<li><a href="/data/timeline"><i class="icon-tasks"></i>时间轴浏览</a></li> <li><a href="/data/timeline"><i class="icon-tasks"></i>时间轴浏览</a></li>
<!-- <li><a href="/data/map"><i class="icon-globe"></i>空间浏览</a></li> --> <!-- <li><a href="/data/map"><i class="icon-globe"></i>空间浏览</a></li> -->
<li><a href="/data/timemap"><i class="icon-film"></i>时空浏览</a></li> <li><a href="/data/timemap"><i class="icon-film"></i>时空浏览</a></li>
<li><a href="/data/browse"><i class="icon-align-justify"></i>全部浏览</a></li> <li><a href="/data/browse"><i class="icon-align-justify"></i>全部浏览</a></li>
<!-- <li><a href="/data/advancesearch"><i class="icon-search"></i>高级搜索</a></li> --> <li><a href="/data/browse"><i class="icon-align-justify"></i>可视化数据</a></li>
<!-- <li><a href="/data/advancesearch"><i class="icon-search"></i>高级搜索</a></li> -->
</ul> </ul>

View File

@ -1,59 +1,37 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data); $this->headTitle($this->config->title->data);
if (!empty($this->codename)) $this->headTitle($this->codename); if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css'); $this->headLink()->appendStylesheet('/css/metadata.css');
$this->nav[] = array('link'=>"/data/tag",'title'=>'关键词浏览'); $this->nav[] = array('link'=>"/data/visual",'title'=>'可视化数据列表');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
?> ?>
<div id='row-fluid'> <div class="row-fluid">
<?= $this->render('breadcrumbs.phtml') ?> <?= $this->render('breadcrumbs.phtml') ?>
<?= $this->partial('data/tools.phtml'); ?> <?= $this->partial('data/tools.phtml'); ?>
</div> </div>
<?php if (!empty($this->paginator)) : ?> <?php if (!empty($this->paginator)) : ?>
<div id='metacontent'> <div id='metacontent'>
<h1>当前浏览:<?php echo $this->codename; ?></h1> <?php echo $this->paginator; ?>
<?php echo $this->paginator; ?> <hr />
<hr /> <?php foreach($this->paginator as $md) : ?>
<?php foreach($this->paginator as $md) : ?> <div class="mditem">
<div class="mditem"> <div class="thumb">
<div class="thumb"> <a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="colorbox">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="colorbox"> <img src="/service/thumb/id/<?php echo $md['id'];?>" />
<img src="/service/thumb/id/<?php echo $md['id'];?>" /> </a>
</a> </div>
</div> <h2><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a></h2>
<h2><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a></h2> <span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span> </div>
</div> <?php endforeach; ?>
<?php endforeach; ?> <?php echo $this->paginator; ?>
<?php echo $this->paginator; ?> </div>
</div> <?php endif; ?>
<?php else : ?> <script>
<div id='leftnav'> $(document).ready(function(){
<?php $(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词'); $(".colorbox").colorbox({photo:"true"});
$type=''; });
foreach($this->keywords as $cg) : </script>
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul></fieldset>
<?php endif;
$type=$cg['keytype'];
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php else : ?>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<?php endif; ?>
<script>
$(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$(".colorbox").colorbox({photo:"true"});
});
</script>

View File

@ -1,111 +1,111 @@
<?php <?php
namespace Westdc\Visual; namespace Westdc\Visual;
use Westdc\Visual\Listener\VisualListener as Listener; use Westdc\Visual\Listener\VisualListener as Listener;
use Helpers\dbh; use Helpers\dbh;
class Visual class Visual
{ {
public $db; public $db;
protected $events; protected $events;
function __construct() function __construct()
{ {
$this->db = \Zend_Registry::get('db'); $this->db = \Zend_Registry::get('db');
$this->mainTable = "datavisual"; $this->mainTable = "datavisual";
$Listener = new Listener(); $Listener = new Listener();
@$this->getEventManager()->attachAggregate($Listener); @$this->getEventManager()->attachAggregate($Listener);
} }
public function getEventManager(\Zend_EventManager_EventCollection $events = NULL) public function getEventManager(\Zend_EventManager_EventCollection $events = NULL)
{ {
if ($events !== NULL) { if ($events !== NULL) {
$this->events = $events; $this->events = $events;
} elseif ($this->events === NULL) { } elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__); $this->events = new \Zend_EventManager_EventManager(__CLASS__);
} }
return $this->events; return $this->events;
} }
//添加 //添加
public function add($data) public function add($data)
{ {
$params = compact('data'); $params = compact('data');
$results = $this->getEventManager()->trigger('submit.checkParam', $this, $params); $results = $this->getEventManager()->trigger('submit.checkParam', $this, $params);
$cache_data = $results->last(); $cache_data = $results->last();
if($cache_data !== true) if($cache_data !== true)
{ {
return $cache_data; return $cache_data;
} }
$results = $this->getEventManager()->trigger('submit.processData', $this, $params); $results = $this->getEventManager()->trigger('submit.processData', $this, $params);
$data = $results->last(); $data = $results->last();
$dbh = new dbh(); $dbh = new dbh();
$record = $this->getVisualVars($data['uuid']); $record = $this->getVisualVars($data['uuid']);
if(empty($record)) if(empty($record))
{ {
$id = $dbh->insert($this->mainTable,$data); $id = $dbh->insert($this->mainTable,$data);
if($id) if($id)
{ {
$this->getEventManager()->trigger('submit.recordPosted', $this, $params); $this->getEventManager()->trigger('submit.recordPosted', $this, $params);
return true; return true;
}else{ }else{
if($id === false) if($id === false)
{ {
return '服务器开小差了,请稍后再试'; return '服务器开小差了,请稍后再试';
}else{ }else{
return '服务器处理中遇到错误,请联系管理员'; return '服务器处理中遇到错误,请联系管理员';
} }
} }
}//add }//add
else{ else{
if(!$dbh->update($this->mainTable,$data," uuid='{$data['uuid']}' ")) if(!$dbh->update($this->mainTable,$data," uuid='{$data['uuid']}' "))
{ {
$this->getEventManager()->trigger('submit.recordChanged', $this, $params); $this->getEventManager()->trigger('submit.recordChanged', $this, $params);
return "修改失败!请重试"; return "修改失败!请重试";
}else{ }else{
return true; return true;
} }
}//edit }//edit
}// add() }// add()
//删除 //删除
public function del($uuid) public function del($uuid)
{ {
if(!is_numeric($id) || empty($id) || $id< 0) if(!is_numeric($id) || empty($id) || $id< 0)
{ {
return false; return false;
} }
$sql = "DELETE FROM {$this->mainTable} WHERE uuid='$uuid'"; $sql = "DELETE FROM {$this->mainTable} WHERE uuid='$uuid'";
return $this->db->exec($sql); return $this->db->exec($sql);
} }
//获得可视化变量 //获得可视化变量
public function getVisualVars($uuid) public function getVisualVars($uuid)
{ {
$sql = "SELECT * FROM {$this->mainTable} WHERE uuid='$uuid' LIMIT 1"; $sql = "SELECT * FROM {$this->mainTable} WHERE uuid='$uuid' LIMIT 1";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC); return $rs->fetch(\PDO::FETCH_ASSOC);
} }
//获得可以可视化的元数据 //获得可以可视化的元数据
public function getVisualMetadata() public function getVisualMetadata()
{ {
$sql = "SELECT * FROM metadata md $sql = "SELECT * FROM metadata md
LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid
WHERE v.uuid IS NOT NULL WHERE v.uuid IS NOT NULL";
";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC); return $rs->fetchAll(\PDO::FETCH_ASSOC);
} }
} }