Skip to content
Snippets Groups Projects
Commit cb0df242 authored by Jared Hancock's avatar Jared Hancock
Browse files

Fix bug when creating a new dynamic list

parent e055cc21
No related branches found
No related tags found
No related merge requests found
...@@ -49,12 +49,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -49,12 +49,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<?php } ?> <?php } ?>
</select></td> </select></td>
</tr> </tr>
<tr>
<td width="180">Description:</td>
<td><textarea name="notes" rows="3" cols="40"><?php
echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2"> <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
...@@ -67,6 +61,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -67,6 +61,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
$showing=$pageNav->showing().' list items'; $showing=$pageNav->showing().' list items';
?> ?>
<?php } <?php }
else $showing = 'Add a few initial items to the list';
?> ?>
<tr> <tr>
<th colspan="4"> <th colspan="4">
...@@ -76,7 +71,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -76,7 +71,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<tr> <tr>
<th>Delete</th> <th>Delete</th>
<th>Value</th> <th>Value</th>
<th>Extra</th> <th>Extra <em style="display:inline">&mdash; abbreviations and such</em></th>
</tr> </tr>
</thead> </thead>
<tbody <?php if ($info['sort_mode'] == 'SortCol') { ?> <tbody <?php if ($info['sort_mode'] == 'SortCol') { ?>
...@@ -85,7 +80,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -85,7 +80,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
$icon = ($info['sort_mode'] == 'SortCol') $icon = ($info['sort_mode'] == 'SortCol')
? '<i class="icon-sort"></i>&nbsp;' : ''; ? '<i class="icon-sort"></i>&nbsp;' : '';
if ($list) { if ($list) {
foreach ($list->getItems($pageNav->getLimit(), $pageNav->getStart()) as $i) { foreach ($list->getItems() as $i) {
$id = $i->get('id'); ?> $id = $i->get('id'); ?>
<tr> <tr>
<td><?php echo $icon; ?> <td><?php echo $icon; ?>
...@@ -94,7 +89,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -94,7 +89,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
value="<?php echo $i->get('sort'); ?>"/></td> value="<?php echo $i->get('sort'); ?>"/></td>
<td><input type="text" size="40" name="value-<?php echo $id; ?>" <td><input type="text" size="40" name="value-<?php echo $id; ?>"
value="<?php echo $i->get('value'); ?>"/></td> value="<?php echo $i->get('value'); ?>"/></td>
<td><input type="text" size="20" name="extra-<?php echo $id; ?>" <td><input type="text" size="30" name="extra-<?php echo $id; ?>"
value="<?php echo $i->get('extra'); ?>"/></td> value="<?php echo $i->get('extra'); ?>"/></td>
</tr> </tr>
<?php } <?php }
...@@ -104,15 +99,24 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -104,15 +99,24 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<td><?php echo $icon; ?> <em>add</em> <td><?php echo $icon; ?> <em>add</em>
<input type="hidden" name="sort-new-<?php echo $i; ?>"/></td> <input type="hidden" name="sort-new-<?php echo $i; ?>"/></td>
<td><input type="text" size="40" name="value-new-<?php echo $i; ?>"/></td> <td><input type="text" size="40" name="value-new-<?php echo $i; ?>"/></td>
<td><input type="text" size="20" name="extra-new-<?php echo $i; ?>"/></td> <td><input type="text" size="30" name="extra-new-<?php echo $i; ?>"/></td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
<tbody>
<tr>
<th colspan="7">
<em><strong>Internal Notes:</strong> be liberal, they're internal</em>
</th>
</tr>
<tr>
<td colspan="7"><textarea name="notes" rows="6" cols="80" style="width:95%"><?php
echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody>
</table>
</table> </table>
<?php
if ($count) //Show options..
echo '<div>&nbsp;Page:'.$pageNav->getPageLinks().'&nbsp;</div>';
?>
<p style="padding-left:225px;"> <p style="padding-left:225px;">
<input type="submit" name="submit" value="<?php echo $submit_text; ?>"> <input type="submit" name="submit" value="<?php echo $submit_text; ?>">
<input type="reset" name="reset" value="Reset"> <input type="reset" name="reset" value="Reset">
......
...@@ -31,9 +31,11 @@ if($_POST) { ...@@ -31,9 +31,11 @@ if($_POST) {
case 'add': case 'add':
$list = DynamicList::create(array( $list = DynamicList::create(array(
'name'=>$_POST['name'], 'name'=>$_POST['name'],
'name_plural'=>$_POST['name_plural'],
'sort_mode'=>$_POST['sort_mode'],
'notes'=>$_POST['notes'])); 'notes'=>$_POST['notes']));
if ($list->isValid()) if ($list->isValid())
$list->save(); $list->save(true);
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment