[Z-Lc@sdZdZddd!ZddlZddlZddlZddlZddlmZddkZ d dkZ d efd YZ dS( sA baseclass for the SkeletonPage template Meta-Data ========== Author: Tavis Rudd , Version: $Revision: 1.13 $ Start Date: 2001/04/05 Last Revision Date: $Date: 2002/10/01 17:52:02 $ s!Tavis Rudd s$Revision: 1.13 $i iiN(tTemplateiit _SkeletonPagecBseZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z dddd dZdZddZdddZidZdZRS(s)A baseclass for the SkeletonPage templates?tswww.example.coms$Designed & Implemented by Tavis Rudds Tavis RuddscOsytj|||iidd6dd6d6idd6d6|_i|_g|_i|_i|_i|_i|_dS( NtCheetahtkeywordsstext/html; charset=iso-8859-1s Content-Types HTTP-EQUIVs+Cheetah: The Python-Powered Template Enginet generatortNAME( Rt__init__t _metaTagst _stylesheetst_stylesheetsOrdert_stylesheetLibst_javascriptLibst_javascriptTagst_bodyTagAttribs(tselftargstKWs((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pyR/s       cCs|j|jS(s~Return a formatted vesion of the self._metaTags dictionary, using the formatMetaTags function from Cheetah.Macros.HTML(tformatMetaTagsR(R((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytmetaTagsBsc Cs+d}x5|jjD]$\}}|dt|d7}qW|jsK|S|d7}x|jD]}||jkrd|d}|GH||7}q_n|j|}d}d}x<|jD].\} } |t| dt| d7}qW|d }d |d |d }||7}q_W|d 7}|S(s2Return a formatted version of the self._stylesheetLibs and self._stylesheets dictionaries. The keys in self._stylesheets must be listed in the order that they should appear in the list self._stylesheetsOrder, to ensure that the style rules are defined in the correct order.Rs- s (R titemststrR R ( RtstylesheetTagsTxtttitletsrct identifiertwarningt attribsDicttcssCodet attribCodetktv((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytstylesheetTagsHs.    &  cCsg}xn|jjD]]\}}t|ttfsFd|g}n|dt|ddt|ddg7}qWxn|jjD]]\}}t|ttfsd|g}n|dt|ddt|ddg7}qWdj|S( sReturn a formatted version of the javascriptTags and javascriptLibs dictionaries. Each value in javascriptTags should be a either a code string to include, or a list containing the JavaScript version number and the code string. The keys can be anything. The same applies for javascriptLibs, but the string should be the SRC filename rather than a code string.Rs s" type="text/javascript" src="is" /> (R t iteritemst isinstancetlistttupleRR tjoin(RtjavascriptTagsTxttkeytdetails((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytjavascriptTagsmscCs|jd|jS(s>Create a body tag from the entries in the dict bodyTagAttribs.tbody(t formHTMLTagR(R((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytbodyTagsic Cs|j|}| s| ryOddl}|j|}|j\}} ~|s\|}n|sk| }nWqyJtjd|jjd\}} |s|}n|s| }nWqqXqXn|r|rdjd|dt |dt |d |d t |d g S|rSdjd|dt |d |d t |d g S|rdjd|dt |d |d t |d g Sdjd|d |d t |d gSdS( sDynamically generate an image tag. Cheetah will try to convert the src argument to a WebKit serverSidePath relative to the servlet's location. If width and height aren't specified they are calculated using PIL or ImageMagick if available.iNsidentify -format "%w,%h" t,Rs s
���( t normalizePathtImagetopentsizetostpopentreadtsplitR&R( RRtalttwidththeighttborderR0timt calcWidtht calcHeight((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytimgTags>   "    $cCstjdtjtjS(s,Return a string representing the current yr.s%Y(ttimetstrftimet localtime(R((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pyt currentYrss %b %d, %YcCstj|tjtjS(s3Return a string representing the current localtime.(R?R@RA(Rt formatString((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pyt currentDatesicCsdt|t|fS(Ns6(R(RR8R9((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pytspacerscCsnd|jg}x?|jD]1\}}|d|jdt|dg7}qW|jddj|S(s*returns a string containing an HTML tR(tlowerRRtappendR&(RttagNamet attributesttagTxttnametval((sL/opt/freeware/lib/python2.7/site-packages/Cheetah/Templates/_SkeletonPage.pyR,s ) cCsg}d|kr[xF|djD]1\}}|dt|dt|dg7}q#Wnd|krxF|djD]1\}}|dt|dt|dg7}qxWndj|S(s9format a dict of metaTag definitions into an HTML versions HTTP-EQUIVs Rs