Commit Graph

42 Commits

Author SHA1 Message Date
Tim Almdal
3969145a36 Move the thumb_proportion method into Theme_View and set it by default
if the page type is album.
Leave a todo if we ever set up a theme default API
2009-05-09 22:22:30 +00:00
Tim Almdal
f9ec5d6de4 Make the scaling based on the target thumbnail size that was specified
at thumbnail creation.  This will remove the upscaling effect
2009-04-22 14:05:16 +00:00
Chad Kieffer
b4bca043ac Added method to determine proportion of current thumb_size to the default, 150. Use this in the the default theme, or any other, to reduce the size of CSS widths and heights in albums, including .gItem. 2009-04-22 05:31:29 +00:00
Bharat Mediratta
96aa486060 Add missing 2nd argument for Theme_View() 2009-03-31 20:34:12 +00:00
Bharat Mediratta
736d74d05f Clean up the login, maintenance login and required-top-level-login code.
We now have two clear and separate login approaches:
  login/ajax
  login/html

Choose the one that's appropriate.  Totally simplified the maintenance
page to be separate from the theme and dead simple, and use login/html
approach there.  Totally simplified the top level login
(login_page.html.php) to just be a login page, not the rest of the
chrome on the page and use the login/ajax approach there.

Don't use access::required in albums and then catch the exception,
instead use access::can and check the return code.

Improve the text for maintenance mode.
2009-03-16 04:33:45 +00:00
Tim Almdal
a521d9177f Force a login if everybody does not have access to the root
item. ticket #118.
2009-03-11 13:58:38 +00:00
Tim Almdal
b9ee37f30e Override the ORM_MTTP::children and ORM_MTPP::descendants methods in
the item model and always pass the orderby fields.  This insures that
all children or descendant calls will respect the album sort order.
2009-03-09 14:38:25 +00:00
Tim Almdal
c0375db79f Restructure the sort order to maintain the sort column and sort order
as two separate columns in the item table.
2009-03-09 13:30:22 +00:00
Bharat Mediratta
198297e0d4 Instead of putting after_install in the url, put it in the session.
This helps us to make sure that we only see the welcome message once.
2009-03-09 00:03:04 +00:00
Tim Almdal
8f1e90d837 Update sort order processing per Bharat's feedback
* Remove mime type and type as sortable fields
* Change the internal representation to serialized array
* Shorten the database field to varchar(64)
2009-03-08 19:10:08 +00:00
Tim Almdal
39954ad0b7 Implement Sortable albums. Current sort fields include (Creation
Date, Update Date, Random Key, Title, Mime Type, Item Type & Number of views)
2009-03-08 16:29:01 +00:00
Bharat Mediratta
2ee995fcc7 If the page number is out of range, redirect to the nearest page.
This fixes a bug where deleting the last photo on a page would take
you to a 404.
2009-02-14 22:25:12 +00:00
Andy Staudacher
e4a9b19bf9 Changing t() placeholder syntax from {{replace_me}} to %replace_me. 2009-01-15 10:02:41 +00:00
Bharat Mediratta
034f30190e Rename 'xxx_changed' events to 'xxx_updated' 2009-01-15 02:52:42 +00:00
Bharat Mediratta
ad4f495e56 Rename events
album_created, photo_created  -> item_created
  album_updated, photo_updated  -> item_updated
2009-01-15 02:51:16 +00:00
Bharat Mediratta
73c52c7140 whitespace fix. 2009-01-15 02:15:10 +00:00
Andy Staudacher
a631fe29f3 i18n refactoring: Rename all _() (reserved by gettext) calls to t().
- And refactor printf to our string interpolation / pluralization syntax
- Also, a slight change to the translations_incomings table, using binary(16) instead of char(32) as message key.
2009-01-08 17:13:06 +00:00
Bharat Mediratta
8620c3fa01 Update event calls to take the orig and new models so that event listeners can do comparisons 2009-01-08 02:39:21 +00:00
Bharat Mediratta
63302ad49c Fix message line so that uploads work 2009-01-04 19:46:37 +00:00
Bharat Mediratta
3d9e5e439e Stay on the right page when we navigate up in the breadcrumb.
Introduce a "show" parameter which contains the id of the item that we
want to show when we go to the parent's page.
2009-01-03 20:14:06 +00:00
Bharat Mediratta
6ab195854d Remove rest::JSON content type; it's causing lots of problems and it doesn't directly help since text/html works just as well for our JSON communications 2008-12-29 22:41:53 +00:00
Bharat Mediratta
8fe1990c99 Don't set the document type to JSON when uploading photos. 2008-12-29 04:20:25 +00:00
Felix Rabinovich
6b1fa62173 Added content type to JSON output functions 2008-12-26 20:08:15 +00:00
Bharat Mediratta
2c91a7e9ce Rework log and message helpers to be parallel, but separate.
1) they now have their own matching severity constants
2) they both have convenience functions success(), info(), warning() and error()
3) they both have severity_class()
2008-12-25 23:43:44 +00:00
Bharat Mediratta
fdc0f83024 Big round of normalization of the way that our controllers
communicate.  Almost all controllers now use JSON to speak to the
theme when we're dealing with form processing.  This means tht we only
send the form back and forth, but we use a JSON protocol to tell the
browser success/error status as well as the location of any newly
created resources, or where the browser should redirect the user.

Lots of small changes:
1) Admin -> Edit Profile is gone.  Instead I fixed the "Modify Profile" link
   in the top right corner to be a modal dialog

2) We use json_encode everywhere.  No more Atom/XML for now.  We can bring those
   back later, though.  For now there's a lot of code duplication but that'll be
   easy to clean up.

