Commit Graph

203 Commits

Author SHA1 Message Date
Felix Rabinovich
50dceb5015 Theme Administration implementation 2009-01-01 18:56:06 +00:00
Bharat Mediratta
03c60e2b55 Add deepest album link 2009-01-01 00:28:00 +00:00
Bharat Mediratta
4573ada534 Extend permissions interface to allow resetting to the parental default. 2008-12-31 19:59:42 +00:00
Bharat Mediratta
7d30e55b85 Rename permissions_edit to permissions_browse for consistency 2008-12-31 09:52:03 +00:00
Bharat Mediratta
34372b86c5 Ajaxify the permissions browsing dialog. It only does allow/deny
right now, it doesn't allow you to reset to inherited values.  That's
next.
2008-12-31 09:50:25 +00:00
Bharat Mediratta
48e91e71e5 Rename permission_xxx to permissions_xxx for consistency 2008-12-31 09:04:18 +00:00
Bharat Mediratta
610494296b Turn permission dialog into a browser where you can look at permissions back up the tree 2008-12-31 09:02:40 +00:00
Bharat Mediratta
fc56ebd434 Simplify the next/previous logic in the theme by passing in a null
next/prev sib if one didn't exist.  (that's what we were supposed to
be doing in the first place, anyway)
2008-12-31 07:22:35 +00:00
Bharat Mediratta
c1140b5c0a Add Item_Model::url() and use it where appropriate. Cleans up some
grotty looking stuff in themes.
2008-12-31 07:13:34 +00:00
Bharat Mediratta
44c987e89e Add sibling information on photo pages and a very simple next/previous interface. 2008-12-31 07:06:10 +00:00
Bharat Mediratta
b7f451635a change single to double quotes. 2008-12-31 06:44:38 +00:00
Bharat Mediratta
1579494ec4 Preliminary "Edit Permissions" dialog. You can't change permissions
yet, but it shows you which items have locked view perms.
2008-12-31 04:05:41 +00:00
Bharat Mediratta
ad719b9b6f Fully implement the view_full permission. 2008-12-31 00:18:24 +00:00
Andy Staudacher
59e5ddc13f Update user::create() scaffolding for changes in the user module: can't set the isAdmin bit at creation time. 2008-12-30 21:20:16 +00:00
Bharat Mediratta
a481a684b6 Add a "Graphics Settings" page that lets admins choose which graphics
toolkit we use.  We only allow users to use one toolkit.  The UI needs
work!
2008-12-30 04:14:57 +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
763cc32caf Return the task on success so that our UI can show it at 100% 2008-12-29 21:28:28 +00:00
Bharat Mediratta
8fe1990c99 Don't set the document type to JSON when uploading photos. 2008-12-29 04:20:25 +00:00
Bharat Mediratta
ed8689f768 Expand on the maintenance code to make it more robust and give the
admin more control.  You can now track running tasks, resume stalled
tasks, cancel running tasks, and remove finished tasks.

Added graphics::compose() as a placeholder for future watermark
operations.

Added CSRF protection to maintenance urls.
2008-12-28 23:48:15 +00:00
Bharat Mediratta
74d4e7d505 First round of a task framework. Tasks are job definitions stored in
the database.  They're started with admin/maintenance/start/[task_name]
which sends down some JS/HTML which regularly pings the task at
admin/maintenance/start/[task_id] until its done.

The UI is still very rough.  It works, though!
2008-12-28 10:12:41 +00:00
Felix Rabinovich
6b1fa62173 Added content type to JSON output functions 2008-12-26 20:08:15 +00:00
Bharat Mediratta
6b45be9632 Fix a typo. 2008-12-26 03:56:12 +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
b6f44334d9 Make sure admin method exist before we call them, else we'll just recurse into Admin_Controller::__call() again 2008-12-25 22:29:05 +00:00
Bharat Mediratta
d5a1433f2d Reload the parent before using when adding albums/photos since it may have invalid left/right pointers. 2008-12-25 06:12:16 +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
76b1500209 Clean up the way that we upload via dialogs:
1) If the create request is Ajax, then return a 201 Created response code
2) If we receive back a 201 response, then switch to the new page.
3) Display a status message when we do an upload.
2008-12-23 07:30:14 +00:00
Bharat Mediratta
14da6b65b7 Update to reflect change in album::create API 2008-12-23 04:43:54 +00:00
Bharat Mediratta
5713e3c66e Change photo::create() and album::create() to take ORM instances
instead of ids.
2008-12-23 04:36:09 +00:00
Bharat Mediratta
2502240ce4 Add very simple graphics toolkits.
Track a set of rules in Graphics_Rule_Model which specify how we turn
original images into thumbnails and resizes.  There's one set of rules
that applies to every image in the Gallery.

