]> source.dussan.org Git - nextcloud-server.git/commitdiff
finish refactoring of files admin page
authorHans Bakker <hansmbakker@gmail.com>
Sat, 9 Jul 2011 19:44:50 +0000 (21:44 +0200)
committerHans Bakker <hansmbakker@gmail.com>
Sat, 9 Jul 2011 19:44:50 +0000 (21:44 +0200)
files/js/admin.js [new file with mode: 0644]
files/templates/admin.php

diff --git a/files/js/admin.js b/files/js/admin.js
new file mode 100644 (file)
index 0000000..5cbb2b9
--- /dev/null
@@ -0,0 +1,15 @@
+function switchPublicFolder()  
+{
+        var publicEnable = $('#publicEnable').is(':checked');
+        var sharingaimGroup = $('input:radio[name=sharingaim]'); //find all radiobuttons of that group
+        $.each(sharingaimGroup, function(index, sharingaimItem) {
+                sharingaimItem.disabled = !publicEnable;        //set all buttons to the correct state
+        });
+}
+
+$(document).ready(function(){
+       switchPublicFolder(); // Execute the function after loading DOM tree
+       $('#publicEnable').click(function(){
+               switchPublicFolder(); // To get rid of onClick()
+       });
+});
index 9564076501cf6f1f1228223fda5dbb68ec83829b..ff331f860e626937fbd0136329ca52224af29d7e 100644 (file)
@@ -1,21 +1,13 @@
-<script type="text/javascript">
-function switchPublicFolder()
-{
-       var publicEnable = $('#publicEnable').is(':checked');
-       var sharingaimGroup = $('input:radio[name=sharingaim]');
-       $.each(sharingaimGroup, function(index, sharingaimItem) {
-               sharingaimItem.disabled = !publicEnable;
-       });
-}
-</script>
+<?php OC_UTIL::addScript('files','admin'); ?>
+
 <form name="filesForm" action='#' method='post'>
        <?php if($_['htaccessWorking']):?>
                <label for="maxUploadSize"><?php echo $l->t( 'Maximum upload size' ); ?> </label><input name='maxUploadSize' id="maxUploadSize" value='<?php echo $_['uploadMaxFilesize'] ?>'/><br/>
        <?php endif;?>
-       <input type="checkbox" name="publicEnable" id="publicEnable" onClick="switchPublicFolder()" /><label for="publicEnable"> <?php echo $l->t( 'Allow public folders' ); ?></label><br>
+       <input type="checkbox" name="publicEnable" id="publicEnable" /><label for="publicEnable"> <?php echo $l->t( 'Allow public folders' ); ?></label><br>
 
        <div style="padding-left: 20px">
-               <input type="radio" name="sharingaim" id="separated" checked="checked" /><label for="separated"> <?php echo $l->t( 'separated from webdav storage' ); ?></label><br>
+               <input type="radio" name="sharingaim" id="separated" /><label for="separated"> <?php echo $l->t( 'separated from webdav storage' ); ?></label><br>
                <input type="radio" name="sharingaim" id="userdecide" /><label for="userdecide"> <?php echo $l->t( 'let the user decide' ); ?></label><br>
                <input type="radio" name="sharingaim" id="inwebdav" /><label for="inwebdav"> <?php echo $l->t( 'folder "/public" in webdav storage' ); ?></label>
        </div>