From e8e20e87941ae992afd49f2d70198b0e7437d58e Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 21 Jan 2006 23:16:33 +0000 Subject: Add quickstart PDF format. --- .gitattributes | 3 + .../protected/pages/Configurations/PageConfig.page | 2 +- .../protected/pages/Fundamentals/Services.page | 8 +- framework/Web/Javascripts/extended/base.js | 8 - framework/Web/Javascripts/js/prado.js | 9 +- tools/texbuilder/build.php | 218 +++++++++++++++++++++ tools/texbuilder/prado3_quick_start.pdf | Bin 0 -> 335038 bytes tools/texbuilder/prado3_quick_start.tex | 83 ++++++++ 8 files changed, 312 insertions(+), 19 deletions(-) create mode 100644 tools/texbuilder/build.php create mode 100644 tools/texbuilder/prado3_quick_start.pdf create mode 100644 tools/texbuilder/prado3_quick_start.tex diff --git a/.gitattributes b/.gitattributes index bf3c2897..70a4a86e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -875,3 +875,6 @@ tools/jsbuilder/custom_rhino.jar -text tools/jsbuilder/packer.js -text tools/phpbuilder/build.php -text tools/phpbuilder/files.txt -text +tools/texbuilder/build.php -text +tools/texbuilder/prado3_quick_start.pdf -text svneol=unset#unset +tools/texbuilder/prado3_quick_start.tex -text diff --git a/demos/quickstart/protected/pages/Configurations/PageConfig.page b/demos/quickstart/protected/pages/Configurations/PageConfig.page index 2aff1fb9..606d65a9 100644 --- a/demos/quickstart/protected/pages/Configurations/PageConfig.page +++ b/demos/quickstart/protected/pages/Configurations/PageConfig.page @@ -30,7 +30,7 @@ The format of a page configuration file is as follows, -The <paths>, <modules> and <parameters> are similar to those in an application configuration. The <authorization> specifies the authorization rules that apply to the current page directory and all its subdirectories. It will be explained in more detail in future sections. The <pages> element specifies the initial values for the properties of pages. Each <page> element specifies the initial property values for a particular page identified by the id<pages> element apply to all pages in the current directory and all its subdirectories. +The <paths>, <modules> and <parameters> are similar to those in an application configuration. The <authorization> specifies the authorization rules that apply to the current page directory and all its subdirectories. It will be explained in more detail in future sections. The <pages> element specifies the initial values for the properties of pages. Each <page> element specifies the initial property values for a particular page identified by the id attribute. Initial property values given in the <pages> element apply to all pages in the current directory and all its subdirectories.

\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Services.page b/demos/quickstart/protected/pages/Fundamentals/Services.page index 61bd440b..031eac60 100644 --- a/demos/quickstart/protected/pages/Fundamentals/Services.page +++ b/demos/quickstart/protected/pages/Fundamentals/Services.page @@ -6,9 +6,9 @@ A service is an instance of a class implementing the IService interface

A service is uniquely identified by its ID property. By default when THttpRequest is used as the request module, GET variable names are used to identify which service a user is requesting. If a GET variable name is equal to some service ID, the request is considered for that service, and the value of the GET variable is passed as the service parameter. For page service, the name of the GET variable must be page. For example, the following URL requests for the Fundamentals.Services page, -

+ http://hostname/index.php?page=Fundamentals.Services -
+

Developers may implement additional services for their applications. To make a service available, configure it in application configurations. @@ -23,11 +23,11 @@ Pages may be organized into subdirectories under the BasePath. In each

Service parameter for the page service refers to the page being requested. A parameter like Fundamentals.Services refers to the Services page under the <BasePath>/Fundamentals directory. If such a parameter is absent in a request, a default page named Home is assumed. Using THttpRequest as the request module (default), the following URLs will request for Home, About and Register pages, respectively, -

+ http://hostname/index.php
http://hostname/index.php?page=About
http://hostname/index.php?page=Users.Register -
+ where the first example takes advantage of the fact that the page service is the default service and Home is the default page.

