Changeset 101


Ignore:
Timestamp:
Apr 16, 2006 1:46:11 PM (18 years ago)
Author:
scdev
Message:

Q - fixed a few PEdit glitches. Reformatted PHP source correctly :-\.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/example_config.inc.php

    r100 r101  
    2727    COMMON_BASE,
    2828    SITE_BASE . '/_templates',
    29     get_include_path()
     29    get_include_path(),
    3030)));
    3131
  • trunk/lib/App.inc.php

    r100 r101  
    5656        // Human-readable format used to display dates.
    5757        'date_format' => 'd M Y',
     58        'time_format' => 'h:i:s A',
    5859        'sql_date_format' => '%e %b %Y',
    5960        'sql_time_format' => '%k:%i',
  • trunk/lib/PEdit.inc.php

    r100 r101  
    211211            return false;
    212212        }
    213 ?>       
    214 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="sc-pedit-form">
    215     <input type="hidden" name="filename" value="<?php echo $_SERVER['PHP_SELF']; ?>" />
    216     <input type="hidden" name="file_hash" value="<?php echo $this->_fileHash(); ?>" />
    217 <?php
     213        ?>       
     214        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="sc-pedit-form">
     215        <input type="hidden" name="filename" value="<?php echo $_SERVER['PHP_SELF']; ?>" />
     216        <input type="hidden" name="file_hash" value="<?php echo $this->_fileHash(); ?>" />
     217        <?php
    218218        App::printHiddenSession();
    219219        switch ($this->op) {
    220220        case 'Edit' :
    221 ?>
    222     <div class="sc-pedit-buttons">
    223         <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Search"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
    224         <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
    225     </div>
    226 <?php
     221            ?>
     222            <div class="sc-pedit-buttons">
     223                <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
     224                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     225            </div>
     226            <?php
    227227            break;
    228228        case 'View' :
    229 ?>
    230     <input type="hidden" name="version" value="<?php echo getFormData('version'); ?>" />
    231 <?php
     229            ?>
     230            <input type="hidden" name="version" value="<?php echo getFormData('version'); ?>" />
     231            <?php
    232232            break;
    233233        }
     
    260260    {
    261261        if ($this->_authorized && $this->op == 'Edit' && $this->_data_loaded) {       
    262 ?>
    263     <div class="sc-pedit-item">
    264 <?php
     262            ?>
     263            <div class="sc-pedit-item">
     264            <?php
    265265            $type = (isset($this->_data[$name]['type'])) ? $this->_data[$name]['type'] : $type;
    266266            // Print edit form.
     
    268268            case 'text' :
    269269            default :
    270 ?>
    271         <label><?php echo ucfirst(str_replace('_', ' ', $name)); ?></label>
    272         <input type="text" name="_pedit_data[<?php echo $name; ?>]" id="sc-pedit-<?php echo $name; ?>" value="<?php echo oTxt($this->_data[$name]['content']); ?>" class="full" />
    273 <?php
     270                ?>
     271                <label><?php echo ucfirst(str_replace('_', ' ', $name)); ?></label>
     272                <input type="text" name="_pedit_data[<?php echo $name; ?>]" id="sc-pedit-field-<?php echo $name; ?>" value="<?php echo oTxt($this->_data[$name]['content']); ?>" class="full" />
     273                <?php
    274274                break;
    275275            case 'textarea' :
    276 ?>
    277         <label><?php echo ucfirst(str_replace('_', ' ', $name)); ?></label>
    278         <textarea name="_pedit_data[<?php echo $name; ?>]" id="sc-pedit-<?php echo $name; ?>" rows="" cols="" class="full tall"><?php echo oTxt($this->_data[$name]['content']); ?></textarea>
    279 <?php
     276                ?>
     277                <label><?php echo ucfirst(str_replace('_', ' ', $name)); ?></label>
     278                <textarea name="_pedit_data[<?php echo $name; ?>]" id="sc-pedit-field-<?php echo $name; ?>" rows="" cols="" class="full tall"><?php echo oTxt($this->_data[$name]['content']); ?></textarea>
     279                <?php
    280280                break;
    281281            }
    282 ?>
    283     </div>
    284 <?php
     282            ?>
     283            </div>
     284            <?php
    285285        }
    286286    }
     
    300300        switch ($this->op) {
    301301        case 'Edit' :
    302 ?>
    303     <div class="sc-pedit-buttons">
    304         <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
    305         <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
    306     </div>
    307 </form>
    308 <?php
     302            ?>
     303            <div class="sc-pedit-buttons">
     304                <input type="submit" name="op" value="<?php echo _("Save"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Save"))?>" accesskey="<?php echo substr(_("Save"), 0, 1) ?>" />
     305                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     306            </div>
     307            </form>
     308            <?php
    309309            break;
    310310        case 'Versions' :
    311 ?>
    312     <div class="sc-pedit-buttons">
    313         <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
    314     </div>
    315 </form>
    316 <?php
     311            ?>
     312            <div class="sc-pedit-buttons">
     313                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     314            </div>
     315            </form>
     316            <?php
    317317            break;
    318318        case 'View' :
    319 ?>
    320     <div class="sc-pedit-buttons">
    321         <input type="submit" name="op" value="<?php echo _("Restore"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Restore"))?>" accesskey="<?php echo substr(_("Restore"), 0, 1) ?>" />
    322         <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
    323         <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
    324     </div>
    325 </form>
    326 <?php
     319            ?>
     320            <div class="sc-pedit-buttons">
     321                <input type="submit" name="op" value="<?php echo _("Restore"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Restore"))?>" accesskey="<?php echo substr(_("Restore"), 0, 1) ?>" />
     322                <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
     323                <input type="submit" name="op" value="<?php echo _("Cancel"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Cancel"))?>" accesskey="<?php echo substr(_("Cancel"), 0, 1) ?>" />
     324            </div>
     325            </form>
     326            <?php
    327327            break;
    328328        default :
    329 ?>
    330     <div class="sc-pedit-buttons">
    331         <input type="submit" name="op" value="<?php echo _("Edit"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Edit"))?>" accesskey="<?php echo substr(_("Edit"), 0, 1) ?>" />
    332         <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
    333     </div>
    334 </form>
    335 <?php
     329            ?>
     330            <div class="sc-pedit-buttons">
     331                <input type="submit" name="op" value="<?php echo _("Edit"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Edit"))?>" accesskey="<?php echo substr(_("Edit"), 0, 1) ?>" />
     332                <input type="submit" name="op" value="<?php echo _("Versions"); ?>" title="<?php echo preg_replace('/^(\w)/i', '($1)', _("Versions"))?>" accesskey="<?php echo substr(_("Versions"), 0, 1) ?>" />
     333            </div>
     334            </form>
     335            <?php
    336336        }
    337337    }
     
    348348            // Print versions and commands to view/restore.
    349349            $version_files = $this->_getVersions();
    350 ?>
    351     <h1><?php printf(_("%s saved versions of %s"), sizeof($version_files), basename($_SERVER['PHP_SELF'])); ?></h1>
    352 <?php
     350            ?><h1><?php printf(_("%s saved versions of %s"), sizeof($version_files), basename($_SERVER['PHP_SELF'])); ?></h1><?php
    353351            if (is_array($version_files) && !empty($version_files)) {
    354 ?>
    355     <table id="sc-pedit-versions-table">
    356         <tr>
    357             <th><?php echo _("Date"); ?></th>
    358             <th><?php echo _("Time"); ?></th>
    359             <th><?php echo _("File Size"); ?></th>
    360             <th><?php echo _("Version Options"); ?></th>
    361         </tr>
    362 <?php
     352                ?>
     353                <table id="sc-pedit-versions-table">
     354                <tr>
     355                    <th><?php echo _("Date"); ?></th>
     356                    <th><?php echo _("Time"); ?></th>
     357                    <th><?php echo _("File size"); ?></th>
     358                    <th><?php echo _("Version options"); ?></th>
     359                </tr>
     360                <?php
    363361                foreach ($version_files as $v) {
    364 ?>
    365         <tr>
    366             <td><?php echo date('F j, Y', $v['unixtime']); ?></td>
    367             <td><?php echo date('h:i:s A', $v['unixtime']); ?></td>
    368             <td><?php printf(_("%s bytes"), $v['filesize']); ?></td>
    369             <td class="nowrap"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=View&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("View"); ?></a> or <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=Restore&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("Restore"); ?></a></td>
    370         </tr>
    371 <?php
     362                    ?>
     363                    <tr>
     364                        <td><?php echo date(App::getParam('date_format'), $v['unixtime']); ?></td>
     365                        <td><?php echo date(App::getParam('time_format'), $v['unixtime']); ?></td>
     366                        <td><?php echo humanFileSize($v['filesize']); ?></td>
     367                        <td class="nowrap"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=View&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("View"); ?></a> <?php echo _("or"); ?> <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=Restore&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("Restore"); ?></a></td>
     368                    </tr>
     369                    <?php
    372370                }
    373 ?>
    374     </table>
    375     <div class="help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $this->getParam('versions_min_qty'), $this->getParam('versions_min_qty')); ?></div>
    376 <?php
     371                ?>
     372                </table>
     373                <div class="help"><?php printf(_("When there are more than %s versions, those over %s days old are deleted."), $this->getParam('versions_min_qty'), $this->getParam('versions_min_days')); ?></div>
     374                <?php
    377375            }
    378376        }
Note: See TracChangeset for help on using the changeset viewer.