Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial implementation of codepad

  • Loading branch information...
commit 2571b36d9ed5009122dbf6f56c84d80ed0ade6df 1 parent e321923
@romaninsh romaninsh authored
2  atk4
@@ -1 +1 @@
-Subproject commit 32bd4c9eb8106ea9ddbadfae0e853f3b392b3a5e
+Subproject commit 2664bc3a895e1626da496c3ede8f4f5af884d75e
View
4 lib/Controller/Person.php
@@ -0,0 +1,4 @@
+<?php
+class Controller_Person extends Controller {
+ public $model_name='Model_Person';
+}
View
11 lib/Frontend.php
@@ -8,6 +8,9 @@ function init(){
// Keep this if you are going to use database on all pages
//$this->dbConnect();
+ $this->dbConnect();
+
+
// This will add some resources from atk4-addons, which would be located
// in atk4-addons subdirectory.
$this->addLocation('atk4-addons',array(
@@ -21,6 +24,10 @@ function init(){
// A lot of the functionality in Agile Toolkit requires jUI
$this->add('jUI');
+ $p=explode('_',$this->page);
+ $this->add('Button')->set('View source')->addStyle('float','right')
+ ->js('click')
+ ->univ()->redirect('source/'.$p[0]);
// Initialize any system-wide javascript libraries here
// If you are willing to write custom JavaScritp code,
// place it into templates/js/atk4_univ_ext.js and
@@ -49,11 +56,7 @@ function init(){
// it and place in a separate class
$m=$this->add('Menu',null,'Menu');
$m->addMenuItem('Welcome','index');
- $m->addMenuItem('How Do I..?','how');
- $m->addMenuItem('Database Test','dbtest');
- $m->addMenuItem('Auth test','authtest');
$m->addMenuItem('about');
- $m->addMenuItem('logout');
// If you want to use ajax-ify your menu
// $m->js(true)->_load('ui.atk4_menu')->atk4_menu(array('content'=>'#Content'));
View
10 lib/Model/Person.php
@@ -0,0 +1,10 @@
+<?php
+class Model_Person extends Model_Table {
+ public $entity_code='person';
+ public $table_alias='p';
+ function defineFields(){
+ parent::defineFields();
+
+ $this->addField('name');
+ }
+}
View
17 page/entity.php
@@ -0,0 +1,17 @@
+<?php
+class page_entity extends Page_EntityManager {
+ public $controller='Controller_Person';
+ function init(){
+ $this->api->dbConnect();
+ parent::init();
+ }
+ function initMainPage(){
+ parent::initMainPage();
+
+ $this->grid->addColumnPlain('link','./subpage','Click me');
+
+ }
+ function page_subpage(){
+ $this->add('Text')->set('You have clicked on id='.(int)$_GET['id']);
+ }
+}
View
9 page/index.php
@@ -5,15 +5,6 @@ function init(){
$p=$this;
- // Paste some code here for quick-start
-
- $p->add('Button')
- ->js('click')->univ()
- ->alert('JavaScript / jQuery / Univ Works!');
-
-
-
-
}
function defaultTemplate(){
View
13 page/source.php
@@ -0,0 +1,13 @@
+<?php
+class page_source extends Page {
+ function subPageHandler($p){
+
+ $t=$this->add('Text');
+ try{
+ $t->set(highlight_string(file_get_contents($this->api->locate('page',$p.'.php')),true));
+ }catch(PathFinder_Exception $e){
+ $t->destroy();
+ $this->add('View_Error')->set('This file is not found');
+ }
+ }
+}
View
9 templates/jui/page/index.html
@@ -1,10 +1,5 @@
-<h1>Hello World from your own copy of Agile Toolkit</h1>
-<p>Welcome to Agile Toolkit. You are few steps away from starting building your own Web Software compatible
-with jQuery UI CSS Framework.</p>
-
-<h2>Quick-start</h2>
-<p>Now it's a good time for you to go to <a href="http://agiletoolkit.org/">agiletoolkit.org</a> and copy-paste some sample code into page/index.php. After you do that, you should see it appearing below:
-</p>
+<h1>Welcome to the simple Codepad for Agile Toolkit</h1>
+<p>For now there are no way to post your code samples here. But we are going to add that feature soon</p>
<?$Content?>
Please sign in to comment.
Something went wrong with that request. Please try again.