diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-10-28 20:22:06 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-04-02 15:33:47 +0200 |
commit | 0be9de5df558232e12e2f582af5d08e1f488ba90 (patch) | |
tree | de37dea2e23dd28f631948295979980ec774027f /apps/files/templates | |
parent | 268206cec55921d2d0309469ebd5d9533e4f79ee (diff) | |
download | nextcloud-server-0be9de5df558232e12e2f582af5d08e1f488ba90.tar.gz nextcloud-server-0be9de5df558232e12e2f582af5d08e1f488ba90.zip |
Files, trashbin, public apps use ajax/JSON for the file list
Files app:
- removed file list template, now rendering list from JSON response
- FileList.addFile/addDir is now FileList.add() and takes a JS map with all required
arguments instead of having a long number of function arguments
- added unit tests for many FileList operations
- fixed newfile.php, newfolder.php and rename.php to return the file's
full JSON on success
- removed obsolete/unused undo code
- removed download_url / loading options, now using
Files.getDownloadUrl() for that
- server side now uses Helper::getFileInfo() to prepare file JSON response
- previews are now client-side only
Breadcrumbs are now JS only:
- Added BreadCrumb class to handle breadcrumb rendering and events
- Added unit test for BreadCrumb class
- Moved all relevant JS functions to the BreadCrumb class
Public page now uses ajax to load the file list:
- Added Helper class in sharing app to make it easier to authenticate
and retrieve the file's real path
- Added ajax/list.php to retrieve the file list
- Fixed FileActions and FileList to work with the ajax list
Core:
- Fixed file picker dialog to use the same list format as files app
Diffstat (limited to 'apps/files/templates')
-rw-r--r-- | apps/files/templates/index.php | 15 | ||||
-rw-r--r-- | apps/files/templates/part.breadcrumb.php | 17 | ||||
-rw-r--r-- | apps/files/templates/part.list.php | 67 |
3 files changed, 6 insertions, 93 deletions
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 34acd9c4f51..95edd625cb3 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,5 @@ <div id="controls"> - <?php print_unescaped($_['breadcrumb']); ?> - <div class="actions creatable <?php if (!$_['isCreatable']):?>hidden<?php endif; ?>"> + <div class="actions creatable hidden"> <?php if(!isset($_['dirToken'])):?> <div id="new" class="button"> <a><?php p($l->t('New'));?></a> @@ -48,20 +47,20 @@ </div> </div> <div id="file_action_panel"></div> - <div class="notCreatable notPublic <?php if ($_['isCreatable'] or $_['isPublic'] ):?>hidden<?php endif; ?>"> + <div class="notCreatable notPublic hidden"> <?php p($l->t('You don’t have permission to upload or create files here'))?> </div> <input type="hidden" name="permissions" value="<?php p($_['permissions']); ?>" id="permissions"> </div> -<div id="emptycontent" <?php if (!$_['emptyContent']):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Upload something!'))?></div> +<div id="emptycontent" class="hidden"><?php p($l->t('Nothing in here. Upload something!'))?></div> <input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>" /> <table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="36" data-preview-y="36"> <thead> <tr> - <th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id='headerName'> + <th class="hidden" id='headerName'> <div id="headerName-container"> <input type="checkbox" id="select_all" /> <label for="select_all"></label> @@ -77,8 +76,8 @@ </span> </div> </th> - <th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerSize"><?php p($l->t('Size')); ?></th> - <th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerDate"> + <th class="hidden" id="headerSize"><?php p($l->t('Size')); ?></th> + <th class="hidden" id="headerDate"> <span id="modified"><?php p($l->t( 'Modified' )); ?></span> <?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?> <span class="selectedActions"><a href="" class="delete-selected"> @@ -91,7 +90,6 @@ </tr> </thead> <tbody id="fileList"> - <?php print_unescaped($_['fileList']); ?> </tbody> </table> <div id="editor"></div><!-- FIXME Do not use this div in your app! It is deprecated and will be removed in the future! --> @@ -111,7 +109,6 @@ <!-- config hints for javascript --> <input type="hidden" name="filesApp" id="filesApp" value="1" /> -<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" /> <input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php p($_['allowZipDownload']); ?>" /> <input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" /> <?php if (!$_['isPublic']) :?> diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php deleted file mode 100644 index 69b4cbca10d..00000000000 --- a/apps/files/templates/part.breadcrumb.php +++ /dev/null @@ -1,17 +0,0 @@ -<div class="crumb svg <?php if(!count($_["breadcrumb"])) p('last');?>" data-dir=''> - <a href="<?php print_unescaped($_['baseURL']); ?>"> - <?php if(isset($_['rootBreadCrumb'])): - echo $_['rootBreadCrumb']; - else:?> - <img src="<?php print_unescaped(OCP\image_path('core', 'places/home.svg'));?>" class="svg" /> - <?php endif;?> - </a> -</div> -<?php for($i=0; $i<count($_["breadcrumb"]); $i++): - $crumb = $_["breadcrumb"][$i]; - $dir = \OCP\Util::encodePath($crumb["dir"]); ?> - <div class="crumb <?php if($i == count($_["breadcrumb"])-1) p('last');?> svg" - data-dir='<?php p($dir);?>'> - <a href="<?php p($_['baseURL'].$dir); ?>"><?php p($crumb["name"]); ?></a> - </div> -<?php endfor; diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php deleted file mode 100644 index 8a7a1e370eb..00000000000 --- a/apps/files/templates/part.list.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php $totalfiles = 0; -$totaldirs = 0; -$totalsize = 0; ?> -<?php foreach($_['files'] as $file): - // the bigger the file, the darker the shade of grey; megabytes*2 - $simple_size_color = intval(160-$file['size']/(1024*1024)*2); - if($simple_size_color<0) $simple_size_color = 0; - $relative_modified_date = OCP\relative_modified_date($file['mtime']); - // the older the file, the brighter the shade of grey; days*14 - $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); - if($relative_date_color>160) $relative_date_color = 160; - $name = \OCP\Util::encodePath($file['name']); - $directory = \OCP\Util::encodePath($file['directory']); ?> - <tr data-id="<?php p($file['fileid']); ?>" - data-file="<?php p($name);?>" - data-type="<?php ($file['type'] == 'dir')?p('dir'):p('file')?>" - data-mime="<?php p($file['mimetype'])?>" - data-size="<?php p($file['size']);?>" - data-etag="<?php p($file['etag']);?>" - data-permissions="<?php p($file['permissions']); ?>" - - <?php if(isset($file['displayname_owner'])): ?> - data-share-owner="<?php p($file['displayname_owner']) ?>" - <?php endif; ?> - > - - <?php if(isset($file['isPreviewAvailable']) and $file['isPreviewAvailable']): ?> - <td class="filename svg preview-icon" - <?php else: ?> - <td class="filename svg" - <?php endif; ?> - style="background-image:url(<?php print_unescaped($file['icon']); ?>)" - > - <?php if(!isset($_['readonly']) || !$_['readonly']): ?> - <input id="select-<?php p($file['fileid']); ?>" type="checkbox" /> - <label for="select-<?php p($file['fileid']); ?>"></label> - <?php endif; ?> - <?php if($file['type'] == 'dir'): ?> - <a class="name" href="<?php p(rtrim($_['baseURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>" title=""> - <span class="nametext"> - <?php print_unescaped(htmlspecialchars($file['name']));?> - </span> - <span class="uploadtext" currentUploads="0"> - </span> - </a> - <?php else: ?> - <a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>"> - <label class="filetext" title="" for="select-<?php p($file['fileid']); ?>"></label> - <span class="nametext"><?php print_unescaped(htmlspecialchars($file['basename']));?><span class='extension'><?php p($file['extension']);?></span></span> - </a> - <?php endif; ?> - </td> - <td class="filesize" - style="color:rgb(<?php p($simple_size_color.','.$simple_size_color.','.$simple_size_color) ?>)"> - <?php print_unescaped(OCP\human_file_size($file['size'])); ?> - </td> - <td class="date"> - <span class="modified" - title="<?php p($file['date']); ?>" - style="color:rgb(<?php p($relative_date_color.',' - .$relative_date_color.',' - .$relative_date_color) ?>)"> - <?php p($relative_modified_date); ?> - </span> - </td> - </tr> -<?php endforeach; |