1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-02 19:27:52 +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 (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'); if (trim(Request::post('page_title')) == '') $errors['pages_empty_title'] = __('This field should not be empty', 'pages');
// Generate date // Prepare date
$date = mktime(Request::post('hour'), if (Valid::date(Request::post('page_date'))) {
Request::post('minute'), $date = strtotime(Request::post('page_date'));
Request::post('second'), } else {
Request::post('month'), $date = time();
Request::post('day'), }
Request::post('year'));
if (Request::post('robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; if (Request::post('robots_index')) $robots_index = 'noindex'; else $robots_index = 'index';
if (Request::post('robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; if (Request::post('robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow';
@@ -201,7 +200,9 @@
//-------------- //--------------
// Generate date // 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 // Display view
View::factory('box/pages/views/backend/add') 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('templates')) $template = Request::post('templates'); else $template = $page['template'];
if (Request::post('status')) $status = Request::post('status'); else $status = $page['status']; 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 // Display view
View::factory('box/pages/views/backend/edit') View::factory('box/pages/views/backend/edit')

View File

@@ -1,57 +1,47 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<h2><?php echo __('New page', 'pages'); ?></h2> <h2><?php echo __('New page', 'pages'); ?></h2>
<br /> <br />
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?> <?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 <?php
echo ( echo (
Form::open(null, array('class' => 'form-horizontal')) Form::open().
Form::hidden('csrf', Security::token())
); );
?> ?>
<?php echo (Form::hidden('csrf', Security::token())); ?> <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 <?php
echo ( echo (
Form::label('page_name', __('Name (slug)', 'pages')) Form::label('page_title', __('Title', 'pages')).
); Form::input('page_title', $post_title, array('class' => (isset($errors['pages_empty_title'])) ? 'span6 error-field' : 'span6'))
?>
<?php
echo (
Form::input('page_name', $post_name, 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', $post_title, array('class' => '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_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
?>
<?php
echo ( echo (
Html::br(2). 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'))
);
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::label('page_description', __('Description', 'pages')).
Form::input('page_description', $post_description, array('class' => 'span8')). Form::input('page_description', $post_description, array('class' => 'span8')).
Html::br(2). Html::br(2).
@@ -60,12 +50,16 @@
); );
?> ?>
<br /><br /> <?php
echo (
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?> Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
<br /> '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="row-fluid">
<div class="span4"> <div class="span4">
<?php <?php
@@ -92,42 +86,28 @@
?> ?>
</div> </div>
</div> </div>
</div>
</div>
<hr> <br /><br />
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?>
<br />
<div class="row-fluid"> <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'))
);
?>
</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>
</div>
<hr>
<?php <?php
echo ( echo (
Form::submit('add_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2). 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::submit('add_page', __('Save', 'pages'), array('class' => 'btn'))
Form::close()
); );
?> ?>
</div>
<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>
</div> </div>
</div> </div>

View File

@@ -1,45 +1,41 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<h2> <h2><?php if (Request::get('name') == 'error404') { echo __('Edit 404 page', 'pages'); } else { echo __('Edit page', 'pages'); } ?></h2>
<?php
if (Request::get('name') == 'error404') {
echo __('Edit 404 page', 'pages');
} else {
echo __('Edit page', 'pages');
}
?>
</h2>
<br /> <br />
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?> <?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 <?php
echo ( echo (
Form::open(null, array('class' => 'form-horizontal')) 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'])
); );
?> ?>
<?php echo (Form::hidden('csrf', Security::token())); ?> <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 <?php
echo ( echo (
Form::hidden('page_old_name', Request::get('name')) 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') { if (Request::get('name') !== 'error404') {
echo ( echo (
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages')) Form::label('page_name', __('Name (slug)', 'pages'))
); );
} }
?>
<?php
if (Request::get('name') == 'error404') { if (Request::get('name') == 'error404') {
echo Form::hidden('page_name', $slug_to_edit); echo Form::hidden('page_name', $slug_to_edit);
@@ -52,42 +48,28 @@
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</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>'; if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
?> ?>
</div>
<?php <div class="tab-pane <?php if (Notification::get('seo')) { ?>active<?php } ?>" id="seo">
echo (
Html::br(2).
Form::label('page_title', __('Title', 'pages'))
);
?>
<?php <?php
echo ( 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::label('page_description', __('Description', 'pages')).
Form::input('page_description', $description_to_edit, array('class' => 'span8')). Form::input('page_description', $description_to_edit, array('class' => 'span8')).
Html::br(2). Html::br(2).
Form::label('page_keywords', __('Keywords', 'pages')). Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $keywords_to_edit, array('class' => 'span8')). Form::input('page_keywords', $keywords_to_edit, array('class' => 'span8'))
Form::hidden('old_parent', $page['parent']). );
Form::hidden('page_id', $page['id'])
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>
<br /><br /> <div class="tab-pane <?php if (Notification::get('settings')) { ?>active<?php } ?>" id="settings">
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
<br />
<div class="row-fluid"> <div class="row-fluid">
<?php <?php
if (Request::get('name') == 'error404') { if (Request::get('name') == 'error404') {
@@ -130,42 +112,29 @@
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
</div>
</div>
<hr>
<br /><br />
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
<br />
<div class="row-fluid"> <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'))
);
?>
</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>
</div>
<hr>
<?php <?php
echo ( echo (
Form::submit('edit_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2). 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::submit('edit_page', __('Save', 'pages'), array('class' => 'btn'))
Form::close()
); );
?> ?>
</div>
<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>
</div> </div>
</div> </div>