-
Notifications
You must be signed in to change notification settings - Fork 4
Interchange WellWell catalog
interchange/wellwell
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
=== <WARNING> === We don't pay any heed to backward compatibility for Wellwell until it is announced as stable and mature enough. === </WARNING> === %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WellWell is the new Interchange Shop Starter Kit. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% It's main difference from previous IC demo catalogs that it doesn't tend to be a demo, but rather a frame for building new catalogs. It's main building blocks are components, assembled together with [compose] called from within pages. Flaws in Standard / Interchange ******************************* * two shopping carts components to maintain * components need to specified on every page instead of globally * incomplete ITL doesn't crash whole page Goals ***** * No stone will be left unturned. * KISS instead of convoluted ITL code in standard and predecessors. * Death of [process] (almost done). * Supersede Interchange's routes and profiles with form framework. * Keep core of WellWell small, use plugins for extended functionality. In consequence this deprecates the following tags in this scope: [button], [image]. Prerequisites ************* Interchange 5.7.1 and at least: Dispatch.pm 1.103 Order.pm 2.104 Composition *********** [compose] basically just evaluates the components passed inside the [compose] tag and fits them into the containers inside the template. Templates ========= Templates are HTML files with placeholders for the containers. The placeholders are uppercase words inside curly braces. A very simple template would look like: <html> <head> {HTMLHEAD} </head> <body> {BODY} </body> </html> Components ========== Components are evaluated as ITL and put into the placeholders. [compose component.body="hello_world" ] To automatically create a wrapping div for each component, set COMPOSE_CONTAINER to 1. Automatic components/attributes =============================== Usually certain components appear on every page and you don't want to specify them inside the [compose] tag. [compose] examines the following variables which set components and attributes globally: MV_COMPONENT_AUTO MV_ATTRIBUTE_AUTO Example: Variable MV_COMPONENT_AUTO htmlhead:htmlhead left:menu,categorynav body:infobox Variable MV_ATTRIBUTE_AUTO menu.name=main Users, Roles and Permissions **************************** Users ----- Users are stored in the "users" table. The primary key is "uid", quite like an Unix user id, which is used to identify the user through the system. Other settings, like username and email, can be changed by the user. Roles ----- Roles allow to group users and grant them permissions. Users are allowed to be in multiple roles. Roles are stored in the "roles" table. The primary key is "rid", quite like an Unix group id, which the exception of the two default roles (anonymous and authenticated). The default user roles are: * Anonymous user: this role is used for users that don't have a user account or that are not authenticated. * Authenticated user: this role is automatically granted to all logged in users. The anonymous user has always the rid of 1 and the authenticated user has always the rid of 2. This matches the following records in the permissions table: rid | uid | perm -----+-----+--------------- 1 | 0 | anonymous 2 | 0 | authenticated The relationship between users and roles is kept in the "user_roles" table, e.g. uid | rid -----+----- 1 | 3 1 | 4 Permissions ----------- Permissions can be assigned to a role or to an user. If you want to restrict some content, you can use the [acl] tag for checking for proper permissions. The following example produces a link only if the current user has the "create_content" permission. [acl check create_content] <a href="[area new_content]">Create content</a> [/acl] [acl] returns its body on success or the permission if body is empty. Please note that [acl check] without a permission is always successful. Acl parameter in [compose] .......................... Permissions can be checked for a complete page like that: [compose acl.check="view_titles" acl.bounce="index" components.body="title_info" ] Please note that submitted [form] forms bypass this permission check because they are evaluated during autoload. Menus ..... Only menu entries with sufficient permission will be displayed (permission field in menus table). Forms ***** The recommended way to call [form] forms is within the compose tag: [compose components.body="product_info wishlist_add" forms.wishlist_add.name="wishlist_add" /] Parts ----- Each form consists of one or multiple subforms, called parts. The parts are stored in the "form_series" table: name Form name part Part name label Label displayed on top of the form (optional) template Template (optional) profile Profile to check input in this part (optional) position Position of part (1,2,3,...) Template -------- Forms are build from templates as well. The default template is located at: templates/form Alternative templates can be specified in table form_series, field template. The default template looks as follows: {PREPEND} {TOP} <fieldset> <legend>{TITLE}</legend> {FIELDS} {SUBMIT} </fieldset> {BOTTOM} {PREPEND} is a placeholder which can be used for form components. {TOP} starts the HTML form. {TITLE} shows the label field from form_series table. {FIELDS} contains the regular form elements. {SUBMIT} contains the button form elements (as specified in form_elements table or default submit button) {BOTTOM} ends the HTML form. Elements -------- The elements of a form (part) are stored in the "form_elements" table: code Serial number name Name of form element label Label for form element component Part name priority Sort order in form (descending) widget Widget The widget is passed by the form_element_field theme function to the [display] tag. One exception to that is the "legend" widget, which just displays the label of the form_element. Attributes ---------- Every form element can have a set of attributes, stored in the form_attributes table. They are working pretty much the same as in the metadata table for the Interchange UI. Attributes can be applied for every form element with a certain name: wellwell=> select * from form_attributes where name = 'country'; code | name | component | attribute | value ------+---------+-----------+--------------+------------------------------------------------------------ 32 | country | | lookup_query | SELECT code,name FROM country ORDER BY priority DESC, name Or only for a certain from: wellwell=> select * from form_attributes where component = 'content_edit'; code | name | component | attribute | value ------+------+--------------+-----------+------- 30 | uri | content_edit | width | 200 31 | body | content_edit | height | 400 Hooks ----- There are two hooks for forms: form_NAME_load (e.g. form_checkout_load) form_NAME_save (e.g. form_checkout_save) The first parameter for the hook sub is the part name. Load .... The load hook is called for the setup of a form part. It is not called if the profile check for the form part has been failed. The return value of the load hook is either a false value or a hash reference which can contain the following members: page triggers a bounce to that page instead of displaying the form attributes hash reference providing defaults for form attributes Save .... The save hook is called if the form part has been successfully submitted (e.g. profile check successful). Theming ------- Most aspects of a form can be 'themed': * title * elements (complete, label and field) * submit button Currently, you can modify one of the existing theme functions: theme_form_title theme_form_element theme_form_element_label theme_form_element_field theme_form_submit Components ---------- Regular components can also included in forms. Examples are dynamic form parts and supplementary content. Form components are stored in the "form_components" table. name - form name part - form part (empty if component applies to all parts of the form) component - component name location - placeholder used to place the component, e.g prepend for {PREPEND} placeholder priority - sort order in placeholder (descending) Plugins ******* Plugins are living in the plugins subdirectory of wellwell. Plugins are activated by adding them to PLUGINS variable (comma separated list of plugins). Please read the README for the plugin first and follow the instructions before activating the plugin. Authoring plugins ================= Plugins are basically a small WellWell catalog on its own. Configuration ------------- The configuration file is called plugin.cfg. The basic configuration is as follows: Message Loading helloworld plugin. Variable CURPLUGIN helloworld include plugins/default.cfg Info file --------- The info file NAME.info contains basic information about the plugin: name version author E.g. name = Hello world! version = 0.1 author = Stefan Hornburg (Racke) <[email protected]> Directory structure ------------------- NAME.info - info file (see Info file) plugin.cfg - configuration file (see Configuration) code - directory for custom code (tags, functions, ...) pages/NAME - directory for pages components - directory for components Images ****** Originals for (product) images are recorded in images table. Paging ****** Paging can be controlled by passing parameters to [searchcontainer]. paging_startlinks => always show # links at the beginning paging_endlinks => always show # links at the end paging_slidelength => length of sliding window Example: 96 pages, startlinks 3, endlinks 1, slidelength 5 page 1 shows: 1,2,3,4,5,..,96 page 8 shows: 1,2,3,..,6,7,8,9,10,..,96 Processing ********** 1. Autoload Autoload checks for form submissions so we can reroute the request based on certain conditions. Routes ****** More flexible routes needs modifications to Interchange itself, but here we go: - complementing record files with record macros Modules for Composition Framework ********************************* Vend::Compose::Address => addresses, [address] Vend::Compose::Taxonomy Features ******** - deal gracefully with discontinued items (through order_missing SpecialSub)
About
Interchange WellWell catalog
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published