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

Commit b5c57bc

Browse files
committed
Revert ajxp_home to non-react implementation
Declare build and load React bundle separately, to avoid any compatibility issues with older browsers.
1 parent ba3747a commit b5c57bc

File tree

4 files changed

+123
-60
lines changed

4 files changed

+123
-60
lines changed

core/src/plugins/access.ajxp_home/class.UserDashboardHome.js

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Class.create("UserDashboardHome", AjxpPane, {
2727
initialize: function($super, oFormObject, editorOptions){
2828

2929
$super(oFormObject, editorOptions);
30-
31-
/*
30+
this._repoInfos = $H();
31+
this._repoInfosLoading = $H();
3232
var dashLogo = pydio.Registry.getPluginConfigs("gui.ajax").get("CUSTOM_DASH_LOGO");
3333
if(!dashLogo)
3434
dashLogo = pydio.Registry.getDefaultImageFromParameters("gui.ajax", "CUSTOM_DASH_LOGO");
@@ -41,31 +41,31 @@ Class.create("UserDashboardHome", AjxpPane, {
4141
}
4242
oFormObject.down("#logo_div").down("img").src = url;
4343
}
44-
var wsElement = oFormObject.down('#workspaces_list');
45-
*/
44+
oFormObject.down("#welcome").update( MessageHash['user_home.40'].replace('%s', ajaxplorer.user.getPreference("USER_DISPLAY_NAME") || ajaxplorer.user.id));
4645

47-
//attachMobileScroll(oFormObject.down('#list_cont'), 'vertical');
46+
var wsElement = oFormObject.down('#workspaces_list');
4847

49-
/*
5048
var simpleClickOpen = ajaxplorer.getPluginConfigs("access.ajxp_home").get("SIMPLE_CLICK_WS_OPEN");
5149

52-
var switchToRepo = function(repoId, save){
50+
var switchToRepo = function(repoId){
5351
if(!repoId) return;
54-
if(save){
55-
PydioApi.getClient().request({
52+
if(oFormObject.down('#save_ws_choice').checked){
53+
// Save this preference now!
54+
var params = $H({
5655
'PREFERENCES_DEFAULT_START_REPOSITORY':repoId,
5756
'get_action':'custom_data_edit'
58-
}, function(){
59-
pydio.user.setPreference('DEFAULT_START_REPOSITORY', repoId, false);
6057
});
58+
var conn = new Connexion();
59+
conn.setParameters(params);
60+
conn.setMethod("POST");
61+
conn.onComplete = function(transport){
62+
ajaxplorer.user.setPreference('DEFAULT_START_REPOSITORY', repoId, false);
63+
};
64+
conn.sendAsync();
6165
}
62-
pydio.triggerRepositoryChange(repoId);
66+
ajaxplorer.triggerRepositoryChange(repoId);
6367
};
64-
*/
6568

66-
/*
67-
this._repoInfos = $H();
68-
this._repoInfosLoading = $H();
6969
var updateRepoInfo = function(block, repoId){
7070
var data = this._repoInfos.get(repoId);
7171
var blocks = 0;
@@ -139,8 +139,7 @@ Class.create("UserDashboardHome", AjxpPane, {
139139
updateRepoInfo(legendBlock.down(".repoInfo"), repoId);
140140
}
141141
}.bind(this);
142-
*/
143-
/*
142+
144143
var renderElement = function(repoObject){
145144

146145
var repoId = repoObject.getId();
@@ -205,13 +204,6 @@ Class.create("UserDashboardHome", AjxpPane, {
205204
sharedWS.each(function(pair){renderElement(pair.value);});
206205
}
207206

208-
oFormObject.down('#go_to_ws').observe("click", function(e){
209-
var target = e.target;
210-
switchToRepo(target.CURRENT_REPO_ID);
211-
});
212-
*/
213-
214-
/*
215207
if($('videos_pane')){
216208
$('videos_pane').select('div.tutorial_load_button').invoke("observe", "click", function(e){
217209
var t = Event.findElement(e, 'div.tutorial_load_button');
@@ -224,10 +216,11 @@ Class.create("UserDashboardHome", AjxpPane, {
224216
}catch(e){}
225217
});
226218
}
227-
*/
228219

229-
/*
230-
oFormObject.down("#welcome").update( MessageHash['user_home.40'].replace('%s', ajaxplorer.user.getPreference("USER_DISPLAY_NAME") || ajaxplorer.user.id));
220+
oFormObject.down('#go_to_ws').observe("click", function(e){
221+
var target = e.target;
222+
switchToRepo(target.CURRENT_REPO_ID);
223+
});
231224

232225
if(pydio.getController().getActionByName("logout") && ajaxplorer.user.id != "guest"){
233226
oFormObject.down("#welcome").insert('<small>'+MessageHash["user_home.67"].replace("%logout", "<span id='disconnect_link'></span>").replace('%s', ajaxplorer.user.getPreference("USER_DISPLAY_NAME") || ajaxplorer.user.id)+'</small>');
@@ -241,35 +234,22 @@ Class.create("UserDashboardHome", AjxpPane, {
241234
pydio.getController().fireAction("login");
242235
});
243236
}
237+
244238
if(ajaxplorer.getPluginConfigs('access.ajxp_home').get("ENABLE_GETTING_STARTED")){
245239
var obj = oFormObject.down("#welcome");
246240
if(oFormObject.down("#welcome > small")) obj = oFormObject.down("#welcome > small");
247241
var span = new Element('span').update('<br>' + MessageHash["user_home.55"]);
248242
span.down('a').observe('click', function(){ pydio.getController().fireAction("open_tutorial_pane"); });
249243
obj.insert(span);
250244
}
251-
*/
252245

253246

254-
if(!Modernizr.flexbox){
255247
try{
256248
window.setTimeout(function(){
257249
if($("orbit_content")) $("orbit_content").ajxpPaneObject.resize();
258250
else if($("browser")) $("browser").ajxpPaneObject.resize();
259251
}, 50);
260252
}catch(e){}
261-
}
262-
fitHeightToBottom($('home_account_pane'));
263-
264-
ResourcesManager.loadClassesAndApply(['PydioReactComponents'], function(){
265-
React.render(
266-
React.createElement(PydioReactComponents.UserDashboard, {
267-
pydio:pydio
268-
}),
269-
document.getElementById('home_account_pane')
270-
);
271-
});
272-
273253

274254
},
275255

@@ -278,10 +258,7 @@ Class.create("UserDashboardHome", AjxpPane, {
278258
$super(size);
279259

280260
//fitHeightToBottom(this.htmlElement.down('#workspaces_center'), this.htmlElement, 0);
281-
},
282-
283-
destroy: function(){
284-
React.unmountComponentAtNode(document.getElementById('home_account_pane'));
285261
}
286262

263+
287264
});

core/src/plugins/access.ajxp_home/manifest.xml

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<client_settings icon="plugins/access.ajxp_home/share.png">
44
<resources>
55
<i18n namespace="user_home" path="plugins/access.ajxp_home/i18n" />
6-
<!--<js className="UserDashboardHome" file="plugins/access.ajxp_home/class.UserDashboardHome.js"/>-->
7-
<js className="WelcomeComponents" file="plugins/access.ajxp_home/build/WelcomeComponents.js"/>
6+
<!--<js className="WelcomeComponents" file="plugins/access.ajxp_home/build/WelcomeComponents.js" depends="React"/>-->
7+
<js className="UserDashboardHome" file="plugins/access.ajxp_home/class.UserDashboardHome.js"/>
88
<css file="plugins/access.ajxp_home/home.css" autoload="true"/>
99
</resources>
1010
<node_provider ajxpClass="EmptyNodeProvider" ajxpOptions="{}"/>
@@ -111,13 +111,32 @@
111111
<template_part ajxpId="orbit_content" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height","fitParent":"ajxp_desktop", "imageBackgroundFromConfigs":"access.ajxp_home/WELCOME_PAGE_BACKGROUND_","messageBoxReference":true}' theme="orbit"><![CDATA[
112112
<style>
113113
#global_toolbar{
114-
position: absolute;display: block;width:99%;background: none !important;
114+
position: absolute;
115+
display: block;
116+
width:99%;
117+
background: none !important;
115118
}
116119
#clickable_home, div.custom_top_title, img.custom_logo_image.linked {
117120
display:none;
118121
}
119122
</style>
120-
<div id="home_account_pane" ajxpClass="AjxpReactComponent" ajxpOptions='{"fit":"height", "componentNamespace":"WelcomeComponents", "componentName":"UserDashboard"}' class="horizontal_layout"></div>
123+
<div id="home_account_pane" ajxpClass="UserDashboardHome" class="horizontal_layout">
124+
<div id="home_left_bar" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height", "fitParent":"orbit_content"}' style="width:420px;">
125+
<div id="welcome" style="min-height:94px;"></div>
126+
<div id="workspaces_center" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height", "fitParent":"home_left_bar"}'>
127+
<div id="list_cont" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height", "fitParent":"workspaces_center"}'>
128+
<ul id="workspaces_list"></ul>
129+
</div>
130+
<div id="workspaces_button" style="display:none;">
131+
<input type="button" name="go_to_ws" id="go_to_ws" value="AJXP_MESSAGE[user_home.42]" class="disabled">
132+
</div>
133+
</div>
134+
</div>
135+
<div id="home_center_panel" ajxpClass="AjxpPane" ajxpOptions='{"fit":"height", "fitParent":"orbit_content","flexTo":"orbit_content"}'>
136+
<div id="logo_div"><img src=""></div>
137+
<div id="ws_legend"></div>
138+
</div>
139+
</div>
121140
]]></template_part>
122141
</client_configs>
123142
<actions>
@@ -126,9 +145,71 @@
126145
<context dir="true" recycle="true" selection="false"/>
127146
</gui>
128147
<processing>
129-
<clientCallback components="true">
130-
<component type="react" namespace="WelcomeComponents" name="TutorialPane" element="tutorial_panel"/>
131-
</clientCallback>
148+
<clientCallback><![CDATA[
149+
$('videos_pane').setStyle({display:'block'});
150+
if(!$('videos_pane')._OBSERVER_SET){
151+
$('videos_pane').select('div.tutorial_load_button').invoke("observe", "click", function(e){
152+
var t = Event.findElement(e, 'div.tutorial_load_button');
153+
try{
154+
var main = t.up('div.tutorial_legend');
155+
main.next('iframe').src = main.readAttribute('data-videoSrc');
156+
}catch(e){}
157+
});
158+
var configs = ajaxplorer.getPluginConfigs('access.ajxp_home');
159+
$A(['URL_APP_IOSAPPSTORE', 'URL_APP_ANDROID', 'URL_APP_SYNC_WIN', 'URL_APP_SYNC_MAC']).each(function(p){
160+
$('videos_pane').select('a[href="'+p+'"]').invoke('writeAttribute', 'href', configs.get(p));
161+
});
162+
$('videos_pane')._OBSERVER_SET = true;
163+
}
164+
]]></clientCallback>
165+
<clientForm id="videos_pane"><![CDATA[
166+
<div id="videos_pane" style="display:none;" class="skipSibling" ajxpClass="AjxpPane" ajxpOptions='{}' style="overflow-y: scroll;">
167+
<div style="float: left;font-size: 1.5em;margin-left: 16px;margin-top: 16px;cursor: pointer;" onclick="$('videos_pane').hide();" class="icon-remove-sign"></div>
168+
<div style="clear:left; font-size: 25px; text-align:center; margin: 40px 0 30px;">AJXP_MESSAGE[user_home.56]</div>
169+
<div id="tutorial_dl_apps_pane">
170+
<div style="width: 750px; margin: 0 auto;" id="dl_pydio_cont">
171+
<div style="float: left;margin: 44px 18px;font-size: 21px;" id="dl_pydio_for">AJXP_MESSAGE[user_home.57]</div>
172+
<div style="width: 81px; float:left;">
173+
<a href="URL_APP_ANDROID" target="_blank" class="icon-mobile-phone" style="font-size: 96px;"></a><a href="URL_APP_ANDROID" target="_blank" class="icon-android" style="font-size: 30px;position: relative;top: -26px;left: -32px;color: rgb(86, 190, 86);"></a><div style="font-size: 11px;top: -15px;position: relative;left: -13px;">AJXP_MESSAGE[user_home.58]</div>
174+
</div>
175+
<div style="width: 91px; float:left;">
176+
<a href="URL_APP_IOSAPPSTORE" target="_blank" class="icon-tablet" style="font-size: 96px;"></a><a href="URL_APP_IOSAPPSTORE" target="_blank" class="icon-apple" style="font-size: 26px;position: relative;top: -33px;left: -40px;color: white;text-shadow: 0px 0px 20px rgba(0,0,0,0.4);"></a><div style="font-size: 11px;top: -15px;position: relative;left: 2px;">AJXP_MESSAGE[user_home.59]</div>
177+
</div> <div style="width: 110px; float:left;padding-top: 14px;">
178+
<a href="URL_APP_SYNC_MAC" target="_blank" class="icon-desktop" style="font-size: 74px;"></a><a href="URL_APP_SYNC_MAC" target="_blank" class="icon-apple" style="font-size: 26px;position: relative;top: -30px;left: -51px;color: rgb(148, 148, 148);"></a><div style="font-size: 11px;top: -6px;position: relative;left: 6px;">AJXP_MESSAGE[user_home.60]</div>
179+
</div>
180+
<div style="width: 100px; float:left;padding-top: 8px;">
181+
<a href="URL_APP_SYNC_WIN" target="_blank" class="icon-laptop" style="font-size: 87px;"></a><a href="URL_APP_SYNC_WIN" target="_blank" class="icon-windows" style="font-size: 26px;position: relative;top: -66px;left: 34px;color: rgb(56, 122, 173);"></a><div style="font-size: 11px;top: -40px;position: relative;left: 12px;">AJXP_MESSAGE[user_home.61]</div>
182+
</div>
183+
</div>
184+
</div>
185+
<div class="tutorial_legend" data-videoSrc="//www.youtube.com/embed/80kq-T6bQO4?list=PLxzQJCqzktEYnIChsR5h3idjAxgBssnt5">
186+
AJXP_MESSAGE[user_home.62]
187+
<div class="tutorial_load_button"><i class="icon-youtube-play"></i> Play Video</div>
188+
</div>
189+
<img class="tutorial_video" src="https://img.youtube.com/vi/80kq-T6bQO4/0.jpg">
190+
191+
<div class="tutorial_legend" data-videoSrc="//www.youtube.com/embed/ZuVKsIa4XdU?list=PLxzQJCqzktEYnIChsR5h3idjAxgBssnt5">
192+
AJXP_MESSAGE[user_home.63]
193+
<div class="tutorial_load_button"><i class="icon-youtube-play"></i> Play Video</div>
194+
</div>
195+
<img class="tutorial_video" src="https://img.youtube.com/vi/ZuVKsIa4XdU/0.jpg">
196+
197+
<div class="tutorial_legend" data-videoSrc="//www.youtube.com/embed/MEHCN64RoTY?list=PLxzQJCqzktEYnIChsR5h3idjAxgBssnt5">
198+
AJXP_MESSAGE[user_home.64]
199+
<div class="tutorial_load_button"><i class="icon-youtube-play"></i> Play Video</div>
200+
</div>
201+
<img class="tutorial_video" src="https://img.youtube.com/vi/MEHCN64RoTY/0.jpg">
202+
203+
<div class="tutorial_legend" data-videoSrc="//www.youtube.com/embed/ot2Nq-RAnYE?list=PLxzQJCqzktEYnIChsR5h3idjAxgBssnt5">
204+
AJXP_MESSAGE[user_home.66]
205+
<div class="tutorial_load_button"><i class="icon-youtube-play"></i> Play Video</div>
206+
</div>
207+
<img class="tutorial_video" src="https://img.youtube.com/vi/ot2Nq-RAnYE/0.jpg">
208+
209+
<div style="clear:left; text-align:center;">
210+
<a href="http://pyd.io/end-user-tutorials/" target="_blank" style="text-align: center;font-size: 25px;background-color: #e35d52;padding: 10px;border-radius: 5px;color: white;display: inline-block;margin: 40px 0;"><i class="icon-youtube-play"></i> AJXP_MESSAGE[user_home.65]</a></div>
211+
</div>
212+
]]></clientForm>
132213
</processing>
133214
</action>
134215
</actions>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<client_settings>
44
<resources>
55
<i18n namespace="ajax_gui" path="plugins/gui.ajax/res/i18n"/>
6+
<js file="plugins/gui.ajax/res/js/vendor/nodejs/bundle.prod.min.js" className="React"/>
67
</resources>
78
</client_settings>
89
<server_settings>

core/src/plugins/gui.ajax/res/themes/orbit/html/gui_debug.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
}?>
99
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
1010
<link rel="icon" type="image/x-png" href="<?php print(AJXP_THEME_FOLDER);?>/images/html-folder.png">
11-
<script src="plugins/gui.ajax/res/js/vendor/nodejs/bundle.js"></script>
11+
<!--[if IE 8]>
12+
<script src="plugins/gui.ajax/res/js/vendor/es6/es5-shim.min.js"></script>
13+
<script src="plugins/gui.ajax/res/js/vendor/es6/es5-sham.min.js"></script>
14+
<![endif]-->
15+
<!-- <script src="plugins/gui.ajax/res/js/vendor/nodejs/bundle.js"></script>-->
1216
<?php
1317
print($ADDITIONAL_FRAMEWORKS);
1418

@@ -79,12 +83,12 @@
7983
</form>
8084
</div>
8185
<script type="text/javascript">
82-
React.initializeTouchEvents(true);
83-
document.observe("ajaxplorer:before_gui_load", function(e){
84-
ajaxplorer.currentThemeUsesIconFonts = true;
85-
pydio.Parameters.set('currentThemeUsesIconFonts', true);
86-
document.documentElement.className += " ajxp_theme_orbit";
87-
});
86+
if(window.React) React.initializeTouchEvents(true);
87+
document.observe("ajaxplorer:before_gui_load", function(e){
88+
ajaxplorer.currentThemeUsesIconFonts = true;
89+
pydio.Parameters.set('currentThemeUsesIconFonts', true);
90+
document.documentElement.className += " ajxp_theme_orbit";
91+
});
8892
</script>
8993

9094
</body>

0 commit comments

Comments
 (0)