Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Oct 18, 2016
2 parents f4852f4 + a89f77c commit 7a6bdf3
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 51 deletions.
16 changes: 16 additions & 0 deletions doc/faq/technical.md
Expand Up @@ -142,3 +142,19 @@ Email sending
| cms_email_priority | Let it be `3` |
| cms_email_bcc_batch_mode | Let it be `FALSE` |
| cms_email_bcc_batch_size | Let it be `200` |

How could I add a quicklink that run a javascript function?
===========================================================

Go to `CMS Management | Setting`, click `Page Partials` tab, paste this script into `custom script` textarea:

```javascript
$(document).ready(function(){
var additional_quicklink = '<li class="dropdown"><a id="qlink" href="#">Test</a></li>';
$('#_top_navigation>div.container>nav>ul.navbar-nav:first').append(additional_quicklink);
$('#qlink').click(function(event){
window.alert("Hi hi hi");
event.preventDefault();
});
});
```
10 changes: 5 additions & 5 deletions modules/blog/controllers/Manage_article.php
Expand Up @@ -58,8 +58,8 @@ protected function make_crud(){

// displayed columns on list, edit, and add, uncomment to use
$crud->columns('article_title', 'author_user_id', 'status', 'publish_date', 'featured' , 'category_article', 'comments');
$crud->edit_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'category_article', 'keyword', 'description', 'featured', 'allow_comment', 'photos', 'comments', '_updated_by', '_updated_at');
$crud->add_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'category_article', 'keyword', 'description', 'featured', 'allow_comment', 'photos', 'comments', '_created_by', '_created_at');
$crud->edit_fields('article_title', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'category_article', 'photos', 'keyword', 'description', 'article_url', 'featured', 'allow_comment', 'comments', '_updated_by', '_updated_at');
$crud->add_fields('article_title', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'category_article', 'photos', 'keyword', 'description', 'article_url', 'featured', 'allow_comment', 'comments', '_created_by', '_created_at');
//$crud->set_read_fields('article_title', 'article_url', 'keyword', 'description', 'date', 'author_user_id', 'content', 'allow_comment', 'status', 'visited', 'featured', 'publish_date', 'photo', 'comment', 'category_article');

// caption of each columns
Expand Down Expand Up @@ -162,15 +162,15 @@ protected function make_crud(){
$crud->unset_texteditor('keyword');
$crud->unset_texteditor('description');

$crud->set_outside_tab(6);
$crud->set_outside_tab(5);
$crud->set_tabs(array(
'Setting' => 4,
'Photos' => 1,
'Setting' => 5,
'Comments' => 1,
));
$crud->set_tab_glyphicons(array(
'Setting' => 'glyphicon-th-list',
'Photos' => 'glyphicon-picture',
'Setting' => 'glyphicon-th-list',
'Comments' => 'glyphicon-comment',
));

Expand Down
18 changes: 9 additions & 9 deletions modules/blog/views/field_article_comments.php
Expand Up @@ -12,8 +12,7 @@
<table id="md_table_comments" class="table table-striped table-bordered">
<thead>
<tr>
<th style="width:350px;">Comment Summary</th>
<th style="width:100px;">Action</th>
<th style="width:450px;">Comment Summary</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -129,18 +128,19 @@ function add_table_row_comments(value){
component += '<div">';
component += comment_content;
component += '</div>';
component += '</td>';




/////////////////////////////////////////////////////////////////////////////
// Delete Button
/////////////////////////////////////////////////////////////////////////////

component += '<td>';
component += '<a class="btn btn-primary toggle_comment_approve" record_index="'+RECORD_INDEX_comments+'" href="#">' + caption + '</a><br /><br />';
component += '<input class="md_field_comments_delete btn btn-danger" record_index="'+RECORD_INDEX_comments+'" primary_key="" type="button" value="Delete" /></td>';
component += '<div style="clear:both;"></div>';
component += '<div class="pull-right">';
component += '<a class="btn btn-default toggle_comment_approve" record_index="'+RECORD_INDEX_comments+'" href="#">' + caption + '</a>&nbsp;';
component += '<input class="md_field_comments_delete btn btn-default" record_index="'+RECORD_INDEX_comments+'" primary_key="" type="button" value="Delete" />';
component += '</div>';
component += '<div style="clear:both;"></div>';

component += '</td>';
component += '</tr>';

/////////////////////////////////////////////////////////////////////////////
Expand Down
167 changes: 131 additions & 36 deletions modules/blog/views/field_article_photos.php
Expand Up @@ -11,21 +11,22 @@
background-repeat : no-repeat;
background-position:center;
}
.md_field_photos_col_index{
width : 50px;
}
.md_field_photos_col_caption{
width : 257px;
}
.md_field_photos_tr:last-child .move_down{
display:none!important;
}
.md_field_photos_tr:first-child .move_up{
display:none!important;
}
</style>

<table id="md_table_photos" class="table table-striped table-bordered">
<thead>
<tr>
<th style="width:50px;">Index</th>
<th style="width:150px;">Photo</th>
<th style="width:300px;">Caption</th>
<th style="width:100px;">Action</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -84,20 +85,6 @@ function add_table_row_photos(value){

var component = '<tr id="md_field_photos_tr_'+RECORD_INDEX_photos+'" class="md_field_photos_tr">';

/////////////////////////////////////////////////////////////////////////////
// FIELD "index"
/////////////////////////////////////////////////////////////////////////////
var field_value = 0;
if(typeof(value) != 'undefined' && value.hasOwnProperty('index')){
field_value = value.index;
}
component += '<td>';
component += '<input id="md_field_photos_col_index_'+RECORD_INDEX_photos+
'" record_index="'+RECORD_INDEX_photos+
'" class="md_field_photos_col md_field_photos_col_index form-control" column_name="index" type="text"'+
' name="md_field_photos_col_index_'+RECORD_INDEX_photos+'" value="'+field_value+'" />';
component += '</td>';

/////////////////////////////////////////////////////////////////////////////
// FIELD "url"
/////////////////////////////////////////////////////////////////////////////
Expand All @@ -109,34 +96,55 @@ function add_table_row_photos(value){
if(field_value != ''){
component += '<div class="_photo-preview" style="background-image:url(\''+UPLOAD_PATH+'thumb_'+field_value+'\')"></div>';
}else{
component += '<span id="photo_file_name_'+RECORD_INDEX_photos+'" style="display:none;"></span>';
component += '<input id="md_field_photos_col_url_'+RECORD_INDEX_photos+
'" record_index="'+RECORD_INDEX_photos+
'" class="md_field_photos_col form-control" column_name="url" type="file"'+
'" class="md_field_photos_col md_field_photos_col_url" column_name="url" type="file"'+
' name="md_field_photos_col_url_'+RECORD_INDEX_photos+'" value="'+field_value+'"/>';
}

component += '</td>';

/////////////////////////////////////////////////////////////////////////////
// FIELD "caption"
/////////////////////////////////////////////////////////////////////////////
var field_value = '';
if(typeof(value) != 'undefined' && value.hasOwnProperty('caption')){
field_value = value.caption;
}
component += '<td>';
component += '<textarea id="md_field_photos_col_caption_'+RECORD_INDEX_photos+
'" record_index="'+RECORD_INDEX_photos+
'" class="md_field_photos_col md_field_photos_col_caption form-control" column_name="caption"'+
' name="md_field_photos_col_caption_'+RECORD_INDEX_photos+'">'+field_value+'</textarea>';
component += '</td>';
/////////////////////////////////////////////////////////////////////////////
// FIELD "caption"
/////////////////////////////////////////////////////////////////////////////
var field_value = '';
if(typeof(value) != 'undefined' && value.hasOwnProperty('caption')){
field_value = value.caption;
}
component += '<textarea id="md_field_photos_col_caption_'+RECORD_INDEX_photos+
'" record_index="'+RECORD_INDEX_photos+
'" class="md_field_photos_col md_field_photos_col_caption form-control" column_name="caption"'+
' name="md_field_photos_col_caption_'+RECORD_INDEX_photos+'">'+field_value+'</textarea><br />';

/////////////////////////////////////////////////////////////////////////////
// FIELD "index"
/////////////////////////////////////////////////////////////////////////////
var field_value = 0;
if(typeof(value) != 'undefined' && value.hasOwnProperty('index')){
field_value = value.index;
}
component += '<input id="md_field_photos_col_index_'+RECORD_INDEX_photos+
'" record_index="'+RECORD_INDEX_photos+
'" class="md_field_photos_col md_field_photos_col_index" column_name="index" type="hidden"'+
' name="md_field_photos_col_index_'+RECORD_INDEX_photos+'" value="'+field_value+'" />';

component += '<div class="pull-right">';
/////////////////////////////////////////////////////////////////////////////
// Move Up and Move Down Button
/////////////////////////////////////////////////////////////////////////////
component += '<a href="#" id="move_up_'+RECORD_INDEX_photos+'" class="move_up btn btn-default" record_index="'+RECORD_INDEX_photos+'"><i class="glyphicon glyphicon-arrow-up"></i></a>&nbsp;';

component += '<a href="#" id="move_down_'+RECORD_INDEX_photos+'" class="move_down btn btn-default" record_index="'+RECORD_INDEX_photos+'"><i class="glyphicon glyphicon-arrow-down"></i></a>&nbsp;';

/////////////////////////////////////////////////////////////////////////////
// Delete Button
/////////////////////////////////////////////////////////////////////////////
component += '<td><input class="md_field_photos_delete btn btn-default" record_index="'+RECORD_INDEX_photos+'" primary_key="" type="button" value="Delete" /></td>';
/////////////////////////////////////////////////////////////////////////////
// Delete Button
/////////////////////////////////////////////////////////////////////////////
component += '<input class="md_field_photos_delete btn btn-default" record_index="'+RECORD_INDEX_photos+'" primary_key="" type="button" value="Delete" />';
component += '</div>';

component += '</td>';
component += '</tr>';

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -187,6 +195,93 @@ function add_table_row_photos(value){
RECORD_INDEX_photos++;
}

/////////////////////////////////////////////////////////////////////////////
// preview before upload
/////////////////////////////////////////////////////////////////////////////
$(document).on('change', '.md_field_photos_col_url', function(event){
if(event.target.files && event.target.files[0]){
var record_index = $(this).attr('record_index');
var span = $('#photo_file_name_'+record_index);
span.html($(this).val());
span.show();
$(this).hide();
}
});

/////////////////////////////////////////////////////////////////////////////
// on move up
/////////////////////////////////////////////////////////////////////////////
$(document).on('click', 'a.move_up', function(event){
event.preventDefault();
//'md_field_photos_tr_'+RECORD_INDEX_photos
// current's
var current_record_index = $(this).attr('record_index');
var current_input = $('#md_field_photos_col_index_'+current_record_index);
var current_index = current_input.val();
var current_tr = $('#md_field_photos_tr_' + current_record_index);
// other's
var other_record_index = null;
var other_input = null;
var other_index = null;
// find other
var best_index = -1;
var found = false;
$('.md_field_photos_col_index').each(function(){
if($(this).val() < current_index){
if(!found || $(this).val() > best_index){
best_index = $(this).val();
other_index = best_index;
other_input = $(this);
other_record_index = other_input.attr('record_index');
found = true;
}
}
});
// find, swap
if(found){
current_input.val(other_index);
other_input.val(current_index);
current_tr.prev().before(current_tr);
}
});

/////////////////////////////////////////////////////////////////////////////
// on move down
/////////////////////////////////////////////////////////////////////////////
$(document).on('click', 'a.move_down', function(event){
event.preventDefault();
//'md_field_photos_tr_'+RECORD_INDEX_photos
// current's
var current_record_index = $(this).attr('record_index');
var current_input = $('#md_field_photos_col_index_'+current_record_index);
var current_index = current_input.val();
var current_tr = $('#md_field_photos_tr_' + current_record_index);
// other's
var other_record_index = null;
var other_input = null;
var other_index = null;
// find other
var best_index = -1;
var found = false;
$('.md_field_photos_col_index').each(function(){
if($(this).val() > current_index){
if(!found || $(this).val() < best_index){
best_index = $(this).val();
other_index = best_index;
other_input = $(this);
other_record_index = other_input.attr('record_index');
found = true;
}
}
});
// find, swap
if(found){
current_input.val(other_index);
other_input.val(current_index);
current_tr.next().after(current_tr);
}
});


/////////////////////////////////////////////////////////////////////////////
// md_field_photos_add.click (Add row)
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -39,7 +39,7 @@ No-CMS come with several batteries included:
Release Information
===================

- v1.1.1, Oct, 08, 2016
- v1.1.2, Oct, 18, 2016


Server Requirements
Expand Down

0 comments on commit 7a6bdf3

Please sign in to comment.