Admin HTML stuff library
| > Script written by Matt Mecham
| > Date started: 1st march 2002
|
+--------------------------------------------------------------------------
*/
class admin_skin {
var $base_url;
var $img_url;
var $has_title;
var $td_widths = array();
var $td_header = array();
var $td_colspan;
function admin_skin() {
global $INFO, $IN;
$this->base_url = $INFO['board_url']."/admin.".$INFO['php_ext']."?adsess=".$IN['AD_SESS'];
$this->img_url = $INFO['html_url'].'/sys-img';
}
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
// Javascript elements
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
function js_pop_win()
{
return "
";
}
function js_help_link($help="", $text="Quick Help")
{
return "( base_url}&act=quickhelp&id=$help','Help','width=250,height=400,resizable=yes,scrollbars=yes'); return false;\">$text )";
}
function js_template_tools()
{
return "
";
}
function js_checkdelete()
{
return "
";
}
function js_no_specialchars()
{
return "
";
}
function make_page_jump($tp="", $pp="", $ub="" )
{
global $IN, $INFO;
return "Pages: ";
}
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
// FORM ELEMENTS
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
function start_form($hiddens="", $name='theAdminForm', $js="") {
global $IN, $INFO;
$form = "
";
return $html;
}
//+--------------------------------------------------------------------
function end_form_standalone($text = "", $js = "")
{
$html = "";
$colspan = "";
if ($text != "")
{
$html .= "\n";
}
$html .= "";
return $html;
}
//+--------------------------------------------------------------------
function form_upload($name="FILE_UPLOAD", $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
return " ";
}
//+--------------------------------------------------------------------
function form_input($name, $value="", $type='text', $js="", $size="30") {
if ($js != "")
{
$js = ' '.$js.' ';
}
return " ";
}
function form_simple_input($name, $value="", $size='5') {
return " ";
}
//+--------------------------------------------------------------------
function form_textarea($name, $value="", $cols='60', $rows='5', $wrap='soft') {
return "";
}
//+--------------------------------------------------------------------
function form_dropdown($name, $list=array(), $default_val="", $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
$html = "\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( ($default_val != "") and ($v[0] == $default_val) )
{
$selected = ' selected';
}
$html .= "".$v[1]." \n";
}
$html .= " \n\n";
return $html;
}
//+--------------------------------------------------------------------
function form_multiselect($name, $list=array(), $default=array(), $size=5, $js="") {
if ($js != "")
{
$js = ' '.$js.' ';
}
//$html = "\n";
$html = "\n";
foreach ($list as $k => $v)
{
$selected = "";
if ( count($default) > 0 )
{
if ( in_array( $v[0], $default ) )
{
$selected = ' selected="selected"';
}
}
$html .= "".$v[1]." \n";
}
$html .= " \n\n";
return $html;
}
//+--------------------------------------------------------------------
function form_yes_no( $name, $default_val="", $js=array() ) {
$y_js = "";
$n_js = "";
if ( $js['yes'] != "" )
{
$y_js = $js['yes'];
}
if ( $js['no'] != "" )
{
$n_js = $js['no'];
}
$yes = "Yes ";
$no = " No";
if ($default_val == 1)
{
$yes = "Yes ";
}
else
{
$no = " No";
}
return $yes.' '.$no;
}
//+--------------------------------------------------------------------
function form_checkbox( $name, $checked=0, $val=1, $js=array() ) {
if ($checked == 1)
{
return " ";
}
else
{
return " ";
}
}
//+--------------------------------------------------------------------
function build_group_perms( $read='*', $write='*', $reply='*', $upload='*' ) {
global $DB;
$html = "
";
$html .= $this->add_td_basic( "GLOBAL: All current and future permission masks", "left", "pformstrip" );
//+-------------------------------------------------------------------------
if ($read == '*')
{
$html_read = " \n";
}
else
{
$html_read = " \n";
}
//+-------------------------------------------------------------------------
if ($reply == '*')
{
$html_reply = " \n";
}
else
{
$html_reply = " \n";
}
//+-------------------------------------------------------------------------
if ($write == '*')
{
$html_start = " \n";
}
else
{
$html_start = " \n";
}
if ($upload == '*')
{
$html_upload = " \n";
}
else
{
$html_upload = " \n";
}
//+-------------------------------------------------------------------------
$html .= $this->add_td_row( array( "All current and future permission masks ",
"$html_read ",
"$html_reply ",
"$html_start ",
"$html_upload ",
) );
//+-------------------------------------------------------------------------
$html .= $this->add_td_basic( "OR: Adjust permissions per mask below", "left", "pformstrip" );
$DB->query("SELECT * FROM ibf_forum_perms ORDER BY perm_name ASC");
while ( $data = $DB->fetch_row() )
{
if ($read == '*')
{
$html_read = " ";
}
else if ( preg_match( "/(^|,)".$data['perm_id']."(,|$)/", $read ) )
{
$html_read = " ";
}
else
{
$html_read = " ";
}
//+----------------------------------------------------------------------------------------
if ($reply == '*')
{
$html_reply = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $reply ) )
{
$html_reply = " ";
}
else
{
$html_reply = " ";
}
//+----------------------------------------------------------------------------------------
if ($write == '*')
{
$html_start = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $write ) )
{
$html_start = " ";
}
else
{
$html_start = " ";
}
//+----------------------------------------------------------------------------------------
if ($upload == '*')
{
$html_upload = " ";
}
else if ( preg_match( "/(?:^|,)".$data['perm_id']."(?:,|$)/", $upload ) )
{
$html_upload = " ";
}
else
{
$html_upload = " ";
}
$html .= $this->add_td_row( array( "{$data['perm_name']}
",
"$html_read ",
"$html_reply ",
"$html_start ",
"$html_upload ",
) );
}
$html .= $this->add_td_row( array( " ",
"Select: ",
"Select: ",
"Select: ",
"Select: ",
) );
return $html;
}
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
// SCREEN ELEMENTS
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
function add_subtitle($title="",$id="subtitle", $colspan="") {
if ($colspan != "")
{
$colspan = " colspan='$colspan' ";
}
return "\n$title \n";
}
//+--------------------------------------------------------------------
function start_table( $title="", $desc="") {
if ($title != "")
{
$this->has_title = 1;
$html .= "
$title
\n";
if ( $desc != "" )
{
$html .= "
$desc
\n";
}
}
$html .= "\n
";
if (isset($this->td_header[0]))
{
$html .= "\n";
// Auto remove two only headers..
if ( $this->td_header[0][0] == ' ' && $this->td_header[1][0] == ' ' && ( ! isset( $this->td_header[2][0] ) ) )
{
$this->td_header[0][0] = '{none}';
$this->td_header[1][0] = '{none}';
}
foreach ($this->td_header as $td)
{
if ($td[1] != "")
{
$width = " width='{$td[1]}' ";
}
else
{
$width = "";
}
if ($td[0] != '{none}')
{
$html .= "{$td[0]} \n";
}
$this->td_colspan++;
}
$html.= " \n";
}
return $html;
}
//+--------------------------------------------------------------------
function add_td_row( $array, $css="", $align='middle' ) {
if (is_array($array))
{
$html = "\n";
$count = count($array);
$this->td_colspan = $count;
for ($i = 0; $i < $count ; $i++ )
{
$td_col = $i % 2 ? 'tdrow2' : 'tdrow1';
if ($css != "")
{
$td_col = $css;
}
if (is_array($array[$i]))
{
$text = $array[$i][0];
$colspan = $array[$i][1];
$html .= "".$text." \n";
}
else
{
if ($this->td_header[$i][1] != "")
{
$width = " width='{$this->td_header[$i][1]}' ";
}
else
{
$width = "";
}
$html .= "".$array[$i]." \n";
}
}
$html .= " \n";
return $html;
}
}
//+--------------------------------------------------------------------
function add_td_basic($text="",$align="left",$id="tdrow1") {
$html = "";
$colspan = "";
if ($text != "")
{
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
$html .= "$text \n";
}
return $html;
}
//+--------------------------------------------------------------------
function add_td_spacer() {
if ($this->td_colspan > 0)
{
$colspan = " colspan='".$this->td_colspan."' ";
}
return " ";
}
//+--------------------------------------------------------------------
function end_table() {
$this->td_header = array(); // Reset TD headers
if ($this->has_title == 1)
{
$this->has_title = 0;
return "
\n\n";
}
else
{
return "\n\n";
}
}
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
//+--------------------------------------------------------------------
function get_css()
{
return "";
}
function print_top($title="",$desc="") {
global $INFO, $IN;
$css = $this->get_css();
return "
Menu
$css
top_extra}>
$title
$desc
";
}
function wrap_nav($links)
{
return "\n $links
\n";
}
//+--------------------------------------------------------------------
function print_foot() {
return "
Quick Jump
";
}
//+--------------------------------------------------------------------
//{ background-color:#C2CFDF; font-weight:bold; font-size:12px; color:#000055 }
function menu_top() {
global $INFO;
$pop_win = $this->js_pop_win();
return "
Menu
$pop_win
";
}
//+--------------------------------------------------------------------
function menu_foot() {
return "
";
}
//+--------------------------------------------------------------------
function menu_cat_expanded($name="", $links="", $id = "") {
global $IN;
return "
\n";
}
//+--------------------------------------------------------------------
function menu_cat_collapsed($name="", $id = "", $desc="") {
global $IN;
return "
\n";
}
//+--------------------------------------------------------------------
function menu_cat_link($url="", $name="", $urltype=0)
{
global $INFO;
if ( $urltype == 1 )
{
$theurl = $INFO['board_url'].'/index.'.$INFO['php_ext'].'?';
}
else
{
$theurl = $this->base_url;
}
return " $name ";
}
//+--------------------------------------------------------------------
function frame_set() {
global $IN, $ibforums;
$frames = "
Invision Power Board Administration Center
";
return $frames;
}
}
?>