Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Commit

Permalink
controll panel compatibility for pyro2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencozart committed Dec 4, 2011
1 parent 4747dc3 commit 17f8236
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 157 deletions.
1 change: 1 addition & 0 deletions controllers/admin.php
Expand Up @@ -19,6 +19,7 @@ class Admin extends Admin_Controller
*/
private $validation_rules = array();

public $section = 'faqs';

public function __construct()
{
Expand Down
2 changes: 2 additions & 0 deletions controllers/admin_categories.php
Expand Up @@ -19,6 +19,8 @@ class Admin_categories extends Admin_Controller {
*/
private $validation_rules = array();

public $section = "categories";

/**
* Constructor method
*
Expand Down
28 changes: 26 additions & 2 deletions details.php
Expand Up @@ -11,7 +11,7 @@
*/
class Module_Faq extends Module {

public $version = '1.0';
public $version = '2.0';

public function info()
{
Expand All @@ -25,7 +25,31 @@ public function info()
'frontend' => TRUE,
'backend' => TRUE,
'menu' => 'content',
'author' => 'Stephen Cozart'
'author' => 'Stephen Cozart',
'sections' => array(
'faqs' => array(
'name'=>'faq_questions_title',
'uri'=>'admin/faq',
'shortcuts' => array(
array(
'name' => 'faq_create_title',
'uri' => 'admin/faq/create',
'class'=>'add'
),
),
),
'categories' => array(
'name' => 'faq_category_index_title',
'uri' => 'admin/faq/categories',
'shortcuts' => array(
array(
'name' => 'faq_category_create_title',
'uri' => 'admin/faq/categories/create',
'class'=>'add'
),
),
),
)
);
}

Expand Down
24 changes: 15 additions & 9 deletions js/faq.js
Expand Up @@ -57,11 +57,13 @@
}
$.post(post_url, form_data, function(data, response, xhr) {
var obj = $.parseJSON(data);
create_notification(obj.status, obj.message);
if(obj.status == 'success')
{
load_content(url);
load_content(url,obj.status,obj.message);
//create_notification(obj.status, obj.message);
}
else
create_notification(obj.status, obj.message);
});
}

Expand All @@ -70,28 +72,28 @@
*/
function create_notification(type, message)
{
var notice = '<div class="closable notification '+ type +'">'+message+'<a class="close" href="#">close</a></div>';
var notice = '<div class="alert '+ type +'">'+message+'</div>';
remove_notification();
$('#shortcuts').after(notice);
$('.notification').slideDown('normal');
$('#content-body').prepend(notice);
$('.alert').fadeIn('normal');
}

