Created
October 29, 2010 20:00
-
-
Save robheittman/654288 to your computer and use it in GitHub Desktop.
Ruby snippet in PostLaunch #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you = $GoGoEgo.getPlugin("Identity").getId | |
if you == nil then | |
$document.write "Please <a href='/portals'>log in</a> to use this page." | |
else | |
mode = you[-2,2] | |
you = you[0..-2] | |
if you != $base.getCollectionID and mode != "+a" then | |
$document.write <<-END | |
Your account is not allowed to use this page. | |
Please <a href='/portals/logout.html'>log out</a> and log in as an administrator | |
or the user #{base.getCollectionID} | |
END | |
else | |
$document.write <<-END | |
<div id='portal_files_header'> | |
Files available for : <b>#{$base.getCollectionName}</b>     | |
<span style='font-size:small'>[<a href='/portals/logout.html'>Log Out</a>]</span> | |
</div> | |
END | |
for i in 0..$base.getItemCount | |
$document.writeEL "/collections/portals/storage/#{$base.getCollectionID}/#{$base.getItemObject(i).itemID}/storageitem.html" | |
if (i+1) < $base.getItemCount() | |
$document.write "<hr color='#e83f22'>" | |
end | |
end | |
$document.write <<-END | |
<div style='margin-top: 20px'></div><div>Upload a new item:</div> | |
<form method="post" enctype="multipart/form-data"> | |
<div><input type='file' name='file'/></div> | |
<div>Name:<br/> | |
<input type='text' name='name' size='60'/></div> | |
<div>Description:<br/> | |
<textarea name='description' rows='3' cols='60'></textarea></div> | |
<div><input type='submit' value='Upload'/></div> | |
</form> | |
END | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment