diff options
-rw-r--r-- | ajax/sessionController.php | 1 | ||||
-rw-r--r-- | js/documents.js | 22 | ||||
-rw-r--r-- | public.php | 2 | ||||
-rw-r--r-- | templates/public.php | 4 |
4 files changed, 17 insertions, 12 deletions
diff --git a/ajax/sessionController.php b/ajax/sessionController.php index 907e6fd1..1648d433 100644 --- a/ajax/sessionController.php +++ b/ajax/sessionController.php @@ -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); diff --git a/js/documents.js b/js/documents.js index 95d2210c..9c3c29c8 100644 --- a/js/documents.js +++ b/js/documents.js @@ -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'); diff --git a/templates/public.php b/templates/public.php index eb0e478a..9979ace5 100644 --- a/templates/public.php +++ b/templates/public.php @@ -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'])): ?> |