aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/template/picture.tpl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--themes/default/template/picture.tpl47
1 files changed, 17 insertions, 30 deletions
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 9db8e3f83..0759d14d4 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -271,51 +271,38 @@ y.callService(
{/if}
{if $display_info.privacy_level and isset($available_permission_levels)}
- <div id="Privacy" class="imageInfo"><div class="relSwitchBox">
- <dt><a id="privacyLevelLink" href="javascript:togglePrivacyLevelBox()">{'Who can see this photo?'|@translate}</a></dt>
+ <div id="Privacy" class="imageInfo">
+ <dt>{'Who can see this photo?'|@translate}</dt>
<dd>
+ <div>
+ <a id="privacyLevelLink" href>{$available_permission_levels[$current.level]}</a>
+ </div>
{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
-{footer_script require='jquery'}
-{literal}function setPrivacyLevel(rootUrl, id, level)
-{
-var y = new PwgWS(rootUrl);
-y.callService(
- "pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
+{footer_script require='jquery'}{strip}
+function setPrivacyLevel(id, level){
+(new PwgWS('{$ROOT_URL}')).callService(
+ "pwg.images.setPrivacyLevel", { image_id:id, level:level},
{
method: "POST",
onFailure: function(num, text) { alert(num + " " + text); },
onSuccess: function(result) {
jQuery('#privacyLevelBox .switchCheck').css('visibility','hidden');
- jQuery('#levelCheck'+level).css('visibility','visible');
+ jQuery('#switchLevel'+level).prev('.switchCheck').css('visibility','visible');
+ jQuery('#privacyLevelLink').text(jQuery('#switchLevel'+level).text());
}
}
);
}
-function togglePrivacyLevelBox()
-{
- var elt = document.getElementById("privacyLevelBox"),
- ePos = document.getElementById("privacyLevelLink");
- if (elt.style.display == "none")
- {
- elt.style.left = (ePos.offsetLeft)+"px";
- elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
- elt.style.display="block";
- }
- else
- elt.style.display="none";
-}
-{/literal}
-{/footer_script}
-
- <div id="privacyLevelBox" class="switchBox" onclick="togglePrivacyLevelBox()" style="display:none" onmouseout="e=event.toElement||event.relatedTarget;e.parentNode==this||e==this||togglePrivacyLevelBox()">
+(SwitchBox=window.SwitchBox||[]).push("#privacyLevelLink", "#privacyLevelBox");
+{/strip}{/footer_script}
+ <div id="privacyLevelBox" class="switchBox" style="display:none">
{foreach from=$available_permission_levels item=label key=level}
- <span id="levelCheck{$level}" class="switchCheck" {if $level != $current.level} style="visibility:hidden"{/if}>&#x2714; </span>
- <a id="switchLevel{$level}" href="javascript:setPrivacyLevel('{$ROOT_URL}', {$current.id}, {$level})">{$label}</a><br>
+ <span class="switchCheck"{if $level != $current.level} style="visibility:hidden"{/if}>&#x2714; </span>
+ <a id="switchLevel{$level}" href="javascript:setPrivacyLevel({$current.id},{$level})">{$label}</a><br>
{/foreach}
</div>
-
</dd>
- </div></div>
+ </div>
{/if}
{/strip}
</dl>