;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- ;;; $Header: src/tags.lisp $ ;;; Copyright (c) 2008, Andrea Chiumenti. All rights reserved. ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; * Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; * Redistributions in binary form must reproduce the above ;;; copyright notice, this list of conditions and the following ;;; disclaimer in the documentation and/or other materials ;;; provided with the distribution. ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (in-package :claw-html) (defgeneric page-req-parameter (page name &optional as-list) (:documentation "This method returns a request parameter given by NAME searching first into post parameters and, if no parameter found, into get prarmeters. The optional function parameter AS-LIST if true returns the result as list. When AS-LIST is true, if the searched parameter is found more then once, a list with all valuse given to param NAME is returned. - PAGE is the page instance that must be given. - NAME The parameter to search - AS-LIST If true the result is returned as list, if false as string. Default: false ")) (defgeneric page-json-id-list (page) (:documentation "This internal method is called to get a list of all the components by their id, that must be updated when an xhr request is sent from the browser. - PAGE is the page instance that must be given ")) (defgeneric page-json-prefix (page) (:documentation "This internal method is called to get a prefix to prepend to a json reply when needed. - PAGE is the page instance that must be given ")) (defgeneric page-json-suffix (page) (:documentation "This internal method is called to get a suffix to append to a json reply when needed. - PAGE is the page instance that must be given ")) (defgeneric page-content (page) (:documentation "This method returns the page content to be redered. - PAGE is the page instance that must be given ")) (defgeneric page-init (page) (:documentation "Internal method for page initialization. - PAGE is the page instance that must be given ")) (defgeneric page-render (page) (:documentation "This method is the main method fired from the framework to render the desired page and to handle all the request cycle. - PAGE is the page instance that must be given ")) (defgeneric page-before-render (page) (:documentation "This method is called as first instruction of PAGE-RENDER. - PAGE is the page instance that must be given ")) (defgeneric page-init-injections (page) (:documentation "This internal method is called during the request cycle phase to reset page slots that must be reinitialized during sub-phases (rewinding, pre-rendering, rendering). - PAGE is the page instance that must be given ")) (defgeneric page-render-headings (page) (:documentation "This internal method renders the html first lines that determine if the page is a html or a xhtml, along with the schema definition. - PAGE is the page instance that must be given ")) (defgeneric page-request-parameters (page) (:documentation "This internal method builds the get and post parameters into an hash table. Parameters are collected as lists so that this method can collect parameters that appear moter then once. ")) (defgeneric page-print-tabulation (page) (:documentation "This internal method is called during the rendering phase if tabulation is enabled. It writes the right amount of tabs chars to indent the page. - PAGE is the page instance that must be given ")) (defgeneric page-newline (page) (:documentation "This internal method simply writes the rest of page content on a new line when needed. - PAGE is the page instance that must be given ")) (defgeneric page-format (page str &rest rest) (:documentation "This internal method is the replacement of the FORMAT function. It is aware of an xhr request when the reply must be given as a json object. It also uses the default page output stream to render the output. - PAGE is the page instance that must be given - STR The format control - REST The format arguments See http://www.lisp.org/HyperSpec/Body/fun_format.html#format for more info. ")) (defgeneric page-format-raw (page str &rest rest) (:documentation "This internal method is the replacement of the FORMAT. The difference with PAGE-FORMAT is that it prints out the result ignoring the json directive. It also uses the default page output stream as PAGE-FORMAT does to render the output. - PAGE is the page instance that must be given - STR The format control - REST The format arguments See http://www.lisp.org/HyperSpec/Body/fun_format.html#format for more info. ")) (defgeneric page-body-initscripts (page) (:documentation "During the render phase wcomponent instances inject their initialization scripts (javascript) that will be evaluated when the page has been loaded. This internal method is called to render these scripts. The result is used by the HTBODY-INITSCRIPTS-TAG method that generates a