Make WordPress Core

Changeset 620


Ignore:
Timestamp:
12/17/2003 01:07:40 AM (22 years ago)
Author:
mikelittle
Message:

Default page if no group selected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options.php

    r619 r620  
    3737
    3838require_once("optionhandler.php");
     39$non_was_selected = 0;
    3940if ($option_group_id == '') {
    4041    $option_group_id = 1;
     42    $non_was_selected = 1;
    4143}
    4244
     
    5052    // iterate through the list of options in this group
    5153    // pull the vars from the post
    52     // validate ranges etc.?
     54    // validate ranges etc.
    5355    // update the values
    5456    $options = $wpdb->get_results("SELECT $tableoptions.option_id, option_name, option_type, option_value, option_admin_level "
     
    103105    include_once("./admin-header.php");
    104106    if ($user_level <= 3) {
    105         die("You have no right to edit the options for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
     107        die("You have no right to edit the options for this blog.<br>Ask for a promotion from your <a href=\"mailto:$admin_email\">blog admin</a> :)");
    106108    }
     109?>
     110
     111<?php
     112if ($non_was_selected) { // no group pre-selected, display opening page
     113?>
     114<div class="wrap">
     115<?php
     116    //iterate through the available option groups. output them as a definition list.
     117    $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
     118    foreach ($option_groups as $option_group) {
     119        echo("  <dt><a href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></dt>\n");
     120        $current_long_desc = $option_group->group_longdesc;
     121        if ($current_long_desc == '') {
     122            $current_long_desc = 'No help for this group of options.';
     123        }
     124        echo("  <dd>{$option_group->group_desc}: $current_long_desc</dd>\n");
     125    } // end for each group
     126?>
     127  <dt><a href="options-permalink.php">Permalinks</a></dt>
     128  <dd>Permanent link configuration</dd>
     129</div>
     130<?php   
     131
     132} else { //there was a group selected.
     133
    107134?>
    108135<ul id="adminmenu2">
    109136<?php
    110     //we need to iterate through the available option groups.
     137    //Iterate through the available option groups.
    111138    $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
    112139    foreach ($option_groups as $option_group) {
     
    120147    } // end for each group
    121148?>
    122 <li class="last"><a href="options-permalink.php">Permalinks</a></li>
     149  <li class="last"><a href="options-permalink.php">Permalinks</a></li>
    123150</ul>
    124     <br clear="all" />
     151<br clear="all" />
    125152<div class="wrap">
    126     <h2><?php echo $current_desc; ?></h2>
    127     <form name="form" action="<?php echo $this_file; ?>" method="post">
    128     <input type="hidden" name="action" value="update" />
    129     <input type="hidden" name="option_group_id" value="<?php echo $option_group_id; ?>" />
    130 
     153  <h2><?php echo $current_desc; ?></h2>
     154  <form name="form" action="<?php echo $this_file; ?>" method="post">
     155  <input type="hidden" name="action" value="update" />
     156  <input type="hidden" name="option_group_id" value="<?php echo $option_group_id; ?>" />
    131157  <table width="90%" cellpadding="2" cellspacing="2" border="0">
    132158<?php
     
    139165    if ($options) {
    140166        foreach ($options as $option) {
    141             echo('<tr><td width="10%" valign="top">'. get_option_widget($option, ($user_level >= $option->option_admin_level), '</td><td width="15%" valign="top" style="border: 1px solid #ccc">'));
    142             echo("</td><td  valign='top' class='helptext'>$option->option_description</td></tr>\n");
     167            echo('    <tr><td width="10%" valign="top">'. get_option_widget($option, ($user_level >= $option->option_admin_level), '</td><td width="15%" valign="top" style="border: 1px solid #ccc">'));
     168            echo("    </td><td  valign='top' class='helptext'>$option->option_description</td></tr>\n");
    143169        }
    144170    }
     
    148174    <tr><td colspan="3"><?php echo $message; ?></td></tr>
    149175  </table>
    150 
     176  </form>
    151177</div>
    152 
    153    </form>
    154178
    155179<div class="wrap">
    156180<?php
    157 if ($current_long_desc != '') {
    158     echo($current_long_desc);
    159 } else {
     181    if ($current_long_desc != '') {
     182        echo($current_long_desc);
     183    } else {
    160184?>
    161     <p> No help for this group of options.</p>
     185  <p> No help for this group of options.</p>
    162186<?php
    163 }
     187    }
    164188?>
    165189</div>
    166190<?php
    167 
     191} // end else a group was selected
    168192break;
    169 }
     193} // end switch
    170194
    171195include("admin-footer.php") ?>
Note: See TracChangeset for help on using the changeset viewer.