Allow gues user to choose a name

pull/1/head
Victor Dubiniuk 11 years ago
parent 7b858e75b5
commit fdf7a602d4

@ -16,6 +16,7 @@ class SessionController extends Controller{
public static function joinAsGuest($args){
$uid = self::preDispatchGuest();
$uid = substr(@$_POST['name'], 0, 16) . $uid;
$token = @$args['token'];
$file = File::getByShareToken($token);
self::join($uid, $file);

@ -92,19 +92,12 @@ var documentsMain = {
if (!OC.currentUser){
documentsMain.isGuest = true;
var fileId = $("[name='document']").val();
var fileId;
} else {
// Does anything indicate that we need to autostart a session?
var fileId = parent.location.hash.replace(/\W*/g, '');
}
if ($("[name='document']").val()){
// !Login page mess wih WebODF toolbars
$(document.body).attr('id', 'body-user');
$('header,footer').hide();
}
if (!fileId){
documentsMain.show();
} else {
@ -187,7 +180,7 @@ var documentsMain = {
}
$.post(
url,
{ },
{ name : $("[name='memberName']").val() },
documentsMain.initSession
);
},
@ -346,7 +339,16 @@ $(document).ready(function() {
$(document.body).on('click', '#odf-close', documentsMain.onClose);
$(document.body).on('click', '#odf-invite', documentsMain.onInvite);
$(document.body).on('click', '#odf-join', function(event){
event.preventDefault();
// !Login page mess wih WebODF toolbars
$(document.body).attr('id', 'body-user');
$('header,footer').hide();
documentsMain.prepareSession();
documentsMain.joinSession(
$("[name='document']").val()
);
});
$('.add-document').on('click', '.add', documentsMain.onCreate);
var file_upload_start = $('#file_upload_start');

@ -28,11 +28,9 @@ if (isset($_GET['t'])) {
$path = null;
$rootLinkItem = \OCP\Share::resolveReShare($linkItem);
$fileOwner = $rootLinkItem['uid_owner'];
}
}
$tmpl = new \OCP\Template('documents', 'public', 'guest');
if (isset($fileOwner)) {
\OCP\Util::addStyle( 'documents', '3rdparty/webodf/dojo-app');

@ -3,6 +3,10 @@
</div>
<div id="documents-content">
<?php if (isset($_['document'])): ?>
<form>
<input type="text" name="memberName" placeholder="<?php p($l->t('Introduce yourself')) ?>" />
<button id="odf-join"><?php p($l->t('Join')) ?></button>
</form>
<input type="hidden" name="document" value ="<?php p($_['document']) ?>" />
<?php endif; ?>
<?php if (isset($_['notFound'])): ?>

Loading…
Cancel
Save