3) REST_Controller is no longer abstract.   All methods its subclasses should create
   throw exceptions, which means that subclasses don't have to implement stubs for
   those methods.

4) New pattern: helper method get_add_form calls take an Item_Model,
   not an id since we have to load the Item_Model in the controller
   anyway to check permissions.

5) User/Groups REST resources are separate from User/Group in the site
   admin.  They do different things, we should avoid confusing overlap.
2008-12-25 05:12:46 +00:00
Bharat Mediratta
f6ebb436e4 Rest_Controller -> REST_Controller everywhere, for consistency. 2008-12-25 02:38:53 +00:00
Bharat Mediratta
c7193f9b2e Normalize our Admin controllers so that functions always print out
their results, as opposed to having them return their view back
upstream.  This is a little more code in every controller, but it's
much less magical and more consistent.

Look up the active_theme and active_admin_theme inside the view
itself, no need to do that in the controllers.  This makes view
initialization easier in the controllers.
2008-12-24 04:22:22 +00:00
Bharat Mediratta
672eca5337 Lots of deltas rolled up into a bigger change. Sorry for the mess.
1) Deleted in-place-editing.  We'll be replacing this with a real edit
   system that groups settings together and is more coherent.

2) Tweaked the way that dialog boxes work to get the ajax stuff working
   again.  It's imperfect and does not work properly for uploading images.
   This is going to get redone also, but this is a good resting point.

3) Created edit forms for albums and photos.  Moved _update and _create out
   of Items_Controller and into the individual subclasses.

4) Created access::required which is a shorthand for:
    if (!access::can(...)) {
      access::forbidden();
    }

5) Added validation rules to Items_Model

6) Converted login to use the regular modal dialog approach in the theme.
2008-12-24 00:20:26 +00:00
Bharat Mediratta
ec8462410f Update view counts for albums also 2008-12-20 20:11:51 +00:00
Bharat Mediratta
8b3e244578 We always have at least 1 page in an album. 2008-12-19 01:26:49 +00:00
Bharat Mediratta
b37047ff55 Add Item_Model::viewable() which we can use to restrict any query to
just items viewable by the active user.  Ie:

  ORM::factory("item")
    ->where("name", "foo")
    ->find_all()

Would get all items with the name "foo".

  ORM::factory("item")
    ->viewable()
    ->where("name", "foo")
    ->find_all()

Restricts it to just the set of items that the user is allowed to see.
2008-12-17 22:39:33 +00:00
Bharat Mediratta
65a340efd8 Fix a bug where we were using module::set_var() instead of module::get_var() resulting in
loading all photos in an album on a single page and updating the var on every page load.
2008-12-16 04:52:16 +00:00
Tim Almdal
942dbe175c Remove a couple of todo's by store the "theme name", "admin theme name" and "page size" in the vars table and initializing when the core module is installed 2008-12-12 19:39:38 +00:00
Bharat Mediratta
18a6614a11 Change all access API methods to take ORMs instead of ids. This will
minimize reloading objects from the database.
2008-12-10 07:05:49 +00:00
Bharat Mediratta
4a0e4b798e Check view permissions before allowing view access to albums/photos. 2008-12-09 10:14:09 +00:00
Tim Almdal
3953dde2c6 The rearrange module will now add an album if you drag the "new album" onto the album tree. I haven't had a chance to figure out why the form does get any styling or why a textarea is no included as a list item. 2008-12-02 21:25:15 +00:00
Tim Almdal
70de32ebb4 Insure that the page and offset refere to valid items 2008-11-29 17:08:42 +00:00
Tim Almdal
bac4ff2046 1) Create a Theme_View class that combines the functionality of the Theme class with the View class.
2) Only define the form.html.php::DrawForm method once if there are multiple forms on the page (i.e. comments and add tags)
2008-11-27 16:19:07 +00:00
Bharat Mediratta
7e5f59bcb7 Add children_count to album/photo controllers for consistency with tags 2008-11-27 05:59:37 +00:00
Bharat Mediratta
974f9f7788 Add a new "tag" page type.
Create the concept of "page types" which let us specify the kind of
page that we're rendering in high level terms.  Currently there are
three page types: album, photo and tag.

The tag page type uses slightly different variables.  It has a $tag
but no $item.  Adjust all sidebar_block() functions to avoid printing
stuff that's dependent on the item if there is no item.

Simplify the tag code to stop trying to fake an item.

Update the theme slightly to use $item and $tag where appropriate
(notably, for making the <title> element).
2008-11-26 21:50:45 +00:00
Bharat Mediratta
5638fc5fb6 Change the way that we do RESTful routing.
1) We now use __call() in REST_Controller to handle any requests to a controller
   that were not already handled.  In the case of RESTful controllers, this should
   be the only entry point (although they're free to break the model and add other
   ones.. nothing stops them).

   This means that we can remove all the catch-all routes in
   routes.php which greatly simplifies it.

2) Move request_method() and output_format() out of REST_Controller and into the REST
   helper in core/helpers/rest.php

3) Experiment with letting the various subclasses check the output_format and deal with
   it themselves.  This simplifies the API, but it might be a bad idea in that it might
   push too much work to the individual controllers.  It's a balancing act, time will tell,
   I'm willing to change it back later.
2008-11-19 04:20:35 +00:00
Jozef Selesi
b2772f5a05 * Renamed the album, item and photo controllers to albums, items and photos in order to follow the convention that controllers that refer to a collection of resources have plural names.
* Added a bug workaround to routes.php
2008-11-19 00:12:25 +00:00