Merge branch 'master' of https://github.com/typecho/typecho-replica
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 附件管理列表
|
||||
* 文件管理列表
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 附件管理列表组件
|
||||
* 文件管理列表组件
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
@@ -78,7 +78,7 @@ class Widget_Contents_Attachment_Admin extends Widget_Abstract_Contents
|
||||
/** 构建基础查询 */
|
||||
$select = $this->select()->where('table.contents.type = ?', 'attachment');
|
||||
|
||||
/** 如果具有编辑以上权限,可以查看所有附件,反之只能查看自己的附件 */
|
||||
/** 如果具有编辑以上权限,可以查看所有文件,反之只能查看自己的文件 */
|
||||
if (!$this->user->pass('editor', true)) {
|
||||
$select->where('table.contents.authorId = ?', $this->user->uid);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
* 获取页面偏移的URL Query
|
||||
*
|
||||
* @access protected
|
||||
* @param integer $cid 附件id
|
||||
* @param integer $cid 文件id
|
||||
* @param string $status 状态
|
||||
* @return string
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
->limit(1), array($this, 'push'));
|
||||
|
||||
if (!$this->have()) {
|
||||
throw new Typecho_Widget_Exception(_t('附件不存在'), 404);
|
||||
throw new Typecho_Widget_Exception(_t('文件不存在'), 404);
|
||||
} else if ($this->have() && !$this->allow('edit')) {
|
||||
throw new Typecho_Widget_Exception(_t('没有编辑权限'), 403);
|
||||
}
|
||||
@@ -62,10 +62,10 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断附件名转换到缩略名后是否合法
|
||||
* 判断文件名转换到缩略名后是否合法
|
||||
*
|
||||
* @access public
|
||||
* @param string $name 附件名
|
||||
* @param string $name 文件名
|
||||
* @return boolean
|
||||
*/
|
||||
public function nameToSlug($name)
|
||||
@@ -81,7 +81,7 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断附件缩略名是否存在
|
||||
* 判断文件缩略名是否存在
|
||||
*
|
||||
* @access public
|
||||
* @param string $slug 缩略名
|
||||
@@ -116,18 +116,18 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
$form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/contents-attachment-edit', $this->options->index),
|
||||
Typecho_Widget_Helper_Form::POST_METHOD);
|
||||
|
||||
/** 附件名称 */
|
||||
/** 文件名称 */
|
||||
$name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, $this->title, _t('标题 *'));
|
||||
$form->addInput($name);
|
||||
|
||||
/** 附件缩略名 */
|
||||
/** 文件缩略名 */
|
||||
$slug = new Typecho_Widget_Helper_Form_Element_Text('slug', NULL, $this->slug, _t('缩略名'),
|
||||
_t('附件缩略名用于创建友好的链接形式,建议使用字母,数字,下划线和横杠.'));
|
||||
_t('文件缩略名用于创建友好的链接形式,建议使用字母,数字,下划线和横杠.'));
|
||||
$form->addInput($slug);
|
||||
|
||||
/** 附件描述 */
|
||||
/** 文件描述 */
|
||||
$description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, $this->attachment->description,
|
||||
_t('描述'), _t('此文字用于描述附件,在有的主题中它会被显示.'));
|
||||
_t('描述'), _t('此文字用于描述文件,在有的主题中它会被显示.'));
|
||||
$form->addInput($description);
|
||||
|
||||
/** 分类动作 */
|
||||
@@ -144,19 +144,19 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
$delete = new Typecho_Widget_Helper_Layout('a', array('href' =>
|
||||
Typecho_Common::url('/action/contents-attachment-edit?do=delete&cid=' . $this->cid, $this->options->index),
|
||||
'class' => 'operate-delete',
|
||||
'lang' => _t('你确认删除附件 %s 吗?', $this->attachment->name)));
|
||||
$submit->container($delete->html(_t('删除附件')));
|
||||
'lang' => _t('你确认删除文件 %s 吗?', $this->attachment->name)));
|
||||
$submit->container($delete->html(_t('删除文件')));
|
||||
$form->addItem($submit);
|
||||
|
||||
$name->addRule('required', _t('必须填写附件标题'));
|
||||
$name->addRule(array($this, 'nameToSlug'), _t('附件标题无法被转换为缩略名'));
|
||||
$name->addRule('required', _t('必须填写文件标题'));
|
||||
$name->addRule(array($this, 'nameToSlug'), _t('文件标题无法被转换为缩略名'));
|
||||
$slug->addRule(array($this, 'slugExists'), _t('缩略名已经存在'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新附件
|
||||
* 更新文件
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -195,8 +195,8 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
|
||||
/** 提示信息 */
|
||||
$this->widget('Widget_Notice')->set('publish' == $this->status ?
|
||||
_t('附件 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->title) :
|
||||
_t('未归档附件 %s 已经被更新', $this->title), NULL, 'success');
|
||||
_t('文件 <a href="%s">%s</a> 已经被更新', $this->permalink, $this->title) :
|
||||
_t('未归档文件 %s 已经被更新', $this->title), NULL, 'success');
|
||||
|
||||
}
|
||||
|
||||
@@ -246,11 +246,11 @@ class Widget_Contents_Attachment_Edit extends Widget_Contents_Post_Edit implemen
|
||||
}
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
$this->response->throwJson($deleteCount > 0 ? array('code' => 200, 'message' => _t('附件已经被删除'))
|
||||
: array('code' => 500, 'message' => _t('没有附件被删除')));
|
||||
$this->response->throwJson($deleteCount > 0 ? array('code' => 200, 'message' => _t('文件已经被删除'))
|
||||
: array('code' => 500, 'message' => _t('没有文件被删除')));
|
||||
} else {
|
||||
/** 设置提示信息 */
|
||||
$this->widget('Widget_Notice')->set($deleteCount > 0 ? _t('附件已经被删除') : _t('没有附件被删除'), NULL,
|
||||
$this->widget('Widget_Notice')->set($deleteCount > 0 ? _t('文件已经被删除') : _t('没有文件被删除'), NULL,
|
||||
$deleteCount > 0 ? 'success' : 'notice');
|
||||
|
||||
/** 返回原网页 */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 文章相关附件
|
||||
* 文章相关文件
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 文章相关附件组件
|
||||
* 文章相关文件组件
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
@@ -37,7 +37,7 @@ class Widget_Contents_Attachment_Related extends Widget_Abstract_Contents
|
||||
/** 构建基础查询 */
|
||||
$select = $this->select()->where('table.contents.type = ?', 'attachment');
|
||||
|
||||
//order字段在附件里代表所属文章
|
||||
//order字段在文件里代表所属文章
|
||||
$select->where('table.contents.parent = ?', $this->parameter->parentId);
|
||||
|
||||
/** 提交查询 */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* 没有关联的附件
|
||||
* 没有关联的文件
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 没有关联的附件组件
|
||||
* 没有关联的文件组件
|
||||
*
|
||||
* @category typecho
|
||||
* @package Widget
|
||||
|
||||
Reference in New Issue
Block a user