Commit Graph

33 Commits

Author SHA1 Message Date
Jakob Hilden
b909132f54 tag changes in the tag admin should now work as expected 2009-03-25 04:47:25 +00:00
Tim Almdal
85f2c6b666 Move the setting of the page title into the controller that is
creating the page.  Provide for a default page title if none is
set. This allows less changes to page.html.php as different modules
want to change the page title.
2009-03-12 16:06:13 +00:00
Tim Almdal
b82b60c91a Rename tag.html.php to dynamic.html.php as part of ticket #115
creating Dynamic Albums.  This name change reflects the usage better
and allows multiple dynamic albums (including tags) to use the same
page template.
2009-03-12 15:40:08 +00:00
Tim Almdal
2b1f68a654 Continue the journey of replacing raw sql with ORM or Database method
calls (Ticket #68)
2009-02-27 00:19:12 +00:00
Andy Staudacher
e4a9b19bf9 Changing t() placeholder syntax from {{replace_me}} to %replace_me. 2009-01-15 10:02:41 +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
3381f1d01a Put up an error if you try to reuse an existing tag name 2009-01-04 22:58:18 +00:00
Bharat Mediratta
92ceef27da Allow renaming of tags using a modal dialog. Put up a confirmation
dialog for deleting tags.  Remove the 4 character restriction on tags
(it was getting ignored by the add form anyway since it was mistakenly
referred to as tag_name there).
2009-01-04 08:44:06 +00:00
Bharat Mediratta
2c27469412 Simple admin tags interface. 2009-01-04 01:55:59 +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
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
fd49c74607 Convert tag module over to returning JSON. 2008-12-25 01:34:17 +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
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
Tim Almdal
1c279887aa Should be get_var not set_var 2008-12-14 03:48:32 +00:00
Bharat Mediratta
d480778108 Don't have to check if the item is loaded now, access::can will guard against unloaded items 2008-12-13 19:49:58 +00:00
Bharat Mediratta
65e237a59a Fix security pattern. We can't successfully call access::can unless the item is loaded. 2008-12-13 09:53:36 +00:00
Tim Almdal
e7a763a8c2 Add permission check on the tag add controller, in case some bypasses the view and tries to access the controller directly. 2008-12-13 08:27:14 +00:00
Tim Almdal
fc3fd3321d Add a permissions check to determine if the active user has edit permission on the item in order to display the tag add form 2008-12-13 07:49:27 +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
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
3992dad486 Move form generation off into tag::get_add_form(). We can't use a controller to generate the form (it's incompatible with our REST model where controllers print stuff) 2008-11-27 06:25:21 +00:00
Bharat Mediratta
d16790de0c Get rid of the placeholder "add tags here..." text, and clear the form
on submit.
2008-11-27 05:45:17 +00:00
Bharat Mediratta
72d16756b1 Refactor cloud generation into a helper so that we can call it from
Tags_Controller::_index().  This enables our Ajax code to reload the
tags block after we submit a new tag, so update the JS to do that
properly.
2008-11-27 05:37:20 +00:00
Bharat Mediratta
5447b83210 Clean up REST pattern in tags:
1) Generate the form in Tags_Controller::_form_add()
2) Process the form submit in Tags_Controller::_create()
3) Create the tag properly

This required me to limit our scope to adding one tag at a time, which
I think is fine if we're doing Ajax style tag addition.
2008-11-27 05:00:50 +00:00
Tim Almdal
b4b72b284b We are now submitting the ajax tag add form to the server correctly and rehooking the ajaxForm 2008-11-27 01:48:01 +00:00
Tim Almdal
d881c91e0c Trying to add tags, but it doesn't work yet. For some reason that i can't figure out, the form never validates and I never get into the true branch of the if. I'm taking a break for awhile. 2008-11-27 00:26:04 +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
9f37aaa1c2 Move Tag_Controller -> Tags_Controller to fit our REST pattern. 2008-11-26 20:40:04 +00:00
Bharat Mediratta
aa19a79e06 Clean up unnecessary comments, remove stray references to Comment_Controller 2008-11-26 20:33:06 +00:00
Tim Almdal
af9a27216d Modify the tag model to behave like a virtual album. There are two outstanding issues that i still have to resolve. The first being there is no thumbnail for the root directory, so it doesn't look quite right. And secondly, the bread crumb shows the dynamic tag album as hot having a parent. I wanted it to be the root directory, but i will overcome :-) 2008-11-26 16:48:00 +00:00
Tim Almdal
03bf3a6af2 Remove the more or less links 2008-11-26 05:08:43 +00:00
Tim Almdal
1ea0382f53 Moving right along on tags. Now the threshold for which tags can be changed. The default is to show all the tags (i.e. count >= the minimum frequency) by clicking on the "See Less" link, the tag cloud will not show the minimum frequency, so the number of tags shown is smaller.
The "See More" link works the opposite way.
2008-11-25 22:38:11 +00:00