westdc-zf1/application/default/views/scripts/author/version.phtml

105 lines
4.6 KiB
PHTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">Home</a>');
$this->breadcrumb('<a href="/author">Author</a>');
$this->breadcrumb('Versions');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-pills">
<li class="<?php if(!$this->mdtitle) echo "active";?>"><a class="" href="/author/version">All versions</a></li>
<li class=""><a class="" href="/author/version/ac/bydata">By datasets</a></li>
</ul>
</div>
<div>
<?php
if (count($this->paginator)):
if ($this->mdtitle) echo "<h2>Dataset: ".$this->mdtitle."</h2>";
echo '<ul class="unstyled">';
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li class="well" id="list_<?php echo $item['id'];?>">
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
[<a href="/author/version/uuid/<?php echo $item['uuid']; ?>">All versions</a>]</p>
<p>Created: <?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?>
<?php if ($item['userid']) :
echo "Releaser ".(empty($item['realname'])?$item['username']:$item['realname'])." 【";
else :
?>
[<a onclick="return confirm('Sure to delete this version?');" href="javascript:action('delete','<?php echo $item['id'];?>');" class="more">Delete</a>
<?php endif; ?>
<a onclick="return confirm('Sure to restore this version to Geonetwork');" href="javascript:action('restore','<?php echo $item['id'];?>');" class="more">Restore to Geonetwork</a>
<a href="/author/version/ac/diff/id/<?php echo $item['id'];?>" class="more">Diff with previous version</a>
<a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline">Commit this version</a>
]</p>
<?php if ($item['changelog']) : ?>
<p><?php echo $item['changelog']; ?></p>
<?php endif; ?>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>
<script>
function action(ac,id){
$.ajax({
'type':"POST",
'url':'/author/version/',
'data':'ac='+ ac +'&id='+id,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{$('#changelog').val('');$('#commit_submit').attr('onclick','');}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('commit&changelog='+$('#changelog').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="commitform">
<form>
<p>
<label>Changelog:</label><br />
<textarea class="input-block-level" style="resize:none;height:200px;" id="changelog"></textarea>
<br /><small>Please input the difference of the version</small>
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>