]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use HTML5 data attribute + fix undefined variable
authorLukas Reschke <lukas@statuscode.ch>
Sat, 26 Jan 2013 13:07:35 +0000 (14:07 +0100)
committerLukas Reschke <lukas@statuscode.ch>
Sat, 26 Jan 2013 13:07:35 +0000 (14:07 +0100)
apps/files/appinfo/routes.php
apps/files/index.php
apps/files/js/publiclistview.php [deleted file]
apps/files/templates/part.list.php
apps/files_sharing/js/share.js
apps/files_sharing/templates/public.php

index 307a4d0320d1b9527dcf7c48a62f1e9d36752cdf..043782a9c04c5cdb5cb9958b0b848ba6f8994f93 100644 (file)
@@ -8,7 +8,4 @@
 
 $this->create('download', 'download{file}')
        ->requirements(array('file' => '.*'))
-       ->actionInclude('files/download.php');
-// oC JS config
-$this->create('publicListView', 'js/publiclistview.js')
-       ->actionInclude('files/js/publiclistview.php');
\ No newline at end of file
+       ->actionInclude('files/download.php');
\ No newline at end of file
index 2c6b689b0c9d3b1518249a02fd6382534a467fb1..378f5e02e62e820d0c7801f5d859964f59308d42 100644 (file)
@@ -76,6 +76,7 @@ $list = new OCP\Template('files', 'part.list', '');
 $list->assign('files', $files, false);
 $list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=', false);
 $list->assign('downloadURL', OCP\Util::linkTo('files', 'download.php') . '?file=', false);
+$list->assign('disableSharing', false);
 $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
 $breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
 $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=', false);
diff --git a/apps/files/js/publiclistview.php b/apps/files/js/publiclistview.php
deleted file mode 100644 (file)
index f1c67aa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-// Set the content type to Javascript
-header("Content-type: text/javascript");
-
-// Disallow caching
-header("Cache-Control: no-cache, must-revalidate"); 
-header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 
-
-if ( array_key_exists('disableSharing', $_) && $_['disableSharing'] == true )  {
-       echo "var disableSharing = true;";
-} else {
-       echo "var disableSharing = false;";
-}
index 78f91467c7a23d3c1624724f021bbfedd740447d..f3f06d61d66af29b5e6a6c41c0e957cec8592de7 100644 (file)
@@ -1,4 +1,4 @@
-<script type="text/javascript" src="<?php echo OC_Helper::linkToRoute('publicListView');?>"></script>
+<input type="hidden" id="disableSharing" data-status="<?php echo $_['disableSharing']; ?>">
 
 <?php foreach($_['files'] as $file):
        $simple_file_size = OCP\simple_file_size($file['size']);
index 780b9c1bf6d9eb925680ee1552a8066066dcf7c0..eb5a6e8cb7fe27e001353a3e348757e60b4638a9 100644 (file)
@@ -1,5 +1,7 @@
 $(document).ready(function() {
 
+       var disableSharing = $('#disableSharing').data('status');
+
        if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined'  && !disableSharing) {
 
                FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
index 275360ac2a869e86d705696a379ef62a845b6dfa..35cca7c42dc9c2832c5b3923fdc681d3ddfed6f8 100644 (file)
@@ -1,5 +1,3 @@
-<script type="text/javascript" src="<?php echo OC_Helper::linkToRoute('publicListView');?>"></script>
-
 <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
 <input type="hidden" name="downloadURL" value="<?php echo $_['downloadURL'] ?>" id="downloadURL">
 <input type="hidden" name="filename" value="<?php echo $_['filename'] ?>" id="filename">