整合:Xaraya:技术文档:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
第1行: 第1行:
Technical documentation of the Gallery2 integration module for Xaraya.
Xaraya的Gallery2整合模块的技术文档。


== Included Hooks ==
== 包括的Hook ==
The gallery2 module provides create, update, delete API hooks and a search GUI hook. The API hooks are only provided for the roles module as they are used for the user/group management synchronization with G2.
gallery2模块提供create,update,delete API hook和一个search GUI hook。API hook仅用于roles模块,因为这些hook被用作与G2的用户/组管理的同步。


All hooks should be activated, always. And thus, they are activated automatically during gallery2 module installation. If these hooks are not active, to activate them, go to Admin panel -> Modules -> Configure Hooks and click on the gallery2 link. Select the roles module to enable the user/group synchronization functionality .
所有的hook都应被激活。而它们在gallery2模块安装过程中就被自动激活了。如果这些hook不处于活动状态而需要激活的话,请打开管理面板(Admin panel) -> 模块(Modules) -> 配置hook(Configure Hooks)并点击gallery2链接。选择roles模块来启用用户/组的同步功能。


== Authentication / Session management ==
== 认证/会话管理 ==
Xaraya is responsible for the authentication and forwards the authenticated user to G2. Both, xaraya and G2, still have their own session management and cookies. The only difference is that G2 checks if there is already a xaraya session before it creates a session for the same user.
Xaraya负责认证并将经认证的用户递送给G2。xaraya和G2均具有各自的会话管理和cookies。唯一的区别就是,G2会在为相同用户创建会话之前先检查是否已存在一个xaraya会话。


== User-/Group management ==
== 用户-/组管理 ==
Both applications still have their own user-/group management. But G2 is not allowed to initiate a change. Everytime you create, update or delete a role (user/group) in xaraya, the gallery2 module instantaneously creates, updates or deletes the user/group in G2. Same for group memberships.
Both applications still have their own user-/group management. But G2 is not allowed to initiate a change. Everytime you create, update or delete a role (user/group) in xaraya, the gallery2 module instantaneously creates, updates or deletes the user/group in G2. Same for group memberships.
If you delete a user in xaraya, the G2 user receives a random password. That leaves the possibility to recall this role in xaraya. If you purge the role, it gets deleted in G2 too.
If you delete a user in xaraya, the G2 user receives a random password. That leaves the possibility to recall this role in xaraya. If you purge the role, it gets deleted in G2 too.


=== Initial user-/group synchronization ===
=== 初始用户-/组同步 ===
The initial user and group synchronization, that is the import of G2 users/groups into xaraya and the export/update of xaraya roles to G2, is based on the unique role name / G2 userName / groupName. There are 3 special groups and 1 special user that are mapped internally:
初始用户及组同步,即G2用户/组导入xaraya及xaraya角色向G2的导出,是基于唯一角色名称/ G2 userName / groupName之上的。有三类特殊组及一个特殊用户是经内部进行映射的:
* xaraya: 'Everybody' is mapped to G2: 'Everybody' (default name)
* xaraya: 'Everybody'被映射到G2: 'Everybody' (默认名称)
* xaraya: 'Administrators' is mapped to G2: 'Site Admins' (default name)
* xaraya: 'Administrators'被映射到G2: 'Site Admins' (默认名称)
* xaraya: 'Users' is mapped to G2: '?' (default name)
* xaraya: 'Users' 被映射到G2: '?' (默认名称)
* xaraya: 'anonymous' is mapped to G2: 'guest' (default name)
* xaraya: 'anonymous'被映射到G2: 'guest' (默认名称)
* All other users/groups, including the admins, are mapped based on their unique username.
* 其他所有组/用户,包括管理员,都基于各自唯一用户名而经映射。


The import / export of G2 users/groups and xaraya roles happens right after you hit "Update Config" in the Modify Config view, but only if the config parameters you supplied are valid.
G2用户组和xaraya角色的导入/导出在你点击Modify Config 视图中的"Update Config"后就开始了,但仅当你所提供的config参量有效时才可行。


If there are conflicts, that is, if there exist xaraya roles and G2 users / groups with the same unique username before the initial synchronization, we update the G2 user data with the data we get from xaraya.
如果发生冲突,即在初始同步之前xaraya角色和G2用户/组唯一用户名皆相同的话,我们就会使用取自xaraya的数据来进行G2用户数据的更新。


* NOTE: If you want some specific users / groups mapped, make sure they have the same unique username in xaraya and G2 before you configure this module!
* 注:如果你希望映射某些特定用户/组的话,在配置该模块之前,确保它们在xaraya和G2中具有相同的唯一用户名。
* NOTE: All users have to member of the Users group in G2, but admins must not be members of the Users group in xaraya. We take care of this, so don't wonder if you see this "inconsistency" when you take a look at the databases.
* 注:所有用户必须为G2 User用户组中的成员,但管理员绝不能是xaraya User用户组的成员。我们会处理这个问题的,因此在查看数据库时碰上了此类"不一致性"的话不要多想。


