summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes3
-rw-r--r--demos/quickstart/protected/pages/Configurations/PageConfig.page2
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Services.page8
-rw-r--r--framework/Web/Javascripts/extended/base.js8
-rw-r--r--framework/Web/Javascripts/js/prado.js9
-rw-r--r--tools/texbuilder/build.php218
-rw-r--r--tools/texbuilder/prado3_quick_start.pdfbin0 -> 335038 bytes
-rw-r--r--tools/texbuilder/prado3_quick_start.tex83
8 files changed, 312 insertions, 19 deletions
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,
</parameters>
</configuration>
</com:TTextHighlighter>
-The <tt>&lt;paths&gt;</tt>, <tt>&lt;modules&gt;</tt> and <tt>&lt;parameters&gt;</tt> are similar to those in an application configuration. The <tt>&lt;authorization&gt;</tt> 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 <tt>&lt;pages&gt;</tt> element specifies the initial values for the properties of pages. Each <tt>&lt;page&gt;</tt> element specifies the initial property values for a particular page identified by the <tt>id</code attribute. Initial property values given in the <tt>&lt;pages&gt;</tt> element apply to all pages in the current directory and all its subdirectories.
+The <tt>&lt;paths&gt;</tt>, <tt>&lt;modules&gt;</tt> and <tt>&lt;parameters&gt;</tt> are similar to those in an application configuration. The <tt>&lt;authorization&gt;</tt> 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 <tt>&lt;pages&gt;</tt> element specifies the initial values for the properties of pages. Each <tt>&lt;page&gt;</tt> element specifies the initial property values for a particular page identified by the <tt>id</tt> attribute. Initial property values given in the <tt>&lt;pages&gt;</tt> element apply to all pages in the current directory and all its subdirectories.
</p>
</com:TContent> \ 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 <tt>IService</tt> interface
</p>
<p>
A service is uniquely identified by its <tt>ID</tt> property. By default when <tt>THttpRequest</tt> is used as the <a href="?page=Fundamentals.Modules#request">request module</a>, GET variable names are used to identify which service a user is requesting. If a GET variable name is equal to some service <tt>ID</tt>, 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 <tt>page</tt>. For example, the following URL requests for the <tt>Fundamentals.Services</tt> page,
-<div class="source">
+<com:TTextHighlighter Language="none" CssClass="source">
http://hostname/index.php?page=Fundamentals.Services
-</div>
+</com:TTextHighlighter>
</p>
<p>
Developers may implement additional services for their applications. To make a service available, configure it in <a href="?page=Configurations.AppConfig">application configurations</a>.
@@ -23,11 +23,11 @@ Pages may be organized into subdirectories under the <tt>BasePath</tt>. In each
</p>
<p>
Service parameter for the page service refers to the page being requested. A parameter like <tt>Fundamentals.Services</tt> refers to the <tt>Services</tt> page under the <tt>&lt;BasePath&gt;/Fundamentals</tt> directory. If such a parameter is absent in a request, a default page named <tt>Home</tt> is assumed. Using <tt>THttpRequest</tt> as the request module (default), the following URLs will request for <tt>Home</tt>, <tt>About</tt> and <tt>Register</tt> pages, respectively,
-<div class="source">
+<com:TTextHighlighter Language="none" CssClass="source">
http://hostname/index.php<br/>
http://hostname/index.php?page=About<br/>
http://hostname/index.php?page=Users.Register
-</div>
+</com:TTextHighlighter>
where the first example takes advantage of the fact that the page service is the default service and <tt>Home</tt> is the default page.
</p>
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,13 +1,5 @@
/**
- * 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
@ returns element
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 @@
+<?php
+//page root location
+$base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/');
+
+//list page into chapters
+$pages['Getting Started'] = array(
+ 'GettingStarted/Introduction.page',
+ 'GettingStarted/AboutPrado.page',
+ 'GettingStarted/Installation.page');
+
+$pages['Fundamentals'] = array(
+ 'Fundamentals/Architecture.page',
+ 'Fundamentals/Components.page',
+ 'Fundamentals/Controls.page',
+ 'Fundamentals/Pages.page',
+ 'Fundamentals/Modules.page',
+ 'Fundamentals/Services.page',
+ 'Fundamentals/Applications.page',
+ 'Fundamentals/HelloWorld.page',
+ 'Fundamentals/Hangman.page');
+
+$pages['Configurations'] = array(
+ 'Configurations/Overview.page',
+ 'Configurations/Templates1.page',
+ 'Configurations/Templates2.page',
+ 'Configurations/Templates3.page',
+ 'Configurations/AppConfig.page',
+ 'Configurations/PageConfig.page');
+
+$pages['Controls'] = array(
+ 'Controls/Overview.page',
+ 'Controls/Simple.page',
+ 'Controls/List.page',
+ 'Controls/Validation.page',
+ 'Controls/DataList.page',
+ 'Controls/DataGrid.page');
+
+
+//-------------- END CONFIG ------------------
+
+
+function escape_verbatim($matches)
+{
+ return "\begin{verbatim}".str_replace('\$', '$', $matches[2])."\end{verbatim}\n";
+}
+
+function include_image($matches)
+{
+ global $current_path;
+ $image = dirname($current_path).'/'.$matches[1];
+ $file = realpath($image);
+ $info = getimagesize($file);
+ switch($info[2])
+ {
+ case 1:
+ $im = imagecreatefromgif($file);
+ break;
+ case 2: $im = imagecreatefromjpeg($file); break;
+ case 3: $im = imagecreatefrompng($file); break;
+ }
+ global $base;
+
+ if(isset($im))
+ {
+ $prefix = strtolower(str_replace(realpath($base), '', $file));
+ $filename = preg_replace('/\\\|\//', '_', substr($prefix,1));
+ $filename = substr($filename, 0, strrpos($filename,'.')).'.png';
+ $newfile = dirname(__FILE__).'/'.$filename;
+ imagepng($im,$newfile);
+ imagedestroy($im);
+
+ return include_figure($info, $filename);
+ }
+}
+
+function include_figure($info, $filename)
+{
+ $width = sprintf('%0.2f', $info[0]/(135/2.54));
+ return '
+\begin{figure}[ht]
+ \centering
+ \includegraphics[width='.$width.'cm]{'.$filename.'}
+ \label{fig:'.$filename.'}
+\end{figure}
+';
+}
+
+function anchor($matches)
+{
+ $page = get_current_path();
+ return '\hypertarget{'.$page.'/'.$matches[1].'}{}';
+}
+
+function get_current_path()
+{
+ global $current_path, $base;
+ $page = strtolower(substr(str_replace($base, '', $current_path),1));
+ return $page;
+}
+
+function make_link($matches)
+{
+ if(is_int(strpos($matches[1], '#')))
+ {
+ if(strpos($matches[1],'?') ===false)
+ {
+ $target = get_current_path().'/'.substr($matches[1],1);
+ return '\hyperlink{'.$target.'}{'.$matches[2].'}';
+ }
+ else
+ {
+ $page = strtolower(str_replace('?page=', '', $matches[1]));
+ $page = str_replace('.','/',$page);
+ $page = str_replace('#','.page/',$page);
+ return '\hyperlink{'.$page.'}{'.$matches[2].'}';
+ }
+ }
+ else if(is_int(strpos($matches[1],'?')))
+ {
+ $page = str_replace('?page=','',$matches[1]);
+ return '\hyperlink{'.$page.'}{'.$matches[2].'}';
+ }
+ return '\href{'.$matches[1].'}{'.$matches[2].'}';
+}
+
+function parse_html($page,$html)
+{
+ $html = preg_replace('/<\/?com:TContent[^>]*>/', '', $html);
+ $html = preg_replace('/<\/?p>/m', '', $html);
+
+ //headings
+ $html = preg_replace('/<h1[^>]*>([^<]+)<\/h1>/', '\section{$1}', $html);
+ $html = preg_replace('/<h2[^>]*>([^<]+)<\/h2>/', '\subsection{$1}', $html);
+ $html = preg_replace('/<h3[^>]*>([^<]+)<\/h3>/', '\subsubsection{$1}', $html);
+
+ //codes
+ $html = str_replace('$', '\$', $html);
+ $html = preg_replace('/<com:TTextHighlighter[^>]*>/', '`1`', $html);
+ $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html);
+ $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', 'escape_verbatim', $html);
+ $html = preg_replace_callback('/(<div class="source">)([^<]*)(<\/div>)/', 'escape_verbatim', $html);
+
+
+ $html = preg_replace_callback('/<img\s+src="<%~([^"]*)%>"[^\\/]*\/>/', 'include_image', $html);
+
+ //runbar
+ $html = preg_replace('/<com:RunBar\s+PagePath="([^"]*)"\s+\/>/',
+ 'Try, \texttt{http://../quickstart/index.php?page=$1}', $html);
+
+
+ //text modifiers
+ $html = preg_replace('/<b>([^>]*)<\/b>/', '\textbf{$1}', $html);
+ $html = preg_replace('/<i>([^>]*)<\/i>/', '\emph{$1}', $html);
+ $html = preg_replace('/<tt>([^>]*)<\/tt>/', '\texttt{$1}', $html);
+
+ //links
+ $html = preg_replace_callback('/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/',
+ 'make_link', $html);
+ //anchor
+ $html = preg_replace_callback('/<a[^>]+name="([^"]*)"[^>]*><\/a>/', 'anchor', $html);
+
+ //item lists
+ $html = preg_replace('/<ol>/', '\begin{itemize}', $html);
+ $html = preg_replace('/<\/ol>/', '\end{itemize}', $html);
+ $html = preg_replace('/<ul>/', '\begin{enumerate}', $html);
+ $html = preg_replace('/<\/ul>/', '\end{enumerate}', $html);
+ $html = preg_replace('/<li>/', '\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
--- /dev/null
+++ b/tools/texbuilder/prado3_quick_start.pdf
Binary files 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}