// Make sure we're logged in (send us to the front page if not)\r
if (!isloggedin()) forward();\r
\r
- // Get input data \r
- $cover = get_input('cover');\r
+ // Get input data\r
$title_array = get_input('title');\r
$caption_array = get_input('caption');\r
$tags_array = get_input('tags');\r
$image_guid_array = get_input('image_guid');\r
$container_guid = get_input('container_guid');\r
$album_entity = get_entity($container_guid);\r
+ $cover = get_input('cover');\r
$not_updated = array();\r
\r
- foreach($image_guid_array as $key => $im) { \r
+ foreach($image_guid_array as $key => $im) {\r
$image = get_entity($im);\r
- \r
+ \r
if ($image->canEdit()) {\r
\r
// Convert string of tags into a preformatted array\r
\r
//set description appropriately\r
$image->title = $title_array[$key];\r
- \r
+ \r
//set description appropriately\r
$image->description = $caption_array[$key];\r
\r
}\r
\r
//if cover meta is sent from image save as metadata\r
- if ($cover == $im) { \r
+ if ($cover == $im) {\r
$album_entity->cover = $im;\r
}\r
}\r
+++ /dev/null
-<?php\r
-\r
- /**\r
- * Multi radio input\r
- * This is for selection of cover image\r
- * \r
- * \r
- * @uses $vars['value'] The current value, if any\r
- * @uses $vars['js'] Any Javascript to enter into the input tag\r
- * @uses $vars['internalname'] The name of the input field\r
- * @uses $vars['options'] An array of strings representing the options for the radio field\r
- * \r
- */\r
-\r
- $class = $vars['class'];\r
- if (!$class) $class = "input-checkboxes";\r
-\r
- foreach($vars['options'] as $label => $option) {\r
-\r
- if ($vars['set'] != $vars['value']) {\r
- $selected = "";\r
- } else {\r
- $selected = "checked = \"checked\"";\r
- }\r
-\r
- $labelint = (int) $label;\r
- if ("{$label}" == "{$labelint}") {\r
- $label = $option;\r
- }\r
- \r
- $disabled = "";\r
- if ($vars['disabled']) $disabled = ' disabled="yes" '; \r
- 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 />";\r
- }\r
-\r
-?>
\ No newline at end of file
<?php\r
\r
$file_array = $vars['file_array'];\r
+ \r
+ // make sure one of the images becomes the cover if there isn't one already\r
$album_entity = get_entity($vars['album_guid']);\r
- if(!$album_entity->cover) $no_cover = true;\r
+ if (!$album_entity->cover) $no_cover = true;\r
\r
- foreach($file_array as $key => $file_guid){\r
+ foreach ($file_array as $key => $file_guid){\r
$entity = get_entity($file_guid);\r
$guid = $entity->guid;\r
$body = $entity->description;\r
$tags = $entity->tags;\r
$container_guid = $entity->container_guid;\r
- if($no_cover && !$cover) $cover = $guid;\r
- \r
- echo '<div class="tidypics_edit_image_container">'; \r
- echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="tidypics_edit_images" alt="' . $title . '"/>';\r
- echo '<div class="tidypics_image_info">';\r
- echo '<p><label>' . elgg_echo('album:title') . '</label>';\r
- echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";\r
- echo '</p>';\r
- echo '<p><label>' . elgg_echo('caption') . "</label>";\r
- echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n";\r
- echo "</p>";\r
- echo '<p><label>' . elgg_echo("tags") . "</label>\n";\r
- echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";\r
- echo '</p>';\r
- echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";\r
- echo '<label>' . elgg_echo("album:cover") . '</label>';\r
- echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array(elgg_echo('album:cover:yes')), 'set' => $cover));\r
- echo '</div>';\r
- echo '</div>';\r
\r
+ // first one is default cover if there isn't one already\r
+ if ($no_cover) {\r
+ $val = $guid;\r
+ $no_cover = false;\r
+ }\r
+ \r
+ echo '<div class="tidypics_edit_image_container">';\r
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="tidypics_edit_images" alt="' . $title . '"/>';\r
+ echo '<div class="tidypics_image_info">';\r
+ echo '<p><label>' . elgg_echo('album:title') . '</label>';\r
+ echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";\r
+ echo '</p>';\r
+ echo '<p><label>' . elgg_echo('caption') . "</label>";\r
+ echo elgg_view("input/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\n";\r
+ echo "</p>";\r
+ echo '<p><label>' . elgg_echo("tags") . "</label>\n";\r
+ echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";\r
+ echo '</p>';\r
+ echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";\r
+ \r
+ echo elgg_view("input/radio", array("internalname" => "cover",\r
+ "value" => $val,\r
+ 'options' => array( elgg_echo('album:cover') => $guid,\r
+ ),\r
+ ));\r
+ echo '</div>';\r
+ echo '</div>';\r
}\r
+ \r
?>\r
-<input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" /> \r
+<input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />\r
<p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>\r
</form>\r
</div>
\ No newline at end of file