-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added custom sql config example files
isbn to isbn13 converter
Showing
6 changed files
with
102 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- | ||
-- Core Form - Book Base Fields | ||
-- | ||
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_ist`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES | ||
(NULL, 'featuredimage', 'Featured Image', 'featured_image', 'book-base', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'text', 'Subtitle', 'sub_title', 'book-base', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'textarea', 'Description', 'description', 'book-base', 'book-single', 'col-md-8', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'select', 'Author', 'author_idfs', 'book-base', 'book-single', 'col-md-3', '', '/tag/api/list/booksingle_3', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable', 'add-OnePlace\\Tag\\Controller\\TagController'), | ||
(NULL, 'select', 'Category', 'category_idfs', 'book-base', 'book-single', 'col-md-3', '', '/tag/api/list/booksingle_1', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable', 'add-OnePlace\\Tag\\Controller\\TagController'), | ||
(NULL, 'text', 'ISBN', 'isbn', 'book-base', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'text', 'ISBN13', 'isbn13', 'book-base', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''); | ||
|
||
-- | ||
-- Core Form - Book Details Fields | ||
-- | ||
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_ist`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES | ||
(NULL, 'select', 'Format', 'format_idfs', 'book-details', 'book-single', 'col-md-3', '', '/tag/api/list/booksingle_5', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable', 'add-OnePlace\\Tag\\Controller\\TagController'), | ||
(NULL, 'select', 'Language', 'language_idfs', 'book-details', 'book-single', 'col-md-3', '', '/tag/api/list/booksingle_6', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable', 'add-OnePlace\\Tag\\Controller\\TagController'), | ||
(NULL, 'select', 'Publisher', 'publisher_idfs', 'book-details', 'book-single', 'col-md-3', '', '/tag/api/list/booksingle_4', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable', 'add-OnePlace\\Tag\\Controller\\TagController'), | ||
(NULL, 'date', 'Publish Date', 'date_publish', 'book-details', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'text', 'Pages', 'pages', 'book-details', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'text', 'Weight', 'weight', 'book-details', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''), | ||
(NULL, 'text', 'Dimensions', 'dimensions', 'book-details', 'book-single', 'col-md-3', '', '', '0', '1', '0', '', '', ''); | ||
|
||
|
||
-- | ||
-- book Form Tabs | ||
-- | ||
INSERT INTO `core_form_tab` (`Tab_ID`, `form`, `title`, `subtitle`, `icon`, `counter`, `sort_id`, `filter_check`, `filter_value`) VALUES | ||
('book-details', 'book-single', 'Details', 'Infos', 'fas fa-info', '', '1', '', ''); | ||
|
||
-- | ||
-- Tags | ||
-- | ||
INSERT INTO `core_tag` (`Tag_ID`, `tag_key`, `tag_label`) VALUES | ||
(3, 'author', 'Author'), | ||
(4, 'publisher', 'Publisher'), | ||
(5, 'format', 'Format'), | ||
(6, 'language', 'Language'); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- | ||
-- Alter book tables | ||
-- | ||
|
||
ALTER TABLE `book` ADD `sub_title` TEXT NOT NULL DEFAULT '' AFTER `label`; | ||
ALTER TABLE `book` ADD `description` TEXT NOT NULL DEFAULT '' AFTER `sub_title`; | ||
ALTER TABLE `book` ADD `author_idfs` INT(11) NOT NULL DEFAULT '0' AFTER `description`; | ||
ALTER TABLE `book` ADD `isbn` TEXT NOT NULL DEFAULT '' AFTER `author_idfs`; | ||
ALTER TABLE `book` ADD `isbn13` TEXT NOT NULL DEFAULT '' AFTER `isbn`; | ||
ALTER TABLE `book` ADD `publisher_idfs` INT(11) NOT NULL DEFAULT '0' AFTER `isbn13`; | ||
ALTER TABLE `book` ADD `date_publish` TEXT NOT NULL DEFAULT '0000-00-00' AFTER `publisher_idfs`; | ||
ALTER TABLE `book` ADD `category_idfs` INT(11) NOT NULL DEFAULT '0' AFTER `date_publish`; | ||
ALTER TABLE `book` ADD `format_idfs` INT(11) NOT NULL DEFAULT '0' AFTER `category_idfs`; | ||
ALTER TABLE `book` ADD `language_idfs` INT(11) NOT NULL DEFAULT '0' AFTER `format_idfs`; | ||
ALTER TABLE `book` ADD `pages` TEXT NOT NULL DEFAULT '' AFTER `language_idfs`; | ||
ALTER TABLE `book` ADD `weight` TEXT NOT NULL DEFAULT '' AFTER `pages`; | ||
ALTER TABLE `book` ADD `dimensions` TEXT NOT NULL DEFAULT '' AFTER `weight`; | ||
ALTER TABLE `book` ADD `featured_image` VARCHAR(255) NOT NULL DEFAULT '' AFTER `dimensions`; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
<h2>Edit Book</h2> | ||
|
||
<?= $this->partial('partial/basicform', ['sFormName'=>$sFormName,'oItem'=>$oBook]); ?> | ||
<?= $this->partial('partial/basicform', ['sFormName'=>$sFormName,'oItem'=>$oBook]); ?> | ||
|
||
<?php | ||
/** | ||
* @addedtoskeleton | ||
* @requires 1.0.0 | ||
* @campatibleto master-dev | ||
*/ | ||
?> | ||
<script> | ||
$(function() { | ||
// listen on isbn blur | ||
$('input[name="<?=$sFormName?>_isbn"]').on('blur',function() { | ||
var sISBN = $(this).val(); | ||
|
||
// check if value is in isbn10 format | ||
if (sISBN.length == 10 && $.isNumeric(sISBN)) | ||
{ | ||
var iChecksum = 0; | ||
|
||
// isbn10 to isbn13 algorithm | ||
var sISBN13 = "978" + sISBN.substring(0, 9); | ||
for (i = 0; i < sISBN13.length; i++) { | ||
iChecksum += (i%2)?parseInt(sISBN13[i]*3):parseInt(sISBN13[i]); | ||
} | ||
iChecksum = (10 - (iChecksum%10)) %10; | ||
sISBN13 = sISBN13 + String(iChecksum); | ||
|
||
// write new isbn13 | ||
$('input[name="<?=$sFormName?>_isbn13"]').val(sISBN13); | ||
} | ||
}); | ||
}); | ||
</script> | ||
<?php | ||
/** | ||
* @addedtoskeletonend | ||
*/ | ||
?> |