Allow gues user to choose a name
This commit is contained in:
		
							parent
							
								
									7b858e75b5
								
							
						
					
					
						commit
						fdf7a602d4
					
				| @ -16,6 +16,7 @@ class SessionController extends Controller{ | |||||||
| 	 | 	 | ||||||
| 	public static function joinAsGuest($args){ | 	public static function joinAsGuest($args){ | ||||||
| 		$uid = self::preDispatchGuest(); | 		$uid = self::preDispatchGuest(); | ||||||
|  | 		$uid = substr(@$_POST['name'], 0, 16) . $uid; | ||||||
| 		$token = @$args['token']; | 		$token = @$args['token']; | ||||||
| 		$file = File::getByShareToken($token); | 		$file = File::getByShareToken($token); | ||||||
| 		self::join($uid, $file); | 		self::join($uid, $file); | ||||||
|  | |||||||
| @ -92,19 +92,12 @@ var documentsMain = { | |||||||
| 		 | 		 | ||||||
| 		if (!OC.currentUser){ | 		if (!OC.currentUser){ | ||||||
| 			documentsMain.isGuest = true; | 			documentsMain.isGuest = true; | ||||||
| 			var fileId = $("[name='document']").val(); | 			var fileId; | ||||||
| 		} else { | 		} else { | ||||||
| 			// Does anything indicate that we need to autostart a session?
 | 			// Does anything indicate that we need to autostart a session?
 | ||||||
| 			var fileId = parent.location.hash.replace(/\W*/g, ''); | 			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){ | 		if (!fileId){ | ||||||
| 			documentsMain.show(); | 			documentsMain.show(); | ||||||
| 		} else { | 		} else { | ||||||
| @ -187,7 +180,7 @@ var documentsMain = { | |||||||
| 		} | 		} | ||||||
| 		$.post( | 		$.post( | ||||||
| 			url, | 			url, | ||||||
| 			{ }, | 			{ name : $("[name='memberName']").val() }, | ||||||
| 			documentsMain.initSession | 			documentsMain.initSession | ||||||
| 		); | 		); | ||||||
| 	}, | 	}, | ||||||
| @ -346,7 +339,16 @@ $(document).ready(function() { | |||||||
| 	 | 	 | ||||||
| 	$(document.body).on('click', '#odf-close', documentsMain.onClose); | 	$(document.body).on('click', '#odf-close', documentsMain.onClose); | ||||||
| 	$(document.body).on('click', '#odf-invite', documentsMain.onInvite); | 	$(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); | 	$('.add-document').on('click', '.add', documentsMain.onCreate); | ||||||
| 
 | 
 | ||||||
| 	var file_upload_start = $('#file_upload_start'); | 	var file_upload_start = $('#file_upload_start'); | ||||||
|  | |||||||
| @ -28,11 +28,9 @@ if (isset($_GET['t'])) { | |||||||
| 		$path = null; | 		$path = null; | ||||||
| 		$rootLinkItem = \OCP\Share::resolveReShare($linkItem); | 		$rootLinkItem = \OCP\Share::resolveReShare($linkItem); | ||||||
| 		$fileOwner = $rootLinkItem['uid_owner']; | 		$fileOwner = $rootLinkItem['uid_owner']; | ||||||
| 
 |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| $tmpl = new \OCP\Template('documents', 'public', 'guest'); | $tmpl = new \OCP\Template('documents', 'public', 'guest'); | ||||||
| if (isset($fileOwner)) { | if (isset($fileOwner)) { | ||||||
| 	\OCP\Util::addStyle( 'documents', '3rdparty/webodf/dojo-app'); | 	\OCP\Util::addStyle( 'documents', '3rdparty/webodf/dojo-app'); | ||||||
|  | |||||||
| @ -3,6 +3,10 @@ | |||||||
| </div> | </div> | ||||||
| <div id="documents-content"> | <div id="documents-content"> | ||||||
| 	<?php if (isset($_['document'])): ?>
 | 	<?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']) ?>" /> | 		<input type="hidden" name="document" value ="<?php p($_['document']) ?>" /> | ||||||
| 	<?php endif; ?>
 | 	<?php endif; ?>
 | ||||||
| 	<?php if (isset($_['notFound'])): ?>
 | 	<?php if (isset($_['notFound'])): ?>
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user