aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-06-20 16:05:56 +0000
committerCash Costello <cash.costello@gmail.com>2009-06-20 16:05:56 +0000
commitbf9291c23b5fe587e2226bf73c317bf76ea686a6 (patch)
treed74d90cf30c365cb473e8a5404c17706a5ac9ef9
parentc118d77f0625fa70fe3cdadb23bcbeea96a0768c (diff)
downloadelgg-bf9291c23b5fe587e2226bf73c317bf76ea686a6.tar.gz
elgg-bf9291c23b5fe587e2226bf73c317bf76ea686a6.tar.bz2
now using built-in radio input view
-rw-r--r--actions/edit_multi.php12
-rw-r--r--views/default/input/multi_radio.php36
-rw-r--r--views/default/tidypics/forms/edit_multi.php55
3 files changed, 39 insertions, 64 deletions
diff --git a/actions/edit_multi.php b/actions/edit_multi.php
index a857e92d7..7c03244a5 100644
--- a/actions/edit_multi.php
+++ b/actions/edit_multi.php
@@ -7,19 +7,19 @@
// Make sure we're logged in (send us to the front page if not)
if (!isloggedin()) forward();
- // Get input data
- $cover = get_input('cover');
+ // Get input data
$title_array = get_input('title');
$caption_array = get_input('caption');
$tags_array = get_input('tags');
$image_guid_array = get_input('image_guid');
$container_guid = get_input('container_guid');
$album_entity = get_entity($container_guid);
+ $cover = get_input('cover');
$not_updated = array();
- foreach($image_guid_array as $key => $im) {
+ foreach($image_guid_array as $key => $im) {
$image = get_entity($im);
-
+
if ($image->canEdit()) {
// Convert string of tags into a preformatted array
@@ -27,7 +27,7 @@
//set description appropriately
$image->title = $title_array[$key];
-
+
//set description appropriately
$image->description = $caption_array[$key];
@@ -43,7 +43,7 @@
}
//if cover meta is sent from image save as metadata
- if ($cover == $im) {
+ if ($cover == $im) {
$album_entity->cover = $im;
}
}
diff --git a/views/default/input/multi_radio.php b/views/default/input/multi_radio.php
deleted file mode 100644
index 3e3bb1649..000000000
--- a/views/default/input/multi_radio.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
- /**
- * Multi radio input
- * This is for selection of cover image
- *
- *
- * @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- * @uses $vars['options'] An array of strings representing the options for the radio field
- *
- */
-
- $class = $vars['class'];
- if (!$class) $class = "input-checkboxes";
-
- foreach($vars['options'] as $label => $option) {
-
- if ($vars['set'] != $vars['value']) {
- $selected = "";
- } else {
- $selected = "checked = \"checked\"";
- }
-
- $labelint = (int) $label;
- if ("{$label}" == "{$labelint}") {
- $label = $option;
- }
-
- $disabled = "";
- if ($vars['disabled']) $disabled = ' disabled="yes" ';
- echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" {$selected} value=\"".htmlentities($vars['value'], null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";
- }
-
-?> \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
index 24755e9cf..01ffb3128 100644
--- a/views/default/tidypics/forms/edit_multi.php
+++ b/views/default/tidypics/forms/edit_multi.php
@@ -8,38 +8,49 @@
<?php
$file_array = $vars['file_array'];
+
+ // make sure one of the images becomes the cover if there isn't one already
$album_entity = get_entity($vars['album_guid']);
- if(!$album_entity->cover) $no_cover = true;
+ if (!$album_entity->cover) $no_cover = true;
- foreach($file_array as $key => $file_guid){
+ foreach ($file_array as $key => $file_guid){
$entity = get_entity($file_guid);
$guid = $entity->guid;
$body = $entity->description;
$tags = $entity->tags;
$container_guid = $entity->container_guid;
- if($no_cover && !$cover) $cover = $guid;
-
- echo '<div class="tidypics_edit_image_container">';
- echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="tidypics_edit_images" alt="' . $title . '"/>';
- echo '<div class="tidypics_image_info">';
- echo '<p><label>' . elgg_echo('album:title') . '</label>';
- echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";
- echo '</p>';
- echo '<p><label>' . elgg_echo('caption') . "</label>";
- echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n";
- echo "</p>";
- echo '<p><label>' . elgg_echo("tags") . "</label>\n";
- echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";
- echo '</p>';
- echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";
- echo '<label>' . elgg_echo("album:cover") . '</label>';
- echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array(elgg_echo('album:cover:yes')), 'set' => $cover));
- echo '</div>';
- echo '</div>';
+ // first one is default cover if there isn't one already
+ if ($no_cover) {
+ $val = $guid;
+ $no_cover = false;
+ }
+
+ echo '<div class="tidypics_edit_image_container">';
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="tidypics_edit_images" alt="' . $title . '"/>';
+ echo '<div class="tidypics_image_info">';
+ echo '<p><label>' . elgg_echo('album:title') . '</label>';
+ echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";
+ echo '</p>';
+ echo '<p><label>' . elgg_echo('caption') . "</label>";
+ echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n";
+ echo "</p>";
+ echo '<p><label>' . elgg_echo("tags") . "</label>\n";
+ echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";
+ echo '</p>';
+ echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";
+
+ echo elgg_view("input/radio", array("internalname" => "cover",
+ "value" => $val,
+ 'options' => array( elgg_echo('album:cover') => $guid,
+ ),
+ ));
+ echo '</div>';
+ echo '</div>';
}
+
?>
-<input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+<input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
<p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
</form>
</div> \ No newline at end of file