Edit image title and description from album context

jond Member
Hi,

I want to edit an image's title and description from an album context. It is simpler to use javascript to cycle through the images than waiting for a page refresh, and 90% of the time I'm looking at an image through pretty-themed css front-end, and just want to use the ajax editable to make fast changes. It's a great UI feature for a great program.

It seems the program flow for the editable ajax calls works like so: In the template, I can call "printEditable(...)" (in zp-core/template-function.php) which will actually prints:

`

editInPlace('editable_image_6', 'image', 'desc');`

on the web page. The javascript function is included in the html template's <head> and (called jquery.editinplace.js).

The parameters that matter are:

context -- tells ZP if we're updating an image or an album
current-page-url -- this is the magic that tells ZP which photo or album is currently being edited.

The logic is if zp knows the context is image, then zp will look at the url to decide which image to edit, and do the edit. The problem is i'm viewing all the images from the album page. I need a way to send the image url with the ajax call. so i fixed it up with a couple simple tweaks shown below.

in other words, there are about 2 core zp changes to make, one in the JS file, and one in the template-funcitons file that allow specifying which image url should be edited....

`

diff zenphoto/zp-core/template-functions.php _zenphotos/zp-core/template-functions.php

1158a1159

> * @param string $save_url is url of context needed to edit image information when images are shown all at once

1162c1163

< function printEditable($context, $field, $editable = false, $editclass = 'editable', $messageIfEmpty = true, $convertBR = false, $override = false, $label='') {

---

> function printEditable($context, $field, $editable = false, $editclass = 'editable', $messageIfEmpty = true, $convertBR = false, $override = false, $label='', $save_url=false) {

1213c1214,1218

< echo "editInPlace('editable_{$context}_$id', '$context', '$field');";

---

> if ($save_url === false) {

> echo "editInPlace('editable_{$context}_$id', '$context', '$field');";

> } else {

> echo "editInPlace('editable_{$context}_$id', '$context', '$field', '$save_url');";

> }

`

`

diff _zenphotos/zp-core/js/jquery.editinplace.js zenphoto/zp-core/js/jquery.editinplace.js

349,352c349

< function editInPlace(target, context, field, save_url) {

< if (save_url == null) {

< save_url = document.location.href;

< }

---

> function editInPlace(target, context, field) {

358,359c355

< form_type: form_type,

< save_url: save_url

---

> form_type: form_type

`

Then you can use these changes in the template (for me in album.php), like so:

`

<?php printEditable('image', 'title', true, 'editable', true, false, false, '', getImageLinkURL());?>

`

which will print:

`

editInPlace('editable_image_5', 'image', 'title', '/photos/chloes%20first%20days/IMG_0029.JPG.php');

`

That allows you to edit the image's title/description in place from the album page.

What would it take to include this in the core distribution, where should i post this for the right people to look at it?

thanks,

jon

Comments

  • Please create a ticket on our TRAC system. Apply your changes to the current SVN source files and attach the changed files to your ticket.
Sign In or Register to comment.