Changeset 144 for Dev/trunk


Ignore:
Timestamp:
11/03/11 10:30:40 (13 years ago)
Author:
fpvanagthoven
Message:

Fixed mkdir call in ApplicationConnector?.php, now actually makes a directory instead of errors.
Cleaning up of pipeline Sequencer, smaller icons, etc. Trying to get non-db version of editor working properly, then integrate db calls.

Location:
Dev/trunk
Files:
5 added
10 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/ApplicationConnector.php

    r131 r144  
    1111 * @author jkraaijeveld
    1212 */
    13 class ApplicationConnector implements IConnector{
    14    
     13class ApplicationConnector implements IConnector {
     14
    1515    protected $model;
    1616    protected $fileName = 'data/applications/applications.rdf';
     
    1919     * Constructor for ApplicationConnector.
    2020     */
    21     public function __construct()
    22     {
     21    public function __construct() {
    2322        //Ensure the required folder for this connector exists
    24         if (!is_dir('data/applications/'))
    25             mkdir('data/applications/');       
     23        if (!is_dir('data/applications/')) {
     24            mkdir('data/applications/', null, true);
     25        }
    2626    }
    27    
     27
    2828    /**
    2929     * function load()
     
    3333        //Get the Memory Model from the ModelFactory
    3434        $this->model = ModelFactory::getDefaultModel();
    35        
     35
    3636        //Ensure the required file exists before loading
    37         if(file_exists($this->fileName))
     37        if (file_exists($this->fileName))
    3838            $this->model->load($this->fileName);
    3939    }
    40    
     40
    4141    /**
    4242     * function save()
     
    4444     */
    4545    public function save() {
    46         $this->model->saveAs($this->fileName,'rdf');
     46        $this->model->saveAs($this->fileName, 'rdf');
    4747    }
    48    
     48
    4949    /**
    5050     * function get($arguments)
     
    5858        $keys = array_keys($arguments);
    5959        //Set default values for arguments
    60         $uid = "?uid"; $title = "?title"; $description = "?description"; $style = "?style";
     60        $uid = "?uid";
     61        $title = "?title";
     62        $description = "?description";
     63        $style = "?style";
    6164        //Set the arguments if they are supplied
    62         if(in_array("uid", $keys))
    63             $uid = "\"".$arguments["uid"]."\"";
    64         if(in_array("title", $keys))
    65             $title = '\''.$arguments["title"].'\'';
    66         if(in_array("description", $keys))
    67             $description = "\"".$arguments["description"]."\"";
    68         if(in_array("style", $keys))
    69             $style = "\"".$arguments["style"]."\"";   
     65        if (in_array("uid", $keys))
     66            $uid = "\"" . $arguments["uid"] . "\"";
     67        if (in_array("title", $keys))
     68            $title = '\'' . $arguments["title"] . '\'';
     69        if (in_array("description", $keys))
     70            $description = "\"" . $arguments["description"] . "\"";
     71        if (in_array("style", $keys))
     72            $style = "\"" . $arguments["style"] . "\"";
    7073
    7174        //Create the querystring
     
    9093        $results = $this->model->sparqlQuery($querystring);
    9194        $applications = array();
    92         if(!empty($results))
    93         {
     95        if (!empty($results)) {
    9496            //Run over all results and create appropriate Application objets
    95             foreach($results as $result)
    96             {
    97                     $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
     97            foreach ($results as $result) {
     98                $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
    9899            }
    99100        }
    100101        return $applications;
    101102    }
    102    
     103
    103104    /**
    104105     * function set()
     
    107108     * @param type $rToolObject: The ResearchToolObject to be saved.
    108109     */
    109     public function set($rToolObject)
    110     {
     110    public function set($rToolObject) {
    111111        $this->load();
    112         $resourceApplication = new Resource(APPLICATION.'/'.$rToolObject->uid);
     112        $resourceApplication = new Resource(APPLICATION . '/' . $rToolObject->uid);
    113113        //Remove the old value stored with the given id
    114114        $this->model->subtract($this->model->find($resourceApplication, null, null));
     
    117117        $resourceApplicationType = new Resource(APPLICATION);
    118118        $predicateRType = new Resource(RTYPE);
    119         $this->model->add(new Statement($resourceApplication,$predicateRType,$resourceApplicationType));
    120                
     119        $this->model->add(new Statement($resourceApplication, $predicateRType, $resourceApplicationType));
     120
    121121        $literalApplicationID = new Literal($rToolObject->uid);
    122122        $predicateUniqueID = new Resource(UID);
    123         $this->model->add(new Statement($resourceApplication,$predicateUniqueID,$literalApplicationID));
     123        $this->model->add(new Statement($resourceApplication, $predicateUniqueID, $literalApplicationID));
    124124
    125125        $applicationTitle = new Literal($rToolObject->title);
    126         $predicateTitle = new Resource(TITLE); 
    127         $this->model->add(new Statement($resourceApplication,$predicateTitle,$applicationTitle));
     126        $predicateTitle = new Resource(TITLE);
     127        $this->model->add(new Statement($resourceApplication, $predicateTitle, $applicationTitle));
    128128
    129129        $applicationDescription = new Literal($rToolObject->description);
    130130        $predicateDescription = new Resource(DESCRIPTION);
    131         $this->model->add(new Statement($resourceApplication,$predicateDescription,$applicationDescription));
     131        $this->model->add(new Statement($resourceApplication, $predicateDescription, $applicationDescription));
    132132
    133133        $applicationStyle = new Literal($rToolObject->style);
    134134        $predicateStyle = new Resource(STYLE);
    135         $this->model->add(new Statement($resourceApplication,$predicateStyle,$applicationStyle));
    136                
    137         $this->save();
     135        $this->model->add(new Statement($resourceApplication, $predicateStyle, $applicationStyle));
     136
     137        $this->save();
    138138    }
     139
    139140}
    140141
  • Dev/trunk/classes/DisplayStep.php

    r142 r144  
    1818    public $imageURL;
    1919    public $selected = false;
    20     public $name;
     20    public $caption;
     21    public $id;
    2122
    22     public function __construct($t, $ref=null, $n) {
    23        
     23    public function __construct($t, $ref=null, $c, $id) {
     24
    2425        $this->type = $t;
    2526        $this->reference = $ref;
    26         $this->name = $n;
    27        
     27        $this->caption = $c;
     28        $this->id = $id;
     29
    2830        switch ($this->type) {
    2931            case "Questionnaire":
    30                 $this->imageURL = "images/icons/questionnaire2.png";
     32                $this->imageURL = "images/icons/questionnaire.png";
    3133                break;
    3234            case "Dashboard":
    33                 $this->imageURL = "images/icons/dashboard2.png";
     35                $this->imageURL = "images/icons/dashboard.png";
    3436                break;
    3537            case "Application":
    36                 $this->imageURL = "images/icons/application2.png";
    37                 break;
    38             case "Notice":
    39                 $this->imageURL = "images/icons/notice2.png";
     38                $this->imageURL = "images/icons/application.png";
    4039                break;
    4140            default:
     
    4342                break;
    4443        }
    45        
     44
    4645        //output a display object
    47         echo '<div class="displayStep" style="background-image: url(\'';
    48         echo $this->imageURL;
    49         echo '\');" ><p>'.$this->name.'</p></div>'."\n";
    50        
     46        //echo '<div class="displayStep"><div class="displayStepIcon" style="background-image: url('.$this->imageURL.');"></div>'.$this->caption.'</div>'."\n";
     47        echo '<div class="displayStep"><div class="displayStepIcon"><img src="' . $this->imageURL . '" /></div>' . $this->caption . '</div>';
    5148    }
    5249
  • Dev/trunk/css/awesome.css

    r142 r144  
    5959    background-image: url('../images/bg/blueishgridblock.png');
    6060    height: 100%;
     61    font-size: 12px;
    6162}
    6263
     
    586587#sequencer {
    587588    width: 100%;
    588     margin: 0 auto auto auto;
    589     background-image: url('../images/bg/sequencerBG.png');
     589    margin: 0 auto 0 auto;
     590    /*background-image: url('../images/bg/sequencerBG.png');*/
     591    background-image: linear-gradient(top, #B0B0B0 21%, #888888 80%);
     592    background-image: -o-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     593    background-image: -moz-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     594    background-image: -webkit-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     595    background-image: -ms-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     596
     597    background-image: -webkit-gradient(
     598        linear,
     599        left top,
     600        left bottom,
     601        color-stop(0.21, #B0B0B0),
     602        color-stop(0.8, #888888)
     603    );
    590604    background-position: bottom;
    591605    background-repeat: repeat-x;
     
    597611    margin-top:0.5em;
    598612    margin-left: 1em;
    599     font-size: 1.2em;
     613    font-size: 1.25em;
    600614    color: #FFF;
    601615   
    602616}
    603617
    604 #sequencer #seqContent {
    605     height: 10em;
     618#sequencer .seqContent {
     619    height: 9em;
     620    overflow-x: scroll;
     621    overflow-y: hidden;
    606622    margin-bottom: 0.5em;
    607     background-image: url('../images/bg/sequencerContentBG.png');
    608     /*background-position: top;
    609     background-color: #dddddd;*/
     623   
     624    background-image: linear-gradient(top, #B0B0B0 21%, #888888 80%);
     625    background-image: -o-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     626    background-image: -moz-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     627    background-image: -webkit-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     628    background-image: -ms-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     629    background-image: -webkit-gradient(
     630        linear,
     631        left bottom,
     632        left top,
     633        color-stop(0.25, #B0B0B0),
     634        color-stop(0.8, #888888)
     635    );
     636   
    610637    border: 1px solid #ddd;
    611638    -moz-border-radius: 0.5em;
     
    620647}
    621648
    622 #seqContent .displayStep {
     649.seqContent .displayStep {
    623650    /*height: 140px;*/
    624     width: 100px;
     651    width: 52px;
     652    padding: 0;
    625653    margin: 10px 0 0 0;
    626654    background-repeat: no-repeat;
     
    629657}
    630658
    631 #seqContent .displayStep p{
    632     margin-top: 105px;
     659.seqContent .displayStep .displayStepIcon {
     660    width: 50px;
     661    height: 50px;
     662    border: 2px solid #444444;
     663    color: #FFF;
     664    float: left;
     665}
     666
     667.seqContent .displayStep p{
     668    margin-top: 55px;
    633669    font-weight: normal;
    634670    font-size: 0.875em;
     671    float: left;
    635672   
    636673}
    637674
    638 #seqContent .divider {
     675.seqContent .divider {
    639676    width: 10px;
    640     height: 100px;
    641     margin: 10px 5px 0 10px;
     677    height: 50px;
     678    margin: 10px 15px 0 20px;
    642679    background-image: url('../images/ui/sequencerDivider.png');
    643680    float: left;
    644681}
    645682
     683
     684
     685
     686
     687
    646688/*
    647     Toolbox
     689 *
     690 *
     691 *  TOOLBOX
     692 *
     693 *
    648694*/
    649695
    650696#toolbox {
    651     width: 40%;
    652     float: left;
    653     background-image: url('../images/bg/sequencerBG.png');
     697    /*width: 40%;*/
     698    float: left;
     699    /*background-image: url('../images/bg/sequencerBG.png');*/
     700    background-image: linear-gradient(top, #B0B0B0 21%, #888888 80%);
     701    background-image: -o-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     702    background-image: -moz-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     703    background-image: -webkit-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     704    background-image: -ms-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     705
     706    background-image: -webkit-gradient(
     707        linear,
     708        left top,
     709        left bottom,
     710        color-stop(0.25, #B0B0B0),
     711        color-stop(0.8, #888888)
     712    );
     713   
    654714}
    655715
     
    659719    margin-top:0.5em;
    660720    margin-left: 1em;
    661     font-size: 1.2em;
     721    font-size: 1.25em;
    662722    color: #FFF;
    663723}
    664724
    665 #toolbox .displayStep {
    666     height: 140px;
    667     width: 100px;
    668     margin: 0 5px 0 5px;
    669     background-repeat: no-repeat;
    670     float: left;
    671     text-align: center;
    672 }
    673 
    674 #toolbox .displayStep p {
    675     margin-top: 105px;
    676     color: #FFF;
    677 }
     725#toolbox .creationButton {
     726    height: 50px;
     727    margin: 0 0 5px 0;
     728    border: 1px solid #000;
     729    border-radius: 5px;
     730    -moz-border-radius: 5px;
     731}
     732
     733#toolbox .creationButton:hover {
     734    border: 1px solid #FFF;
     735    background: rgba(255, 255, 255, 0.2);
     736}
     737
     738#toolbox .buttonIcon {
     739    margin: 0 10px 0 5px;
     740    float: left;
     741}
     742
     743#toolbox .creationButton p {
     744    margin: 15px 10px 0 0;
     745    color: #444;
     746    float: left;
     747}
  • Dev/trunk/pipelineEditor.php

    r142 r144  
    22require 'classes/master.php'; //should be at top of every page
    33
    4 /*
    5   if(isset($_SESSION['username'])){   //user is logged in
    6   //get pipeline contents from database, and store in displayObject() array "pipelineSteps"
    7   //nu nog even gewoon een hardcoded workaround
    8   foreach ()
    94
    10   }
    11  * */
     5$pipeline = $_SESSION['currentPipeline'];
    126
    13 // generate a random array of pipeline contents
    14 $displaySteps = array();    // array containing a number of random-generated stings "$type", to fill up the sequencer
    15 $numSteps = 9;              // number of steps to random-generate for testing purposes.
    16 $maxNumSteps = 9;           // maximum number of steps that can be displayed in the sequencer (without scrollbars, at current)
     7// generate a set array of pipeline contents, in lieue of working database interface
     8//if (isset($pipeline)){
     9//$pipeline = array(new Step("Questionnaire", "Questionnaire 1", 1), new Step("Dashboard", "Dashboard 1", 2), new Step("Application", "Application 1", 3));
     10//}
     11//else {
     12    $pipeline = $_SESSION['currentPipeline'];
     13//}
    1714
    18 for ($n = 1; $n <= $numSteps; $n++) {   // fill the array of types
    19     $rnd = rand(1, 4);
    20     switch ($rnd) {
    21         case 1:
    22             $type = "Dashboard";
    23             break;
    24         case 2:
    25             $type = "Questionnaire";
    26             break;
    27         case 3:
    28             $type = "Notice";
    29             break;
    30         case 4:
    31             $type = "Application";
    32             break;
    33         default:
    34             $type = "Questionnaire";
    35             break;
    36     }
    37     $displaySteps[] = $type;
     15if (isset($_POST['objectToCreate'])){
     16    $pipeline[] = new Step($_POST['objectToCreate'], $_POST['objectToCreate']." NEW", 4);
     17    unset($_POST);
    3818}
    3919
     20$_SESSION['currentPipeline'] = $pipeline;
     21
     22$pipelineCount = 3;
    4023$pipelineName = "Test pipeline";
     24
     25$dbi = new DatabaseInterface();       //mkdir error?!?!?!
    4126?>
    4227
     
    4631-->
    4732<!DOCTYPE html>
     33
    4834<html>
    4935    <head>
     
    5339        <script type="text/javascript" src="js/menu.js"></script>
    5440        <script type="text/javascript" src="js/jquery.jps"></script>
     41        <script type="text/javascript" src="js/editorScripts.js"></script>
    5542    </head>
    5643    <body>
    57         <div id="logo">
     44        <div id="header">
    5845            <?php new Logo(); ?>
    5946        </div>
     
    6148        <div id="wrapper">
    6249            <div id="content">
    63                 <form action="pipelineEditor.php" method="POST">
    64                    
    65                     <fieldset id="sequencer">
    66                        
    67                         <div class="title">Name: <?php echo $pipelineName; ?></div>
    68 
    69                         <div id="seqContent">
    70                             <?php
    71                             $n = 0;
    72                             foreach ($displaySteps as $displayStep) {
    73                                 if ($n <= $maxNumSteps) {
    74                                     $n++;
    75                                     new DisplayStep($displayStep, null, "Step " . $n);
    76                                     if ($n != $numSteps){
    77                                         echo "<div class='divider'></div>";
    78                                     }
    79                                 }
    80                             }
    81                             ?>                               
    82                         </div>
    83 
    84                         <div id="controls">
    85                             <input type="submit" name="moveSelectedLeft" value="< Move" class="surveyButton" />
    86                             <input type="submit" name="moveSelectedRight" value="Move >" class="surveyButton" />
    87                             <input type="submit" name="editSelected" value="Edit step" class="surveyButton" />
    88                             <input type="submit" name="deleteSelected" value="Delete step" class="surveyButton" />
    89                             <input type="hidden" name="selectedStep" />
    90                         </div>
    91 
    92                     </fieldset>
    93                    
    94                     <br />
    95                     <fieldset id="toolbox">
    96                         <div class="title">Toolbox</div>
    97                         <?php
    98                             new DisplayStep("Questionnaire", null, "Questionnaire");
    99                             new DisplayStep("Notice", null, "Notice");
    100                             new DisplayStep("Application", null, "Application");
    101                             new DisplayStep("Dashboard", null, "Dashboard");
    102                         ?>
    103                     </fieldset>
    104                 </form>
     50                <?php new pipelineSequencer($pipeline); ?>
     51                <?php new Toolbox(); ?>
    10552            </div>
    10653    </body>
  • Dev/trunk/register.php

    r65 r144  
    66        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    77        <title>Facilitator</title>
    8         <?php new StyleSheet(); ?>
     8        <?php new StyleSheet("awesome"); ?>
    99        <script type="text/javascript" src="js/menu.js"></script>
    1010    </head>
Note: See TracChangeset for help on using the changeset viewer.