Various small XHTML fixes, language fixes

This commit is contained in:
moodler
2006-02-06 05:24:02 +00:00
parent 6f4e039994
commit 6e0119dd30
6 changed files with 72 additions and 58 deletions
+5 -1
View File
@@ -117,7 +117,11 @@
//set flag to unapproved after each edit
$record = get_record('data_records','id',$rid);
$record->approved = 0;
if (isteacher($course->id)) {
$record->approved = 1;
} else {
$record->approved = 0;
}
update_record('data_records',$record);
foreach ($datarecord as $name=>$value){
+19 -19
View File
@@ -4,10 +4,10 @@ $string['add'] = 'Add entry';
$string['addafield'] = 'Add a Field';
$string['addtemplate'] = 'Add Template';
$string['ascending'] = 'Ascending';
$string['atmaxentry'] = 'you are at the maximum number of entries!';
$string['autogenallforms'] = 'Generate All Default Templates';
$string['atmaxentry'] = 'You have entered the maximum number of entries allowed!';
$string['autogenallforms'] = 'Generate all default templates';
$string['availablefromdate'] = 'Available from';
$string['availabletags'] = 'Available Tags';
$string['availabletags'] = 'Available tags';
$string['availabletodate'] = 'Available to';
$string['browse'] = 'Browse';
$string['cancel'] = 'Cancel';
@@ -23,16 +23,16 @@ $string['menu'] = 'Menu (Single-selection)';
$string['menuchoose'] = 'Choose...';
$string['emptyadd'] = 'The Add template is empty, generating a default form...';
$string['emptyaddform'] = 'You did not fill out any fields!';
$string['entrysaved'] = 'Entry Saved';
$string['example'] = 'Database Module Example';
$string['fieldadded'] = 'Field Added';
$string['fielddeleted'] = 'Field Deleted';
$string['fieldname'] = 'Field Name';
$string['entrysaved'] = 'Your entry has been saved';
$string['example'] = 'Database module example';
$string['fieldadded'] = 'Field added';
$string['fielddeleted'] = 'Field deleted';
$string['fieldname'] = 'Field name';
$string['fields'] = 'Fields';
$string['fieldupdated'] = 'Field Updated';
$string['fieldupdated'] = 'Field updated';
$string['file'] = 'File';
$string['footer'] = 'Footer';
$string['generatedefault'] = 'Generate Default Template';
$string['generatedefault'] = 'Generate default template';
$string['header'] = 'Header';
$string['headeraddtemplate'] = 'Defines the interface when adding new entries';
$string['headerlisttemplate'] = 'Defines browsing interface for multiple entries';
@@ -46,9 +46,9 @@ $string['listtemplate'] = 'List Template';
$string['maxentries'] = 'Maximum entries';
$string['modulename'] = 'Database';
$string['modulenameplural'] = 'Databases';
$string['multientry'] = 'Repeated Entry';
$string['multientry'] = 'Repeated entry';
$string['multimenu'] = 'Menu (Multiple-selection)';
$string['multipletags'] = 'multiple tags found! template not saved';
$string['multipletags'] = 'Multiple tags found! Template not saved';
$string['namecheckbox'] = 'Checkbox Field';
$string['namemenu'] = 'Menu Field';
$string['namemultimenu'] = 'Multiple-selection Menu Field';
@@ -58,7 +58,7 @@ $string['nameurl'] = 'URL Field';
$string['nametext'] = 'Text Field';
$string['nametextarea'] = 'Textarea Field';
$string['namepicture'] = 'Picture Field';
$string['newentry'] = 'New Entry:';
$string['newentry'] = 'New entry';
$string['newfield'] = 'Create a new field';
$string['nofieldindatabase'] = 'There are no fields defined for this database, please add some';
$string['nolisttemplate'] = 'List template is not yet defined';
@@ -69,25 +69,25 @@ $string['numrecords'] = 'Records';
$string['noaccess'] = 'You do not have access to this page';
$string['nomatch'] = 'No matching entries found!';
$string['norecords'] = 'No entries in database';
$string['optionaldescription'] = 'Short Description (Optional)';
$string['optionalfilename'] = 'File Name (Optional)';
$string['pagesize'] = 'Number of Entries Per Page';
$string['optionaldescription'] = 'Short description (optional)';
$string['optionalfilename'] = 'Filename (optional)';
$string['pagesize'] = 'Entries per page';
$string['participants'] = 'Participants';
$string['picture'] = 'Picture';
$string['radiobutton'] = 'Radio Button(s)';
$string['radiobutton'] = 'Radio Buttons';
$string['recorddeleted'] = 'Record Deleted';
$string['requireapproval'] = 'Require Approval?';
$string['requiredentries'] = 'Required entries';
$string['requiredentriestoview'] = 'Entries required before viewing';
$string['rsstemplate'] = 'RSS Template';
$string['save'] = 'Save';
$string['savetemplate'] = 'Save Template';
$string['savetemplate'] = 'Save template';
$string['singletemplate'] = 'Single Template';
$string['teachersandstudents'] = '$a->teachers and $a->students';
$string['templates'] = 'Templates';
$string['text'] = 'Text';
$string['textarea'] = 'Textarea';
$string['type'] = 'Field Type';
$string['type'] = 'Field type';
$string['updatefield'] = 'Update an existing field';
$string['url'] = 'Url';
$string['viewfromdate'] = 'Viewable from';
+43 -37
View File
@@ -29,7 +29,6 @@ define ('PARTICIPANTS_TS', 3);
define ('DATAMAXENTRIES', 50);
define ('PERPAGE_SINGLE', 1);
class data_field_base { //base class (text field)
var $type = 'text'; /// Base class implements "text" field type completely.
@@ -258,7 +257,7 @@ function data_generate_default_form($dataid, $mode){
}
if ($mode!='addtemplate' and $mode!='rsstemplate'){ //if not adding, we put tags in there
$str .= '<tr><td align="center" colspan="2">##Edit## ##More## ##Delete##</td></tr>';
$str .= '<tr><td align="center" colspan="2">##Edit## ##More## ##Delete## ##Approve##</td></tr>';
}
$str .= '</table>';
@@ -326,8 +325,6 @@ function data_get_field_from_name($name){
if ($field){
return data_get_field($field);
} else {
return false;
}
}
@@ -400,12 +397,17 @@ function data_numentries($data){
* output bool *
****************************************************************/
function data_add_record($dataid, $groupid=0){
global $USER;
global $USER, $course;
$record->userid = $USER->id;
$record->groupid = $groupid;
$record->dataid = $dataid;
$record->timecreated = time();
$record->timemodified = time();
if (isteacher($course->id)) {
$record->approved = 1;
} else {
$record->approved = 0;
}
return insert_record('data_records',$record);
}
@@ -680,10 +682,12 @@ function data_print_template($records, $data, $search, $template, $sort, $page,
unset($g);
}
$record = get_record('data_records','id',$record->id);
///replacing special tags (##Edit##, ##Delete##, ##More##)
$patterns[]='/\#\#Edit\#\#/i';
$patterns[]='/\#\#Delete\#\#/i';
$patterns[]='/\#\#More\#\#/i';
$patterns[]='/\#\#Approve\#\#/i';
if (data_isowner($record->id) or isteacheredit($course->id)){
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/add.php?d='
@@ -700,18 +704,18 @@ function data_print_template($records, $data, $search, $template, $sort, $page,
}
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;rid='.$record->id.'&amp;search='.$search.'&amp;sort='.$sort.'&amp;order='.$order.'&amp;"><img src="'.$CFG->pixpath.'/i/search.gif" height="11" width="11" border="0" alt="'.get_string('more').'" /></a>';
if (isteacher($course->id) && ($data->approval) && (!$record->approved)){
$replacement[] = data_print_approve_button($record->id, $data->id, $page, $rid, $search, $sort, $order);
}else {
$replacement[] = '';
}
///actual replacement of the tags
$newtext = preg_replace($patterns, $replacement, $data->{$template});
echo $newtext; //prints the template with tags replaced
//if this record is not yet approved, and database requires approval, print silly button
$record = get_record('data_records','id',$record->id);
if (isteacher($course->id) && (!$record->approved) && $data->approval) {
data_print_approve_button($record->id, $data->id, $page, $rid, $search, $sort, $order);
}
echo '<p></p>';
}
}
@@ -727,28 +731,29 @@ function data_print_template($records, $data, $search, $template, $sort, $page,
function data_print_preference_form($data, $perpage, $search, $sort='', $order='ASC'){
echo '<br />';
echo '<form name="options" action="view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'" method="post">';
echo '<table id="optiontable" align="center">';
echo '<tr><td>'.get_string('search').'</td>';
echo '<td><input type="text" size = "16" name="search" value="'.s($search).'" />';
echo '</td></tr>';
echo '<tr align="right"><td>';
echo '<label for="perpage">'.get_string('pagesize','data').'</label>';
echo ':</td>';
echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
echo '<td align="left">';
$pagesizes = array(1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,10=>10,15=>15,20=>20,30=>30,40=>40,50=>50,100=>100,200=>200,300=>300,400=>400,500=>500,1000=>1000);
echo '<table id="sortsearch" align="center">';
echo '<tr>'.
'<td class="c0 r1"><label for="perpage">'.get_string('pagesize','data').':</label></td>';
echo '<td class="c1 r1">';
$pagesizes = array(1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,10=>10,15=>15,
20=>20,30=>30,40=>40,50=>50,100=>100,200=>200,300=>300,400=>400,500=>500,1000=>1000);
choose_from_menu($pagesizes,'perpage1',$perpage,'choose','','0');
echo '</td></tr>';
echo '<tr>'.
'<td class="c0 r0">'.get_string('search').':</td>'.
'<td class="c1 r0"><input type="text" size="16" name="search" value="'.s($search).'" /></td>'.
'</tr>';
echo '<tr>';
echo '<tr><td>';
echo 'Sort by:';
echo '</td><td>';
echo '<tr><td class="c0 r2">';
echo get_string('sortby').':';
echo '</td><td class="c1 r2">';
//foreach field, print the option
$fields = get_records('data_fields','dataid',$data->id);
echo '<select name="sort"><option value="0">'.get_string('dateentered','data').'</option>';
foreach ($fields as $field) {
if ($field->id == $sort) {
echo '<option value="'.$field->id.'" SELECTED>'.$field->name.'</option>';
echo '<option value="'.$field->id.'" selected="selected">'.$field->name.'</option>';
} else {
echo '<option value="'.$field->id.'">'.$field->name.'</option>';
}
@@ -767,25 +772,26 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
}
//print ASC or DESC
echo '</td></tr><tr>';
echo '<td colspan="2" align="center">';
echo '<input type="submit" value="'.get_string('savepreferences').'" />';
echo '<td colspan="2" align="center" class="r3">';
echo '<input type="submit" value="'.get_string('savesettings').'" />';
echo '</td></tr></table>';
echo '</form>';
}
//silly function that prints a button
function data_print_approve_button($recordid, $d, $page='0', $rid='0', $search='', $sort='', $order='') {
echo '<div align="center"><form action="approve.php" method="GET">';
echo '<input type="hidden" name="d" value="'.$d.'" />';
echo '<input type="hidden" name="rid" value="'.$rid.'" />';
echo '<input type="hidden" name="page" value="'.$page.'" />';
echo '<input type="hidden" name="search" value="'.$search.'" />';
echo '<input type="hidden" name="sort" value="'.$sort.'" />';
echo '<input type="hidden" name="order" value="'.$order.'" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="recordid" value="'.$recordid.'" />';
echo '<input type="submit" value="'.get_string('approve').'" />';
echo '</form></div>';
$str= '<div align="center"><form action="approve.php" method="GET">';
$str.= '<input type="hidden" name="d" value="'.$d.'" />';
$str.= '<input type="hidden" name="rid" value="'.$rid.'" />';
$str.= '<input type="hidden" name="page" value="'.$page.'" />';
$str.= '<input type="hidden" name="search" value="'.$search.'" />';
$str.= '<input type="hidden" name="sort" value="'.$sort.'" />';
$str.= '<input type="hidden" name="order" value="'.$order.'" />';
$str.= '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
$str.= '<input type="hidden" name="recordid" value="'.$recordid.'" />';
$str.= '<input type="submit" value="'.get_string('approve').'" />';
$str.= '</form></div>';
return $str;
}
//silly function that approves a record
+3
View File
@@ -0,0 +1,3 @@
#mod-data-view #sortsearch .c0 {
text-align: right;
}
+1
View File
@@ -159,6 +159,7 @@
echo '<option value="##edit##">##Edit##</option>';
echo '<option value="##more##">##More##</option>';
echo '<option value="##delete##">##Delete##</option>';
echo '<option value="##approve##">##Approve##</option>';
echo '</select>';
///add the HTML editor(s)
+1 -1
View File
@@ -117,7 +117,7 @@
/// Check to see if groups are being used here
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
$currentgroup = setup_and_print_groups($course, $groupmode, "view.php?id=$cm->id");
$currentgroup = setup_and_print_groups($course, $groupmode, "'view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'&amp;page='.$page.'&amp;'");
} else {
$currentgroup = 0;
}