Cleaning up xhtml markup. Code now validates for xhtml 1.0 transitional.

This commit is contained in:
vyshane 2006-02-20 02:15:45 +00:00
parent 7541b03f28
commit af25f45e1a
21 changed files with 224 additions and 135 deletions

View file

@ -214,7 +214,7 @@
print_simple_box_start('center','80%'); print_simple_box_start('center','80%');
if (!$rid){ if (!$rid){
print_heading(get_string('newentry','data'),2); print_heading(get_string('newentry','data'), '', 2);
} }
/****************************************** /******************************************

View file

@ -80,8 +80,8 @@ class data_field_checkbox extends data_field_base {
foreach (explode("\n", $field->param1) as $checkbox) { foreach (explode("\n", $field->param1) as $checkbox) {
$checkbox = ltrim(rtrim($checkbox)); $checkbox = ltrim(rtrim($checkbox));
$str .= '<input type="checkbox" name="field_' . $field->id . '[]" id="field_'; $str .= '<input type="checkbox" name="field_' . $field->id . '[]" ';
$str .= $field->id . '[]" value="' . $checkbox . '" '; $str .= 'value="' . $checkbox . '" ';
if (array_search($checkbox, $content) !== false) { if (array_search($checkbox, $content) !== false) {
// Selected by user. // Selected by user.

View file

@ -1,11 +1,11 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
@ -19,13 +19,13 @@
</tr> </tr>
<tr> <tr>
<td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td> <td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td><textarea style="width:300px; height:150px;" name="param1" id="param1"><?php if($field->param1) {echo $field->param1;} ?></textarea></td> <td><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($field->param1) {echo $field->param1;} ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -97,7 +97,7 @@ class data_field_file extends data_field_base {// extends
} }
*/ */
$str .= '<div title="' . $field->description . '">'; $str .= '<div title="' . $field->description . '">';
$str .= '<input type="hidden" name ="field_'.$field->id.'_0" id="field_'.$field->id.'"_0 value="fakevalue" />'; $str .= '<input type="hidden" name ="field_'.$field->id.'_0" value="fakevalue" />';
$str .= get_string('file','data'). ': <input type="file" name ="field_'.$field->id.'" id="field_'.$field->id.'" title="'.$field->description.'" /><br />'; $str .= get_string('file','data'). ': <input type="file" name ="field_'.$field->id.'" id="field_'.$field->id.'" title="'.$field->description.'" /><br />';
$str .= get_string('optionalfilename','data').': <input type="text" name="field_' $str .= get_string('optionalfilename','data').': <input type="text" name="field_'
.$field->id.'_1" id="field_'.$field->id.'_1" value="'.$displayname.'" /><br />'; .$field->id.'_1" id="field_'.$field->id.'_1" value="'.$displayname.'" /><br />';
@ -108,7 +108,7 @@ class data_field_file extends data_field_base {// extends
if ($rid and isset($content)){ if ($rid and isset($content)){
require_once($CFG->libdir.'/filelib.php'); require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src); $icon = mimeinfo('icon', $src);
$str .= '<img align="absmiddle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'. $str .= '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
'<a href="'.$source.'/'.$src.'" >'.$name.'</a>'; '<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
} }
return $str; return $str;
@ -143,7 +143,7 @@ class data_field_file extends data_field_base {// extends
require_once($CFG->libdir.'/filelib.php'); require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src); $icon = mimeinfo('icon', $src);
$str = '<img align="absmiddle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'. $str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
'<a href="'.$source.'/'.$src.'" >'.$name.'</a>'; '<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
return $str; return $str;
} }

View file

@ -1,14 +1,33 @@
<table width="100%"><tr><td span="2"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <table width="100%">
<?php echo ($this->name()); ?></td></tr> <tr>
<tr><td><Name><?php echo get_string('fieldname', 'data'); ?>:</td><td><input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" /></td></tr> <td colspan="2">
<tr><td><?php echo get_string('fielddescription', 'data'); ?>:</td><td><input style="width:300px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" /></td></tr> <?php echo ($this->name()); ?>
<tr><td></td><td><input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> </td>
</tr>
<tr>
<td>
<?php echo get_string('fieldname', 'data'); ?>:
</td>
<td>
<input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fielddescription', 'data'); ?>:</td><td><input style="width:300px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" />
</td>
</tr>
<tr>
<td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"></td> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
</td>
</tr>
</table>
</form> </form>
</td></tr></table>

