Update of /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/opaque/moodleModule/opaque/stack Modified Files: Tag: question_reporting soapPage.php stackAuthor.php stackLib.php stackDeploy.php stackQuestionList.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackAuthor.php,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -C2 -d -r1.13 -r1.13.4.1 *** stackAuthor.php 26 Jun 2009 17:03:41 -0000 1.13 --- stackAuthor.php 22 Nov 2010 23:05:52 -0000 1.13.4.1 *************** *** 110,113 **** --- 110,114 ---- $clean = stripslashes($post); $posted[$key] = $clean; + $posted[$key] = get_magic_quotes_gpc() ? $post : stripslashes($post); } } *************** *** 135,139 **** else { - $engineName = getEngineName($SESSION->stackSelectedEngine); $strtitle = get_string('authorEngine', 'qtype_opaque').$engineName; --- 136,139 ---- *************** *** 153,178 **** print_box_start(); ! print_heading($strtitle); ! ! if($soapPage->form == true) { echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; } ! //echo '<input type="text" name="texttest" />'; - - echo $soapPage->XHTML; - if($soapPage->form == true) { //echo '<input type="hidden" name="pageRequested" value="'.$pageRequest.'" />'; //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 '<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').'" />'; ! echo '</form>'; ! //echo '<hr>'; ! //var_dump($_POST); } print_box_end(); --- 153,201 ---- print_box_start(); ! if($soapPage->form == true) { echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; } ! //print_heading($strtitle); //echo '<input type="text" name="texttest" />'; if($soapPage->form == true) { //echo '<input type="hidden" name="pageRequested" value="'.$pageRequest.'" />'; //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>'; } + echo $soapPage->XHTML; + 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(); *************** *** 186,188 **** } ! ?> --- 209,211 ---- } ! ?> \ No newline at end of file Index: stackDeploy.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackDeploy.php,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** stackDeploy.php 23 Jun 2009 16:18:28 -0000 1.2 --- stackDeploy.php 22 Nov 2010 23:05:52 -0000 1.2.4.1 *************** *** 21,29 **** require_once($CFG->libdir . '/formslib.php'); require_once($CFG->libdir . '/datalib.php'); require_once(dirname(__FILE__) . '/../locallib.php'); ! require_once('stackLib.php'); require_once('../../../editlib.php'); - // Check the user is logged in. require_login(); --- 21,29 ---- require_once($CFG->libdir . '/formslib.php'); require_once($CFG->libdir . '/datalib.php'); + require_once(dirname(__FILE__) . '/../locallib.php'); ! //require_once('stackLib.php'); require_once('../../../editlib.php'); // Check the user is logged in. require_login(); *************** *** 46,78 **** redirect('stackEngineSelector.php'); } ! $param = $_POST + $_GET; ! // handle drops ! if(!empty($param['drop']) && is_numeric($param['drop'])) { ! $dropSpecs['id'] = $param['id']; ! $dropSpecs['instance'] = $param['drop']; ! stackDropinstance($SESSION->stackSelectedEngine, $dropSpecs); ! //echo "trying to drop instance".$param['drop']; } ! // handle adds ! if(!empty($param['add']) && is_numeric($param['add'])) { ! // addSpecs contains details of instances to add. Initially random but may be systematic later. ! $addSpecs['id'] = $param['id']; ! $addSpecs['number'] = $param['add']; ! stackAddInstances($SESSION->stackSelectedEngine, $addSpecs); ! //echo "trying to add instance".$param['add']; } ! $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); $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'); ! $navlinks[] = array('name' => $strtitle, 'link' => '', 'type' => 'title'); ! $navigation = build_navigation($navlinks); print_header_simple($strtitle, '', $navigation, '', $deployedPage->head); --- 46,141 ---- redirect('stackEngineSelector.php'); } + //*/ + //print_r($_POST); + //print_r($USER); + //exit(); + if(!empty($_POST['submit'])) { ! switch($_POST['submit']) { ! case 'add': // String from Deployment.php - TODO. ! if(!is_numeric($_POST['add'])) break; ! $specs['id'] = $_GET['id']; ! $specs['number'] = $_POST['add']; ! $specs['autoprime'] = isset($_POST['autoprime'])? 1 : 0; ! stackAddInstances($SESSION->stackSelectedEngine, $specs); ! break; ! ! case get_string('stackDeploy_button_undeploy', 'qtype_opaque'): ! if(!isset($_POST['instances'])) break; ! foreach($_POST['instances'] as $iid => $on) { ! $specs['id'] = $_GET['id']; // not sure this is needed but, hey. ! $specs['instance'] = $iid; ! stackDropInstance($SESSION->stackSelectedEngine, $specs); ! } ! break; ! ! case get_string('stackDeploy_button_prime', 'qtype_opaque'): ! if(!isset($_POST['instances'])) break; ! foreach($_POST['instances'] as $iid => $on) { ! $specs['id'] = $_GET['id']; // not sure this is needed but, hey. ! $specs['instance'] = $iid; ! stackPrimeInstance($SESSION->stackSelectedEngine, $specs); ! } ! break; ! ! case get_string('stackDeploy_button_update', 'qtype_opaque'): ! if(!is_numeric($_POST['prior'])) break; ! $specs['id'] = $_GET['id']; // not sure this is needed but, hey. ! $specs['prior'] = $_POST['prior']; ! $specs['number'] = $_POST['add']; ! $specs['category'] = $_POST['category']; ! $specs['operation'] = 'update'; ! //print_r($specs); ! stackUpdateDeployment($SESSION->stackSelectedEngine, $specs); ! break; ! ! case get_string('stackDeploy_button_moveTo', 'qtype_opaque'): ! $specs['id'] = $_GET['id']; // not sure this is needed but, hey. ! $specs['category'] = $_POST['category']; ! $specs['operation'] = 'move'; ! //print_r($specs); ! stackMoveDeployment($SESSION->stackSelectedEngine, $specs); ! break; ! } } ! // handle single deletions ! if(!empty($_GET['drop']) && is_numeric($_GET['drop'])) { ! $specs['id'] = $_GET['id']; ! $specs['instance'] = $_GET['drop']; ! stackDropinstance($SESSION->stackSelectedEngine, $specs); } ! // 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'])) { ! $specs['id'] = $_GET['id']; ! $specs['instance'] = $_GET['prime']; ! stackPrimeInstance($SESSION->stackSelectedEngine, $specs); ! } ! ! unset($_POST['instances']); // handled above since can't easily pass an array over Opaque. ! $param = $_POST + $_GET; ! ! $deployedPage = stackDeployedList($SESSION->stackSelectedEngine, $param); // problem here ! ! //echo '<pre>'.print_r($deployedPage, 1); ! ! $deployedList = $deployedPage->deployedInstances; $engineName = getEngineName($SESSION->stackSelectedEngine); ! $strtitle = get_string('deployingQuestion', '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'); ! $navlinks[] = array('name' => $strtitle, 'link' => '', 'type' => 'title'); ! $navigation = build_navigation($navlinks); print_header_simple($strtitle, '', $navigation, '', $deployedPage->head); *************** *** 80,111 **** print_heading($strtitle); ! echo $deployedPage->xhtml; - $deployedList = $deployedPage->deployedInstances; if($deployedList == NULL) { ! echo get_string('noInstances', 'qtype_opaque'); } else { $opts = new stdClass; $opts->noclean = true; ! echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; ! echo '<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="0"> <tbody>'; ! echo '<tr><th>question note</th><th>Operations</th></tr>'; foreach($deployedList as $instance) { ! echo '<tr> ! <td>'.format_text($instance->qNote, FORMAT_MOODLE, $opts).'</td> ! <td>' . ! '<a href="stackDeploy.php?id='.$param['id'].'&drop='.$instance->id.'" >Drop</a> ' . ! '<a href="stackSessionPage.php?page=try&id='.$param['id'].'&instance='.$instance->id.'&seed='.$instance->seed.'" />Try</a></td> ! </tr>'; } echo '</tbody></table>'; echo '</form>'; } --- 143,196 ---- print_heading($strtitle); + echo "<form method='POST' action='?id=".$_GET['id']."'>"; + echo "<div class='mdl-align'>".$deployedPage->xhtml."</div>"; // 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) { ! // nothing required: ! echo '<p class="mdl-align">'.get_string('noInstances', 'qtype_opaque').'</p>'; } else { + echo '<p>'.get_string('nodeployed', 'qtype_opaque').': '.count($deployedList); + $opts = new stdClass; $opts->noclean = true; + $opts->para = false; ! // form starts with $deployedPage->xhtml (!) echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; ! echo '<table style="text-align: left;" width="100%" border="0" cellpadding="5" cellspacing="0"> <tbody>'; ! echo '<tr>'; ! echo '<th class="header"><input type="checkbox" onclick="c=this.checked;$(\'.groupCB\').each(function() {this.checked = c})"></th>'; ! echo '<th align="center" class="header">'.get_string('actions', 'qtype_opaque').'</th>'; ! echo '<th class="header">'.get_string('qNote', 'qtype_opaque').'</th>'; ! //echo '<th align="center" class="header">'.get_string('stackDeploy_primed?', 'qtype_opaque').'</th>'; ! echo '</tr>'; ! $i = 0; foreach($deployedList as $instance) { ! if($i++ % 2 == 0) echo '<tr class="even">'; ! else echo '<tr class="odd">'; ! ! echo '<td><input type="checkbox" name="instances['.$instance->id.']" class="groupCB"></td>'; ! echo '<td align="center">' . ! '<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: stackQuestionList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/stackQuestionList.php,v retrieving revision 1.33 retrieving revision 1.33.2.1 diff -C2 -d -r1.33 -r1.33.2.1 *** stackQuestionList.php 22 Oct 2009 17:37:56 -0000 1.33 --- stackQuestionList.php 22 Nov 2010 23:05:52 -0000 1.33.2.1 *************** *** 13,16 **** --- 13,17 ---- * * @author Jonathan Hart (j.p...@bh...) + * @author Simon Hammond (s.h...@bh...) * @copyright © 2007 University of Birmingham * @license http://www.gnu.org/copyleft/gpl.html GNU Public License *************** *** 49,52 **** --- 50,54 ---- $questionPage = stackQuestionList($SESSION->stackSelectedEngine, $param); + //echo "<pre>".print_r($questionPage, 1)."</pre>"; $engineName = getEngineName($SESSION->stackSelectedEngine); *************** *** 55,82 **** 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; *************** *** 90,105 **** } ! if($questionList == NULL && !isset($_POST['filter'])) ! { echo '<h3>'.get_string('myQuestions','qtype_opaque').'</h3>'; echo ''.get_string('noQuestions', 'qtype_opaque').''; } ! else ! { echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; /*echo '<pre>'; var_dump($questionList); ! echo '</pre>';*/ // Filter echo "<p>".count($questionList).' '.get_string('question(s)', 'qtype_opaque')." <input type='text' id='filter' name='filter' value='". --- 80,171 ---- } ! if($questionList == NULL && !isset($_POST['filter'])) { echo '<h3>'.get_string('myQuestions','qtype_opaque').'</h3>'; echo ''.get_string('noQuestions', 'qtype_opaque').''; } ! ! else { ! // tot up keywords ! $kwFreq = array(); ! if(!empty($questionList)) { ! foreach($questionList as $q) { ! if(!empty($q->keywords)) { ! foreach($q->keywords as $kw) { ! if(!isset($kwFreq[$kw])) $kwFreq[$kw] = 1; ! else $kwFreq[$kw]++; ! } ! } ! } ! } ! ! ksort($kwFreq); // sort keywords alphanumerically but still case-sensitive ! $kws = array_keys($kwFreq); ! echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; /*echo '<pre>'; var_dump($questionList); ! echo '</pre>';//*/ ! ! if(!empty($questionPage->keywords)) { ! // List ALL used keywords ! echo get_string('keywords', 'qtype_opaque').": <a href='stackQuestionList.php'>" . ! (isset($_GET['keywords'])?'*':'<b>*</b>') . ! "</a>, "; ! $firstKeyword = true; ! //foreach($kwFreq as $kw => $freq) { ! $i = 1; ! foreach($questionPage->keywords as $kw) { ! if(!$firstKeyword) { ! echo ', '; ! } else $firstKeyword = false; ! $kwLink = "<a href='?keywords=$kw'>$kw</a>"; ! echo isset($_GET['keywords']) && in_array($kw, $kws) ? "<b>$kwLink</b>": $kwLink; ! if($i++ == 50) { ! echo "<span onmouseover='$(this).hide();$(this).next().show()'>, <b>more...</b></span></a><span style='display:none' class='moreTags'>"; ! } ! } ! if(!$firstKeyword) echo '.'; ! ! if($i > 50) echo "</span>";// closing moretags ! ! if (count($kwFreq) > 0) { ! // keywords associated with given keyword ! if(isset($_GET['keywords'])) { ! echo "<p>".get_string('keywordsRelatedTo', 'qtype_opaque')." <b>".$_GET['keywords']."</b>: "; ! ! $firstKeyword = true; ! foreach($kwFreq as $kw => $freq) { ! //foreach($questionPage->keywords as $kw) { ! if(!$firstKeyword && $_GET['keywords'] != $kw) { ! echo ', '; ! } else $firstKeyword = false; ! ! $kwLink = "<a title='$freq' href='?keywords=$kw'>$kw</a>"; ! //$kwLink = "<a href='?keywords=$kw'>$kw</a>"; ! echo $_GET['keywords'] == $kw ? '': $kwLink; ! } ! if(!$firstKeyword) echo '.'; ! } else if (!empty($kwFreq)) { ! // most common keywords ! arsort($kwFreq); ! $toShow = 10; ! echo "<p>".get_string('mostCommonKeywords', 'qtype_opaque').": "; ! $firstKeyword = true; ! foreach($kwFreq as $kw => $freq) { ! //foreach($questionPage->keywords as $kw) { ! if(!$firstKeyword) { ! echo ', '; ! } else $firstKeyword = false; + $kwLink = "<a title='$freq' href='?keywords=$kw'>$kw</a>"; + echo $kwLink; + $toShow--; + if($toShow <= 0) break; + } + if(!$firstKeyword) echo '.'; + } + } + } + //*/ // Filter echo "<p>".count($questionList).' '.get_string('question(s)', 'qtype_opaque')." <input type='text' id='filter' name='filter' value='". *************** *** 108,124 **** (isset($_POST['casesensitive'])?"checked='checked'":'')."> ".get_string('caseSensitive', 'qtype_opaque')."<p>"; echo '<table style="text-align: left; width: 100%;" border="0" cellpadding="4px" cellspacing="0"> <tbody> ! <tr><td></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['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>'; --- 174,204 ---- (isset($_POST['casesensitive'])?"checked='checked'":'')."> ".get_string('caseSensitive', 'qtype_opaque')."<p>"; + // keywords associate with given filter + if(isset($_POST['filter']) && !empty($_POST['filter'])) { + echo "<p>".get_string('keywordsRelatedTo', 'qtype_opaque')." '".$_POST['filter']."': "; + + $firstKeyword = true; + foreach($kwFreq as $kw => $freq) { + //foreach($questionPage->keywords as $kw) { + if(!$firstKeyword) { + echo ', '; + } else $firstKeyword = false; + + echo "<a title='$freq' href='?keywords=$kw'>$kw</a>"; + } + if(!$firstKeyword) echo '.'; + } + 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>'; *************** *** 153,156 **** --- 233,237 ---- $opts = new stdClass; $opts->noclean = true; + $opts->para = false; for($i=0; $i < count($questionList); $i++) *************** *** 160,167 **** 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>' . ! '<td>'.$questionList[$i]->description.'</td>'; ! //'<td>'.format_text($questionList[$i]->description, FORMAT_MOODLE, $opts).'</td>'; echo '<td align="center">'; --- 241,261 ---- 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); ! $firstKeyword = true; ! foreach($keywords as $keyword) { ! if(!$firstKeyword) { ! echo ', '; ! } else $firstKeyword = false; ! $kwLink = "<a href='?keywords=$keyword'>".$keyword."</a>"; ! echo $kwLink; ! } ! echo '</small>'; ! } ! echo '</td>'; echo '<td align="center">'; *************** *** 229,233 **** <tbody> <tr> - <td>'.get_string('id', 'qtype_opaque').'</td> <td>'.get_string('name', 'qtype_opaque').'</td> <td>'.get_string('description', 'qtype_opaque').'</td> --- 323,326 ---- *************** *** 244,261 **** else echo '<tr class="odd">'; ! echo '<td>'.$questionList[$i]->id.'</td> ! <td>'.$questionList[$i]->name.'</td> <td>'.$questionList[$i]->description.'</td>'; if($questionList[$i]->valid == 1) { ! echo '<td>1</td>'; } else { ! echo '<td>0</td>'; } ! echo '<td>'.$questionList[$i]->dateEdited.'</td>'; echo '<td>'; if(!empty($questionList[$i]->moodleCategories)) --- 337,354 ---- else echo '<tr class="odd">'; ! //echo '<td>'.$questionList[$i]->id.'</td> ! echo '<td>'.$questionList[$i]->name.'</td> <td>'.$questionList[$i]->description.'</td>'; if($questionList[$i]->valid == 1) { ! echo '<img alt="1" src="'.$CFG->wwwroot.'/pix/i/tick_green_small.gif" />'; } else { ! echo '<img alt="0" src="'.$CFG->wwwroot.'/pix/i/cross_red_small.gif" />'; } ! echo '<td>'.formatDate($questionList[$i]->dateEdited).'</td>'; echo '<td>'; if(!empty($questionList[$i]->moodleCategories)) *************** *** 270,274 **** } } ! } echo '</td>'; global $USER; --- 363,369 ---- } } ! } else { ! echo get_string('noCategories', 'qtype_opaque'); ! } echo '</td>'; global $USER; *************** *** 288,293 **** if($questionPage->questionItems != NULL) { ! //echo '<br/><a href="javascript:;" onclick="toggleSelection()">invert selection</a>'; ! echo '<br /> <input type="radio" name="selectall" onclick="selectAll(this.form,0);" />Select all<input type="radio" name="selectall" onclick="selectAll(this.form,1);" />Inverse selection'; echo '<br /><h4>'.get_string('withSelected', 'qtype_opaque').'</h4>'; echo '<input type="submit" value="Delete" name="Submit" class="stackbutton" onclick="return confirm(\''.get_string('confirmDeletion','qtype_opaque').'\')" /> <input type="submit" value="Export" name="Submit" class="stackbutton" /> <input type="submit" value="Validate" name="Submit" />'; --- 383,387 ---- if($questionPage->questionItems != NULL) { ! echo '<a href="javascript:;" onclick="$(\'.groupingCheckbox\').click()">'.get_string('invertSelection', 'qtype_opaque').'</a>'; echo '<br /><h4>'.get_string('withSelected', 'qtype_opaque').'</h4>'; echo '<input type="submit" value="Delete" name="Submit" class="stackbutton" onclick="return confirm(\''.get_string('confirmDeletion','qtype_opaque').'\')" /> <input type="submit" value="Export" name="Submit" class="stackbutton" /> <input type="submit" value="Validate" name="Submit" />'; *************** *** 303,310 **** if(!empty($catList)) { ! echo '<span class="relatedBox"><input type="submit" value="Move to Moodle Question Bank:" name="Submit"> '; echo $catList; echo '</span>'; ! } echo '<input type="hidden" name="stackEngine" value="'.$SESSION->stackSelectedEngine.'" />'; --- 397,406 ---- if(!empty($catList)) { ! echo '<p /><span class="relatedBox"><input type="submit" value="Move to Moodle Question Bank:" name="Submit"> '; echo $catList; echo '</span>'; ! } else { ! echo get_string('noCategories', 'qtype_opaque'); ! } echo '<input type="hidden" name="stackEngine" value="'.$SESSION->stackSelectedEngine.'" />'; Index: soapPage.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/opaque/stack/soapPage.php,v retrieving revision 1.14 retrieving revision 1.14.4.1 diff -C2 -d -r1.14 -r1.14.4.1 *** soapPage.php 23 Jun 2009 16:18:28 -0000 1.14 --- soapPage.php 22 Nov 2010 23:05:52 -0000 1.14.4.1 *************** *** 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.17 retrieving revision 1.17.4.1 diff -C2 -d -r1.17 -r1.17.4.1 *** stackLib.php 23 Jun 2009 16:18:28 -0000 1.17 --- stackLib.php 22 Nov 2010 23:05:52 -0000 1.17.4.1 *************** *** 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,363 **** /** ! * Drops an instance (or version) of a question given its cache ID. * * @param int engineID --- 363,407 ---- /** ! * 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']; ! ! echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); ! } ! } ! ! /** ! * Adds an instance (or version) of a question. * * @param int engineID *************** *** 394,398 **** $values[] = $param['number']; ! //echo "param in AddInstances: ".print_r($param, true); echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); --- 438,483 ---- $values[] = $param['number']; ! $keys[] = 'autoprime'; ! $values[] = $param['autoprime']; ! ! echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); ! } ! } ! ! /** ! * Primes an instance of a question. ! * ! * @param int engineID ! * @param int id ! */ ! function stackPrimeInstance($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[] = 'prime'; ! ! $keys[] = 'instance'; ! $values[] = $param['instance']; echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); *************** *** 400,403 **** --- 485,575 ---- } + + /** + * Replaces one deployment to the Moodle quesiton bank with another. + * + * @param array + */ + function stackUpdateDeployment($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[] = 'update'; + + $keys[] = 'prior'; + $values[] = $param['prior']; + + $keys[] = 'number'; + $values[] = $param['number']; + + $keys[] = 'category'; + $values[] = $param['category']; + + $keys[] = 'engineID'; + $values[] = $engineID; + + echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); + } + } + + + function stackMoveDeployment($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[] = 'move'; + + $keys[] = 'category'; + $values[] = $param['category']; + + $keys[] = 'engineID'; + $values[] = $engineID; + + echo soap_call($connection, 'stackDeployOperation', array($passkey, $USER->id, $keys, $values)); + } + } + + /** * Returns the name of the engine from its id *************** *** 600,606 **** { ! ereg('([0-9]*):([0-9]*) ([0-9]*)/([0-9]*)/([0-9]*)',$value->dateEdited, $time); ! ! $ts = mktime($time[1], $time[2], 0, $time[4],$time[3],$time[5]); //works on UK dates only. TODO generate date based of Moodle settings --- 772,776 ---- { ! preg_match('|([0-9]*):([0-9]*) ([0-9]*)/([0-9]*)/([0-9]*)|',$value->dateEdited, $time); $ts = mktime($time[1], $time[2], 0, $time[4],$time[3],$time[5]); //works on UK dates only. TODO generate date based of Moodle settings *************** *** 641,643 **** --- 811,820 ---- } + function formatDate($date) { + preg_match('|([0-9]*):([0-9]*) ([0-9]*)/([0-9]*)/([0-9]*)|',$date, $time); + $ts = mktime($time[1], $time[2], 0, $time[4],$time[3],$time[5]); //works on UK dates only. TODO generate date based of Moodle settings + if($ts < strtotime('00:00')) return date('j M Y', $ts); + else return date('g:ia', $ts); + } + ?> \ No newline at end of file |