/**
* Remove notifications
*/
function remove_notification()
{
$('.notification').slideUp('normal', function() {
$('.alert').fadeOut('normal', function() {
$(this).remove();
});
}

/**
* Content switcher
*/
function load_content(load_url)
function load_content(load_url,type,message)
{
$('#content').slideUp('normal', function() {
$('#content-body').fadeOut('normal', function() {
$(this).load(load_url, function(data, response, xhr) {

//handle answer ckeditor
Expand All @@ -105,7 +107,11 @@
}
init_ckeditor();
do_sortable();
$(this).slideDown('normal');
$(this).find('.table_action_buttons button').attr('disabled','disabled');
if( typeof type != 'undefined' && typeof message != 'undefined' )
create_notification(type,message);

$(this).fadeIn('normal');
});
});
}
Expand Down
1 change: 1 addition & 0 deletions language/english/faq_lang.php
Expand Up @@ -31,6 +31,7 @@
$lang['faq_page_title'] = "Frequently Asked Questions";
$lang['faq_category_page_title'] = "Question Categories";
$lang['faq_home_title'] = 'FAQ Home';
$lang['faq_questions_title'] = 'Questions';#translate

//links
$lang['faq_edit_link'] = 'Edit';
Expand Down
45 changes: 28 additions & 17 deletions views/admin/categories/create.php
@@ -1,21 +1,32 @@
<h3><?php echo lang('faq_category_create_title'); ?></h3>
<section class="title">
<h4><?php echo lang('faq_category_create_title'); ?></h4>
</section>
<section class="item">
<?php echo form_open('admin/faq/categories/create', 'id="categories" class="crud"'); ?>
<ol>
<li>
<label for="title"><?php echo lang('faq_category_label'); ?></label>
<input name="title" type="text" value="<?php echo set_value('title'); ?>" />
<span class="required-icon tooltip">*</span>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<?php echo form_dropdown('published', $publish_options, set_value('published')); ?>
</li>
<li>
<label for="description"><?php echo lang('faq_category_description_label'); ?></label>
<textarea name="description" rows="5" cols="80"><?php echo set_value('description'); ?></textarea>
</li>
</ol>
<div class="form_inputs">
<fieldset>
<ul>
<li>
<label for="title"><?php echo lang('faq_category_label'); ?><span class="required-icon tooltip">*</span></label>
<div class="input">
<input name="title" type="text" value="<?php echo set_value('title'); ?>" />
</div>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<div class="input">
<?php echo form_dropdown('published', $publish_options, set_value('published')); ?>
</div>
</li>
<li>
<label for="description"><?php echo lang('faq_category_description_label'); ?></label>
<textarea name="description" rows="5" cols="80"><?php echo set_value('description'); ?></textarea>
</li>
</ul>
</fieldset>
</div>
<div class="buttons">
<?php $this->load->view('admin/partials/buttons', array('buttons' => array('save', 'cancel') )); ?>
</div>
<?php echo form_close(); ?>
<?php echo form_close(); ?>
</section>
45 changes: 28 additions & 17 deletions views/admin/categories/edit.php
@@ -1,22 +1,33 @@
<h3><?php echo lang('faq_category_edit_title'); ?></h3>
<section class="title">
<h4><?php echo lang('faq_category_edit_title'); ?></h4>
</section>
<section class="item">
<?php echo form_open('admin/faq/categories/edit/'.$category->id, 'id="categories" class="crud"'); ?>
<ol>
<li>
<label for="title"><?php echo lang('faq_category_label'); ?></label>
<input name="title" type="text" value="<?php echo $category->title; ?>" />
<span class="required-icon tooltip">*</span>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<?php echo form_dropdown('published', $publish_options, $category->published); ?>
</li>
<li>
<label for="description"><?php echo lang('faq_category_description_label'); ?></label>
<textarea name="description" rows="5" cols="80"><?php echo $category->description; ?></textarea>
</li>
</ol>
<div class="form_inputs">
<fieldset>
<ul>
<li>
<label for="title"><?php echo lang('faq_category_label'); ?><span class="required-icon tooltip">*</span></label>
<div class="input">
<input name="title" type="text" value="<?php echo $category->title; ?>" />
</div>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<div class="input">
<?php echo form_dropdown('published', $publish_options, $category->published); ?>
<div class="input">
</li>
<li>
<label for="description"><?php echo lang('faq_category_description_label'); ?></label>
<textarea name="description" rows="5" cols="80"><?php echo $category->description; ?></textarea>
</li>
</ul>
</fieldset>
</div>
<input type="hidden" name="category_id" value="<?php echo $category->id; ?>" />
<div class="buttons">
<?php $this->load->view('admin/partials/buttons', array('buttons' => array('save', 'cancel') )); ?>
</div>
<?php echo form_close(); ?>
<?php echo form_close(); ?>
</section>
67 changes: 36 additions & 31 deletions views/admin/categories/index.php
@@ -1,40 +1,45 @@
<h3><?php echo lang('faq_category_index_title'); ?></h3>

<section class="title">
<h4><?php echo lang('faq_category_index_title'); ?></h4>
</section>
<section class="item">
<?php if(!empty($categories)): ?>
<?php echo form_open('admin/faq/categories/action', 'class="crud"') ?>
<table border="0" class="table-list">
<thead>
<tr>
<th><?php echo form_checkbox(array('name' => 'action_to_all', 'class' => 'check-all'));?></th>
<th><?php echo lang('faq_category_label') ?></th>
<th class="width-5"><?php echo lang('faq_published_label') ?></th>
<th class="width-10"><span><?php echo lang('faq_actions_label');?></span></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">
<div class="inner"><?php $this->load->view('admin/partials/pagination'); ?></div>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach($categories as $c): ?>
<tr>
<td><?php echo form_checkbox('action_to[]', $c->id) ?></td>
<td><?php echo $c->title; ?></td>
<td><?php echo $c->published; ?></td>
<td class="buttons buttons-small">
<?php echo anchor('admin/faq/categories/edit/'.$c->id, lang('faq_edit_link'), 'rel="ajax" class="button"'); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<thead>
<tr>
<th><?php echo form_checkbox(array('name' => 'action_to_all', 'class' => 'check-all'));?></th>
<th><?php echo lang('faq_category_label') ?></th>
<th class="width-5"><?php echo lang('faq_published_label') ?></th>
<th class="width-10"><span><?php echo lang('faq_actions_label');?></span></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">
<div class="inner"><?php $this->load->view('admin/partials/pagination'); ?></div>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach($categories as $c): ?>
<tr>
<td><?php echo form_checkbox('action_to[]', $c->id) ?></td>
<td><?php echo $c->title; ?></td>
<td><?php echo $c->published; ?></td>
<td class="buttons buttons-small">
<?php echo anchor('admin/faq/categories/edit/'.$c->id, lang('faq_edit_link'), 'rel="ajax" class="btn orange edit button"'); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="buttons">
<div class="table_action_buttons">
<?php $this->load->view('admin/partials/buttons', array('buttons' => array('delete'))); ?>
</div>
<?php echo form_close(); ?>
<?php else: ?>
<p><?php echo lang('faq_no_categories');?></p>
<div class="no_data">
<?php echo lang('faq_no_categories');?>
</div>
<?php endif; ?>
</section>
55 changes: 34 additions & 21 deletions views/admin/create.php
@@ -1,25 +1,38 @@
<h3><?php echo lang('faq_create_title'); ?></h3>
<section class="title">
<h4><?php echo lang('faq_create_title'); ?></h4>
</section>
<section class="item">
<?php echo form_open('admin/faq/create', 'id="faq" class="crud"'); ?>
<ol>
<li>
<label for="question"><?php echo lang('faq_question_label'); ?></label>
<input name="question" type="text" value="<?php echo set_value('question'); ?>" />
<span class="required-icon tooltip">*</span>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<?php echo form_dropdown('published', $publish_options, set_value('published')); ?>
</li>
<li>
<label for="category"><?php echo lang('faq_category_label'); ?></label>
<?php echo form_dropdown('category', $category_options, set_value('category')); ?>
</li>
<li>

<textarea name="answer" rows="5" cols="80" class="wysiwyg-simple"><?php echo set_value('answer'); ?></textarea>
</li>
</ol>
<div class="form_inputs">
<fieldset>
<ul>
<li>
<label for="question"><?php echo lang('faq_question_label'); ?><span>*</span></label>
<div class="input">
<input name="question" type="text" value="<?php echo set_value('question'); ?>" />
</div>
</li>
<li class="even">
<label for="published"><?php echo lang('faq_published_label'); ?></label>
<div class="input">
<?php echo form_dropdown('published', $publish_options, set_value('published')); ?>
</div>
</li>
<li>
<label for="category"><?php echo lang('faq_category_label'); ?></label>
<div class="input">
<?php echo form_dropdown('category', $category_options, set_value('category')); ?>
</div>
</li>
<li>
<label for="answer"><?php echo lang('faq_answer_label'); ?></label><br style="clear: both;"/>
<textarea name="answer" rows="5" cols="80" class="wysiwyg-simple"><?php echo set_value('answer'); ?></textarea>
</li>
</ul>
</fieldset>
</div>
<div class="buttons">
<?php $this->load->view('admin/partials/buttons', array('buttons' => array('save', 'cancel') )); ?>
</div>
<?php echo form_close(); ?>
<?php echo form_close(); ?>
</section>

0 comments on commit 17f8236

Please sign in to comment.