修改后台部分模板,修改前台可视化数据列表中得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
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
?>
<style>
.listingDetails{position:absolute;width:650px; z-index:999;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<h3>统计</h3>
<hr/>
<ul>
<li><?php echo $this->totle['c'];?> 条档案</li>
<li>栏目 <?php echo $this->typec['c'];?></li>
</ul>
</div>
<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();
}
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div class="span9">
<h3>统计</h3>
<hr/>
<ul>
<li><?php echo $this->totle['c'];?> 条档案</li>
<li>栏目 <?php echo $this->typec['c'];?></li>
</ul>
</div>
</div>
<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>

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,11 +1,12 @@
<ul class="nav nav-pills">
<li class="nav-header">特色导航方式</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/category"><i class="icon-th"></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/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/advancesearch"><i class="icon-search"></i>高级搜索</a></li> -->
<ul class="nav nav-pills">
<li class="nav-header">特色导航方式</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/category"><i class="icon-th"></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/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> -->
</ul>

View File

@ -1,59 +1,37 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->nav[] = array('link'=>"/data/tag",'title'=>'关键词浏览');
$this->theme->AppendPlus($this,'colorbox');
?>
<div id='row-fluid'>
<?= $this->render('breadcrumbs.phtml') ?>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->paginator)) : ?>
<div id='metacontent'>
<h1>当前浏览:<?php echo $this->codename; ?></h1>
<?php echo $this->paginator; ?>
<hr />
<?php foreach($this->paginator as $md) : ?>
<div class="mditem">
<div class="thumb">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="colorbox">
<img src="/service/thumb/id/<?php echo $md['id'];?>" />
</a>
</div>
<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>
</div>
<?php endforeach; ?>
<?php echo $this->paginator; ?>
</div>
<?php else : ?>
<div id='leftnav'>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='';
foreach($this->keywords as $cg) :
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>
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->nav[] = array('link'=>"/data/visual",'title'=>'可视化数据列表');
$this->theme->AppendPlus($this,'colorbox');
?>
<div class="row-fluid">
<?= $this->render('breadcrumbs.phtml') ?>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->paginator)) : ?>
<div id='metacontent'>
<?php echo $this->paginator; ?>
<hr />
<?php foreach($this->paginator as $md) : ?>
<div class="mditem">
<div class="thumb">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="colorbox">
<img src="/service/thumb/id/<?php echo $md['id'];?>" />
</a>
</div>
<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>
</div>
<?php endforeach; ?>
<?php echo $this->paginator; ?>
</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
namespace Westdc\Visual;
use Westdc\Visual\Listener\VisualListener as Listener;
use Helpers\dbh;
class Visual
{
public $db;
protected $events;
function __construct()
{
$this->db = \Zend_Registry::get('db');
$this->mainTable = "datavisual";
$Listener = new Listener();
@$this->getEventManager()->attachAggregate($Listener);
}
public function getEventManager(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//添加
public function add($data)
{
$params = compact('data');
$results = $this->getEventManager()->trigger('submit.checkParam', $this, $params);
$cache_data = $results->last();
if($cache_data !== true)
{
return $cache_data;
}
$results = $this->getEventManager()->trigger('submit.processData', $this, $params);
$data = $results->last();
$dbh = new dbh();
$record = $this->getVisualVars($data['uuid']);
if(empty($record))
{
$id = $dbh->insert($this->mainTable,$data);
if($id)
{
$this->getEventManager()->trigger('submit.recordPosted', $this, $params);
return true;
}else{
if($id === false)
{
return '服务器开小差了,请稍后再试';
}else{
return '服务器处理中遇到错误,请联系管理员';
}
}
}//add
else{
if(!$dbh->update($this->mainTable,$data," uuid='{$data['uuid']}' "))
{
$this->getEventManager()->trigger('submit.recordChanged', $this, $params);
return "修改失败!请重试";
}else{
return true;
}
}//edit
}// add()
//删除
public function del($uuid)
{
if(!is_numeric($id) || empty($id) || $id< 0)
{
return false;
}
$sql = "DELETE FROM {$this->mainTable} WHERE uuid='$uuid'";
return $this->db->exec($sql);
}
//获得可视化变量
public function getVisualVars($uuid)
{
$sql = "SELECT * FROM {$this->mainTable} WHERE uuid='$uuid' LIMIT 1";
$rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC);
}
//获得可以可视化的元数据
public function getVisualMetadata()
{
$sql = "SELECT * FROM metadata md
LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid
WHERE v.uuid IS NOT NULL
";
$rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC);
}
<?php
namespace Westdc\Visual;
use Westdc\Visual\Listener\VisualListener as Listener;
use Helpers\dbh;
class Visual
{
public $db;
protected $events;
function __construct()
{
$this->db = \Zend_Registry::get('db');
$this->mainTable = "datavisual";
$Listener = new Listener();
@$this->getEventManager()->attachAggregate($Listener);
}
public function getEventManager(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//添加
public function add($data)
{
$params = compact('data');
$results = $this->getEventManager()->trigger('submit.checkParam', $this, $params);
$cache_data = $results->last();
if($cache_data !== true)
{
return $cache_data;
}
$results = $this->getEventManager()->trigger('submit.processData', $this, $params);
$data = $results->last();
$dbh = new dbh();
$record = $this->getVisualVars($data['uuid']);
if(empty($record))
{
$id = $dbh->insert($this->mainTable,$data);
if($id)
{
$this->getEventManager()->trigger('submit.recordPosted', $this, $params);
return true;
}else{
if($id === false)
{
return '服务器开小差了,请稍后再试';
}else{
return '服务器处理中遇到错误,请联系管理员';
}
}
}//add
else{
if(!$dbh->update($this->mainTable,$data," uuid='{$data['uuid']}' "))
{
$this->getEventManager()->trigger('submit.recordChanged', $this, $params);
return "修改失败!请重试";
}else{
return true;
}
}//edit
}// add()
//删除
public function del($uuid)
{
if(!is_numeric($id) || empty($id) || $id< 0)
{
return false;
}
$sql = "DELETE FROM {$this->mainTable} WHERE uuid='$uuid'";
return $this->db->exec($sql);
}
//获得可视化变量
public function getVisualVars($uuid)
{
$sql = "SELECT * FROM {$this->mainTable} WHERE uuid='$uuid' LIMIT 1";
$rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC);
}
//获得可以可视化的元数据
public function getVisualMetadata()
{
$sql = "SELECT * FROM metadata md
LEFT JOIN {$this->mainTable} v ON v.uuid = md.uuid
WHERE v.uuid IS NOT NULL";
$rs = $this->db->query($sql);
return $rs->fetchAll(\PDO::FETCH_ASSOC);
}
}