Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added save functionality, fixed fileManager.php issues, etc. #1

Merged
merged 1 commit into from
Feb 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<filesMatch ".(txt)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
2 changes: 0 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ USE:
the images to the folder "IAT/[template name]/img"

4) Direct participants to your IAT! (e.g., [yourserver.com]/IAT)

For a more detailed walkthrough, see http://www.slideshare.net/winteram/open-source-iat-spsp-2013.
270 changes: 161 additions & 109 deletions core/css/experimenter.css
Original file line number Diff line number Diff line change
@@ -1,109 +1,161 @@
body {
background:none repeat scroll 0 0 #FFFFFF;
border:0 none;
font-family: Arial;
}

.exp-header {
height: 50px;
width: 98%;
font-size: 20px;
padding: 25px 10px 0px 10px;
margin: 1px;
}

.exp-header-active-label {
float: left;
}

.exp-header-active {
margin-left: 70px;
}

.selector-frame {
width: 230px;
margin: 15px 0px 0px 15px;
float: left;
}

.selector-label {
font-size: 14px;
width: 100px;
padding: 2px;
text-align: center;
}

.selector-button-list {
width: 200px;
margin: 5px;
}

.delete-item {
float: left;
}

#exp-content {
min-height: 550px;
min-width: 550px;
margin: 10px 30px 0px 250px;
border: solid black 1px;
}

#create-new {
text-align: center;
}

#template-name {
font-size: 32px;
border-style: none;
margin: 5px 0px 0px 5px;
background-color: #CCC;
}

.template-item {
padding: 3px 0px 3px 0px;
background-color: #F2F2F2;
border: #666666 1px solid;
}

.template-item-label {
margin-left: 15px;
text-align: center;
width: 100%;
}

.template-selected {
background-color: #CEF6F5;
}

.template-form-label {
float: left;
}

.template-form-item {
padding: 3px 0px 3px 0px;
}

.template-option {
font-size: 12px;
margin-left: 10px;
}

.cat-item-img {
margin: 10px 3px 3px 3px;
vertical-align: bottom;
max-width: 100px;
max-height: 30px;
}

#add-item-button {
text-align: center;
margin-left:auto;
margin-right:auto;
height: 50px;
width: 50px;
}

.erroritem {
border: red 1px dotted;
}
body {
background:none repeat scroll 0 0 #FFFFFF;
border:0 none;
font-family: Arial;
}

.exp-header {
height: 50px;
width: 98%;
font-size: 20px;
padding: 25px 10px 0px 10px;
margin: 1px;
}

.exp-header-active-label {
float: left;
}

.exp-header-active {
margin-left: 70px;
}

.selector-frame {
width: 230px;
margin: 15px 0px 0px 15px;
float: left;
}

.selector-label {
font-size: 14px;
width: 100px;
padding: 2px;
text-align: center;
}

.selector-button-list {
width: 200px;
margin: 5px;
}

.delete-item {
float: left;
cursor: pointer;
}

.save-item {
float: right;
margin-right: 5px;
cursor: pointer;
}

.ui-icon:hover {
background-image: url(overcast/images/ui-icons_3383bb_256x240.png);
}

#exp-content {
min-height: 550px;
min-width: 550px;
margin: 10px 30px 0px 250px;
border: solid black 1px;
}

#create-new {

}

#template-name {
font-size: 32px;
border-style: none;
margin: 5px 0px 0px 5px;
background-color: #CCC;
}

.template-item {
padding: 3px 0px 3px 0px;
background-color: #f5f5f5;
border: #eee 1px solid;
font: 11pt Verdana;
}

.template-item:not(.template-selected):hover {
color: #599FCF;
}

.template-selected {
background-color: #FCFCD2;
border-color: #aaa;
}

.template-unsaved {
background-color: #fcfc98 !important;
}

.template-unsaved .template-item-label {
font-weight: bold;
}

.template-unsaved .template-item-label:after {
content: "*";
font-weight: bold;
}

.template-item-label {
margin-left: 15px;
text-align: center;
width: 100%;
cursor: default;
}

.template-form-label {
float: left;
}

.template-form-item {
padding: 3px 0px 3px 0px;
}

.template-option {
font-size: 12px;
margin-left: 10px;
}

.cat-item-img {
margin: 10px 3px 3px 3px;
vertical-align: bottom;
max-width: 100px;
max-height: 30px;
}

#add-item-button {
text-align: center;
margin-left:auto;
margin-right:auto;
height: 50px;
width: 50px;
}

.erroritem {
border: red 1px dotted;
}

.ui-dialog {
width: 40% !important;
}

.cat-AB {
-moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-left-radius: 6px;
-moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; -khtml-border-top-right-radius: 6px; border-top-right-radius: 6px;
}



.cat-12 {
background: #3383BB;
color: #ccc !important;
-moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-left-radius: 6px; border-top-left-radius: 6px;
-moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; -khtml-border-top-right-radius: 6px; border-top-right-radius: 6px;
}

.ui-state-hover .cat-12 { color: #ddd !important; }
.ui-state-active .cat-12 { color: #fff !important; }
41 changes: 32 additions & 9 deletions core/fileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,29 @@
);

//update active and available templates
function updateActive($newActive=NULL)
function updateActive($optArr=NULL)
{
$active_str = file_get_contents("../templates/active.txt");
$active_str = file_get_contents('../templates/active.txt');
$active = json_decode($active_str);
if(!is_null($newActive))

// When "op" = "setActive", calls updateActive with 'newActive' option set
if(isset($optArr) && isset($optArr['newActive']))
{
$active->active = $optArr['newActive'];
}
else if(isset($optArr['op']) && $optArr['op'] == 'saveTemplate')
{
if($active->active == $optArr['oldName'])
{
$active->active = $optArr['newName'];
}
}
else if(isset($optArr['op']) && $optArr['op'] == 'deleteTemplate')
{
$active->active = $newActive;
if($active->active == $optArr['oldName'])
{
$active->active = 'Empty';
}
}

$available = array();
Expand All @@ -52,7 +68,7 @@ function updateActive($newActive=NULL)
}
closedir($handle);
}
sort($available);
natcasesort($available);
$active->available = $available;

$active_fh = fopen("../templates/active.txt", 'w');
Expand Down Expand Up @@ -131,8 +147,9 @@ function writeoutput($output)
break;
case 'setActive':
if( isset($_REQUEST['template']) )
{
updateActive($_REQUEST['template']);
{
$optArr = array('newActive' => $_REQUEST['template']);
updateActive($optArr);
echo "success";
}
else
Expand Down Expand Up @@ -346,7 +363,10 @@ function writeoutput($output)

// check if old name is currently active, if so, change?
// also need to rename in active.txt
updateActive();
$optArr = array('oldName' => $_REQUEST['oldname'],
'newName' => $form['template-name'],
'op' => 'saveTemplate');
updateActive($optArr);
}
$inputfile = fopen("../templates/".$form["template-name"]."/input.txt", 'w');
fwrite($inputfile, $json_template);
Expand Down Expand Up @@ -406,7 +426,10 @@ function writeoutput($output)
unlink($folder_dir."/input.txt");
}
rmdir($folder_dir);
updateActive();

$optArr = array('oldName' => $_REQUEST['template'],
'op' => 'deleteTemplate');
updateActive($optArr);
}
else
{
Expand Down
Loading