[geeklog-devel] Feature Request: ADMIN_list (2 requests)

Joe Mucchiello joe at ThrowingDice.com
Tue Aug 21 15:17:10 EDT 2007


Can you make it possible to name checkboxes used in the delete option?

         if (is_array($options) AND $options['chkdelete']) {
             $delitemtext = isset($options['chkitem']) ? 
$options['chkitem'] : 'delitem';  // new line
             $admin_templates->set_var('class', "admin-list-field");
             $admin_templates->set_var('itemtext', '<input 
type="checkbox" name="'.$delitemtext.'[]" value="' . 
$A[$options['chkfield']].'">');
             $admin_templates->parse('item_field', 'field', true);
         }

     if (is_array($options) AND $options['chkdelete']) {
         $delitemtext = isset($options['chkitem']) ? 
$options['chkitem'] : 'delitem';  // new line
         $admin_templates->set_var('header_text', '<input 
type="checkbox" name="chk_selectall" title="'.$LANG01[126].'" 
onclick="caItemsExt(this.form,'."'$delitemtext'".');">');

Probably would need to make a second caItems javascript function so 
you don't have to modify all the calls to caItems throughout the code.

    function caItemsExt(f, delitem) {
        var n=f.elements.length;
        for (i=0;i<n; i++) {
            var field=f.elements[i];
            if (field.type == 'checkbox' && field.name.match(delitem)) {
                 if (f.chk_selectall.checked) {
                     field.checked=true;
                 } else {
                     field.checked=false;
                 }
            }
        }
    }

Another ADMIN_list request: How about making a way to add more 
buttons to the row where the trash can appears? I believe it is in 
admin/lists/list.thtml. Perhaps add an $options['buttons_below'] and 
then put a {buttons_below} into that thtml:

                             <div style="padding:5px 0px 0px 
9px;{show_deleteimage}">
                                 <input type="image" 
src="{layout_url}/images/deleteitem.png" title="{lang_deleteall}" 
onclick="return confirm('{lang_delconfirm}');">
                                 {buttons_below}
                             </div>

// and then something like would be necessary
     if (count($data_arr) > 1 AND is_array($options) AND 
($options['chkdelete'] OR $options['buttons_below']) {
         if ($options['chkdelete']) {
             $admin_templates->set_var('header_text', '<input 
type="checkbox" name="chk_selectall" title="'.$LANG01[126].'" 
onclick="caItems(this.form);">');
             $admin_templates->set_var('show_deleteimage', '');
         }
         if ($options['buttons_below']) {
             $admin_templates->set_var('buttons_below', 
$options['buttons_below']);
         }
         $admin_templates->set_var('class', "admin-list-headerfield");
         $admin_templates->parse('header_row', 'header', true);
         $admin_templates->clear_var('on_click');
     } else {
         $admin_templates->set_var('show_deleteimage','display:none;');
     }


----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list