Copy of version of the test data creation into the developer module.
One step closer to retiring the scaffolding
This commit is contained in:
parent
c086aa0a9d
commit
7f8fe9420b
|
@ -32,6 +32,16 @@ class Admin_Developer_Controller extends Admin_Controller {
|
|||
print $view;
|
||||
}
|
||||
|
||||
public function test_data() {
|
||||
$v = new Admin_View("admin.html");
|
||||
$v->content = new View("admin_developer.html");
|
||||
$v->content->title = t("Generate Test Data");
|
||||
|
||||
list ($form, $errors) = $this->_get_module_form();
|
||||
$v->content->developer_content = $this->_get_test_data_view($form, $errors);
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function module_create() {
|
||||
access::verify_csrf();
|
||||
|
||||
|
@ -49,10 +59,15 @@ class Admin_Developer_Controller extends Admin_Controller {
|
|||
->name(t("Create Module"));
|
||||
$task = task::create($task_def, array_merge(array("step" => 0), $post->as_array()));
|
||||
|
||||
$success_msg = t("Generation of %module completed successfully",
|
||||
array("module" => $post->name));
|
||||
$error_msg = t("Generation of %module failed.", array("module" => $post->name));
|
||||
print json_encode(array("result" => "started",
|
||||
"url" => url::site("admin/developer/run_create/{$task->id}?csrf=" .
|
||||
access::csrf_token()),
|
||||
"task" => $task->as_array()));
|
||||
"max_iterations" => 15,
|
||||
"success_msg" => $success_msg, "error_msg" => $error_msg,
|
||||
"url" => url::site("admin/developer/run_task/{$task->id}?csrf=" .
|
||||
access::csrf_token()),
|
||||
"task" => $task->as_array()));
|
||||
} else {
|
||||
$v = $this->_get_module_create_content(arr::overwrite($form, $post->as_array()),
|
||||
arr::overwrite($errors, $post->errors()));
|
||||
|
@ -61,22 +76,69 @@ class Admin_Developer_Controller extends Admin_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function run_create($task_id) {
|
||||
public function test_data_create() {
|
||||
access::verify_csrf();
|
||||
|
||||
list ($form, $errors) = $this->_get_test_data_form();
|
||||
|
||||
$post = new Validation($_POST);
|
||||
$post->add_rules("albums", "numeric");
|
||||
$post->add_rules("photos", "numeric");
|
||||
$post->add_rules("comments", "numeric");
|
||||
$post->add_rules("tags", "numeric");
|
||||
$post->add_callbacks("albums", array($this, "_set_default"));
|
||||
$post->add_callbacks("photos", array($this, "_set_default"));
|
||||
$post->add_callbacks("comments", array($this, "_set_default"));
|
||||
$post->add_callbacks("tags", array($this, "_set_default"));
|
||||
|
||||
if ($post->validate()) {
|
||||
$task_def = Task_Definition::factory()
|
||||
->callback("developer_task::create_content")
|
||||
->description(t("Create test content"))
|
||||
->name(t("Create Test Data"));
|
||||
$total = $post->albums + $post->photos + $post->comments + $post->tags;
|
||||
$success_msg = t("Successfully generated test data");
|
||||
$error_msg = t("Problems with test data generation was encountered");
|
||||
$task = task::create($task_def, array("total" => $total, "batch" => (int)ceil($total / 10),
|
||||
"success_msg" => $success_msg,
|
||||
"current" => 0, "error_msg" => $error_msg,
|
||||
"albums" => $post->albums, "photos" => $post->photos,
|
||||
"comments" => $post->comments, "tags" => $post->tags));
|
||||
batch::start();
|
||||
|
||||
print json_encode(array("result" => "started",
|
||||
"max_iterations" => $total + 5,
|
||||
"url" => url::site("admin/developer/run_task/{$task->id}?csrf=" .
|
||||
access::csrf_token()),
|
||||
"task" => $task->as_array()));
|
||||
} else {
|
||||
$v = $this->_get_test_data_view(arr::overwrite($form, $post->as_array()),
|
||||
arr::overwrite($errors, $post->errors()));
|
||||
print json_encode(array("result" => "error",
|
||||
"form" => $v->__toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public function run_task($task_id) {
|
||||
access::verify_csrf();
|
||||
|
||||
$task = task::run($task_id);
|
||||
try {
|
||||
$task = task::run($task_id);
|
||||
} catch (Exception $e) {
|
||||
$error_msg = $e->getMessage();
|
||||
$task->done = true;
|
||||
}
|
||||
|
||||
if ($task->done) {
|
||||
batch::stop();
|
||||
$context = unserialize($task->context);
|
||||
switch ($task->state) {
|
||||
case "success":
|
||||
message::success(t("Generation of %module completed successfully",
|
||||
array("module" => $context["name"])));
|
||||
message::success($context["success_msg"]);
|
||||
break;
|
||||
|
||||
case "error":
|
||||
message::success(t("Generation of %module failed.",
|
||||
array("module" => $context["name"])));
|
||||
message::success(empty($error_msg) ? $context["error_msg"] : $error_msg);
|
||||
break;
|
||||
}
|
||||
print json_encode(array("result" => "success",
|
||||
|
@ -88,30 +150,6 @@ class Admin_Developer_Controller extends Admin_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function session($key) {
|
||||
if (!(user::active()->admin)) {
|
||||
throw new Exception("@todo UNAUTHORIZED", 401);
|
||||
}
|
||||
|
||||
Session::instance()->set($key, $this->input->get("value", false));
|
||||
$this->auto_render = false;
|
||||
url::redirect($_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
private function _get_module_create_content($form, $errors) {
|
||||
$config = Kohana::config("developer.methods");
|
||||
|
||||
$v = new View("developer_module.html");
|
||||
$v->action = "admin/developer/module_create";
|
||||
$v->hidden = array("csrf" => access::csrf_token());
|
||||
$v->theme = $config["theme"];
|
||||
$v->event = $config["event"];
|
||||
$v->menu = $config["menu"];
|
||||
$v->form = $form;
|
||||
$v->errors = $errors;
|
||||
return $v;
|
||||
}
|
||||
|
||||
function mptt() {
|
||||
$v = new Admin_View("admin.html");
|
||||
$v->content = new View("mptt_tree.html");
|
||||
|
@ -163,11 +201,61 @@ class Admin_Developer_Controller extends Admin_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
private function _get_module_form($name="", $description="") {
|
||||
public function _set_default(Validation $post, $field) {
|
||||
if (empty($post->$field)) {
|
||||
$post->$field = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function _get_module_form() {
|
||||
$form = array("name" => "", "description" => "", "theme[]" => array(), "menu[]" => array(),
|
||||
"event[]" => array());
|
||||
$errors = array_fill_keys(array_keys($form), "");
|
||||
|
||||
return array($form, $errors);
|
||||
}
|
||||
|
||||
private function _get_module_create_content($form, $errors) {
|
||||
$config = Kohana::config("developer.methods");
|
||||
|
||||
$v = new View("developer_module.html");
|
||||
$v->action = "admin/developer/module_create";
|
||||
$v->hidden = array("csrf" => access::csrf_token());
|
||||
$v->theme = $config["theme"];
|
||||
$v->event = $config["event"];
|
||||
$v->menu = $config["menu"];
|
||||
$v->form = $form;
|
||||
$v->errors = $errors;
|
||||
return $v;
|
||||
}
|
||||
|
||||
private function _get_test_data_form() {
|
||||
$form = array("albums" => "10", "photos" => "10", "comments" => "10", "tags" => "10",
|
||||
"generate_albums" => "");
|
||||
$errors = array_fill_keys(array_keys($form), "");
|
||||
|
||||
return array($form, $errors);
|
||||
}
|
||||
|
||||
private function _get_test_data_view($form, $errors) {
|
||||
$v = new View("admin_developer_test_data.html");
|
||||
$v->action = "admin/developer/test_data_create";
|
||||
$v->hidden = array("csrf" => access::csrf_token());
|
||||
$album_count = ORM::factory("item")->where("type", "album")->count_all();
|
||||
$photo_count = ORM::factory("item")->where("type", "photo")->count_all();
|
||||
|
||||
$v->comment_installed = module::is_installed("comment");
|
||||
$comment_count = empty($v->comment_installed) ? 0 : ORM::factory("comment")->count_all();
|
||||
|
||||
$v->tag_installed = module::is_installed("tag");
|
||||
$tag_count = empty($v->tag_installed) ? 0 : ORM::factory("tag")->count_all();
|
||||
|
||||
$v->album_count = t2("%count album", "%count albums", $album_count);
|
||||
$v->photo_count = t2("%count photo", "%count photos", $photo_count);
|
||||
$v->comment_count = t2("%count comment", "%count comments", $comment_count);
|
||||
$v->tag_count = t2("%count tag", "%count tags", $tag_count);
|
||||
$v->form = $form;
|
||||
$v->errors = $errors;
|
||||
return $v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ class developer_installer {
|
|||
}
|
||||
|
||||
static function uninstall() {
|
||||
$config = Kohana::config("developer.methods");
|
||||
module::delete("developer");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ class developer_menu_Core {
|
|||
->id("generate_menu")
|
||||
->label(t("Generate Module"))
|
||||
->url(url::site("admin/developer/module")))
|
||||
->append(Menu::factory("link")
|
||||
->id("generate_data")
|
||||
->label(t("Generate Test Data"))
|
||||
->url(url::site("admin/developer/test_data")))
|
||||
->append(Menu::factory("link")
|
||||
->id("mptt_tree_menu")
|
||||
->label(t("MPTT Tree"))
|
||||
|
|
|
@ -147,4 +147,164 @@ class developer_task_Core {
|
|||
ob_end_clean();
|
||||
}
|
||||
}
|
||||
|
||||
static function create_content($task) {
|
||||
$context = unserialize($task->context);
|
||||
$batch_cnt = $context["batch"];
|
||||
while ($context["albums"] > 0 && $batch_cnt > 0) {
|
||||
set_time_limit(30);
|
||||
self::_add_album_or_photo("album");
|
||||
|
||||
$context["current"]++;
|
||||
$context["albums"]--;
|
||||
$batch_cnt--;
|
||||
}
|
||||
while ($context["photos"] > 0 && $batch_cnt > 0) {
|
||||
set_time_limit(30);
|
||||
self::_add_album_or_photo();
|
||||
|
||||
$context["current"]++;
|
||||
$context["photos"]--;
|
||||
$batch_cnt--;
|
||||
}
|
||||
while ($context["comments"] > 0 && $batch_cnt > 0) {
|
||||
self::_add_comment();
|
||||
$context["current"]++;
|
||||
$context["comments"]--;
|
||||
$batch_cnt--;
|
||||
}
|
||||
while ($context["tags"] > 0 && $batch_cnt > 0) {
|
||||
self::_add_tag();
|
||||
$context["current"]++;
|
||||
$context["tags"]--;
|
||||
$batch_cnt--;
|
||||
}
|
||||
$task->done = $context["current"] >= $context["total"];
|
||||
$task->context = serialize($context);
|
||||
$task->state = "success";
|
||||
$task->percent_complete = $context["current"] / $context["total"] * 100;
|
||||
}
|
||||
|
||||
private static function _add_album_or_photo($desired_type=null) {
|
||||
srand(time());
|
||||
$parents = ORM::factory("item")->where("type", "album")->find_all()->as_array();
|
||||
$owner_id = module::is_installed("user") ? user::active()->id : null;
|
||||
|
||||
$test_images = glob(APPPATH . "tests/images/*.[Jj][Pp][Gg]");
|
||||
|
||||
$parent = $parents[array_rand($parents)];
|
||||
$parent->reload();
|
||||
$type = $desired_type;
|
||||
if (!$type) {
|
||||
$type = rand(0, 10) ? "photo" : "album";
|
||||
}
|
||||
if ($type == "album") {
|
||||
$thumb_size = module::get_var("core", "thumb_size");
|
||||
$rand = rand();
|
||||
$parents[] = album::create(
|
||||
$parent, "rnd_$rand", "Rnd $rand", "random album $rand", $owner_id)
|
||||
->save();
|
||||
} else {
|
||||
$photo_index = rand(0, count($test_images) - 1);
|
||||
photo::create($parent, $test_images[$photo_index], basename($test_images[$photo_index]),
|
||||
"rnd_" . rand(), "sample thumb", $owner_id);
|
||||
}
|
||||
}
|
||||
|
||||
private static function _add_comment() {
|
||||
srand(time());
|
||||
$photos = ORM::factory("item")->where("type", "photo")->find_all()->as_array();
|
||||
$users = ORM::factory("user")->find_all()->as_array();
|
||||
|
||||
if (empty($photos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (module::is_installed("akismet")) {
|
||||
akismet::$test_mode = 1;
|
||||
}
|
||||
|
||||
$photo = $photos[array_rand($photos)];
|
||||
$author = $users[array_rand($users)];
|
||||
$guest_name = ucfirst(self::_random_phrase(rand(1, 3)));
|
||||
$guest_email = sprintf("%s@%s.com", self::_random_phrase(1), self::_random_phrase(1));
|
||||
$guest_url = sprintf("http://www.%s.com", self::_random_phrase(1));
|
||||
comment::create($photo, $author, self::_random_phrase(rand(8, 500)),
|
||||
$guest_name, $guest_email, $guest_url);
|
||||
}
|
||||
|
||||
private static function _add_tag() {
|
||||
$items = ORM::factory("item")->find_all()->as_array();
|
||||
|
||||
if (!empty($items)) {
|
||||
$tags = self::_generateTags();
|
||||
|
||||
$tag_name = $tags[array_rand($tags)];
|
||||
$item = $items[array_rand($items)];
|
||||
|
||||
tag::add($item, $tag_name);
|
||||
}
|
||||
}
|
||||
|
||||
private static function _random_phrase($count) {
|
||||
static $words;
|
||||
if (empty($words)) {
|
||||
$sample_text = "Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium
|
||||
laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi
|
||||
architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas
|
||||
sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione
|
||||
voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit,
|
||||
amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut
|
||||
labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis
|
||||
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi
|
||||
consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam
|
||||
nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
|
||||
pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis
|
||||
praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi
|
||||
sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt
|
||||
mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et
|
||||
expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio, cumque
|
||||
nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas
|
||||
assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis
|
||||
debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et
|
||||
molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut
|
||||
reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores
|
||||
repellat.";
|
||||
$words = preg_split('/\s+/', $sample_text);
|
||||
}
|
||||
|
||||
$chosen = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$chosen[] = $words[array_rand($words)];
|
||||
}
|
||||
|
||||
return implode(' ', $chosen);
|
||||
}
|
||||
|
||||
|
||||
private static function _generateTags($number=10){
|
||||
// Words from lorem2.com
|
||||
$words = explode(
|
||||
" ",
|
||||
"Lorem ipsum dolor sit amet consectetuer adipiscing elit Donec odio Quisque volutpat " .
|
||||
"mattis eros Nullam malesuada erat ut turpis Suspendisse urna nibh viverra non " .
|
||||
"semper suscipit posuere a pede Donec nec justo eget felis facilisis " .
|
||||
"fermentum Aliquam porttitor mauris sit amet orci Aenean dignissim pellentesque " .
|
||||
"felis Morbi in sem quis dui placerat ornare Pellentesque odio nisi euismod in " .
|
||||
"pharetra a ultricies in diam Sed arcu Cras consequat Praesent dapibus neque " .
|
||||
"id cursus faucibus tortor neque egestas augue eu vulputate magna eros eu " .
|
||||
"erat Aliquam erat volutpat Nam dui mi tincidunt quis accumsan porttitor " .
|
||||
"facilisis luctus metus Phasellus ultrices nulla quis nibh Quisque a " .
|
||||
"lectus Donec consectetuer ligula vulputate sem tristique cursus Nam nulla quam " .
|
||||
"gravida non commodo a sodales sit amet nisi Pellentesque fermentum " .
|
||||
"dolor Aliquam quam lectus facilisis auctor ultrices ut elementum vulputate " .
|
||||
"nunc Sed adipiscing ornare risus Morbi est est blandit sit amet sagittis vel " .
|
||||
"euismod vel velit Pellentesque egestas sem Suspendisse commodo ullamcorper " .
|
||||
"magna");
|
||||
|
||||
while ($number--) {
|
||||
$results[] = $words[array_rand($words, 1)];
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
}
|
|
@ -6,18 +6,22 @@ var module_success = function(data) {
|
|||
var url = data.url;
|
||||
var done = false;
|
||||
var counter = 0;
|
||||
var max_iterations = data.max_iterations;
|
||||
while (!done) {
|
||||
$.ajax({async: false,
|
||||
success: function(data, textStatus) {
|
||||
$("#gModuleProgress").progressbar("value", data.task.percent_complete);
|
||||
done = data.task.done;
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
done = true;
|
||||
},
|
||||
dataType: "json",
|
||||
type: "POST",
|
||||
url: url
|
||||
});
|
||||
// Leave this in as insurance that we never run away
|
||||
done = done || ++counter > 12;
|
||||
done = done || ++counter > max_iterations;
|
||||
}
|
||||
document.location.reload();
|
||||
};
|
||||
|
|
92
modules/developer/views/admin_developer_test_data.html.php
Normal file
92
modules/developer/views/admin_developer_test_data.html.php
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script>
|
||||
$("#gGenerateTestData").ready(function() {
|
||||
$(".gGenerateCheckbox").click(function() {
|
||||
var buttons = $(this).val();
|
||||
$(buttons).attr("disabled", !this.checked);
|
||||
});
|
||||
<? if (!empty($form["generate_albums"])): ?>
|
||||
$("#gGenerateAlbums").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_photos"])): ?>
|
||||
$("#gGeneratePhotos").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_comments"])): ?>
|
||||
$("#gGenerateCommentss").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_tags"])): ?>
|
||||
$("#gGenerateTags").click();
|
||||
<? endif ?>
|
||||
});
|
||||
</script>
|
||||
<?= form::open($action, array("method" => "post", "id" => "gGenerateTestData"), $hidden) ?>
|
||||
<? if (!empty($album_count)): ?>
|
||||
<p><?= t("Currently:") ?><br />
|
||||
|
||||
<i>(<?= $album_count ?>, <?= $photo_count ?>, <?= $comment_count ?>, <?= $tag_count ?>)</i>
|
||||
</p>
|
||||
<? endif ?>
|
||||
|
||||
<fieldset>
|
||||
<ul>
|
||||
<li <? if (!empty($errors["albums"])): ?> class="gError"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateAlbums", t("Generate Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateAlbums", "name" => "generate_albums", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_albums"])), ".gRadioAlbum") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("album_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "album_$number", "name" => "albums", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioAlbum"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["albums"]) && $errors["albums"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li <? if (!empty($errors["photos"])): ?> class="gError"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGeneratePhotos", t("Generate Photos and Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "gGeneratePhotos", "name" => "generate_photos", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_photos"])), ".gRadioPhoto") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("photo_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "photo_$number", "name" => "photos", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioPhoto"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["photos"]) && $errors["photos"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li
|
||||
<? if(!empty($comment_installed)): ?>
|
||||
<li <? if (!empty($errors["comments"])): ?> class="gError"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateComments", t("Generate Comments")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateComments", "name" => "generate_comments", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_comments"])), ".gRadioComment") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("comment_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "comment_$number", "name" => "comments", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioComment"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["comments"]) && $errors["comments"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<? if(!empty($tag_installed)): ?>
|
||||
<li <? if (!empty($errors["tags"])): ?> class="gError"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateTags", t("Generate Tags")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateTags", "name" => "generate_tags", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_tags"])), ".gRadioTag") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("tag_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "tag_$number", "name" => "tags", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioTag"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["tags"]) && $errors["tags"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<li>
|
||||
<?= form::submit(array("id" => "gGenerateData", "name" => "generate", "class" => "submit", "style" => "clear:both!important"), t("Generate")) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
Reference in New Issue
Block a user