Changeset 43e612a in iPeer


Ignore:
Timestamp:
2012-12-17T18:13:35-08:00 (6 years ago)
Author:
John Hsu <john.hsu@…>
Branches:
3.1.x, dev, hotfix, master, pagodabox, ticket463
Children:
af647d1
Parents:
682eaae
git-author:
John Hsu <john.hsu@…> (12/17/2012 05:20:00 PM)
git-committer:
John Hsu <john.hsu@…> (12/17/2012 06:13:35 PM)
Message:

Add/View/List? surveys now same as eval events.

You can now List/View/Add? surveys in the same way as
Simple/Rubric/Mixevals?. This was actually easier to do than creating a
whole separate facility to deal with surveys separately. Since the plan
was to ultimately have surveys behave the same way as all other events
anyways.

Editing surveys will be done in the next commit.

Note that the split between survey and survey template still needs to be
done on the template side, as the survey template creation is still
creating an entry in the event table.

Location:
app
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • app/config/sql/ipeer.sql

    r682eaae r43e612a  
    460460(1, 'SIMPLE', 'simple_evaluations', 'SimpleEvaluation', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    461461(2, 'RUBRIC', 'rubrics', 'Rubric', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    462 (3, 'SURVEY', 'surveys', '', 0, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
     462(3, 'SURVEY', 'surveys', '', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    463463(4, 'MIX EVALUATION', 'mixevals', 'Mixeval', 1, 'A', 0, '2006-04-03 11:51:02', 0, '2006-04-06 15:31:48');
    464464
     
    991991  `user_id` int(11) NOT NULL DEFAULT '1',
    992992  `name` varchar(255) NOT NULL,
     993  `availability` varchar(10) NOT NULL DEFAULT 'public',
    993994  `due_date` datetime DEFAULT NULL,
    994995  `release_date_begin` datetime DEFAULT NULL,
  • app/config/sql/ipeer_samples_data.sql

    r682eaae r43e612a  
    655655(1, 'SIMPLE', 'simple_evaluations', 'SimpleEvaluation', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    656656(2, 'RUBRIC', 'rubrics', 'Rubric', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    657 (3, 'SURVEY', 'surveys', '', 0, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
     657(3, 'SURVEY', 'surveys', '', 1, 'A', 0, '0000-00-00 00:00:00', NULL, NULL),
    658658(4, 'MIX EVALUATION', 'mixevals', 'Mixeval', 1, 'A', 0, '2006-04-03 11:51:02', 0, '2006-04-06 15:31:48');
    659659
     
    14711471  `user_id` int(11) NOT NULL DEFAULT '1',
    14721472  `name` varchar(255) NOT NULL,
     1473  `availability` varchar(10) NOT NULL DEFAULT 'public',
    14731474  `due_date` datetime DEFAULT NULL,
    14741475  `release_date_begin` datetime DEFAULT NULL,
  • app/controllers/events_controller.php

    r682eaae r43e612a  
    1313    public $name = 'Events';
    1414    public $helpers = array('Html', 'Ajax', 'Javascript', 'Time');
    15     public $uses = array('GroupEvent', 'User', 'Group', 'Course', 'Event', 'EventTemplateType', 'SimpleEvaluation', 'Rubric', 'Mixeval', 'Personalize', 'GroupsMembers', 'Penalty');
     15    public $uses = array('GroupEvent', 'User', 'Group', 'Course', 'Event', 'EventTemplateType', 'SimpleEvaluation', 'Rubric', 'Mixeval', 'Personalize', 'GroupsMembers', 'Penalty', 'Survey');
    1616    public $components = array("AjaxList", "Session");
    1717
     
    101101            array("!Custom.results",       __("View", true),       "4em", "action", "View Results"),
    102102            array("Event.event_template_type_id", __("Type", true), "", "map",
    103             array("1" => __("Simple", true), "2" => __("Rubric", true), "4" => __("Mixed", true))),
     103            array(
     104                "1" => __("Simple", true),
     105                "2" => __("Rubric", true),
     106                "3" => __("Survey", true),
     107                "4" => __("Mixed", true))),
    104108            array("Event.due_date",       __("Due Date", true),    "10em", "date"),
    105109            array("!Custom.isReleased",    __("Released ?", true), "8em", "string"),
     
    150154        }
    151155
    152         // Leave the survey types out, always
    153         $extraFilters .= !empty($extraFilters) ? "and " : "";
    154         $extraFilters .= "Event.event_template_type_id<>3";
    155 
    156 
    157156        // Set up actions
    158157        $warning = __("Are you sure you want to delete this event permanently?", true);
     
    181180     * @return void
    182181     */
    183     function index($courseId = null, $message = '')
     182    function index($courseId = null)
    184183    {
    185184        // check for permission to course ($courseId) only when $courseId is provided
     
    193192        }
    194193
    195         $this->set('message', $message);
    196 
    197194        // We need to change the session state to point to this
    198195        // course:
    199         // Initialize a basic non-funcional AjaxList
     196        // Initialize a basic non-functional AjaxList
    200197        $this->AjaxList->quickSetUp();
    201         // Clear the state first, we don't want any previous searches/selections.
     198        // Clear the state first, we don't want any previous searches/selections
    202199        $this->AjaxList->clearState();
    203200        // Set and update session state Variable
     
    214211    }
    215212
    216 
    217213    /**
    218214     * ajaxList
     
    245241            $this->redirect('index');
    246242            return;
    247         } else if ($event['Event']['event_template_type_id'] == '3') {
    248             // can't view survey event from this view
    249             $this->Session->setFlash(__('Invalid Id', true));
    250             $this->redirect('index');
    251243        }
    252244
     
    258250            $modelName = 'Rubric';
    259251            break;
     252        case 3:
     253            $modelName = 'Survey';
     254            break;
    260255        case 4:
    261256            $modelName = 'Mixeval';
     
    313308        );
    314309        $this->set(
     310            'surveys',
     311            $this->Survey->getBelongingOrPublic($this->Auth->user('id'))
     312        );
     313        $this->set(
    315314            'rubrics',
    316315            $this->Rubric->getBelongingOrPublic($this->Auth->user('id'))
  • app/views/events/add.ctp

    r682eaae r43e612a  
    1212echo $this->Form->input('Rubric',
    1313    array('div' => array('id' => 'RubricDiv'), 'label' => $html->link('Preview', '', array('id' => 'prevR', 'target' => '_blank'))));
     14echo $this->Form->input('Survey',
     15    array('div' => array('id' => 'SurveyDiv'), 'label' => $html->link('Preview', '', array('id' => 'prevV', 'target' => '_blank'))));
    1416echo $this->Form->input('Mixeval',
    1517    array('div' => array('id' => 'MixevalDiv'), 'label' => $html->link('Preview', '', array('id' => 'prevM', 'target' => '_blank'))));
     
    3537echo $this->Form->input('release_date_begin', array('label' => 'Evaluation Released From', 'type' => 'text'));
    3638echo $this->Form->input('release_date_end', array('label' => 'Until', 'type' => 'text'));
    37 echo $this->Form->input('result_release_date_begin', array('label' => 'Results Released From', 'type' => 'text', 'label' => 'Result Release Date'));
    38 echo $this->Form->input('result_release_date_end', array('label' => 'Until', 'type' => 'text'));
    39 echo $this->Form->input('Group', array('label' => 'Group(s)'));
     39echo $this->Form->input('result_release_date_begin',
     40    array('label' => 'Results Released From', 'type' => 'text'));
     41echo $this->Form->input('result_release_date_end',
     42    array('label' => 'Until', 'type' => 'text'));
     43echo $this->Form->input('Group',
     44    array('div' => array('id' => 'GroupsDiv'), 'label' => 'Group(s)'));
    4045
    4146// No nice way of inserting new penalty entries using CakePHP, doing it
    4247// manually.
     48echo "<div id='penaltyInputs'>";
    4349echo $this->Form->label(
    4450    'latep',
     
    4652    array('class' => 'penaltyLabel')
    4753);
    48 echo "<div id='penaltyInputs'>";
    4954// Keep track of the number of penalties entered. This is mostly for smart
    5055// 'resume' where the user encounters an error during form submit and we need
     
    8590
    8691}
    87 echo "</div>";
    8892echo '<a class="addPenaltyButton"
    8993    href="#" onclick="addPenaltyInputs(); return false;">Add Penalty</a>';
     94echo "</div>";
    9095
    9196echo $this->Form->submit();
     
    104109jQuery("#EventSimpleEvaluation").change(updatePreview);
    105110jQuery("#EventRubric").change(updatePreview);
     111jQuery("#EventSurvey").change(updatePreview);
    106112jQuery("#EventMixeval").change(updatePreview);
    107113// for redirecting to the add event view for the selected course
     
    148154        jQuery("#SimpleEvalDiv").show();
    149155        jQuery("#RubricDiv").hide();
     156        jQuery("#SurveyDiv").hide();
    150157        jQuery("#MixevalDiv").hide();
     158        jQuery("div.radio").show();
     159        jQuery("#penaltyInputs").show();
     160        jQuery("#GroupsDiv").show();
    151161        updatePreview();
    152162    }
     
    154164        jQuery("#SimpleEvalDiv").hide();
    155165        jQuery("#RubricDiv").show();
     166        jQuery("#SurveyDiv").hide();
    156167        jQuery("#MixevalDiv").hide();
     168        jQuery("div.radio").show();
     169        jQuery("#penaltyInputs").show();
     170        jQuery("#GroupsDiv").show();
     171        updatePreview();
     172    }
     173    else if (eventType == '3') {
     174        jQuery("#SimpleEvalDiv").hide();
     175        jQuery("#RubricDiv").hide();
     176        jQuery("#SurveyDiv").show();
     177        jQuery("#MixevalDiv").hide();
     178        jQuery("div.radio").hide(); // no self eval and comments in surveys
     179        jQuery("#penaltyInputs").hide(); // no penalty in surveys
     180        jQuery("#GroupsDiv").hide(); // no groups in surveys
    157181        updatePreview();
    158182    }
     
    160184        jQuery("#SimpleEvalDiv").hide();
    161185        jQuery("#RubricDiv").hide();
     186        jQuery("#SurveyDiv").hide();
    162187        jQuery("#MixevalDiv").show();
     188        jQuery("div.radio").show();
     189        jQuery("#penaltyInputs").show();
     190        jQuery("#GroupsDiv").show();
    163191        updatePreview();
    164192    }
     
    188216        prevR.href = url + eventIdToPrev;
    189217    }
     218    else if (eventType == '3') {
     219        var eventIdToPrev = jQuery("#EventSurvey").val();
     220        console.log("Id: " + eventIdToPrev);
     221        url = "<?php echo $this->base; ?>/surveys/view/";
     222        prevV.href = url + eventIdToPrev;
     223    }
    190224    else if (eventType == '4') {
    191225        var eventIdToPrev = jQuery("#EventMixeval").val();
  • app/views/events/index.ctp

    r682eaae r43e612a  
    1 <div class="content-container">
    2   <div class="button-row">
    3     <ul>
    4       <li>
    5         <?php echo ($courseId != null) ? $html->link(__('Add Event', true), '/events/add/'.$courseId, array('class' => 'add-button')) : ""; ?>
    6       </li>
    7     </ul>
    8   </div>
    9   <div>
    10     <?php echo $this->element("list/ajaxList", array ("paramsForList" =>$paramsForList)); ?>
    11   </div>
     1<div class="button-row">
     2<ul>
     3  <li>
     4    <?php echo ($courseId != null) ? $html->link(__('Add Event', true), '/events/add/'.$courseId, array('class' => 'add-button')) : ""; ?>
     5  </li>
     6</ul>
    127</div>
     8<div>
     9<?php echo $this->element("list/ajaxList", array ("paramsForList" =>$paramsForList)); ?>
     10</div>
  • app/views/events/view.ctp

    r682eaae r43e612a  
    55    <tr><th colspan="2">Evaluation Event</th></tr>
    66    <tr>
    7         <th><?php __('Course:')?></th>
     7        <th><?php __('Course')?></th>
    88        <td><?php echo $event['Course']['full_name']; ?>
    99        </td>
    1010    </tr>
    1111    <tr>
    12         <th><?php __('Event Title:')?></th>
     12        <th><?php __('Event Title')?></th>
    1313        <td><?php echo $event['Event']['title']; ?></td>
    1414    </tr>
    1515    <tr>
    16         <th><?php __('Description:')?></th>
     16        <th><?php __('Description')?></th>
    1717        <td><?php echo $event['Event']['description']; ?></td>
    1818    </tr>
    1919    <tr>
    20         <th valign="top"><?php __('Evaluation Format:')?></th>
     20        <th valign="top"><?php __('Evaluation Format')?></th>
    2121        <td>
    2222            <?php echo $event['EventTemplateType']['type_name'];?>
     
    2424    </tr>
    2525    <tr>
    26         <th valign="top"><?php __('Evaluation:')?></th>
     26        <th valign="top"><?php __('Evaluation')?></th>
    2727        <td>
    2828            <?php echo $html->link($event[$modelName]['name'], '/'.strtolower(Inflector::pluralize($modelName)).'/view/'.$event[$modelName]['id']);?>
     
    3030    </tr>
    3131    <tr>
    32         <th><?php __('Allow Self-Evaluation?:')?></th>
     32        <th><?php __('Allow Self-Evaluation?')?></th>
    3333        <td>
    3434            <?php echo $event['Event']['self_eval']==1? 'Enable' : 'Disable'; ?>
     
    3636    </tr>
    3737    <tr>
    38         <th><?php __('Require Student Comments?:')?></th>
     38        <th><?php __('Require Student Comments?')?></th>
    3939        <td><?php echo $event['Event']['com_req']==1? 'Yes' : 'No'; ?></td>
    4040    </tr>
    4141    <tr>
    42         <th><?php __('Due Date:')?>&nbsp;</th>
     42        <th><?php __('Due Date')?>&nbsp;</th>
    4343        <td><?php echo Toolkit::formatDate($event['Event']['due_date']) ?></td>
    4444    </tr>
    4545    <tr>
    46         <th><?php __('Evaluation Release Date: <font color="red">*</font>')?></th>
     46        <th><?php __('Evaluation Release Date')?></th>
    4747        <td id="release_date_begin">
    4848            <table width="100%">
     
    6363    </tr>
    6464    <tr>
    65         <th><?php __('Result Release Date: <font color="red">*</font>')?></th>
     65        <th><?php __('Result Release Date')?></th>
    6666        <td id="result_release_date_begin">
    6767            <table width="100%">
     
    8282    </tr>
    8383    <tr>
    84         <th><?php __('Late Penalty:')?></th>
     84        <th><?php __('Late Penalty')?></th>
    8585        <td>
    8686            <?php
     
    101101    </tr>
    102102    <tr>
    103         <th valign="top"><?php __('Groups Assignment:')?></th>
     103        <th valign="top"><?php __('Groups Assignment')?></th>
    104104        <td>
    105105        <?php
Note: See TracChangeset for help on using the changeset viewer.