liip / vie-bundle
VIE是一种使任何使用RDFa的网站可编辑的方法。
Requires
- php: >=5.3.2
- friendsofsymfony/rest-bundle: *
- symfony/assetic-bundle: >= 2.0
- symfony/symfony: 2.*
This package is not auto-updated.
Last update: 2022-02-01 12:20:28 UTC
README
此包不再维护。请使用SymfonyCmfCreateBundle。
简介
VIE是一种使任何使用RDFa的网站可编辑的方法。
更多信息请参阅http://wiki.iks-project.eu/index.php/Semantic_Editor
安装
最好使用Composer来包含此包。
编辑您的项目composer文件,添加对liip/vie-bundle的新require。然后创建一个scripts部分或添加到现有的部分
"scripts": {
"post-install-cmd": [
"Liip\\VieBundle\\Composer\\ScriptHandler::initSubmodules",
...
],
"post-update-cmd": [
"Liip\\VieBundle\\Composer\\ScriptHandler::initSubmodules",
...
]
},
将此包添加到应用程序的kernel
// application/ApplicationKernel.php
public function registerBundles()
{
return array(
// ...
new Liip\VieBundle\LiipVieBundle(),
// ...
);
}
在config.yml中添加映射并启用控制器
liip_vie:
phpcr_odm: true
#orm: my_document_manager
map:
'<sioc:Post>': 'Liip\HelloBundle\Document\Article'
base_path: /cms/routes
cms_path: /cms/content/static
最后将相关的路由添加到您的配置中
<import resource="liip_vie.phpcr.controller" type="rest" />
vie:
resource: "@LiipVieBundle/Resources/config/routing/phpcr_odm.xml"
可选:Aloha Editor(此包包含hallo编辑器,但如果您愿意,也可以使用aloha)
To use the Aloha editor with this bundle, download the files here: https://github.com/alohaeditor/Aloha-Editor/downloads/aloha-0.9.3.zip
Unzip the contents of the "aloha" subfolder of this zip as folder vendor/bundles/Liip/VieBundle/vendor/aloha
Make sure you have just one aloha folder with the js, not aloha/aloha/... - you should have vendor/bundles/Liip/VieBundle/vendor/aloha/aloha.js
使用方法
调整您的模板以加载编辑器js文件,如果当前会话允许编辑内容。
{% render "liip_vie.controller.vie:includeJSFilesAction" %}
您必须做的另一件事是调整您的模板以包含语义RDFa注释,这样VIE就知道哪些内容是可编辑的。有关示例RDFa注释,请参阅cmf sandbox模板:https://github.com/symfony-cmf/cmf-sandbox/blob/master/src/Sandbox/MainBundle/Resources/views/EditableStaticContent/index.html.twig
这是什么?
此包目前是一个巨大的安全漏洞,因为它不尝试检查任何权限,也不清理或验证内容(XSS攻击等)。
主要目标是最终支持工具,以便轻松地将实体/文档实例作为RDFa输出到HTML中,以及将它们从JSON-LD映射回进行处理。
该包目前提供
- 将JSON-LD数据保存到ORM/ODM实体或文档的REST处理器。
- VIE库、hallo编辑器以及集成Aloha编辑器的支持
- 待办事项:考虑我们是否可以帮助以某种方式输出带有RDFa的实体/文档(文档上的注释 + twig扩展?)
依赖
此包包括vie和hallo编辑器作为子模块。您的symfony必须激活两个包
- FOSRestBundle来处理请求(见上述安装说明)
- AsseticBundle以提供javascript文件。(symfony-standard的一部分,只需确保您没有禁用它)
此外,DMS\Filter中有一个可选依赖:https://github.com/rdohms/DMS-Filter
将以下内容添加到您的deps文件中
[DMS-Filter]
git=http://github.com/rdohms/DMS-Filter.git
并将以下内容添加到您的autoload.php中
$loader->registerNamespaces(array(
'DMS\Filter' => __DIR__.'/vendor/DMS-Filter',
));
最后启用过滤器服务
liip_vie:
filter: true
开发hallo编辑器
您可以在VIE包内部开发hallo编辑器。如果将liip_vie: use_coffee
选项设置为true,它将包含coffee脚本文件与assetic一起,而不是预编译的javascript。这也意味着,如果您在assetic配置中为coffeescript设置了映射,您需要正确设置coffee编译器。在沙盒中,我们进行了一些修改以避免触发coffee脚本编译。在config.yml中,我们将coffee扩展设置为可配置的。
assetic:
filters:
cssrewrite: ~
coffee:
bin: %coffee.bin%
node: %coffee.node%
apply_to: %coffee.extension%
liip_vie:
# set this to true if you want to develop hallo and edit the coffee files
use_coffee: true|false
现在,如果parameters.yml将coffee.extension
设置为\.coffee
,则coffeescript将被编译,并且需要安装coffee编译器。如果您将其设置为其他任何内容,如\.nocoffee
,则不需要安装coffee编译器。