File permissions web app source code.




Source code for the file permissions application shown a while back.

<html>
<body>

<script type="text/javascript">
<!--
/* chmod helper, Version 1.0
 * by DK of able-design
* Last Modified: recently
*/

function do_chmod(user) {
 var field4 = user + "4";
 var field2 = user + "2";
 var field1 = user + "1";
 var total = "t_" + user;
 var symbolic = "sym_" + user;
 var number = 0;
 var sym_string = "";

 if (document.chmod[field4].checked == true) { number += 4; }
 if (document.chmod[field2].checked == true) { number += 2; }
 if (document.chmod[field1].checked == true) { number += 1; }

 if (document.chmod[field4].checked == true) {
  sym_string += "r";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field2].checked == true) {
  sym_string += "w";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field1].checked == true) {
  sym_string += "x";
 } else {
  sym_string += "-";
 }

 if (number == 0) { number = ""; }
 document.chmod[total].value = number;
 document.chmod[symbolic].value = sym_string;

 document.chmod.t_total.value = document.chmod.t_owner.value + document.chmod.t_group.value + document.chmod.t_other.value;
 document.chmod.sym_total.value = "-" + document.chmod.sym_owner.value + document.chmod.sym_group.value + document.chmod.sym_other.value;
}
//-->
</script>


<form name="chmod" action="">
<table cellpadding="0" cellspacing="0" summary="Chmod calculator"><tr><td width="100%" valign="top"><table width="100%" cellpadding="5" cellspacing="2" border="0" summary=""><tr><td width="100%" bgcolor="#8e97b4" align="center" colspan="5"><font color="#ffffff" size="3"><b>chmod (File Permissions) helper</b></font></td></tr>
 <tr bgcolor="#bcbcbc">
  <td align="left"><b>Permission</b></td>
  <td align="center"><b>Owner</b></td>
  <td align="center"><b>Group</b></td>

  <td align="center"><b>Other</b></td>
  <td bgcolor="#dddddd" rowspan="4"> </td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Read</b> (r = 4)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner4" value="4" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group4" value="4" onclick="do_chmod('group')"></td>

  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other4" value="4" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Write</b> (w=2)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner2" value="2" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group2" value="2" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other2" value="2" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">

  <td align="left" nowrap><b>Execute</b> (x=1)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner1" value="1" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group1" value="1" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other1" value="1" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Octal:</td>
  <td align="center"><input type="text" name="t_owner" value="" size="1"></td>

  <td align="center"><input type="text" name="t_group" value="" size="1"></td>
  <td align="center"><input type="text" name="t_other" value="" size="1"></td>
  <td align="left"><b>=</b> <input type="text" name="t_total" value="" size="3"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Symbolic:</td>
  <td align="center"><input type="text" name="sym_owner" value="" size="3"></td>
  <td align="center"><input type="text" name="sym_group" value="" size="3"></td>

  <td align="center"><input type="text" name="sym_other" value="" size="3"></td>
  <td align="left"><b>=</b> <input type="text" name="sym_total" value="" size="10"></td>
 </tr>
</table></td></tr></table>
</form>
</body>
</html>

Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.