Skip to content

Commit 45d5e88

Browse files
FileManager. Updated rights with numeric field
1 parent 20acf12 commit 45d5e88

File tree

3 files changed

+58
-39
lines changed

3 files changed

+58
-39
lines changed

web/css/file_manager.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,11 @@ ul.listing { list-style-type: none; padding: 18px 0 0; margin: -4px 0 0 -1px; b
270270
.confirm-box .controls .keep-original:hover { color: #FFCC00; }
271271
.confirm-box .controls .keep-original:active { color: #6DB8D3; }
272272

273+
.confirm-box .chmod-mask,
273274
.confirm-box .new-title { background-color: #292929; border: 1px solid #111; color: #eee; font-family: Arial; font-size: 16px; margin-bottom: 73px; margin-left: 27px; padding: 10px 14px; width: 396px; }
275+
.confirm-box .chmod-mask:focus,
274276
.confirm-box .new-title:focus { border: 1px solid #FFCC00; box-shadow: 0 0 5px 0 rgba(255, 204, 0 , 0.3); }
277+
.confirm-box .chmod-mask { width: 28px; margin: -12px 0 42px 57px; }
275278

276279
.confirm-box.rename .message { margin-bottom: 36px; }
277280
.confirm-box.rename .controls.replace { display: none; }

web/js/file_manager.js

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,25 +1525,8 @@ FM.confirmChmod = function() {
15251525
var src = selected.find('.source').val();
15261526
src = $.parseJSON(src);
15271527

1528-
var ro = $('input[name="read-by-owner"]').is(':checked') ? 4 : 0;
1529-
var wo = $('input[name="write-by-owner"]').is(':checked') ? 2 : 0;
1530-
var eo = $('input[name="execute-by-owner"]').is(':checked') ? 1 : 0;
1531-
1532-
var rg = $('input[name="read-by-group"]').is(':checked') ? 4 : 0;
1533-
var wg = $('input[name="write-by-group"]').is(':checked') ? 2 : 0;
1534-
var eg = $('input[name="execute-by-group"]').is(':checked') ? 1 : 0;
1535-
1536-
var re = $('input[name="read-by-others"]').is(':checked') ? 4 : 0;
1537-
var we = $('input[name="write-by-others"]').is(':checked') ? 2 : 0;
1538-
var ee = $('input[name="execute-by-others"]').is(':checked') ? 1 : 0;
1539-
1540-
var o = ro+wo+eo;
1541-
var g = rg+wg+eg;
1542-
var e = re+we+ee;
1543-
1544-
var permissions = o + "" + g + "" + e + "";
1545-
1546-
var action = FM.isItemFile(src) ? 'chmod_item' : 'chmod_item';
1528+
var permissions = $('.chmod input.chmod-mask').val();
1529+
var action = 'chmod_item';
15471530

15481531
var params = {
15491532
dir: FM['TAB_' + tab + '_CURRENT_PATH'] + '/',
@@ -1583,24 +1566,7 @@ FM.confirmBulkChmod = function() {
15831566
}
15841567
});
15851568

1586-
1587-
var ro = $('input[name="read-by-owner"]').is(':checked') ? 4 : 0;
1588-
var wo = $('input[name="write-by-owner"]').is(':checked') ? 2 : 0;
1589-
var eo = $('input[name="execute-by-owner"]').is(':checked') ? 1 : 0;
1590-
1591-
var rg = $('input[name="read-by-group"]').is(':checked') ? 4 : 0;
1592-
var wg = $('input[name="write-by-group"]').is(':checked') ? 2 : 0;
1593-
var eg = $('input[name="execute-by-group"]').is(':checked') ? 1 : 0;
1594-
1595-
var re = $('input[name="read-by-others"]').is(':checked') ? 4 : 0;
1596-
var we = $('input[name="write-by-others"]').is(':checked') ? 2 : 0;
1597-
var ee = $('input[name="execute-by-others"]').is(':checked') ? 1 : 0;
1598-
1599-
var o = ro+wo+eo;
1600-
var g = rg+wg+eg;
1601-
var e = re+we+ee;
1602-
1603-
var permissions = o + "" + g + "" + e + "";
1569+
var permissions = $('.chmod input.chmod-mask').val();
16041570

16051571
var action = 'chmod_item';
16061572
var tab = FM.getTabLetter(FM.CURRENT_TAB);
@@ -1693,6 +1659,29 @@ FM.chmodItems = function() {
16931659
tpl.set(':EXECUTE_BY_OTHERS', mode[2] & 1 ? "checked" : "");
16941660

16951661
FM.popupOpen(tpl.finalize());
1662+
$('.chmod input.chmod-mask').val(mode);
1663+
1664+
$('.chmod input[type=checkbox]').click(function(){
1665+
var ro = $('input[name="read-by-owner"]').is(':checked') ? 4 : 0;
1666+
var wo = $('input[name="write-by-owner"]').is(':checked') ? 2 : 0;
1667+
var eo = $('input[name="execute-by-owner"]').is(':checked') ? 1 : 0;
1668+
1669+
var rg = $('input[name="read-by-group"]').is(':checked') ? 4 : 0;
1670+
var wg = $('input[name="write-by-group"]').is(':checked') ? 2 : 0;
1671+
var eg = $('input[name="execute-by-group"]').is(':checked') ? 1 : 0;
1672+
1673+
var re = $('input[name="read-by-others"]').is(':checked') ? 4 : 0;
1674+
var we = $('input[name="write-by-others"]').is(':checked') ? 2 : 0;
1675+
var ee = $('input[name="execute-by-others"]').is(':checked') ? 1 : 0;
1676+
1677+
var o = ro+wo+eo;
1678+
var g = rg+wg+eg;
1679+
var e = re+we+ee;
1680+
1681+
var permissions = o + "" + g + "" + e + "";
1682+
1683+
$('.chmod input.chmod-mask').val(permissions);
1684+
});
16961685
}
16971686

16981687
FM.bulkChmod = function() {
@@ -1728,6 +1717,28 @@ FM.bulkChmod = function() {
17281717
//popup_bulk_copy
17291718

17301719
FM.popupOpen(tpl.finalize());
1720+
1721+
$('.chmod input[type=checkbox]').click(function(){
1722+
var ro = $('input[name="read-by-owner"]').is(':checked') ? 4 : 0;
1723+
var wo = $('input[name="write-by-owner"]').is(':checked') ? 2 : 0;
1724+
var eo = $('input[name="execute-by-owner"]').is(':checked') ? 1 : 0;
1725+
1726+
var rg = $('input[name="read-by-group"]').is(':checked') ? 4 : 0;
1727+
var wg = $('input[name="write-by-group"]').is(':checked') ? 2 : 0;
1728+
var eg = $('input[name="execute-by-group"]').is(':checked') ? 1 : 0;
1729+
1730+
var re = $('input[name="read-by-others"]').is(':checked') ? 4 : 0;
1731+
var we = $('input[name="write-by-others"]').is(':checked') ? 2 : 0;
1732+
var ee = $('input[name="execute-by-others"]').is(':checked') ? 1 : 0;
1733+
1734+
var o = ro+wo+eo;
1735+
var g = rg+wg+eg;
1736+
var e = re+we+ee;
1737+
1738+
var permissions = o + "" + g + "" + e + "";
1739+
1740+
$('.chmod input.chmod-mask').val(permissions);
1741+
});
17311742
}
17321743
}
17331744

@@ -2448,10 +2459,10 @@ $(document).ready(function() {
24482459
}
24492460
var tab = FM.getTabLetter(FM.CURRENT_TAB);
24502461
var elm = $(FM.CURRENT_TAB).find('.dir:eq('+FM['CURRENT_'+tab+'_LINE']+')');
2451-
2462+
24522463
if (elm.length == 1) {
24532464
var src = $.parseJSON($(elm).find('.source').val());
2454-
2465+
24552466
if (src.type == 'd') {
24562467
FM.open(src.full_path, FM.CURRENT_TAB);
24572468
}
@@ -2647,6 +2658,9 @@ $(document).ready(function() {
26472658
$('.shortcuts').hide();
26482659
});
26492660

2661+
2662+
2663+
26502664
});
26512665

26522666
/*$(document).bind('keydown.tab', function() {

web/js/templates.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ App.Templates.html = {
143143
<li><label><input type="checkbox" name="write-by-others" value="1" ~!:WRITE_BY_OTHERS~! /> '+App.Constants.FM_WRITE_BY_OTHERS+'</label></li>\
144144
<li><label><input type="checkbox" name="execute-by-others" value="1" ~!:EXECUTE_BY_OTHERS~! /> '+App.Constants.FM_EXECUTE_BY_OTHERS+'</label></li>\
145145
</ul>\
146+
<input type="text" name="mask" class="chmod-mask" maxlength="3" />\
146147
</div>\
147148
<div class="controls">\
148149
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\
@@ -166,6 +167,7 @@ App.Templates.html = {
166167
<li><label><input type="checkbox" name="write-by-others" value="1" checked /> '+App.Constants.FM_WRITE_BY_OTHERS+'</label></li>\
167168
<li><label><input type="checkbox" name="execute-by-others" value="1" checked /> '+App.Constants.FM_EXECUTE_BY_OTHERS+'</label></li>\
168169
</ul>\
170+
<input type="text" name="mask" class="chmod-mask" maxlength="3" value="777" />\
169171
</div>\
170172
<div class="controls">\
171173
<p class="cancel" onClick="FM.popupClose();">'+App.Constants.FM_CANCEL+'</p>\

0 commit comments

Comments
 (0)