Improving real-time style change for users

This commit is contained in:
BlackLight 2011-01-08 17:00:53 +01:00
parent 4507ef5d06
commit 3a532f2521
6 changed files with 64 additions and 21 deletions

View file

@ -184,6 +184,22 @@
{ {
shell.json[i] = blashrc[i]; shell.json[i] = blashrc[i];
} }
if ( blashrc['banner'] )
{
if ( document.getElementById ( 'banner' ))
{
document.getElementById ( 'banner' ).innerHTML = blashrc['banner'] + '<br/><br/>';
}
}
if ( blashrc['promptText'] )
{
if ( document.getElementById ( 'promptText' ))
{
document.getElementById ( 'promptText' ).innerHTML = shell.unescapePrompt ( blashrc['promptText'], shell.json.promptSequences );
}
}
} }
if ( stylercIndex > 0 ) if ( stylercIndex > 0 )

View file

@ -351,6 +351,36 @@ switch ( $action )
print set_content ( $file, $content ); print set_content ( $file, $content );
break; break;
case 'list':
if ( !( $xml = new SimpleXMLElement ( $xmlcontent )))
{
print "Unable to open the users XML file\n";
return false;
}
$users = array();
for ( $i = 0; $i < count ( $xml->user ); $i++ )
{
array_push ( $users, $xml->user[$i]['name'] );
}
sort ( $users, SORT_STRING );
foreach ( $users as $i => $user )
{
print $user;
if ( $i < count ( $users ) - 1 )
{
print "<br/>";
}
print "\n";
}
break;
default : default :
print "Unallowed action\n"; print "Unallowed action\n";
break; break;

View file

@ -268,6 +268,22 @@ function blash ()
{ {
shell.json[i] = blashrc[i]; shell.json[i] = blashrc[i];
} }
if ( blashrc['banner'] )
{
if ( document.getElementById ( 'banner' ))
{
document.getElementById ( 'banner' ).innerHTML = blashrc['banner'] + '<br/><br/>';
}
}
if ( blashrc['promptText'] )
{
if ( document.getElementById ( 'promptText' ))
{
document.getElementById ( 'promptText' ).innerHTML = shell.unescapePrompt ( blashrc['promptText'], shell.json.promptSequences );
}
}
} }
if ( stylercIndex > 0 ) if ( stylercIndex > 0 )

View file

@ -74,6 +74,7 @@
"touch", "touch",
"useradd", "useradd",
"userdel", "userdel",
"users",
"whoami" "whoami"
] ]
} }

View file

@ -3,7 +3,7 @@
*/ */
{ {
"banner" : "Welcome back to blash<br/><br/>", "banner" : "Welcome back to blash",
"machine" : "localhost", "machine" : "localhost",
/** /**

View file

@ -33,26 +33,6 @@
"path" : "/home", "path" : "/home",
"type" : "directory" "type" : "directory"
}, },
{
"path" : "/home/guest",
"type" : "directory"
},
{
"path" : "/home/guest/mbox",
"type" : "file",
"content" : "No new mail"
},
{
"path" : "/home/blacklight",
"type" : "directory",
"can_read" : "blacklight",
"can_write" : "blacklight"
},
{
"path" : "/home/blacklight/mbox",
"type" : "file",
"content" : "No new mail"
},
{ {
"path" : "/google", "path" : "/google",
"type" : "file", "type" : "file",