We also drop pending users from G2. If they haven't yet registered with xaraya, the eventually will notice the change and sign up. :)
我们还会从G2中删除审核中的用户。如果他们还没有注册xaraya的话,看到这种变化之后就会注意到的,然后就会注册。:)


All subsequent synchronizations (login, logout, create, update, delete role) are based on a xaraya uid to G2 entityId mapping.
所有后继的同步(登入,登出,创建,更新,删除角色)都是基于xaraya uid至G2 entityId的映射上的。


== Permissions/Privileges ==
== 权限/特权 ==
You can manage G2 permissions in G2 and not with the roles / privileges modules of xaraya. But all xaraya user groups exist in G2 too. So just assign permissions to the default user group / admin group / everybody group in G2 and all registered users / administrators / everybody will have these permissions.
你可以在G2中管理G2权限,而不用xaraya的roles/ privileges 模块。但所有的xaraya用户组也存在于G2中。所以只要为G2中的默认用户组/管理员组/所有人组指定权限,所有已注册用户/管理员/所有人就会具有相应的这些权限了。


For more information, check the Gallery 2 documentation for permission management.
更多相关信息请见有关Gallery2权限管理的资料。


== Visual integration ==
== 可视化整合 ==
No HTML frames are used. G2 generates the resulting HTML without the ...section and the and tags and returns it to our wrapper module. Then we put everything into an almost empty xaraya template. G2 returns the javascript, css and the page title too and we include everything in the created xaraya page.
不使用任何HTML框架。G2生成不带... section和标签的HTML并将其返回wrapper模块。接着我们将所有东西都放入一个几乎为空的xaraya模板。G2也会返回javascript,css和页面标题。而我们在创建的xaraya 页面中包括进所有东西。


If you want to customize the look, you can start by choosing one of the existing G2 themes. You can then customize the G2 templates, theme and stylesheets for detailled adjustments. G2 uses smarty as its templating engine, so perhaps you already know everything to create your very own look and feel of G2.
如果你想自定义外观的话,可以选取某个现有G2外观主题作为开始。然后你可以自定义G2模板,外观主题和风格页来做进一步的细节调整。G2使用smarty作为自己的模板引擎,所以你可能已对G2外观主题的自创胸有成竹了。




== Menu links ==
== 菜单链接 ==
TODO: We will dynamically send all available menu links from G2 to xaraya, the goal is to have only the one and only xaraya menu.
TODO: 我们会将所有来自G2的菜单链接自动发送到xaraya,目的就是具有唯一的xaraya菜单。


== Search hook ==
== 搜素hook ==
TODO: We will add a search hook therewith you can search for G2 items, comments, ... from xaraya.
TODO: 我们会添加一个搜索(search) hook这样就可以从xaraya搜索G2项目,评论…了。


== URLs, direct and indirect requests ==
== URL,直接和间接请求 ==
We configure G2 to run all requests through xaraya. The xaraya core sees that the request is intended for the gallery2 module and the gallery2 module passes the request to G2 itself.
We configure G2 to run all requests through xaraya. The xaraya core sees that the request is intended for the gallery2 module and the gallery2 module passes the request to G2 itself.


第56行: 第56行:
For now, xaraya short urls are not supported by this module. But you can activate the G2 Url rewrite module which generates also very nice URLs.
For now, xaraya short urls are not supported by this module. But you can activate the G2 Url rewrite module which generates also very nice URLs.


== Language Settings ==
== 语言设定 ==
Xaraya and G2 manage language settings the same way. There's a site wide language default, a user language setting and a language setting per session. A base module updateconfig hook synchronizes the site default language with G2 and on each request we hand over the current language setting of the active xaraya user to G2. If G2 has the language lang_COUNTRY installed, it sets the language accordingly, if not, it tries the fallback lang_ANYOTHERCOUNTRY, if that fails, it uses the old language setting.
Xaraya and G2 manage language settings the same way. There's a site wide language default, a user language setting and a language setting per session. A base module updateconfig hook synchronizes the site default language with G2 and on each request we hand over the current language setting of the active xaraya user to G2. If G2 has the language lang_COUNTRY installed, it sets the language accordingly, if not, it tries the fallback lang_ANYOTHERCOUNTRY, if that fails, it uses the old language setting.


[[Category:Integration:Xaraya]]
[[Category:Integration:Xaraya]]

2008年11月7日 (五) 16:51的版本

Xaraya的Gallery2整合模块的技术文档。

包括的Hook

gallery2模块提供create,update,delete API hook和一个search GUI hook。API hook仅用于roles模块,因为这些hook被用作与G2的用户/组管理的同步。

