-view options

This commit is contained in:
Claude 2012-05-25 19:00:05 +02:00
parent a794c5c66b
commit 971e7dbeea
6 changed files with 3 additions and 115 deletions

View File

@ -46,7 +46,6 @@ $route['cron/:any'] = "main/cron";
$route['view/raw/:any'] = 'main/raw';
$route['view/rss/:any'] = 'main/rss';
$route['view/embed/:any'] = 'main/embed';
$route['view/options'] = 'main/view_options';
$route['view/download/:any'] = 'main/download';
$route['view/:any'] = 'main/view';
$route['lists'] = 'main/lists';

View File

@ -11,8 +11,6 @@
* - download()
* - lists()
* - view()
* - _view_options_prep()
* - view_options()
* - cron()
* - about()
* - _valid_lang()
@ -355,15 +353,6 @@ class Main extends CI_Controller
}
$data = $this->pastes->getPaste(2, true);
$data['reply_form'] = $this->_form_prep($data['lang_code'], 'Re: ' . $data['title'], $data['raw'], $data['pid']);
if ($this->db_session->userdata('full_width'))
{
$data['full_width'] = true;
}
else
{
$data['full_width'] = false;
}
$this->load->view('view/view', $data);
}
else
@ -372,66 +361,6 @@ class Main extends CI_Controller
}
}
function _view_options_prep()
{
$this->load->helper('form');
if ($this->db_session->userdata('remember_view') > 0)
{
$data['full_width_set'] = $this->db_session->userdata('full_width');
$data['view_raw_set'] = $this->db_session->userdata('view_raw');
}
else
{
$data['full_width_set'] = false;
$data['view_raw_set'] = false;
}
return $data;
}
function view_options()
{
if (!$this->input->post('submit'))
{
$data = $this->_view_options_prep();
$this->load->view('view/view_options', $data);
}
else
{
$this->load->library('form_validation');
$rules = array(
array(
'field' => 'full_width',
'label' => 'full_width',
'rules' => 'max_length[1]',
) ,
array(
'field' => 'view_raw',
'label' => 'view_raw',
'rules' => 'max_length[1]',
) ,
);
$this->form_validation->set_rules($rules);
if ($this->form_validation->run() == false)
{
exit('Ugh, stupid skiddie.');
}
else
{
$user_data = array(
'full_width' => $this->input->post('full_width') ,
'view_raw' => $this->input->post('view_raw') ,
'remember_view' => true
);
$this->db_session->set_userdata($user_data);
$this->db_session->set_flashdata('settings_changed', 'true');
redirect();
}
}
}
function cron()
{
$this->load->model('pastes');

View File

@ -1,5 +1,4 @@
<?php $this->load->view('defaults/header');?>
<small><a class="control" href="<?php echo site_url("view/options")?>">Change paste viewing options</a></small><br/><br/>
<h1>Recent Pastes <a href="<?php echo site_url('lists/rss'); ?>"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJDSURBVHjajJJNSBRhGMd/887MzrQxRSLbFuYhoUhEKsMo8paHUKFLdBDrUIdunvq4RdClOq8Hb0FBSAVCUhFR1CGD/MrIJYqs1kLUXd382N356plZFOrUO/MMz/vO83+e93n+f+1zF+kQBoOQNLBJg0CTj7z/rvWjGbEOIwKp9O7WkhtQc/wMWrlIkP8Kc1lMS8eyFHpkpo5SgWCCVO7Z5JARhuz1Qg29fh87u6/9VWL1/SPc4Qy6n8c0FehiXin6dcCQaylDMhqGz8ydS2hKkmxNkWxowWnuBLHK6G2C8X6UJkBlxUmNqLYyNbzF74QLDrgFgh9LLE0NsPKxjW1Hz2EdPIubsOFdH2HgbwAlC4S19dT13o+3pS+vcSfvUcq9YnbwA6muW9hNpym/FWBxfh0CZkKGkPBZeJFhcWQAu6EN52QGZ/8prEKW+cdXq0039UiLXhUYzdjebOJQQI30UXp6mZn+Dtam32Afu0iyrgUvN0r+ZQbr8HncSpUVJfwRhBWC0hyGV8CxXBL5SWYf9sYBidYLIG2V87/ifVjTWAX6AlxeK2C0X8e58hOr/Qa2XJ3iLMWxB1h72tHs7bgryzHAN2o2gJorTrLxRHVazd0o4TXiyV2Yjs90uzauGvvppmqcLjwmbZ3V7BO2HOrBnbgrQRqWUgTZ5+Snx4WeKfzCCrmb3axODKNH+vvUyWjqyK4DiKQ0eXSpFsgVvLJQWpH+xSpr4otg/HI0TR/t97cxTUS+QxIMRTLi/9ZYJPI/AgwAoc3W7ZrqR2IAAAAASUVORK5CYII=" alt="rss" title="RSS" /></a></h1>
<?php

View File

@ -18,7 +18,7 @@
<span class="detail"><span class="item">Embed </span><input id="embed_field" type="text" value="<?php echo htmlspecialchars('<iframe src="' . site_url('view/embed/' . $pid) . '" style="border:none;width:100%"></iframe>'); ?>" /></span>
<div class="spacer"></div>
<span class="detail"><a class="control" href="<?php echo site_url("view/download/".$pid); ?>">Download Paste</a> or <a class="control" href="<?php echo site_url("view/raw/".$pid); ?>">View Raw</a> &mdash; <a href="#" class="expand control">Expand paste</a> to full width of browser | <a href="<?php echo site_url('view/options'); ?>">Change Viewing Options</a></span>
<span class="detail"><a class="control" href="<?php echo site_url("view/download/".$pid); ?>">Download Paste</a> or <a class="control" href="<?php echo site_url("view/raw/".$pid); ?>">View Raw</a> &mdash; <a href="#" class="expand control">Expand paste</a> to full width of browser</span>
</div>
</div>
</div>
@ -27,8 +27,8 @@
</div>
</div>
<div class="paste <?php if($full_width){ echo "full"; }?>">
<div class="text_formatted <?php if($full_width){ echo "full"; }?>">
<div class="paste">
<div class="text_formatted">
<div class="container">
<?php echo $paste; ?>
</div>

View File

@ -1,26 +0,0 @@
<?php $this->load->view("defaults/header"); ?>
<div class="form_wrapper margin full">
<form action="<?php echo site_url("view/options"); ?>" method="post">
<h1>Change paste viewing options</h1>
<p class="explain border">Here you can change your preferences for viewing pastes. Requires cookies to be enabled.</p>
<div class="item">
<label for="full_width">Expand Pastes
<span class="instruction">This automatically expands the width of a paste to fill the whole page.</span>
</label>
<div class="text_beside">
<?php
$set = array('name' => 'full_width', 'id' => 'full_width', 'value' => '1', 'checked' => $full_width_set);
echo form_checkbox($set);
?>
<p>Expand Pastes by default</p>
</div>
</div>
<div><button type="submit" value="submit" name="submit">Save</button></div>
<div class="spacer"></div>
</form>
</div>
<?php $this->load->view("defaults/footer.php"); ?>

View File

@ -220,10 +220,6 @@ h4 {
float: left;
}
.form_wrapper.full .text_beside {
width: 250px;
}
.form_wrapper textarea {
width: 694px;
}
@ -372,10 +368,6 @@ h4 {
font-size: 100%;
}
.paste.full {
width: 90%;
}
.paste .text_formatted {
clear: both;
float: left;
@ -387,11 +379,6 @@ h4 {
position: relative;
}
.paste .text_formatted.full {
width: 100%;
margin-left: 10px;
}
.text_formatted ol {
padding-left: 50px;
}