View file

@ -54,27 +54,25 @@ class data_field_menu extends data_field_base {
notify("that is not a valid field id!"); notify("that is not a valid field id!");
exit; exit;
} }
$content = '';
//look for that record and pull it out //look for that record and pull it out
if ($rid) { if ($rid) {
$datacontent = get_record('data_content','fieldid',$id,'recordid',$rid); $datacontent = get_record('data_content','fieldid',$id,'recordid',$rid);
if (isset($datacontent->content)) { if (isset($datacontent->content)) {
$content = $datacontent->content; $content = $datacontent->content;
}else {
$content = '';
} }
} }
$str .= '<table><tr><td>'; $str = '<div title="'.$field->description.'"><table><tr><td>';
/* /*
if ($field->description) { if ($field->description) {
$str .= '<img src="'.$CFG->pixpath.'/help.gif" alt="'.$field->description.'" title="'.$field->description.'">&nbsp;'; $str .= '<img src="'.$CFG->pixpath.'/help.gif" alt="'.$field->description.'" title="'.$field->description.'">&nbsp;';
} }
*/ */
$str .= '<div title="'.$field->description.'">';
$str .= get_string('menu','data').': </td><td>'; $str .= get_string('menu','data').': </td><td>';
$str .= '<select name="field_'.$field->id.' id="field_'.$field->id.'>'; $str .= '<select name="field_'.$field->id.'" id="field_'.$field->id.'">';
$str .= '<option value="">' . get_string('menuchoose', 'data') . '</option>'; $str .= '<option value="">' . get_string('menuchoose', 'data') . '</option>';
foreach (explode("\n",$field->param1) as $option) { foreach (explode("\n",$field->param1) as $option) {
@ -84,8 +82,7 @@ class data_field_menu extends data_field_base {
$str.='<option value="'.ltrim(rtrim($option)).'">'.ltrim(rtrim($option)).'</option>'; $str.='<option value="'.ltrim(rtrim($option)).'">'.ltrim(rtrim($option)).'</option>';
} }
} }
$str .= '</div>'; $str .= '</select></td></tr></table></div>';
$str .= '</select></td></tr></table>';
return $str; return $str;
} }

View file