所有的hook都应被激活。而它们在gallery2模块安装过程中就被自动激活了。如果这些hook不处于活动状态而需要激活的话,请打开管理面板(Admin panel) -> 模块(Modules) -> 配置hook(Configure Hooks)并点击gallery2链接。选择roles模块来启用用户/组的同步功能。

认证/会话管理

Xaraya负责认证并将经认证的用户递送给G2。xaraya和G2均具有各自的会话管理和cookies。唯一的区别就是,G2会在为相同用户创建会话之前先检查是否已存在一个xaraya会话。

用户-/组管理

Both applications still have their own user-/group management. But G2 is not allowed to initiate a change. Everytime you create, update or delete a role (user/group) in xaraya, the gallery2 module instantaneously creates, updates or deletes the user/group in G2. Same for group memberships. If you delete a user in xaraya, the G2 user receives a random password. That leaves the possibility to recall this role in xaraya. If you purge the role, it gets deleted in G2 too.

初始用户-/组同步

初始用户及组同步,即G2用户/组导入xaraya及xaraya角色向G2的导出,是基于唯一角色名称/ G2 userName / groupName之上的。有三类特殊组及一个特殊用户是经内部进行映射的:

  • xaraya: 'Everybody'被映射到G2: 'Everybody' (默认名称)
  • xaraya: 'Administrators'被映射到G2: 'Site Admins' (默认名称)
  • xaraya: 'Users' 被映射到G2: '?' (默认名称)
  • xaraya: 'anonymous'被映射到G2: 'guest' (默认名称)
  • 其他所有组/用户,包括管理员,都基于各自唯一用户名而经映射。

G2用户组和xaraya角色的导入/导出在你点击Modify Config 视图中的"Update Config"后就开始了,但仅当你所提供的config参量有效时才可行。

如果发生冲突,即在初始同步之前xaraya角色和G2用户/组唯一用户名皆相同的话,我们就会使用取自xaraya的数据来进行G2用户数据的更新。

  • 注:如果你希望映射某些特定用户/组的话,在配置该模块之前,确保它们在xaraya和G2中具有相同的唯一用户名。
  • 注:所有用户必须为G2 User用户组中的成员,但管理员绝不能是xaraya User用户组的成员。我们会处理这个问题的,因此在查看数据库时碰上了此类"不一致性"的话不要多想。

我们还会从G2中删除审核中的用户。如果他们还没有注册xaraya的话,看到这种变化之后就会注意到的,然后就会注册。:)

所有后继的同步(登入,登出,创建,更新,删除角色)都是基于xaraya uid至G2 entityId的映射上的。

权限/特权

你可以在G2中管理G2权限,而不用xaraya的roles/ privileges 模块。但所有的xaraya用户组也存在于G2中。所以只要为G2中的默认用户组/管理员组/所有人组指定权限,所有已注册用户/管理员/所有人就会具有相应的这些权限了。

更多相关信息请见有关Gallery2权限管理的资料。

可视化整合

不使用任何HTML框架。G2生成不带... section和标签的HTML并将其返回wrapper模块。接着我们将所有东西都放入一个几乎为空的xaraya模板。G2也会返回javascript,css和页面标题。而我们在创建的xaraya 页面中包括进所有东西。

如果你想自定义外观的话,可以选取某个现有G2外观主题作为开始。然后你可以自定义G2模板,外观主题和风格页来做进一步的细节调整。G2使用smarty作为自己的模板引擎,所以你可能已对G2外观主题的自创胸有成竹了。


菜单链接

TODO: 我们会将所有来自G2的菜单链接自动发送到xaraya,目的就是具有唯一的xaraya菜单。

搜素hook

TODO: 我们会添加一个搜索(search) hook这样就可以从xaraya搜索G2项目,评论…了。

URL,直接和间接请求

We configure G2 to run all requests through xaraya. The xaraya core sees that the request is intended for the gallery2 module and the gallery2 module passes the request to G2 itself.

The only exception are the download links/requests. G2 features an image firewall. Unlike ordinary gallery scripts, there's no way you can download any images from G2 than through the application. The developers of G2 spent a lot of effort in trying to reduce the time needed to process download requests. If all these download requests would run through the xaraya core before G2 received them, it'd be bloody slow. That's why all download links/requests go directly to G2, bypassing xaraya.

For now, xaraya short urls are not supported by this module. But you can activate the G2 Url rewrite module which generates also very nice URLs.

语言设定

Xaraya and G2 manage language settings the same way. There's a site wide language default, a user language setting and a language setting per session. A base module updateconfig hook synchronizes the site default language with G2 and on each request we hand over the current language setting of the active xaraya user to G2. If G2 has the language lang_COUNTRY installed, it sets the language accordingly, if not, it tries the fallback lang_ANYOTHERCOUNTRY, if that fails, it uses the old language setting.