Skip to content

Instantly share code, notes, and snippets.

@robheittman
Created October 29, 2010 20:00
Show Gist options
  • Save robheittman/654288 to your computer and use it in GitHub Desktop.
Save robheittman/654288 to your computer and use it in GitHub Desktop.
Ruby snippet in PostLaunch #1
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> &#160; &#160;
<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