@ -1,16 +1,16 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><Name><?php echo get_string('fieldname', 'data'); ?>:</td> <td><?php echo get_string('fieldname', 'data'); ?>:</td>
<td><input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" /></td> <td><input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" /></td>
</tr> </tr>
<tr> <tr>
@ -19,13 +19,13 @@
</tr> </tr>
<tr> <tr>
<td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td> <td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td><textarea style="width:300px; height:150px;" name="param1" id="param1"><?php if($field->param1) {echo $field->param1;} ?></textarea></td> <td><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($field->param1) {echo $field->param1;} ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -1,16 +1,16 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><Name><?php echo get_string('fieldname', 'data'); ?>:</td> <td><?php echo get_string('fieldname', 'data'); ?>:</td>
<td><input style="width:300px;" type="text" name="name" id="name" value="<?php echo($field->name); ?>" /></td> <td><input style="width:300px;" type="text" name="name" id="name" value="<?php echo($field->name); ?>" /></td>
</tr> </tr>
<tr> <tr>
@ -19,13 +19,13 @@
</tr> </tr>
<tr> <tr>
<td valign="top"><?php echo get_string('fieldoptions', 'data'); ?></td> <td valign="top"><?php echo get_string('fieldoptions', 'data'); ?></td>
<td><textarea style="width:300px; height:150px;" name="param1" id="param1"><?php if($field->param1) {echo $field->param1;} ?></textarea></td> <td><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($field->param1) {echo $field->param1;} ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -95,7 +95,7 @@ class data_field_picture extends data_field_file {// extends
} }
*/ */
$str .= '<div title="'.$field->description.'">'; $str .= '<div title="'.$field->description.'">';
$str .= '<input type="hidden" name ="field_'.$field->id.'_0" id="field_'.$field->id.'"_0 value="fakevalue" />'; $str .= '<input type="hidden" name ="field_'.$field->id.'_0" id="field_'.$field->id.'_0" value="fakevalue" />';
$str .= get_string('picture','data'). ': <input type="file" name ="field_'.$field->id.'" id="field_'.$field->id.'" /><br />'; $str .= get_string('picture','data'). ': <input type="file" name ="field_'.$field->id.'" id="field_'.$field->id.'" /><br />';
$str .= get_string('optionaldescription','data') .': <input type="text" name="field_' $str .= get_string('optionaldescription','data') .': <input type="text" name="field_'
.$field->id.'_1" id="field_'.$field->id.'_1" value="'.$des.'" /><br />'; .$field->id.'_1" id="field_'.$field->id.'_1" value="'.$des.'" /><br />';
@ -135,7 +135,7 @@ class data_field_picture extends data_field_file {// extends
if ($template == 'listtemplate') { if ($template == 'listtemplate') {
$width = $field->param4 ? ' width="'.$field->param4.'" ':' '; $width = $field->param4 ? ' width="'.$field->param4.'" ':' ';
$height = $field->param5 ? ' height="'.$field->param5.'" ':' '; $height = $field->param5 ? ' height="'.$field->param5.'" ':' ';
$str = '<a href="view.php?d='.$field->dataid.'&rid='.$recordid.'"><img '.$width.$height.' src="'.$source.'/'.$src.'" alt="'.$alt.'" title="'.$title.'" border="0" /></a>'; $str = '<a href="view.php?d='.$field->dataid.'&amp;rid='.$recordid.'"><img '.$width.$height.' src="'.$source.'/'.$src.'" alt="'.$alt.'" title="'.$title.'" border="0" /></a>';
} else { } else {
$width = $field->param1 ? ' width="'.$field->param1.'" ':' '; $width = $field->param1 ? ' width="'.$field->param1.'" ':' ';
$height = $field->param2 ? ' height="'.$field->param2.'" ':' '; $height = $field->param2 ? ' height="'.$field->param2.'" ':' ';

View file

@ -1,25 +1,73 @@
<table width="100%"><tr><td span="2"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <table width="100%">
<?php echo ($this->name()); ?></td></tr> <tr>
<tr><td><?php echo get_string('fieldname', 'data');?>:</td><td><input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" /></td></tr> <td colspan="2">
<tr><td><?php echo get_string('fielddescription', 'data');?>:</td><td><input style="width:300px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" /></td></tr> <?php echo ($this->name()); ?>
<tr><td><?php echo get_string('fieldwidthsingleview', 'data');?>:</td><td><input style="width:70px;" type="text" name="param1" id="param1" value = "<? if (!empty($field->param1)) echo $field->param1; ?>" /> </td>
<tr><td><?php echo get_string('fieldheightsingleview', 'data');?>:</td><td><input style="width:70px;" type="text" name="param2" id="param2" value = "<? if (!empty($field->param2)) echo $field->param2; ?>" /> </tr>
<tr><td><?php echo get_string('fieldwidthlistview', 'data');?>:</td><td><input style="width:70px;" type="text" name="param4" id="param4" value = "<? if (!empty($field->param4)) echo $field->param4; ?>" /> <tr>
<tr><td><?php echo get_string('fieldheightlistview', 'data');?>:</td><td><input style="width:70px;" type="text" name="param5" id="param5" value = "<? if (!empty($field->param5)) echo $field->param5; ?>" /> <td>
<tr><td><?php echo get_string('maxsize', 'data'); ?>:</td><td> <?php echo get_string('fieldname', 'data');?>:</td><td><input style="width:300px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fielddescription', 'data');?>:
</td>
<td>
<input style="width:300px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fieldwidthsingleview', 'data');?>:
</td>
<td>
<input style="width:70px;" type="text" name="param1" id="param1" value = "<? if (!empty($field->param1)) echo $field->param1; ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fieldheightsingleview', 'data');?>:
</td>
<td>
<input style="width:70px;" type="text" name="param2" id="param2" value = "<? if (!empty($field->param2)) echo $field->param2; ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fieldwidthlistview', 'data');?>:</td><td><input style="width:70px;" type="text" name="param4" id="param4" value = "<? if (!empty($field->param4)) echo $field->param4; ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fieldheightlistview', 'data');?>:
</td>
<td>
<input style="width:70px;" type="text" name="param5" id="param5" value = "<? if (!empty($field->param5)) echo $field->param5; ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('maxsize', 'data'); ?>:
</td>
<td>
<?php <?php
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes); $choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
choose_from_menu ($choices, "param3", $field->param3, ""); choose_from_menu ($choices, "param3", $field->param3, "");
?> ?>
</td> </td>
</tr> </tr>
<tr><td></td><td><input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" /> <tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"></td> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
</td>
</tr>
</table>
</form> </form>
</td></tr></table>

View file

@ -80,8 +80,8 @@ class data_field_radiobutton extends data_field_base {
foreach (explode("\n",$field->param1) as $radio) { foreach (explode("\n",$field->param1) as $radio) {
$radio = ltrim(rtrim($radio)); $radio = ltrim(rtrim($radio));
$str .= '<input type="radio" name="field_' . $field->id . '" id="field_'; $str .= '<input type="radio" name="field_' . $field->id . '" ';
$str .= $field->id . '" value="' . $radio . '" '; $str .= 'value="' . $radio . '" ';
if ($content == $radio) { if ($content == $radio) {
// Selected by user. // Selected by user.

View file

@ -1,11 +1,11 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
@ -19,13 +19,13 @@
</tr> </tr>
<tr> <tr>
<td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td> <td valign="top"><?php echo get_string('fieldoptions', 'data'); ?>:</td>
<td><textarea style="width:300px; height:150px;" name="param1" id="param1"><?php if($field->param1) {echo $field->param1;} ?></textarea></td> <td><textarea style="width:300px; height:150px;" name="param1" id="param1" cols="80" rows="10"><?php if($field->param1) {echo $field->param1;} ?></textarea></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -1,11 +1,11 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
@ -24,8 +24,8 @@
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -1,16 +1,16 @@
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<table width="100%"> <table width="100%">
<tr> <tr>
<td span="2"> <td colspan="2">
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
<?php echo ($this->name()); ?> <?php echo ($this->name()); ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><Name><?php echo get_string('fieldname', 'data'); ?>:</td> <td><?php echo get_string('fieldname', 'data'); ?>:</td>
<td><input style="width:300px;" type="text" name="name" id="name" value="<?php echo($field->name); ?>" /></td> <td><input style="width:300px;" type="text" name="name" id="name" value="<?php echo($field->name); ?>" /></td>
</tr> </tr>
<tr> <tr>
@ -28,8 +28,8 @@
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" \> <input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -71,13 +71,13 @@ class data_field_url extends data_field_base {// extends
$url = empty($contents[0])? 'http://':$contents[0]; $url = empty($contents[0])? 'http://':$contents[0];
$text = empty($contents[1])? '':$contents[1]; $text = empty($contents[1])? '':$contents[1];
$str = '<table><tr><td align="right">'; $str = '<div title="'.$field->description.'">';
$str .= '<table><tr><td align="right">';
/* /*
if ($field->description){ if ($field->description){
$str .= '<img src="'.$CFG->pixpath.'/help.gif" alt="'.$field->description.'" title="'.$field->description.'">&nbsp;'; $str .= '<img src="'.$CFG->pixpath.'/help.gif" alt="'.$field->description.'" title="'.$field->description.'">&nbsp;';
} }
*/ */
$str .= '<div title="'.$field->description.'">';
$str .= get_string('url','data').':</td><td><input type="text" name="field_'.$field->id.'_0" id="field_'.$field->id.'_0" value="'.$url.'" /></td></tr>'; $str .= get_string('url','data').':</td><td><input type="text" name="field_'.$field->id.'_0" id="field_'.$field->id.'_0" value="'.$url.'" /></td></tr>';
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$field->id.'_1" id="field_'.$field->id.'_1" value="'.$text.'" /></td></tr>'; $str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$field->id.'_1" id="field_'.$field->id.'_1" value="'.$text.'" /></td></tr>';
$str .= '</table>'; $str .= '</table>';

View file

@ -1,14 +1,36 @@
<table width="100%"><tr><td span="2"> <form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="post">
<form name="fieldsubform" action="<?php echo $CFG->wwwroot; ?>/mod/data/fields.php?d=<?php echo ($field->dataid); ?>" method="POST"> <table width="100%">
<?php echo ($this->name()); ?></td></tr> <tr>
<tr><td><Name><?php echo get_string('fieldname', 'data'); ?>:</td><td><input style="width:350px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" /></td></tr> <td colspan="2">
<tr><td><?php echo get_string('fielddescription', 'data'); ?>:</td><td><input style="width:350px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" /></td></tr> <?php echo ($this->name()); ?>
<tr><td></td><td><input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" /> </td>
</tr>
<tr>
<td>
<?php echo get_string('fieldname', 'data'); ?>:
</td>
<td>
<input style="width:350px;" type="text" name="name" id="name" value = "<?php echo($field->name); ?>" />
</td>
</tr>
<tr>
<td>
<?php echo get_string('fielddescription', 'data'); ?>:
</td>
<td>
<input style="width:350px;" type="text" name="description" id="description" value = "<? echo ($field->description);?>" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="<?php if ($newfield) {echo get_string('add');} else {echo get_string('save','data');} ?>" />
<input type="hidden" name="fid" value="<?php echo ($field->id); ?>" /> <input type="hidden" name="fid" value="<?php echo ($field->id); ?>" />
<input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" /> <input type="hidden" name="mode" value="<?php if ($newfield) {echo 'add';} else {echo 'update';} ?>" />
<input type="hidden" name="type" value="<?php echo $this->type; ?>" /> <input type="hidden" name="type" value="<?php echo $this->type; ?>" />
<input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" \> <input type="submit" value="<?php echo get_string('cancel'); ?>" onclick="document.fieldsubform.mode.value='void';" />
<input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden"></td> <input name="sesskey" value="<?php echo sesskey(); ?>" type="hidden" />
</td>
</tr>
</table>
</form> </form>
</td></tr></table>

View file

@ -143,7 +143,7 @@
echo '<input name="confirm" value="1" type="hidden" />'; echo '<input name="confirm" value="1" type="hidden" />';
echo '<strong>'.$field->name.'</strong> - '.get_string('confirmdeletefield','data'); echo '<strong>'.$field->name.'</strong> - '.get_string('confirmdeletefield','data');
echo '<p />'; echo '<p />';
echo '<input type="submit" value="'.get_string('ok').'"> '; echo '<input type="submit" value="'.get_string('ok').'" /> ';
echo '<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1);" />'; echo '<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1);" />';
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
@ -215,9 +215,11 @@
else if ($mode != 'display'){ //display main form - add new, update, delete else if ($mode != 'display'){ //display main form - add new, update, delete
echo '<form name="fieldform" action="fields.php?d='.$data->id.'&amp;" method="POST">'; //echo '<form name="fieldform" action="fields.php?d='.$data->id.'&amp;" method="POST">';
echo '<input type="hidden" name="mode" value="">'; echo '<form name="fieldform" action="fields.php" method="post">';
echo '<input name="sesskey" value="'.sesskey().'" type="hidden">'; echo '<input name="d" type="hidden" value="'.$data->id.'" />';
echo '<input type="hidden" name="mode" value="" />';
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
print_simple_box_start('center','50%'); print_simple_box_start('center','50%');
///New fields ///New fields
@ -249,12 +251,10 @@
echo '<tr><td align="center">'; echo '<tr><td align="center">';
echo '<a href="fields.php?d='.$data->id.'&amp;mode=display&amp;fid='.$field->id.'&amp;sesskey='.sesskey().'">'; echo '<a href="fields.php?d='.$data->id.'&amp;mode=display&amp;fid='.$field->id.'&amp;sesskey='.sesskey().'">';
echo '<img src="'.$CFG->pixpath.'/t/edit.gif" echo '<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>';
height="11" width="11" border="0" alt="'.get_string('edit').'" /></a>';
echo '&nbsp;'; echo '&nbsp;';
echo '<a href="fields.php?d='.$data->id.'&amp;mode=delete&amp;fid='.$field->id.'&amp;sesskey='.sesskey().'">'; echo '<a href="fields.php?d='.$data->id.'&amp;mode=delete&amp;fid='.$field->id.'&amp;sesskey='.sesskey().'">';
echo '<img src="'.$CFG->pixpath.'/t/delete.gif" echo '<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
height="11" width="11" border="0" alt="'.get_string('delete').'" /></a>';
echo '</td>'; echo '</td>';
///Print Fieldname Column ///Print Fieldname Column

View file

@ -303,10 +303,11 @@ function data_generate_empty_add_form($id, $rid=0){
//this only applies to add and single template //this only applies to add and single template
$str .= '<div align="center">'; $str .= '<div align="center">';
$str .= '<table><tr>'; $str .= '<table>';
foreach ($fields as $cfield){ foreach ($fields as $cfield){
$str .= '<tr>';
$str .= '<td valign="top" align="right">'; $str .= '<td valign="top" align="right">';
$str .= $cfield->name.':'; $str .= $cfield->name.':';
$str .= '</td>'; $str .= '</td>';
@ -315,11 +316,12 @@ function data_generate_empty_add_form($id, $rid=0){
$g = data_get_field($cfield); $g = data_get_field($cfield);
$str .= $g->display_add_field($cfield->id,$rid); $str .= $g->display_add_field($cfield->id,$rid);
$str .= '</td>'; $str .= '</td>';
$str .= '</tr>';
unset($g); unset($g);
} }
$str .= '</tr></table>'; $str .= '</table>';
$str .= '</div><p></p>'; $str .= '</div>';
} }
@ -835,7 +837,7 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />'; echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
echo '<table id="sortsearch" align="center">'; echo '<table id="sortsearch" align="center">';
echo '<tr>'. echo '<tr>'.
'<td class="c0 r1"><label for="perpage">'.get_string('pagesize','data').':</label></td>'; '<td class="c0 r1">'.get_string('pagesize','data').':</td>';
echo '<td class="c1 r1">'; 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, $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); 20=>20,30=>30,40=>40,50=>50,100=>100,200=>200,300=>300,400=>400,500=>500,1000=>1000);
@ -846,7 +848,7 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
'<td class="c1 r0"><input type="text" size="16" name="search" value="'.s($search).'" /></td>'. '<td class="c1 r0"><input type="text" size="16" name="search" value="'.s($search).'" /></td>'.
'</tr>'; '</tr>';
echo '<tr>'; echo '<tr>';
echo '<tr><td class="c0 r2">'; echo '<td class="c0 r2">';
echo get_string('sortby').':'; echo get_string('sortby').':';
echo '</td><td class="c1 r2">'; echo '</td><td class="c1 r2">';
//foreach field, print the option //foreach field, print the option
@ -862,15 +864,16 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
echo '</select>'; echo '</select>';
echo '<select name="order">'; echo '<select name="order">';
if ($order == "ASC") { if ($order == "ASC") {
echo '<option value="ASC" SELECTED>'.get_string('ascending','data').'</option>'; echo '<option value="ASC" selected="selected">'.get_string('ascending','data').'</option>';
} else { } else {
echo '<option value="ASC">'.get_string('ascending','data').'</option>'; echo '<option value="ASC">'.get_string('ascending','data').'</option>';
} }
if ($order == "DESC") { if ($order == "DESC") {
echo '<option value="DESC" SELECTED>'.get_string('descending','data').'</option>'; echo '<option value="DESC" selected="selected">'.get_string('descending','data').'</option>';
} else { } else {
echo '<option value="DESC">'.get_string('descending','data').'</option>'; echo '<option value="DESC">'.get_string('descending','data').'</option>';
} }
echo '</select>';
//print ASC or DESC //print ASC or DESC
echo '</td></tr><tr>'; echo '</td></tr><tr>';
echo '<td colspan="2" align="center" class="r3">'; echo '<td colspan="2" align="center" class="r3">';
@ -881,7 +884,7 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
//silly function that prints a button //silly function that prints a button
function data_print_approve_button($recordid, $d, $page='0', $rid='0', $search='', $sort='', $order='') { function data_print_approve_button($recordid, $d, $page='0', $rid='0', $search='', $sort='', $order='') {
$str= '<div align="center"><form action="approve.php" method="GET">'; $str= '<div align="center"><form action="approve.php" method="get">';
$str.= '<input type="hidden" name="d" value="'.$d.'" />'; $str.= '<input type="hidden" name="d" value="'.$d.'" />';
$str.= '<input type="hidden" name="rid" value="'.$rid.'" />'; $str.= '<input type="hidden" name="rid" value="'.$rid.'" />';
$str.= '<input type="hidden" name="page" value="'.$page.'" />'; $str.= '<input type="hidden" name="page" value="'.$page.'" />';
@ -1055,7 +1058,7 @@ function data_print_comments($data, $record , $search, $template, $sort, $page=0
} }
//prints silly comment form //prints silly comment form
echo '<p /><div align="center"><form method="POST" action="comment.php">'; echo '<p /><div align="center"><form method="post" action="comment.php">';
echo '<input type="hidden" name="mode" value="add" />'; echo '<input type="hidden" name="mode" value="add" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="recordid" value="'.$record->id.'" />'; echo '<input type="hidden" name="recordid" value="'.$record->id.'" />';

View file

@ -37,7 +37,7 @@
$row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/add.php?d='.$data->id, get_string('add','data')); $row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/add.php?d='.$data->id, get_string('add','data'));
} }
if (isteacher($course->id)) { if (isteacher($course->id)) {
$row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&mode=singletemplate', get_string('templates','data')); $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&amp;mode=singletemplate', get_string('templates','data'));
$row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/fields.php?d='.$data->id, get_string('fields','data')); $row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/fields.php?d='.$data->id, get_string('fields','data'));
} }

View file

@ -116,8 +116,8 @@
echo '<div align="center">'.get_string('header'.$mode,'data').'</div><br />'; echo '<div align="center">'.get_string('header'.$mode,'data').'</div><br />';
echo '<form name="tempform" action="templates.php?d='.$data->id.'&amp;mode='.$mode.'" method="POST">'; echo '<form name="tempform" action="templates.php?d='.$data->id.'&amp;mode='.$mode.'" method="post">';
echo '<input name="sesskey" value="'.sesskey().'" type="hidden">'; echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
//print button to autogen all forms, if all templates are empty //print button to autogen all forms, if all templates are empty
$data = get_record('data', 'id', $d); //reload because of possible updates so far! $data = get_record('data', 'id', $d); //reload because of possible updates so far!
@ -137,7 +137,6 @@
if ($fields = get_records('data_fields','dataid',$data->id)){ if ($fields = get_records('data_fields','dataid',$data->id)){
foreach ($fields as $field) { foreach ($fields as $field) {
echo '<option value="[['.$field->name.']]">'.$field->name.' ('.$field->type.')</option>'; echo '<option value="[['.$field->name.']]">'.$field->name.' ('.$field->type.')</option>';
echo '[['.$field->name.']]'.'<br />';
} }
} }
//print special tags //print special tags

View file

@ -197,6 +197,7 @@
//if not editting teacher, check whether user has sufficient records to view //if not editting teacher, check whether user has sufficient records to view
if (!isteacheredit($course->id) and data_numentries($data) < $data->requiredentriestoview){ if (!isteacheredit($course->id) and data_numentries($data) < $data->requiredentriestoview){
notify (($data->requiredentriestoview - data_numentris(data)).'&nbsp;'.get_string('insufficiententries','data')); notify (($data->requiredentriestoview - data_numentris(data)).'&nbsp;'.get_string('insufficiententries','data'));
echo '</td></tr></table>';
print_footer($course); print_footer($course);
exit; exit;
} }
@ -340,6 +341,7 @@
} }
data_print_preference_form($data, $perpage, $search); data_print_preference_form($data, $perpage, $search);
echo '</td></tr></table>';
print_footer($course); print_footer($course);
exit; exit;
} }
@ -372,8 +374,7 @@
data_print_preference_form($data, $perpage, $search, $sort, $order); data_print_preference_form($data, $perpage, $search, $sort, $order);
/// Finish the page // Finish the page
echo '</td></tr></table>'; echo '</td></tr></table>';
print_footer($course); print_footer($course);