Permalink
Browse files

content to md files

  • Loading branch information...
vadym
vadym committed Jul 19, 2013
1 parent 1bceb60 commit 25697e378975001356296c5e7849c5ac6541abbe
Showing with 138 additions and 36 deletions.
  1. +2 −1 composer.json
  2. +13 −0 docs/index.md
  3. +38 −35 lib/Frontend.php
  4. +22 −0 lib/Model/Menu.php
  5. +63 −0 page/gui.php
View
@@ -5,6 +5,7 @@
"require": {
"romaninsh/validation": "dev-master",
"agile55/ga": "dev-master",
- "romaninsh/documenting": "dev-master"
+ "romaninsh/documenting": "dev-master",
+ "dflydev/markdown": "dev-master"
}
}
View
@@ -0,0 +1,13 @@
+Agile Toolkit Demonstration
+===
+
+This demo website is designed to help you learn Agile Toolkit by focusing on a practical examples. Examples are surrounded by a extensive commentary.
+
+How to use this website
+---
+
+Left-side navigation contains links to some of the most popular examples stored here. There are many hidden examples, so do not forget to search the site.
+
+Below is an interactive demonstration. It contains the PHP source code and result produced by that code. [You can run this example in your local installation of Agile Toolkit](<?link?>learn/install/how<?/link?>).
+
+You can also download Codepad alltogether with all it's examples and run it on your local computer. [Full sources of codepad are available as open-source](https://github.com/atk4/atk4-codepad).
View
@@ -8,56 +8,59 @@ function init(){
//$this->dbConnect();
$this->pathfinder->addLocation('./',array(
+ 'docs'=>'docs',
'addons'=>array('atk4-addons','addons','ds-addons'),
'php'=>array('atk4-addons/mvc','atk4-addons/misc/lib'),
// 'template'=>'atk4-addons/misc/templates',
// 'js'=>array('js','templates/js'),
));
-
-
-// $this->addLocation('atk4-addons',array(
-// 'php'=>array(
-// 'mvc',
-// 'misc/lib',
-// ),
-// ))
-// ->setParent($this->pathfinder->base_location);
-
$this->add('jUI');
- }
- function page_back($p){
- $this->redirect('http://agiletoolkit.org/doc/');
- }
- function initLayout(){
- try {
- parent::initLayout();
- }catch(Exception_StopInit $e){}
- $page=$this->page_object;
- if(@$page->descr){
- $page->add('Order')->move(
- $page->add('View_Info')->setHTML($page->descr)
- ,'first')->move(
- $page->add('Button')->set('View Source')->js('click')
- ->univ()->location('https://github.com/atk4/atk4-codepad/blob/master/page/'.
- $this->api->page.'.php')->owner
- ,'first')->now();
-
-
- }
-
- $page->template->eachTag('Code',function($a,$b) use($page){ $page->add('documenting/View_Code',null,$b)->set($a); });
- $page->template->eachTag('Example',function($a,$b) use($page){ $page->add('documenting/View_Example',null,$b)->set($a); });
- $page->template->eachTag('Silent',function($a,$b) use($page){ $page->add('documenting/View_Example',null,$b)->set($a,true); });
- $page->template->eachTag('ExecuteTrigger',function($a,$b) use($page){ $page->add('documenting/View_ExecuteTrigger',null,$b)->set($a,'trigger'); });
+ $r = $this->add("Controller_PatternRouter");
+ $r
+ ->addRule('gui\/(.*)', "gui", array('gui'))
+ ->route();
if(!$this->tree && $this->template->hasTag('SubMenu')){
$tree=$this->add('TreeView',null,'SubMenu',array('submenu'));
$tree->setModel('Menu');
}
+
+ }
+ function page_back($p){
+ $this->redirect('http://agiletoolkit.org/doc/');
}
+// function initLayout(){
+// try {
+// parent::initLayout();
+// }catch(Exception_StopInit $e){}
+// $page=$this->page_object;
+//
+// if(@$page->descr){
+// $page->add('Order')->move(
+// $page->add('View_Info')->setHTML($page->descr)
+// ,'first')->move(
+// $page->add('Button')->set('View Source')->js('click')
+// ->univ()->location('https://github.com/atk4/atk4-codepad/blob/master/page/'.
+// $this->api->page.'.php')->owner
+// ,'first')->now();
+//
+//
+// }
+//
+// $page->template->eachTag('Code',function($a,$b) use($page){ $page->add('documenting/View_Code',null,$b)->set($a); });
+// $page->template->eachTag('Example',function($a,$b) use($page){ $page->add('documenting/View_Example',null,$b)->set($a); });
+// $page->template->eachTag('Silent',function($a,$b) use($page){ $page->add('documenting/View_Example',null,$b)->set($a,true); });
+// $page->template->eachTag('ExecuteTrigger',function($a,$b) use($page){ $page->add('documenting/View_ExecuteTrigger',null,$b)->set($a,'trigger'); });
+//
+//
+// if(!$this->tree && $this->template->hasTag('SubMenu')){
+// $tree=$this->add('TreeView',null,'SubMenu',array('submenu'));
+// $tree->setModel('Menu');
+// }
+// }
function render(){
$this->js(true)->_load('myuniv')->univ()->softScroll();
$this->js(true,'if(window.cb)window.cb($(document).height())');
View
@@ -25,6 +25,28 @@ function init(){
$this->setSource($this->convertArray(array(
'index'=>'About This Site',
+ 'scaffolding' => array(
+ 'Scaffolding',
+ ),
+ 'styles' => array(
+ 'Styles',
+ ),
+ 'grid-system' => array(
+ 'Grid System',
+ 'columns'=>'Columns',
+ 'add-class'=>'addClass (span5)',
+ ),
+ 'grid-system' => array(
+ 'Grid System',
+ 'columns'=>'Columns',
+ 'add-class'=>'addClass (span5)',
+ ),
+ 'responsive-design' => array(
+ 'Responsive Design',
+ ),
+
+ '-----' => array(),
+
'gui'=>array(
'User Interface',
'form'=>'Forms',
View
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Created by JetBrains PhpStorm.
+ * User: vadym
+ * Date: 7/19/13
+ * Time: 4:13 PM
+ * To change this template use File | Settings | File Templates.
+ */
+class page_gui extends Page {
+ function init() {
+ parent::init();
+
+ list($this->md_file,$junk)=explode('.',$_GET['gui']);
+
+ if ($this->md_file == '') {
+ $this->md_file = 'index';
+ }
+
+ $parser = new dflydev\markdown\MarkdownExtraParser();
+ $html = $parser->transformMarkdown(file_get_contents(
+ $this->api->locatePath('docs',$this->md_file.'.md')
+ ));
+
+
+
+ $html=str_replace('<pre><code>','<?Code?>',$html);
+ $html=str_replace('</code></pre>','<?/Code?>',$html);
+ $html=preg_replace(
+ '/<p><img src="([^"]*)" alt="([^"]*)" \/><\/p>/',
+ '<?Image?>\\1 \\2<?/?>',
+ $html
+ );
+
+
+ $this->template->loadTemplateFromString($html);
+
+
+ $page=$this;
+ $page->template->eachTag('Code',function($a,$b) use($page){
+ $page->add('romaninsh/documenting/View_Example',null,$b)->set($a,true);
+ });
+ $page->template->eachTag('Example',function($a,$b) use($page){
+ $page->add('romaninsh/documenting/View_Example',null,$b)->set($a);
+ });
+ $page->template->eachTag('Image',function($a,$b) use($page){
+ list($file,$title)=explode(' ',$a,2);
+ $page->add('View',null,$b)
+ ->setElement('image')
+ ->setAttr('src',$page->api->locateURL('public','images/doc/'.dirname($page->page).'/'.$file))
+ ->setAttr('alt',$title)
+ ->setAttr('title',$title);
+ });
+
+ // relative links
+// $page->template->eachTag('link',
+// function(&$a,$b) use ($page) {
+// var_dump($a);
+// var_dump($b);
+// $page->template->set($b,$page->api->url($a));
+// }
+// );
+ }
+}

0 comments on commit 25697e3

Please sign in to comment.