Frontend cleanup
This commit is contained in:
parent
c44ebd24ce
commit
db2b876132
@ -15,3 +15,7 @@
|
|||||||
#allsessions div{
|
#allsessions div{
|
||||||
margin:5px 0;
|
margin:5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#odf_close{
|
||||||
|
float:left;
|
||||||
|
}
|
28
js/office.js
28
js/office.js
@ -19,7 +19,7 @@ var officeMain = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onView: function(response) {
|
joinSession: function(response) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
OC.addScript('office', 'editor/boot_editor').done(function() {
|
OC.addScript('office', 'editor/boot_editor').done(function() {
|
||||||
@ -30,11 +30,10 @@ var officeMain = {
|
|||||||
// odf action toolbar
|
// odf action toolbar
|
||||||
var odfToolbarHtml =
|
var odfToolbarHtml =
|
||||||
'<div id="odf-toolbar">' +
|
'<div id="odf-toolbar">' +
|
||||||
'<button style="float:left" id="odf_close">' + t('files_odfviewer', 'Close') + '</button>' +
|
'<button id="odf_close">' + t('files_odfviewer', 'Close') + '</button>' +
|
||||||
'<span id="toolbar" class="claro"></span>' +
|
'<span id="toolbar" class="claro"></span>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
$('#controls').append(odfToolbarHtml);
|
$('#controls').append(odfToolbarHtml);
|
||||||
//$('#controls').append('<span id="toolbar" class="claro"></span>');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// fade out file list and show WebODF canvas
|
// fade out file list and show WebODF canvas
|
||||||
@ -55,9 +54,8 @@ var officeMain = {
|
|||||||
'</div>'+
|
'</div>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'</div>',
|
'</div>';
|
||||||
bodyelement = document.getElementsByTagName('body')[0];
|
$(document.body).addClass("claro");
|
||||||
bodyelement.className += " claro";
|
|
||||||
$('.documentslist, #emptyfolder').after(canvashtml);
|
$('.documentslist, #emptyfolder').after(canvashtml);
|
||||||
// in case we are on the public sharing page we shall display the odf into the preview tag
|
// in case we are on the public sharing page we shall display the odf into the preview tag
|
||||||
$('#preview').html(canvashtml);
|
$('#preview').html(canvashtml);
|
||||||
@ -75,14 +73,10 @@ var officeMain = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// odfelement = document.getElementById("odf-canvas");
|
|
||||||
// odfcanvas = new odf.OdfCanvas(odfelement);
|
|
||||||
// odfcanvas.load(doclocation);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
registerSession : function(filepath){
|
startSession : function(filepath){
|
||||||
"use strict";
|
"use strict";
|
||||||
if (officeMain.initialized === undefined) {
|
if (officeMain.initialized === undefined) {
|
||||||
alert("WebODF Editor not yet initialized...");
|
alert("WebODF Editor not yet initialized...");
|
||||||
@ -91,7 +85,7 @@ var officeMain = {
|
|||||||
|
|
||||||
$.post(OC.Router.generate('office_session_start'),
|
$.post(OC.Router.generate('office_session_start'),
|
||||||
{ 'path' : filepath },
|
{ 'path' : filepath },
|
||||||
officeMain.onView
|
officeMain.joinSession
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -100,7 +94,7 @@ var officeMain = {
|
|||||||
$('#allsessions').remove();
|
$('#allsessions').remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.post(OC.filePath('office', 'ajax', 'sessions.php'), {}, officeMain.onSessions);
|
$.post(OC.Router.generate('office_session_list'), {}, officeMain.onSessions);
|
||||||
},
|
},
|
||||||
onSessions : function(response){
|
onSessions : function(response){
|
||||||
if (response && response.sessions){
|
if (response && response.sessions){
|
||||||
@ -114,14 +108,14 @@ var officeMain = {
|
|||||||
$('<div><a href="">'+s.es_id+ '</a></div>').appendTo('#allsessions').click(
|
$('<div><a href="">'+s.es_id+ '</a></div>').appendTo('#allsessions').click(
|
||||||
function(event){
|
function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
officeMain.onView(s);
|
officeMain.joinSession(s);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onClose: function() {
|
onClose: function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
var bodyelement = document.getElementsByTagName('body')[0];
|
|
||||||
// Fade out odf-toolbar
|
// Fade out odf-toolbar
|
||||||
$('#odf-toolbar').fadeOut('slow');
|
$('#odf-toolbar').fadeOut('slow');
|
||||||
// Fade out editor
|
// Fade out editor
|
||||||
@ -130,7 +124,7 @@ var officeMain = {
|
|||||||
$('#odf-canvas').remove();
|
$('#odf-canvas').remove();
|
||||||
$('.actions,#file_access_panel').fadeIn('slow');
|
$('.actions,#file_access_panel').fadeIn('slow');
|
||||||
$('.documentslist, #emptyfolder').fadeIn('slow');
|
$('.documentslist, #emptyfolder').fadeIn('slow');
|
||||||
bodyelement.className.replace(' claro', '');
|
$(document.body).removeClass('claro');
|
||||||
webodfEditor.shutdown();
|
webodfEditor.shutdown();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -139,7 +133,7 @@ var officeMain = {
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.documentslist tr').click(function(event) {
|
$('.documentslist tr').click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
officeMain.registerSession($(this).attr('data-file'));
|
officeMain.startSession($(this).attr('data-file'));
|
||||||
});
|
});
|
||||||
$('#odf_close').live('click', officeMain.onClose);
|
$('#odf_close').live('click', officeMain.onClose);
|
||||||
$('#session-list').click(officeMain.showSessions);
|
$('#session-list').click(officeMain.showSessions);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user