aboutsummaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-07-12 00:30:27 +0000
committerrvelices <rv-github@modusoptimus.com>2008-07-12 00:30:27 +0000
commite2ee204c128717069c84437e0aa75bf14b6b352a (patch)
tree72f8059850e19b21168f217aa9a3b09096fdba87 /template
parent22ce08c6fbc9f52152ac300156d72256d76a1d64 (diff)
- add to caddie on picture page done through ajax
git-svn-id: http://piwigo.org/svn/trunk@2429 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--template-common/scripts.js66
-rw-r--r--template/yoga/picture.tpl22
2 files changed, 51 insertions, 37 deletions
diff --git a/template-common/scripts.js b/template-common/scripts.js
index 452be1699..e7fa7e9b5 100644
--- a/template-common/scripts.js
+++ b/template-common/scripts.js
@@ -4,11 +4,11 @@ var len = formulaire.elements.length;
var i=0;
for( i = 0; i < len; i++)
{
- if ( formulaire.elements[i].type=='checkbox'
- && formulaire.elements[i].name != 'copie')
- {
- formulaire.elements[i].checked = true;
- }
+ if ( formulaire.elements[i].type=='checkbox'
+ && formulaire.elements[i].name != 'copie')
+ {
+ formulaire.elements[i].checked = true;
+ }
}
}
@@ -18,11 +18,11 @@ var len = formulaire.elements.length;
var i=0;
for( i = 0; i < len; i++)
{
- if ( formulaire.elements[i].type=='checkbox'
- && formulaire.elements[i].name != 'copie')
- {
+ if ( formulaire.elements[i].type=='checkbox'
+ && formulaire.elements[i].name != 'copie')
+ {
formulaire.elements[i].checked = false;
- }
+ }
}
}
@@ -32,44 +32,42 @@ var len = formulaire.elements.length;
var i=0;
for( i=0; i<len; i++)
{
- if ( formulaire.elements[i].type=='checkbox'
- && formulaire.elements[i].name != 'copie')
- {
+ if ( formulaire.elements[i].type=='checkbox'
+ && formulaire.elements[i].name != 'copie')
+ {
formulaire.elements[i].checked = !formulaire.elements[i].checked;
- }
+ }
}
}
function phpWGOpenWindow(theURL,winName,features)
{
- img = new Image();
- img.src = theURL;
- if (img.complete)
- {
- var width=img.width +40;
- var height=img.height +40;
- }
- else
- {
- var width=640;
- var height=480;
- img.onload = resizeWindowToFit;
- }
- newWin = window.open(theURL,winName,features+',left=2,top=1,width=' + width + ',height=' + height);
+ img = new Image();
+ img.src = theURL;
+ if (img.complete)
+ {
+ var width=img.width +40;
+ var height=img.height +40;
+ }
+ else
+ {
+ var width=640;
+ var height=480;
+ img.onload = resizeWindowToFit;
+ }
+ newWin = window.open(theURL,winName,features+',left=2,top=1,width=' + width + ',height=' + height);
}
function resizeWindowToFit()
{
- newWin.resizeTo( img.width+50, img.height+100);
+ newWin.resizeTo( img.width+50, img.height+100);
}
function popuphelp(url)
{
- window.open(
- url,
- 'dc_popup',
- 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no'
- );
+ window.open( url, 'dc_popup',
+ 'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=500,menubar=no,resizable=yes,scrollbars=yes,status=no'
+ );
}
@@ -154,7 +152,7 @@ PwgWS.prototype = {
}
catch (e)
{
- this.dispatchError( 200, e.message + '\n' + transport.responseText.substr(0,256).escapeHTML() );
+ this.dispatchError( 200, e.message + '\n' + transport.responseText.substr(0,512) );
}
if (resp!=null)
{
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index e52a7a7a7..af22ade18 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -54,9 +54,25 @@
{if isset($U_ADMIN) }
<a href="{$U_ADMIN}" title="{'link_info_image'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/preferences.png" class="button" alt="{'edit'|@translate}"></a>
{/if}
- {if isset($U_CADDIE) }
- <a href="{$U_CADDIE}" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"></a>
- {/if}
+ {if isset($U_CADDIE) }{*caddie management BEGIN*}
+<script type="text/javascript">
+{literal}function addToCadie(aElement, rootUrl, id)
+{
+if (aElement.disabled) return;
+aElement.disabled=true;
+var y = new PwgWS(rootUrl);
+
+y.callService(
+ "pwg.caddie.add", {image_id: id} ,
+ {
+ onFailure: function(num, text) { alert(num + " " + text); document.location=aElement.href; },
+ onSuccess: function(result) { aElement.disabled = false; }
+ }
+ );
+}{/literal}
+</script>
+ <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"></a>
+ {/if}{*caddie management END*}
</div>
{include file=$FILE_PICTURE_NAV_BUTTONS}
</div> <!-- imageToolBar -->