Page 1 of 1

getting values

Posted: Thu Aug 07, 2003 3:14 am
by zuzupus
hi,
i created dirmodify.phtml and how i can get the values in text field called New directory
for eg, when i select radio button let say download and this link having HTML inside it
so when i select this link then
New directory download
HTML Information its checked as this downlaod have html file


please visit this link

http://server2.vitodesign.com/scripts/dirmodify.phtml

thanks

Code: Select all

<? $dir = './'; require($dir.'lib.php'); get_session(); ?>
<? // if (!$session->login || !$session->admin) send_location_die('login.phtml?error=true'); ?>
<? expire_header(); ?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
    <head>
         <title>Directory Administration</title>
         <link rel="stylesheet" type="text/css" href="../styles/styles.css" />
         <? expire(); ?>
    </head>

    <body>
         <?
              $trees = 2;
              $tree = array();
                        $users = array();
              query_db("SELECT sys_pk, name FROM t_user ORDER BY name");
              while($r = foreach_db()) {
                   $users[$r->sys_pk] = $r;
              }
              query_db("SELECT sys_pk, fk_t_directories_parent AS parent, name FROM t_directories ORDER BY sort, name");
              while($r = foreach_db())
                   $tree[$r->sys_pk] = $r;
              $top = array();
              foreach(array_keys($tree) as $key) {
                   $v =& $tree[$key];
                   if (isset($tree[$v->parent])) {
                        $tree[$v->parent]->child[] =& $v;
                   } else {
                        $top[] =& $v;
                   }
                   unset($v);
              }
              unset($tree);
              function recurse(&$tree, &$maxdepth, &$opens, &$opens_new, &$subtree, $depth) {
                   if (++$depth > $maxdepth) $maxdepth = $depth;
                   foreach($subtree as $r) {
                        $s = new stdClass();
                        $s->sys_pk = $r->sys_pk;
                        $s->depth = $depth;
                        $s->name = $r->name;
                        $children = is_array($r->child) ? count($r->child) : 0;
                        if ($children) {
                             if ($opens[$s->sys_pk]) {
                                  $s->mode = 2;
                                  $opens_new[$s->sys_pk] = true;
                             } else {
                                  $s->mode = 1;
                             }
                        } else {
                             $s->mode = 0;
                        }
                        $tree[$r->sys_pk] = $s;
                        if ($s->mode == 2)
                             recurse($tree, $maxdepth, $opens, $opens_new, $r->child, $depth);
                   }
              }
              function make_tree(&$opens) {
                   global $top;
                   $tree = array();
                   $maxdepth = 0;
                   $opens_new = array();
                   recurse($tree, $maxdepth, $opens, $opens_new, $top, 0);
                   $opens = $opens_new;
                   return array($tree, $maxdepth);
              }
              if (!is_array($session->opens) || !$click) $session->opens = array();
              for($i = 0; $i < $trees; $i++)
                   if (!is_array($session->opens[$i]))
                        $session->opens[$i] = array();
              if ($click) {
                   $side += 0;
                   $id += 0;
                   if ($side < 1 || $side > $trees) $side = 1;
                   $session->opens[$side-1][$id] = ($click == 2);
              }
         ?>
         <form action="diradmin.php" method="post">
              <table border="0" cellpadding="0" cellspacing="0" width="95%">
                   <tr>
                        <td valign="top">
                             <? $side = 1; list($tree, $maxdepth) = make_tree($session->opens[$side-1]); ?>
                             <table border="0" cellpadding="0" cellspacing="0">
                                  <th style="line-height: 150%" colspan="<?=($maxdepth+1) ?>">Directory under which to create new one<br /></th>
                                  <tr>
                                            <td class="black2"><input type="radio" name="ddir" value="0" id="ddir0" /></td>
                                            <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                                 &nbsp;<label for="<?="ddir0" ?>"><top level></label>
                                            </td>
                                  </tr>
                                  <? foreach($tree as $r) { ?>
                                       <tr>
                                            <?=str_repeat('<td></td>', $r->depth-1) ?>
                                            <td class="black2"><input type="radio" name="ddir" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" /></td>
                                            <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                                 &nbsp;<label for="<?="dir{$r->sys_pk}" ?>"><? if ($r->mode) { ?><a href="<?=htmlentities("dirmodify.phtml?click=".($r->mode == 2 ? 1 : 2)."&id={$r->sys_pk}&side={$side}") ?>" style="color: inherit;"><?=htmlentities(($r->mode == 2) ? '-' : '+') ?><? } ?><?=htmlentities($r->name) ?><? if ($r->mode) { ?></a><? } ?></label>
                                            </td>
                                       </tr>
                                  <? } ?>
                             </table><br />
                             <hr noshade="noshade" width="80%" size="1" />

                             <table border="0" cellspacing="2" cellpadding="0">
                                                        <tr>
                                       <th style="line-height: 150%" colspan="4" align="center">Modify directory</th>
                                  </tr>
                                                        <tr>
                                       <td class="black2" colspan="2" align="center"><em>(Select both the Directory Rights )</em></td>
                                  </tr>
                                                        <tr>
                                       <td class="black2">New Directory:&nbsp;</td>
                                       <td class="black2"><input type="text" name="name" size="30" /></td>
                                  </tr>

                                                        <tr>
                                     <td class="black2" nowrap>HTML-Informationen:&nbsp;</td>
                                      <td class="black2"><input name="check" type="checkbox" /></td>
                                  </tr>

                                                        <tr>
                                                          <td class="black2" valign="top">Benutzer und Rechte:</td>
                                                            <td class="black2">keine Datens&auml;tze</td>
                                                    </tr>

                                                        <tr>
                                                            <td class="black2">Benutzer: </td>
                                                             <td>
                                                                            <select name="benutzer">
                                                                            <option selected="selected">** Bitte w&auml;hlen **</option>
                                                                                <? foreach($users as $r) { ?>
                                                                            <option value="<?=$r->sys_pk ?>"><?=htmlentities($r->name) ?></option>
                                                                             <? } ?>
                                                                            </select>
                                                              </td>
                                                        </tr>

                                                        <tr>
                                                                <td class="black2">Rechte: </td>
                                  </tr>
                                                            <tr>
                                      <td class="black2"><input id="add" type="radio" name="add" value="1" checked="checked" /> <label for="add">read only</label></td>
                                                         </tr>
                                     <tr>
                                       <td class="black2"><input id="remove" type="radio" name="add" value="2" /> <label for="remove">write only</label></td>
                                                        </tr>
                                     <tr>
                                       <td class="black2"><input id="add" type="radio" name="add" value="3" checked="checked" /> <label for="add">read and write</label></td>
                                                        </tr>
                                     <tr>
                                       <td class="black2"><input id="remove" type="radio" name="add" value="0" /> <label for="remove">no rights</label></td>
                                     </tr>
                                                        <tr>
                                       <td class="black2" colspan="4" align="center"><input type="submit" name="modify" value="Modify" /></td>
                                                        </tr>
                             </table><br />
                   </td>
                        <td valign="top">&nbsp;&nbsp;&nbsp;</td>
                        <td valign="top">
                             <? $side = 1; list($tree, $maxdepth) = make_tree($session->opens[$side-1]); ?>
                             <table border="0" cellpadding="0" cellspacing="0">
                                  <th style="line-height: 150%" colspan="<?=($maxdepth+1) ?>">Directory to copy rights from<br /></th>
                                  <? foreach($tree as $r) { ?>
                                       <tr>
                                            <?=str_repeat('<td></td>', $r->depth-1) ?>
                                            <td class="black2"><input type="radio" name="dir" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" /></td>
                                            <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                                 &nbsp;<label for="<?="dir{$r->sys_pk}" ?>"><? if ($r->mode) { ?><a href="<?=htmlentities("dirmodify.phtml?click=".($r->mode == 2 ? 1 : 2)."&id={$r->sys_pk}&side={$side}") ?>" style="color: inherit;"><?=htmlentities(($r->mode == 2) ? '-' : '+') ?><? } ?><?=htmlentities($r->name) ?><? if ($r->mode) { ?></a><? } ?></label>
                                            </td>
                                       </tr>
                                  <? } ?>
                             </table><br />
                        </td>
                   </tr>
              </table><br />
         </form>
    </body>
</html>