From: Simon H. <sim...@us...> - 2010-09-30 16:56:59
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv28438/opaque/moodleModule/opaque/stack Modified Files: soapPage.php stackQuestionList.php stackLib.php stackDeploy.php stackAuthor.php Log Message: Merging 2.2 branch (with some additional fixes to ensure seamless updating for version lines) Index: stackDeploy.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackDeploy.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stackDeploy.php 3 Nov 2009 11:27:51 -0000 1.4 --- stackDeploy.php 30 Sep 2010 16:56:21 -0000 1.5 *************** *** 61,65 **** break; ! case get_string('stackDeploy_button_delete', 'qtype_opaque'): if(!isset($_POST['instances'])) break; foreach($_POST['instances'] as $iid => $on) { --- 61,65 ---- break; ! case get_string('stackDeploy_button_undeploy', 'qtype_opaque'): if(!isset($_POST['instances'])) break; foreach($_POST['instances'] as $iid => $on) { *************** *** 88,91 **** --- 88,98 ---- } + // handle version undeploy + if(!empty($_GET['dropall']) && is_numeric($_GET['dropall'])) { + $specs['id'] = $_GET['id']; + $specs['version'] = $_GET['dropall']; + stackUndeployVersion($SESSION->stackSelectedEngine, $specs); + } + // handle single primings if(!empty($_GET['prime']) && is_numeric($_GET['prime'])) { *************** *** 100,108 **** $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); $deployedList = $deployedPage->deployedInstances; $engineName = getEngineName($SESSION->stackSelectedEngine); ! $strtitle = get_string('instantiationsOf', 'qtype_opaque').$param['id'].' : '.$engineName.get_string('qEngine', 'qtype_opaque'); $navlinks = array(); $navlinks[] = array('name' => get_string('StackQuestions', 'qtype_opaque', ''), 'link' => 'stackQuestionList.php', 'type' => 'title'); --- 107,117 ---- $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); + //echo '<pre>'.print_r($deployedPage, 1); + $deployedList = $deployedPage->deployedInstances; $engineName = getEngineName($SESSION->stackSelectedEngine); ! $strtitle = get_string('instancesOf', 'qtype_opaque').$param['id'];//.' : '.$engineName.get_string('qEngine', 'qtype_opaque'); $navlinks = array(); $navlinks[] = array('name' => get_string('StackQuestions', 'qtype_opaque', ''), 'link' => 'stackQuestionList.php', 'type' => 'title'); *************** *** 114,121 **** print_heading($strtitle); echo "<form method='POST' action='?id=".$_GET['id']."'>"; echo $deployedPage->xhtml; // may include form fields //echo " <input type='checkbox' name='autoprime' checked='checked'> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); ! echo " <input type='checkbox' name='autoprime' ".(isset($_POST['autoprime'])?'checked="checked"':"")."> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); if($deployedList == NULL) --- 123,132 ---- print_heading($strtitle); + echo '<p>'.get_string('nodeployed', 'qtype_opaque').': '.count($deployedList); + echo "<form method='POST' action='?id=".$_GET['id']."'>"; echo $deployedPage->xhtml; // may include form fields //echo " <input type='checkbox' name='autoprime' checked='checked'> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); ! //echo " <input type='checkbox' name='autoprime' ".(isset($_POST['autoprime'])?'checked="checked"':"")."> ".get_string('stackDeploy_autoprime', 'qtype_opaque'); if($deployedList == NULL) *************** *** 146,159 **** '<a href="stackSessionPage.php?page=try&id='.$param['id'].'&instance='.$instance->id.'&seed='.$instance->seed.'" /><img alt="'.get_string('preview', 'qtype_opaque').'" title="'.get_string('preview', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/preview.gif" /></a> '. '<a href="stackDeploy.php?id='.$param['id'].'&prime='.$instance->id.'"><img alt="'.get_string('primed?', 'qtype_opaque').'" title="'.get_string('prime', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/go.gif" /></a> '. ! '<a onclick="return confirm(\''.get_string('confirmDeletion', 'qtype_opaque').'\')" href="stackDeploy.php?id='.$param['id'].'&drop='.$instance->id.'" ><img alt="'.get_string('delete', 'qtype_opaque').'" title="'.get_string('delete', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/delete.gif" /></a></td>'; $qID = 'q'.$instance->id; ! $previewBox = '<a href="javascript:;" onClick="$(\'#'.$qID.'\').slideToggle(\'fast\')" /><small>'.get_string('stackDeploy_showStem', 'qtype_opaque').'</small></a><div style="clear:both; border:#999 solid 1px; display:none; padding:10px" id="'.$qID.'">'.$instance->xhtml; echo '<td align="left">'.format_text($instance->qNote.$previewBox.'</div>', FORMAT_MOODLE, $opts).'</td>'; ! echo '<td>'.($instance->isPrimed ? '<img alt="'.get_string('primed', 'qtype_opaque').'." src="'.$CFG->wwwroot.'/pix/i/tick_green_small.gif" />':'').'</td>'; echo '</tr>'; } echo '</tbody></table>'; echo '<a href="javascript:;" onclick="$(\'.groupCB\').click()">'.get_string('invertSelection', 'qtype_opaque').'</a><br /><b>'.get_string('withSelected', 'qtype_opaque').':</b>'; ! echo '<input type="submit" value="'.get_string('stackDeploy_button_delete', 'qtype_opaque').'" name="submit" onclick="return confirm(\''.get_string('confirmDeletion','qtype_opaque').'\')" />'; echo '<input type="submit" value="'.get_string('stackDeploy_button_prime', 'qtype_opaque').'" name="submit" />'; echo '</form>'; --- 157,170 ---- '<a href="stackSessionPage.php?page=try&id='.$param['id'].'&instance='.$instance->id.'&seed='.$instance->seed.'" /><img alt="'.get_string('preview', 'qtype_opaque').'" title="'.get_string('preview', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/preview.gif" /></a> '. '<a href="stackDeploy.php?id='.$param['id'].'&prime='.$instance->id.'"><img alt="'.get_string('primed?', 'qtype_opaque').'" title="'.get_string('prime', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/go.gif" /></a> '. ! '<a onclick="return confirm(\''.get_string('confirmUndeploy', 'qtype_opaque').'\')" href="stackDeploy.php?id='.$param['id'].'&drop='.$instance->id.'" ><img alt="'.get_string('undeploy', 'qtype_opaque').'" title="'.get_string('undeploy', 'qtype_opaque').'" src="'.$CFG->wwwroot.'/pix/t/delete.gif" /></a></td>'; $qID = 'q'.$instance->id; ! $previewBox = ' <a href="javascript:;" onClick="$(\'#'.$qID.'\').slideToggle(\'fast\')" /><small>'.get_string('stackDeploy_showStem', 'qtype_opaque').'</small></a><div style="clear:both; border:#999 solid 1px; display:none; padding:10px" id="'.$qID.'">'.$instance->xhtml; echo '<td align="left">'.format_text($instance->qNote.$previewBox.'</div>', FORMAT_MOODLE, $opts).'</td>'; ! echo '<td align="center">'.($instance->isPrimed ? '<img alt="'.get_string('primed', 'qtype_opaque').'." src="'.$CFG->wwwroot.'/pix/i/tick_green_small.gif" />':'').'</td>'; echo '</tr>'; } echo '</tbody></table>'; echo '<a href="javascript:;" onclick="$(\'.groupCB\').click()">'.get_string('invertSelection', 'qtype_opaque').'</a><br /><b>'.get_string('withSelected', 'qtype_opaque').':</b>'; ! echo '<input type="submit" value="'.get_string('stackDeploy_button_undeploy', 'qtype_opaque').'" name="submit" Xonclick="return confirm(\''.get_string('confirmUndeploy','qtype_opaque').'\')" />'; echo '<input type="submit" value="'.get_string('stackDeploy_button_prime', 'qtype_opaque').'" name="submit" />'; echo '</form>'; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackAuthor.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stackAuthor.php 14 Jan 2010 14:31:12 -0000 1.15 --- stackAuthor.php 30 Sep 2010 16:56:21 -0000 1.16 *************** *** 110,113 **** --- 110,114 ---- $clean = stripslashes($post); $posted[$key] = $clean; + $posted[$key] = get_magic_quotes_gpc() ? $post : stripslashes($post); } } *************** *** 164,183 **** //echo '<input type="submit" name="submit" value="Update" /> <input type="submit" name="submit" value="Save" /> <input type="submit" name="submit" value="Save as New" /> <input type="submit" name="submit" value="Export as XML" />'; echo '<div id="authoringControls">'; ! print_heading($strtitle); echo '<input type="submit" name="submit" value="'.get_string('stackAuthor_button_update','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_save','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_savenew','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_exportAsXml','qtype_opaque').'" />'; ?> ! <a href="#stem">Stem</a> ! <br /><a href="#parts" onClick="$('#partContainer').slideDown();">Interactions</a> ! <br /><a href="#prts" onClick="$('#prtContainer').slideDown();">Responses</a> ! <br /><a href="#options" onClick="$('#optionContainer').slideDown();">Options</a> ! <br /><a href="#tests" onClick="$('#testContainer').slideDown();">Tests</a> ! <br /><a href="#meta" onClick="$('#metaContainer').slideDown();">Meta</a> <?php echo '<p><small>'.get_string('stackAuthor_finish_reminder','qtype_opaque').'</small></p>'; echo '</div>'; - - - //echo '<hr>'; - //var_dump($_POST); } --- 165,183 ---- //echo '<input type="submit" name="submit" value="Update" /> <input type="submit" name="submit" value="Save" /> <input type="submit" name="submit" value="Save as New" /> <input type="submit" name="submit" value="Export as XML" />'; echo '<div id="authoringControls">'; ! //echo ! //print_heading($strtitle); echo '<input type="submit" name="submit" value="'.get_string('stackAuthor_button_update','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_save','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_savenew','qtype_opaque').'" /> <input type="submit" name="submit" value="'.get_string('stackAuthor_button_exportAsXml','qtype_opaque').'" />'; ?> ! <ul> ! <li><a href="#stem">Stem</a></li> ! <li><a href="#parts" onClick="$('#partContainer').slideDown();">Interactions</a></li> ! <li><a href="#prts" onClick="$('#prtContainer').slideDown();">Responses</a></li> ! <li><a href="#options" onClick="$('#optionContainer').slideDown();">Options</a></li> ! <li><a href="#tests" onClick="$('#testContainer').slideDown();">Tests</a></li> ! <li><a href="#meta" onClick="$('#metaContainer').slideDown();">Meta</a></li> ! </ul> <?php echo '<p><small>'.get_string('stackAuthor_finish_reminder','qtype_opaque').'</small></p>'; echo '</div>'; } *************** *** 185,188 **** --- 185,201 ---- echo '</form>'; + // bit of an optional hack to improve UI while keeping things SOAP page simple + ?> + <script language="JavaScript" type="text/javascript"> + $(document).ready(function() { + console.log($('#versionHistory').children('br').length); + // $('#authoringControls').append($('#versionHistory').detach().html()); // move + $('#authoringControls').append($('#versionHistory').html()); // copy + // would like to limit side to last n items since it is fixed and so doesn't scroll + + }); + </script> + + <?php print_box_end(); Index: stackQuestionList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackQuestionList.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** stackQuestionList.php 5 Feb 2010 15:52:08 -0000 1.42 --- stackQuestionList.php 30 Sep 2010 16:56:21 -0000 1.43 *************** *** 57,84 **** print_header_simple($strtitle, '', $strtitle, '', $questionPage->head); print_box_start(); ! print_heading($strtitle); ! ! ! /*echo '<pre>'; ! var_dump($questionPage); ! echo '</pre>';*/ //$url = getStackURL($SESSION->stackSelectedEngine); $docsUrl = 'http://stack.bham.ac.uk/wiki/index.php/Main_Page'; ! echo '<div class="section80"> ! <h3 class="section">'.get_string('addquestion', 'qtype_opaque').'</h3> ! <ul class="horizontal"> ! ! <li><a href="stackAuthor.php?id=new">'.get_string('newQ', 'qtype_opaque').'</a></li> ! <li><a href="soapPage.php?page=import">'.get_string('import', 'qtype_opaque').'</a></li> ! <li><a href="soapPage.php?page=chat">'.get_string('chat', 'qtype_opaque').'</a></li> ! <li><a href="soapPage.php?page=search">'.get_string('search', 'qtype_opaque').'</a></li> ! <li><a href="stackSessionPage.php?page=report">'.get_string('reports', 'qtype_opaque').'</a></li> ! <!--<li><a href="soapPage.php?page=optionsEditor">'.get_string('stackOptions', 'qtype_opaque').'</a></li>--> ! <li><a href="'.$docsUrl.'">Stack Documentation</a></li> ! ! </ul> ! </div>'; $questionList = $questionPage->questionItems; --- 57,72 ---- print_header_simple($strtitle, '', $strtitle, '', $questionPage->head); print_box_start(); ! //print_heading($strtitle); //$url = getStackURL($SESSION->stackSelectedEngine); $docsUrl = 'http://stack.bham.ac.uk/wiki/index.php/Main_Page'; ! echo '<a href="stackAuthor.php?id=new">'.get_string('newQ', 'qtype_opaque').'</a> | ! <a href="soapPage.php?page=import">'.get_string('import', 'qtype_opaque').'</a> | ! <a href="soapPage.php?page=chat">'.get_string('chat', 'qtype_opaque').'</a> | ! <a href="soapPage.php?page=search">'.get_string('search', 'qtype_opaque').'</a> | ! <a href="stackSessionPage.php?page=report">'.get_string('reports', 'qtype_opaque').'</a> | ! <!--<li><a href="soapPage.php?page=optionsEditor">'.get_string('stackOptions', 'qtype_opaque').'</a>--> ! <a href="'.$docsUrl.'">Stack Documentation</a>'; $questionList = $questionPage->questionItems; *************** *** 198,219 **** echo '<table style="text-align: left; width: 100%;" border="0" cellpadding="4px" cellspacing="0"> <tbody> ! <tr><td>'; ! //$this->add_checkbox_controller(1, null, null, 1); ?> <input type="checkbox" onclick="c=this.checked;$('.groupingCheckbox').each(function() {this.checked = c})"> <?php ! echo '</td>'; ! ! /*echo '<pre>'; ! var_dump($questionList); ! echo '</pre>';*/ ! $tableHeadings['id'] = '<th class="header"><a href="stackQuestionList.php?sortBy=id&sortOrder=dec">'.get_string('id', 'qtype_opaque').'</a></th>'; ! $tableHeadings['name'] = '<th class="header"><a href="stackQuestionList.php?sortBy=name&sortOrder=asc">'.get_string('name', 'qtype_opaque').'</a></th>'; ! //$tableHeadings['name'] = '<th class="header"><a href="stackQuestionList.php?sortBy=name&sortOrder=asc">'.get_string('name', 'qtype_opaque').'</a>: '.get_string('keywords', 'qtype_opaque').'</th>'; ! $tableHeadings['keywords'] = '<th class="header">'.get_string('keywords', 'qtype_opaque').'</th>'; ! $tableHeadings['description'] = '<th class="header"><a href="stackQuestionList.php?sortBy=description&sortOrder=asc">'.get_string('description', 'qtype_opaque').'</a></th>'; ! $tableHeadings['valid'] = '<th class="header"><a href="stackQuestionList.php?sortBy=valid&sortOrder=asc">'.get_string('valid', 'qtype_opaque').'</a></th>'; ! $tableHeadings['nodeployed'] = '<th class="header" nowrap><a href="stackQuestionList.php?sortBy=nodeployed&sortOrder=asc">'.get_string('nodeployed', 'qtype_opaque').'</a></th>'; $tableHeadings['published'] = '<th class="header"><a href="stackQuestionList.php?sortBy=published&sortOrder=asc">'.get_string('published', 'qtype_opaque').'</a></th>'; $tableHeadings['dateEdited'] = '<th class="header"><a href="stackQuestionList.php?sortBy=dateEdited&sortOrder=asc">'.get_string('dateEdited', 'qtype_opaque').'</a></th>'; --- 186,198 ---- echo '<table style="text-align: left; width: 100%;" border="0" cellpadding="4px" cellspacing="0"> <tbody> ! <tr><th class="header">'; ?> <input type="checkbox" onclick="c=this.checked;$('.groupingCheckbox').each(function() {this.checked = c})"> <?php ! echo '</th>'; ! $tableHeadings['name'] = '<th class="header"><a href="stackQuestionList.php?sortBy=name&sortOrder=asc">'.get_string('name', 'qtype_opaque').'</a>: <span style="font-weight: normal">'.get_string('description', 'qtype_opaque').' <small>'.get_string('keywords', 'qtype_opaque').'</small></span></th>'; ! $tableHeadings['valid'] = '<th class="header"><a href="stackQuestionList.php?sortBy=valid&sortOrder=asc">'.get_string('valid', 'qtype_opaque').'</a></th>'; ! $tableHeadings['nodeployed'] = '<th class="header" nowrap><a href="stackQuestionList.php?sortBy=nodeployed&sortOrder=asc"><abbr title="'.get_string('nodeployed', 'qtype_opaque').'">#</abbr></a></th>'; $tableHeadings['published'] = '<th class="header"><a href="stackQuestionList.php?sortBy=published&sortOrder=asc">'.get_string('published', 'qtype_opaque').'</a></th>'; $tableHeadings['dateEdited'] = '<th class="header"><a href="stackQuestionList.php?sortBy=dateEdited&sortOrder=asc">'.get_string('dateEdited', 'qtype_opaque').'</a></th>'; *************** *** 256,263 **** echo '<td><input type="checkbox" class="groupingCheckbox" name="'.$questionList[$i]->id.'" value="selected" /></td>'; ! echo '<td>'.$questionList[$i]->id.'</td> ! <td>'.$questionList[$i]->name.'</td>'; ! echo '<td>'; ! if(!empty($questionList[$i]->keywords)) { $keywords = $questionList[$i]->keywords; asort($keywords); --- 235,242 ---- echo '<td><input type="checkbox" class="groupingCheckbox" name="'.$questionList[$i]->id.'" value="selected" /></td>'; ! //echo '<td>'.$questionList[$i]->id.'.'.$questionList[$i]->version.'</td>'; ! echo '<td><b>'.$questionList[$i]->name.'</b>: '.format_text($questionList[$i]->description, FORMAT_MOODLE, $opts); ! if(!empty($questionList[$i]->keywords)) { ! echo '<br /><small>'; $keywords = $questionList[$i]->keywords; asort($keywords); *************** *** 269,277 **** $kwLink = "<a href='?keywords=$keyword'>".$keyword."</a>"; echo $kwLink; - //echo $_GET['keywords'] == $keyword ? '<b>'.$kwLink.'</b>': $kwLink; } } ! echo '</td>' . ! '<td>'.format_text($questionList[$i]->description, FORMAT_MOODLE, $opts).'</td>'; echo '<td align="center">'; --- 248,255 ---- $kwLink = "<a href='?keywords=$keyword'>".$keyword."</a>"; echo $kwLink; } + echo '</small>'; } ! echo '</td>'; echo '<td align="center">'; *************** *** 339,343 **** <tbody> <tr> - <td>'.get_string('id', 'qtype_opaque').'</td> <td>'.get_string('name', 'qtype_opaque').'</td> <td>'.get_string('description', 'qtype_opaque').'</td> --- 317,320 ---- *************** *** 354,359 **** else echo '<tr class="odd">'; ! echo '<td>'.$questionList[$i]->id.'</td> ! <td>'.$questionList[$i]->name.'</td> <td>'.$questionList[$i]->description.'</td>'; --- 331,336 ---- else echo '<tr class="odd">'; ! //echo '<td>'.$questionList[$i]->id.'</td> ! echo '<td>'.$questionList[$i]->name.'</td> <td>'.$questionList[$i]->description.'</td>'; Index: soapPage.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/soapPage.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** soapPage.php 23 Jun 2009 16:18:28 -0000 1.14 --- soapPage.php 30 Sep 2010 16:56:21 -0000 1.15 *************** *** 33,37 **** redirect('stackEngineSelector.php?return=soapPage.php?page='.$param['page']); } ! if($pageRequest != 'chat') //caschat pages don't need permissions { --- 33,37 ---- redirect('stackEngineSelector.php?return=soapPage.php?page='.$param['page']); } ! if($pageRequest != 'chat' && $pageRequest != 'diagnostic') //caschat/diagnostic pages don't need permissions { Index: stackLib.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackLib.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** stackLib.php 14 Jan 2010 14:31:12 -0000 1.19 --- stackLib.php 30 Sep 2010 16:56:21 -0000 1.20 *************** *** 310,313 **** --- 310,317 ---- $values[] = $USER->id; } + + $keys[] = 'engineID'; + $values[] = $engineID; + $passkey = stackGetPassKey($engineID, $USER->id); *************** *** 319,323 **** /** ! * Drops an instance (or version) of a question given its cache ID. * * @param int engineID --- 323,327 ---- /** ! * Drops an instance of a question given its cache ID. * * @param int engineID *************** *** 359,362 **** --- 363,409 ---- /** + * Undeploys a question version. + * + * @param int engineID + * @param int id + */ + function stackUndeployVersion($engineID, $param) + { + $engine = load_engine_def($engineID); + if(is_string($engine)) + { + echo $engine; //error occured. + } + else + { + $connection = connect_to_engine($engine); + if (is_string($connection)) + { + echo $connection; + } + + global $USER; + $keys[] = 'userID'; + $values[] = $USER->id; + + $keys[] = 'id'; + $values[] = $param['id']; + + $passkey = stackGetPassKey($engineID, $USER->id); + + $keys[] = 'operation'; + $values[] = 'undeploy'; + + $keys[] = 'version'; + $values[] = $param['version']; + + $keys[] = 'engine'; + $values[] = $engineID; + + echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); + } + } + + /** * Adds an instance (or version) of a question. * |