Example #1
0
 static function get_add_form_admin()
 {
     $form = new Forge("admin/users/add_group", "", "post", array("id" => "gAddGroupForm"));
     $form_group = $form->group("add_group")->label(t("Add Group"));
     $form_group->input("name")->label(t("Name"))->id("gName");
     $form_group->inputs["name"]->error_messages("in_use", t("There is already a group with that name"));
     $form_group->submit("")->value(t("Add Group"));
     $group = ORM::factory("group");
     $form->add_rules_from($group);
     return $form;
 }
Example #2
0
 static function get_edit_form_admin($product)
 {
     $form = new Forge("admin/product_lines/edit_product/{$product->id}", "", "post", array("id" => "gEditProductForm"));
     $group = $form->group("edit_product")->label(t("Edit Product"));
     $group->input("name")->label(t("Name"))->id("gProductName")->value($product->name);
     $group->inputs["name"]->error_messages("in_use", t("There is already a product with that name"));
     $group->input("cost")->label(t("Cost"))->id("gCost")->value($product->cost);
     $group->input("description")->label(t("Description"))->id("gDescription")->value($product->description);
     $group->submit("")->value(t("Modify Product"));
     $form->add_rules_from($product);
     return $form;
 }
Example #3
0
 static function get_edit_form_admin($postage)
 {
     $form = new Forge("admin/postage_bands/edit_postage_band/{$postage->id}", "", "post", array("id" => "gEditPostageForm"));
     $group = $form->group("edit_postage")->label(t("Edit Postage Band"));
     $group->input("name")->label(t("Name"))->id("gPostageName")->value($postage->name);
     $group->inputs["name"]->error_messages("in_use", t("There is already a postage band with that name"));
     $group->input("flat_rate")->label(t("Flat Rate"))->id("gFlatRate")->value($postage->flat_rate);
     $group->input("per_item")->label(t("Per Item"))->id("gPetItem")->value($postage->per_item);
     $group->submit("")->value(t("Modify Postage Band"));
     $form->add_rules_from($postage);
     return $form;
 }
Example #4
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
     $group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Directory Name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Create"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }
Example #5
0
 static function get_edit_form_admin($product)
 {
     $form = new Forge("admin/product_lines/edit_product/{$product->id}", "", "post", array("id" => "g-edit-product-form"));
     $group = $form->group("edit_product")->label(t("Edit Product"));
     $group->input("name")->label(t("Name"))->id("g-product-name")->value($product->name);
     $group->inputs["name"]->error_messages("in_use", t("There is already a product with that name"));
     $group->input("cost")->label(t("Cost"))->id("g-cost")->value($product->cost);
     $group->input("description")->label(t("Description"))->id("g-description")->value($product->description);
     $group->dropdown("postage_band")->label(t("Postage Band"))->options(postage_band::getPostageArray())->selected($product->postage_band_id);
     $group->submit("")->value(t("Modify Product"));
     $form->add_rules_from($product);
     return $form;
 }
Example #6
0
 static function get_edit_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
     $form->hidden("_method")->value("put");
     $group = $form->group("edit_album")->label(t("Edit Album"));
     if ($parent->id != 1) {
         $group->input("name")->label(t("Name"))->value($parent->name);
     }
     $group->input("title")->label(t("Title"))->value($parent->title);
     $group->textarea("description")->label(t("Description"))->value($parent->description);
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Modify"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }
Example #7
0
 private function _get_edit_form($user)
 {
     $form = new Forge("users/update/{$user->id}", "", "post", array("id" => "g-edit-user-form"));
     $form->set_attr("class", "g-narrow");
     $group = $form->group("edit_user")->label(t("Edit User: %name", array("name" => $user->name)));
     $group->input("full_name")->label(t("Full Name"))->id("g-fullname")->value($user->full_name);
     self::_add_locale_dropdown($group, $user);
     $group->password("password")->label(t("Password"))->id("g-password");
     $group->password("password2")->label(t("Confirm Password"))->id("g-password2")->matches($group->password);
     $group->input("email")->label(t("Email"))->id("g-email")->value($user->email);
     $group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
     $form->add_rules_from($user);
     module::event("user_edit_form", $user, $form);
     $group->submit("")->value(t("Save"));
     return $form;
 }
Example #8
0
 static function get_add_form_admin()
 {
     $form = new Forge("admin/users/add_user", "", "post", array("id" => "gAddUserForm"));
     $group = $form->group("add_user")->label(t("Add User"));
     $group->input("name")->label(t("Username"))->id("gUsername")->error_messages("in_use", t("There is already a user with that username"));
     $group->input("full_name")->label(t("Full Name"))->id("gFullName");
     $group->password("password")->label(t("Password"))->id("gPassword");
     $group->password("password2")->label(t("Confirm Password"))->id("gPassword2")->matches($group->password);
     $group->input("email")->label(t("Email"))->id("gEmail");
     $group->input("url")->label(t("URL"))->id("gUrl");
     self::_add_locale_dropdown($group);
     $group->checkbox("admin")->label(t("Admin"))->id("gAdmin");
     $group->submit("")->value(t("Add User"));
     $user = ORM::factory("user");
     $form->add_rules_from($user);
     return $form;
 }
Example #9
0
 static function get_add_form_admin()
 {
     $form = new Forge("admin/users/add_user", "", "post", array("id" => "gAddUserForm"));
     $group = $form->group("add_user")->label(t("Add User"));
     $group->input("name")->label(t("Name"))->id("gName");
     $group->inputs["name"]->error_messages("in_use", t("There is already a user with that name"));
     $group->input("full_name")->label(t("Full Name"))->id("gFullName");
     $group->password("password")->label(t("Password"))->id("gPassword");
     $group->password("password2")->label(t("Confirm Password"))->id("gPassword2");
     $group->inputs["password2"]->error_messages("mistyped", t("The password and the confirm password must match"));
     $group->input("email")->label(t("Email"))->id("gEmail");
     $group->input("url")->label(t("URL"))->id("gUrl")->value($user->url);
     $group->submit("")->value(t("Add User"));
     $user = ORM::factory("user");
     $form->add_rules_from($user);
     return $form;
 }
Example #10
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddPhotoForm"));
     $group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Filename"));
     $group->upload("file")->label(t("File"))->rules("required|allow[jpg,png,gif,flv,mp4]");
     $group->hidden("type")->value("photo");
     $group->submit("")->value(t("Upload"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }
Example #11
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-photo-form"));
     $group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Filename"));
     $group->input("slug")->label(t("Internet Address"))->value($photo->slug)->callback("item::validate_url_safe")->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
     $group->upload("file")->label(t("File"))->rules("required|allow[jpg,png,gif,flv,mp4]");
     $group->hidden("type")->value("photo");
     $group->submit("")->value(t("Upload"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }
Example #12
0
 static function get_edit_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
     $form->hidden("_method")->value("put");
     $group = $form->group("edit_album")->label(t("Edit Album"));
     $group->input("title")->label(t("Title"))->value($parent->title);
     $group->textarea("description")->label(t("Description"))->value($parent->description);
     if ($parent->id != 1) {
         $group->input("dirname")->label(t("Directory Name"))->value($parent->name)->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain a \"/\""))->callback("item::validate_no_trailing_period")->error_messages("no_trailing_period", t("The directory name can't end in \".\""));
     }
     $sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder"))->label(t("Sort Order"));
     $sort_order->dropdown("column", array("id" => "gAlbumSortColumn"))->label(t("Sort by"))->options(array("weight" => t("Default"), "captured" => t("Capture Date"), "created" => t("Creation Date"), "title" => t("Title"), "updated" => t("Updated Date"), "view_count" => t("Number of views"), "rand_key" => t("Random")))->selected($parent->sort_column);
     $sort_order->dropdown("direction", array("id" => "gAlbumSortDirection"))->label(t("Order"))->options(array("ASC" => t("Ascending"), "DESC" => t("Descending")))->selected($parent->sort_order);
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Modify"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }
Example #13
0
 static function get_add_form($parent)
 {
     $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-album-form"));
     $group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Description"));
     $group->input("name")->label(t("Directory name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
     $group->input("slug")->label(t("Internet Address"))->callback("item::validate_url_safe")->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
     $group->hidden("type")->value("album");
     $group->submit("")->value(t("Create"));
     $form->add_rules_from(ORM::factory("item"));
     $form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
     return $form;
 }
Example #14
0
 static function get_delete_form($tag)
 {
     $form = new Forge("admin/tags/delete/{$tag->id}", "", "post", array("id" => "gDeleteTagForm"));
     $group = $form->group("delete_tag")->label(t("Really delete tag %tag_name?", array("tag_name" => $tag->name)));
     $group->submit("")->value(t("Delete Tag"));
     $form->add_rules_from(ORM::factory("tag"));
     return $form;
 }
Example #15
0
 static function get_edit_form($photo)
 {
     $form = new Forge("photos/{$photo->id}", "", "post", array("id" => "gEditPhotoForm"));
     $form->hidden("_method")->value("put");
     $group = $form->group("edit_photo")->label(t("Edit Photo"));
     $group->input("title")->label(t("Title"))->value($photo->title);
     $group->textarea("description")->label(t("Description"))->value($photo->description);
     $group->input("filename")->label(t("Filename"))->value($photo->name)->error_messages("conflict", t("There is already a file with this name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The photo name can't contain a \"/\""))->callback("item::validate_no_trailing_period")->error_messages("no_trailing_period", t("The photo name can't end in \".\""));
     $group->submit("")->value(t("Modify"));
     $form->add_rules_from(ORM::factory("item"));
     return $form;
 }