Track the state of thumbs and resizes with a "dirty" bit.  The new
graphics helper manages the rules and can rebuild the thumbs and
resizes for any images that are considered "dirty".

Introduce the concept of an "album cover" which is an item that an
album points to.  We'll use that item as the source for the album's
thumbnail/resize.

Conflated with this change (sorry!) I also changed the Var table to
use module_name instead of module_id.  This may be marginally less
efficient, but it's much easier to follow in the database.
2008-12-23 04:14:07 +00:00
Bharat Mediratta
bdc0876fa8 Add messaging system for reporting actions back to the user. Make
module install/uninstall work and tie it into the messaging system.
2008-12-22 06:50:20 +00:00
Bharat Mediratta
17f77b8de4 Remove module.info from infrastructure modules that are effectively
libraries that would ship with the core.

Refactor welcome.php to use the newly refactored module::available()
2008-12-22 04:49:30 +00:00
Bharat Mediratta
9cf2c57921 Normalize CSRF handling into the access helper. Probably not the best
place for it, but it'll do for now.

Do CSRF checking in the Admin controller so that we're safe across the
board on the admin side.
2008-12-22 04:33:18 +00:00
Bharat Mediratta
685a5ca1e1 Support proper rendering of locked modules, add a submit button, point it at admin/modules/save 2008-12-22 04:32:23 +00:00
Bharat Mediratta
fe27bd1eb3 Change the way that we track modules.
Each module now has a "module.info" file that has information about
the module, including the core.  We can display the installed version,
and the version in the code.

Also take a first shot at a modules admin page.
2008-12-22 03:41:33 +00:00
Bharat Mediratta
0573698155 Add some more logging code. Now the site admin has some log entries to look at. 2008-12-21 04:43:47 +00:00
Bharat Mediratta
f257f1b350 create a more generic random_phrase() function 2008-12-21 02:02:06 +00:00
Bharat Mediratta
ec8462410f Update view counts for albums also 2008-12-20 20:11:51 +00:00
Bharat Mediratta
50b0613243 Add view counts and show them properly. 2008-12-20 20:04:57 +00:00
Bharat Mediratta
e4bace4c74 Collapse Admin_Dashboard_Controller down into a single theme call, since now
all dashboard blocks are stored in modules.
2008-12-20 01:42:18 +00:00
Bharat Mediratta
9d2d824336 Fix a bug in admin delegation. 2008-12-19 22:14:14 +00:00
Bharat Mediratta
855a5928ce Create a new pattern for Site Admin controllers:
1) They must all start with "admin_".  This pattern is not directly
   routable.

2) Their urls must be /admin/xxx.

3) The Admin_Controller will take the xxx and look for Admin_Xxx_Controller
   and will delegate to that admin controller, after doing security checks.

Moved the users and dashboard views into individual modules for now.
2008-12-19 09:47:13 +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
5ca17fd273 Allow server-side adding of images to other albums than the root 2008-12-19 00:48:45 +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
fa5a8fde4a Switch from cookie sessions to database sessions. We can't use cookie
sessions; it encodes all the value into the cookie which means
little/no security, transfer costs, and storage limits.
2008-12-17 18:32:08 +00:00
Bharat Mediratta
78cd00312e Improve performance by finding the item without walking the tree.
Instead, use the level and the name to get a short list of candidates,
and check each one of those.  In most cases, this query should give us
the right result the first time.
2008-12-17 05:53:05 +00:00