Skip to content
Snippets Groups Projects
page.inc.php 5.26 KiB
Newer Older
  • Learn to ignore specific revisions
  • Peter Rotich's avatar
    Peter Rotich committed
    <?php
    if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
    $pageTypes = array(
    
            'landing' => __('Landing page'),
            'offline' => __('Offline page'),
            'thank-you' => __('Thank you page'),
            'other' => __('Other'),
    
    Peter Rotich's avatar
    Peter Rotich committed
            );
    $info=array();
    $qstr='';
    if($page && $_REQUEST['a']!='add'){
    
        $title=__('Update Page');
    
    Peter Rotich's avatar
    Peter Rotich committed
        $action='update';
    
        $submit_text=__('Save Changes');
    
    Peter Rotich's avatar
    Peter Rotich committed
        $info=$page->getHashtable();
    
        $info['body'] = Format::viewableImages($page->getBody());
        $info['notes'] = Format::viewableImages($info['notes']);
    
        $slug = Format::slugify($info['name']);
    
    Peter Rotich's avatar
    Peter Rotich committed
        $qstr.='&id='.$page->getId();
    }else {
    
        $title=__('Add New Page');
    
    Peter Rotich's avatar
    Peter Rotich committed
        $action='add';
    
        $submit_text=__('Add Page');
    
    Peter Rotich's avatar
    Peter Rotich committed
        $info['isactive']=isset($info['isactive'])?$info['isactive']:0;
        $qstr.='&a='.urlencode($_REQUEST['a']);
    }
    $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
    ?>
    <form action="pages.php?<?php echo $qstr; ?>" method="post" id="save">
     <?php csrf_token(); ?>
     <input type="hidden" name="do" value="<?php echo $action; ?>">
     <input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
     <input type="hidden" name="id" value="<?php echo $info['id']; ?>">
    
     <h2><?php echo __('Site Pages'); ?>
    
        <i class="help-tip icon-question-sign" href="#site_pages"></i>
        </h2>
    
     <table class="form_table fixed" width="940" border="0" cellspacing="0" cellpadding="2">
    
    Peter Rotich's avatar
    Peter Rotich committed
        <thead>
    
            <tr><td></td><td></td></tr> <!-- For fixed table layout -->
    
    Peter Rotich's avatar
    Peter Rotich committed
            <tr>
                <th colspan="2">
                    <h4><?php echo $title; ?></h4>
    
                    <em><?php echo __('Page information'); ?></em>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td width="180" class="required">
    
                  <?php echo __('Name'); ?>:
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
                <td>
                    <input type="text" size="40" name="name" value="<?php echo $info['name']; ?>">
                    &nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
                </td>
            </tr>
            <tr>
                <td width="180" class="required">
    
                    <?php echo __('Type'); ?>:
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
                <td>
    
                    <span>
    
    Peter Rotich's avatar
    Peter Rotich committed
                    <select name="type">
    
                        <option value="" selected="selected">&mdash; <?php
                        echo __('Select Page Type'); ?> &mdash;</option>
    
    Peter Rotich's avatar
    Peter Rotich committed
                        <?php
                        foreach($pageTypes as $k => $v)
                            echo sprintf('<option value="%s" %s>%s</option>',
                                    $k, (($info['type']==$k)?'selected="selected"':''), $v);
                        ?>
                    </select>
                    &nbsp;<span class="error">*&nbsp;<?php echo $errors['type']; ?></span>
    
                    &nbsp;<i class="help-tip icon-question-sign" href="#type"></i>
                    </span>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
            </tr>
    
            <?php if ($info['name'] && $info['type'] == 'other') { ?>
            <tr>
                <td width="180" class="required">
    
                    <?php echo __('Public URL'); ?>:
    
                </td>
                <td><a href="<?php echo sprintf("%s/pages/%s",
                        $ost->getConfig()->getBaseUrl(), urlencode($slug));
                    ?>">pages/<?php echo $slug; ?></a>
                </td>
            </tr>
            <?php } ?>
    
    Peter Rotich's avatar
    Peter Rotich committed
            <tr>
                <td width="180" class="required">
    
                    <?php echo __('Status'); ?>:
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
                <td>
    
                    <input type="radio" name="isactive" value="1" <?php echo $info['isactive']?'checked="checked"':''; ?>><strong><?php echo __('Active'); ?></strong>
                    <input type="radio" name="isactive" value="0" <?php echo !$info['isactive']?'checked="checked"':''; ?>><?php echo __('Disabled'); ?>
    
    Peter Rotich's avatar
    Peter Rotich committed
                    &nbsp;<span class="error">*&nbsp;<?php echo $errors['isactive']; ?></span>
                </td>
            </tr>
            <tr>
                <th colspan="2">
    
                    <em><?php echo __(
                    '<b>Page body</b>: Ticket variables are only supported in thank-you pages.'
                    ); ?><font class="error">*&nbsp;<?php echo $errors['body']; ?></font></em>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </th>
            </tr>
             <tr>
                <td colspan=2 style="padding-left:3px;">
    
                    <textarea name="body" cols="21" rows="12" style="width:98%;" class="richtext draft"
                        data-draft-namespace="page" data-draft-object-id="<?php echo $info['id']; ?>"
                        ><?php echo $info['body']; ?></textarea>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
            </tr>
            <tr>
                <th colspan="2">
    
                    <em><strong><?php echo __('Internal Notes'); ?></strong>: 
                    <?php echo __("be liberal, they're internal"); ?></em>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </th>
            </tr>
            <tr>
                <td colspan=2>
    
                    <textarea class="richtext no-bar" name="notes" cols="21"
                        rows="8" style="width: 80%;"><?php echo $info['notes']; ?></textarea>
    
    Peter Rotich's avatar
    Peter Rotich committed
                </td>
            </tr>
        </tbody>
    </table>
    <p style="padding-left:225px;">
        <input type="submit" name="submit" value="<?php echo $submit_text; ?>">
    
        <input type="reset"  name="reset"  value="<?php echo __('Reset'); ?>">
        <input type="button" name="cancel" value="<?php echo __('Cancel'); ?>" onclick='window.location.href="pages.php"'>
    
    Peter Rotich's avatar
    Peter Rotich committed
    </p>
    </form>