;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.presentation) ;; changes from html4 to html5 are covered nicely in ;; http://diveintohtml5.org/semantics.html (def render-xhtml extjs-frame/widget (bind ((application *application*) (application-path (path-of application)) (encoding (or (when *response* (encoding-name-of *response*)) +default-encoding+)) (debug-client-side? (debug-client-side? -self-)) (javascript-supported? (not (request-parameter-value *request* +no-javascript-error-parameter-name+)))) (emit-xhtml-prologue encoding +html5-doctype+) ,(bind (((icon-uri &optional timestamp) (ensure-list (page-icon-uri-of -self-)))) (when icon-uri )) ,(foreach (lambda (entry) (bind (((stylesheet-uri &optional timestamp) (ensure-list entry))) <link (:rel "stylesheet" :href ,(bind ((uri (hu.dwim.uri:clone-uri stylesheet-uri))) (hu.dwim.uri:prepend-path uri application-path) (when timestamp (append-timestamp-to-uri uri timestamp)) (hu.dwim.uri:print-uri-to-string uri)))>)) (stylesheet-uris-of -self-)) <script (:type +javascript-mime-type+ :src ,(bind ((uri (hu.dwim.uri:clone-uri (extjs-release-uri-of -self-)))) ;; we have the sencha-touch release version in the url, so timestamps here are not important (hu.dwim.uri:prepend-path uri application-path) (hu.dwim.uri:append-path uri (extjs-file-name-of -self-)) (hu.dwim.uri:print-uri-to-string uri))) ;; it must have an empty body because browsers don't like collapsed <script ... /> in the head ""> ,(foreach (lambda (entry) (bind (((script-uri &optional timestamp) (ensure-list entry))) <script (:type +javascript-mime-type+ :src ,(bind ((uri (hu.dwim.uri:clone-uri script-uri))) (unless (starts-with #\/ (path-of uri)) (hu.dwim.uri:prepend-path uri application-path)) (when timestamp (append-timestamp-to-uri uri timestamp)) (when debug-client-side? (setf (hu.dwim.uri:query-parameter-value uri "debug") "t")) (hu.dwim.uri:print-uri-to-string uri))) ;; it must have an empty body because browsers don't like collapsed <script ... /> in the head "">)) (script-uris-of -self-))> <body ;; NOTE: if javascript is turned on in the browser, then just reload without the marker parameter (this might be true after enabling it and pressing refresh) ,(unless javascript-supported? (bind ((href (hu.dwim.uri:print-uri-to-string (clone-request-uri :strip-query-parameters (list +no-javascript-error-parameter-name+))))) `js-xml(setf window.location.href ,href))) ;; TODO: this is where all of the ext page js should go ,@(with-xhtml-body-environment () `js(progn (Ext.application (create :tabletStartupScreen "tablet_startup.png" :|phoneStartupScreen| "phone_startup.png" :icon "icon.png" :glossOnIcon "false" :on-ready ,(render-content-for -self-)))) `js(progn (log.debug "Loaded successfully, clearing the failed to load timer and showing the page") (clearTimeout document.hdp-failed-to-load-timer))) >>))