xhtml and accessibility cleanup in data mod MDL-7813

* image galery preset accessiblity fixes MDL-7822
* xhtml fixes
* fields now use s() and p() where needed
* added labels to all fields - imporved accessiblity for adding of new entries
* some other general bugfixing and cleanup

it is still not finished though, expect some more commits tomorrow
This commit is contained in:
skodak
2006-12-12 23:34:55 +00:00
parent 1a57f3aa8d
commit e357c206db
29 changed files with 204 additions and 178 deletions
+1 -1
View File
@@ -289,7 +289,7 @@
echo $newtext;
echo '<div align="center"><input type="submit" name="saveandview" value="'.get_string('saveandview','data').'" />';
if ($rid) {
echo '&nbsp;<input type="submit" name="cancel" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)">';
echo '&nbsp;<input type="submit" name="cancel" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
} else {
echo '<input type="submit" value="'.get_string('saveandadd','data').'" />';
}
+2 -2
View File
@@ -278,10 +278,10 @@
shorten_text($field->field->description, 30),
'<a href="field.php?d='.$data->id.'&amp;mode=display&amp;fid='.$field->field->id.'&amp;sesskey='.sesskey().'">'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>'.
'&nbsp;'.
'<a href="field.php?d='.$data->id.'&amp;mode=delete&amp;fid='.$field->field->id.'&amp;sesskey='.sesskey().'">'.
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>'
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>'
);
}
+10 -6
View File
@@ -40,26 +40,30 @@ class data_field_checkbox extends data_field_base {
$content = explode('##', $content);
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$i = 0;
foreach (explode("\n", $this->field->param1) as $checkbox) {
$checkbox = trim($checkbox);
$str .= '<input type="checkbox" name="field_' . $this->field->id . '[]" ';
$str .= 'value="' . $checkbox . '" ';
$str .= '<input type="checkbox" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '[]" ';
$str .= 'value="' . s($checkbox) . '" ';
if (array_search($checkbox, $content) !== false) {
$str .= 'checked />';
} else {
$str .= '/>';
}
$str .= $checkbox . '<br />';
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$checkbox.'</label><br />';
$i++;
}
$str .= '</fieldset>';
$str .= '</div>';
return $str;
}
function update_content($recordid, $value, $name='') {
$content = new object;
$content = new object();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = $this->format_data_field_checkbox_content($value);
+7 -7
View File
@@ -1,14 +1,14 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
<td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
<td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
+1 -1
View File
@@ -42,7 +42,7 @@ class data_field_date extends data_field_base {
$content = time();
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= print_date_selector('field_'.$this->field->id.'_day', 'field_'.$this->field->id.'_month',
'field_'.$this->field->id.'_year', $content, true);
$str .= '</div>';
+5 -5
View File
@@ -1,10 +1,10 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
</table>
+10 -8
View File
@@ -60,13 +60,15 @@ class data_field_file extends data_field_base {
$source = '';
}
$str = '<div title="' . $this->field->description . '">';
$str = '<div title="' . s($this->field->description) . '">';
$str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" value="fakevalue" />';
$str .= get_string('file','data'). ': <input type="file" name ="field_'.$this->field->id.'" id="field_'.
$this->field->id.'" title="'.$this->field->description.'" /><br />';
$str .= get_string('optionalfilename','data').': <input type="text" name="field_' .$this->field->id.'_filename"
id="field_'.$this->field->id.'_filename" value="'.$displayname.'" /><br />';
$str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->field->param3.'" />';
$str .= get_string('file','data'). ' <input type="file" name ="field_'.$this->field->id.'" id="field_'.
$this->field->id.'" title="'.s($this->field->description).'" /><br />';
$str .= get_string('optionalfilename','data').' <input type="text" name="field_' .$this->field->id.'_filename"
id="field_'.$this->field->id.'_filename" value="'.s($displayname).'" /><br />';
$str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.s($this->field->param3).'" />';
$str .= '</fieldset>';
$str .= '</div>';
if ($recordid and isset($content)){ // Print icon
@@ -97,8 +99,8 @@ class data_field_file extends data_field_base {
$source = $CFG->wwwroot.'/file.php?file=/'.$path;
}
$width = $this->field->param1 ? ' width = "'.$this->field->param1.'" ':' ';
$height = $this->field->param2 ? ' height = "'.$this->field->param2.'" ':' ';
$width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
$height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src);
+16 -5
View File
@@ -1,10 +1,21 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"> <?php echo get_string('fieldname', 'data'); ?>: </td>
<td class="c1"> <input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"> <?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
<td class="c0"><label for="param3">
<?php echo get_string('maxsize', 'data'); ?></label></td>
<td class="c1">
<?php
$course->maxbytes = get_field('course', 'maxbytes', 'id', $this->data->course);
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
choose_from_menu($choices, 'param3', $this->field->param3, '', '', 0, false, false, 0, 'param3');
?>
</td>
</tr>
</table>
+5 -3
View File
@@ -64,11 +64,13 @@ class data_field_latlong extends data_field_base {
}
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<table><tr><td align="right">';
$str .= '<label for="field_'.$this->field->id.'_0">' . get_string('latitude', 'data') . '</label>:</td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$lat.'" size="10" />°N</td></tr>';
$str .= '<tr><td align="right"><label for="field_'.$this->field->id.'_1">' . get_string('longitude', 'data') . '</label>:</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.$long.'" size="10" />°E</td></tr>';
$str .= '<label for="field_'.$this->field->id.'_0">' . get_string('latitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($lat).'" size="10" />°N</td></tr>';
$str .= '<tr><td align="right"><label for="field_'.$this->field->id.'_1">' . get_string('longitude', 'data') . '</label></td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($long).'" size="10" />°E</td></tr>';
$str .= '</table>';
$str .= '</fieldset>';
$str .= '</div>';
return $str;
+8 -8
View File
@@ -1,16 +1,16 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p ($this->field->description);?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('latlonglinkservicesdisplayed', 'data'); ?>:</td>
<td class="c0"><label for="param1"><?php echo get_string('latlonglinkservicesdisplayed', 'data'); ?></label></td>
<td class="c1">
<select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php echo sizeof($this->linkoutservices) ?>">
<select class="linkservicesdisplayed" name="param1[]" id="param1" multiple="multiple" size="<?php p(sizeof($this->linkoutservices)); ?>">
<?php
$serviceschosen = explode(',', htmlspecialchars($this->field->param1));
foreach($this->linkoutservices as $servicename=>$serviceurl) {
@@ -22,7 +22,7 @@
</td>
</tr>
<tr>
<td class="c0"><?php echo get_string('latlongkmllabelling', 'data'); ?>:</td>
<td class="c0"><label for="param2"><?php echo get_string('latlongkmllabelling', 'data'); ?></label></td>
<td class="c1">
<select class="kmllabelling" name="param2" id="param2">
<option value="-1"<?php if($this->field->param2==-1) echo ' selected="selected"' ?>><?php echo get_string('entry', 'data') ?> #</option>
+2 -2
View File
@@ -39,7 +39,7 @@ class data_field_menu extends data_field_base {
$content = '';
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$rawoptions = explode("\n",$this->field->param1);
foreach ($rawoptions as $option) {
@@ -50,7 +50,7 @@ class data_field_menu extends data_field_base {
}
$str .= choose_from_menu($options, 'field_'.$this->field->id, $content,
get_string('menuchoose', 'data'), '', '', true, false);
get_string('menuchoose', 'data'), '', '', true, false, 0, 'field_'.$this->field->id);
$str .= '</div>';
+7 -7
View File
@@ -1,14 +1,14 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
<td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
<td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
+2 -2
View File
@@ -40,12 +40,12 @@ class data_field_multimenu extends data_field_base {
$content = array();
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
foreach (explode("\n",$this->field->param1) as $option) {
$option = trim($option);
$str .= '<option value="' . $option . '"';
$str .= '<option value="' . s($option) . '"';
if (array_search($option, $content) !== false) {
// Selected by user.
+7 -7
View File
@@ -1,14 +1,14 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
<td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?></td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
<td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
+5 -5
View File
@@ -1,10 +1,10 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
</table>
+14 -12
View File
@@ -57,15 +57,17 @@ class data_field_picture extends data_field_file {
}
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$str .= '<input type="hidden" name ="field_'.$this->field->id.'_file" id="field_'.$this->field->id.'_file" value="fakevalue" />';
$str .= get_string('picture','data'). ': <input type="file" name ="field_'.$this->field->id.'" id="field_'.$this->field->id.'" /><br />';
$str .= get_string('optionaldescription','data') .': <input type="text" name="field_'
.$this->field->id.'_filename" id="field_'.$this->field->id.'_filename" value="'.$description.'" /><br />';
$str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->field->param3.'" />';
$str .= '<label for="field_'.$this->field->id.'">'.get_string('picture','data'). '</label>&nbsp;<input type="file" name ="field_'.$this->field->id.'" id="field_'.$this->field->id.'" /><br />';
$str .= '<label for="field_'.$this->field->id.'_filename">'.get_string('optionaldescription','data') .'</label>&nbsp;<input type="text" name="field_'
.$this->field->id.'_filename" id="field_'.$this->field->id.'_filename" value="'.s($description).'" /><br />';
$str .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.s($this->field->param3).'" />';
if ($filepath){
$str .= '<img width="'.$this->previewwidth.'" height="'.$this->previewheight.'" src="'.$filepath.'" alt="" />';
$str .= '<img width="'.s($this->previewwidth).'" height="'.s($this->previewheight).'" src="'.$filepath.'" alt="" />';
}
$str .= '</fieldset>';
$str .= '</div>';
return $str;
}
@@ -99,14 +101,14 @@ class data_field_picture extends data_field_file {
}
if ($template == 'listtemplate') {
$width = $this->field->param4 ? ' width="'.$this->field->param4.'" ' : ' ';
$height = $this->field->param5 ? ' height="'.$this->field->param5.'" ' : ' ';
$width = $this->field->param4 ? ' width="'.s($this->field->param4).'" ' : ' ';
$height = $this->field->param5 ? ' height="'.s($this->field->param5).'" ' : ' ';
$str = '<a href="view.php?d='.$this->field->dataid.'&amp;rid='.$recordid.'"><img '.
$width.$height.' src="'.$thumbnailsource.'" alt="'.$alt.'" title="'.$title.'" border="0" /></a>';
$width.$height.' src="'.$thumbnailsource.'" alt="'.s($alt).'" title="'.s($title).'" border="0" /></a>';
} else {
$width = $this->field->param1 ? ' width="'.$this->field->param1.'" ':' ';
$height = $this->field->param2 ? ' height="'.$this->field->param2.'" ':' ';
$str = '<a href="'.$source.'"><img '.$width.$height.' src="'.$source.'" alt="'.$alt.'" title="'.$title.'" border="0"/></a>';
$width = $this->field->param1 ? ' width="'.s($this->field->param1).'" ':' ';
$height = $this->field->param2 ? ' height="'.s($this->field->param2).'" ':' ';
$str = '<a href="'.$source.'"><img '.$width.$height.' src="'.$source.'" alt="'.s($alt).'" title="'.s($title).'" border="0"/></a>';
}
return $str;
}
+22 -29
View File
@@ -1,60 +1,53 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0">
<?php echo get_string('fieldname', 'data');?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" />
<td class="c0"><label for="name">
<?php echo get_string('fieldname', 'data');?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fielddescription', 'data');?>:
</td>
<td class="c0"><label for="description">
<?php echo get_string('fielddescription', 'data');?></label></td>
<td class="c1">
<input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" />
<input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldwidthsingleview', 'data');?>:
</td>
<td class="c0"><label for="param1">
<?php echo get_string('fieldwidthsingleview', 'data');?></label></td>
<td class="c1">
<input style="width:70px;" type="text" name="param1" id="param1" value = "<?php if (!empty($this->field->param1)) echo $this->field->param1; ?>" />
<input style="width:70px;" type="text" name="param1" id="param1" value="<?php if (!empty($this->field->param1)) p($this->field->param1); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldheightsingleview', 'data');?>:
</td>
<td class="c0"><label for="param2">
<?php echo get_string('fieldheightsingleview', 'data');?></label></td>
<td class="c1">
<input style="width:70px;" type="text" name="param2" id="param2" value = "<?php if (!empty($this->field->param2)) echo $this->field->param2; ?>" />
<input style="width:70px;" type="text" name="param2" id="param2" value="<?php if (!empty($this->field->param2)) p($this->field->param2); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldwidthlistview', 'data');?>:
</td>
<td class="c1"><input style="width:70px;" type="text" name="param4" id="param4" value = "<?php if (!empty($this->field->param4)) echo $this->field->param4; ?>" />
<td class="c0"><label for="param4">
<?php echo get_string('fieldwidthlistview', 'data');?></label></td>
<td class="c1"><input style="width:70px;" type="text" name="param4" id="param4" value="<?php if (!empty($this->field->param4)) p($this->field->param4); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldheightlistview', 'data');?>:
</td>
<td class="c0"><label for="param5">
<?php echo get_string('fieldheightlistview', 'data');?></label></td>
<td class="c1">
<input style="width:70px;" type="text" name="param5" id="param5" value = "<?php if (!empty($this->field->param5)) echo $this->field->param5; ?>" />
<input style="width:70px;" type="text" name="param5" id="param5" value="<?php if (!empty($this->field->param5)) p($this->field->param5); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('maxsize', 'data'); ?>:
</td>
<td class="c0"><label for="param3">
<?php echo get_string('maxsize', 'data'); ?></label></td>
<td class="c1">
<?php
$course->maxbytes = get_field('course', 'maxbytes', 'id', $this->data->course);
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
choose_from_menu ($choices, "param3", $this->field->param3, "");
choose_from_menu($choices, 'param3', $this->field->param3, '', '', 0, false, false, 0, 'param3');
?>
</td>
</tr>
</tr>
</table>
+9 -5
View File
@@ -40,12 +40,14 @@ class data_field_radiobutton extends data_field_base {
$content = '';
}
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
$str .= '<fieldset><legend><span class="accesshide">'.$this->field->name.'</span></legend>';
$i = 0;
foreach (explode("\n",$this->field->param1) as $radio) {
$radio = trim($radio);
$str .= '<input type="radio" name="field_' . $this->field->id . '" ';
$str .= 'value="' . $radio . '" ';
$str .= '<input type="radio" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '" ';
$str .= 'value="' . s($radio) . '" ';
if ($content == $radio) {
// Selected by user.
@@ -54,8 +56,10 @@ class data_field_radiobutton extends data_field_base {
$str .= '/>';
}
$str .= $radio . '<br />';
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$radio.'</label><br />';
$i++;
}
$str .= '</fieldset>';
$str .= '</div>';
return $str;
}
+7 -7
View File
@@ -1,14 +1,14 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
<td class="c0" valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {echo $this->field->param1;} ?></textarea></td>
<td class="c0" valign="top"><label for="param1"><?php echo get_string('fieldoptions', 'data'); ?></label></td>
<td class="c1"><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($this->field->param1) {p($this->field->param1);} ?></textarea></td>
</tr>
</table>
+6 -6
View File
@@ -1,14 +1,14 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php echo($this->field->description); ?>" /></td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fieldallowautolink', 'data'); ?>:</td>
<td class="c0"><label for="param1"><?php echo get_string('fieldallowautolink', 'data'); ?></label></td>
<td class="c1"><input type="checkbox" name="param1" id="param1" <?php if($this->field->param1) {echo 'checked="checked"';} ?> value="1" /></td>
</tr>
</table>
+2 -2
View File
@@ -72,13 +72,13 @@ class data_field_textarea extends data_field_base {
function gen_textarea($usehtmleditor, $text='') {
return print_textarea($usehtmleditor, $this->field->param3, $this->field->param2,
'', '', 'field_'.$this->field->id, $text, '', true);
'', '', 'field_'.$this->field->id, $text, '', true, 'field_' . $this->field->id);
}
function print_after_form() {
if (can_use_richtext_editor()) {
use_html_editor('field_' . $this->field->id);
use_html_editor('field_' . $this->field->id, '', 'field_' . $this->field->id);
}
}
+15 -17
View File
@@ -1,41 +1,39 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"><?php echo get_string('fieldname', 'data'); ?>:</td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php echo($this->field->name); ?>" /></td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"><input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('fielddescription', 'data'); ?>:</td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1">
<input class="fielddescription" type="text" name="description" id="description"
value="<?php echo($this->field->description); ?>" />
value="<?php p($this->field->description); ?>" />
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldwidth', 'data'); ?>:
</td>
<td class="c0"><label for="param2">
<?php echo get_string('fieldwidth', 'data'); ?></label></td>
<td class="c1">
<input style="width:50px;" type="text" name="param2" id="width" value=
<input style="width:50px;" type="text" name="param2" id="param2" value=
<?php
if (empty($this->field->param2)) {
echo '"60"';
echo('"60"');
} else {
echo('"' . $this->field->param2 . '"');
echo '"'.s($this->field->param2).'"';
}
?> /> <?php echo get_string('columns', 'data'); ?>
</td>
</tr>
<tr>
<td class="c0">
<?php echo get_string('fieldheight', 'data'); ?>:
</td>
<td class="c0"><label for="param3">
<?php echo get_string('fieldheight', 'data'); ?></label></td>
<td class="c1">
<input style="width:50px;" type="text" name="param3" id="height" value=
<input style="width:50px;" type="text" name="param3" id="param3" value=
<?php
if (empty($this->field->param3)) {
echo '"35"';
echo('"35"');
} else {
echo('"' . $this->field->param3 . '"');
echo '"'.s($this->field->param2).'"';
}
?> /> <?php echo get_string('rows', 'data'); ?>
</td>
+3 -3
View File
@@ -44,14 +44,14 @@ class data_field_url extends data_field_base {
}
$url = empty($url) ? 'http://' : $url;
$str = '<div title="'.$this->field->description.'">';
$str = '<div title="'.s($this->field->description).'">';
if (!empty($this->field->param1) and empty($this->field->param2)) {
$str .= '<table><tr><td align="right">';
$str .= get_string('url','data').':</td><td><input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$url.'" size="60" /></td></tr>';
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.$text.'" size="60" /></td></tr>';
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($text).'" size="60" /></td></tr>';
$str .= '</table>';
} else { // Just the URL field
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.$url.'" size="60" />';
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="field_'.$this->field->id.'_0" value="'.s($url).'" size="60" />';
}
$str .= '</div>';
+8 -8
View File
@@ -1,18 +1,18 @@
<table width="100%">
<table width="100%" cellpadding="5">
<tr>
<td class="c0"> <?php echo get_string('fieldname', 'data'); ?>: </td>
<td class="c1"> <input class="fieldname" type="text" name="name" id="name" value = "<?php echo($this->field->name); ?>" /> </td>
<td class="c0"><label for="name"><?php echo get_string('fieldname', 'data'); ?></label></td>
<td class="c1"> <input class="fieldname" type="text" name="name" id="name" value="<?php p($this->field->name); ?>" /></td>
</tr>
<tr>
<td class="c0"> <?php echo get_string('fielddescription', 'data'); ?>: </td>
<td class="c1"> <input class="fielddescription" type="text" name="description" id="description" value = "<?php echo ($this->field->description);?>" /> </td>
<td class="c0"><label for="description"><?php echo get_string('fielddescription', 'data'); ?></label></td>
<td class="c1"><input class="fielddescription" type="text" name="description" id="description" value="<?php p($this->field->description);?>" /></td>
</tr>
<tr>
<td class="c0"> <?php echo get_string('forcelinkname', 'data'); ?>: </td>
<td class="c1"> <input class="forcelinkname" type="text" name="param2" id="forcelinkname" value = "<?php echo ($this->field->param2);?>" /> </td>
<td class="c0"><label for="param2"><?php echo get_string('forcelinkname', 'data'); ?></label></td>
<td class="c1"><input class="forcelinkname" type="text" name="param2" id="forcelinkname" value="<?php p($this->field->param2);?>" /></td>
</tr>
<tr>
<td class="c0"><?php echo get_string('autolinkurl', 'data') ?></td>
<td class="c0"><label for="param1"><?php echo get_string('autolinkurl', 'data') ?></td>
<td class="c1"><input type="checkbox" name="param1" id="param1" <?php if($this->field->param1) {echo 'checked="checked"';} ?> value="1" /></td>
</tr>
</table>
+22 -14
View File
@@ -198,7 +198,7 @@ class data_field_base { /// Base class for Database Field Types (see field/*
echo '<div align="center">';
echo '<input type="submit" value="'.$savebutton.'" />'."\n";
echo '<input type="submit" name="cancel" value="'.get_string('cancel').'" />'."\n";
echo '</div">';
echo '</div>';
echo '</form>';
@@ -331,12 +331,20 @@ function data_generate_default_template(&$data, $template, $recordid=0, $form=fa
if ($fields = get_records('data_fields', 'dataid', $data->id, 'id')) {
$str = '<div align="center">';
$str .= '<table>';
$str .= '<table cellpadding="5">';
foreach ($fields as $field) {
$str .= '<tr><td valign="top" align="right">';
$str .= $field->name.':';
if ($template == 'addtemplate') {
$str .= '<label';
if (!in_array($field->type, array('picture', 'checkbox', 'date', 'latlong', 'radiobutton'))) {
$str .= ' for="[['.$field->name.'#id]]"';
}
$str .= '>'.$field->name.'</label>';
} else {
$str .= $field->name.': ';
}
$str .= '</td>';
$str .='<td>';
@@ -351,7 +359,7 @@ function data_generate_default_template(&$data, $template, $recordid=0, $form=fa
}
if ($template != 'addtemplate' and $template != 'rsstemplate') { //if not adding, we put tags in there
$str .= '<tr><td align="center" colspan="2">##Edit## ##More## ##Delete## ##Approve##</td></tr>';
$str .= '<tr><td align="center" colspan="2">##edit## ##more## ##delete## ##approve##</td></tr>';
}
$str .= '</table>';
@@ -827,35 +835,35 @@ function data_print_template($template, $records, $data, $search='',$page=0, $re
}
/// Replacing special tags (##Edit##, ##Delete##, ##More##)
$patterns[]='##Edit##';
$patterns[]='##Delete##';
$patterns[]='##edit##';
$patterns[]='##delete##';
if (has_capability('mod/data:manageentries', $context) or data_isowner($record->id)) {
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
.$data->id.'&amp;rid='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>';
.$data->id.'&amp;rid='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
.$data->id.'&amp;delete='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
.$data->id.'&amp;delete='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
} else {
$replacement[] = '';
$replacement[] = '';
}
$patterns[]='##More##';
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" height="11" width="11" border="0" alt="'.get_string('more', 'data').'" /></a>';
$patterns[]='##more##';
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;rid='.$record->id.'"><img src="'.$CFG->pixpath.'/i/search.gif" height="11" width="11" border="0" alt="'.get_string('more', 'data').'" title="'.get_string('more', 'data').'" /></a>';
$patterns[]='##MoreURL##';
$patterns[]='##moreurl##';
$replacement[] = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;rid='.$record->id;
$patterns[]='##User##';
$patterns[]='##user##';
$replacement[] = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$record->userid.
'&amp;course='.$data->course.'">'.fullname($record).'</a>';
$patterns[]='##Approve##';
$patterns[]='##approve##';
if (has_capability('mod/data:approve', $context) && ($data->approval) && (!$record->approved)){
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&amp;approve='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/i/approve.gif" height="11" width="11" border="0" alt="'.get_string('approve').'" /></a>';
} else {
$replacement[] = '';
}
$patterns[]='##Comments##';
$patterns[]='##comments##';
if (($template == 'listtemplate') && ($data->comments)) {
$comments = count_records('data_comments','recordid',$record->id);
$replacement[] = '<a href="view.php?rid='.$record->id.'#comments">'.get_string('commentsn','data', $comments).'</a>';
+2 -2
View File
@@ -292,7 +292,7 @@ echo '<div align="center">';
echo '<table class="presets" cellpadding="5">';
echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strexport.'</h3></td></tr>';
echo '<tr><td><label for="zipexport">'.$strexportaszip.'</label>';
echo '<tr><td><label>'.$strexportaszip.'</label>';
helpbutton('exportzip', '', 'data');
echo '</td><td>';
$options = new object();
@@ -302,7 +302,7 @@ $options->sesskey = sesskey();
print_single_button('preset.php', $options, $strexport, 'post');
echo '</td></tr>';
echo '<tr><td><label for="zipexport">'.$strsaveaspreset.'</label>';
echo '<tr><td><label>'.$strsaveaspreset.'</label>';
helpbutton('savepreset', '', 'data');
echo '</td><td>';
$options = new object();
@@ -1,8 +1,7 @@
<div align="center">
<table cellpadding="2">
<table cellpadding="5">
<tr><td><label for="[[title#id]]">Title</label></td><td>[[title]]</td></tr>
<tr><td><label for="[[caption#id]]">Caption</label></td><td>[[caption]]</td></tr>
<tr><td><label>Image</label></td><td>[[image]]</td></tr>
</table>
<hr />
[[image]]
</div>
@@ -1,7 +1,7 @@
<div class="picturediv">
<table class="pictureframe"><tr><td>
<table class="picture">
<tr><td><div name="listimage">[[image]]</div></td></tr>
<tr><td><div class="listimage">[[image]]</div></td></tr>
<tr><td align="right">##edit## ##delete## ##approve##</td></tr>
</table>
</td></tr></table>
+3
View File
@@ -208,6 +208,9 @@
if ($mode == 'addtemplate') {
echo '<optgroup label="'.get_string('fieldids', 'data').'">';
foreach ($fields as $field) {
if (in_array($field->type, array('picture', 'checkbox', 'date', 'latlong', 'radiobutton'))) {
continue; //ids are not usable for these composed items
}
echo '<option value="[['.$field->name.'#id]]" title="'.$field->description.' id">'.$field->name.' id - [['.$field->name.'#id]]</option>';
}
echo '</optgroup>';