From: <ja...@us...> - 2006-07-28 15:36:24
|
Revision: 14073 Author: jablko Date: 2006-07-25 11:50:19 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/gallery/?rev=14073&view=rev Log Message: ----------- Alpha inline editing implementation. Supports editing summaries from album view. Proof of concept TODO Status feedback. Non-immediate views need $status on delegation - not just redirection TODO SerialNumber isn't getting updated, subsiquent edits fail TODO $error isn't getting serialized in session, wrong error displayed on redirection to ErrorPage TODO Check edit permission Modified Paths: -------------- branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl branches/DEV_2_2_ajax/themes/matrix/theme.inc Modified: branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js =================================================================== --- branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js 2006-07-25 17:53:55 UTC (rev 14072) +++ branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js 2006-07-25 18:50:19 UTC (rev 14073) @@ -108,6 +108,18 @@ document.write(response.responseText); document.close(); }}, args.join("&")); + }, + + hide: function() { + for (var i = 0; i < arguments.length; i++) { + YAHOO.util.Dom.get(arguments[i]).style.display = "none"; + } + }, + + show: function() { + for (var i = 0; i < arguments.length; i++) { + YAHOO.util.Dom.get(arguments[i]).style.display = ""; + } } }; Modified: branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl 2006-07-25 17:53:55 UTC (rev 14072) +++ branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl 2006-07-25 18:50:19 UTC (rev 14073) @@ -111,9 +111,123 @@ {/if} {if !empty($child.summary)} +<div class="gbBlock" id="{"status"|elementId::$child.id}"{if empty($status.editMessage) && empty($status.warning) && empty($form.error)} style="display: none"{/if}> + <h2 class="giSuccess" id="{"success"|elementId::$child.id}"{if empty($status.editMessage)} style="display: none"{/if}> {$status.editMessage} </h2> + + <div class="giWarning" id="{"warning"|elementId::$child.id}"{if empty($status.warning)} style="display: none"{/if}> + {foreach from=$status.warning item=warning} + {$warning} + {/foreach} + </div> + + <h2 class="giError" id="{"error"|elementId::$child.id}"{if empty($form.error)} style="display: none"{/if}> {g->text text="There was a problem processing your request"} </h2> +</div> + <p class="giDescription"> - {$child.summary|markup|entitytruncate:256} - </p> + <a id="{"summary"|elementId::$child.id}" style="color: black; font-weight: normal; text-decoration: none" href="javascript:GalleryUtilities.hide('{"summary"|elementId::$child.id}'); GalleryUtilities.show('{"summaryForm"|elementId::$child.id}')"> {$child.summary|markup|entitytruncate:256} </a> + </p> + + <form id="{"summaryForm"|elementId::$child.id}" style="display: none" action="{g->url}" method="post" enctype="{$ItemAdmin.enctype}">{* TODO Fix enctype *} + {g->hiddenFormVars} + <input name="{"controller"|formVar}" type="hidden" value="core.ItemEdit"/> + <input name="{"itemId"|formVar}" type="hidden" value="{$child.id}"/> + <input name="{"editPlugin"|formVar}" type="hidden" value="ItemEditItem"/> + <input id="{"serialNumberInput"|elementId::$child.id}" name="{"form[serialNumber]"|formVar}" type="hidden" value="{$child.serialNumber}"/> + {include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core" element="summary"|elementId::$child.id} + <input id="{"summary"|elementId::$child.id}" name="{"form[summary]"|formVar}" type="text" value="{$child.summary}"/> + <div class="gbBlock gcBackground1"> + <input class="inputTypeSubmit" id="{"saveInput"|elementId::$child.id}" name="{"form[action][save]"|formVar}" type="submit" value="{g->text text="Save"}"/> + <input class="inputTypeSubmit" id="{"undoInput"|elementId::$child.id}" name="{"form[action][undo]"|formVar}" type="submit" value="{g->text text="Reset"}"/> + </div> + </form> + +<script type="text/javascript"> + // <![CDATA[ + + {* Template's client-side variables & functions *} + var EditSummary_{$child.id} = {ldelim} + + {* Submit template's form using Ajax *} + submit: function(event, self) {ldelim} + if (!GalleryUtilities.isCallbackSupported()) {ldelim} + return; + {rdelim} + + var form = YAHOO.util.Dom.get("{"summaryForm"|elementId::$child.id}"); + + {* Disable template's form *} + YAHOO.util.Dom.batch(form.elements, function(element) {ldelim} + element.blur(); + element.disabled = "disabled"; + {rdelim}); + + {* Give immediate feedback if possible *} + YAHOO.util.Dom.get("{"summary"|elementId::$child.id}").innerHTML = "{g->text text="Saving..."}"; + GalleryUtilities.hide("{"summaryForm"|elementId::$child.id}"); + GalleryUtilities.show("{"summary"|elementId::$child.id}"); + + {* Serialize form elements *} + var args = GalleryUtilities.serializeForm(form, YAHOO.util.Event.getTarget(event)); + args.push("{"callback"|formVar}=callback"); + + {g->formVars name="delegate" value=$delegate} + args.push("{$name}={$value}"); + {/g->formVars} + + {* Make Ajax callback request *} + GalleryUtilities.callbackRequest("{g->url}", args); + + YAHOO.util.Event.preventDefault(event); + {rdelim} + {rdelim}; + + {* Register template's submit function with submit buttons *} + YAHOO.util.Event.addListener(["{"saveInput"|elementId::$child.id}", "{"undoInput"|elementId::$child.id}"], "click", EditSummary_{$child.id}.submit, EditSummary_{$child.id}); + + {* Ajax callback output *} + {if GalleryUtilities::isCallback()} + {capture append="smarty.output"} + YAHOO.util.Dom.get("{"summary"|elementId::$child.id}").innerHTML = "{$child.summary|markup|entitytruncate:256}"; + + {* TODO Move to Ajax event listener so form is also enabled on failure *} + {* Enable template's form *} + YAHOO.util.Dom.batch(YAHOO.util.Dom.get("{"summaryForm"|elementId::$child.id}").elements, + function(element) {ldelim} + element.disabled = ""; + {rdelim}); + + YAHOO.util.Dom.get("{"serialNumberInput"|elementId::$child.id}").value = {$form.serialNumber}; + + {if empty($status.editMessage) && empty($status.warning) && empty($form.error)} + YAHOO.util.Dom.get("{"status"|elementId::$child.id}").style.display = "none"; + {else} + YAHOO.util.Dom.get("{"status"|elementId::$child.id}").style.display = ""; + {/if} + + {if empty($status.editMessage)} + YAHOO.util.Dom.get("{"success"|elementId::$child.id}").style.display = "none"; + {else} + YAHOO.util.Dom.get("{"success"|elementId::$child.id}").innerHTML = "{$status.editMessage}"; + YAHOO.util.Dom.get("{"success"|elementId::$child.id}").style.display = ""; + {/if} + + {if empty($status.warning)} + YAHOO.util.Dom.get("{"warning"|elementId::$child.id}").style.display = "none"; + {else} + YAHOO.util.Dom.get("{"warning"|elementId::$child.id}").innerHTML = "{$status.warning|@implode:""}"; + YAHOO.util.Dom.get("{"warning"|elementId::$child.id}").style.display = ""; + {/if} + + {if empty($form.error)} + YAHOO.util.Dom.get("{"error"|elementId::$child.id}").style.display = "none"; + {else} + YAHOO.util.Dom.get("{"error"|elementId::$child.id}").style.display = ""; + {/if} + {/capture} + {/if} + + // ]]> +</script> {/if} {if ($child.canContainChildren && $theme.params.showAlbumOwner) || Modified: branches/DEV_2_2_ajax/themes/matrix/theme.inc =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/theme.inc 2006-07-25 17:53:55 UTC (rev 14072) +++ branches/DEV_2_2_ajax/themes/matrix/theme.inc 2006-07-25 18:50:19 UTC (rev 14073) @@ -24,7 +24,7 @@ */ /** - * This implements the standard gallery theme + * This implements the standard Gallery theme * * @package MatrixTheme * @subpackage Theme @@ -43,8 +43,7 @@ $this->setVersion('1.1.0'); $this->setRequiredCoreApi(array(7, 0)); $this->setRequiredThemeApi(array(2, 1)); - $this->setStandardSettings( - array('rows' => 3, 'columns' => 3, + $this->setStandardSettings(array('rows' => 3, 'columns' => 3, 'showImageOwner' => 0, 'showAlbumOwner' => 1, 'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '', 'colorpack' => '', @@ -79,6 +78,15 @@ $theme =& $template->getVariableByReference('theme'); $theme['columnWidthPct'] = floor(100 / $params['columns']); +$template->javascript('lib/yui/yahoo-min.js'); +$template->javascript('lib/yui/connection-min.js'); +$template->javascript('lib/yui/dom-min.js'); +$template->javascript('lib/yui/event-min.js'); +$template->javascript('lib/javascript/GalleryUtilities.js'); + +$template->setVariable('delegate', GalleryUtilities::getUrlVariablesFiltered(array('return', + 'returnName', 'navId', 'fromNavId'))); + /* Add our header and styles */ return array(null, 'theme.tpl'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ja...@us...> - 2006-08-11 21:10:06
|
Revision: 14276 Author: jablko Date: 2006-08-11 14:09:59 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/gallery/?rev=14276&view=rev Log Message: ----------- Add inline-edit & Ajax-rotate blocks to photo view Re-center status feedback on non-square images Make status feedback a child of image anchor Modified Paths: -------------- branches/DEV_2_2_ajax/lib/javascript/EditItemBlock.js branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js branches/DEV_2_2_ajax/lib/javascript/RotatePhotoBlock.js branches/DEV_2_2_ajax/lib/smarty_plugins/modifier.elementId.php branches/DEV_2_2_ajax/modules/core/templates/EditItemBlock.tpl branches/DEV_2_2_ajax/modules/core/templates/RotatePhotoBlock.tpl branches/DEV_2_2_ajax/modules/core/templates/blocks/ItemLinks.tpl branches/DEV_2_2_ajax/modules/core/templates/blocks/PhotoSizes.tpl branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl branches/DEV_2_2_ajax/themes/matrix/templates/photo.tpl branches/DEV_2_2_ajax/themes/matrix/templates/theme.tpl branches/DEV_2_2_ajax/themes/matrix/theme.inc Modified: branches/DEV_2_2_ajax/lib/javascript/EditItemBlock.js =================================================================== --- branches/DEV_2_2_ajax/lib/javascript/EditItemBlock.js 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/lib/javascript/EditItemBlock.js 2006-08-11 21:09:59 UTC (rev 14276) @@ -31,70 +31,74 @@ * @param {Object} self reference, since function will be executed in scope of the event target */ EditItemBlock.prototype.submit = function(EditItemBlock, target, self) { - if (!GalleryUtilities.isCallbackSupported()) { - return; - } + if (!GalleryUtilities.isCallbackSupported()) { + return; + } - var form = YAHOO.util.Dom.get(GalleryUtilities.elementId("form", "EditItemBlock", - self.templateId)); + var form = YAHOO.util.Dom.get(GalleryUtilities.elementId("form", "EditItemBlock", + self.templateId)); - /* Disable template's form */ - YAHOO.util.Dom.batch(form.elements, function(element) { - element.blur(); - element.disabled = "disabled"; - }); + /* Disable template's form */ + YAHOO.util.Dom.batch(form.elements, function(element) { + element.blur(); + element.disabled = "disabled"; + }); - /* Give immediate feedback if possible */ - YAHOO.util.Dom.get( - GalleryUtilities.elementId("value", "EditItemBlock", self.templateId)).innerHTML = "Saving..."; + /* Give immediate feedback if possible */ + YAHOO.util.Dom.get( + GalleryUtilities.elementId("value", "EditItemBlock", self.templateId)).innerHTML = "Saving..."; - GalleryUtilities.hide(GalleryUtilities.elementId("success", "EditItemBlock", self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("warning", "EditItemBlock", self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("error", "EditItemBlock", self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("working", "EditItemBlock", self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("status", "EditItemBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("success", "EditItemBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("warning", "EditItemBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("error", "EditItemBlock", self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("working", "EditItemBlock", self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("status", "EditItemBlock", self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("form", "EditItemBlock", self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("link", "EditItemBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("form", "EditItemBlock", self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("link", "EditItemBlock", self.templateId)); - var connection; + var connection; - /* Register with all callback responses */ - GalleryUtilities.responseEvent.subscribe(function(type, args) { - var response = args[0]; - if (response.tId == connection.tId) { + /* Register with all callback responses */ + GalleryUtilities.responseEvent.subscribe(function(type, args) { + var response = args[0]; + if (response.tId == connection.tId) { - /* Enable template's form */ - YAHOO.util.Dom.batch(form.elements, function(element) { - element.disabled = ""; + /* Enable template's form */ + YAHOO.util.Dom.batch(form.elements, function(element) { + element.disabled = ""; + }); + + if (!GalleryUtilities.isResponseSuccessful(response)) { + GalleryUtilities.hide(GalleryUtilities.elementId("working", "EditItemBlock", + self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("success", "EditItemBlock", + self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("warning", "EditItemBlock", + self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("error", "EditItemBlock", + self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("status", "EditItemBlock", + self.templateId)); + } + } }); - if (!GalleryUtilities.isResponseSuccessful(response)) { - GalleryUtilities.hide(GalleryUtilities.elementId("working", "EditItemBlock", - self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("success", "EditItemBlock", - self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("warning", "EditItemBlock", - self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("error", "EditItemBlock", - self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("status", "EditItemBlock", - self.templateId)); - } + /* Serialize form elements */ + var args = GalleryUtilities.serializeForm(form, target); + args.push(GalleryUtilities.formVar("callback") + "=callback"); + + args.push(GalleryUtilities.formVar("delegate[view]") + "=core.EditItemBlock"); + + if (self.templateId != null) { + args.push(GalleryUtilities.formVar("delegate[templateId]") + "=" + self.templateId); } - }); - /* Serialize form elements */ - var args = GalleryUtilities.serializeForm(form, target); - args.push(GalleryUtilities.formVar("callback") + "=callback"); + args.push(GalleryUtilities.formVar("delegate[EditItemBlock][item][id]") + "=" + + EditItemBlock.item.id); + args.push(GalleryUtilities.formVar("delegate[EditItemBlock][property]") + "=" + + EditItemBlock.property); - args.push(GalleryUtilities.formVar("delegate[view]") + "=core.EditItemBlock"); - args.push(GalleryUtilities.formVar("delegate[templateId]") + "=" + self.templateId); - args.push(GalleryUtilities.formVar("delegate[EditItemBlock][item][id]") + "=" - + EditItemBlock.item.id); - args.push(GalleryUtilities.formVar("delegate[EditItemBlock][property]") + "=" - + EditItemBlock.property); - - /* Make Ajax callback request */ - connection = GalleryUtilities.callbackRequest(form.action, args); -} + /* Make Ajax callback request */ + connection = GalleryUtilities.callbackRequest(form.action, args); + } Modified: branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js =================================================================== --- branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/lib/javascript/GalleryUtilities.js 2006-08-11 21:09:59 UTC (rev 14276) @@ -29,8 +29,8 @@ * @return {Boolean} true if the client supports Ajax callbacks */ GalleryUtilities.isCallbackSupported = function() { - return YAHOO.util.Connect.getConnectionObject(); -} + return YAHOO.util.Connect.getConnectionObject(); + } /** * Serialize form elements @@ -41,59 +41,59 @@ * @return {Array} "name=value" arguments */ GalleryUtilities.serializeForm = function(form, target) { - form = YAHOO.util.Dom.get(form); + form = YAHOO.util.Dom.get(form); - var args = []; - YAHOO.util.Dom.batch(form.elements, function(element) { + var args = []; + YAHOO.util.Dom.batch(form.elements, function(element) { - /* Don't serialize form elements without name attributes */ - if (element.name == "") { - return; - } + /* Don't serialize form elements without name attributes */ + if (element.name == "") { + return; + } - /* Don't serialize submit elements which weren't clicked */ - if (element.type.toLowerCase() == "submit" && element != YAHOO.util.Dom.get(target)) { - return; - } + /* Don't serialize submit elements which weren't clicked */ + if (element.type.toLowerCase() == "submit" && element != YAHOO.util.Dom.get(target)) { + return; + } - /* Serialize form elements */ - switch (element.type) { - case "select-one": - var option = element.options[element.selectedIndex]; - var arg = [element.name, option.value]; - break; - case "select-multiple": - var value = []; - YAHOO.util.Dom.batch(element.options, function(option) { - if (option.selected) { - value.push(option.value); + /* Serialize form elements */ + switch (element.type) { + case "select-one": + var option = element.options[element.selectedIndex]; + var arg = [element.name, option.value]; + break; + case "select-multiple": + var value = []; + YAHOO.util.Dom.batch(element.options, function(option) { + if (option.selected) { + value.push(option.value); + } + }); + var arg = [element.name, value]; + break; + case "checkbox": + case "radio": + if (element.checked) { + var arg = [element.name, element.value]; + } + break; + case "submit": + case "hidden": + case "password": + case "text": + var arg = [element.name, element.value]; + break; } + + /* Ignore empty arguments */ + if (arg) { + args.push(encodeURIComponent(arg[0]) + "=" + encodeURIComponent(arg[1])); + } }); - var arg = [element.name, value]; - break; - case "checkbox": - case "radio": - if (element.checked) { - var arg = [element.name, element.value]; - } - break; - case "submit": - case "hidden": - case "password": - case "text": - var arg = [element.name, element.value]; - break; - } - /* Ignore empty arguments */ - if (arg) { - args.push(encodeURIComponent(arg[0]) + "=" + encodeURIComponent(arg[1])); - } - }); + return args; + } - return args; -} - /** * Make Ajax callback request * @@ -102,40 +102,40 @@ * @return {Object} YUI connection object */ GalleryUtilities.callbackRequest = function(url, args) { - var connection = YAHOO.util.Connect.asyncRequest("POST", url, { - success: function(response) { - if (response.getResponseHeader["Content-Type"] && - response.getResponseHeader["Content-Type"].ltrim().substr(0, 15) == - "text/javascript") { - eval(response.responseText); - this.responseEvent.fire(response); - return; - } + var connection = YAHOO.util.Connect.asyncRequest("POST", url, { + success: function(response) { + if (response.getResponseHeader["Content-Type"] && + response.getResponseHeader["Content-Type"].ltrim().substr(0, 15) == + "text/javascript") { + eval(response.responseText); + this.responseEvent.fire(response); + return; + } - document.open(); - document.write(response.responseText); - document.close(); - }, + document.open(); + document.write(response.responseText); + document.close(); + }, - failure: function(response) { - if (response.getResponseHeader["Content-Type"] && - response.getResponseHeader["Content-Type"].ltrim().substr(0, 15) == - "text/javascript") { - eval(response.responseText); - this.responseEvent.fire(response); - return; - } + failure: function(response) { + if (response.getResponseHeader["Content-Type"] && + response.getResponseHeader["Content-Type"].ltrim().substr(0, 15) == + "text/javascript") { + eval(response.responseText); + this.responseEvent.fire(response); + return; + } - document.open(); - document.write(response.responseText); - document.close(); - }, - - scope: this}, args.join("&")); + document.open(); + document.write(response.responseText); + document.close(); + }, + + scope: this}, args.join("&")); - this.requestEvent.fire(connection); - return connection; -} + this.requestEvent.fire(connection); + return connection; + } /** * Custom event triggered on all callback requests @@ -154,23 +154,38 @@ * @return {Boolean} true if the callback response is successful */ GalleryUtilities.isResponseSuccessful = function(response) { - var status = response.status; - return status >= 200 && status < 300; -} + var status = response.status; + return status >= 200 && status < 300; + } /** + * Center one element relative to another + * + * @param {Element} one element + * @param {Element} another element + */ +GalleryUtilities.center = function(element, context) { + element = YAHOO.util.Dom.get(element); + context = YAHOO.util.Dom.get(context); + var position = YAHOO.util.Dom.getXY(context); + position[0] += (context.offsetWidth - element.offsetWidth) / 2; + position[1] += (context.offsetHeight - element.offsetHeight) / 2; + YAHOO.util.Dom.setXY(element, position); + } + +/** * Hide element * * @param {mixed} one element or many elements */ GalleryUtilities.hide = function() { - for (var i = 0; i < arguments.length; i++) { - var element = YAHOO.util.Dom.get(arguments[i]); - if (element != null) { - element.style.display = "none"; - } + YAHOO.util.Dom.batch(arguments, function(argument) { + var element = YAHOO.util.Dom.get(argument); + if (element != null) { + element.style.display = "none"; + } + }); } -} /** * Show element @@ -178,13 +193,13 @@ * @param {mixed} one element or many elements */ GalleryUtilities.show = function() { - for (var i = 0; i < arguments.length; i++) { - var element = YAHOO.util.Dom.get(arguments[i]); - if (element != null) { - element.style.display = ""; - } + YAHOO.util.Dom.batch(arguments, function(argument) { + var element = YAHOO.util.Dom.get(argument); + if (element != null) { + element.style.display = ""; + } + }); } -} /** * Element ids in Gallery contain 1) the element id, 2) the template basename - to avoid conflicts @@ -199,11 +214,17 @@ */ GalleryUtilities.elementId = function(elementId, templateName, templateId) { - /* JavaScript reference mentions join is a generic method, yet arguments.join is undefined */ - arguments.join = Array.prototype.join; - return arguments.join("-"); -} + /* JavaScript reference mentions join is a generic method, yet arguments.join is undefined */ + var components = []; + YAHOO.util.Dom.batch(arguments, function(argument) { + if (argument != null) { + components.push(argument); + } + }); + return components.join("-"); + } + /** * Return variable name with prepended prefix * @@ -212,8 +233,8 @@ * @todo use GALLERY_FORM_VARIABLE_PREFIX */ GalleryUtilities.formVar = function(name) { - return "g2_" + name; -} + return "g2_" + name; + } /** * Trim leading spaces @@ -221,10 +242,10 @@ * @return {String} this string without leading spaces */ String.prototype.ltrim = function() { - var index = 0; - while (this.substr(index, 1) == " ") { - index++; + var index = 0; + while (this.substr(index, 1) == " ") { + index++; + } + + return this.substr(index); } - - return this.substr(index); -} Modified: branches/DEV_2_2_ajax/lib/javascript/RotatePhotoBlock.js =================================================================== --- branches/DEV_2_2_ajax/lib/javascript/RotatePhotoBlock.js 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/lib/javascript/RotatePhotoBlock.js 2006-08-11 21:09:59 UTC (rev 14276) @@ -31,92 +31,97 @@ * @param {Object} self reference, since function will be executed in scope of the event target */ RotatePhotoBlock.prototype.submit = function(RotatePhotoBlock, target, self) { - if (!GalleryUtilities.isCallbackSupported()) { - return; - } + if (!GalleryUtilities.isCallbackSupported()) { + return; + } - var form = YAHOO.util.Dom.get(GalleryUtilities.elementId("form", "RotatePhotoBlock", - self.templateId)); + var form = YAHOO.util.Dom.get(GalleryUtilities.elementId("form", "RotatePhotoBlock", + self.templateId)); - /* Disable template's form */ - YAHOO.util.Dom.batch(form.elements, function(element) { - element.blur(); - element.disabled = "disabled"; - }); + /* Disable template's form */ + YAHOO.util.Dom.batch(form.elements, function(element) { + element.blur(); + element.disabled = "disabled"; + }); - /* Give immediate feedback if possible */ - if (target.name == GalleryUtilities.formVar("form[action][rotate][-90]")) { - YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = - "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; - } else if (target.name == GalleryUtilities.formVar("form[action][rotate][180]")) { - YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = - "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; - } else if (target.name == GalleryUtilities.formVar("form[action][rotate][90]")) { - YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = - "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; - } + /* Give immediate feedback if possible */ + if (target.name == GalleryUtilities.formVar("form[action][rotate][-90]")) { + YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = + "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; + } else if (target.name == GalleryUtilities.formVar("form[action][rotate][180]")) { + YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = + "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; + } else if (target.name == GalleryUtilities.formVar("form[action][rotate][90]")) { + YAHOO.util.Dom.get(RotatePhotoBlock.id).style.filter = + "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; + } - GalleryUtilities.hide(GalleryUtilities.elementId("success", "RotatePhotoBlock", self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("warning", "RotatePhotoBlock", self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("error", "RotatePhotoBlock", self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("working", "RotatePhotoBlock", self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("status", "RotatePhotoBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("success", "RotatePhotoBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("warning", "RotatePhotoBlock", self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("error", "RotatePhotoBlock", self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("working", "RotatePhotoBlock", self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("status", "RotatePhotoBlock", self.templateId)); - /* Center status over image */ - var status = YAHOO.util.Dom.get(GalleryUtilities.elementId("status", "RotatePhotoBlock", - self.templateId)); - var context = YAHOO.util.Dom.get(RotatePhotoBlock.id); - var position = YAHOO.util.Dom.getXY(context); - position[0] += (context.offsetWidth - status.offsetWidth) / 2; - position[1] += (context.offsetHeight - status.offsetHeight) / 2; - YAHOO.util.Dom.setXY(GalleryUtilities.elementId("status", "RotatePhotoBlock", self.templateId), - position); + /* Center status over image */ + GalleryUtilities.center( + GalleryUtilities.elementId("status", "RotatePhotoBlock", self.templateId), + RotatePhotoBlock.id); - YAHOO.util.Dom.setStyle(GalleryUtilities.elementId("status", "RotatePhotoBlock", - self.templateId), "opacity", 0.8); + /* TODO Make prettier */ + YAHOO.util.Dom.setStyle(GalleryUtilities.elementId("status", "RotatePhotoBlock", + self.templateId), "opacity", 0.8); - var connection; + var connection; - /* Register with all callback responses */ - GalleryUtilities.responseEvent.subscribe(function(type, args) { - var response = args[0]; - if (response.tId == connection.tId) { + /* Register with all callback responses */ + GalleryUtilities.responseEvent.subscribe(function(type, args) { + var response = args[0]; + if (response.tId == connection.tId) { - /* Enable template's form */ - YAHOO.util.Dom.batch(form.elements, function(element) { - element.disabled = ""; + /* Enable template's form */ + YAHOO.util.Dom.batch(form.elements, function(element) { + element.disabled = ""; + }); + + if (!GalleryUtilities.isResponseSuccessful(response)) { + GalleryUtilities.hide(GalleryUtilities.elementId("working", "RotatePhotoBlock", + self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("success", "RotatePhotoBlock", + self.templateId)); + GalleryUtilities.hide(GalleryUtilities.elementId("warning", "RotatePhotoBlock", + self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("error", "RotatePhotoBlock", + self.templateId)); + GalleryUtilities.show(GalleryUtilities.elementId("status", "RotatePhotoBlock", + self.templateId)); + + /* Center status over image */ + GalleryUtilities.center( + GalleryUtilities.elementId("status", "RotatePhotoBlock", self.templateId), + RotatePhotoBlock.id); + } + } }); - if (!GalleryUtilities.isResponseSuccessful(response)) { - GalleryUtilities.hide(GalleryUtilities.elementId("working", "RotatePhotoBlock", - self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("success", "RotatePhotoBlock", - self.templateId)); - GalleryUtilities.hide(GalleryUtilities.elementId("warning", "RotatePhotoBlock", - self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("error", "RotatePhotoBlock", - self.templateId)); - GalleryUtilities.show(GalleryUtilities.elementId("status", "RotatePhotoBlock", - self.templateId)); - } + /* Serialize form elements */ + var args = GalleryUtilities.serializeForm(form, target); + args.push(GalleryUtilities.formVar("callback") + "=callback"); + + args.push(GalleryUtilities.formVar("delegate[view]") + "=core.RotatePhotoBlock"); + + if (self.templateId != null) { + args.push(GalleryUtilities.formVar("delegate[templateId]") + "=" + self.templateId); } - }); - /* Serialize form elements */ - var args = GalleryUtilities.serializeForm(form, target); - args.push(GalleryUtilities.formVar("callback") + "=callback"); + args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][item][id]") + "=" + + RotatePhotoBlock.item.id); + args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][image][id]") + "=" + + RotatePhotoBlock.image.id); + args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][class]") + "=" + + RotatePhotoBlock.class); + args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][id]") + "=" + + RotatePhotoBlock.id); - args.push(GalleryUtilities.formVar("delegate[view]") + "=core.RotatePhotoBlock"); - args.push(GalleryUtilities.formVar("delegate[templateId]") + "=" + self.templateId); - args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][item][id]") + "=" - + RotatePhotoBlock.item.id); - args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][image][id]") + "=" - + RotatePhotoBlock.image.id); - args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][class]") + "=" - + RotatePhotoBlock.class); - args.push(GalleryUtilities.formVar("delegate[RotatePhotoBlock][id]") + "=" - + RotatePhotoBlock.id); - - /* Make Ajax callback request */ - connection = GalleryUtilities.callbackRequest(form.action, args); -} + /* Make Ajax callback request */ + connection = GalleryUtilities.callbackRequest(form.action, args); + } Modified: branches/DEV_2_2_ajax/lib/smarty_plugins/modifier.elementId.php =================================================================== --- branches/DEV_2_2_ajax/lib/smarty_plugins/modifier.elementId.php 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/lib/smarty_plugins/modifier.elementId.php 2006-08-11 21:09:59 UTC (rev 14276) @@ -35,16 +35,16 @@ * template. If the template name & id are omitted, the template id is filled in with the * {$templateId} template variable, if present. * - * @param string input string + * @param string element id * @param string template name * @param string template id * @return string an HTML element id * ------------------------------------------------------------- */ -function smarty_modifier_elementId($string, $templateName=null, $templateId=null) { - $elementId = array(); - if (!empty($string)) { - $elementId[] = $string; +function smarty_modifier_elementId($elementId, $templateName=null, $templateId=null) { + $components = array(); + if (!empty($elementId)) { + $components[] = $elementId; } if (empty($templateName)) { @@ -57,12 +57,12 @@ $templateId = $smarty->_tpl_vars['templateId']; } } - $elementId[] = $templateName; + $components[] = $templateName; if (!empty($templateId)) { - $elementId[] = $templateId; + $components[] = $templateId; } - return implode('-', $elementId); + return implode('-', $components); } ?> Modified: branches/DEV_2_2_ajax/modules/core/templates/EditItemBlock.tpl =================================================================== --- branches/DEV_2_2_ajax/modules/core/templates/EditItemBlock.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/modules/core/templates/EditItemBlock.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -49,17 +49,19 @@ // <![CDATA[ var EditItemBlock_{$templateId|replace:"-":"_"} = new EditItemBlock(); - EditItemBlock_{$templateId|replace:"-":"_"}.templateId = "{$templateId}"; + {if !empty($templateId)} + EditItemBlock_{$templateId|replace:"-":"_"}.templateId = "{$templateId}"; + {/if} {* Register template's submit function with submit buttons *} YAHOO.util.Event.addListener(["{"saveInput"|elementId}", "{"undoInput"|elementId}"], "click", function(event, self) {ldelim} - EditItemBlock_{$templateId|replace:"-":"_"}.submit( - {ldelim}item: {ldelim}id: {$EditItemBlock.item.id}{rdelim}, - property: "{$EditItemBlock.property}"{rdelim}, YAHOO.util.Event.getTarget(event), - self); - YAHOO.util.Event.preventDefault(event); - {rdelim}, EditItemBlock_{$templateId|replace:"-":"_"}); + EditItemBlock_{$templateId|replace:"-":"_"}.submit( + {ldelim}item: {ldelim}id: {$EditItemBlock.item.id}{rdelim}, + property: "{$EditItemBlock.property}"{rdelim}, + YAHOO.util.Event.getTarget(event), self); + YAHOO.util.Event.preventDefault(event); + {rdelim}, EditItemBlock_{$templateId|replace:"-":"_"}); new YAHOO.widget.Tooltip("{"tooltip"|elementId}", {ldelim}context: "{"link"|elementId}"{rdelim}); @@ -79,8 +81,8 @@ YAHOO.util.Dom.batch( YAHOO.util.Dom.getElementsByClassName("serialNumberInput-{$EditItemBlock.item.id}"), function(element) {ldelim} - element.value = {$EditItemBlock.item.serialNumber}; - {rdelim}); + element.value = {$EditItemBlock.item.serialNumber}; + {rdelim}); GalleryUtilities.hide("{"working"|elementId}"); Modified: branches/DEV_2_2_ajax/modules/core/templates/RotatePhotoBlock.tpl =================================================================== --- branches/DEV_2_2_ajax/modules/core/templates/RotatePhotoBlock.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/modules/core/templates/RotatePhotoBlock.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -56,20 +56,22 @@ // <![CDATA[ var RotatePhotoBlock_{$templateId|replace:"-":"_"} = new RotatePhotoBlock(); - RotatePhotoBlock_{$templateId|replace:"-":"_"}.templateId = "{$templateId}"; + {if !empty($templateId)} + RotatePhotoBlock_{$templateId|replace:"-":"_"}.templateId = "{$templateId}"; + {/if} {* Register template's submit function with submit buttons *} YAHOO.util.Event.addListener(["{"rotate-90Input"|elementId}", "{"rotate180Input"|elementId}", "{"rotate90Input"|elementId}"], "click", function(event, self) {ldelim} - RotatePhotoBlock_{$templateId|replace:"-":"_"}.submit( - {ldelim}item: {ldelim}id: {$RotatePhotoBlock.item.id}{rdelim}, - image: {ldelim}id: {$RotatePhotoBlock.image.id}{rdelim}, - class: "{$smarty.Gallery.image.classes.1}", - id: "{$smarty.Gallery.image.ids.1}"{rdelim}, YAHOO.util.Event.getTarget(event), - self); - YAHOO.util.Event.preventDefault(event); - {rdelim}, RotatePhotoBlock_{$templateId|replace:"-":"_"}); + RotatePhotoBlock_{$templateId|replace:"-":"_"}.submit( + {ldelim}item: {ldelim}id: {$RotatePhotoBlock.item.id}{rdelim}, + image: {ldelim}id: {$RotatePhotoBlock.image.id}{rdelim}, + class: "{$smarty.Gallery.image.classes.1}", + id: "{$smarty.Gallery.image.ids.1}"{rdelim}, + YAHOO.util.Event.getTarget(event), self); + YAHOO.util.Event.preventDefault(event); + {rdelim}, RotatePhotoBlock_{$templateId|replace:"-":"_"}); // ]]> </script> @@ -88,50 +90,52 @@ {* Ajax callback output *} {if GalleryUtilities::isCallback()} {capture append="smarty.output"} - YAHOO.util.Dom.get("{"hidden"|elementId}").innerHTML = - '{g->image item=$RotatePhotoBlock.item + YAHOO.util.Dom.get("{"hidden"|elementId}").innerHTML = '{g->image item=$RotatePhotoBlock.item image=$RotatePhotoBlock.image class=$RotatePhotoBlock.class id="hiddenImage"|elementId}'; var hiddenImage = YAHOO.util.Dom.get("{"hiddenImage"|elementId}"); YAHOO.util.Event.addListener(hiddenImage, "load", function(event, self) {ldelim} - var image = YAHOO.util.Dom.get("{$RotatePhotoBlock.id}"); - image.parentNode.replaceChild(hiddenImage, image); - hiddenImage.id = "{$RotatePhotoBlock.id}"; + var image = YAHOO.util.Dom.get("{$RotatePhotoBlock.id}"); + image.parentNode.replaceChild(hiddenImage, image); + hiddenImage.id = "{$RotatePhotoBlock.id}"; - GalleryUtilities.hide("{"working"|elementId}"); + GalleryUtilities.hide("{"working"|elementId}"); - {if empty($status.editMessage) && empty($status.warning) && empty($form.error)} - GalleryUtilities.hide("{"status"|elementId}"); - {else} - GalleryUtilities.show("{"status"|elementId}"); - {/if} + {if empty($status.editMessage) && empty($status.warning) && empty($form.error)} + GalleryUtilities.hide("{"status"|elementId}"); + {else} + GalleryUtilities.show("{"status"|elementId}"); + {/if} - {if empty($status.editMessage)} - GalleryUtilities.hide("{"success"|elementId}"); - {else} - YAHOO.util.Dom.get("{"success"|elementId}").innerHTML = "{$status.editMessage}"; - GalleryUtilities.show("{"success"|elementId}"); - {/if} + {if empty($status.editMessage)} + GalleryUtilities.hide("{"success"|elementId}"); + {else} + YAHOO.util.Dom.get("{"success"|elementId}").innerHTML = "{$status.editMessage}"; + GalleryUtilities.show("{"success"|elementId}"); + {/if} - {if empty($status.warning)} - GalleryUtilities.hide("{"warning"|elementId}"); - {else} - YAHOO.util.Dom.get("{"warning"|elementId}").innerHTML = "{$status.warning|@implode:""}"; - GalleryUtilities.show("{"warning"|elementId}"); - {/if} + {if empty($status.warning)} + GalleryUtilities.hide("{"warning"|elementId}"); + {else} + YAHOO.util.Dom.get("{"warning"|elementId}").innerHTML = "{$status.warning|@implode:""}"; + GalleryUtilities.show("{"warning"|elementId}"); + {/if} - {if empty($form.error)} - GalleryUtilities.hide("{"error"|elementId}"); - {else} - GalleryUtilities.show("{"error"|elementId}"); - {/if} - {rdelim}, RotatePhotoBlock_{$templateId|replace:"-":"_"}); + {if empty($form.error)} + GalleryUtilities.hide("{"error"|elementId}"); + {else} + GalleryUtilities.show("{"error"|elementId}"); + {/if} + /* Center status over image */ + GalleryUtilities.center("{"status"|elementId}", "{$RotatePhotoBlock.id}"); + {rdelim}, RotatePhotoBlock_{$templateId|replace:"-":"_"}); + YAHOO.util.Dom.batch( YAHOO.util.Dom.getElementsByClassName("serialNumberInput-{$RotatePhotoBlock.item.id}"), function(element) {ldelim} - element.value = {$RotatePhotoBlock.item.serialNumber}; - {rdelim}); + element.value = {$RotatePhotoBlock.item.serialNumber}; + {rdelim}); {/capture} {/if} Modified: branches/DEV_2_2_ajax/modules/core/templates/blocks/ItemLinks.tpl =================================================================== --- branches/DEV_2_2_ajax/modules/core/templates/blocks/ItemLinks.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/modules/core/templates/blocks/ItemLinks.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -23,26 +23,34 @@ {if count($links) > 1 && $useDropdown} <div class="{$class}"> <select onchange="var value = this.value; this.options[0].selected = true; eval(value)"> - <option label="{if $item.canContainChildren}{g->text text="« album actions »"}{else}{g->text text="« item actions »"}{/if}" value="">{if $item.canContainChildren}{g->text text="« album actions »"}{else}{g->text text="« item actions »"}{/if}</option> - {foreach from=$links item=link} - {if $lowercase} - {assign linkText=$link.text|lower} + <option value=""> + {if $item.canContainChildren} + {g->text text="« album actions »"} {else} - {assign linkText=$link.text} + {g->text text="« item actions »"} {/if} - <option label="{$linkText}" value="{if isset($link.script)}{$link.script}{else}window.location = '{g->url params=$link.params}'{/if}"> {$linkText} </option> + </option> + {foreach from=$links item=link} + <option value="{if isset($link.script)}{$link.script}{else}window.location = '{g->url params=$link.params}'{/if}"{if !empty($link.selected)} selected="selected"{/if}> + {if $lowercase} + {$link.text|lower} + {else} + {$link.text} + {/if} + </option> {/foreach} </select> </div> {elseif count($links) > 0} <div class="{$class}"> {foreach from=$links item=link} - {if $lowercase} - {assign linkText=$link.text|lower} - {else} - {assign linkText=$link.text} - {/if} - <a class="gbAdminLink {g->linkid urlParams=$link.params}" href="{if isset($link.script)}javascript:{$link.script}{else}{g->url params=$link.params}{/if}"> {$linkText} </a> + <a class="gbAdminLink {g->linkid urlParams=$link.params}" href="{if isset($link.script)}javascript:{$link.script}{else}{g->url params=$link.params}{/if}"> + {if $lowercase} + {$link.text|lower} + {else} + {$link.text} + {/if} + </a> {/foreach} </div> {/if} Modified: branches/DEV_2_2_ajax/modules/core/templates/blocks/PhotoSizes.tpl =================================================================== --- branches/DEV_2_2_ajax/modules/core/templates/blocks/PhotoSizes.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/modules/core/templates/blocks/PhotoSizes.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -5,47 +5,41 @@ * version. Gallery will look for that file first and use it if it exists. *} <div class="{$class}"> - {if count($theme.imageViews) > 1} - {g->text text="Size: "} - <select onchange="{literal}if (this.value) { newLocation = this.value; this.options[0].selected = true; location.href= newLocation; }{/literal}"> - {section name=imageView loop=$theme.imageViews} - <option value="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" - arg2="imageViewsIndex=`$smarty.section.imageView.index`"}"{if - $smarty.section.imageView.index==$theme.imageViewsIndex} selected="selected"{/if}> - {if empty($theme.imageViews[imageView].width)} - {if isset($theme.imageViews[imageView].isSource)} - {g->text text="Source"} - {else} - {g->text text="Unknown"} - {/if} - {else} - {g->text text="%dx%d" arg1=$theme.imageViews[imageView].width - arg2=$theme.imageViews[imageView].height} - {/if} - </option> - {/section} - </select> - <br/> - {/if} + {if $theme.imageViews|@count > 1} + {g->text text="Size: "} <select onchange="var value = this.value; this.options[{$theme.imageViewsIndex}].selected = true; eval(value)"> - {if !empty($theme.sourceImage)} - {g->text text="Full size: "} - {capture name="fullSize"} - {if empty($theme.sourceImage.width)} - {$theme.sourceImage.itemTypeName.0} - {else} - {g->text text="%dx%d" arg1=$theme.sourceImage.width - arg2=$theme.sourceImage.height} - {/if} - {/capture} - {if count($theme.imageViews) > 1} - <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" - arg2="imageViewsIndex=`$theme.sourceImageViewIndex`"}"> - {$smarty.capture.fullSize} - </a> + {assign imageViewIndex=0} + {foreach from=$theme.imageViews item="imageView"} + <option value="window.location = '{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" arg2="imageViewsIndex=$imageViewIndex"}'"{if $imageViewIndex == $theme.imageViewsIndex} selected="selected"{/if}> + {if empty($imageView.width)} + {if !empty($imageView.isSource)} + {g->text text="Source"} + {else} + {g->text text="Unknown"} + {/if} + {else} + {g->text text="%dx%d" arg1=$imageView.width arg2=$imageView.height} + {/if} + </option> + {assign imageViewIndex=$imageViewIndex+1} + {/foreach} + </select> + <br/> + {/if} + + {if !empty($theme.sourceImage)} + {capture name="fullSize"} + {if empty($theme.sourceImage.width)} + {$theme.sourceImage.itemTypeName.0} + {else} + {g->text text="%dx%d" arg1=$theme.sourceImage.width arg2=$theme.sourceImage.height} + {/if} + {/capture} + + {g->text text="Full size: "} {if $theme.imageViews|@count > 1} + <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" arg2="imageViewsIndex=`$theme.sourceImageViewIndex`"}"> {$smarty.capture.fullSize} </a> {else} {$smarty.capture.fullSize} {/if} - <br/> {/if} </div> Modified: branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/themes/matrix/templates/album.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -30,10 +30,13 @@ {$EditItemBlock.value} {$EditItemBlock.status} </p> {/g->container} + </td><td style="width: 30%"> + {g->block type="core.ItemInfo" + class="giInfo" + item=$theme.item showDate=true + showSize=true + showOwner=true} </td> - <td style="width: 30%"> - {g->block type="core.ItemInfo" item=$theme.item showDate=true showSize=true showOwner=true class="giInfo"} - </td> </tr></table> </div> @@ -67,14 +70,15 @@ {assign childrenInColumnCount=`$childrenInColumnCount+1`} <td class="{if $child.canContainChildren}giAlbumCell gcBackground1{else}giItemCell{/if}" style="width: {$theme.columnWidthPct}%"> - {if $child.canContainChildren || $child.entityType == 'GalleryLinkItem'} - {assign frameType="albumFrame"} - {capture assign="linkUrl"}{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}{/capture} - {else} - {assign frameType="itemFrame"} - {capture assign="linkUrl"}{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}{/capture} - {/if} <div> + {if $child.canContainChildren || $child.entityType == 'GalleryLinkItem'} + {assign frameType="albumFrame"} + {capture assign="linkUrl"}{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}{/capture} + {else} + {assign frameType="itemFrame"} + {capture assign="linkUrl"}{g->url params=$theme.pageUrl arg1="itemId=`$child.id`"}{/capture} + {/if} + {if empty($child.thumbnail)} <a href="{$linkUrl}" class="giMissingThumbnail"> {g->text text="no thumbnail"} </a> {else} @@ -86,16 +90,15 @@ templateId=$child.id RotatePhotoBlock.item=$child RotatePhotoBlock.image=$child.thumbnail - RotatePhotoBlock.class="giThumbnail"} </a> + RotatePhotoBlock.class="giThumbnail"} {$smarty.RotatePhotoBlock.status} </a> {/g->container} - {$EditItemBlock.status} <span style="display: none"> {$smarty.RotatePhotoBlock.form} </span> {merge child.itemLinks=$smarty.RotatePhotoBlock.links} {/if} </div> - {g->block type="core.ItemLinks" item=$child links=$child.itemLinks} {$smarty.RotatePhotoBlock.status} + {g->block type="core.ItemLinks" item=$child links=$child.itemLinks} {g->container type="core.EditItemBlock" templateId="title-`$child.id`" @@ -106,7 +109,7 @@ {g->text text="Album: %s" arg1=$EditItemBlock.value} {else} {$EditItemBlock.value} - {/if} + {/if} {$EditItemBlock.status} </p> {/g->container} Modified: branches/DEV_2_2_ajax/themes/matrix/templates/photo.tpl =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/templates/photo.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/themes/matrix/templates/photo.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -5,117 +5,123 @@ * version. Gallery will look for that file first and use it if it exists. *} {if !empty($theme.imageViews)} -{assign var="image" value=$theme.imageViews[$theme.imageViewsIndex]} + {assign var="image" value=$theme.imageViews[$theme.imageViewsIndex]} {/if} -<table width="100%" cellspacing="0" cellpadding="0"> - <tr valign="top"> - {if !empty($theme.params.sidebarBlocks)} + +{* Evaluate early to modify $theme.itemLinks. TODO Find a cleaner way to do this *} +{capture name="imageView"} + {if empty($theme.imageViews)} + {g->text text="There is nothing to view for this item"} + {else} + {capture name="fallback"} + <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`" forceFullUrl=true forceSessionId=true}"> {g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1} </a> + {/capture} + + {if !$image.viewInline} + {$smarty.capture.fallback} + {else} + {g->container type="imageframe.ImageFrame" + frame=$theme.photoFrame + width=$image.width + height=$image.height} + {if count($theme.imageViews) > 1} + {if $theme.imageViewsIndex == 1 && $theme.imageViews|@count == 2} + <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`"}"> + {else} + {assign var="imageViewsLink" value=$theme.imageViewsIndex+1} + {if $imageViewsLink == $theme.imageViews|@count} + {assign var="imageViewsLink" value=$theme.imageViewsIndex-1} + {/if} + <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" arg2="imageViewsIndex=`$imageViewsLink`"}"> + {/if} + {/if} + {g->block type="core.RotatePhotoBlock" + RotatePhotoBlock.item=$theme.item + RotatePhotoBlock.image=$image + RotatePhotoBlock.fallback=$smarty.capture.fallback} {$smarty.RotatePhotoBlock.status} + {if count($theme.imageViews) > 1} + </a> + {/if} + {/g->container} + + <span style="display: none"> {$smarty.RotatePhotoBlock.form} </span> + {/if} + {/if} +{/capture} +{merge theme.itemLinks=$smarty.RotatePhotoBlock.links} + +<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top"> + {if !empty($theme.params.sidebarBlocks)} <td id="gsSidebarCol"> {g->theme include="sidebar.tpl"} </td> - {/if} - <td> - <div id="gsContent"> - <div class="gbBlock gcBackground1"> - <table width="100%"> - <tr> - <td> - {if !empty($theme.item.title)} - <h2> {$theme.item.title|markup} </h2> - {/if} - {if !empty($theme.item.description)} - <p class="giDescription"> - {$theme.item.description|markup} - </p> - {/if} - </td> - <td style="width: 30%"> - {g->block type="core.ItemInfo" - item=$theme.item - showDate=true - showOwner=true - class="giInfo"} - {g->block type="core.PhotoSizes" class="giInfo"} - </td> - </tr> - </table> - </div> + {/if} + <td> + <div id="gsContent"> + <div class="gbBlock gcBackground1"> + <table width="100%"><tr> + <td> + {g->container type="core.EditItemBlock" + templateId="title" + EditItemBlock.item=$theme.item + EditItemBlock.property="title"} + <h2> {$EditItemBlock.value} {$EditItemBlock.status} </h2> + {/g->container} - {if !empty($theme.navigator)} - <div class="gbBlock gcBackground2 gbNavigator"> - {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} - </div> - {/if} + {g->container type="core.EditItemBlock" + templateId="description" + EditItemBlock.item=$theme.item + EditItemBlock.property="description"} + <p class="giDescription"> + {$EditItemBlock.value} {$EditItemBlock.status} + </p> + {/g->container} + </td><td style="width: 30%"> + {g->block type="core.ItemInfo" + class="giInfo" + item=$theme.item + showDate=true + showOwner=true} + {g->block type="core.PhotoSizes" class="giInfo"} + </td> + </tr></table> + </div> - <div id="gsImageView" class="gbBlock"> - {if !empty($theme.imageViews)} - {capture name="fallback"} - <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`" - forceFullUrl=true forceSessionId=true}"> - {g->text text="Download %s" arg1=$theme.sourceImage.itemTypeName.1} - </a> - {/capture} + {if !empty($theme.navigator)} + <div class="gbBlock gcBackground2 gbNavigator"> + {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} + </div> + {/if} - {if $image.viewInline} - {if count($theme.imageViews) > 1} - {if $theme.imageViewsIndex==1 && count($theme.imageViews)==2} - <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`"}"> - {else} - {assign var="imageViewsLink" value=$theme.imageViewsIndex+1} - {if $imageViewsLink==count($theme.imageViews)} - {assign var="imageViewsLink" value=$theme.imageViewsIndex-1} - {/if} - <a href="{g->url params=$theme.pageUrl arg1="itemId=`$theme.item.id`" - arg2="imageViewsIndex=`$imageViewsLink`"}"> - {/if} - {/if} - {if isset($theme.photoFrame)} - {g->container type="imageframe.ImageFrame" frame=$theme.photoFrame - width=$image.width height=$image.height} - {g->image id="%ID%" item=$theme.item image=$image - fallback=$smarty.capture.fallback class="%CLASS%"} - {/g->container} - {else} - {g->image item=$theme.item image=$image fallback=$smarty.capture.fallback} - {/if} - {if count($theme.imageViews) > 1} - </a> - {/if} - {else} - {$smarty.capture.fallback} - {/if} - {else} - {g->text text="There is nothing to view for this item."} - {/if} - </div> + <div id="gsImageView" class="gbBlock"> + {$smarty.capture.imageView} + </div> - {* Download link for item in original format *} - {if !empty($theme.sourceImage) && $theme.sourceImage.mimeType != $theme.item.mimeType} - <div class="gbBlock"> - <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}"> - {g->text text="Download %s in original format" arg1=$theme.sourceImage.itemTypeName.1} - </a> - </div> - {/if} + {* Download link for item in original format *} + {if !empty($theme.sourceImage) && $theme.sourceImage.mimeType != $theme.item.mimeType} + <div class="gbBlock"> + <a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}"> {g->text text="Download %s in original format" arg1=$theme.sourceImage.itemTypeName.1} </a> + </div> + {/if} - {* Show any other photo blocks (comments, exif etc) *} - {foreach from=$theme.params.photoBlocks item=block} - {g->block type=$block.0 params=$block.1} - {/foreach} + {* Show any other photo blocks (comments, exif etc.) *} + {foreach from=$theme.params.photoBlocks item=block} + {g->block type=$block.0 params=$block.1} + {/foreach} - {if !empty($theme.navigator)} - <div class="gbBlock gcBackground2 gbNavigator"> - {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} - </div> - {/if} + {if !empty($theme.navigator)} + <div class="gbBlock gcBackground2 gbNavigator"> + {g->block type="core.Navigator" navigator=$theme.navigator reverseOrder=true} + </div> + {/if} - {g->block type="core.GuestPreview" class="gbBlock"} + {g->block type="core.GuestPreview" class="gbBlock"} - {* Our emergency edit link, if the user removes all blocks containing edit links *} - {g->block type="core.EmergencyEditItemLink" class="gbBlock" - checkSidebarBlocks=true - checkPhotoBlocks=true} - </div> - </td> - </tr> -</table> + {* Our emergency edit link, if the user removes all blocks containing edit links *} + {g->block type="core.EmergencyEditItemLink" + class="gbBlock" + checkSidebarBlocks=true + checkPhotoBlocks=true} + </div> + </td> +</tr></table> Modified: branches/DEV_2_2_ajax/themes/matrix/templates/theme.tpl =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/templates/theme.tpl 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/themes/matrix/templates/theme.tpl 2006-08-11 21:09:59 UTC (rev 14276) @@ -21,55 +21,53 @@ <body class="gallery"> <div {g->mainDivAttributes}> {* - * Some module views (eg slideshow) want the full screen. So for those, we - * don't draw a header, footer, navbar, etc. Those views are responsible for - * drawing everything. + * Some module views (eg slideshow) want the full screen. So for those, we don't draw a + * header, footer, navbar, etc. Those views are responsible for drawing everything. *} {if $theme.useFullScreen} {include file="gallery:`$theme.moduleTemplate`" l10Domain=$theme.moduleL10Domain} {else} - <div id="gsHeader"> - <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> - </div> - - <div id="gsNavBar" class="gcBorder1"> - <div class="gbSystemLinks"> - {g->block type="core.SystemLinks" - order="core.SiteAdmin core.YourAccount core.Login core.Logout" - othersAt=4} + <div id="gsHeader"> + <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> </div> - <div class="gbBreadCrumb"> - {g->block type="core.BreadCrumb"} + <div id="gsNavBar" class="gcBorder1"> + <div class="gbSystemLinks"> + {g->block type="core.SystemLinks" + order="core.SiteAdmin core.YourAccount core.Login core.Logout" + othersAt=4} + </div> + + <div class="gbBreadCrumb"> + {g->block type="core.BreadCrumb"} + </div> </div> - </div> - {* Include the appropriate content type for the page we want to draw. *} - {if $theme.pageType == 'album'} - {g->theme include="album.tpl"} - {elseif $theme.pageType == 'photo'} - {g->theme include="photo.tpl"} - {elseif $theme.pageType == 'admin'} - {g->theme include="admin.tpl"} - {elseif $theme.pageType == 'module'} - {g->theme include="module.tpl"} - {elseif $theme.pageType == 'progressbar'} - {g->theme include="progressbar.tpl"} - {/if} + {* Include the appropriate content type for the page we want to draw *} + {if $theme.pageType == 'album'} + {g->theme include="album.tpl"} + {elseif $theme.pageType == 'photo'} + {g->theme include="photo.tpl"} + {elseif $theme.pageType == 'admin'} + {g->theme include="admin.tpl"} + {elseif $theme.pageType == 'module'} + {g->theme include="module.tpl"} + {elseif $theme.pageType == 'progressbar'} + {g->theme include="progressbar.tpl"} + {/if} - <div id="gsFooter"> - {g->logoButton type="validation"} - {g->logoButton type="gallery2"} - {g->logoButton type="gallery2-version"} - {g->logoButton type="donate"} - </div> - {/if} {* end of full screen check *} + <div id="gsFooter"> + {g->logoButton type="validation"} + {g->logoButton type="gallery2"} + {g->logoButton type="gallery2-version"} + {g->logoButton type="donate"} + </div> + {/if} {* End of full screen check *} </div> {* - * Give Gallery a chance to output any cleanup code, like javascript that - * needs to be run at the end of the <body> tag. If you take this out, some - * code won't work properly. + * Give Gallery a chance to output any cleanup code, like JavaScript that needs to be run at the + * end of the <body> tag. If you take this out, some code won't work properly. *} {g->trailer} Modified: branches/DEV_2_2_ajax/themes/matrix/theme.inc =================================================================== --- branches/DEV_2_2_ajax/themes/matrix/theme.inc 2006-08-11 20:55:27 UTC (rev 14275) +++ branches/DEV_2_2_ajax/themes/matrix/theme.inc 2006-08-11 21:09:59 UTC (rev 14276) @@ -46,20 +46,18 @@ $this->setRequiredCoreApi(array(7, 0)); $this->setRequiredThemeApi(array(2, 4)); $this->setStandardSettings(array('rows' => 3, 'columns' => 3, - 'showImageOwner' => 0, 'showAlbumOwner' => 1, - 'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '', - 'colorpack' => '', - 'showMicroThumbs' => 0, - 'sidebarBlocks' => serialize(array( - array('search.SearchBlock', array('showAdvancedLink' => true)), - array('core.ItemLinks', array('useDropdown' => false)), - array('core.PeerList', array()), - array('imageblock.ImageBlock', array()))), - 'albumBlocks' => serialize(array( - array('comment.ViewComments', array()))), - 'photoBlocks' => serialize(array( - array('exif.ExifInfo', array()), - array('comment.ViewComments', array()))))); + 'showImageOwner' => 0, 'showAlbumOwner' => 1, + 'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '', + 'colorpack' => '', + 'showMicroThumbs' => 0, + 'sidebarBlocks' => serialize(array( + array('search.SearchBlock', array('showAdvancedLink' => true)), + array('core.ItemLinks', array('useDropdown' => false)), + array('core.PeerList', array()), + array('imageblock.ImageBlock', array()))), + 'albumBlocks' => serialize(array(array('comment.ViewComments', array()))), + 'photoBlocks' => serialize(array(array('exif.ExifInfo', array()), + array('comment.ViewComments', array()))))); } /** @@ -101,6 +99,12 @@ return array($ret, null); } + /* Preloads */ + GalleryCoreApi::requireOnce('modules/core/Preloads.inc'); + CorePreloads::preload($template, 'EditItemBlock', array()); + CorePreloads::preload($template, 'RotatePhotoBlock', array()); + + /* Add our header and styles */ return array(null, 'theme.tpl'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |