1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

Pages Plugin: ui and logic updates.

This commit is contained in:
Awilum
2012-09-30 01:32:03 +03:00
parent dac5a8c58e
commit e8609ae691
3 changed files with 203 additions and 250 deletions

View File

@@ -116,13 +116,12 @@
if (count($page) != 0) $errors['pages_exists'] = __('This page already exists', 'pages');
if (trim(Request::post('page_title')) == '') $errors['pages_empty_title'] = __('This field should not be empty', 'pages');
// Generate date
$date = mktime(Request::post('hour'),
Request::post('minute'),
Request::post('second'),
Request::post('month'),
Request::post('day'),
Request::post('year'));
// Prepare date
if (Valid::date(Request::post('page_date'))) {
$date = strtotime(Request::post('page_date'));
} else {
$date = time();
}
if (Request::post('robots_index')) $robots_index = 'noindex'; else $robots_index = 'index';
if (Request::post('robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow';
@@ -201,7 +200,9 @@
//--------------
// Generate date
$date = explode('-', Date::format(time(), 'Y-m-d-H-i-s'));
$date = Date::format(time(), 'Y-m-d H:i:s');
Notification::setNow('page', 'page');
// Display view
View::factory('box/pages/views/backend/add')
@@ -392,7 +393,10 @@
if (Request::post('templates')) $template = Request::post('templates'); else $template = $page['template'];
if (Request::post('status')) $status = Request::post('status'); else $status = $page['status'];
$date = explode('-', Date::format($page['date'],'Y-m-d-H-i-s'));
// Generate date
$date = Date::format(time(), 'Y-m-d H:i:s');
Notification::setNow('page', 'page');
// Display view
View::factory('box/pages/views/backend/edit')

View File

@@ -1,65 +1,94 @@
<div class="row-fluid">
<div class="span12">
<h2><?php echo __('New page', 'pages'); ?></h2>
<br />
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php if (isset($errors['pages_empty_name']) or isset($errors['pages_exists'])) $error_class1 = 'error'; else $error_class1 = ''; ?>
<?php if (isset($errors['pages_empty_title'])) $error_class2 = 'error'; else $error_class2 = ''; ?>
<?php
echo (
Form::open(null, array('class' => 'form-horizontal'))
Form::open().
Form::hidden('csrf', Security::token())
);
?>
<?php echo (Form::hidden('csrf', Security::token())); ?>
<?php
echo (
Form::label('page_name', __('Name (slug)', 'pages'))
);
?>
<ul class="nav nav-tabs">
<li <?php if (Notification::get('page')) { ?>class="active"<?php } ?>><a href="#page" data-toggle="tab"><?php echo __('Page', 'pages'); ?></a></li>
<li <?php if (Notification::get('seo')) { ?>class="active"<?php } ?>><a href="#seo" data-toggle="tab"><?php echo __('SEO', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<?php
echo (
Form::input('page_name', $post_name, array('class' => 'span6'))
);
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
echo (
Form::label('page_title', __('Title', 'pages')).
Form::input('page_title', $post_title, array('class' => (isset($errors['pages_empty_title'])) ? 'span6 error-field' : 'span6'))
);
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
?>
echo (
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages')).
Form::input('page_name', $post_name, array('class' => (isset($errors['pages_exists'])) ? 'span6 error-field' : 'span6'))
);
<?php
echo (
Html::br(2).
Form::label('page_title', __('Title', 'pages'))
);
?>
<?php
echo (
Form::input('page_title', $post_title, array('class' => 'span6'))
);
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
?>
<?php
echo (
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::input('page_description', $post_description, array('class' => 'span8')).
Html::br(2).
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $post_keywords, array('class' => 'span8'))
);
?>
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
?>
</div>
<div class="tab-pane <?php if (Notification::get('seo')) { ?>active<?php } ?>" id="seo">
<?php
echo (
Form::label('page_description', __('Description', 'pages')).
Form::input('page_description', $post_description, array('class' => 'span8')).
Html::br(2).
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $post_keywords, array('class' => 'span8'))
);
?>
<?php
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
?>
</div>
<div class="tab-pane <?php if (Notification::get('settings')) { ?>active<?php } ?>" id="settings">
<div class="row-fluid">
<div class="span4">
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
<div class="span4">
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $post_template)
);
?>
</div>
<div class="span4">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, 'published')
);
?>
</div>
</div>
</div>
</div>
<br /><br />
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?>
@@ -67,67 +96,18 @@
<br />
<div class="row-fluid">
<div class="span4">
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
<div class="span4">
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $post_template)
);
?>
</div>
<div class="span4">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, 'published')
);
?>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="span8">
<div class="span6">
<?php
echo (
Form::label(__('Published on', 'pages'), __('Published on', 'pages')).
Form::input('year', $date[0], array('class' => 'input-mini')). ' ' .
Form::input('month', $date[1], array('class' => 'input-mini')). ' ' .
Form::input('day', $date[2], array('class' => 'input-mini')). ' <span style="color:gray;">@</span> '.
Form::input('minute', $date[3], array('class' => 'input-mini')). ' : '.
Form::input('second', $date[4], array('class' => 'input-mini'))
Form::submit('add_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::submit('add_page', __('Save', 'pages'), array('class' => 'btn'))
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
?>
<div class="span6">
<div class="pull-right">Published on: <input class="input-large" type="text" name="page_date" value="<?php echo $date; ?>"></div>
<?php echo Form::close(); ?>
</div>
</div>
<hr>
<?php
echo (
Form::submit('add_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::submit('add_page', __('Save', 'pages'), array('class' => 'btn')).
Form::close()
);
?>
</div>
</div>

View File

@@ -1,87 +1,121 @@
<div class="row-fluid">
<div class="span12">
<h2>
<?php
if (Request::get('name') == 'error404') {
echo __('Edit 404 page', 'pages');
} else {
echo __('Edit page', 'pages');
}
?>
</h2>
<h2><?php if (Request::get('name') == 'error404') { echo __('Edit 404 page', 'pages'); } else { echo __('Edit page', 'pages'); } ?></h2>
<br />
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php if (isset($errors['pages_empty_name'])) $error_class1 = 'error'; else $error_class1 = ''; ?>
<?php if (isset($errors['pages_exists'])) $error_class1 = 'error'; else $error_class1 = ''; ?>
<?php if (isset($errors['pages_empty_title'])) $error_class2 = 'error'; else $error_class2 = ''; ?>
<?php
echo (
Form::open(null, array('class' => 'form-horizontal'))
);
?>
<?php echo (Form::hidden('csrf', Security::token())); ?>
<?php
echo (
Form::hidden('page_old_name', Request::get('name'))
);
if (Request::get('name') !== 'error404') {
echo (
Form::label('page_name', __('Name (slug)', 'pages'))
);
}
?>
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('page_name', $slug_to_edit);
} else {
echo (
Form::input('page_name', $slug_to_edit, array('class' => 'span6'))
);
}
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
?>
<?php
echo (
Html::br(2).
Form::label('page_title', __('Title', 'pages'))
);
?>
<?php
echo (
Form::input('page_title', $title_to_edit, array('class' => 'span6'))
);
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
?>
<?php
echo (
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::input('page_description', $description_to_edit, array('class' => 'span8')).
Html::br(2).
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $keywords_to_edit, array('class' => 'span8')).
Form::open().
Form::hidden('csrf', Security::token()).
Form::hidden('page_old_name', Request::get('name')).
Form::hidden('old_parent', $page['parent']).
Form::hidden('page_id', $page['id'])
);
?>
<ul class="nav nav-tabs">
<li <?php if (Notification::get('page')) { ?>class="active"<?php } ?>><a href="#page" data-toggle="tab"><?php echo __('Page', 'pages'); ?></a></li>
<li <?php if (Notification::get('seo')) { ?>class="active"<?php } ?>><a href="#seo" data-toggle="tab"><?php echo __('SEO', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
echo (
Form::label('page_title', __('Title', 'pages')).
Form::input('page_title', $title_to_edit, array('class' => (isset($errors['pages_empty_title'])) ? 'span6 error-field' : 'span6'))
);
if (Request::get('name') !== 'error404') {
echo (
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages'))
);
}
if (Request::get('name') == 'error404') {
echo Form::hidden('page_name', $slug_to_edit);
} else {
echo (
Form::input('page_name', $slug_to_edit, array('class' => 'span6'))
);
}
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
?>
</div>
<div class="tab-pane <?php if (Notification::get('seo')) { ?>active<?php } ?>" id="seo">
<?php
echo (
Form::label('page_description', __('Description', 'pages')).
Form::input('page_description', $description_to_edit, array('class' => 'span8')).
Html::br(2).
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $keywords_to_edit, array('class' => 'span8'))
);
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
?>
</div>
<div class="tab-pane <?php if (Notification::get('settings')) { ?>active<?php } ?>" id="settings">
<div class="row-fluid">
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('pages', $parent_page);
} else {
?>
<div class="span4">
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
<?php } ?>
<?php if (Request::get('name') != 'error404') { ?>
<div class="span4">
<?php } else { ?>
<div>
<?php } ?>
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $template)
);
?>
</div>
<?php
if(Request::get('name') == 'error404') {
echo Form::hidden('status', $status);
} else {
?>
<div class="span4">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $status)
);
?>
</div>
<?php } ?>
</div>
</div>
</div>
<br /><br />
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
@@ -89,83 +123,18 @@
<br />
<div class="row-fluid">
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('pages', $parent_page);
} else {
?>
<div class="span4">
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
<?php } ?>
<?php if (Request::get('name') != 'error404') { ?>
<div class="span4">
<?php } else { ?>
<div>
<?php } ?>
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $template)
);
?>
</div>
<?php
if(Request::get('name') == 'error404') {
echo Form::hidden('status', $status);
} else {
?>
<div class="span4">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $status)
);
?>
</div>
<?php } ?>
</div>
<hr>
<div class="row-fluid">
<div class="span8">
<div class="span6">
<?php
echo (
Form::label(__('Published on', 'pages'), __('Published on', 'pages')).
Form::input('year', $date[0], array('class' => 'input-mini')). ' ' .
Form::input('month', $date[1], array('class' => 'input-mini')). ' ' .
Form::input('day', $date[2], array('class' => 'input-mini')). ' @ '.
Form::input('minute', $date[3], array('class' => 'input-mini')). ' : '.
Form::input('second', $date[4], array('class' => 'input-mini'))
Form::submit('edit_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::submit('edit_page', __('Save', 'pages'), array('class' => 'btn'))
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
?>
<div class="span6">
<div class="pull-right">Published on: <input class="input-large" type="text" name="page_date" value="<?php echo $date; ?>"></div>
<?php echo Form::close(); ?>
</div>
</div>
<hr>
<?php
echo (
Form::submit('edit_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::submit('edit_page', __('Save', 'pages'), array('class' => 'btn')).
Form::close()
);
?>
</div>
</div>