opencontent / oceditorialstuff-ls
OpenContent 编辑内容
Requires
README
介绍
OpenContent 编辑内容扩展 用于向网络编辑提供面向工作流程的发布仪表板。它允许配置多个仪表板,每个仪表板针对一类内容。
默认情况下,此扩展允许
- 状态分配
- 可按状态过滤的搜索引擎
- 修改内容的访问
- 智能和移动媒体文件插入
- 向一个或多个用户发送包含内容的邮件
- 发送推文或Facebook(如果已正确配置NGPush)
- 显示修改历史记录
- 显示内部评论
要求
- eZPublish Legacy 版本 > 4.7
- OCBootstrap 扩展
- OCSearchTools 扩展
- OCOperatorsCollection 扩展
- NGPush 扩展(可选)
安装
- 将扩展克隆到
<ez_legacy_root>/extension
文件夹中 - 将 schema.sql 表格导入数据库
- 重新生成 autoloads 并清空 ini 和模板缓存
- 在自定义文件中自定义
editorialstuff.ini
使用和自定义
仪表板配置
每个仪表板对应于 editorialstuff.ini
文件中的一个配置。
活动的仪表板位于 AvailableFactories/Identifiers
中,每个仪表板都可以通过 http://<your_domain>/editorialstuff/dashboard/<identifier>
路径访问。
默认情况下,扩展附带一个 demo 仪表板,可通过 http://<your_domain>/editorialstuff/dashboard/demo
访问,其设置在 demo
块中定义(与 identifier 完全相同)。
[demo]
ClassIdentifier=folder
CreationRepositoryNode=2
CreationButtonText=Crea nuova cartella
RepositoryNodes[]
RepositoryNodes[]=1
AttributeIdentifiers[]
AttributeIdentifiers[images]=images
AttributeIdentifiers[videos]=video
AttributeIdentifiers[audios]=audio
AttributeIdentifiers[tags]=argomento
StateGroup=test
States[draft]=Bozza
States[published]=Pubblicato
#ClassName=YourCustomPHPClass
- 在
ClassIdentifier
中定义将显示和管理在仪表板中的对象的类标识符 - 在
CreationRepositoryNode
中指定创建新对象时所在的父节点 - 在
CreationButtonText
中定义前面提到的按钮的标签 - 在
RepositoryNodes
中定义从仪表板创建对象时要使用的父节点 - 在
AttributeIdentifiers
中映射类的属性:图像、视频和音频必须是类型为 对象关系(eZObjectRelationList) 的属性,标签必须是类型为 eZTags 的属性。这些是可选的,如果没有指定,则某些功能可能不可用 - 在
StateGroup
和States
中指定仪表板将考虑的组和状态(标识符=>名称)(如果不在系统中,扩展将负责创建它们)
使用操作
此扩展默认提供两个操作 AddLocation
和 RemoveLocation
。
[AvailableActions]
Actions[]
Actions[]=AddLocation
Actions[]=RemoveLocation
[AddLocation]
ClassName=OCEditorialStuffActionHandler
MethodName=addLocation
[RemoveLocation]
ClassName=OCEditorialStuffActionHandler
MethodName=removeLocation
在单个仪表板配置的配置组中,可以指定在状态之间转换时执行的操作。
[demo]
...
Actions[]
Actions[draft-published]=AddLocation;43;5
Actions[published-draft]=RemoveLocation;43;5
在刚刚描述的配置示例中,当对象从草稿状态转换为发布状态时,扩展将执行 OCEditorialStuffActionHandler::addLocation
函数,并将 id 43、3、5 以及当前内容(OCEditorialStuffPost)作为参数传递。相反,当从发布状态转换为草稿状态时,它将使用相反的操作 OCEditorialStuffActionHandler::removeLocation
。
要添加动作,只需在配置中的AvailableActions
列出其标题,并在专门块中指定其类和要调用的方法。被调用的方法期望第一个参数为当前内容(OCEditorialStuffPost),第二个参数为配置文件中指定的值数组。在所描述的示例中,调用的PHP方法是
// $addLocationIds = array( 43, 5 );
public static function addLocation( OCEditorialStuffPost $post, $addLocationIds )
{
$object = $post->getObject();
if ( $object instanceof eZContentObject )
{
eZContentOperationCollection::addAssignment(
$object->attribute( 'main_node_id' ),
$object->attribute( 'id' ),
$addLocationIds
);
}
else
{
eZDebug::writeError( "Object not found", __METHOD__ );
}
}
自定义负责更改的整个PHP类
[demo]
...
ClassName=YourCustomPHPClass
最后,在可选参数ClassName
中,可以指定将处理每个单独帖子的PHP类。如果没有指定参数,将使用类OCEditorialStuffPostDefaultFactory
定义自定义类是为了自定义状态转换时发生的事情:该类必须扩展抽象类OCEditorialStuffPostFactory
并实现onChangeState
方法,例如
class MyCustomEditorialStuffPostFactory extends OCEditorialStuffPostFactory
{
// se lo stato dell'oggetto viene cambiato da 'foo' a 'bar'
// all'oggetto viene aggiunta una collocazione in Media
public function onChangeState(
OCEditorialStuffPost $post,
eZContentObjectState $beforeState,
eZContentObjectState $afterState
)
{
$currentObject = $post->getObject();
if ( $beforeState->attribute( 'identifier' ) == 'foo'
&& $afterState->attribute( 'identifier' ) == 'bar' )
{
OCEditorialStuffHistory::addHistoryToObjectId( $post->id(), 'My custom history item', array( 'name' => 'My custom history item parameter' ) );
}
}
}
(请注意,OCEditorialStuffPost $post 对象封装了一个eZContentObject。)
启用内部聊天
要启用内部评论,需要在指定的类中创建一个类型为评论(ezcomComments)的属性:该属性必须具有标识符internal_comment