diff --git a/framework/Web/Javascripts/extended/base.js b/framework/Web/Javascripts/extended/base.js index 48927b75..06a916d6 100644 --- a/framework/Web/Javascripts/extended/base.js +++ b/framework/Web/Javascripts/extended/base.js @@ -1,12 +1,4 @@ -/** - * true if o is an Element Node or document or window. The last two because it's used for onload events - if you specify strict as true, return false for document or window - */ -function isElement(o, strict) { - return o && isObject(o) && ((!strict && (o==window || o==document)) || o.nodeType == 1) -} - /** * get element @ @param element or element id string diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js index ef28bcd6..1683b3fe 100644 --- a/framework/Web/Javascripts/js/prado.js +++ b/framework/Web/Javascripts/js/prado.js @@ -158,9 +158,6 @@ function isList(o){ return o&&isObject(o)&&isArray(o); } -function isElement(o,_2){ -return o&&isObject(o)&&((!_2&&(o==window||o==document))||o.nodeType==1); -} function $(n,d){ if(isElement(n)){ return n; @@ -191,9 +188,9 @@ x=d.getElementById(n); return x; } Function.prototype.bindEvent=function(){ -var _6=this,args=$A(arguments),object=args.shift(); -return function(_7){ -return _6.apply(object,[_7||window.event].concat(args)); +var _4=this,args=$A(arguments),object=args.shift(); +return function(_5){ +return _4.apply(object,[_5||window.event].concat(args)); }; }; diff --git a/tools/texbuilder/build.php b/tools/texbuilder/build.php new file mode 100644 index 00000000..0cea6aee --- /dev/null +++ b/tools/texbuilder/build.php @@ -0,0 +1,218 @@ +]*>/', '', $html); + $html = preg_replace('/<\/?p>/m', '', $html); + + //headings + $html = preg_replace('/]*>([^<]+)<\/h1>/', '\section{$1}', $html); + $html = preg_replace('/]*>([^<]+)<\/h2>/', '\subsection{$1}', $html); + $html = preg_replace('/]*>([^<]+)<\/h3>/', '\subsubsection{$1}', $html); + + //codes + $html = str_replace('$', '\$', $html); + $html = preg_replace('/]*>/', '`1`', $html); + $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html); + $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', 'escape_verbatim', $html); + $html = preg_replace_callback('/(
)([^<]*)(<\/div>)/', 'escape_verbatim', $html); + + + $html = preg_replace_callback('/"[^\\/]*\/>/', 'include_image', $html); + + //runbar + $html = preg_replace('//', + 'Try, \texttt{http://../quickstart/index.php?page=$1}', $html); + + + //text modifiers + $html = preg_replace('/([^>]*)<\/b>/', '\textbf{$1}', $html); + $html = preg_replace('/([^>]*)<\/i>/', '\emph{$1}', $html); + $html = preg_replace('/([^>]*)<\/tt>/', '\texttt{$1}', $html); + + //links + $html = preg_replace_callback('/]+href="([^"]*)"[^>]*>([^<]*)<\/a>/', + 'make_link', $html); + //anchor + $html = preg_replace_callback('/]+name="([^"]*)"[^>]*><\/a>/', 'anchor', $html); + + //item lists + $html = preg_replace('/
    /', '\begin{itemize}', $html); + $html = preg_replace('/<\/ol>/', '\end{itemize}', $html); + $html = preg_replace('/
      /', '\begin{enumerate}', $html); + $html = preg_replace('/<\/ul>/', '\end{enumerate}', $html); + $html = preg_replace('/
    • /', '\item ', $html); + $html = preg_replace('/<\/li>/', '', $html); + + $html = html_entity_decode($html); + + + return $html; +} + +function get_chapter_label($chapter) +{ + return '\hypertarget{'.str_replace(' ', '', $chapter).'}{}'; +} + +function get_section_label($section) +{ + $section = str_replace('.page', '', $section); + return '\hypertarget{'.str_replace('/', '.', $section).'}{}'; +} + +//--------------- BEGIN PROCESSING ------------------- + +$count = 1; +$current_path = ''; +echo "Compiling .page files to Latex files\n\n"; +foreach($pages as $chapter => $sections) +{ + $content = '\chapter{'.$chapter.'}'.get_chapter_label($chapter); + echo "Creating ch{$count}.txt => Chapter {$count}: {$chapter}\n"; + echo str_repeat('-',60)."\n"; + foreach($sections as $section) + { + echo " Adding $section\n"; + $page = $base.'/'.$section; + $current_path = $page; + $content .= get_section_label($section); + $content .= parse_html($page,file_get_contents($page)); + } + + //var_dump($content); + file_put_contents("ch{$count}.tex", $content); + $count++; + echo "\n"; +} + +if($count > 1) +{ + echo "** Use Latex and pdfText to compile the main tex file. **\n"; +} + + +?> \ No newline at end of file diff --git a/tools/texbuilder/prado3_quick_start.pdf b/tools/texbuilder/prado3_quick_start.pdf new file mode 100644 index 00000000..4f6ddbf1 Binary files /dev/null and b/tools/texbuilder/prado3_quick_start.pdf differ diff --git a/tools/texbuilder/prado3_quick_start.tex b/tools/texbuilder/prado3_quick_start.tex new file mode 100644 index 00000000..675ec357 --- /dev/null +++ b/tools/texbuilder/prado3_quick_start.tex @@ -0,0 +1,83 @@ +\documentclass{book} +\usepackage[pdftex]{graphicx} +\usepackage[pdftex]{hyperref} + +\usepackage{fancyhdr} + +%---------- fonts Type 1 ----------------- +%\usepackage{times} +%\usepackage[T1]{fontenc} +%\usepackage{textcomp} + +%------------------------Page set-up----------------------------------------- + +\renewcommand{\baselinestretch}{1.25} +\setlength{\hoffset}{-1in} +\setlength{\oddsidemargin}{3.5cm} +\setlength{\evensidemargin}{3.5cm} +\setlength{\topmargin}{0cm} +\setlength{\footskip}{2cm} +\setlength{\headheight}{14pt} +\setlength{\marginparwidth}{0cm} +\setlength{\marginparsep}{0cm} +\setlength{\marginparpush}{0cm} +\setlength{\textwidth}{15cm} +\setlength{\parindent}{0cm} +\setlength{\parskip}{0.75\baselineskip} + +%------------------------------------------------------------------------------ + + +%---- change link style ---- +\hypersetup{colorlinks, linkcolor=blue, pdfstartview={FitH}} + + +% Pages and Fancyheadings stuff +%----------------------------------------------------------------------- +\cfoot{\thepage} +\fancyhead[LE,RO]{} +\fancyhead[LO]{\nouppercase{\scshape\rightmark}} +\fancyhead[RE]{\nouppercase{\scshape\leftmark}} +%----------------------------------------------------------------------- + +%----------------- TITLE -------------- + +\title{\Huge \bfseries Prado Quick Start} +\author{Qiang Xue \\[7mm] \today} +\date{ Compiled by Wei Zhuo} + + +%-------------- BEGIN DOCUMENT ------------------ + + +\begin{document} + +\maketitle + +\pagestyle{plain} +\addcontentsline{toc}{chapter}{Contents} +\pagenumbering{roman} +\tableofcontents + +\newpage + +\chapter*{Preface} +\addcontentsline{toc}{chapter}{Preface} +Prado quick start doc + +\newpage + +\pagestyle{fancyplain} +\pagenumbering{arabic} + +\include{ch1} +\include{ch2} +\include{ch3} +\include{ch4} +\include{ch5} +\include{ch6} +\include{ch7} +\include{ch8} + + +\end{document} -- cgit v1.2.3