mirror of
https://github.com/Ekokumppanit/ystavakylaecard.git
synced 2026-01-26 03:04:00 +00:00
- Creating cards now works. We use Open Sans to make texts beautiful
- Added card counts to default controller - Load images from our basecards folder in assets - Administration now includes card counts - Other misc improvements
This commit is contained in:
@@ -76,7 +76,7 @@ $autoload['libraries'] = array('database', 'session');
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
|
||||
$autoload['helper'] = array('url', 'file');
|
||||
$autoload['helper'] = array('url', 'file', 'text', 'directory', 'ecards');
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -41,6 +41,14 @@ define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
|
||||
define('FONTPATH', APPPATH . 'fonts/');
|
||||
define('HEADERTEXT', FONTPATH . 'Open_Sans/OpenSans-Bold.ttf');
|
||||
define('BODYTEXT', FONTPATH . 'Open_Sans/OpenSans-Regular.ttf');
|
||||
|
||||
define('ASSETSPATH', FCPATH . 'assets/');
|
||||
|
||||
define('BASECARDS', ASSETSPATH . 'basecards/');
|
||||
define('CARDPATH', ASSETSPATH . 'cards/');
|
||||
|
||||
|
||||
/* End of file constants.php */
|
||||
|
||||
@@ -49,10 +49,12 @@ $route['default_controller'] = "welcome";
|
||||
$route['404_override'] = 'welcome/error404';
|
||||
|
||||
$route['uusi'] = $route['default_controller']."/newCard";
|
||||
$route['tallenna'] = $route['default_controller']."/saveCard";
|
||||
$route['kaikki'] = $route['default_controller']."/ecards";
|
||||
$route['ecards'] = $route['default_controller']."/ecards";
|
||||
$route['ecards/(:any)'] = $route['default_controller']."/ecards/$1";
|
||||
$route['info'] = $route['default_controller']."/info";
|
||||
$route['preview/(:any)'] = $route['default_controller']."/preview/$1";
|
||||
|
||||
/* End of file routes.php */
|
||||
/* Location: ./application/config/routes.php */
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
class Welcome extends CI_Controller
|
||||
{
|
||||
private $user;
|
||||
public $card_count;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ecard_model', 'ecard');
|
||||
$this->load->model('erkanaauth_model', 'erkana');
|
||||
|
||||
$this->user = $this->erkana->getUser();
|
||||
$this->card_count = $this->ecard->countStatuses();
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -14,7 +20,9 @@ class Welcome extends CI_Controller
|
||||
|
||||
$data = array(
|
||||
'page_title' => array( 'Etusivu', 'Ystäväkylä eKortti' ),
|
||||
'page_classes' => array( 'frontpage' )
|
||||
'page_classes' => array( 'frontpage' ),
|
||||
'count' => $this->card_count,
|
||||
'user' => $this->user
|
||||
);
|
||||
|
||||
$this->load->view('_header', $data);
|
||||
@@ -26,7 +34,9 @@ class Welcome extends CI_Controller
|
||||
{
|
||||
$data = array(
|
||||
'page_title' => array( 'Tietoa', 'Ystäväkylä eKortti' ),
|
||||
'page_classes' => array( 'info' )
|
||||
'page_classes' => array( 'info' ),
|
||||
'count' => $this->card_count,
|
||||
'user' => $this->user
|
||||
);
|
||||
|
||||
$this->load->view('_header', $data);
|
||||
@@ -40,15 +50,9 @@ class Welcome extends CI_Controller
|
||||
$data = array(
|
||||
'page_title' => array( 'Uusi eKortti', 'Ystäväkylä eKortti' ),
|
||||
'page_classes' => array( 'new_card' ),
|
||||
|
||||
'images' => array(
|
||||
"http://placekitten.com/800/550",
|
||||
"http://placekitten.com/g/800/550",
|
||||
"http://placekitten.com/800/551",
|
||||
"http://placekitten.com/g/800/551",
|
||||
"http://placekitten.com/800/552",
|
||||
"http://placekitten.com/g/800/552"
|
||||
)
|
||||
'count' => $this->card_count,
|
||||
'images' => fetchBaseCards(),
|
||||
'user' => $this->user
|
||||
);
|
||||
|
||||
$this->load->view('_header', $data);
|
||||
@@ -59,7 +63,9 @@ class Welcome extends CI_Controller
|
||||
public function ecards($card_id = null)
|
||||
{
|
||||
$data = array(
|
||||
'page_classes' => array( 'ecards' )
|
||||
'page_classes' => array( 'ecards' ),
|
||||
'count' => $this->card_count,
|
||||
'user' => $this->user
|
||||
);
|
||||
|
||||
if (empty($card_id)) {
|
||||
@@ -85,6 +91,8 @@ class Welcome extends CI_Controller
|
||||
$data['ecard']->id = $card_id;
|
||||
$data['ecard']->response = "error";
|
||||
$data['ecard']->response_text = "No card found with that id";
|
||||
} else {
|
||||
$data['ecard']->response = 200;
|
||||
}
|
||||
|
||||
$data['page_classes'][] = 'show_one';
|
||||
@@ -97,11 +105,85 @@ class Welcome extends CI_Controller
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function preview($urldata = null)
|
||||
{
|
||||
if (empty($urldata)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$rawdata = explode(",", urldecode($urldata));
|
||||
foreach ($rawdata as $dataline) {
|
||||
list($key, $value) = explode("=", $dataline);
|
||||
|
||||
$value = str_replace(";-;", "\r", $value);
|
||||
$value = str_replace(";:;", "\n", $value);
|
||||
$data[$key] = urldecode($value);
|
||||
}
|
||||
|
||||
$opts = parseImageOptions($data);
|
||||
|
||||
$imgresource = $this->ecard->createCard(
|
||||
$opts['cardPath'],
|
||||
$opts['cardHead'],
|
||||
$opts['cardText'],
|
||||
$opts['cardHeadPlace'],
|
||||
$opts['cardTextPlace'],
|
||||
$opts['cardHeadSize'],
|
||||
$opts['cardTextSize'],
|
||||
$opts['cardSize']
|
||||
);
|
||||
|
||||
$this->ecard->showCard($imgresource);
|
||||
}
|
||||
|
||||
public function upload()
|
||||
public function saveCard()
|
||||
{
|
||||
# code...
|
||||
$image = $this->input->post();
|
||||
|
||||
if (empty($image)) {
|
||||
redirect("uusi");
|
||||
}
|
||||
|
||||
$opts = parseImageOptions($image);
|
||||
$entry = parseCardEntryValues($image);
|
||||
|
||||
$imgresource = $this->ecard->createCard(
|
||||
$opts['cardPath'],
|
||||
$opts['cardHead'],
|
||||
$opts['cardText'],
|
||||
$opts['cardHeadPlace'],
|
||||
$opts['cardTextPlace'],
|
||||
$opts['cardHeadSize'],
|
||||
$opts['cardTextSize'],
|
||||
$opts['cardSize']
|
||||
);
|
||||
|
||||
if (empty($imgresource)) {
|
||||
$this->session->flash_data('message', 'Virhe luodessa kuvaa');
|
||||
redirect("uusi");
|
||||
}
|
||||
|
||||
if (empty($entry)) {
|
||||
$this->session->flash_data('message', 'Virhe tiedoissa');
|
||||
redirect("uusi");
|
||||
}
|
||||
|
||||
if ($this->ecard->get_by('hash', $entry['hash'])) {
|
||||
redirect("ecards/" . $entry['hash']);
|
||||
}
|
||||
|
||||
if (($card = $this->ecard->savecard($imgresource, $entry['hash']))) {
|
||||
|
||||
if ($card != $entry['hash']) {
|
||||
log_message('debug', "card: {$card} != hash: {$entry['hash']}");
|
||||
}
|
||||
|
||||
$this->ecard->insert($entry);
|
||||
|
||||
redirect(site_url('ecards/' . $entry['hash']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class Yllapito extends CI_Controller
|
||||
{
|
||||
private $user;
|
||||
public $card_count;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -11,6 +12,10 @@ class Yllapito extends CI_Controller
|
||||
$this->load->model('erkanaauth_model', 'erkana');
|
||||
|
||||
$this->user = $this->erkana->getUser();
|
||||
|
||||
if (!empty($this->user)) {
|
||||
$this->card_count = $this->ecard->countStatuses();
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -23,6 +28,7 @@ class Yllapito extends CI_Controller
|
||||
'page_title' => array( 'Etusivu', 'Ystäväkylä eKortti' ),
|
||||
'page_classes' => array( 'frontpage' ),
|
||||
'user' => $this->user,
|
||||
'count' => $this->card_count,
|
||||
'messages' => $this->session->flashdata('messages')
|
||||
);
|
||||
|
||||
|
||||
202
application/fonts/Open_Sans/LICENSE.txt
Executable file
202
application/fonts/Open_Sans/LICENSE.txt
Executable file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
BIN
application/fonts/Open_Sans/OpenSans-Bold.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-Bold.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-BoldItalic.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-BoldItalic.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-ExtraBold.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-ExtraBold.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-ExtraBoldItalic.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-ExtraBoldItalic.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-Italic.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-Italic.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-Light.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-Light.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-LightItalic.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-LightItalic.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-Regular.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-Regular.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-Semibold.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-Semibold.ttf
Executable file
Binary file not shown.
BIN
application/fonts/Open_Sans/OpenSans-SemiboldItalic.ttf
Executable file
BIN
application/fonts/Open_Sans/OpenSans-SemiboldItalic.ttf
Executable file
Binary file not shown.
@@ -75,3 +75,228 @@ function checkboxed(
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
function fetchBaseCards($from = null)
|
||||
{
|
||||
if (empty($from)) {
|
||||
$from = APPPATH . '../assets/basecards/';
|
||||
}
|
||||
$map = directory_map($from, 1);
|
||||
|
||||
if (! empty($map)) {
|
||||
$images = array();
|
||||
foreach ($map as $image) {
|
||||
$images[] = site_url('assets/basecards/' . $image);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $images;
|
||||
}
|
||||
|
||||
function footerAssets()
|
||||
{
|
||||
$assets = array(
|
||||
'jquery.min.js',
|
||||
'custom.modernizr.min.js', // Foundation flavored Modernizr
|
||||
'foundation.min.js', // Foundation 1.4.1
|
||||
'image-picker.min.js', // Image Picker 0.1.4
|
||||
'jquery.validate.min.js', // jQuery Validation Plugin 1.11.1
|
||||
'additional-methods.min.js',// jQuery Validation Methods
|
||||
'messages_fi.js', // jQuery Validation Plugin Finnish translation
|
||||
'jquery-ui.min.js', // jQuery UI 1.10.3
|
||||
'scripts.js' // Our scripts
|
||||
);
|
||||
|
||||
if (ENVIRONMENT == 'development') {
|
||||
$assets[] = 'dev.js';
|
||||
}
|
||||
|
||||
return $assets;
|
||||
}
|
||||
|
||||
function calculateTextBox($text = '', $fontFile = null, $fontSize = null, $fontAngle = 0)
|
||||
{
|
||||
/************
|
||||
simple function that calculates the *exact* bounding box (single pixel precision).
|
||||
The function returns an associative array with these keys:
|
||||
left, top: coordinates you will pass to imagettftext
|
||||
width, height: dimension of the image you have to create
|
||||
*************/
|
||||
$rect = imagettfbbox($fontSize, $fontAngle, $fontFile, $text);
|
||||
$minX = min(array($rect[0], $rect[2], $rect[4], $rect[6]));
|
||||
$maxX = max(array($rect[0], $rect[2], $rect[4], $rect[6]));
|
||||
$minY = min(array($rect[1], $rect[3], $rect[5], $rect[7]));
|
||||
$maxY = max(array($rect[1], $rect[3], $rect[5], $rect[7]));
|
||||
|
||||
return array(
|
||||
"left" => abs($minX) - 1,
|
||||
"top" => abs($minY) - 1,
|
||||
"width" => $maxX - $minX,
|
||||
"height" => $maxY - $minY,
|
||||
"box" => $rect
|
||||
);
|
||||
}
|
||||
|
||||
function cardSizeRatio($full_w = 0, $full_h = 0, $prev_w = 0, $prev_h = 0)
|
||||
{
|
||||
$ratio_w = ($full_w/$prev_w);
|
||||
$ratio_h = ($full_h/$prev_h);
|
||||
|
||||
$results = array(
|
||||
'w' => $ratio_w,
|
||||
'h' => $ratio_h
|
||||
);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
function parseImageOptions($post)
|
||||
{
|
||||
/*
|
||||
$cardPath = null,
|
||||
$cardHead = null,
|
||||
$cardText = null,
|
||||
$cardHeadPlace = array(),
|
||||
$cardTextPlace = array(),
|
||||
$cardHeadSize = array(),
|
||||
$cardTextSize = 0
|
||||
*/
|
||||
|
||||
/*
|
||||
sender_name=Ismo
|
||||
sender_email=ismo%40ma.com
|
||||
receiver_name=ismo
|
||||
receiver_email=ismo%40me.com
|
||||
message_title=Moikka+täältä
|
||||
message_text=aöslkdjföalkjsdfölakjsdföljk
|
||||
sizeOf_message_text_w=381
|
||||
sizeOf_message_text_h=18
|
||||
sizeOf_message_title_w=381
|
||||
sizeOf_message_title_h=30
|
||||
placeOf_message_text_y=72
|
||||
placeOf_message_text_x=10
|
||||
placeOf_message_title_y=20
|
||||
placeOf_message_title_x=10
|
||||
participate=yes
|
||||
publiccard=yes
|
||||
submit=Lähetä+eKorttisi%21
|
||||
submit=Lähetä+eKorttisi%21
|
||||
*/
|
||||
|
||||
$message_title = (empty($post['message_title'])) ? '' : $post['message_title'];
|
||||
$message_text = (empty($post['message_text'])) ? '' : $post['message_text'];
|
||||
|
||||
$image_url = str_replace("-:-", "/", $post['select_image']);
|
||||
|
||||
$card = str_replace(site_url(), FCPATH, $image_url);
|
||||
|
||||
$headerTextFix = -3;
|
||||
//$headerTextFix = 40*(72/96); // 72dpi -> 96dpi, + 5 padding
|
||||
$messageTextFix = 28*(72/96) +3; // 72dpi -> 96dpi, + 5 padding
|
||||
|
||||
$opts = array(
|
||||
'cardPath' => $card,
|
||||
'cardHead' => $message_title,
|
||||
'cardText' => $message_text,
|
||||
'cardHeadPlace' => array(
|
||||
'x' => $post['placeOf_message_title_x'] + 3,
|
||||
'y' => $post['placeOf_message_title_y'] + $headerTextFix //20
|
||||
),
|
||||
'cardTextPlace' => array(
|
||||
'x' => $post['placeOf_message_text_x'] + 3,
|
||||
'y' => $post['placeOf_message_text_y'] + $messageTextFix //40
|
||||
),
|
||||
'cardHeadSize' => array(
|
||||
'w' => $post['sizeOf_message_title_w'],
|
||||
'h' => $post['sizeOf_message_title_h']
|
||||
),
|
||||
'cardTextSize' => array(
|
||||
'w' => $post['sizeOf_message_text_w'],
|
||||
'h' => $post['sizeOf_message_text_h']
|
||||
),
|
||||
'cardSize' => array(
|
||||
'w' => $post['sizeOf_image_w'],
|
||||
'h' => $post['sizeOf_image_h']
|
||||
)
|
||||
);
|
||||
|
||||
return $opts;
|
||||
}
|
||||
|
||||
function parseCardEntryValues($post)
|
||||
{
|
||||
if (empty($post)) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
sender_name=Ismo
|
||||
sender_email=ismo%40ma.com
|
||||
receiver_name=ismo
|
||||
receiver_email=ismo%40me.com
|
||||
message_title=Moikka+täältä
|
||||
message_text=aöslkdjföalkjsdfölakjsdföljk
|
||||
sizeOf_message_text_w=381
|
||||
sizeOf_message_text_h=18
|
||||
sizeOf_message_title_w=381
|
||||
sizeOf_message_title_h=30
|
||||
placeOf_message_text_y=72
|
||||
placeOf_message_text_x=10
|
||||
placeOf_message_title_y=20
|
||||
placeOf_message_title_x=10
|
||||
participate=yes
|
||||
publiccard=yes
|
||||
submit=Lähetä+eKorttisi%21
|
||||
submit=Lähetä+eKorttisi%21
|
||||
*/
|
||||
unset($post['submit']);
|
||||
|
||||
$card = str_replace(site_url(), FCPATH, $post['select_image']);
|
||||
|
||||
if ($post['publiccard'] == 'yes') {
|
||||
$private = 'no';
|
||||
} else {
|
||||
$private = 'yes';
|
||||
}
|
||||
|
||||
if ($post['participate'] == 'yes') {
|
||||
$participate = 'yes';
|
||||
} else {
|
||||
$participate = 'no';
|
||||
}
|
||||
|
||||
$hash = md5(
|
||||
$post['sender_name'] .
|
||||
$post['sender_email'] .
|
||||
$post['message_title'] .
|
||||
$post['message_text']
|
||||
);
|
||||
|
||||
$values = array(
|
||||
// Sender and receiver details
|
||||
'uploader_name' => $post['sender_name'],
|
||||
'uploader_email' => $post['sender_email'],
|
||||
'receiver_name' => $post['receiver_name'],
|
||||
'receiver_email' => $post['receiver_email'],
|
||||
// The message on card
|
||||
'message_title' => $post['message_title'],
|
||||
'message_content' => $post['message_text'],
|
||||
// Card and message placement details
|
||||
'base_card' => $card,
|
||||
'sizeof_message_title_w' => $post['sizeOf_message_title_w'],
|
||||
'sizeof_message_title_h' => $post['sizeOf_message_title_h'],
|
||||
'sizeof_message_text_w' => $post['sizeOf_message_text_w'],
|
||||
'sizeof_message_text_h' => $post['sizeOf_message_text_h'],
|
||||
'placeof_message_title_x' => $post['placeOf_message_title_x'],
|
||||
'placeof_message_title_y' => $post['placeOf_message_title_y'] + 30 + 5,
|
||||
'placeof_message_text_x' => $post['placeOf_message_text_x'],
|
||||
'placeof_message_text_y' => $post['placeOf_message_text_y'] + 32 + 25,
|
||||
'participate' => $participate,
|
||||
'private' => $private,
|
||||
'card_status' => 'queue',
|
||||
'hash' => $hash
|
||||
);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,202 @@ class Ecard_model extends MY_Model
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function timestamps($book)
|
||||
public function formatPost($data = null)
|
||||
{
|
||||
$book['created_at'] = $book['updated_at'] = date('Y-m-d H:i:s');
|
||||
return $book;
|
||||
$format = $data;
|
||||
unset(
|
||||
$format['from_page'],
|
||||
$format['page']
|
||||
);
|
||||
|
||||
$format = $format['data'];
|
||||
|
||||
if (empty($format)) {
|
||||
return false;
|
||||
} else {
|
||||
foreach ($format as $card_id => $item) {
|
||||
unset($card_id, $item);
|
||||
}
|
||||
|
||||
}
|
||||
return $format;
|
||||
}
|
||||
|
||||
public function createCard(
|
||||
$cardPath = null,
|
||||
$cardHead = '',
|
||||
$cardText = '',
|
||||
$cardHeadPlace = array(),
|
||||
$cardTextPlace = array(),
|
||||
$cardHeadSize = array(),
|
||||
$cardTextSize = array(),
|
||||
$cardSize = array()
|
||||
) {
|
||||
|
||||
if (empty($cardSize)) {
|
||||
$cardSize["w"] = 800;
|
||||
$cardSize["h"] = 600;
|
||||
}
|
||||
|
||||
if (empty($cardHeadSize)) {
|
||||
$cardHeadSize["w"] = 600;
|
||||
$cardHeadSize["h"] = 200;
|
||||
}
|
||||
|
||||
if (empty($cardTextSize)) {
|
||||
$cardTextSize["w"] = 600;
|
||||
$cardTextSize["h"] = 200;
|
||||
}
|
||||
|
||||
// If we don't have card, use default
|
||||
if (empty($cardPath) || ! is_readable($cardPath)) {
|
||||
$cardPath = FCPATH . 'assets/basecards/1.jpg';
|
||||
}
|
||||
|
||||
// Header text place, 5x5 from top left corner
|
||||
if (empty($cardHeadPlace)) {
|
||||
$cardHeadPlace["x"] = 5;
|
||||
$cardHeadPlace["y"] = 35;
|
||||
}
|
||||
|
||||
// Text place defaults, x 30 px lower than header text
|
||||
if (empty($cardTextPlace)) {
|
||||
$cardTextPlace["x"] = 5;
|
||||
$cardTextPlace["y"] = 65;
|
||||
}
|
||||
|
||||
// Create image resource and allocate background as white
|
||||
$rImg = ImageCreateFromJPEG($cardPath);
|
||||
|
||||
// Image size
|
||||
$img_w = imagesx($rImg);
|
||||
$img_h = imagesy($rImg);
|
||||
|
||||
$ratio = cardSizeRatio(
|
||||
$img_w,
|
||||
$img_h,
|
||||
$cardSize['w'],
|
||||
$cardSize['h']
|
||||
);
|
||||
|
||||
// Calculate difference between preview and real
|
||||
$head_x = $cardHeadPlace['x'] * $ratio['w'];
|
||||
$head_y = $cardHeadPlace['y'] * $ratio['h'];
|
||||
$text_x = $cardTextPlace['x'] * $ratio['w'];
|
||||
$text_y = $cardTextPlace['y'] * $ratio['h'];
|
||||
|
||||
// Set white color to white
|
||||
$white = imagecolorallocate($rImg, 255, 255, 255);
|
||||
|
||||
// Header text
|
||||
// resource, text size, angle, x, y, color, font file, text
|
||||
if (! empty($cardHead)) {
|
||||
imagettftext(
|
||||
$rImg,
|
||||
40,
|
||||
0,
|
||||
$head_x, //$cardHeadPlace["x"],
|
||||
$head_y, //$cardHeadPlace["y"],
|
||||
$white,
|
||||
HEADERTEXT,
|
||||
$cardHead
|
||||
);
|
||||
}
|
||||
|
||||
// Content text
|
||||
// resource, text size, angle, x, y, color, font file, text
|
||||
if (! empty($cardText)) {
|
||||
imagettftext(
|
||||
$rImg,
|
||||
28,
|
||||
0,
|
||||
$text_x, //$cardTextPlace["x"],
|
||||
$text_y, //$cardTextPlace["y"],
|
||||
$white,
|
||||
BODYTEXT,
|
||||
$cardText
|
||||
);
|
||||
}
|
||||
|
||||
// Return our image as png
|
||||
return $rImg;
|
||||
}
|
||||
|
||||
public function showCard($rImg = null)
|
||||
{
|
||||
if (empty($rImg) || ! is_resource($rImg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
header('Content-Type: image/png');
|
||||
imagepng($rImg, null, 9, PNG_FILTER_PAETH);
|
||||
imagedestroy($rImg);
|
||||
}
|
||||
|
||||
public function saveCard($rImg = null, $name = null)
|
||||
{
|
||||
if (empty($rImg) || ! is_resource($rImg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$image = imagepng($rImg, CARDPATH . $name . '.png', 9, PNG_FILTER_PAETH);
|
||||
imagedestroy($rImg);
|
||||
|
||||
if ($image) {
|
||||
return $name;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveCards($cardData = null)
|
||||
{
|
||||
if (empty($cardData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($cardData as $id => $data) {
|
||||
try {
|
||||
$this->ecard->update($id, $data);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function countStatuses()
|
||||
{
|
||||
$return = new stdClass();
|
||||
|
||||
// Our type counts, default to zero amount
|
||||
$return->all = 0;
|
||||
$return->queue = 0;
|
||||
$return->private = 0;
|
||||
$return->public = 0;
|
||||
$return->hidden = 0;
|
||||
|
||||
// Count amounts
|
||||
$result = $this->db->select("COUNT(*) num, card_status")
|
||||
->group_by("card_status")
|
||||
->get($this->_table)
|
||||
->result_object();
|
||||
|
||||
// Make easier to use
|
||||
if (!empty($result)) {
|
||||
foreach ($result as $count) {
|
||||
$return->{$count->card_status} = $count->num;
|
||||
$return->all += $count->num;
|
||||
}
|
||||
}
|
||||
|
||||
// Return our defaults, or our counts
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function timestamps($ecard)
|
||||
{
|
||||
$ecard['created_at'] = $ecard['updated_at'] = date('Y-m-d H:i:s');
|
||||
return $ecard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
|
||||
|
||||
<footer class="row">
|
||||
<footer class="pagefooter row">
|
||||
<div class="large-12 columns">
|
||||
<div class="panel">
|
||||
<a href="<?php echo site_url("yllapito"); ?>" class="loginlink">π</a>
|
||||
© Ystäväkylä-hanke, Ekokumppanit Oy, Ismo Vuorinen 2013
|
||||
©
|
||||
<a target="_blank" href="http://www.ystavakyla.fi">Ystäväkylä-hanke</a>,
|
||||
<a target="_blank" href="http://www.ekokumppanit.fi">Ekokumppanit Oy</a>,
|
||||
<a target="_blank" href="http://ivuorinen.com">Ismo Vuorinen</a>
|
||||
2013
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
// Assets spark
|
||||
assets_js(
|
||||
array(
|
||||
'jquery.min.js',
|
||||
'custom.modernizr.min.js', // Foundation flavored Modernizr
|
||||
'foundation.min.js', // Foundation 1.4.1
|
||||
'image-picker.min.js', // Image Picker 0.1.4
|
||||
'jquery.validate.min.js', // jQuery Validation Plugin 1.11.1
|
||||
'additional-methods.min.js',// jQuery Validation Methods
|
||||
'messages_fi.js', // jQuery Validation Plugin Finnish translation
|
||||
'jquery-ui.min.js', // jQuery UI 1.10.3
|
||||
'scripts.js' // Our scripts
|
||||
)
|
||||
footerAssets() // in application/helpers/ecards_helper.php
|
||||
);
|
||||
?>
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- {elapsed_time} -->
|
||||
</body>
|
||||
|
||||
@@ -49,7 +49,7 @@ if (empty($page_title)) {
|
||||
<li><?= lnk("kaikki", "Listaa kaikki"); ?></li>
|
||||
<li class="divider"></li>
|
||||
<li class="has-dropdown">
|
||||
<?= lnk("info", "Tietoa"); ?>
|
||||
<?= lnk("info", "Tietoa") . "\n"; ?>
|
||||
<ul class="dropdown">
|
||||
<li><?= lnk("info#rekisteri", "Rekisteriseloste"); ?></li>
|
||||
<li><?= lnk("info#yhteystiedot", "Yhteystiedot"); ?></li>
|
||||
@@ -59,61 +59,84 @@ if (empty($page_title)) {
|
||||
<?php
|
||||
if (isset($user) and ! empty($user)) {
|
||||
|
||||
if (empty($count)) {
|
||||
$count->all = 0;
|
||||
$count->queue = 0;
|
||||
$count->private = 0;
|
||||
$count->public = 0;
|
||||
$count->hidden = 0;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<ul class="left">
|
||||
<li class="has-dropdown adminmenu">
|
||||
<a href="<?php echo site_url("yllapito"); ?>">
|
||||
|
||||
<?php
|
||||
if ($count->queue > 0) {
|
||||
?><span class="right label round"><?= $count->queue; ?></span><?php
|
||||
} ?>
|
||||
|
||||
Ylläpito (Moi <?php echo $user->firstname; ?>!)</a>
|
||||
<ul class="dropdown">
|
||||
<li class="has-dropdown">
|
||||
<?= lnk("yllapito/ecards", "Hallitse kortteja"); ?>
|
||||
<?= lnk("yllapito/ecards", "Hallitse kortteja") . "\n"; ?>
|
||||
<ul class="dropdown">
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/ecards/moderate");?>">
|
||||
<span class="right label round">0</span>
|
||||
Jonossa
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/ecards/public");?>">
|
||||
<span class="right label round">0</span>
|
||||
Julkaistut
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/ecards/private");?>">
|
||||
<span class="right label round">0</span>
|
||||
Privaatit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/ecards/deleted");?>">
|
||||
<span class="right label round">0</span>
|
||||
Hylätyt
|
||||
</a>
|
||||
</li>
|
||||
<li><?php
|
||||
$text = '<span class="right label round">'
|
||||
. $count->queue
|
||||
. '</span> Jonossa';
|
||||
echo lnk("yllapito/ecards/queue", $text);
|
||||
?></li>
|
||||
<li><?php
|
||||
$text = '<span class="right label round">'
|
||||
. $count->public
|
||||
. '</span> Julkaistut';
|
||||
echo lnk("yllapito/ecards/public", $text);
|
||||
?></li>
|
||||
<li><?php
|
||||
$text = '<span class="right label round">'
|
||||
. $count->private
|
||||
. '</span> Privaatit';
|
||||
echo lnk("yllapito/ecards/private", $text);
|
||||
?></li>
|
||||
<li><?php
|
||||
$text = '<span class="right label round">'
|
||||
. $count->hidden
|
||||
. '</span> Hylätyt';
|
||||
echo lnk("yllapito/ecards/hidden", $text);
|
||||
?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
// Should the user see these?
|
||||
if ($user->can_modusers == "yes" || $user->can_seeusers == "yes") {
|
||||
?>
|
||||
<li class="has-dropdown">
|
||||
<a href="<?php echo site_url("yllapito/users"); ?>">Hallitse käyttäjiä</a>
|
||||
<?= lnk("yllapito/users", "Hallitse käyttäjiä") . "\n"; ?>
|
||||
<ul class="dropdown">
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/users/add");?>">
|
||||
Lisää käyttäjä
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo site_url("yllapito/users/list");?>">
|
||||
Listaa käyttäjät
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
if ($user->can_modusers == "yes") {
|
||||
echo "<li>"
|
||||
. lnk("yllapito/users/add", "Lisää käyttäjä")
|
||||
. "</li>\n";
|
||||
}
|
||||
if ($user->can_seeusers == "yes") {
|
||||
echo "<li>"
|
||||
. lnk("yllapito/users/list", "Listaa käyttäjät")
|
||||
. "</li>\n";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a class="logout" href="<?php echo site_url("yllapito/logout"); ?>">Kirjaudu ulos</a>
|
||||
</li>
|
||||
<li><a class="logout" href="<?php
|
||||
echo site_url("yllapito/logout"); ?>">Kirjaudu ulos</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -11,20 +11,29 @@ if (empty($amount)) {
|
||||
$amount = 5;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $amount; $i++) {
|
||||
$url = site_url('/ecards/' . md5($i));
|
||||
echo "\n";
|
||||
$cards = $this->ecard
|
||||
->order_by('created_at', 'DESC')
|
||||
->limit($amount)
|
||||
->get_many_by('card_status', 'public');
|
||||
|
||||
$url = '<a href="'.$url.'" title="'.$i.'">';
|
||||
foreach ($cards as $card) {
|
||||
$url = site_url('/ecards/' . $card->hash);
|
||||
$img = site_url('assets/cards/' . $card->hash . '.png');
|
||||
$time = date("d.m.Y \k\l\o H.i", strtotime($card->created_at));
|
||||
|
||||
$url = '<a href="'.$url.'" title="'.$time.'">';
|
||||
|
||||
$img = '<img src="'.$img.'" alt="'.$time.'">';
|
||||
?>
|
||||
<li class="image-panel">
|
||||
<?php echo $url; ?>
|
||||
<img src="http://placekitten.com/800/500" alt="placeholder+image">
|
||||
<em><?php echo date("d.m.Y \k\l\o H.i", rand($t_start, $t_end)); ?></em>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="image-panel">
|
||||
<?php echo $url."\n"; ?>
|
||||
<?php echo $img; ?>
|
||||
<em><?php echo $time; ?></em>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
echo "\n";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="row">
|
||||
<div class="large-6 small-12 columns">
|
||||
<div class="panel">
|
||||
<form id="ecard_form">
|
||||
<form id="ecard_form" method="post" action="<?php echo site_url('tallenna'); ?>">
|
||||
|
||||
<h2>Tiedot</h2>
|
||||
|
||||
@@ -124,6 +124,10 @@ if (! empty($images)) {
|
||||
<input type="hidden" id="sizeOf_message_title_h"
|
||||
name="sizeOf_message_title_h" value="">
|
||||
|
||||
<input type="hidden" id="sizeOf_image_w"
|
||||
name="sizeOf_image_w" value="">
|
||||
<input type="hidden" id="sizeOf_image_h"
|
||||
name="sizeOf_image_h" value="">
|
||||
|
||||
<input type="hidden" id="placeOf_message_text_y"
|
||||
name="placeOf_message_text_y" value="">
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
|
||||
<?php
|
||||
$cards = rand(10, 200);
|
||||
$private = rand(4,100);
|
||||
$public = $cards-$private;
|
||||
|
||||
if( $public < 4 ) {
|
||||
$public = rand(10, 200);
|
||||
$private = $private + $public;
|
||||
$cards = $public + $private;
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
|
||||
<div class="large-12 columns">
|
||||
<div class="panel">
|
||||
<h2>Tässä kaikki Ystäväkylän sähköpostikortit!</h2>
|
||||
<p>Postikortit ovat järjestetty luomisjärjestykseen, uusimmat ensimmäiseksi. Tällä hetkellä postikortteja on kaikkiaan <strong><?=$cards;?></strong> kappaletta joista näytetään julkisesti <strong><?=$public;?></strong> kappaletta. Yksityisiä kortteja on <strong><?=$private;?></strong> kappaletta.</p>
|
||||
<p>
|
||||
Postikortit ovat järjestetty luomisjärjestykseen, uusimmat ensimmäiseksi.
|
||||
Tällä hetkellä postikortteja on kaikkiaan <strong><?=$count->all;?></strong> kappaletta joista
|
||||
näytetään julkisesti <strong><?=$count->public;?></strong> kappaletta.
|
||||
Yksityisiä kortteja on <strong><?=$count->private;?></strong> kappaletta.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('_partial_cardlist.php', array('amount' => $public)); ?>
|
||||
<?php $this->load->view('_partial_cardlist.php', array('amount' => $count->public)); ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
BIN
assets/basecards/1.jpg
Normal file
BIN
assets/basecards/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
assets/basecards/2.jpg
Normal file
BIN
assets/basecards/2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -21,6 +21,28 @@ h1, h2, h3 {
|
||||
font-family: Georgia, 'Sans serif';
|
||||
}
|
||||
|
||||
input:disabled, label.disabled {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
table.valign thead tr,
|
||||
.valign {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.zebra {
|
||||
background: #aeaeae;
|
||||
}
|
||||
|
||||
.valign-top {
|
||||
vertical-align: top;
|
||||
}
|
||||
table thead th button {
|
||||
margin: 0px;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -139,14 +161,6 @@ h1, h2, h3 {
|
||||
background: #333;
|
||||
}
|
||||
|
||||
#message_title_preview {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#message_text_preview {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
#message_title_preview,
|
||||
#message_text_preview {
|
||||
position: relative;
|
||||
@@ -159,13 +173,22 @@ h1, h2, h3 {
|
||||
#message_title_preview {
|
||||
top: 20px;
|
||||
left: 10px;
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
}
|
||||
#message_text_preview {
|
||||
top: 40px;
|
||||
left: 10px;
|
||||
font-size: 20px;
|
||||
line-height: 140%;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.toteutuva .url {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#previewpanel:hover .ui-draggable,
|
||||
.ui-draggable-dragging,
|
||||
.ui-resizable-resizing {
|
||||
cursor: move;
|
||||
|
||||
71
assets/js/dev.js
Normal file
71
assets/js/dev.js
Normal file
@@ -0,0 +1,71 @@
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
/**
|
||||
* This is only relevant if we are in development mode.
|
||||
* Purpose of this is to provide easy way to test how our
|
||||
* image gets made, runs only on development mode.
|
||||
*
|
||||
* $(".toteutuva .url") is a <small> -field that shows our
|
||||
* query to /preview/{querystring}, what in part generates
|
||||
* our preview image as $("#previewimage")
|
||||
*
|
||||
* Both of these can be found in application/views/new.php
|
||||
*/
|
||||
|
||||
$('.updatepreview').on('click', function () {
|
||||
var query = [];
|
||||
var img = '/ystavakylaecard/preview/';
|
||||
|
||||
|
||||
$.each($('#ecard_form')[0].elements, function(i,o) {
|
||||
var _this = $(o);
|
||||
|
||||
if (_this.attr('name') == 'sender_name' ||
|
||||
_this.attr('name') == 'sender_email' ||
|
||||
_this.attr('name') == 'receiver_name' ||
|
||||
_this.attr('name') == 'receiver_email' ||
|
||||
_this.attr('name') == 'select_image' ||
|
||||
_this.attr('name') == 'message_title' ||
|
||||
_this.attr('name') == 'message_text' ||
|
||||
_this.attr('name') == 'participate' ||
|
||||
_this.attr('name') == 'publiccard' ||
|
||||
_this.attr('name') == 'submit'
|
||||
) {
|
||||
|
||||
} else {
|
||||
var str = _this.attr('name') + '=' + _this.attr('value');
|
||||
query.push(str);
|
||||
}
|
||||
});
|
||||
|
||||
var select_image_src = $('#previewimage').attr('src');
|
||||
select_image_src = select_image_src.replace(/\//g, "-:-");
|
||||
|
||||
var select_image = 'select_image=' + select_image_src;
|
||||
var message_title = 'message_title=' + $('#message_title_preview').text();
|
||||
var message_text = 'message_text=' + $('#message_text_preview').text();
|
||||
|
||||
message_text = message_text.replace(/\r/g, ";-;");
|
||||
message_text = message_text.replace(/\n/g, ";:;");
|
||||
|
||||
query.push(
|
||||
message_title,
|
||||
message_text,
|
||||
select_image
|
||||
);
|
||||
|
||||
img = img + encodeURIComponent( query.toString() );
|
||||
|
||||
$('.toteutuva img').attr("src", img);
|
||||
|
||||
var prevurl = decodeURIComponent(img);
|
||||
prevurl = prevurl.replace(/,/g, "\n");
|
||||
prevurl = prevurl.replace(/;-;/g, "\r");
|
||||
prevurl = prevurl.replace(/;:;/g, "\n");
|
||||
prevurl = prevurl.replace(/preview\//g, "preview\/\n");
|
||||
$('.toteutuva .url').text(prevurl);
|
||||
|
||||
//alert(img);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -12,6 +12,16 @@ jQuery(document).ready(function($) {
|
||||
}
|
||||
});
|
||||
|
||||
// Provide zebra striping to our table
|
||||
$('table tbody tr:odd').addClass("zebra");
|
||||
|
||||
// Also make parent element have class="active"
|
||||
$('.active').parent().addClass("active");
|
||||
|
||||
// Add class "disabled" (text-decoration: line-through)
|
||||
// to disabled elements parent, usually <label>
|
||||
$("input:disabled").parent().addClass("disabled");
|
||||
|
||||
// Change jQuery textarea hook default behavior
|
||||
$.valHooks.textarea = {
|
||||
get: function( elem ) {
|
||||
@@ -52,13 +62,19 @@ jQuery(document).ready(function($) {
|
||||
scroll: false,
|
||||
stop: function(e, ui) {
|
||||
|
||||
// PHP imagettftext() position is set from bottom left corner
|
||||
var height = $("#"+this.id).height();
|
||||
var bottom = ui.position.top + height;
|
||||
|
||||
//alert("#" + this.id + " = b:" + bottom + " / h: " + height);
|
||||
|
||||
if (this.id === 'message_title_preview') {
|
||||
$('#placeOf_message_title_y').val(ui.position.top);
|
||||
$('#placeOf_message_title_y').val(bottom);
|
||||
$('#placeOf_message_title_x').val(ui.position.left);
|
||||
}
|
||||
|
||||
if (this.id === 'message_text_preview') {
|
||||
$('#placeOf_message_text_y').val(ui.position.top);
|
||||
$('#placeOf_message_text_y').val(bottom);
|
||||
$('#placeOf_message_text_x').val(ui.position.left);
|
||||
}
|
||||
}
|
||||
@@ -130,10 +146,14 @@ jQuery(document).ready(function($) {
|
||||
var title_p = title.position();
|
||||
var text_p = text.position();
|
||||
|
||||
// We count from bottom left corner
|
||||
var title_y = title_p.top + title.height();
|
||||
var text_y = text_p.top + text.height() - 30; // Manual fix
|
||||
|
||||
// Position of elements
|
||||
$('#placeOf_message_title_y').val(title_p.top);
|
||||
$('#placeOf_message_title_y').val(title_y);
|
||||
$('#placeOf_message_title_x').val(title_p.left);
|
||||
$('#placeOf_message_text_y').val(text_p.top);
|
||||
$('#placeOf_message_text_y').val(text_y);
|
||||
$('#placeOf_message_text_x').val(text_p.left);
|
||||
|
||||
// Size of elements
|
||||
|
||||
Reference in New Issue
Block a user