vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Checkbox/Upload fields in AdminCP (https://vborg.vbsupport.ru/showthread.php?t=315335)

TheAdminMarket 11-09-2014 02:09 PM

Checkbox/Upload fields in AdminCP
 
Hello,

Does anyone knows the syntax (in case that they're supporting) for fieldtype:
  • Checkbox
  • File (Upload)
eg something similar that I found for textarea:
Code:

print_textarea_row
print_yes_no_row
print_select_row

I know that I can use print_yesno_row instead of checkbox but I prefer checkbox. The most important is the File (Upload) to avoid using standard HTML there.

Thank you

nerbert 11-09-2014 02:35 PM

I've edited my adminfunctions.php file so I'm not sure I have the line numbers correct, I'm looking at the old version for vB 4.2.0

print_checkbox_row(), line 1104

print_upload_row(), line 1175

EDIT: Well, since I have the file open ....

PHP Code:

/**
* Prints a row containing an <input type="checkbox" />
*
* @param    string    Title for row
* @param    string    Name for checkbox
* @param    boolean    Whether or not to check the box
* @param    string    Value for checkbox
* @param    string    Text label for checkbox
* @param    string    Optional Javascript code to run when checkbox is clicked - example: ' onclick="do_something()"'
*/
function print_checkbox_row($title$name$checked true$value 1$labeltext ''$onclick '')
{
    global 
$vbphrase$vbulletin;

    if (
$labeltext == '')
    {
        
$labeltext $vbphrase['yes'];
    }

    
$uniqueid fetch_uniqueid_counter();

    
print_label_row(
        
"<label for=\"{$name}_$uniqueid\">$title</label>",
        
"<div id=\"ctrl_$name\"><label for=\"{$name}_$uniqueid\" class=\"smallfont\"><input type=\"checkbox\" name=\"$name\" id=\"{$name}_$uniqueid\" value=\"$value\" tabindex=\"1\"" iif($onclick" onclick=\"$onclick\"") . iif($vbulletin->debug" title=\"name=&quot;$name&quot;\"") . iif($checked' checked="checked"') . " /><strong>$labeltext</strong></label></div>",
        
'''top'$name
    
);


PHP Code:

/**
* Prints a row containing an <input type="file" />
*
* @param    string    Title for row
* @param    string    Name for file upload field
* @param    integer    Max uploaded file size in bytes
* @param    integer    Size of file upload field
*/
function print_upload_row($title$name$maxfilesize 1000000$size 35)
{
    global 
$vbulletin;

    
construct_hidden_code('MAX_FILE_SIZE'$maxfilesize);

    
// Don't style the file input for Opera or Firefox 3. #25838
    
$use_bginput = (is_browser('opera') OR is_browser('firefox'3) ? false true);

    
print_label_row(
        
$title,
        
"<div id=\"ctrl_$name\"><input type=\"file\"" . ($use_bginput ' class="bginput"' '') . " name=\"$name\" size=\"$size\" tabindex=\"1\"" iif($vbulletin->debug" title=\"name=&quot;$name&quot;\"") . " /></div>",
        
'''top'$name
    
);



TheAdminMarket 11-09-2014 02:53 PM

Quote:

Originally Posted by nerbert (Post 2522034)
I've edited my adminfunctions.php file so I'm not sure I have the line numbers correct, I'm looking at the old version for vB 4.2.0

print_checkbox_row(), line 1104

print_upload_row(), line 1175

Most probably you are :) Thank you.
A bit before I: print_checkbox_row("Active", "active", "");
and worked. Actually it adds a "Yes" after the checkbox.

Also tried: print_file_row("Active", "active", "", 30,30); but I got fatal error. I'm crossing my fingers your solution to work.

I'll come back soon.

--------------- Added [DATE]1415552186[/DATE] at [TIME]1415552186[/TIME] ---------------

You're the King !!! :) Works perfect.

Thank you for your time. Really appreciated.


All times are GMT. The time now is 03:13 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03449 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete