1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 11:47:51 +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,65 +1,94 @@
<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>
<?php <li <?php if (Notification::get('seo')) { ?>class="active"<?php } ?>><a href="#seo" data-toggle="tab"><?php echo __('SEO', 'pages'); ?></a></li>
echo ( <li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
Form::label('page_name', __('Name (slug)', 'pages')) </ul>
);
?>
<?php <div class="tab-content tab-page">
echo ( <div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
Form::input('page_name', $post_name, array('class' => 'span6')) <?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>'; echo (
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>'; 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 if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
echo ( if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
Html::br(2). ?>
Form::label('page_title', __('Title', 'pages'))
); </div>
?> <div class="tab-pane <?php if (Notification::get('seo')) { ?>active<?php } ?>" id="seo">
<?php
echo (
<?php Form::label('page_description', __('Description', 'pages')).
echo ( Form::input('page_description', $post_description, array('class' => 'span8')).
Form::input('page_title', $post_title, array('class' => 'span6')) Html::br(2).
); Form::label('page_keywords', __('Keywords', 'pages')).
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>'; Form::input('page_keywords', $post_keywords, array('class' => 'span8'))
?> );
?>
<?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'))
);
?>
<?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 /> <br /><br />
<?php Action::run('admin_editor', array(Html::toText($post_content))); ?> <?php Action::run('admin_editor', array(Html::toText($post_content))); ?>
@@ -67,67 +96,18 @@
<br /> <br />
<div class="row-fluid"> <div class="row-fluid">
<div class="span4"> <div class="span6">
<?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">
<?php <?php
echo ( echo (
Form::label(__('Published on', 'pages'), __('Published on', 'pages')). Form::submit('add_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::input('year', $date[0], array('class' => 'input-mini')). ' ' . Form::submit('add_page', __('Save', 'pages'), array('class' => 'btn'))
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>
<div class="span3"> <div class="span6">
<?php <div class="pull-right">Published on: <input class="input-large" type="text" name="page_date" value="<?php echo $date; ?>"></div>
echo ( <?php echo Form::close(); ?>
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>
</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>
</div> </div>

View File

@@ -1,87 +1,121 @@
<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')).
<?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::hidden('old_parent', $page['parent']). Form::hidden('old_parent', $page['parent']).
Form::hidden('page_id', $page['id']) 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 /> <br /><br />
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?> <?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>
@@ -89,83 +123,18 @@
<br /> <br />
<div class="row-fluid"> <div class="row-fluid">
<?php <div class="span6">
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">
<?php <?php
echo ( echo (
Form::label(__('Published on', 'pages'), __('Published on', 'pages')). Form::submit('edit_page_and_exit', __('Save and exit', 'pages'), array('class' => 'btn')).Html::nbsp(2).
Form::input('year', $date[0], array('class' => 'input-mini')). ' ' . Form::submit('edit_page', __('Save', 'pages'), array('class' => 'btn'))
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>
<div class="span3"> <div class="span6">
<?php <div class="pull-right">Published on: <input class="input-large" type="text" name="page_date" value="<?php echo $date; ?>"></div>
echo ( <?php echo Form::close(); ?>
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>
</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>
</div> </div>