]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
using built-in elgg checkbox view rather than custom
authorCash Costello <cash.costello@gmail.com>
Sat, 20 Jun 2009 15:09:01 +0000 (15:09 +0000)
committerCash Costello <cash.costello@gmail.com>
Sat, 20 Jun 2009 15:09:01 +0000 (15:09 +0000)
actions/edit.php
views/default/input/cover_checkbox.php [deleted file]
views/default/tidypics/forms/edit.php

index 359e83fb063a3de456e78b0fbe9ee7bac61daa39..f5c66a1d87f1b09dd472f89ba215ec566d01f5a9 100644 (file)
@@ -15,6 +15,8 @@
        $access  = get_input('access_id');\r
        $tags    = get_input('tidypicstags');\r
        $subtype = get_input('subtype');\r
+       $cover   = get_input('cover');\r
+       if (is_array($cover)) $cover = $cover[0];\r
        \r
        $container_guid = get_input('container_guid');\r
 \r
@@ -59,7 +61,7 @@
        }\r
 \r
        //if cover meta is sent from image save as metadata\r
-       if ($subtype == 'image' && get_input('cover') == elgg_echo('album:cover:yes')) {\r
+       if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {\r
                $album = get_entity($container_guid); \r
                $album->cover = $entity->guid;\r
        }\r
diff --git a/views/default/input/cover_checkbox.php b/views/default/input/cover_checkbox.php
deleted file mode 100644 (file)
index 0413266..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php\r
-\r
-       /**\r
-        * Elgg custom checkbox input used to define an album cover \r
-        * @ forms/edit.php\r
-        * i made custom check box because the default checkboxes allows for more than one box.\r
-        * it handles the checkboxes via arrays, but i only need one and i did not want to use time figuring it all out\r
-        * simple and sweet , one checkbox.\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 checkbox field\r
-        * \r
-        */\r
-
-       $class = $vars['class'];
-       if (!$class) $class = "input-checkboxes";
-\r
-    foreach($vars['options'] as $label => $option) {\r
-
-           if ($option != $vars['value']) {\r
-               $selected = "";\r
-           } else {\r
-                       $selected = "checked = \"checked\"";\r
-           }\r
-\r
-        $labelint = (int) $label;\r
-        if ("{$label}" == "{$labelint}") {\r
-               $label = $option;\r
-        }
-        
-        $disabled = "";
-        if ($vars['disabled']) $disabled = ' disabled="yes" '; \r
-        echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" {$selected} value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";\r
-    }\r
-\r
-?> 
\ No newline at end of file
index 533852413be45a5589e0e19fd77bfb51ded3bd19..a504cde607f838585bb0ff6aa2105ba7cbeeabbe 100644 (file)
 \r
 <?php\r
                if ($subtype == 'image') {\r
-                       // should this album be the cover for the album\r
-                       \r
-                       // try to determine if it is already the cover - the pass of this variable doesn't work - leave for next version\r
-                       $guid = $vars['entity']->guid;\r
                        $container_guid = $vars['entity']->container_guid;\r
-                       $cover_guid = get_entity($container_guid)->cover;\r
-                       if($cover_guid == $vars['entity']->guid)\r
-                               $cover = 'yes';\r
+                       \r
+                       // should this image be the cover for the album - only ask for non-cover photos\r
+                       // determine if it is already the cover\r
+                       $img_guid = $vars['entity']->guid;\r
+                       $album = get_entity($container_guid);\r
+                       $cover_guid = $album->cover;\r
+                       \r
+                       if ($cover_guid != $img_guid) { \r
                        \r
 ?>\r
                <p>\r
-                       <label><?php echo elgg_echo("album:cover"); ?></label>\r
-                       <?php  echo elgg_view("input/cover_checkbox", array( "internalname" => "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes'))));  ?>\r
+<?php                  echo elgg_view('input/checkboxes', array('internalname' => "cover", \r
+                                                                                                       'options' => array(elgg_echo("album:cover")),\r
+                                                                                                       ));\r
+?>\r
                </p>\r
 <?php\r
+                       }\r
+                       \r
                } else {\r
                        // album so display access control\r
 ?>\r