Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit e979c82

Browse files
committed
Fix minisite login background by loading configs via JS.
1 parent 9ee8d50 commit e979c82

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

core/src/plugins/gui.ajax/manifest.xml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@
333333
<style>
334334
div#overlay.form-login_form_dynamic {
335335
opacity: 1;
336-
background-image: url(plugins/gui.ajax/res/themes/orbit/images/hires-photos/02.jpg) !important;
337-
background-position: 50% 50%;
338336
}
339337
#browser{
340338
background-color: #345E79;
@@ -405,13 +403,16 @@
405403
</div>
406404
</div>
407405
<link rel="stylesheet" href="plugins/gui.ajax/res/themes/orbit/css/fontfaces.css"/>
406+
<script>
407+
document.observe("ajaxplorer:afterApply-login", function(){
408+
AjxpPane.prototype.staticApplyBackgroundFromConfigs($("overlay"), "gui.ajax/CUSTOM_SHAREPAGE_BACKGROUND_", "display:block;", true);
409+
});
410+
</script>
408411
]]></template>
409412
<template name="minisite_film_strip" element="ajxp_film_strip" position="top" label="share_center.154" theme="orbit"><![CDATA[
410413
<style type="text/css">
411414
div#overlay.form-login_form_dynamic {
412415
opacity: 1;
413-
background-image: url(plugins/gui.ajax/res/themes/orbit/images/hires-photos/02.jpg) !important;
414-
background-position: 50% 50%;
415416
}
416417
#browser{
417418
-webkit-font-smoothing: antialiased;
@@ -524,6 +525,9 @@
524525
</div>
525526
<link rel="stylesheet" href="plugins/gui.ajax/res/themes/orbit/css/fontfaces.css"/>
526527
<script>
528+
document.observe("ajaxplorer:afterApply-login", function(){
529+
AjxpPane.prototype.staticApplyBackgroundFromConfigs($("overlay"), "gui.ajax/CUSTOM_SHAREPAGE_BACKGROUND_", "display:block;", true);
530+
});
527531
document.observe("ajaxplorer:selection_changed", function(e){
528532
try{
529533
var dm = ajaxplorer.getContextHolder();
@@ -556,11 +560,9 @@
556560
</script>
557561
]]></template>
558562
<template name="unique_preview_file" element="ajxp_unique_strip" position="top" label="Unique File Preview"><![CDATA[
559-
<style type="text/css">
563+
<style type="text/css">
560564
div#overlay.form-login_form_dynamic {
561565
opacity: 1;
562-
background-image: url(plugins/gui.ajax/res/themes/orbit/images/hires-photos/02.jpg) !important;
563-
background-position: 50% 50%;
564566
}
565567
#browser{
566568
background-color: #345E79;
@@ -650,6 +652,9 @@
650652
</div>
651653
<link rel="stylesheet" href="plugins/gui.ajax/res/themes/orbit/css/fontfaces.css"/>
652654
<script>
655+
document.observe("ajaxplorer:afterApply-login", function(){
656+
AjxpPane.prototype.staticApplyBackgroundFromConfigs($("overlay"), "gui.ajax/CUSTOM_SHAREPAGE_BACKGROUND_", "display:block;", true);
657+
});
653658
document.observe("ajaxplorer:user_logged", function(){
654659
try{
655660
@@ -679,15 +684,13 @@
679684
]]></template>
680685
<template name="unique_preview_download" element="ajxp_unique_dl" position="top" label="Big download button"><![CDATA[
681686
<style type="text/css">
682-
div#overlay.form-login_form_dynamic {
683-
opacity: 1;
684-
background-image: url(plugins/gui.ajax/res/themes/orbit/images/hires-photos/02.jpg) !important;
685-
background-position: 50% 50%;
686-
}
687+
div#overlay.form-login_form_dynamic {
688+
opacity: 1;
689+
}
687690
#browser{
688691
background-color: #000;
689692
width:102%;
690-
-webkit-font-smoothing: antialiased;
693+
-webkit-font-smoothing: antialiased;
691694
}
692695
#cpane_container{
693696
float:none;
@@ -798,7 +801,11 @@
798801
<div id="logo_widget" class="widget_logo" ajxpClass="LogoWidget" ajxpOptions='{"imageParameter":"gui.ajax/CUSTOM_MINISITE_LOGO"}'></div>
799802
</div>
800803
<link rel="stylesheet" href="plugins/gui.ajax/res/themes/orbit/css/fontfaces.css"/>
801-
<style>img.custom_logo_image{ width: auto; height: 85px !important; top: inherit !important; bottom: 25px; } #cpane_container{left:0;}</style>
804+
<style>img.custom_logo_image{ width: auto; height: 85px !important; top: inherit !important; bottom: 25px; } #cpane_container{left:0;} div#overlay.form-login_form_dynamic { opacity: 1; }</style>
805+
document.observe("ajaxplorer:afterApply-login", function(){
806+
AjxpPane.prototype.staticApplyBackgroundFromConfigs($("overlay"), "gui.ajax/CUSTOM_SHAREPAGE_BACKGROUND_", "display:block;", true);
807+
});
808+
</script>
802809
]]></template>
803810
<template name="minisite_dropbox" element="ajxp_dropbox_template" position="top" label="share_center.163"><![CDATA[
804811
<div id="browser" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height"}'>
@@ -810,7 +817,12 @@
810817
<div id="logo_widget" class="widget_logo" ajxpClass="LogoWidget" ajxpOptions='{"imageParameter":"gui.ajax/CUSTOM_MINISITE_LOGO"}'></div>
811818
</div>
812819
<link rel="stylesheet" href="plugins/gui.ajax/res/themes/orbit/css/fontfaces.css"/>
813-
<style>img.custom_logo_image{ width: auto; right: 6px !important; left: inherit !important; height: 87px !important; bottom: 3px; top: inherit !important; }</style>
820+
<style>img.custom_logo_image{ width: auto; right: 6px !important; left: inherit !important; height: 87px !important; bottom: 3px; top: inherit !important; } div#overlay.form-login_form_dynamic { opacity: 1; }</style>
821+
<script>
822+
document.observe("ajaxplorer:afterApply-login", function(){
823+
AjxpPane.prototype.staticApplyBackgroundFromConfigs($("overlay"), "gui.ajax/CUSTOM_SHAREPAGE_BACKGROUND_", "display:block;", true);
824+
});
825+
</script>
814826
]]></template>
815827
<component_config className="FilesList">
816828
<property name="thumbSize" value="64"/>

core/src/plugins/gui.ajax/res/js/pydio/ui/class.AjxpPane.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,14 @@ Class.create("AjxpPane", {
455455
return;
456456
}
457457

458+
this.staticApplyBackgroundFromConfigs(this.htmlElement, configName);
459+
460+
},
461+
462+
staticApplyBackgroundFromConfigs:function(element, configName, additionalStyles, important){
463+
464+
var bgrounds,paramPrefix,bStyles,index, i;
465+
458466
var exp = configName.split("/");
459467
var plugin = exp[0];
460468
paramPrefix = exp[1];
@@ -487,8 +495,14 @@ Class.create("AjxpPane", {
487495
if (bStyles.length) {
488496
i = Math.floor( Math.random() * bStyles.length);
489497
var bg = bStyles[i];
498+
if(important){
499+
bg = bg.replace(';', ' !important;');
500+
}
501+
if(additionalStyles){
502+
bg += additionalStyles;
503+
}
490504
if(Modernizr.backgroundsize) bg = bg.replace('background-size:100%','background-size:cover').replace('background-size:140%','background-size:cover');
491-
this.htmlElement.setAttribute("style", bg);
505+
element.setAttribute("style", bg);
492506
}
493507

494508
}

0 commit comments

Comments
 (0)