Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' Conflicts: Makefile
- Loading branch information
Showing
49 changed files
with
844 additions
and
122 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class='message'><date>00:00:00</date> <name>LibraryBox:</name> <data class='def'>Chat and share files anonymously!</data></div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Require any additional compass plugins here. | ||
|
||
# Set this to the root of your project when deployed: | ||
http_path = "/www/" | ||
css_dir = "/www/css/" | ||
sass_dir = "sass" | ||
images_dir = "/www/img/" | ||
javascripts_dir = "/www/js/" | ||
|
||
# You can select your preferred output style here (can be overridden via the command line): | ||
output_style = :expanded | ||
#:expanded or :nested or :compact or :compressed | ||
|
||
# To enable relative paths to assets via compass helper functions. Uncomment: | ||
# relative_assets = true | ||
|
||
# To disable debugging comments that display the original location of your selectors. Uncomment: | ||
line_comments = false | ||
|
||
|
||
# If you prefer the indented syntax, you might want to regenerate this | ||
# project again passing --syntax sass, or you can uncomment this: | ||
# preferred_syntax = :sass | ||
# and then run: | ||
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
#!/usr/bin/python | ||
|
||
# Modificated ShoutBox Library | ||
# enables further modifications for the ShoutBox | ||
# Run without to generate htmlfile | ||
# Run the following to enter a new line from command line | ||
# psogen.py input Anonymous default "Text" | ||
|
||
import os, datetime, re | ||
|
||
import messages, broadcast | ||
|
||
datafilename = os.environ["SHOUTBOX_CHATFILE"] | ||
htmlfilename = os.environ["SHOUTBOX_GEN_HTMLFILE"] | ||
|
||
try: | ||
raw_dest = os.environ["SHOUTBOX_BROADCAST_DESTINATIONS"] | ||
finished_dest = re.sub ( '#' , '"' , raw_dest ) | ||
broadcast_destination = eval ( finished_dest ) | ||
except KeyError: | ||
broadcast_destination = False | ||
|
||
|
||
#-------------- | ||
# Generates Shoutbox-HTML-Frame ... | ||
# Imports: | ||
# content - String containing preformatted data | ||
#-------------- | ||
def generate_html(content): | ||
htmlstring = "<html><head><meta http-equiv='cache-control' content='no-cache'><meta name='GENERATOR' content='PyShoutOut'><title>Shout-Out Data</title><body>" | ||
htmlstring += content | ||
htmlstring += "</body></html>" | ||
return htmlstring | ||
|
||
#-------------- | ||
# Generates HTML Data based on given content and write it to static html file | ||
# Imports: | ||
# content - String containing preformatted data | ||
#-------------- | ||
def generate_html_into_file(content): | ||
htmlstring = generate_html ( content ) | ||
|
||
htmlfile = open( htmlfilename , 'w' ) | ||
htmlfile.write( htmlstring ) | ||
htmlfile.close() | ||
|
||
#-------------- | ||
# Generates HTML Data based on datafilename 's content | ||
#-------------- | ||
def generate_html_from_file(): | ||
old = read_data_file() | ||
generate_html_into_file( old ) | ||
|
||
#-------------- | ||
# Generates and Displays generated HTML | ||
#-------------- | ||
def generate_html_to_display_from_file(): | ||
old = read_data_file() | ||
htmlstring = generate_html ( old ) | ||
print htmlstring | ||
|
||
#-------------- | ||
# Reads Data file from datafilename given name | ||
#-------------- | ||
def read_data_file(): | ||
datafile = open(datafilename, 'r') | ||
old = datafile.read() | ||
datafile.close() | ||
return old | ||
|
||
#-------------- | ||
# Function for saving new Shoubox-Content & Regenerate static HTML file -- usually called by HTML-Form | ||
#-------------- | ||
def process_form( name , indata , color ): | ||
content = save_input( name , indata , color ) | ||
|
||
if broadcast_destination == False: | ||
generate_html_into_file ( content ) | ||
|
||
|
||
#-------------- | ||
# Acutally Saves SB-Content to datafile | ||
#-------------- | ||
def save_input( name , indata , color ): | ||
|
||
content = prepare_line ( name, indata, color ) | ||
|
||
if broadcast_destination != False: | ||
return writeToNetwork( content , broadcast_destination ) | ||
else: | ||
return writeToDisk ( content ) | ||
|
||
def writeToNetwork ( content , broadcast_destination ): | ||
message = messages.shoutbox_message() | ||
message.set(content) | ||
casting = broadcast.broadcast( ) | ||
casting.setDestination(broadcast_destination) | ||
casting.set( message.get_message() ) | ||
casting.send() | ||
return None | ||
|
||
def writeToDisk ( content ): | ||
old = read_data_file() | ||
finalcontent = content + old | ||
datafile = open(datafilename, 'r+') | ||
datafile.write(finalcontent) | ||
#datafile.truncate(0) | ||
datafile.close() | ||
return finalcontent | ||
|
||
|
||
def prepare_line ( name, indata, color ): | ||
datapass = re.sub("<", "<", indata) | ||
data = re.sub(">", ">", datapass) | ||
curdate = datetime.datetime.now() | ||
# Trying to make it look like this: | ||
# <div class="message"> | ||
# <date>00:00:00</date> <name>Nickname:</name> <data class="def">Lorem ipsum dolor sit amet</data> | ||
# </div> | ||
content = "<div class='message'><date>" + curdate.strftime("%H:%M:%S") + "</date> <name>" + name + ":</name> <data class='" + color + "'>" + data + "</data></div>\n" | ||
return content | ||
|
||
#-------------- | ||
# Testing or Generating static HTML File | ||
#-------------- | ||
if __name__ == "__main__": | ||
import sys | ||
if sys.argv.count("input") >= 1 : | ||
save_input( sys.argv[2] , sys.argv[3] , sys.argv[4] ) | ||
generate_html_to_display_from_file() | ||
print "Entered Text." | ||
|
||
generate_html_from_file () | ||
print "Generated HTML-Shoutbox File." | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
// Get the base | ||
@import "modules/base"; | ||
|
||
// Partials | ||
@import "partials/reset"; | ||
@import "partials/type"; | ||
@import "partials/forms"; | ||
|
||
//----------------[ Mobile ] | ||
#header { | ||
background: $orange; | ||
border-bottom: 1px solid darken($orange, 10%); | ||
#menu-icon { | ||
position: absolute; | ||
top: .25em; | ||
right: .25em; | ||
img { | ||
width: 2em; | ||
} | ||
} | ||
#top-nav { | ||
.brand { | ||
margin-left: 0; | ||
} | ||
|
||
ul { | ||
display: none; | ||
li { | ||
&:last-child { | ||
margin: 0 0 .5em 0; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#content { | ||
#welcome { | ||
background: $gray; | ||
margin: 0 0 1em; | ||
padding: 2em 0; | ||
img { | ||
margin: 0 .25em 0 0; | ||
} | ||
} | ||
|
||
#files-top {} | ||
|
||
#files-latest {} | ||
|
||
#chat { | ||
#shoutbox { | ||
height: 300px; | ||
margin: 0 0 .5em; | ||
.message { | ||
margin: 0 0 .10em; | ||
} | ||
} | ||
|
||
#shoutbox-input { | ||
.nickname {} | ||
.message {} | ||
} | ||
|
||
#shoutbox-options { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
#footer { | ||
background: $orange; | ||
border-top: 1px solid darken($orange, 10%); | ||
margin: 2em 0 0 0; | ||
padding: 0 0 1em; | ||
.to-top { | ||
float: right; | ||
} | ||
} | ||
|
||
.container { | ||
height: 100%; | ||
padding: 0 .5em; | ||
width: 100%; | ||
} | ||
|
||
.one-third, | ||
.two-thrids { | ||
margin: 0 0 1em; | ||
} | ||
|
||
@media screen and (min-width: 600px) { | ||
#header { | ||
#menu-icon { | ||
display: none; | ||
} | ||
#top-nav { | ||
.brand { | ||
float: left; | ||
margin: 0 1em 0 0; | ||
} | ||
|
||
ul { | ||
display: block; | ||
li { | ||
float: left; | ||
&:last-child { | ||
margin: 0; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#content { | ||
#welcome {} | ||
|
||
#files-top {} | ||
|
||
#files-latest {} | ||
|
||
#chat { | ||
#shoutbox {} | ||
|
||
#shoutbox-input { | ||
input, | ||
button { | ||
float: left; | ||
} | ||
.nickname { | ||
margin: 0 5px 0 0; | ||
width: 15%; | ||
} | ||
.message { | ||
margin: 0 5px 0 0; | ||
width: 70%; | ||
} | ||
.button { | ||
width: 10%; | ||
} | ||
} | ||
|
||
#shoutbox-options { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
#footer { | ||
.to-top { | ||
display: none; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 0 2em 0 0; | ||
} | ||
.last { | ||
padding: 0; | ||
} | ||
|
||
} | ||
|
||
//----------------[ Desktop ] | ||
@media screen and (min-width: 801px) { | ||
#header { | ||
#menu-icon {} | ||
#top-nav { | ||
.brand {} | ||
|
||
ul { | ||
li {} | ||
} | ||
} | ||
} | ||
|
||
#content { | ||
#welcome {} | ||
|
||
#files-top {} | ||
|
||
#files-latest {} | ||
|
||
#chat { | ||
#shoutbox {} | ||
|
||
#shoutbox-input { | ||
.nickname {} | ||
.message {} | ||
} | ||
|
||
#shoutbox-options {} | ||
} | ||
} | ||
|
||
#footer {} | ||
|
||
.container { | ||
margin: 0 auto; | ||
max-width: 1280px; | ||
width: 90%; | ||
} | ||
|
||
.one-third { | ||
float: left; | ||
width: 1 / 3 * 100%; | ||
} | ||
|
||
.two-thirds { | ||
float: left; | ||
width: 2 / 3 * 100%; | ||
} | ||
|
||
} |
Oops, something went wrong.