diff --git a/3.0/modules/albumpassword/controllers/albumpassword.php b/3.0/modules/albumpassword/controllers/albumpassword.php index 6fea60e8..bf79698d 100644 --- a/3.0/modules/albumpassword/controllers/albumpassword.php +++ b/3.0/modules/albumpassword/controllers/albumpassword.php @@ -109,7 +109,7 @@ class albumpassword_Controller extends Controller { // Display a success message and close the dialog. message::success(t("Password saved.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } public function logout() { @@ -139,10 +139,10 @@ class albumpassword_Controller extends Controller { cookie::delete("g3_albumpassword_id"); cookie::set("g3_albumpassword", $album_password); message::success(t("Password Accepted.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } else { message::error(t("Password Rejected.")); - print "\n\n\n\n\n"; + json::reply(array("result" => "success")); } } diff --git a/3.0/modules/albumtree/helpers/albumtree_installer.php b/3.0/modules/albumtree/helpers/albumtree_installer.php index 592a9b71..77c7066f 100644 --- a/3.0/modules/albumtree/helpers/albumtree_installer.php +++ b/3.0/modules/albumtree/helpers/albumtree_installer.php @@ -20,7 +20,7 @@ class albumtree_installer { static function install() { module::set_var("albumtree", "style", "select"); - module::set_version("albumtree", 2); + module::set_version("albumtree", 3); } static function upgrade($version) { diff --git a/3.0/modules/contactowner/controllers/contactowner.php b/3.0/modules/contactowner/controllers/contactowner.php index 0a302c91..8d140872 100644 --- a/3.0/modules/contactowner/controllers/contactowner.php +++ b/3.0/modules/contactowner/controllers/contactowner.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class ContactOwner_Controller extends Controller { - static function get_email_form($user_id, $item_id) { + static function get_email_form($user_id, $item_id=null) { // Determine name of the person the message is going to. $str_to_name = ""; if ($user_id == -1) { @@ -34,7 +34,7 @@ class ContactOwner_Controller extends Controller { // If item_id is set, include a link to the item. $email_body = ""; - if ($item_id <> "") { + if (!empty($item_id)) { $item = ORM::factory("item", $item_id); $email_body = "This message refers to type}s/{$item->id}") . "\">this page."; } @@ -83,10 +83,10 @@ class ContactOwner_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $this->get_email_form("-1", $item_id); - print $template; + $view = new View("contactowner_emailform.html"); + $view->sendmail_form = $this->get_email_form("-1", $item_id); + + print $view; } public function emailid($user_id, $item_id) { @@ -98,10 +98,11 @@ class ContactOwner_Controller extends Controller { } // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $this->get_email_form($user_id, $item_id); - print $template; + // Set up and display the actual page. + $view = new View("contactowner_emailform.html"); + $view->sendmail_form = $this->get_email_form($user_id, $item_id); + + print $view; } public function sendemail($user_id) { @@ -154,18 +155,12 @@ class ContactOwner_Controller extends Controller { ->message($str_emailbody) ->send(); - // Display a message telling the visitor that their email has been sent. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = t("Your Message Has Been Sent."); - print $template; + message::info(t("Your Message Has Been Sent.")); + json::reply(array("result" => "success")); } else { // Set up and display the actual page. - $template = new Theme_View("page.html", "other", "Contact"); - $template->content = new View("contactowner_emailform.html"); - $template->content->sendmail_form = $form; - print $template; + json::reply(array("result" => "error", "html" => (string) $form)); } } } diff --git a/3.0/modules/contactowner/helpers/contactowner_block.php b/3.0/modules/contactowner/helpers/contactowner_block.php index b2c31500..c2629a56 100644 --- a/3.0/modules/contactowner/helpers/contactowner_block.php +++ b/3.0/modules/contactowner/helpers/contactowner_block.php @@ -53,7 +53,7 @@ class contactowner_block_Core { if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && (module::get_var("contactowner", "contact_user_link") == true)) { $block->content->userLink = "item->owner_id) . "/" . $theme->item->id . "\">" . t("Contact") . " " . + $theme->item->owner_id) . "/" . $theme->item->id . "\" class='g-dialog-link'>" . t("Contact") . " " . $userDetails[0]->name . ""; $displayBlock = true; } @@ -63,10 +63,10 @@ class contactowner_block_Core { if (module::get_var("contactowner", "contact_owner_link")) { if ($theme->item()) { $block->content->ownerLink = "item->id . - "\">" . t(module::get_var("contactowner", "contact_button_text")) . ""; + "\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . ""; } else { $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . ""; + "\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . ""; } $displayBlock = true; } diff --git a/3.0/modules/custom_menus/controllers/admin_custom_menus.php b/3.0/modules/custom_menus/controllers/admin_custom_menus.php new file mode 100644 index 00000000..68b43f71 --- /dev/null +++ b/3.0/modules/custom_menus/controllers/admin_custom_menus.php @@ -0,0 +1,254 @@ +page_title = t("Manage menus"); + $view->content = new View("admin_custom_menus.html"); + $view->content->menu_list = $this->get_html_list(0); + print $view; + } + + public function form_create($id) { + // Display the create new menu form. + print $this->get_new_menu_form($id); + } + + public function form_edit($id) { + // Display the edit menu form. + print $this->get_edit_menu_form($id); + } + + static function get_new_menu_form($id) { + // Generate the create new menu form. + $form = new Forge("admin/custom_menus/create/$id", "", "post", array("id" => "g-create-menu-form")); + $group = $form->group("create_menu") + ->label(t("Add new menu")); + $group->input("menu_title") + ->label(t("Title")); + $group->input("menu_url") + ->label(t("URL (Leave blank if this menu will have sub-menus)")); + $group->submit("")->value(t("Create menu")); + return $form; + } + + static function get_edit_menu_form($id) { + // Generate the edit menu form. + $existing_menu = ORM::factory("custom_menu", $id); + $form = new Forge("admin/custom_menus/edit/$id", "", "post", array("id" => "g-edit-menu-form")); + $group = $form->group("edit_menu") + ->label(t("Edit menu")); + $group->input("menu_title") + ->label(t("Title")) + ->value($existing_menu->title); + $group->input("menu_url") + ->label(t("URL (Leave blank if this menu will have sub-menus)")) + ->value($existing_menu->url); + $group->submit("")->value(t("Save changes")); + return $form; + } + + public function create($id) { + // Save a new menu to the database. + + access::verify_csrf(); + + // Save form variables to the database. + $new_menu = ORM::factory("custom_menu"); + $new_menu->title = Input::instance()->post("menu_title"); + $new_menu->url = Input::instance()->post("menu_url"); + $new_menu->parent_id = $id; + + // Set menu's location to the last position. + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $id) + ->order_by("order_by", "DESC") + ->find_all(1); + if (count($existing_menu) > 0) { + $int_position = $existing_menu[0]->order_by; + $int_position++; + $new_menu->order_by = $int_position; + } else { + $new_menu->order_by = 0; + } + + // Save new menu to the database. + $new_menu->save(); + message::success(t("Menu %menu_name created", array("menu_name" => $new_menu->title))); + log::success("custom_menus", t("Menu %menu_name created", array("menu_name" => $new_menu->title))); + json::reply(array("result" => "success")); + } + + public function edit($id) { + // Save a new menu to the database. + + access::verify_csrf(); + + // Load the existing menu and save changes. + $existing_menu = ORM::factory("custom_menu", $id); + if ($existing_menu->loaded()) { + $existing_menu->title = Input::instance()->post("menu_title"); + $existing_menu->url = Input::instance()->post("menu_url"); + $existing_menu->save(); + message::success(t("Menu %menu_name saved", array("menu_name" => $existing_menu->title))); + log::success("custom_menus", t("Menu %menu_name saved", array("menu_name" => $existing_menu->title))); + json::reply(array("result" => "success")); + } else { + message::error(t("Unable to load menu %menu_id", array("menu_id" => $id))); + log::success("custom_menus", t("Unable to load menu %menu_id", array("menu_id" => $id))); + json::reply(array("result" => "success")); + } + } + + function get_html_list($parent_id) { + // Generate an HTML list of existing menu items. + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $parent_id) + ->order_by("order_by", "ASC") + ->find_all(); + $str_html = ""; + if (count($existing_menu) > 0) { + $str_html = "\n"; + } + return $str_html; + } + + public function form_delete($id) { + // Display a form asking the user if they want to delete a menu. + $one_menu = ORM::factory("custom_menu", $id); + if ($one_menu->loaded()) { + print $this->get_delete_form($one_menu); + } + } + + public function delete($id) { + // Delete the specified menu. + + access::verify_csrf(); + + // Make sure $id belongs to an actual menu. + $one_menu = ORM::factory("custom_menu", $id); + if (!$one_menu->loaded()) { + throw new Kohana_404_Exception(); + } + + // If the form validates, delete the specified menu. + $form = $this->get_delete_form($one_menu); + if ($form->validate()) { + $name = $one_menu->title; + $this->delete_sub_menus($one_menu->id); + $one_menu->delete(); + message::success(t("Deleted menu %menu_name", array("menu_name" => $name))); + log::success("custom_menus", t("Deleted menu %menu_name", array("menu_name" => $name))); + json::reply(array("result" => "success", "location" => url::site("admin/custom_menus"))); + } else { + print $form; + } + } + + function delete_sub_menus($parent_id) { + // Delete all sub menus associated with $parent_id. + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $parent_id) + ->order_by("title", "ASC") + ->find_all(); + foreach ($existing_menu as $one_menu) { + $this->delete_sub_menus($one_menu->id); + $one_menu->delete(); + } + } + + static function get_delete_form($one_menu) { + // Generate a new form asking the user if they want to delete a menu. + $form = new Forge("admin/custom_menus/delete/$one_menu->id", "", "post", array("id" => "g-delete-menu-form")); + $group = $form->group("delete_menu") + ->label(t("Really delete menu %menu_name & sub-menus?", array("menu_name" => $one_menu->title))); + $group->submit("")->value(t("Delete Menu")); + return $form; + } + + public function move_menu_up($id) { + // Move the specified menu item up one position. + $one_menu = ORM::factory("custom_menu", $id); + if ($one_menu->loaded()) { + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $one_menu->parent_id) + ->where("order_by", "<", $one_menu->order_by) + ->order_by("order_by", "DESC") + ->find_all(1); + if (count($existing_menu) > 0) { + $second_menu = ORM::factory("custom_menu", $existing_menu[0]->id); + $temp_position = $one_menu->order_by; + $one_menu->order_by = $second_menu->order_by; + $second_menu->order_by = $temp_position; + $one_menu->save(); + $second_menu->save(); + message::success(t("Menu %menu_title moved up", array("menu_title" => $one_menu->title))); + log::success("custom_menus", t("Menu %menu_title moved up", array("menu_title" => $one_menu->title))); + } + } + url::redirect("admin/custom_menus"); + } + + public function move_menu_down($id) { + // Move the specified menu item down one position. + $one_menu = ORM::factory("custom_menu", $id); + if ($one_menu->loaded()) { + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $one_menu->parent_id) + ->where("order_by", ">", $one_menu->order_by) + ->order_by("order_by", "ASC") + ->find_all(1); + if (count($existing_menu) > 0) { + $second_menu = ORM::factory("custom_menu", $existing_menu[0]->id); + $temp_position = $one_menu->order_by; + $one_menu->order_by = $second_menu->order_by; + $second_menu->order_by = $temp_position; + $one_menu->save(); + $second_menu->save(); + message::success(t("Menu %menu_title moved down", array("menu_title" => $one_menu->title))); + log::success("custom_menus", t("Menu %menu_title moved down", array("menu_title" => $one_menu->title))); + } + } + url::redirect("admin/custom_menus"); + } +} diff --git a/3.0/modules/custom_menus/helpers/custom_menus_event.php b/3.0/modules/custom_menus/helpers/custom_menus_event.php new file mode 100644 index 00000000..28d8632b --- /dev/null +++ b/3.0/modules/custom_menus/helpers/custom_menus_event.php @@ -0,0 +1,75 @@ +get("content_menu") + ->append(Menu::factory("link") + ->id("custom_menus") + ->label(t("Custom Menus Manager")) + ->url(url::site("admin/custom_menus"))); + } + + static function site_menu($menu, $theme) { + // Add user definied menu and sub-menu items to the site menu. + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", "0") + ->order_by("order_by", "DESC") + ->find_all(); + if (count($existing_menu) > 0) { + foreach ($existing_menu as $one_menu) { + if ($one_menu->url == "") { + $menu->add_after("home", $new_menu = Menu::factory("submenu") + ->id("custom_menus-" . $one_menu->id) + ->label(t($one_menu->title))); + custom_menus_event::add_sub_menus($one_menu->id, $new_menu); + } else { + $menu->add_after("home", Menu::factory("link") + ->id("custom_menus-" . $one_menu->id) + ->label(t($one_menu->title)) + ->url($one_menu->url)); + } + } + } + } + + function add_sub_menus($parent_id, $parent_menu) { + // Populate the menu bar with any sub-menu items on the current menu ($parent_menu). + $existing_menu = ORM::factory("custom_menu") + ->where("parent_id", "=", $parent_id) + ->order_by("order_by", "ASC") + ->find_all(); + if (count($existing_menu) > 0) { + foreach ($existing_menu as $one_menu) { + if ($one_menu->url == "") { + $parent_menu->append($new_menu = Menu::factory("submenu") + ->id("custom_menus-" . $one_menu->id) + ->label(t($one_menu->title))); + custom_menus_event::add_sub_menus($one_menu->id, $new_menu); + } else { + $parent_menu->append(Menu::factory("link") + ->id("custom_menus-" . $one_menu->id) + ->label(t($one_menu->title)) + ->url($one_menu->url)); + } + } + } + } +} diff --git a/3.0/modules/custom_menus/helpers/custom_menus_installer.php b/3.0/modules/custom_menus/helpers/custom_menus_installer.php new file mode 100644 index 00000000..39021efb --- /dev/null +++ b/3.0/modules/custom_menus/helpers/custom_menus_installer.php @@ -0,0 +1,37 @@ +query("CREATE TABLE IF NOT EXISTS {custom_menus} ( + `id` int(9) NOT NULL auto_increment, + `title` varchar(255) default NULL, + `url` text default NULL, + `parent_id` int(9) NOT NULL default 0, + `order_by` int(9) NOT NULL default 0, + PRIMARY KEY (`id`), + UNIQUE KEY(`id`)) + DEFAULT CHARSET=utf8;"); + + // Set the module version number. + module::set_version("custom_menus", 1); + } +} diff --git a/3.0/modules/custom_menus/models/custom_menu.php b/3.0/modules/custom_menus/models/custom_menu.php new file mode 100644 index 00000000..475ad99b --- /dev/null +++ b/3.0/modules/custom_menus/models/custom_menu.php @@ -0,0 +1,21 @@ + +
+

+
+ " class="g-dialog-link g-create-link"> + +
+
diff --git a/3.0/modules/dynamic/controllers/admin_dynamic.php b/3.0/modules/dynamic/controllers/admin_dynamic.php index 0f87329f..5c64f1d8 100644 --- a/3.0/modules/dynamic/controllers/admin_dynamic.php +++ b/3.0/modules/dynamic/controllers/admin_dynamic.php @@ -25,33 +25,58 @@ class Admin_Dynamic_Controller extends Admin_Controller { access::verify_csrf(); $form = $this->_get_form(); - if ($form->validate()) { - foreach (array("updates", "popular") as $album) { - $album_defn = unserialize(module::get_var("dynamic", $album)); - $group = $form->inputs[$album]; - $album_defn->enabled = $group->inputs["{$album}_enabled"]->value; - $album_defn->description = $group->inputs["{$album}_description"]->value; - $album_defn->limit = $group->inputs["{$album}_limit"] === "" ? null : - $group->inputs["{$album}_limit"]->value; - module::set_var("dynamic", $album, serialize($album_defn)); + $errors = array_fill_keys(array_keys($form), ""); + if ($_POST) { + $post = new Validation($_POST); + $post->add_rules("updates_enabled", array("valid", "numeric")); + $post->add_rules("popular_enabled", array("valid", "numeric")); + $post->add_rules("updates_limit", array("valid", "numeric")); + $post->add_rules("popular_limit", array("valid", "numeric")); + $post->add_rules("updates_description", "length[0,2048]"); + $post->add_rules("popular_description", "length[0,2048]"); + if ($post->validate()) { + foreach (array("updates", "popular") as $album) { + $album_defn = unserialize(module::get_var("dynamic", $album)); + $album_defn->enabled = $post["{$album}_enabled"]; + $album_defn->description = $post["{$album}_description"]; + $album_defn->limit = $post["{$album}_limit"] === "" ? null : $post["{$album}_limit"]; + module::set_var("dynamic", $album, serialize($album_defn)); + } + + message::success(t("Dynamic Albums Configured")); + + url::redirect("admin/dynamic"); + } else { + $form = arr::overwrite($form, $post->as_array()); + $errors = arr::overwrite($errors, $post->errors()); } - - message::success(t("Dynamic Albums Configured")); - - url::redirect("admin/dynamic"); } - print $this->_get_view($form); + print $this->_get_view($form, $errors); } - private function _get_view($form=null) { + private function _get_view($form=null, $errors=null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_dynamic.html"); $v->content->form = empty($form) ? $this->_get_form() : $form; + $v->content->tabs = array("updates" => t("Recent changes"), "popular" => t("Most viewed")); + $v->content->errors = $errors; return $v; } private function _get_form() { + $form = array(); + foreach (array("updates", "popular") as $album) { + $album_defn = unserialize(module::get_var("dynamic", $album)); + $form["{$album}_enabled"] = $album_defn->enabled; + $form["{$album}_limit"] = $album_defn->limit; + $form["{$album}_description"] = $album_defn->description; + } + + return $form; + } + + private function _get_form2() { $form = new Forge("admin/dynamic/handler", "", "post", array("id" => "g-admin-form")); diff --git a/3.0/modules/dynamic/controllers/dynamic.php b/3.0/modules/dynamic/controllers/dynamic.php index 6d7e3062..10a7a6f5 100644 --- a/3.0/modules/dynamic/controllers/dynamic.php +++ b/3.0/modules/dynamic/controllers/dynamic.php @@ -30,17 +30,17 @@ class Dynamic_Controller extends Controller { $page = Input::instance()->get("page", "1"); $album_defn = unserialize(module::get_var("dynamic", $album)); - $children_count = $album_defn->limit; - if (empty($children_count)) { - $children_count = ORM::factory("item") - ->viewable() - ->where("type", "!=", "album") - ->count_all(); + $display_limit = $album_defn->limit; + $children_count = ORM::factory("item") + ->viewable() + ->where("type", "!=", "album") + ->count_all(); + if (!empty($display_limit)) { + $children_count = min($children_count, $display_limit); } - $offset = ($page-1) * $page_size; - - $max_pages = ceil($children_count / $page_size); + $offset = ($page - 1) * $page_size; + $max_pages = max(ceil($children_count / $page_size), 1); // Make sure that the page references a valid offset if ($page < 1 || ($children_count && $page > ceil($children_count / $page_size))) { diff --git a/3.0/modules/dynamic/views/admin_dynamic.html.php b/3.0/modules/dynamic/views/admin_dynamic.html.php index b810de01..8893e7fc 100644 --- a/3.0/modules/dynamic/views/admin_dynamic.html.php +++ b/3.0/modules/dynamic/views/admin_dynamic.html.php @@ -1,8 +1,40 @@ +

-
- + "g-admin-form")) ?> + +
+
    + $label): ?> +
  • + +
+ +
+
    +
  • + + +
  • +
  • + + + " . t("Limit must be numeric") ?> +
  • +
  • + + + " . t("Description must be less than 2048 bytes") ?> +
  • +
      +
+
+
diff --git a/3.0/modules/item_links/helpers/item_links_event.php b/3.0/modules/item_links/helpers/item_links_event.php new file mode 100644 index 00000000..12cc94a1 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_event.php @@ -0,0 +1,58 @@ +where("item_id", "=", $item->id) + ->find_all(); + + $existing_url = ""; + if (count($item_url) > 0) { + $existing_url = $item_url[0]->url; + } + $form->edit_item + ->input("item_links_url") + ->label(t("Redirect to URL:")) + ->value($existing_url); + } + + static function item_deleted($item) { + // Whenever an item is deleted, delete any corresponding data. + db::build()->delete("item_links")->where("item_id", "=", $item->id)->execute(); + } + + static function item_edit_form_completed($item, $form) { + // Update the database with any changes to the item_links field. + $record = ORM::factory("item_link")->where("item_id", "=", $item->id)->find(); + + if ($form->edit_item->item_links_url->value != "") { + if (!$record->loaded()) { + $record->item_id = $item->id; + } + $record->url = $form->edit_item->item_links_url->value; + $record->save(); + } else { + db::build()->delete("item_links")->where("item_id", "=", $item->id)->execute(); + } + } +} diff --git a/3.0/modules/item_links/helpers/item_links_installer.php b/3.0/modules/item_links/helpers/item_links_installer.php new file mode 100644 index 00000000..f9d34d98 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_installer.php @@ -0,0 +1,34 @@ +query("CREATE TABLE IF NOT EXISTS {item_links} ( + `id` int(9) NOT NULL auto_increment, + `item_id` int(9) NOT NULL, + `url` text default NULL, + PRIMARY KEY (`id`), + KEY(`item_id`, `id`)) + DEFAULT CHARSET=utf8;"); + + // Set the module's version number. + module::set_version("item_links", 1); + } +} diff --git a/3.0/modules/item_links/helpers/item_links_theme.php b/3.0/modules/item_links/helpers/item_links_theme.php new file mode 100644 index 00000000..fbfcbb45 --- /dev/null +++ b/3.0/modules/item_links/helpers/item_links_theme.php @@ -0,0 +1,34 @@ +item()) { + $item_url = ORM::factory("item_link") + ->where("item_id", "=", $theme->item->id) + ->find_all(); + if (count($item_url) > 0) { + url::redirect($item_url[0]->url); + } + } + return; + } +} diff --git a/3.0/modules/item_links/models/item_link.php b/3.0/modules/item_links/models/item_link.php new file mode 100644 index 00000000..65335e27 --- /dev/null +++ b/3.0/modules/item_links/models/item_link.php @@ -0,0 +1,21 @@ +module == "tag") { + $data->messages["warn"][] = t("The MetaDescription module requires the Tags module."); + } + } } diff --git a/3.0/modules/metadescription/helpers/metadescription_installer.php b/3.0/modules/metadescription/helpers/metadescription_installer.php index 6d7d540c..6609ecd9 100644 --- a/3.0/modules/metadescription/helpers/metadescription_installer.php +++ b/3.0/modules/metadescription/helpers/metadescription_installer.php @@ -28,6 +28,14 @@ class metadescription_installer { site_status::clear("metadescription_needs_tag"); } + static function can_activate() { + $messages = array(); + if (!module::is_active("tag")) { + $messages["warn"][] = t("The MetaDescription module requires the Tags module."); + } + return $messages; + } + static function uninstall() { module::delete("metadescription"); } diff --git a/3.0/modules/metadescription/helpers/metadescription_theme.php b/3.0/modules/metadescription/helpers/metadescription_theme.php index 72ef29d0..2952e10a 100644 --- a/3.0/modules/metadescription/helpers/metadescription_theme.php +++ b/3.0/modules/metadescription/helpers/metadescription_theme.php @@ -42,7 +42,7 @@ class metadescription_theme_Core { // Load the meta tags into the top of the page. // @todo: metadescription_block.html requires an item so for now, don't render it unless we // have one. - if ($theme->item()) { + if ($theme->item() || $theme->tag()) { $metaView = new View("metadescription_block.html"); $metaView->tags = $tagsItem; return $metaView; diff --git a/3.0/modules/metadescription/module.info b/3.0/modules/metadescription/module.info index f85dbe80..7010a0d1 100644 --- a/3.0/modules/metadescription/module.info +++ b/3.0/modules/metadescription/module.info @@ -1,7 +1,7 @@ name = "MetaDescription" description = "Automatically generates and inserts KEYWORD and DESCRIPTION meta tags into any theme." version = 1 -author_name = "" -author_url = "" +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" info_url = "http://codex.gallery2.org/Gallery3:Modules:metadescription" -discuss_url = "http://gallery.menalto.com/forum_module_metadescription" +discuss_url = "http://gallery.menalto.com/node/102477" diff --git a/3.0/modules/minislideshow/controllers/admin_minislideshow.php b/3.0/modules/minislideshow/controllers/admin_minislideshow.php index dfd008fe..f66a495a 100644 --- a/3.0/modules/minislideshow/controllers/admin_minislideshow.php +++ b/3.0/modules/minislideshow/controllers/admin_minislideshow.php @@ -76,7 +76,6 @@ class Admin_Minislideshow_Controller extends Admin_Controller { $form = new Forge("admin/minislideshow/saveprefs", "", "post", array("id" => "g-mini-slideshow-admin-form")); - // Get location of slideshow files. $group_slideshow_files = $form->group("Minislideshow"); $group_slideshow_files->input("slideshow_url") @@ -124,4 +123,4 @@ class Admin_Minislideshow_Controller extends Admin_Controller { // Return the newly generated form. return $form; } -} \ No newline at end of file +} diff --git a/3.0/modules/minislideshow/css/minislideshow_menu.css b/3.0/modules/minislideshow/css/minislideshow_menu.css index 19d5e414..d1f5271f 100644 --- a/3.0/modules/minislideshow/css/minislideshow_menu.css +++ b/3.0/modules/minislideshow/css/minislideshow_menu.css @@ -1,4 +1,3 @@ #g-view-menu #g-mini-slideshow-link { background-image: url('../images/ico-view-minislideshow.png'); } - diff --git a/3.0/modules/minislideshow/helpers/minislideshow_event.php b/3.0/modules/minislideshow/helpers/minislideshow_event.php index 6d88569a..a4f76361 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_event.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_event.php @@ -41,6 +41,12 @@ class minislideshow_event_Core { } } + static function pre_deactivate($data) { + if ($data->module == "rss") { + $data->messages["warn"][] = t("The MiniSlide Show module requires the RSS module."); + } + } + static function album_menu($menu, $theme) { // Add an option to access the slideshow from the album view. $menu diff --git a/3.0/modules/minislideshow/helpers/minislideshow_installer.php b/3.0/modules/minislideshow/helpers/minislideshow_installer.php index da071844..3edcf98a 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_installer.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_installer.php @@ -22,4 +22,12 @@ class minislideshow_installer { static function deactivate() { site_status::clear("minislideshow_needs_rss"); } + + static function can_activate() { + $messages = array(); + if (!module::is_active("rss")) { + $messages["warn"][] = t("The MiniSlide Show module requires the RSS module."); + } + return $messages; + } } diff --git a/3.0/modules/minislideshow/helpers/minislideshow_theme.php b/3.0/modules/minislideshow/helpers/minislideshow_theme.php index 266452e0..ee724bcc 100644 --- a/3.0/modules/minislideshow/helpers/minislideshow_theme.php +++ b/3.0/modules/minislideshow/helpers/minislideshow_theme.php @@ -20,10 +20,6 @@ class minislideshow_theme_Core { static function head($theme) { - if (!$theme->item()) { - return; - } - - return new View("minislideshow_header_block.html"); + return $theme->css("minislideshow_menu.css"); } } diff --git a/3.0/modules/minislideshow/module.info b/3.0/modules/minislideshow/module.info index 055b5e23..923b02d5 100644 --- a/3.0/modules/minislideshow/module.info +++ b/3.0/modules/minislideshow/module.info @@ -1,7 +1,7 @@ name = "MiniSlide Show" description = "Display MiniSlide Show on your Gallery." version = 1 -author_name = "" -author_url = "" +author_name = "rWatcher" +author_url = "http://codex.gallery2.org/User:RWatcher" info_url = "http://codex.gallery2.org/Gallery3:Modules:minislideshow" -discuss_url = "http://gallery.menalto.com/forum_module_minislideshow" +discuss_url = "http://gallery.menalto.com/node/90362" diff --git a/3.0/modules/minislideshow/views/minislideshow_dialog.html.php b/3.0/modules/minislideshow/views/minislideshow_dialog.html.php index c9507594..9ae60c0b 100644 --- a/3.0/modules/minislideshow/views/minislideshow_dialog.html.php +++ b/3.0/modules/minislideshow/views/minislideshow_dialog.html.php @@ -15,4 +15,4 @@ flashvars="xmlUrl= Embed: " width="485" height="300" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="minislide" wmode="transparent" allowFullscreen="true" allowScriptAccess="always" quality="high" flashvars="xmlUrl=">" readonly> -
\ No newline at end of file + diff --git a/3.0/modules/minislideshow/views/minislideshow_header_block.html.php b/3.0/modules/minislideshow/views/minislideshow_header_block.html.php deleted file mode 100644 index c52d0117..00000000 --- a/3.0/modules/minislideshow/views/minislideshow_header_block.html.php +++ /dev/null @@ -1,5 +0,0 @@ - - -" /> - - diff --git a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php index a469fe67..72ec5112 100755 --- a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php +++ b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php @@ -39,6 +39,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { */ public function index() { + //Start execution timer + $bgtime=time(); + $view = new Admin_View("admin.html"); $view->page_title = t("Gallery 3 :: Manage Module Updates"); $view->content = new View("admin_moduleupdates.html"); @@ -111,10 +114,12 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $font_color_local = $this->get_local_module_version_color ($module_info->version, $module_info->code_version); list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE"); $font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version); - list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); - $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); - list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); - $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + if(!is_numeric($core_version)) { + list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB"); + $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version); + list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH"); + $font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version); + } if($font_color_core == "red" or $font_color_contrib == "red" or $font_color_gh == "red"){ $update_count++; @@ -174,6 +179,20 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { $view->content->GitHub = $GitHub; $view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")); + //End execution timer + $ExecutionTime = (time()-$bgtime); + if ($ExecutionTime < 1) { + $ExecutionTime = '1'; + }else if ($ExecutionTime <= 30){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else if ($ExecutionTime <= 60){ + $ExecutionTime = '' . $ExecutionTime . ''; + }else{ + $ExecutionTime = '' . $ExecutionTime . ''; + } + + + $view->content->ExecutionTime = $ExecutionTime; print $view; } @@ -252,13 +271,24 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { //Check the Gallery3 Community Contributions GitHub if ($file == null) { try { + $thisInstalledVersion = gallery::VERSION; + //Gallery versions prior to 3.0.2 contained the codename in the version string + if (substr_count($thisInstalledVersion, ' ') > 0 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strpos($thisInstalledVersion," ")); + } + //Truncate the minor version number + if (substr_count($thisInstalledVersion, '.') > 1 ){ + $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strripos($thisInstalledVersion,".")); + } $file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". - substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "))."/modules/".$module_name."/module.info", "r"); + $thisInstalledVersion ."/modules/".$module_name."/module.info", "r"); + if ($file != null) { $server = '(GCC)'; } } catch (Exception $e) { + //echo 'Message: ' .$e->getMessage() . '
'; } } break; @@ -303,6 +333,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller { if($line == "Not entered" or $line == "See git") { $line = ""; } + if (substr_count($line, '.') > 0) { + $line = str_replace('.','',$line); + } $version = $line; break; } else { diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php index 1e60a2cb..85f90489 100644 --- a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php +++ b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php @@ -24,7 +24,7 @@ class moduleupdates_installer { $version = module::get_version("moduleupdates"); if ($version < 1) { - module::set_version("moduleupdates", 7); + module::set_version("moduleupdates", 8); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //create the blank ModuleUpdates cache entry with an expiration of 0 days @@ -34,7 +34,7 @@ class moduleupdates_installer { } static function upgrade($version) { - module::set_version("moduleupdates", 7); + module::set_version("moduleupdates", 8); //Remove the ModuleUpdates cache entry 'JIC' Cache::instance()->delete("ModuleUpdates"); //Empty the ModuleUpdates cache entry so our new version starts from scratch diff --git a/3.0/modules/moduleupdates/module.info b/3.0/modules/moduleupdates/module.info index 603aeff5..7c73c340 100755 --- a/3.0/modules/moduleupdates/module.info +++ b/3.0/modules/moduleupdates/module.info @@ -1,7 +1,7 @@ -name = "Module Updates" +name = "ModuleUpdates" description = "Compares your installed module version against the ones stored in the GitHub." -version = 7 -author_name = "" -author_url = "" +version = 8 +author_name = "brentil" +author_url = "http://gallery.menalto.com/user/153736" info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates" -discuss_url = "http://gallery.menalto.com/forum_module_moduleupdates" +discuss_url = "http://gallery.menalto.com/node/96574" diff --git a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php index e55ed7af..18ff31ed 100644 --- a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php +++ b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php @@ -2,7 +2,7 @@
-

+

@@ -16,7 +16,7 @@
  • Green = Your version is newer than the GitHub
    ") ?>
  • Orange = Your file version is newer than the installed version
    ") ?>
  • Pink = Your installed version is newer than file version
    ") ?>
  • -
  • ") ?>
  • +
  • ") ?>
  • " class="submit" />
  • diff --git a/3.0/modules/pages/controllers/admin_pages.php b/3.0/modules/pages/controllers/admin_pages.php new file mode 100644 index 00000000..cbf8ce6e --- /dev/null +++ b/3.0/modules/pages/controllers/admin_pages.php @@ -0,0 +1,271 @@ +page_title = t("Manage pages"); + $view->content = new View("admin_pages.html"); + $query = ORM::factory("static_page"); + $view->content->pages = $query->order_by("name", "ASC")->find_all(); + $view->content->form = $this->get_prefs_form(); + print $view; + } + + public function createpage() { + // Display a form for creating a new page. + $view = new Admin_View("admin.html"); + $view->page_title = t("Create page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_new_page_form(); + print $view; + } + + public function editpage($id) { + // Display a form for editing an existing page. + $existing_page = ORM::factory("static_page", $id); + $view = new Admin_View("admin.html"); + $view->page_title = t("Edit page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_edit_page_form($existing_page); + print $view; + } + + public function savepage() { + // Save a page to the database. + + access::verify_csrf(); + + // Store form values into variables. + $page_id = Input::instance()->post("page_id"); + $page_name = urlencode(trim(Input::instance()->post("page_name"))); + $page_title = Input::instance()->post("page_title"); + $page_code = Input::instance()->post("page_code"); + $display_menu = Input::instance()->post("display_menu"); + + // If $page_id is set, update an existing page. + if (isset($page_id)) { + $update_page = ORM::factory("static_page", $page_id); + $update_page->title = $page_title; + $update_page->html_code = $page_code; + $update_page->display_menu = $display_menu; + $update_page->save(); + message::success(t("Page %page_name updated", array("page_name" => $update_page->name))); + log::success("pages", t("Page %page_name updated", array("page_name" => $update_page->name))); + url::redirect("admin/pages"); + } else { + + // If $page_id is not set, we are dealing with a new page. + // Check and make sure a page with the same names doesn't already exist. + $existing_page = ORM::factory("static_page") + ->where("name", "=", $page_name) + ->find_all(); + + // If the page doesn't exist, save it to the database. + if (count($existing_page) == 0) { + $new_page = ORM::factory("static_page"); + $new_page->name = $page_name; + $new_page->title = $page_title; + $new_page->html_code = $page_code; + $new_page->display_menu = $display_menu; + $new_page->save(); + message::success(t("Page %page_name created", array("page_name" => $page_name))); + log::success("pages", t("Page %page_name created", array("page_name" => $page_name))); + url::redirect("admin/pages"); + } else { + + // If the page does exist, ask the user if they want to overwrite the old page with the new one. + message::error(t("Page %page_name already exists, press Save again to overwrite.", array("page_name" => $page_name))); + $view = new Admin_View("admin.html"); + $view->page_title = t("Edit page"); + $view->content = new View("admin_pages_new.html"); + $view->content->form = $this->get_overwrite_page_form($existing_page[0]->id, $page_name, $page_title, $page_code, $display_menu); + print $view; + } + } + } + + public function form_delete($id) { + // Display a form asking the user if they want to delete a page. + $one_page = ORM::factory("static_page", $id); + if ($one_page->loaded()) { + print $this->get_delete_form($one_page); + } + } + + public function delete($id) { + // Delete the specified page. + + access::verify_csrf(); + + // Make sure $id belongs to an actual page. + $one_page = ORM::factory("static_page", $id); + if (!$one_page->loaded()) { + throw new Kohana_404_Exception(); + } + + // If the form validates, delete the specified page. + $form = $this->get_delete_form($one_page); + if ($form->validate()) { + $name = $one_page->name; + $one_page->delete(); + message::success(t("Deleted page %page_name", array("page_name" => $name))); + log::success("pages", t("Deleted page %page_name", array("page_name" => $name))); + json::reply(array("result" => "success", "location" => url::site("admin/pages"))); + } else { + print $form; + } + } + + public function form_rename($id) { + // Display a form to allow the user to rename a page. + $one_page = ORM::factory("static_page", $id); + if ($one_page->loaded()) { + print InPlaceEdit::factory(urldecode($one_page->name)) + ->action("admin/pages/rename/$id") + ->render(); + } + } + + public function rename($id) { + // Rename an existing page. + access::verify_csrf(); + + // Make sure the page specified by $id exists. + $one_page = ORM::factory("static_page", $id); + if (!$one_page->loaded()) { + throw new Kohana_404_Exception(); + } + + $in_place_edit = InPlaceEdit::factory($one_page->name) + ->action("admin/pages/rename/$one_page->id") + ->rules(array("required", "length[1,64]")); + + // If the form validates, and if the new name doesn't already exist, rename the page. + if ($in_place_edit->validate()) { + $old_name = $one_page->name; + $new_name = urlencode(trim($in_place_edit->value())); + $new_name_exists = ORM::factory("static_page")->where("name", "=", $new_name)->find_all(); + if (count($new_name_exists) == 0) { + $one_page->name = $new_name; + $one_page->save(); + $message = t("Renamed page %old_name to %new_name", + array("old_name" => $old_name, "new_name" => $new_name)); + message::success($message); + log::success("pages", $message); + json::reply(array("result" => "success", "location" => url::site("admin/pages"))); + } else { + json::reply(array("result" => "error", "form" => (string)$in_place_edit->render())); + } + } else { + json::reply(array("result" => "error", "form" => (string)$in_place_edit->render())); + } + } + + static function get_delete_form($one_page) { + // Generate a new form asking the user if they want to delete a page. + $form = new Forge("admin/pages/delete/$one_page->id", "", "post", array("id" => "g-delete-pages-form")); + $group = $form->group("delete_page") + ->label(t("Really delete page %page_name?", array("page_name" => $one_page->name))); + $group->submit("")->value(t("Delete Page")); + return $form; + } + + private function get_new_page_form() { + // Generate a form for creating a new page. + $form = new Forge("admin/pages/savepage", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("new_page"); + $pages_group->input("page_name") + ->label(t("Name")); + $pages_group->input("page_title") + ->label(t("Title")); + $pages_group->textarea("page_code") + ->label(t("HTML Code")); + $pages_group->checkbox("display_menu") + ->label(t("Display in menu?")) + ->checked(false); + $pages_group->submit("save_page") + ->value(t("Save")); + + return $form; + } + + private function get_overwrite_page_form($id, $name, $title, $html_code, $display_menu) { + // Generate a form for overwriting an existing page. + $form = new Forge("admin/pages/savepage", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("new_page"); + $pages_group->hidden("page_id") + ->value($id); + $pages_group->input("page_name") + ->label(t("Name")) + ->readonly() + ->value($name); + $pages_group->input("page_title") + ->label(t("Title")) + ->value($title); + $pages_group->textarea("page_code") + ->label(t("HTML Code")) + ->value($html_code); + $pages_group->checkbox("display_menu") + ->label(t("Display in menu?")) + ->checked($display_menu); + $pages_group->submit("save_page") + ->value(t("Save")); + + return $form; + } + + private function get_edit_page_form($existing_page) { + // Generate a form for editing an existing page. Reuse the overwrite form for as it's basically the same thing. + return ($this->get_overwrite_page_form($existing_page->id, $existing_page->name, $existing_page->title, $existing_page->html_code, $existing_page->display_menu)); + } + + private function get_prefs_form() { + // Generate a form for global preferences. + $form = new Forge("admin/pages/saveprefs", "", "post", + array("id" => "g-pages-admin-form")); + + $pages_group = $form->group("preferences")->label(t("Settings")); + $pages_group->checkbox("display_sidebar") + ->label(t("Hide sidebar on Pages?")) + ->checked(module::get_var("pages", "show_sidebar")); + $pages_group->submit("save_prefs") + ->value(t("Save")); + + return $form; + } + + public function saveprefs() { + // Save a preferences to the database. + + access::verify_csrf(); + + // Save form variables. + module::set_var("pages", "show_sidebar", Input::instance()->post("display_sidebar")); + + // Display message and load main pages admin screen. + message::success(t("Your settings have been saved.")); + url::redirect("admin/pages"); + } +} diff --git a/3.0/modules/pages/controllers/pages.php b/3.0/modules/pages/controllers/pages.php new file mode 100644 index 00000000..d567af47 --- /dev/null +++ b/3.0/modules/pages/controllers/pages.php @@ -0,0 +1,42 @@ +where("name", "=", $page_name) + ->find_all(); + + // If it doesn't exist, display a 404 error. + if (count($existing_page) == 0) { + throw new Kohana_404_Exception(); + } + + // Display the page. + $template = new Theme_View("page.html", "other", "Pages"); + $template->page_title = t("Gallery :: ") . t($existing_page[0]->title); + $template->content = new View("pages_display.html"); + $template->content->title = $existing_page[0]->title; + $template->content->body = $existing_page[0]->html_code; + print $template; + } +} diff --git a/3.0/modules/pages/css/jHtmlArea.css b/3.0/modules/pages/css/jHtmlArea.css new file mode 100644 index 00000000..641ea291 --- /dev/null +++ b/3.0/modules/pages/css/jHtmlArea.css @@ -0,0 +1,48 @@ +div.jHtmlArea { display: inline block; border: solid 1px #ccc; } +div.jHtmlArea div { padding: 0px; margin: 0px; } +div.jHtmlArea .ToolBar { } +div.jHtmlArea .ToolBar ul { border: solid 0px #ccc; margin: 1px; padding: 1px; position:relative; display: inline; background: #fff url(../images/jHtmlArea_Toolbar_Group_BG.png) repeat-x;} +div.jHtmlArea .ToolBar ul li { list-style-type: none; float: left; border: none; padding: 1px; margin: 1px; } +div.jHtmlArea .ToolBar ul li:hover { border: solid 1px #ccc; background: #ddd url(../images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png); padding: 0; } +div.jHtmlArea .ToolBar ul li a { display: block; width: 16px; height: 16px; background: url(../images/jHtmlArea.png) no-repeat -16px -500px; border: none; cursor: pointer; padding: 0px; } +div.jHtmlArea .ToolBar ul li a.highlighted { border: solid 1px #aaa; background-color: #bbb; padding: 0; } +div.jHtmlArea .ToolBar ul li.separator {height: 16px; margin: 0 2px 0 3px; border-left: 1px solid #ccc;} +div.jHtmlArea .ToolBar ul li.separator:hover { padding: 1px; background-color: #fff; border-top:none; border-bottom:none; border-right:none;} + +div.jHtmlArea .ToolBar ul li a:hover { } +div.jHtmlArea .ToolBar ul li a.bold { background-position: 0 0; } +div.jHtmlArea .ToolBar ul li a.italic { background-position: -16px 0; } +div.jHtmlArea .ToolBar ul li a.underline { background-position: -32px 0; } +div.jHtmlArea .ToolBar ul li a.strikethrough { background-position: -48px 0; } +div.jHtmlArea .ToolBar ul li a.link { background-position: -64px 0; } +div.jHtmlArea .ToolBar ul li a.unlink { background-position: -80px 0; } +div.jHtmlArea .ToolBar ul li a.orderedlist { background-position: -96px 0; } +div.jHtmlArea .ToolBar ul li a.unorderedlist { background-position: -112px 0; } +div.jHtmlArea .ToolBar ul li a.image { background-position: -128px 0; } +div.jHtmlArea .ToolBar ul li a.cut { background-position: -144px 0; } +div.jHtmlArea .ToolBar ul li a.copy { background-position: -160px 0; } +div.jHtmlArea .ToolBar ul li a.paste { background-position: -176px 0; } + +div.jHtmlArea .ToolBar ul li a.html { background-position: -192px 0; opacity:0.6; filter:alpha(opacity=60);} +div.jHtmlArea .ToolBar ul li a.html.highlighted { opacity:1.0; filter:alpha(opacity=100);} + +div.jHtmlArea .ToolBar ul li a.h1 { background-position: 0 -16px;} +div.jHtmlArea .ToolBar ul li a.h2 { background-position: -16px -16px;} +div.jHtmlArea .ToolBar ul li a.h3 { background-position: -32px -16px;} +div.jHtmlArea .ToolBar ul li a.h4 { background-position: -48px -16px;} +div.jHtmlArea .ToolBar ul li a.h5 { background-position: -64px -16px;} +div.jHtmlArea .ToolBar ul li a.h6 { background-position: -80px -16px;} +div.jHtmlArea .ToolBar ul li a.subscript { background-position: -96px -16px;} +div.jHtmlArea .ToolBar ul li a.superscript { background-position: -112px -16px;} +div.jHtmlArea .ToolBar ul li a.indent { background-position: -128px -16px;} +div.jHtmlArea .ToolBar ul li a.outdent { background-position: -144px -16px;} +div.jHtmlArea .ToolBar ul li a.horizontalrule { background-position: -160px -16px;} +div.jHtmlArea .ToolBar ul li a.p { background-position: -176px -16px;} + + +div.jHtmlArea .ToolBar ul li a.justifyleft { background-position: 0 -32px;} +div.jHtmlArea .ToolBar ul li a.justifycenter { background-position: -16px -32px;} +div.jHtmlArea .ToolBar ul li a.justifyright { background-position: -32px -32px;} +div.jHtmlArea .ToolBar ul li a.increasefontsize { background-position: -48px -32px;} +div.jHtmlArea .ToolBar ul li a.decreasefontsize { background-position: -64px -32px;} +div.jHtmlArea .ToolBar ul li a.forecolor { background-position: -80px -32px;} \ No newline at end of file diff --git a/3.0/modules/pages/helpers/pages_block.php b/3.0/modules/pages/helpers/pages_block.php new file mode 100644 index 00000000..2eae8861 --- /dev/null +++ b/3.0/modules/pages/helpers/pages_block.php @@ -0,0 +1,57 @@ + t("Pages Links")); + } + + static function get($block_id, $theme) { + $block = ""; + + switch ($block_id) { + case "pages_block": + + // Create a new block with a list of all Pages and their links. + + // Query the database for all existing pages. + // If at least one page exists, display the sidebar block. + $query = ORM::factory("static_page"); + $pages = $query->order_by("title", "ASC")->find_all(); + if (count($pages) > 0) { + + // Loop through each page and generate an HTML list of their links and titles. + $content = ""; + + // Make a new sidebar block. + $block = new Block(); + $block->css_id = "g-pages"; + $block->title = t("Pages"); + $block->content = new View("pages_sidebar.html"); + $block->content->links = $content; + } + break; + } + return $block; + } +} diff --git a/3.0/modules/pages/helpers/pages_event.php b/3.0/modules/pages/helpers/pages_event.php new file mode 100644 index 00000000..3cb37d0b --- /dev/null +++ b/3.0/modules/pages/helpers/pages_event.php @@ -0,0 +1,44 @@ +get("content_menu") + ->append(Menu::factory("link") + ->id("pages") + ->label(t("Pages Settings")) + ->url(url::site("admin/pages"))); + } + + static function site_menu($menu, $theme) { + $menu_pages = ORM::factory("static_page") + ->where("display_menu", "=", true) + ->order_by("title", "DESC") + ->find_all(); + if (count($menu_pages) > 0) { + foreach ($menu_pages as $one_page) { + $menu->add_after("home", Menu::factory("link") + ->id("pages-" . $one_page->id) + ->label(t($one_page->title)) + ->url(url::site("pages/show/" . $one_page->name))); + } + } + } +} diff --git a/3.0/modules/pages/helpers/pages_installer.php b/3.0/modules/pages/helpers/pages_installer.php new file mode 100644 index 00000000..cd1f1546 --- /dev/null +++ b/3.0/modules/pages/helpers/pages_installer.php @@ -0,0 +1,44 @@ +query("CREATE TABLE IF NOT EXISTS {static_pages} ( + `id` int(9) NOT NULL auto_increment, + `name` varchar(255) default NULL, + `title` varchar(255) default NULL, + `html_code` text default NULL, + `display_menu` boolean default 0, + PRIMARY KEY (`id`), + UNIQUE KEY(`name`)) + DEFAULT CHARSET=utf8;"); + + // Set the module version number. + module::set_version("pages", 2); + } + static function upgrade($version) { + $db = Database::instance(); + if ($version == 1) { + $db->query("ALTER TABLE {static_pages} ADD COLUMN `display_menu` boolean default 0"); + module::set_version("pages", $version = 2); + } + } +} diff --git a/3.0/modules/pages/helpers/pages_theme.php b/3.0/modules/pages/helpers/pages_theme.php new file mode 100644 index 00000000..ec57a2ce --- /dev/null +++ b/3.0/modules/pages/helpers/pages_theme.php @@ -0,0 +1,27 @@ +script("jHtmlArea-0.7.0.js") . + $theme->css("jHtmlArea.css"); + } +} + \ No newline at end of file diff --git a/3.0/modules/pages/images/jHtmlArea.png b/3.0/modules/pages/images/jHtmlArea.png new file mode 100644 index 00000000..54c66a10 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea.png differ diff --git a/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png new file mode 100644 index 00000000..bcfb0545 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group_BG.png differ diff --git a/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png new file mode 100644 index 00000000..4287b5b8 Binary files /dev/null and b/3.0/modules/pages/images/jHtmlArea_Toolbar_Group__Btn_Select_BG.png differ diff --git a/3.0/modules/pages/js/jHtmlArea-0.7.0.js b/3.0/modules/pages/js/jHtmlArea-0.7.0.js new file mode 100644 index 00000000..d1e360c4 --- /dev/null +++ b/3.0/modules/pages/js/jHtmlArea-0.7.0.js @@ -0,0 +1,403 @@ +/* +* jHtmlArea 0.7.0 - WYSIWYG Html Editor jQuery Plugin +* Copyright (c) 2009 Chris Pietschmann +* http://jhtmlarea.codeplex.com +* Licensed under the Microsoft Reciprocal License (Ms-RL) +* http://jhtmlarea.codeplex.com/license +*/ +(function($) { + $.fn.htmlarea = function(opts) { + if (opts && typeof (opts) === "string") { + var args = []; + for (var i = 1; i < arguments.length; i++) { args.push(arguments[i]); } + var htmlarea = jHtmlArea(this[0]); + var f = htmlarea[opts]; + if (f) { return f.apply(htmlarea, args); } + } + return this.each(function() { jHtmlArea(this, opts); }); + }; + var jHtmlArea = window.jHtmlArea = function(elem, options) { + if (elem.jquery) { + return jHtmlArea(elem[0]); + } + if (elem.jhtmlareaObject) { + return elem.jhtmlareaObject; + } else { + return new jHtmlArea.fn.init(elem, options); + } + }; + jHtmlArea.fn = jHtmlArea.prototype = { + + // The current version of jHtmlArea being used + jhtmlarea: "0.7.0", + + init: function(elem, options) { + if (elem.nodeName.toLowerCase() === "textarea") { + var opts = $.extend({}, jHtmlArea.defaultOptions, options); + elem.jhtmlareaObject = this; + + var textarea = this.textarea = $(elem); + var container = this.container = $("
    ").addClass("jHtmlArea").width(textarea.width()).insertAfter(textarea); + + var toolbar = this.toolbar = $("
    ").addClass("ToolBar").appendTo(container); + priv.initToolBar.call(this, opts); + + var iframe = this.iframe = $("