summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/developer/config/developer.php1
-rw-r--r--modules/developer/helpers/developer_task.php38
-rw-r--r--modules/developer/js/developer.js2
-rw-r--r--modules/developer/views/admin_controller.txt.php21
-rw-r--r--modules/developer/views/admin_html.txt.php2
-rw-r--r--modules/developer/views/block.txt.php12
-rw-r--r--modules/developer/views/block_html.txt.php10
-rw-r--r--modules/developer/views/controller.txt.php (renamed from modules/developer/views/helpers.txt.php)37
-rw-r--r--modules/developer/views/menu.txt.php9
-rw-r--r--modules/developer/views/theme.txt.php69
10 files changed, 142 insertions, 59 deletions
diff --git a/modules/developer/config/developer.php b/modules/developer/config/developer.php
index 35ef0acd..9f5919b3 100644
--- a/modules/developer/config/developer.php
+++ b/modules/developer/config/developer.php
@@ -44,7 +44,6 @@ $config["methods"] = array(
"photo_blocks" => t("Photo block"),
"photo_bottom" => t("Bottom of photo content"),
"photo_top" => t("Top of photo content"),
- "sidebar_blocks" => t("Sidebar block"),
"sidebar_bottom" => t("Bottom of sidebar"),
"sidebar_top" => t("Top of sidebar"),
"thumb_bottom" => t("Bottom of thumbnail"),
diff --git a/modules/developer/helpers/developer_task.php b/modules/developer/helpers/developer_task.php
index d1b8e288..5f5c6d7e 100644
--- a/modules/developer/helpers/developer_task.php
+++ b/modules/developer/helpers/developer_task.php
@@ -48,6 +48,7 @@ class developer_task_Core {
self::_render_helper_file($context, "installer");
break;
case 2: // Generate theme helper
+ $context["theme"] = 1;
self::_render_helper_file($context, "theme");
break;
case 3: // Generate block helper
@@ -74,18 +75,40 @@ class developer_task_Core {
break;
case 7: // Generate admin form
$file = "{$context['module_path']}/views/admin_{$context['module']}.html.php";
- Kohana::log("debug", $file);
ob_start();
$v = new View("admin_html.txt");
$v->name = $context["name"];
$v->module = $context["module"];
- $v->class = strtr($context["name"], " ", "");
- Kohana::log("debug", Kohana::debug($v->render()));
+ $v->css_id = preg_replace("#\s+#", "", $context["name"]);
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
- case 8: // Generate module.info (do last)
+ case 8: // Generate controller
+ $file = "{$context['module_path']}/controllers/{$context['module']}.php";
+ ob_start();
+ $v = new View("controller.txt");
+ $v->name = $context["name"];
+ $v->module = $context["module"];
+ $v->class_name = $context["class_name"];
+ $v->css_id = preg_replace("#\s+#", "", $context["name"]);
+ print $v->render();
+ file_put_contents($file, ob_get_contents());
+ ob_end_clean();
+ break;
+ case 9: // Generate sidebar block view
+ $file = "{$context['module_path']}/views/{$context['module']}_block.html.php";
+ ob_start();
+ $v = new View("block_html.txt");
+ $v->name = $context["name"];
+ $v->module = $context["module"];
+ $v->class_name = $context["class_name"];
+ $v->css_id = preg_replace("#\s+#", "", $context["name"]);
+ print $v->render();
+ file_put_contents($file, ob_get_contents());
+ ob_end_clean();
+ break;
+ case 10: // Generate module.info (do last)
$file = "{$context["module_path"]}/module.info";
ob_start();
$v = new View("module_info.txt");
@@ -96,10 +119,10 @@ class developer_task_Core {
ob_end_clean();
break;
}
- $task->done = (++$context["step"]) >= 9;
+ $task->done = (++$context["step"]) >= 11;
$task->context = serialize($context);
$task->state = "success";
- $task->percent_complete = ($context["step"] / 9.0) * 100;
+ $task->percent_complete = ($context["step"] / 11.0) * 100;
}
private static function _render_helper_file($context, $helper) {
@@ -111,8 +134,11 @@ class developer_task_Core {
ob_start();
$v = new View("$helper.txt");
$v->helper = $helper;
+ $v->name = $context["name"];
$v->module = $context["module"];
$v->module_name = $context["name"];
+ $v->css_id = strtr($context["name"], " ", "");
+ $v->css_id = preg_replace("#\s#", "", $context["name"]);
$v->callbacks = empty($context[$helper]) ? array() : array_fill_keys($context[$helper], 1);
print $v->render();
file_put_contents($file, ob_get_contents());
diff --git a/modules/developer/js/developer.js b/modules/developer/js/developer.js
index 4d60b5da..78a95af4 100644
--- a/modules/developer/js/developer.js
+++ b/modules/developer/js/developer.js
@@ -9,7 +9,6 @@ var module_success = function(data) {
var task = data.task;
var url = data.url;
var done = false;
- var counter = 0;
while (!done) {
$.ajax({async: false,
success: function(data, textStatus) {
@@ -20,7 +19,6 @@ var module_success = function(data) {
type: "POST",
url: url
});
- done = done || ++counter >= 10;
}
document.location.reload();
};
diff --git a/modules/developer/views/admin_controller.txt.php b/modules/developer/views/admin_controller.txt.php
index 42b5ff38..7f741378 100644
--- a/modules/developer/views/admin_controller.txt.php
+++ b/modules/developer/views/admin_controller.txt.php
@@ -20,17 +20,13 @@
*/
class Admin_<?= $class_name ?>_Controller extends Admin_Controller {
public function index() {
- $view = new Admin_View("admin.html");
- $view->content = new View("admin_<?=$module ?>.html");
- $view->content->form = $this->_get_admin_form();
-
- print $view;
+ print $this->_get_view();
}
public function handler() {
access::verify_csrf();
- $form = $this->_get_admin_form();
+ $form = $this->_get_form();
if ($form->validate()) {
// @todo process the admin form
@@ -38,17 +34,18 @@ class Admin_<?= $class_name ?>_Controller extends Admin_Controller {
url::redirect("admin/<?= $module ?>");
}
- $view = new Admin_View("admin.html");
- $view->content = new View("admin_<?=$module ?>.html");
- $view->content->form = $form;
- print $view;
+ print $this->_get_view($form);
}
- private function _get_admin_view($form=null) {
+ private function _get_view($form=null) {
+ $v = new Admin_View("admin.html");
+ $v->content = new View("admin_<?=$module ?>.html");
+ $v->content->form = empty($form) ? $this->_get_form() : $form;
+ return $v;
}
- private function _get_admin_form() {
+ private function _get_form() {
$form = new Forge("admin/<?= $module ?>/handler", "", "post",
array("id" => "gAdminForm"));
$group = $form->group("group");
diff --git a/modules/developer/views/admin_html.txt.php b/modules/developer/views/admin_html.txt.php
index 34b699d7..5408cdab 100644
--- a/modules/developer/views/admin_html.txt.php
+++ b/modules/developer/views/admin_html.txt.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>" ?>
-<div id="gAdmin<?= $class ?>">
+<div id="gAdmin<?= $css_id ?>">
<h2>
<?= "<?= t(\"$name Adminstration\") ?>" ?>
</h2>
diff --git a/modules/developer/views/block.txt.php b/modules/developer/views/block.txt.php
index b8a96da0..56c0bf8c 100644
--- a/modules/developer/views/block.txt.php
+++ b/modules/developer/views/block.txt.php
@@ -20,7 +20,19 @@
*/
class <?= $module ?>_block {
static function get($block_id) {
+ $block = new Block();
+ if ($block_id == "<?= $module ?>") {
+ $block->css_id = "g<?= $css_id ?>Admin";
+ $block->title = t("<?= $module ?> Dashboard Block");
+ $block->content = new View("<?= $module ?>block.html");
+
+ $block->content->item = ORM::factory("item", 1);
+ }
+ return $block;
}
+
static function get_list() {
+ return array(
+ "<?= $module ?>" => t("<?= $name ?> Dashboard Block"));
}
}
diff --git a/modules/developer/views/block_html.txt.php b/modules/developer/views/block_html.txt.php
new file mode 100644
index 00000000..b0e07a1a
--- /dev/null
+++ b/modules/developer/views/block_html.txt.php
@@ -0,0 +1,10 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>" ?>
+
+<div class="g<?= $css_id ?>Block">
+ <?= "<a href=\"<?= \$item->url() ?>\">" ?>
+
+ <?= "<?= \$item->thumb_tag(array(\"class\" => \"gThumbnail\")) ?>" ?>
+
+ </a>
+</div>
diff --git a/modules/developer/views/helpers.txt.php b/modules/developer/views/controller.txt.php
index 648015d0..b11fa5f3 100644
--- a/modules/developer/views/helpers.txt.php
+++ b/modules/developer/views/controller.txt.php
@@ -18,9 +18,36 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class <?= $module_name ?>_<?= $helper ?> {
-<? foreach ($callbacks as $callback => $args): ?>
- static function <?= $callback ?>(<?= $args ?>) {
+class <?= $class_name ?>_Controller extends Controller {
+ public function index() {
+ print $this->_get_form();
}
-<? endforeach ?>
-}
+
+ public function handler() {
+ access::verify_csrf();
+
+ $form = $this->_get_form();
+ if ($form->validate()) {
+ // @todo process the admin form
+
+ message::success(t("<?= $name ?> Processing Successfully"));
+
+ print json_encode(
+ array("result" => "success"));
+ } else {
+ print json_encode(
+ array("result" => "error",
+ "form" => $form->__toString()));
+ }
+ }
+
+ private function _get_form() {
+ $form = new Forge("<?= $module ?>/handler", "", "post",
+ array("id" => "g<?= $css_id ?>Form"));
+ $group = $form->group("group")->label(t("<?= $name ?> Handler"));
+ $group->input("text")->label(t("Text"))->rules("required");
+ $group->submit("submit")->value(t("Submit"));
+
+ return $form;
+ }
+} \ No newline at end of file
diff --git a/modules/developer/views/menu.txt.php b/modules/developer/views/menu.txt.php
index 5404f6c5..dd315972 100644
--- a/modules/developer/views/menu.txt.php
+++ b/modules/developer/views/menu.txt.php
@@ -38,5 +38,14 @@ class <?= $module ?>_menu {
<? endif ?>
static function site($menu, $theme) {
+ $item = $theme->item();
+
+ if ($item && access::can("edit", $item)) {
+ $options_menu = $menu->get("options_menu")
+ ->append(Menu::factory("dialog")
+ ->id("<?= $module ?>")
+ ->label(t("Peform <?= $module_name ?> Processing"))
+ ->url(url::site("<?= $module ?>/index/$item->id")));
+ }
}
}
diff --git a/modules/developer/views/theme.txt.php b/modules/developer/views/theme.txt.php
index df7b18e0..339a7553 100644
--- a/modules/developer/views/theme.txt.php
+++ b/modules/developer/views/theme.txt.php
@@ -19,144 +19,149 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class <?= $module ?>_theme {
+ static function sidebar_blocks($theme) {
+ $block = new Block();
+ $block->css_id = "g<?= $css_id ?>";
+ $block->title = t("<?= $name ?>");
+ $block->content = new View("<?= $module ?>_block.html");
+ $block->content->item = ORM::factory("item", 1);
+
+ return $block;
+ }
+
<? if (!empty($callbacks["album_blocks"])): ?>
- static function album_blocks() {
+ static function album_blocks($theme) {
}
<? endif ?>
<? if (!empty($callbacks["album_bottom"])): ?>
- static function album_bottom() {
+ static function album_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["album_top"])): ?>
- static function album_top() {
+ static function album_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_credits"])): ?>
- static function admin_credits() {
+ static function admin_credits($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo"])): ?>
- static function admin_footer() {
+ static function admin_footer($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_header_top"])): ?>
- static function admin_header_top() {
+ static function admin_header_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_header_bottom"])): ?>
- static function admin_header_bottom() {
+ static function admin_header_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_page_bottom"])): ?>
- static function admin_page_bottom() {
+ static function admin_page_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_page_top"])): ?>
- static function admin_page_top() {
+ static function admin_page_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_head"])): ?>
- static function admin_head() {
+ static function admin_head($theme) {
}
<? endif ?>
<? if (!empty($callbacks["credits"])): ?>
- static function credits() {
+ static function credits($theme) {
}
<? endif ?>
<? if (!empty($callbacks["dynamic_bottom"])): ?>
- static function dynamic_bottom() {
+ static function dynamic_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["dynamic_top"])): ?>
- static function dynamic_top() {
+ static function dynamic_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["footer"])): ?>
- static function footer() {
+ static function footer($theme) {
}
<? endif ?>
<? if (!empty($callbacks["head"])): ?>
- static function head() {
+ static function head($theme) {
}
<? endif ?>
<? if (!empty($callbacks["header_bottom"])): ?>
- static function header_bottom() {
+ static function header_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["header_top"])): ?>
- static function header_top() {
+ static function header_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["page_bottom"])): ?>
- static function page_bottom() {
+ static function page_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["pae_top"])): ?>
- static function page_top() {
+ static function page_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_blocks"])): ?>
- static function photo_blocks() {
+ static function photo_blocks($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_bottom"])): ?>
- static function photo_bottom() {
+ static function photo_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_top"])): ?>
- static function photo_top() {
- }
-
-<? endif ?>
-<? if (!empty($callbacks["sidebar_blocks"])): ?>
- static function sidebar_blocks() {
+ static function photo_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["sidebar_bottom"])): ?>
- static function sidebar_bottom() {
+ static function sidebar_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["sidebar_top"])): ?>
- static function sidebar_top() {
+ static function sidebar_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_bottom"])): ?>
- static function thumb_bottom($child) {
+ static function thumb_bottom($theme, $child) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_info"])): ?>
- static function thumb_info($child) {
+ static function thumb_info($theme, $child) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_top"])): ?>
- static function thumb_top($child) {
+ static function thumb_top($theme, $child) {
}
<? endif ?>