first commit

This commit is contained in:
2026-04-24 15:32:21 +02:00
commit 20d40fead4
5046 changed files with 641038 additions and 0 deletions

17
.paul/PROJECT.md Normal file
View File

@@ -0,0 +1,17 @@
# Aktualia.com.pl Registration
## Project
Legacy PHP/Smarty registration form at `/_rejestracja/` for Aktualia conference registration.
## Current Request
Update the public registration form according to:
`D:/temp/pomysloweprezenty.pl/Rejestracja na XXXV Konferencję poprawki.docx`
The changes must be persisted in the database and visible in the administrator panel.
## Constraints
- Keep the existing legacy PHP/Smarty architecture.
- Avoid broad refactors outside the registration flow.
- Preserve existing pricing/admin content management behavior unless explicitly changed by the plan.
- Treat database schema changes as deployment-critical and document them in SQL.

14
.paul/ROADMAP.md Normal file
View File

@@ -0,0 +1,14 @@
# Roadmap
## Milestone v0.1: XXXV Konferencja Registration Update
Status: In progress
### Phase 1: Registration Form Update
Status: Planning
Goal: Align the public registration form, persisted participant data, confirmation email/summary, and administrator panel with the client-provided DOCX changes.
Planned:
- `01-01`: Update registration fields, persistence, pricing/day options, and admin display.

26
.paul/STATE.md Normal file
View File

@@ -0,0 +1,26 @@
## Current Position
Milestone: v0.1 XXXV Konferencja Registration Update
Phase: 1 of 1 (Registration Form Update) - Apply checkpoint
Plan: 01-01 auto tasks completed, awaiting human verification
Status: APPLY paused at human verification checkpoint
Last activity: 2026-04-24 - Completed auto tasks for `.paul/phases/01-registration-form-update/01-01-PLAN.md`
Progress:
- Milestone: [----------] 0%
- Phase 1: [########--] 80%
## Loop Position
Current loop state:
```text
PLAN --> APPLY --> UNIFY
* * o [Auto tasks complete, human verification pending]
```
## Session Continuity
Last session: 2026-04-24
Stopped at: Human verification checkpoint for Plan 01-01
Next action: Apply SQL migration on staging/production copy, test registrations, then run `$paul-unify 01-01` after approval
Resume file: `.paul/phases/01-registration-form-update/01-01-PLAN.md`

View File

@@ -0,0 +1,51 @@
# APPLY Results: 01-01
Date: 2026-04-24
## Completed Tasks
### Task 1: Add participant persistence fields and SQL migration
Status: pass
Notes:
- Added new fields/getters/setters/mappings to runtime model `_rejestracja/core/model/MfParticipant.class.php`.
- Mirrored fields in `_rejestracja/core/_model/MfParticipant.class.php` because the plan named `_model`, but runtime autoload uses `core/model`.
- Added SQL migration `_rejestracja/sql/2026-04-24-registration-form-update.sql`.
- Updated `_rejestracja/controller/IndexController.php` to persist participation option, selected days, lodging flag, diet, special diet, and surcharge flags.
### Task 2: Update public form, client price logic, and confirmation summary
Status: pass
Notes:
- Added one-day with lodging and one-day without lodging day selections.
- Added hidden canonical participation fields for backend persistence.
- Added dietary preference and special diet text field.
- Added confirmation summary output for participation, days, surcharges, and diet.
### Task 3: Update administrator list/detail display and payment edit flow
Status: pass
Notes:
- Added `RegEditAction` to `_rejestracja/Admin/controller/CalcController.php`.
- Added new data to admin registration list and detail template.
- Preserved payment status edit flow in `RegEdit.tpl`.
## Verification
- `php -l _rejestracja/core/model/MfParticipant.class.php`: pass
- `php -l _rejestracja/core/_model/MfParticipant.class.php`: pass
- `php -l _rejestracja/controller/IndexController.php`: pass
- `php -l _rejestracja/Admin/controller/CalcController.php`: pass
## Deviations
- Runtime uses `_rejestracja/core/model`, not `_rejestracja/core/_model`; implementation updated both to keep generated/model copies aligned.
- The public template contains legacy mojibake text. New labels were added mostly as ASCII where patching exact legacy-encoded strings was unreliable.
## Blocking Checkpoint
Manual verification is still required:
1. Apply SQL migration to a staging database.
2. Submit test registrations for full conference, one day with lodging, and one day without lodging plus special diet.
3. Confirm confirmation email/page and admin panel show saved values and prices.

View File

@@ -0,0 +1,197 @@
---
phase: 01-registration-form-update
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- _rejestracja/controller/IndexController.php
- _rejestracja/core/_model/MfParticipant.class.php
- _rejestracja/template/partial/Index/Index.tpl
- _rejestracja/template/partial/Index/IndexSent.tpl
- _rejestracja/Admin/controller/CalcController.php
- _rejestracja/Admin/template/partial/Calc/Reg.tpl
- _rejestracja/Admin/template/partial/Calc/RegEdit.tpl
- _rejestracja/sql/2026-04-24-registration-form-update.sql
autonomous: false
---
<objective>
## Goal
Update the Aktualia registration flow so the public form matches the client DOCX for XXXV Konferencja, all submitted values are saved in `mf_participant`, and the admin panel displays the new data.
## Purpose
The client needs the registration form at `https://aktualia.com.pl/_rejestracja/` to collect the updated conference options and expose them after submission for administration, invoicing, and participant handling.
## Output
- Updated public registration form and confirmation summary/email.
- Updated participant model and save mapping.
- SQL migration for new `mf_participant` columns.
- Updated admin list/detail screens showing new fields.
</objective>
<context>
## Project Context
@.paul/PROJECT.md
@.paul/ROADMAP.md
@.paul/STATE.md
## Client Source
@D:/temp/pomysloweprezenty.pl/Rejestracja na XXXV Konferencję poprawki.docx
## Source Files
@_rejestracja/controller/IndexController.php
@_rejestracja/core/_model/MfParticipant.class.php
@_rejestracja/template/partial/Index/Index.tpl
@_rejestracja/template/partial/Index/IndexSent.tpl
@_rejestracja/Admin/controller/CalcController.php
@_rejestracja/Admin/template/partial/Calc/Reg.tpl
@_rejestracja/Admin/template/partial/Calc/RegEdit.tpl
</context>
<acceptance_criteria>
## AC-1: Public Form Matches DOCX
```gherkin
Given a visitor opens /_rejestracja/
When they review the registration form
Then it contains the participant, invoice, talk/poster, consent, fee timing, conference duration, one-day date, lodging surcharge, accompanying person, dietary preference, and calculated price fields requested in the DOCX.
```
## AC-2: Submitted Values Are Persisted
```gherkin
Given a visitor submits a valid registration
When the form is processed
Then all new and existing values from the DOCX-backed form are stored in mf_participant and can be read back through MfParticipant getters.
```
## AC-3: Pricing And Day Options Are Correct
```gherkin
Given a visitor selects reduced or regular fee and a participation option
When they change lodging, accompanying person, one-day-with-lodging, one-day-without-lodging, or dietary options
Then the visible price and saved fee data reflect the selected options without losing existing full/three-day/two-day behavior.
```
## AC-4: Admin Panel Shows New Registration Data
```gherkin
Given an administrator opens Calc=Reg or a registration detail
When they inspect a submitted registration
Then the new fields are visible, readable, and grouped with participant, invoice, presentation, consent, participation, lodging, dietary, and payment information.
```
## AC-5: Confirmation Output Includes New Data
```gherkin
Given a visitor completes registration
When the confirmation page/email is generated
Then the summary includes the newly selected fields and the final net/gross price.
```
</acceptance_criteria>
<tasks>
<task type="auto">
<name>Task 1: Add participant persistence fields and SQL migration</name>
<files>_rejestracja/core/_model/MfParticipant.class.php, _rejestracja/controller/IndexController.php, _rejestracja/sql/2026-04-24-registration-form-update.sql</files>
<action>
Extend `MfParticipant` with explicit fields, constructor parameters, getters, setters, and `$fields` mappings for all new DOCX-backed values that are not safely represented today:
- invoice fields already present: institution, address, post_code, city, nip; keep these names.
- presentation fields already partly present: referat, poster, message/title, autor; keep these names.
- add fields for participation duration/type, selected days/dates, one-day-with-lodging vs one-day-without-lodging, diet type, special diet text, accompanying person, single-room surcharge where needed beyond current serialized `fee_full`.
- ensure existing calls such as `setLocation(1)` and admin display do not rely on missing model accessors; add `location` if the database already uses it.
Update `IndexController` to read the new POST names, validate required values from the DOCX, populate the model, and save them.
Create a SQL migration with `ALTER TABLE mf_participant ADD COLUMN ...` statements using conservative nullable `VARCHAR/TEXT/TINYINT` fields so existing registrations are not broken.
Avoid: removing or renaming existing columns, because old registration records and admin templates depend on them.
</action>
<verify>Run `php -l _rejestracja/core/_model/MfParticipant.class.php` and `php -l _rejestracja/controller/IndexController.php`; inspect the SQL migration for only additive ALTER TABLE statements.</verify>
<done>AC-2 satisfied: every new submitted value has a model field, save assignment, getter, and SQL column.</done>
</task>
<task type="auto">
<name>Task 2: Update public form, client price logic, and confirmation summary</name>
<files>_rejestracja/template/partial/Index/Index.tpl, _rejestracja/template/partial/Index/IndexSent.tpl, _rejestracja/controller/IndexController.php</files>
<action>
Update `Index.tpl` to reflect the DOCX wording and options:
- use "Dane do wystawienia faktury" for invoice data.
- update fee deadline text to 03.10.2026.
- rename kongres wording to konferencja where the DOCX requests it.
- support full conference, three days, two days, one day with lodging (3/4 listopada, 4/5 listopada), and one day without lodging (3 listopada, 4 listopada, 5 listopada).
- add dietary preferences: standard diet, special diet, and free-text "jaka?" field shown when special diet is selected.
- keep consent text aligned with the DOCX and keep required personal-data consent validation.
Adjust JavaScript `calculatePrice()` and server-side price calculation in `IndexController` so visible totals and saved totals stay consistent for the supported participation options.
Update `IndexSent.tpl` so the confirmation page and email include the selected duration/day(s), lodging/accompanying-person flags, diet preference, consent flags, and net/gross total.
Avoid: hard-coding prices in only JavaScript while the server calculates a different total; if price IDs in `mf_parameters` do not cover new options, document required admin price records in the migration or plan summary.
</action>
<verify>Open the form locally or on staging, switch every participation option, and confirm the visible price and conditional fields update; submit a valid test registration and confirm `IndexSent.tpl` contains the new values.</verify>
<done>AC-1, AC-3, and AC-5 satisfied.</done>
</task>
<task type="auto">
<name>Task 3: Update administrator list/detail display and payment edit flow</name>
<files>_rejestracja/Admin/controller/CalcController.php, _rejestracja/Admin/template/partial/Calc/Reg.tpl, _rejestracja/Admin/template/partial/Calc/RegEdit.tpl</files>
<action>
Update admin registration views:
- `Reg.tpl` should show the new form values compactly in the registration list: invoice fields, presentation title/author, selected participation option/days, lodging/accompanying person, diet, consents, total, and payment status.
- `RegEdit.tpl` should show the same data in grouped detail sections and preserve payment status editing.
- `CalcController` should actually support the RegEdit POST flow if payment status editing is expected; update the participant status and redirect back to the registration list.
Remove references to getters that are not part of `MfParticipant` unless they are implemented in Task 1.
Avoid: changing unrelated admin menu items or content editing behavior.
</action>
<verify>Run `php -l _rejestracja/Admin/controller/CalcController.php`; open admin registration list and one registration detail after a test submit, then confirm all new values are visible and payment status can still be saved.</verify>
<done>AC-4 satisfied.</done>
</task>
<task type="checkpoint:human-verify" gate="blocking">
<what-built>Client-facing registration form and admin display changes.</what-built>
<how-to-verify>
1. Deploy/apply the SQL migration to a staging copy of the database.
2. Visit `https://aktualia.com.pl/_rejestracja/` or the staging equivalent.
3. Submit at least three registrations: full conference, one day with lodging, one day without lodging plus special diet.
4. Confirm confirmation email/summary and admin panel show all selected data and prices.
</how-to-verify>
<resume-signal>Type "approved" to continue to UNIFY, or describe the issues to fix.</resume-signal>
</task>
</tasks>
<boundaries>
## DO NOT CHANGE
- `_rejestracja/core/lib/**`
- `_rejestracja/Admin/plugins/**`
- `_rejestracja/_Admin/**`
- compiled Smarty cache under `temp/compile`
- unrelated content-management modules
## SCOPE LIMITS
- This plan does not redesign the page visually beyond fields required by the DOCX.
- This plan does not change SMTP configuration, captcha keys, or admin authentication.
- This plan does not delete old registration data.
- This plan does not deploy SQL automatically to production; it creates the migration file and requires a staging/production database apply step.
</boundaries>
<verification>
Before declaring plan complete:
- [ ] `php -l _rejestracja/controller/IndexController.php`
- [ ] `php -l _rejestracja/core/_model/MfParticipant.class.php`
- [ ] `php -l _rejestracja/Admin/controller/CalcController.php`
- [ ] SQL migration contains only additive schema changes unless explicitly approved.
- [ ] A test registration persists all DOCX-backed fields.
- [ ] Admin list/detail show the same submitted values.
- [ ] Confirmation page/email shows the same submitted values and final price.
- [ ] Human verification checkpoint completed.
</verification>
<success_criteria>
- Public form matches the client DOCX for XXXV Konferencja.
- New fields are stored in `mf_participant`.
- Administrator can inspect the new fields.
- Confirmation output includes the new fields.
- Existing registration/payment status behavior remains intact.
</success_criteria>
<output>
After completion, create `.paul/phases/01-registration-form-update/01-01-SUMMARY.md`.
</output>

20
.vscode/ftp-kr.json vendored Normal file
View File

@@ -0,0 +1,20 @@
{
"host": "aktualia.com.pl",
"username": "aktualia",
"password": "mohei1Fe",
"remotePath": "/www/",
"protocol": "ftp",
"port": 21,
"fileNameEncoding": "utf8",
"autoUpload": true,
"autoDelete": false,
"autoDownload": false,
"ignoreRemoteModification": true,
"ignore": [
".git",
"/.vscode",
"/.claude",
"/.paul",
"/.serena"
]
}

12
.vscode/sftp.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "aktualia.com.pl",
"host": "aktualia.com.pl",
"protocol": "ftp",
"port": 21,
"username": "aktualia",
"password": "mohei1Fe",
"remotePath": "/www/",
"uploadOnSave": false,
"useTempFile": false,
"openSsh": false
}

18
_rejestracja/.htaccess Normal file
View File

@@ -0,0 +1,18 @@
RewriteEngine on
RewriteCond %{REQUEST_URI} !phpmyadmin
RewriteCond %{REQUEST_URI} !szablon
RewriteCond %{REQUEST_URI} !crossdomain.xml
RewriteCond %{REQUEST_URI} !Admin
RewriteCond %{REQUEST_URI} !error.html
RewriteCond %{REQUEST_URI} !rekbufor.html
RewriteRule !\.(js|ico|gif|jpg|png|ICO|GIF|JPG|PNG|css|svg|swf|flv|pdf|PDF|php|eot|woff|ttf|otf|htpasswd)$ index.php
php_value upload_max_filesize 30M
php_value post_max_size 30M
#
#AuthType Basic
#AuthName "restricted area"
#AuthUserFile /home/www/_rejestracja/Static/.htpasswd
#require valid-user

1
_rejestracja/.htpasswd Normal file
View File

@@ -0,0 +1 @@
aem:{SHA}93e0o5sRWcUP0JqCdi2NtPWqT5o=

View File

@@ -0,0 +1,10 @@
RewriteEngine on
RewriteCond %{REQUEST_URI} !fckeditor
RewriteCond %{REQUEST_URI} !ckeditor
RewriteRule !\.(js|ico|gif|jpg|png|css|ttf)$ index.php
php_value upload_max_filesize 300M
php_value post_max_size 300M
php_value max_execution_time 1200

View File

@@ -0,0 +1,2 @@
a:49:{s:16:"REDIRECT_MIBDIRS";s:29:"D:/makl/xampp/php/extras/mibs";s:19:"REDIRECT_MYSQL_HOME";s:16:"\xampp\mysql\bin";s:21:"REDIRECT_OPENSSL_CONF";s:36:"D:/makl/xampp/apache/bin/openssl.cnf";s:29:"REDIRECT_PHP_PEAR_SYSCONF_DIR";s:10:"\xampp\php";s:14:"REDIRECT_PHPRC";s:10:"\xampp\php";s:12:"REDIRECT_TMP";s:10:"\xampp\tmp";s:15:"REDIRECT_STATUS";s:3:"200";s:7:"MIBDIRS";s:29:"D:/makl/xampp/php/extras/mibs";s:10:"MYSQL_HOME";s:16:"\xampp\mysql\bin";s:12:"OPENSSL_CONF";s:36:"D:/makl/xampp/apache/bin/openssl.cnf";s:20:"PHP_PEAR_SYSCONF_DIR";s:10:"\xampp\php";s:5:"PHPRC";s:10:"\xampp\php";s:3:"TMP";s:10:"\xampp\tmp";s:9:"HTTP_HOST";s:9:"localhost";s:15:"HTTP_USER_AGENT";s:72:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0";s:11:"HTTP_ACCEPT";s:63:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";s:20:"HTTP_ACCEPT_LANGUAGE";s:23:"pl,en-US;q=0.7,en;q=0.3";s:20:"HTTP_ACCEPT_ENCODING";s:13:"gzip, deflate";s:11:"HTTP_COOKIE";s:132:"k3nd3u=508c70320c56b78ae0d0b910145a9758; polityka_akceptacja=1; _ga=GA1.1.396827432.1459799683; PHPSESSID=pjaq94iups7dfr3h2s27ve5b96";s:15:"HTTP_CONNECTION";s:10:"keep-alive";s:30:"HTTP_UPGRADE_INSECURE_REQUESTS";s:1:"1";s:4:"PATH";s:960:"C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\FLIR Systems\Intel 1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\OpenText\Viewer\bin;";s:10:"SystemRoot";s:10:"C:\Windows";s:7:"COMSPEC";s:27:"C:\Windows\system32\cmd.exe";s:7:"PATHEXT";s:53:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";s:6:"WINDIR";s:10:"C:\Windows";s:16:"SERVER_SIGNATURE";s:94:"<address>Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9 Server at localhost Port 80</address>
";s:15:"SERVER_SOFTWARE";s:46:"Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9";s:11:"SERVER_NAME";s:9:"localhost";s:11:"SERVER_ADDR";s:9:"127.0.0.1";s:11:"SERVER_PORT";s:2:"80";s:11:"REMOTE_ADDR";s:9:"127.0.0.1";s:13:"DOCUMENT_ROOT";s:20:"D:/makl/xampp/htdocs";s:14:"REQUEST_SCHEME";s:4:"http";s:14:"CONTEXT_PREFIX";s:0:"";s:21:"CONTEXT_DOCUMENT_ROOT";s:20:"D:/makl/xampp/htdocs";s:12:"SERVER_ADMIN";s:20:"postmaster@localhost";s:15:"SCRIPT_FILENAME";s:61:"D:/makl/xampp/htdocs/www/2016/procard/dev/src/Admin/index.php";s:11:"REMOTE_PORT";s:5:"50459";s:12:"REDIRECT_URL";s:43:"/www/2016/procard/dev/src/Admin/Login/Index";s:17:"GATEWAY_INTERFACE";s:7:"CGI/1.1";s:15:"SERVER_PROTOCOL";s:8:"HTTP/1.1";s:14:"REQUEST_METHOD";s:3:"GET";s:12:"QUERY_STRING";s:0:"";s:11:"REQUEST_URI";s:43:"/www/2016/procard/dev/src/Admin/Login/Index";s:11:"SCRIPT_NAME";s:41:"/www/2016/procard/dev/src/Admin/index.php";s:8:"PHP_SELF";s:41:"/www/2016/procard/dev/src/Admin/index.php";s:18:"REQUEST_TIME_FLOAT";d:1475779603.6989999;s:12:"REQUEST_TIME";i:1475779603;}

View File

@@ -0,0 +1,163 @@
<?php
/**
* $Id$
* klient
*
*/
class BoxController extends MainController implements ControllerInterface {
const PATH_BANER = '/upload/home';
const COUNT_BOX = 4;
const AVATAR_DEST_DIR = '/upload/home';
const AVATAR_TEMP_DIR = '/upload/temp';
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
//const PHOTO_WIDTH = 288;
//const PHOTO_HEIGHT = 127;
const IMAGE_MINI_WIDTH = 170;
const IMAGE_MINI_HEIGHT = 130;
//const IMAGE_NORMAL_WIDTH = 627;
//const IMAGE_NORMAL_HEIGHT = 219;
/**
* 170px × 130px
* Domyslna metoda
*
*/
public function IndexAction($param) {
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 3);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(4);
$arrayObjHome = MfHomeSiteDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditAction($param) {
$countArray = range(0, 3);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
$objHomeElement->SetDescription($post['elementText'][$key]);
if($_FILES['elementImg_'.$key]['tmp_name']) {
$photoSize = getimagesize($_FILES['elementImg_'.$key]['tmp_name']);
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH) {
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH / $photoProp;
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH;
}
if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT) {
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT * $photoProp;
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT;
}
$photoFile = PhotoDAL::SimplePhotoUpload($_FILES['elementImg_'.$key], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
if(file_exists(PATH_STATIC_CONTENT.'upload/home/'.$destName.'.jpg'))
unlink(PATH_STATIC_CONTENT.'upload/home/'.$destName.'.jpg');
$propW = $photoWidth/self::IMAGE_MINI_WIDTH;
$propH = $photoHeight/self::IMAGE_MINI_HEIGHT;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
$photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/home', 0, 0, self::IMAGE_MINI_WIDTH*$prop, self::IMAGE_MINI_HEIGHT*$prop, self::IMAGE_MINI_WIDTH, self::IMAGE_MINI_HEIGHT);
$objHomeElement->SetPhoto($photoMini);
}
MfHomeSiteDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirect(Router::GenerateUrl('editBox', array('_value' => 'Box')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'Strona główna');
$this->smarty->assign('lang', $param['lang']);
// $struct = array(
// 'User' => array('User' => 'Index'),
// 'Słowniki' => array('Dictionary' => 'Index'),
// //'Role' => array('Acl' => 'Index'),
// //'Uprawnienia' => array('Acl' => 'Rules'),
// 'Zmienne serwisu' => array('Setup' => 'Index')
//
//
// );
$this->smarty->assign('structure','');
}
private function renderStruct($struct){
$return = array();
foreach($struct AS $k => $row){
$return[] = '<a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a>';
}
return implode("<br />",$return);
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,322 @@
<?php
/**
* $Id$
* Słownki
*
*/
class CalcController extends MainController implements ControllerInterface {
const CONTENT_PER_PAGE = 50;
/**
* Domyślna metoda
*
*/
public function IndexAction($param) {
if (isset($param['type'])) {
SessionProxy::SetValue('typeCalc', $param['type']);
} else {
$param['type'] = 1;
}
SessionProxy::SetValue('typeCalc', $param['type']);
$dalData = MfParametersDAL::GetDalDataObj();
$dalData->addCondition('type', $param['type']);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjParameters);
//===grupowanie====
$arrayParam = array();
$arrayGroupParam = array();
foreach ($arrayObjParameters as $objParam) {
$idLink = $objParam->GetLinkId();
$arrayGroupParam[$objParam->GetLinkId()][] = $objParam;
}
$this->smarty->assign('arrayObj', $arrayObjParameters);
$this->smarty->assign('arrayGroupParam', $arrayGroupParam);
}
public function AddAction($param) {
$objParameters = new MfParameters();
$objParameters->setType(SessionProxy::GetValue('typeCalc'));
$this->smarty->assign('obj', $objParameters);
if (Request::GetPost('doCategoryEdit')) {
Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$priceProgres = Request::Get('price_progres');
$priceProgres ? $priceProgres = 1 : $priceProgres = '0';
$objParameters->setPublication($publication);
$objParameters->setPrice($data['price']);
$objParameters->setLinkId($data['link_id']);
$objParameters->setName($data['name']);
$objParameters->setOpis($data['opis']);
$objParameters->setPriceProgres($priceProgres);
$objParameters->setCountProgres($data['count_progres']);
$objParameters->setUnit($data['unit']);
if(empty($out)) {
//Utils::ArrayDisplay($objParameters);
$idParameters = MfParametersDAL::Save($objParameters);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Calc' => 'Index', 'type' => $objParameters->getType())));
} else {
$this->smarty->assign('obj',$objParameters);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
$objParameters = MfParametersDAL::GetById($param['id']);
$this->smarty->assign('obj', $objParameters);
if (Request::GetPost('doCategoryEdit')) {
Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$priceProgres = Request::Get('price_progres');
$priceProgres ? $priceProgres = 1 : $priceProgres = '0';
$objParameters->setPublication($publication);
$objParameters->setPrice($data['price']);
$objParameters->setLinkId($data['link_id']);
$objParameters->setName($data['name']);
$objParameters->setOpis($data['opis']);
$objParameters->setCountProgres($data['count_progres']);
$objParameters->setPriceProgres($priceProgres);
$objParameters->setUnit($data['unit']);
if(empty($out)) {
//Utils::ArrayDisplay($objParameters);
$idParameters = MfParametersDAL::Save($objParameters);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Calc' => 'Index', 'type' => $objParameters->getType())));
} else {
$this->smarty->assign('obj',$objParameters);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function DeleteAction($param) {
$arrayObjDict = MfDictionaryDAL::GetResult(array('id_mf_dictionary' => $param['id']), array(), 1, 'mf_dictionary.keyword ASC');
if (count($arrayObjDict) > 0) {
MfDictionaryDAL::DeleteByKey($arrayObjDict[0]->GetKeyword());
}
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
public function RegDeleteAction($param) {
$id = $param['id'];
if ($id) {
try {
$obj = MfParticipantDAL::GetById($id);
$dalData = MfParticipantDAL::GetDalDataObj();
$dalData->setId($id);
$dalData->setObj($obj);
MfParametersDAL::Delete($dalData);
} catch (Exception $e) {
//Utils::ArrayDisplay($e);
$logger->error('bład usunięcia wpisu o id: '.$id);
}
}
$this->AddRedirect(Router::GenerateUrl('red', array('Calc' => 'Reg', 'location' => $param['location'])), 0);
}
public function RegEditAction($param) {
$id = isset($param['id']) ? $param['id'] : Request::GetPost('id');
$objParticipant = MfParticipantDAL::GetById($id);
if (Request::GetPost('doCategoryEdit')) {
$objParticipant->setStatus(Request::GetPost('payment_status'));
MfParticipantDAL::Save($objParticipant);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('red', array('Calc' => 'Reg', 'location' => $objParticipant->getLocation() ? $objParticipant->getLocation() : 1)), 0);
}
$arrayFee = $objParticipant->getFeeFullUnserialize();
if (!is_array($arrayFee)) {
$arrayFee = array();
}
$discPrice = isset($arrayFee['disc']) ? $arrayFee['disc'] : 1;
$dalData = MfParametersDAL::GetDalDataObj();
$dalData->addCondition('publication', 1);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
$this->smarty->assign('obj', $objParticipant);
$this->smarty->assign('objParticipant', $objParticipant);
$this->smarty->assign('arrayFee', $arrayFee);
$this->smarty->assign('discPrice', $discPrice);
$this->smarty->assign('arrayObjParameters', $arrayObjParameters);
}
public function RegAction($param) {
$location = 1;
if (isset($param['location'])) {
$location = $param['location'];
}
if ($location == 2) {
$this->partialTemplate = 'RegPAN.tpl';
}
$dalData = MfParticipantDAL::GetDalDataObj();
$dalData->addCondition('location', $location);
//$dalData->setSortBy();
$arrayObjReg = MfParticipantDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjReg);
$dalData = MfParametersDAL::GetDalDataObj();
$dalData->addCondition('publication', 1);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
$this->smarty->assign('arrayObjParameters', $arrayObjParameters);
$this->smarty->assign('arrayObj', $arrayObjReg);
$this->smarty->assign('location', $location);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Formularz');
$struct = array(
//'User' => array('User' => 'Index'),
'Rejestracja - aktualia' => array('Calc' => 'Reg', 'location' => 1),
//'Rejestracja - NAWA' => array('Calc' => 'Reg', 'location' => 2),
// 'Parametry' => array('Calc' => 'Index', 'type' => 1),
//'Parametry mieszkanie' => array('Calc' => 'Index', 'type' => 2),
'Treści - aktualia' => array('HomeSite' => 'EditArticle', 'location' => 1),
//'Treści - NAWA' => array('HomeSite' => 'EditArticle', 'location' => 2)
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,336 @@
<?php
/**
* $Id$
* Słownki
*
*/
class CalcController extends MainController implements ControllerInterface {
const CONTENT_PER_PAGE = 50;
/**
* Domyślna metoda
*
*/
public function IndexAction($param) {
if (isset($param['type'])) {
SessionProxy::SetValue('typeCalc', $param['type']);
} else {
$param['type'] = 1;
}
SessionProxy::SetValue('typeCalc', $param['type']);
$dalData = MfParametersDAL::GetDalDataObj();
$dalData->addCondition('type', $param['type']);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjParameters);
//===grupowanie====
$arrayParam = array();
$arrayGroupParam = array();
foreach ($arrayObjParameters as $objParam) {
$idLink = $objParam->GetLinkId();
$arrayGroupParam[$objParam->GetLinkId()][] = $objParam;
}
$this->smarty->assign('arrayObj', $arrayObjParameters);
$this->smarty->assign('arrayGroupParam', $arrayGroupParam);
}
public function AddAction($param) {
$objParameters = new MfParameters();
$objParameters->setType(SessionProxy::GetValue('typeCalc'));
$this->smarty->assign('obj', $objParameters);
if (Request::GetPost('doCategoryEdit')) {
Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$priceProgres = Request::Get('price_progres');
$priceProgres ? $priceProgres = 1 : $priceProgres = '0';
$objParameters->setPublication($publication);
$objParameters->setPrice($data['price']);
$objParameters->setLinkId($data['link_id']);
$objParameters->setName($data['name']);
$objParameters->setOpis($data['opis']);
$objParameters->setPriceProgres($priceProgres);
$objParameters->setCountProgres($data['count_progres']);
$objParameters->setUnit($data['unit']);
if(empty($out)) {
//Utils::ArrayDisplay($objParameters);
$idParameters = MfParametersDAL::Save($objParameters);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Calc' => 'Index', 'type' => $objParameters->getType())));
} else {
$this->smarty->assign('obj',$objParameters);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
$objParameters = MfParametersDAL::GetById($param['id']);
$this->smarty->assign('obj', $objParameters);
if (Request::GetPost('doCategoryEdit')) {
Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$priceProgres = Request::Get('price_progres');
$priceProgres ? $priceProgres = 1 : $priceProgres = '0';
$objParameters->setPublication($publication);
$objParameters->setPrice($data['price']);
$objParameters->setLinkId($data['link_id']);
$objParameters->setName($data['name']);
$objParameters->setOpis($data['opis']);
$objParameters->setCountProgres($data['count_progres']);
$objParameters->setPriceProgres($priceProgres);
$objParameters->setUnit($data['unit']);
if(empty($out)) {
//Utils::ArrayDisplay($objParameters);
$idParameters = MfParametersDAL::Save($objParameters);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Calc' => 'Index', 'type' => $objParameters->getType())));
} else {
$this->smarty->assign('obj',$objParameters);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function RegEditAction($param) {
$dalData = MfParametersDAL::GetDalDataObj();
//$dalData->addCondition('type', $type);
$dalData->addCondition('publication', 1);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
$objParticipant = MfParticipantDAL::GetById($param['id']);
$arrayFee = $objParticipant->getFeeFullUnserialize();
//Utils::ArrayDisplay($arrayTextPrice);
$this->smarty->assign('arrayObjParameters', $arrayObjParameters);
$this->smarty->assign('discPrice', $arrayFee['disc']);
$this->smarty->assign('arrayFee', $arrayFee);
$this->smarty->assign('obj', $objParticipant);
$this->smarty->assign('objParticipant', $objParticipant);
if (Request::GetPost('doCategoryEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
//$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$objParticipant->setStatus($data['payment_status']);
if(empty($out)) {
//Utils::ArrayDisplay($objParameters);
$idParameters = MfParticipantDAL::Save($objParticipant);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editReg', array('Calc' => 'Reg')));
} else {
$this->smarty->assign('obj',$objParticipant);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function DeleteAction($param) {
$arrayObjDict = MfDictionaryDAL::GetResult(array('id_mf_dictionary' => $param['id']), array(), 1, 'mf_dictionary.keyword ASC');
if (count($arrayObjDict) > 0) {
MfDictionaryDAL::DeleteByKey($arrayObjDict[0]->GetKeyword());
}
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
public function RegDeleteAction($param) {
$obj = MfParticipantDAL::GetById($param['id']);
$dalData = MfParticipantDAL::GetDalDataObj();
$dalData->setObj($obj);
MfParticipantDAL::Delete($dalData);
$this->AddRedirectInfo('Usunięto', 'ok', Router::GenerateUrl('editReg', array('Calc' => 'Reg')));
}
public function RegAction($param) {
$dalData = MfParticipantDAL::GetDalDataObj();
//$dalData->setSortBy();
$arrayObjReg = MfParticipantDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjReg);
$dalData = MfParametersDAL::GetDalDataObj();
$dalData->addCondition('publication', 1);
$dalData->setSortBy('sort');
$arrayObjParameters = MfParametersDAL::GetResult($dalData);
$this->smarty->assign('arrayObjParameters', $arrayObjParameters);
$this->smarty->assign('arrayObj', $arrayObjReg);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Formularz');
$struct = array(
//'User' => array('User' => 'Index'),
'Rejestracja' => array('Calc' => 'Reg'),
// 'Parametry' => array('Calc' => 'Index', 'type' => 1),
//'Parametry mieszkanie' => array('Calc' => 'Index', 'type' => 2),
'Treści' => array('HomeSite' => 'EditArticle')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,440 @@
<?php
/**
* Kontroler konfigurator
*
*/
class ConfigController extends MainController implements ControllerInterface {
const CONTENT_PER_PAGE = 5;
/**
* Strona glowna
*
*/
public function IndexAction($param) {
$dalData = MfStepDAL::GetDalDataObj();
$arrayObjStep = MfStepDAL::GetResult($dalData);
// Utils::ArrayDisplay($arrayObjStep[0]->getStepElement());
$this->smarty->assign('arrayObj', $arrayObjStep);
}
public function AddStructureAction($param) {
}
public function AddAction($param) {
$objStep = MfStepDAL::GetEmptyObj();
if (Request::GetPost('doCategoryAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$objStep->setPublication($publication);
$objStep->setWeight($data['weight']);
$objStep->setLang('pl');
$objStep->setName($data['name']);
$objStep->setDescription($data['description']);
$objStep->setDateAdd(Utils::GetNowDate());
if(empty($out)) {
$idStep = MfStepDAL::Save($objStep);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Config' => 'Index')));
} else {
$this->smarty->assign('obj',$objStep);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
$this->smarty->assign('obj',$objStep);
}
public function EditAction($param) {
$objStep = MfStepDAL::GetById($param['id'], $param['lang']);
$this->smarty->assign('obj', $objStep);
if (Request::GetPost('doCategoryEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$objStep->setPublication($publication);
$objStep->setWeight($data['weight']);
$objStep->setLang('pl');
$objStep->setName($data['name']);
$objStep->setDescription($data['description']);
$objStep->setDateEdit(Utils::GetNowDate());
if(empty($out)) {
//Utils::ArrayDisplay($objStep);
$idStep = MfStepDAL::Save($objStep);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Config' => 'Index')));
} else {
$this->smarty->assign('obj',$objStep);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function DeleteAction($param) {
$dalData = MfStepElementDAL::GetDalDataObj();
$dalData->setCount(true);
$dalData->addCondition('id_mf_step', $param['id']);
$count = MfStepElementDAL::GetResult($dalData);
$delete = true;
$error = '';
if ($count > 0 ) {
$delete = false;
}
if ($delete) {
$objStep = MfStepDAL::GetById($param['id']);
$dalData = MfStepDAL::GetDalDataObj();
$dalData->setObj($objStep);
MfStepDAL::Delete($dalData);
$this->AddRedirectInfo('Element został usunięty', 'ok', Router::GenerateUrl('editCategory', array('Config' => 'Index')));
} else {
if ($count) {
$error .= 'Grupa posiada elementy';
}
// if ($isLang) {
// $error .= $error ? '<br/><br/>' : '';
// $error .= 'Kategoria posiada wersję jezykową';
// }
$this->AddRedirectInfo($error, 'error', Router::GenerateUrl('editCategory', array('Config' => 'Index')));
}
}
public function IndexElementAction($param) {
$dalData = MfStepDAL::GetDalDataObj();
$arrayObjStep = MfStepDAL::GetResult($dalData);
// Utils::ArrayDisplay($arrayObjStep[0]->getStepElement());
$this->smarty->assign('arrayObj', $arrayObjStep);
}
public function AddElementAction($param) {
$idMain = $param['idMain'];
$objStepElement = MfStepElementDAL::GetEmptyObj();
if (Request::GetPost('doCategoryAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$other = Request::Get('other');
$other ? $other = 1 : $other = '0';
$objStepElement->setOther($other);
$objStepElement->setIdMfStep($idMain);
$objStepElement->setPublication($publication);
$objStepElement->setWeight($data['weight']);
$objStepElement->setLang('pl');
$objStepElement->setName($data['name']);
$objStepElement->setDescription($data['description']);
$objStepElement->setDateAdd(Utils::GetNowDate());
if(empty($out)) {
$idStep = MfStepElementDAL::Save($objStepElement);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Config' => 'Edit', 'id' => $idMain)));
} else {
$this->smarty->assign('obj',$objStepElement);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
$this->smarty->assign('obj',$objStepElement);
$this->smarty->assign('idMain',$idMain);
}
public function EditElementAction($param) {
$idMain = $param['idMain'];
$objStepElement = MfStepElementDAL::GetById($param['id'], $param['lang']);
$this->smarty->assign('obj', $objStepElement);
$this->smarty->assign('idMain',$idMain);
if (Request::GetPost('doCategoryEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$other = Request::Get('other');
$other ? $other = 1 : $other = '0';
$objStepElement->setOther($other);
$objStepElement->setIdMfStep($idMain);
$objStepElement->setPublication($publication);
$objStepElement->setWeight($data['weight']);
$objStepElement->setLang('pl');
$objStepElement->setName($data['name']);
$objStepElement->setDescription($data['description']);
$objStepElement->setDateEdit(Utils::GetNowDate());
if(empty($out)) {
//Utils::ArrayDisplay($objStep);
$idStep = MfStepElementDAL::Save($objStepElement);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editConfig', array('Config' => 'Edit', 'id' => $idMain)));
} else {
$this->smarty->assign('obj',$objStep);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function ArchiveAction($param) {
$dalData = MfConfigArchiveDAL::GetDalDataObj();
$page = 1;
if(isset($param['p']) && $param['p'] > 0) {
$page = $param['p'];
}
SessionProxy::SetValue('__news_page_no__', $page);
$offset = ($page - 1) * self::CONTENT_PER_PAGE;
$param['ajax'] = 'GetTableContent($(this).attr(\'href\'), \'#tableContentClient\', $(\'#search\').val(), $(\'#linkedList\').val())';
//$this->smarty->assign('ajax',$param['ajax']);
$dalData->setCount(true);
try {
$limit = Utils::PageConfigure($this->smarty, $param, ceil(MfConfigArchiveDAL::GetResult($dalData)), self::CONTENT_PER_PAGE);
} catch (Exception $e) {
Utils::ArrayDisplay($e);
}
$dalData->setCount(false);
$dalData->setSortBy('date_add DESC');
$dalData->setLimit($limit);
$arrayObj = MfConfigArchiveDAL::GetResult($dalData, false);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function AjaxArchiveAction($param) {
$this->SetAjaxRender();
$dalData = MfConfigArchiveDAL::GetDalDataObj();
$page = 1;
$search= trim(Request::GetPost('search'));
$status = Request::GetPost('linked');
$arraySearch = explode(' ', $search);
if (count($arraySearch) > 0) {
$where = ' ( ';
foreach ($arraySearch as $key => $search) {
$where .= $key == 0 ? '' : ' OR ';
$where .= ' company LIKE "%'.Utils::AddSlashes($search).'%" ';
}
$where .= ' ) ';
$dalData->addCondition(' ', $where, ' ');
}
$dalData->addCondition('status', $status);
if(isset($param['p']) && $param['p'] > 0) {
$page = $param['p'];
}
SessionProxy::SetValue('__news_page_no__', $page);
$offset = ($page - 1) * self::CONTENT_PER_PAGE;
$param['ajax'] = 'GetTableContent($(this).attr(\'href\'), \'#tableContentClient\', $(\'#search\').val(), $(\'#linkedList\').val())';
//$this->smarty->assign('ajax',$param['ajax']);
$dalData->setCount(true);
try {
$limit = Utils::PageConfigure($this->smarty, $param, ceil(MfConfigArchiveDAL::GetResult($dalData)), self::CONTENT_PER_PAGE);
} catch (Exception $e) {
Utils::ArrayDisplay($e);
}
$dalData->setCount(false);
$dalData->setSortBy('date_add DESC');
$dalData->setLimit($limit);
$arrayObj = MfConfigArchiveDAL::GetResult($dalData, false);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function ShowArchiveAction($param) {
$obj = MfConfigArchiveDAL::GetById($param['id']);
$this->smarty->assign('obj', $obj);
}
public function AjaxArchiveStatusAction($param) {
$this->SetNoRender();
$data = Request::GetAllPost();
if (Request::GetPost('id') > 0) {
$obj = MfConfigArchiveDAL::GetById($data['id']);
$obj->setStatus($data['status']);
MfConfigArchiveDAL::Save($obj);
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
//$this->RunShared('Admin');
$this->AddScript('structure.js');
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'CRM');
$struct = array(
//'User' => array('User' => 'Index'),
'Konfigurator' => array('Config' => 'Index'),
'-> Historia konfiguracji' => array('Config' => 'Archive'),
'Demo' => array('Demo' => 'Index'),
'-> Historia pobierania' => array('Demo' => 'File'),
'Pliki' => array('File' => 'Index'),
'Klienci' => array('Client' => 'Index'),
'Strefa Poradnik' => array('Structure' => 'Edit', 'id' => 30),
'Strefa Aktualne promocje' => array('Structure' => 'Edit', 'id' => 31),
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,268 @@
<?php
/**
* Kontroler Demo
*
*/
class DemoController extends MainController implements ControllerInterface {
const CONTENT_PER_PAGE = 30;
/**
* Strona glowna
*
*/
public function IndexAction($param) {
$this->AddScript('structure.js');
$dalData = MfClientDAL::GetDalDataObj();
$page = 1;
$countStart = 0;
if(isset($param['strona']) && $param['strona'] > 0) {
$page = $param['strona'];
$countStart = ($page-1)*self::CONTENT_PER_PAGE;
}
SessionProxy::SetValue('__news_page_no__', $page);
$offset = ($page - 1) * self::CONTENT_PER_PAGE;
$param['ajax'] = 'GetTableContent($(this).attr(\'href\'), \'#tableContentClient\', $(\'#search\').val(), $(\'#linkedList\').val(), $(\'#sortVal\').val())';
//$this->smarty->assign('ajax',$param['ajax']);
$dalData->setCount(true);
$dalData->addCondition('type', 5);
try {
$limit = Utils::PageConfigure($this->smarty, $param, ceil(MfClientDAL::GetResult($dalData)), self::CONTENT_PER_PAGE);
} catch (Exception $e) {
Utils::ArrayDisplay($e);
}
$sortNameASC = '';
$sortNameDESC = '';
$sortIdASC = '';
$sortIdDESC = '';
$sortDateAddDESC = '';
$sortDateAddASC = '';
$sortVal = Request::GetPost('sortVal');
switch (Request::GetPost('sortVal')) {
case 'last_name DESC':
$sortNameDESC = 'Act';
break;
case 'last_name ASC':
$sortNameASC = 'Act';
break;
case 'id_mf_client DESC':
$sortIdDESC = 'Act';
break;
case 'id_mf_client ASC':
$sortIdASC = 'Act';
break;
default:
$sortVal = 'last_name';
$sortNameASC = 'Act';
}
$dalData->setCount(false);
$dalData->setSortBy($sortVal);
$dalData->setLimit($limit);
$dalData->addCondition('type', 5);
$arrayObjClient = MfClientDAL::GetResult($dalData, false);
$this->smarty->assign('arrayObj', $arrayObjClient);
//Utils::ArrayDisplay($arrayObjClient);
$this->smarty->assign('sortVal', 'last_name');
$this->smarty->assign('sortNameASC', $sortNameASC);
$this->smarty->assign('sortNameDESC', $sortNameDESC);
$this->smarty->assign('sortIdASC', $sortIdASC);
$this->smarty->assign('sortIdDESC', $sortIdDESC);
$this->smarty->assign('sortDateAddASC', $sortDateAddASC);
$this->smarty->assign('sortDateAddDESC', $sortDateAddDESC);
$this->smarty->assign('countStart', $countStart);
}
public function AjaxListAction($param) {
$this->AddScript('structure.js');
$this->SetAjaxRender();
$dalData = MfClientDAL::GetDalDataObj();
$page = 1;
$countStart = 0;
if(isset($param['strona']) && $param['strona'] > 0) {
$page = $param['strona'];
$countStart = ($page-1)*self::CONTENT_PER_PAGE;
}
SessionProxy::SetValue('__news_page_no__', $page);
$offset = ($page - 1) * self::CONTENT_PER_PAGE;
$param['ajax'] = 'GetTableContent($(this).attr(\'href\'), \'#tableContentClient\', $(\'#search\').val(), $(\'#linkedList\').val(), $(\'#sortVal\').val())';
$this->smarty->assign('ajax',$param['ajax']);
$dalData->setCount(true);
$dalData->addCondition('type', 5);
try {
$limit = Utils::PageConfigure($this->smarty, $param, ceil(MfClientDAL::GetResult($dalData, false)), self::CONTENT_PER_PAGE);
} catch (Exception $e) {
Utils::ArrayDisplay($e);
}
$sortNameASC = '';
$sortNameDESC = '';
$sortIdASC = '';
$sortIdDESC = '';
$sortDateAddDESC = '';
$sortDateAddASC = '';
$sortVal = Request::GetPost('sortVal');
switch (Request::GetPost('sortVal')) {
case 'last_name DESC':
$sortNameDESC = 'Act';
break;
case 'last_name ASC':
$sortNameASC = 'Act';
break;
case 'id_mf_client DESC':
$sortIdDESC = 'Act';
break;
case 'id_mf_client ASC':
$sortIdASC = 'Act';
break;
case 'date_add ASC':
$sortDateAddASC = 'Act';
break;
case 'date_add DESC':
$sortDateAddDESC = 'Act';
break;
default:
$sortVal = 'last_name';
$sortNameASC = 'Act';
}
$dalData->setCount(false);
$dalData->setSortBy($sortVal);
$dalData->setLimit($limit);
$arrayObjClient = MfClientDAL::GetResult($dalData, false);
$this->smarty->assign('arrayObj', $arrayObjClient);
//Utils::ArrayDisplay($arrayObjClient);
$this->smarty->assign('sortNameASC', $sortNameASC);
$this->smarty->assign('sortNameDESC', $sortNameDESC);
$this->smarty->assign('sortIdASC', $sortIdASC);
$this->smarty->assign('sortIdDESC', $sortIdDESC);
$this->smarty->assign('sortDateAddASC', $sortDateAddASC);
$this->smarty->assign('sortDateAddDESC', $sortDateAddDESC);
$this->smarty->assign('countStart', $countStart);
}
public function ViewAction($param) {
$objClient = MfClientDAL::GetById($param['id']);
$this->smarty->assign('obj', $objClient);
//===FILE=======================================
$dalData = MfFileDemoLogsDAL::GetDalDataObj();
$dalData->addCondition('id_mf_client',$param['id']);
//Utils::ArrayDisplay($_SERVER);
//$dalData->setJoin(array('objFile' => ' LEFT JOIN mf_file ON mf_article.id_mf_article=mf_article_description.id_mf_article'));
$arrayObj = MfFileDemoLogsDAL::GetResult($dalData);
$this->smarty->assign('arrayObjFile', $arrayObj);
//----------------------------------------------
}
public function FileAction($param) {
$dalData = MfFileDemoDAL::GetDalDataObj();
$arrayObj = MfFileDemoDAL::GetResult($dalData);
$dalData = MfFileDemoLogsDAL::GetDalDataObj();
//$dalData->setCount(true);
foreach ($arrayObj as $obj) {
$dalData->addCondition('id_mf_file_demo', $obj->getId());
$arrayByFile[$obj->getId()] = MfFileDemoLogsDAL::GetResult($dalData);
}
//Utils::ArrayDisplay($arrayByFile);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function AddStructureAction($param) {
$this->SetNoRender();
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
//$this->RunShared('Admin');
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'CRM');
$struct = array(
//'User' => array('User' => 'Index'),
'Konfigurator' => array('Config' => 'Index'),
'-> Historia konfiguracji' => array('Config' => 'Archive'),
'Demo' => array('Demo' => 'Index'),
'-> Historia pobierania' => array('Demo' => 'File'),
'Pliki' => array('File' => 'Index'),
'Klienci' => array('Client' => 'Index'),
'Strefa Poradnik' => array('Structure' => 'Edit', 'id' => 30),
'Strefa Aktualne promocje' => array('Structure' => 'Edit', 'id' => 31),
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,153 @@
<?php
/**
* $Id$
* Słownki
*
*/
class DictionaryController extends MainController implements ControllerInterface {
const CONTENT_PER_PAGE = 50;
/**
* Domyślna metoda
*
*/
public function IndexAction($param) {
//$dalData->setCount(true);
$limit = Utils::PageConfigure($this->smarty, $param, ceil( MfDictionaryDAL::GetResult(array('lang' => "'pl'"), array(), null, null, true)), self::CONTENT_PER_PAGE);
$arrayObjDict = MfDictionaryDAL::GetResult(array('lang' => "'pl'"), array(), $limit, 'mf_dictionary.keyword ASC');
//Utils::ArrayDisplay($arrayObjDict);
$this->smarty->assign('arrayObjDict', $arrayObjDict);
}
public function EditAction($param) {
if (isset($param['id'])) {
$arrayObjDict = MfDictionaryDAL::GetResult(array('id_mf_dictionary' => $param['id']), array(), 1, 'mf_dictionary.keyword ASC');
if (!(count($arrayObjDict) > 0)) {
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')));
}
if (Request::GetPost('doDictEdit')) {
$post = Request::GetAllPost(false);
foreach ($post['replacement'] as $langDict => $replacement) {
$arrayObjDict = MfDictionaryDAL::GetResult(array('keyword' => "'".$post['keyword']."'", 'lang' => "'".$langDict."'"), array(), 1, 'mf_dictionary.keyword ASC');
$objDict = $arrayObjDict[0];
$objDict->SetReplacement($replacement);
MfDictionaryDAL::Save($objDict);
}
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
$arrayObjDict = MfDictionaryDAL::GetResult(array('id_mf_dictionary' => $param['id']), array(), 1, 'mf_dictionary.keyword ASC');
if (!(count($arrayObjDict) > 0)) {
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
$this->smarty->assign('objDict', $arrayObjDict[0]);
} else {
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
}
public function DeleteAction($param) {
$arrayObjDict = MfDictionaryDAL::GetResult(array('id_mf_dictionary' => $param['id']), array(), 1, 'mf_dictionary.keyword ASC');
if (count($arrayObjDict) > 0) {
MfDictionaryDAL::DeleteByKey($arrayObjDict[0]->GetKeyword());
}
$this->AddRedirect(Router::GenerateUrl('DictLabel', array("Dictionary" => 'Index')), 0);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
// 'Kategorie produktów' => array('ProductCategory' => 'Index'),
// 'Serie produktów' => array('ProductSeries' => 'Index'),
// 'Materiał produktów' => array('ProductSpec' => 'Index', 'type' => 2),
// 'Kolor produktów' => array('ProductSpec' => 'Index', 'type' => 1),
// 'Żarówki produktów' => array('ProductSpec' => 'Index', 'type' => 3),
//'Paramtery produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,489 @@
<?
class FileController extends MainController implements ControllerInterface
{
const AVATAR_DEST_DIR = '/upload/File';
const AVATAR_TEMP_DIR = '/upload/temp';
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const PHOTO_WIDTH = 283;
const PHOTO_HEIGHT = 400;
const IMAGE_MINI_WIDTH = 283;
const IMAGE_MINI_HEIGHT = 400;
const IMAGE_NORMAL_WIDTH = 283;
const IMAGE_NORMAL_HEIGHT = 400;
public function IndexAction($param){
$dalData = MfFileDAL::GetDalDataObj();
$dalData->setCondition(array());
$dalData->setLimit(10);
$dalData->setSortBy('weight');
$arrayFile = MfFileDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayFile);
}
public function IndexStructureAction($param){
$lang = SessionProxy::GetValue('lang');
$dalData = MfFileDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $lang));
$dalData->setSortBy('weight');
$arrayFile = MfFileDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayFile);
//Utils::ArrayDisplay($arrayFile);
}
public function EditStructureAction($param) {
$lang = SessionProxy::GetValue('lang');
$dalData = MfFileDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $lang));
$dalData->setSortBy('weight');
$arrayFile = MfFileDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayFile);
}
/**
* Akcja dodawania
*
* @param <type> $param
*/
public function AddAction($param) {
$lang = SessionProxy::GetValue('lang');
$idStructure = SessionProxy::GetValue('idStructure');
if (!$idStructure) {
$this->AddRedirect(Router::GenerateUrl('IndexStructure', array('Structure' => 'Index')), 0);
}
$this->smarty->assign('idStructure', $idStructure);
//$idCategory = SessionProxy::GetValue('idCategory');
$idCategory = $idStructure;
$arrayFileType = Utils::GetArrayList('mf_file_type', 'id_mf_file_type','name');
$this->smarty->assign('arrayFileType', $arrayFileType);
$objFile = MfFileDAL::GetEmptyObj();
if(Request::IsPost()) {
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('title', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsDate('datepublication', 'Pole data publikacji musi zostać wypełnione.');
//$validator->IsEmpty('description', 'Pole opis musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$data['timepublication'] = $data['timepublication'] ? $data['timepublication'] : '00';
$objFileDescription = $objFile->GetDescriptionObj();
$objFile->SetDate(Utils::GetNowDate());
//$objFile->SetDatePublication($data['datepublication']." ".$data['timepublication'].":00:00");
$objFile->SetDatePublication(Utils::GetNowDate());
$objFile->SetWeight($data['weight']);
$objFile->SetPublication($publication);
$objFile->SetType($data['file_type']);
$objFile->SetIdStructure($idCategory);
$objFile->SetDateUpdate(Utils::GetNowDate());
$objFile->SetAddDate(Utils::GetNowDate());
$objFile->SetEditDate(Utils::GetNowDate());
$objFileDescription->SetLang($lang);
$objFileDescription->SetDescription($data['description']);
$objFileDescription->SetTitle($data['title']);
$objFileDescription->SetPublication($publication);
if(empty($out)) {
if($_FILES['filename']['tmp_name']){
$destName = Utils::TextToUrl($_FILES['filename']['name']);
if(file_exists(PATH_STATIC_CONTENT.'upload/File/'.$destName)) {
$destName = '1_'.$destName;
}
move_uploaded_file($_FILES['filename']['tmp_name'], PATH_STATIC_CONTENT.'upload/File/'.$destName);
umask(0000);
@chmod(PATH_STATIC_CONTENT.'upload/File/'.$destName, 0777);
$objFile->SetName($destName);
}
if($_FILES['photoname']['tmp_name']){
$photoSize = getimagesize($_FILES['photoname']['tmp_name']);
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH) {
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH / $photoProp;
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH;
}
if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT) {
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT * $photoProp;
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT;
}
$photoFile = PhotoDAL::SimplePhotoUpload($_FILES['photoname'], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
if(file_exists(PATH_STATIC_CONTENT.'upload/File/'.$destName.'.jpg'))
unlink(PATH_STATIC_CONTENT.'upload/File/'.$destName.'.jpg');
$propW = $photoWidth/self::IMAGE_NORMAL_WIDTH;
$propH = $photoHeight/self::IMAGE_NORMAL_HEIGHT;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
// maks szerokość
//$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, $photoWidth, $photoHeight, self::IMAGE_NORMAL_WIDTH, $photoWidth/$prop);
// maks wysokość
//$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, $photoWidth, $photoHeight, $photoHeight/$prop, self::IMAGE_NORMAL_HEIGHT);
$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, self::IMAGE_NORMAL_WIDTH*$prop, self::IMAGE_NORMAL_HEIGHT*$prop, self::IMAGE_NORMAL_WIDTH, self::IMAGE_NORMAL_HEIGHT);
// Utils::ArrayDisplay('$prop: '.$prop);
// Utils::ArrayDisplay('$propW: '.$propW);
// Utils::ArrayDisplay('$propH: '.$propH);
// Utils::ArrayDisplay('$photoHeight: '.$photoHeight);
// Utils::ArrayDisplay('$photoWidth: '.$photoWidth);
/// Utils::ArrayDisplay('$photoHeight/$prop: '.$photoWidth/$prop);
// Utils::ArrayDisplay('self::IMAGE_NORMAL_HEIGHT: '.self::IMAGE_NORMAL_HEIGHT);
//Utils::ArrayDisplay('foto: '.$photo);
$objPhoto = new Picture();
$objPhoto->SetLink($photo);
$objPhoto->SetWeight(1);
$objPhoto->SetPublication(1);
$idPhoto = PictureDAL::Insert($objPhoto);
$objFile->SetIdPicture($idPhoto);
$destName = md5('photo' . microtime());
$propW = $photoWidth/self::IMAGE_MINI_WIDTH;
$propH = $photoHeight/self::IMAGE_MINI_HEIGHT;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
$photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, self::IMAGE_MINI_WIDTH*$prop, self::IMAGE_MINI_HEIGHT*$prop, self::IMAGE_MINI_WIDTH, self::IMAGE_MINI_HEIGHT);
//Utils::ArrayDisplay('fotoMini: '.$photoMini);
$objPhoto = new Picture();
$objPhoto->SetLink($photoMini);
$objPhoto->SetWeight(1);
$objPhoto->SetPublication(1);
$idPhoto = PictureDAL::Insert($objPhoto);
$objFile->SetIdPictureMini($idPhoto);
}
if (isset($data['deletePhoto'])) {
$objFile->SetIdPictureMini(0);
$objFile->SetIdPicture(0);
}
$iid = MfFileDAL::Save($objFile);
$objFileDescription->SetIdMfFile($iid);
MfFileDescriptionDAL::Save($objFileDescription);
$this->smarty->assign('iid', $iid);
//$this->AddRedirect(Router::GenerateUrl('indexFile', array('File'=> 'Index')), 0);
$this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0);
} else {
//$this->content=$this->FormatAjaxOutput($out, $param);
//Utils::ArrayDisplay($out);
$objFile->SetFileDescriptionObj($objFileDescription);
$this->smarty->assign('objFile',$objFile);
$datePublished = explode(" ",$objFile->GetDatePublication());
$this->smarty->assign("datePublished", $datePublished[0]);
$this->smarty->assign("timePublished", $datePublished[1]);
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
/**
* Akcja dodawania
*
* @param <type> $param
*/
public function EditAction($param) {
//Utils::ArrayDisplay($_POST);
$lang = SessionProxy::GetValue('lang');
$idStructure = SessionProxy::GetValue('idStructure');
$this->smarty->assign('idStructure', $idStructure);
//$idCategory = SessionProxy::GetValue('idCategory');
$idCategory = $idStructure;
//$arrayFileType = Utils::GetArrayList('mf_file_type', 'name', $lang);
//$this->smarty->assign('arrayFileType', $arrayFileType);
//$objFile = MfFileDAL::GetEmptyObj();
$objFile = MfFileDAL::GetById($param['idFile'], $lang);
if(Request::IsPost()) {
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('title', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsDate('datepublication', 'Pole data publikacji musi zostać wypełnione.');
//$validator->IsEmpty('description', 'Pole opis musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$objFileDescription = $objFile->GetDescriptionObj();
$objFile->SetDate(Utils::GetNowDate());
//$objFile->SetDatePublication($data['datepublication']." ".$data['timepublication'].":00:00");
$objFile->SetDatePublication(Utils::GetNowDate());
$objFile->SetWeight($data['weight']);
$objFile->SetPublication($publication);
$objFile->SetIdStructure($idCategory);
$objFile->SetType($data['file_type']);
$objFile->SetDateUpdate(Utils::GetNowDate());
$objFile->SetAddDate(Utils::GetNowDate());
$objFile->SetEditDate(Utils::GetNowDate());
//Utils::ArrayDisplay($objFile);
$objFileDescription->SetLang($lang);
$objFileDescription->SetDescription($data['description']);
$objFileDescription->SetTitle($data['title']);
$objFileDescription->SetPublication($publication);
if(empty($out)) {
if($_FILES['filename']['tmp_name']){
if (file_exists($objFile->GetNamePath())) {
unlink($objFile->GetNamePath());
}
$destName = Utils::TextToUrl($_FILES['filename']['name']);
if(file_exists(PATH_STATIC_CONTENT.'upload/File/'.$destName)) {
$destName = '1_'.$destName;
}
move_uploaded_file($_FILES['filename']['tmp_name'], PATH_STATIC_CONTENT.'upload/File/'.$destName);
umask(0000);
@chmod(PATH_STATIC_CONTENT.'upload/File/'.$destName, 0777);
$objFile->SetName($destName);
}
//=obrazki na listę============================================================================================================================================================
if($_FILES['photoname']['tmp_name']) {
$photoSize = getimagesize($_FILES['photoname']['tmp_name']);
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH) {
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH / $photoProp;
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH;
}
if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT) {
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT * $photoProp;
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT;
}
$photoFile = PhotoDAL::SimplePhotoUpload($_FILES['photoname'], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
if(file_exists(PATH_STATIC_CONTENT.'upload/File/'.$destName.'.jpg'))
unlink(PATH_STATIC_CONTENT.'upload/File/'.$destName.'.jpg');
$propW = $photoWidth/self::IMAGE_NORMAL_WIDTH;
$propH = $photoHeight/self::IMAGE_NORMAL_HEIGHT;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
//$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/Structure', 0, 0, self::IMAGE_NORMAL_WIDTH*$prop, self::IMAGE_NORMAL_HEIGHT*$prop, self::IMAGE_NORMAL_WIDTH, self::IMAGE_NORMAL_HEIGHT);
//maks szerokość
//$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, $photoWidth, $photoHeight, self::IMAGE_NORMAL_WIDTH, $photoWidth/$prop);
// maks wysokość
//$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, $photoWidth, $photoHeight, $photoHeight/$prop, self::IMAGE_NORMAL_HEIGHT);
$photo = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, self::IMAGE_NORMAL_WIDTH*$prop, self::IMAGE_NORMAL_HEIGHT*$prop, self::IMAGE_NORMAL_WIDTH, self::IMAGE_NORMAL_HEIGHT);
$objPhoto = new Picture();
$objPhoto->SetLink($photo);
$objPhoto->SetWeight(1);
$objPhoto->SetPublication(1);
$idPhoto = PictureDAL::Insert($objPhoto);
$objFile->SetIdPicture($idPhoto);
$destName = md5('photo' . microtime());
$propW = $photoWidth/self::IMAGE_MINI_WIDTH;
$propH = $photoHeight/self::IMAGE_MINI_HEIGHT;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
$photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/File', 0, 0, self::IMAGE_MINI_WIDTH*$prop, self::IMAGE_MINI_HEIGHT*$prop, self::IMAGE_MINI_WIDTH, self::IMAGE_MINI_HEIGHT);
$objPhoto = new Picture();
$objPhoto->SetLink($photoMini);
$objPhoto->SetWeight(1);
$objPhoto->SetPublication(1);
$idPhoto = PictureDAL::Insert($objPhoto);
$objFile->SetIdPictureMini($idPhoto);
}
if (isset($data['deletePhoto'])) {
$objFile->SetIdPictureMini(0);
$objFile->SetIdPicture(0);
}
//===============================================================================================================================================================
//Utils::ArrayDisplay($objFileDescription);
$iid = MfFileDAL::Save($objFile);
$objFileDescription->SetIdMfFile($iid);
MfFileDescriptionDAL::Save($objFileDescription);
$this->smarty->assign('iid', $iid);
//$this->AddRedirect(Router::GenerateUrl('indexFile', array('File'=> 'Index')), 0);
$this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0);
} else {
//$this->content=$this->FormatAjaxOutput($out, $param);
//Utils::ArrayDisplay($out);
$objFile->SetFileDescriptionObj($objFileDescription);
$this->smarty->assign('objFile',$objFile);
$datePublished = explode(" ",$objFile->GetDatePublication());
$this->smarty->assign("datePublished", $datePublished[0]);
$this->smarty->assign("timePublished", $datePublished[1]);
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
$this->smarty->assign('objFile', $objFile);
}
public function DeleteAction($param) {
$idStructure = SessionProxy::GetValue('idStructure');
$logger = LoggerManager::getLogger(__CLASS__);
$idFile = $param['idFile'];
if ($idFile) {
try {
$objFile = MfFileDAL::GetById($idFile);
if (file_exists($objFile->GetNamePath())) {
unlink($objFile->GetNamePath());
}
MfFileDAL::Delete($objFile);
} catch (Exception $e) {
//Utils::ArrayDisplay($e);
$logger->error('bład usunięcia pliku o id: '.$idFile);
}
}
$this->AddRedirect(Router::GenerateUrl('editStructure', array('id' => $idStructure)), 0);
}
/**
* preDispatch
* @param array $param
* @return null
*/
public function preDispatch($param){
$this->Run($param);
$this->AddScript('dropDown.js');
$this->AddScript('structure.js');
$this->AddScript('Dosia.js');
$this->AddScript('Link.js');
$this->AddScript('drag-drop-folder-tree.js');
// //$this->AddScript('Validator.js');
$this->AddScript('calendar.js');
$this->RunShared('Auth', array());
$this->RunShared('Structure', $param);
$this->smarty->assign('idStucture', SessionProxy::GetValue('idStructure'));
$this->smarty->assign('lang', 'pl');
$this->smarty->assign('titleAdmin', 'Pliki');
$this->smarty->assign('activeTab', 'index');
}
/**
* postDispatch
* @param array $param
* @return null
*/
public function postDispatch($param){
}
}

View File

@@ -0,0 +1,257 @@
<?php
/**
* $Id$
* klient
*
*/
class HomeController extends MainController implements ControllerInterface {
const PATH_BANER = '/upload/Banner';
/**
* Domyslna metoda
*
*/
public function IndexAction($param) {
$lang = SessionProxy::GetValue('lang');
if (!is_dir(PATH_STATIC_CONTENT.self::PATH_BANER)) {
mkdir(PATH_STATIC_CONTENT.self::PATH_BANER, 0777);
}
if (!is_dir(PATH_STATIC_CONTENT.self::PATH_BANER."/".$lang)) {
mkdir(PATH_STATIC_CONTENT.self::PATH_BANER."/".$lang, 0777);
}
//AKCJE DOMYSLNE
$logger = LoggerManager::getLogger(__CLASS__);
if(isset($_POST['saveBanners'])) {
//Utils::ArrayDisplay($_POST);
foreach ($_POST['id'] as $id) {
$name = $_POST['name'][$id];
if (isset($_FILES['baner'.$id]) && $_FILES['baner'.$id]['error'] != 4) {
//echo "sss ".isset($_FILES['photo']['name']);
$fileName = $_FILES['baner'.$id]['name'];
$ext = explode(".",$fileName);
$fileName = Utils::ClearString($fileName);
if (is_file(PATH_STATIC_CONTENT.self::PATH_BANER.$id."/".$_POST['banerSaved'.$id])) {
unlink(PATH_STATIC_CONTENT.self::PATH_BANER.$id."/".$_POST['banerSaved'.$id]);
}
}
else if (isset($_POST['banerSaved'.$id])) {
$fileName = $_POST['banerSaved'.$id];
}
if ($_POST['id']) {
}
//$idCustomer = $_POST['idCustomer'];
$id = HomeDAL::Update($id, $name, $fileName, $lang);
if (!is_dir(PATH_STATIC_CONTENT.self::PATH_BANER."/".$lang."/".$id)) {
mkdir(PATH_STATIC_CONTENT.self::PATH_BANER."/".$lang."/".$id, 0777);
}
CustomerDAL::SaveCustomerFile($_FILES, 'baner'.$id, $fileName, PATH_STATIC_CONTENT.self::PATH_BANER."/".$lang."/".$id);
}
// die(Header('Location: customer'.APPLICATION_FILE_TYPE));
}
$arrayBanner = HomeDAL::GetAll($lang);
$this->smarty->assign('arrayBanner', $arrayBanner);
//Utils::ArrayDisplay($arrayBanner);
$this -> AddScript('AC_RunActiveContent.js');
$this->AddScript('swfobject.js');
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditAction($param) {
$logger = LoggerManager::getLogger(__CLASS__);
//$this->AddScript('CopyFiles.js');
$this->AddScript('prototype.js');
$this->AddScript('validateFormCustomer.js');
$this->AddScript('CheckUnique.js');
if(isset($param['id'])) {
$id=$param['id'];
} else{
$id = null;
}
if(isset($_POST['saveCustomer'])) {
//Utils::ArrayDisplay($_POST);
$id = $_POST['id'];
$name = $_POST['name'];
$url = $_POST['url'];
$sort = $_POST['sort'];
$content = $_POST['content'];
if(!strstr($url, "http://")) {
$url = "http://".$url;
}
if (isset($_FILES['baner']) && $_FILES['baner']['error'] != 4) {
//echo "sss ".isset($_FILES['photo']['name']);
$fileName = $_FILES['baner']['name'];
$ext = explode(".",$fileName);
$fileName = Utils::ClearString($fileName);
if (is_file(PATH_CUSTOMER.$id."/".$_POST['banerSaved'])) {
unlink(PATH_CUSTOMER.$id."/".$_POST['banerSaved']);
}
}
else if (isset($_POST['banerSaved'])) {
$fileName = $_POST['banerSaved'];
}
if ($_POST['id']) {
}
//$idCustomer = $_POST['idCustomer'];
$objCustomer = new Customer($id, $name, $fileName, $content, $url, $sort, $published);
$id = CustomerDAL::Save($objCustomer);
if (!is_dir(PATH_CUSTOMER.$id)) {
mkdir(PATH_CUSTOMER.$id, 0777);
}
CustomerDAL::SaveCustomerFile($_FILES, 'baner', $fileName, PATH_CUSTOMER.$id);
die(Header('Location: customer'.APPLICATION_FILE_TYPE));
}
//AKCJE DOMY<4D>LNE
$objCustomer = CustomerDAL::GetCustomerById($id);
//Utils::ArrayDisplay($objQuery);
$this->smarty->assign('objCustomer', $objCustomer);
$this->smarty->assign('id', $id);
//Utils::ArrayDisplay($objCustomer);
$this->smarty->register_modifier("sslash", "stripslashes");
}
/**
* Sprawdzanie unikalno<6E>ci nazwy klient
*
* @param array $param
*/
public function AjaxCheckUniqueAction($param) {
header('Content-Type: text/html; charset=iso-8859-2');
if ($_POST['value']) {
$value = $_POST['value'];
} else {
$value = "";
}
if ($_POST['column']) {
$column = $_POST['column'];
} else {
$column = "";
}
$unigue = Utils::CheckUnique('customer', $column, $value);
if (!$unigue) {
$this->smarty->assign("uniqueInfo", "1");
}
$this->smarty->assign("column", $column);
$template = 'clean.tpl';
Registry::Remove('smartyTemplate');
Registry::Set('smartyTemplate', $template);
}
/**
* usuwanie banera
*
*/
public function DeleteAction($param) {
$logger = LoggerManager::getLogger(__CLASS__);
$idCustomer = SessionProxy::GetValue(EnumSessionValue::IDCUSTOMER);
if(isset($param['id'])) {
$id=$param['id'];
} else{
$id = null;
}
if($id) {
CustomerDAL::Delete($id);
// $filePath = PATH_BILLBOARD.$idCustomer."/".$id.".swf";
// if (is_file($filePath)) {
// @unlink($filePath);
// }
die(Header('Location: customer'.APPLICATION_FILE_TYPE));
if (Pat) {
}
}
//AKCJE DOMY<4D>LNE
//Utils::ArrayDisplay($objQuery);
}
public function RedirectAction($param) {
if(isset($param) && is_array($param) && !empty($param) && isset($param['id']) && !empty($param['id'])) {
$customer = CustomerDAL::GetCustomerById($param['id']);
Utils::Redirect($customer -> GetRedirectUrl());
}
exit;
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->AddScript("prototype.js");
$this->AddScript("scriptaculous.js");
$this->AddScript("GetContent.js");
$this->AddScript("tree.js");
$this->AddScript('dropDown.js');
$this->AddScript('structure.js');
$this->AddScript('Dosia.js');
$this->AddScript('Link.js');
$this->AddScript('drag-drop-folder-tree.js');
$this->AddScript('Validator.js');
$this->AddScript('calendar.js');
//Utils::ArrayDisplay($param);
$this->Run($param);
$this->RunShared('Structure', $param);
$this->smarty->assign('titleAdmin', 'Struktura strony');
$arrayModuleName = MfModuleDAL::GetArrayModuleName();
$this->smarty->assign( 'arrayModuleName' ,$arrayModuleName);
$this->smarty->assign('showIcon', true);
$this->RunShared('Auth', $param);
//Utils::ArrayDisplay(Utils::ArrayDisplay(SessionProxy::GetValue(EnumSessionValue::USER_OBJECT)));
// if($this->IsUser()==false) {
// $this->AddRedirect(URL_MAIN.'/Login.frmx', 0);
// }
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,566 @@
<?php
/**
* $Id$
* klient
*
*/
class HomeSiteController extends MainController implements ControllerInterface {
const PATH_BANER = '/upload/home';
const COUNT_BOX = 6;
const AVATAR_DEST_DIR = '/upload/home';
const LOGO_DEST_DIR = '/upload/logo';
const AVATAR_TEMP_DIR = '/upload/temp';
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const CROPPER_BIG_PHOTO_MAX_WIDTH_BANER = 1000;
const CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER = 1000;
//const PHOTO_WIDTH = 288;
//const PHOTO_HEIGHT = 127;
const IMAGE_MINI_WIDTH = 450;
const IMAGE_MINI_HEIGHT = 200;
const IMAGE_MINI_WIDTH_BANER = 1024;
const IMAGE_MINI_HEIGHT_BANER = 385;
//const IMAGE_NORMAL_WIDTH = 627;
//const IMAGE_NORMAL_HEIGHT = 219;
/**
* 170px × 130px
* Domyslna metoda
*
*/
public function IndexAction($param) {
//$this->SetAjaxRender();
$dalData = StructureDAL::GetDalDataObj();
$dalData->addCondition('publication', 1);
$dalData->setSortBy('name');
$arrayObjElement = StructureDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjElement);
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 3);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(4);
$arrayObjHome = MfHomeSiteDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayObjElement', $arrayObjElement);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditAction($param) {
$countArray = range(0, 3);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
// $objHomeElement->SetDescription($post['elementText'][$key]);
//$objHomeElement->SetIdSource($post['idElement'][$key]);
if ($_FILES['elementImg_' . $key]['tmp_name']) {
// $photoSize = getimagesize($_FILES['elementImg_'.$key]['tmp_name']);
// $photoProp = $photoSize[0] / $photoSize[1];
// $photoWidth = $photoSize[0];
// $photoHeight = $photoSize[1];
// if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH) {
// $photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH / $photoProp;
// $photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH;
// }
// if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT) {
// $photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT * $photoProp;
// $photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT;
// }
// $photoFile = PhotoDAL::SimplePhotoUpload($_FILES['elementImg_'.$key], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
if (file_exists(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg'))
unlink(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
move_uploaded_file($_FILES['elementImg_' . $key]['tmp_name'], PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
// $propW = $photoWidth/self::IMAGE_MINI_WIDTH;
// $propH = $photoHeight/self::IMAGE_MINI_HEIGHT;
// if ($propW > $propH) {
// $prop = $propH;
// } else {
// $prop = $propW;
// }
// $photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/home', 0, 0, self::IMAGE_MINI_WIDTH*$prop, self::IMAGE_MINI_HEIGHT*$prop, self::IMAGE_MINI_WIDTH, self::IMAGE_MINI_HEIGHT);
$objHomeElement->SetPhoto($destName . '.jpg');
}
MfHomeSiteDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editHomeSite', array('_value' => 'HomeSite')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function LinksAction($param) {
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 5);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteLinkDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
//$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(6);
$arrayObjHome = MfHomeSiteLinkDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteLinkDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditLinkAction($param) {
$countArray = range(0, 5);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteLinkDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
//$objHomeElement->SetDescription($post['elementText'][$key]);
MfHomeSiteLinkDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirect(Router::GenerateUrl('editHomeSite', array('HomeSite' => 'links')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function BanerAction($param) {
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 9);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteBanerDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(10);
$dalData->setSortBy('sort');
$arrayObjHome = MfHomeSiteBanerDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteBanerDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditBanerAction($param) {
$countArray = range(0, 9);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteBanerDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
$objHomeElement->SetSort($post['elementSort'][$key]);
$objHomeElement->SetDescription($post['elementText'][$key]);
if ($_FILES['elementImg_' . $key]['tmp_name']) {
$photoSize = getimagesize($_FILES['elementImg_' . $key]['tmp_name']);
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER) {
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER / $photoProp;
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER;
}
if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER) {
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER * $photoProp;
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER;
}
//$photoFile = PhotoDAL::SimplePhotoUpload($_FILES['elementImg_'.$key], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
//Utils::ArrayDisplay($_FILES['elementImg_'.$key]['tmp_name']);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT.'upload/home/'.$destName.'.jpg');
include_once (Config::Get('PATH_CORE') . '/lib/WideImage/WideImage.php');
if (file_exists(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg'))
unlink(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
$img = WideImage::loadFromUpload('elementImg_' . $key);
$img->resizeDown('1920', null)->saveToFile(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg', 90);
//move_uploaded_file($_FILES['elementImg_' . $key]['tmp_name'], PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
$propW = $photoWidth / self::IMAGE_MINI_WIDTH_BANER;
$propH = $photoHeight / self::IMAGE_MINI_HEIGHT_BANER;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
//$photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/home', 0, 0, self::IMAGE_MINI_WIDTH_BANER*$prop, self::IMAGE_MINI_HEIGHT_BANER*$prop, self::IMAGE_MINI_WIDTH_BANER, self::IMAGE_MINI_HEIGHT_BANER);
$objHomeElement->SetPhoto($destName . '.jpg');
}
if (isset($post['elementClear'][$key])) {
$objHomeElement->SetName('');
$objHomeElement->SetSourceUrl('');
$objHomeElement->SetPhoto('');
$objHomeElement->SetSort(100);
}
MfHomeSiteBanerDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirect(Router::GenerateUrl('editHomeSite', array('HomeSite' => 'Baner')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function LogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$this->smarty->assign('type', $param['type']);
$dalData = MfLogaDAL::GetDalDataObj();
$dalData->addCondition('type', $param['type']);
$arrayObj = MfLogaDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function AddLogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$obj = MfLogaDAL::GetEmptyObj();
if (Request::GetPost('doLogoEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
if (!$_FILES['logo']['tmp_name']) {
$validator->AddError('logo', 'Dodaj plik');
}
$out = $validator->GetErrorList();
$active = Request::Get('active');
$active ? $active = 1 : $active = '0';
$obj->setPublication($active);
$obj->setName($data['name']);
$obj->setUrl($data['url']);
$obj->setSort($data['sort']);
$obj->setType($param['type']);
$obj->setDateAdd(Utils::GetNowDate());
//Utils::ArrayDisplay($out);
if (empty($out)) {
$destNameOrg = $_FILES["logo"]["name"];
include(Config::Get('PATH_CORE') . '/lib/WideImage/WideImage.php');
move_uploaded_file($_FILES["logo"]["tmp_name"], PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $destNameOrg);
// $img = WideImage::loadFromUpload('logo');
// $img->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg);
// $img->resizeDown('100%', 75)->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg, 90);
$obj->setPhoto($destNameOrg);
$idLoga = MfLogaDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
} else {
$this->smarty->assign('obj', $obj);
$this->smarty->assign('info', 'Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type', 'error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error', $error);
}
}
$this->smarty->assign('obj', $obj);
$this->smarty->assign('type', $param['type']);
}
public function EditLogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$dalData = MfLogaDAL::GetDalDataObj();
$obj = MfLogaDAL::GetById($param['id']);
if (Request::GetPost('doLogoEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$active = Request::Get('active');
$active ? $active = 1 : $active = '0';
$obj->setPublication($active);
$obj->setName($data['name']);
$obj->setUrl($data['url']);
$obj->setSort($data['sort']);
$obj->setType($param['type']);
$obj->setDateAdd(Utils::GetNowDate());
//Utils::ArrayDisplay($out);
if (empty($out)) {
if ($_FILES['logo']['tmp_name']) {
$destNameOrg = $_FILES["logo"]["name"];
move_uploaded_file($_FILES["logo"]["tmp_name"], PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $destNameOrg);
// include(Config::Get('PATH_CORE').'/lib/WideImage/WideImage.php');
// $img = WideImage::loadFromUpload('logo');
// $img->resizeDown('100%', 75)->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg, 90);
$obj->setPhoto($destNameOrg);
}
$idLoga = MfLogaDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
} else {
$this->smarty->assign('obj', $obj);
$this->smarty->assign('info', 'Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type', 'error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error', $error);
}
}
$this->smarty->assign('obj', $obj);
}
public function DeleteLogoAction($param) {
$this->SetNoRender();
if (!isset($param['type'])) {
$param['type'] = 1;
}
$dalData = MfLogaDAL::GetDalDataObj();
$obj = MfLogaDAL::GetById($param['id']);
if ($obj->getId() > 0) {
$dalData->setObj($obj);
$param['type'] = $obj->getType();
//Utils::ArrayDisplay(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto());
if (file_exists(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto())) {
unlink(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto());
}
MfLogaDAL::Delete($dalData);
} else {
$this->AddRedirectInfo('Brak elementu', 'error', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
}
$this->AddRedirectInfo('Usunięto', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
}
public function BoxAction($param) {
//Utils::ArrayDisplay($param);
//Utils::ArrayDisplay($_FILES);
if (Request::GetPost('doBoxEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
if ($_FILES['box']['tmp_name']) {
move_uploaded_file($_FILES['box']['tmp_name'], PATH_STATIC_CONTENT . "/upload/baner.jpg");
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editBox', array('HomeSite' => 'Box')));
} else {
//Utils::ArrayDisplay('err');
$this->AddRedirectInfo('Dodaj plik', 'info', Router::GenerateUrl('editBox', array('HomeSite' => 'Box')));
}
}
}
public function ArticleBoxAction($param) {
$dalData = MfArticleBoxDAL::GetDalDataObj();
$arrayObj = MfArticleBoxDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function EditArticleAction($param) {
$location = 1;
if(isset($param['location'])) {
$location = $param['location'];
}
if ($location == 1) {
$arrayIdLang = array('pl' => 1, 'en' => 2);
} elseif ($location == 2) {
$arrayIdLang = array('pl' => 3, 'en' => 4);
}
$this->smarty->assign('location', $location);
$lang = SessionProxy::GetValue('lang');
if (isset($arrayIdLang[$lang])) {
$id = $arrayIdLang[$lang];
$obj = MfArticleBoxDAL::GetById($id);
//Utils::ArrayDisplay($obj);
if ($obj->getId() != $id) {
$dalData = MfArticleBoxDAL::GetDalDataObj();
$obj->setId($id);
$obj->setLang($lang);
$dalData->setObj($obj);
MfArticleBoxDAL::Insert($dalData);
}
$this->smarty->assign('obj', $obj);
if (Request::IsPost()) {
$data = Request::GetAllPost();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$obj->setDescription($data['description']);
$obj->setShortnote($data['shortnote']);
$obj->setPublication($publication);
$obj->setLang($lang);
//$obj->setDatePublication($data['datePublication']);
$obj->setName($data['name']);
$dalData = MfArticleBoxDAL::GetDalDataObj();
$dalData->setObj($obj);
MfArticleBoxDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('', array('HomeSite'=>'EditArticle', 'location' => $location)));
}
} else {
$obj = MfArticleBoxDAL::GetEmptyObj();
}
$this->smarty->assign('obj', $obj);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'Formularz');
$struct = array(
//'User' => array('User' => 'Index'),
'Rejestracja - aktualia' => array('Calc' => 'Reg', 'location' => 1),
//'Rejestracja - NAWA' => array('Calc' => 'Reg', 'location' => 2),
// 'Parametry' => array('Calc' => 'Index', 'type' => 1),
//'Parametry mieszkanie' => array('Calc' => 'Index', 'type' => 2),
'Treści - aktualia' => array('HomeSite' => 'EditArticle', 'location' => 1),
//'Treści - NAWA' => array('HomeSite' => 'EditArticle', 'location' => 2)
);
$this->smarty->assign('structure', $this->renderStruct($struct));
}
private function renderStruct($struct) {
$return = '';
foreach ($struct AS $k => $row) {
$return .= '<li><a href="' . Router::GenerateUrl('dictpig', $row) . '">' . $k . '</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,554 @@
<?php
/**
* $Id$
* klient
*
*/
class HomeSiteController extends MainController implements ControllerInterface {
const PATH_BANER = '/upload/home';
const COUNT_BOX = 6;
const AVATAR_DEST_DIR = '/upload/home';
const LOGO_DEST_DIR = '/upload/logo';
const AVATAR_TEMP_DIR = '/upload/temp';
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const CROPPER_BIG_PHOTO_MAX_WIDTH_BANER = 1000;
const CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER = 1000;
//const PHOTO_WIDTH = 288;
//const PHOTO_HEIGHT = 127;
const IMAGE_MINI_WIDTH = 450;
const IMAGE_MINI_HEIGHT = 200;
const IMAGE_MINI_WIDTH_BANER = 1024;
const IMAGE_MINI_HEIGHT_BANER = 385;
//const IMAGE_NORMAL_WIDTH = 627;
//const IMAGE_NORMAL_HEIGHT = 219;
/**
* 170px × 130px
* Domyslna metoda
*
*/
public function IndexAction($param) {
//$this->SetAjaxRender();
$dalData = StructureDAL::GetDalDataObj();
$dalData->addCondition('publication', 1);
$dalData->setSortBy('name');
$arrayObjElement = StructureDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayObjElement);
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 3);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(4);
$arrayObjHome = MfHomeSiteDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayObjElement', $arrayObjElement);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditAction($param) {
$countArray = range(0, 3);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
// $objHomeElement->SetDescription($post['elementText'][$key]);
//$objHomeElement->SetIdSource($post['idElement'][$key]);
if ($_FILES['elementImg_' . $key]['tmp_name']) {
// $photoSize = getimagesize($_FILES['elementImg_'.$key]['tmp_name']);
// $photoProp = $photoSize[0] / $photoSize[1];
// $photoWidth = $photoSize[0];
// $photoHeight = $photoSize[1];
// if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH) {
// $photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH / $photoProp;
// $photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH;
// }
// if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT) {
// $photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT * $photoProp;
// $photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT;
// }
// $photoFile = PhotoDAL::SimplePhotoUpload($_FILES['elementImg_'.$key], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
if (file_exists(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg'))
unlink(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
move_uploaded_file($_FILES['elementImg_' . $key]['tmp_name'], PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
// $propW = $photoWidth/self::IMAGE_MINI_WIDTH;
// $propH = $photoHeight/self::IMAGE_MINI_HEIGHT;
// if ($propW > $propH) {
// $prop = $propH;
// } else {
// $prop = $propW;
// }
// $photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/home', 0, 0, self::IMAGE_MINI_WIDTH*$prop, self::IMAGE_MINI_HEIGHT*$prop, self::IMAGE_MINI_WIDTH, self::IMAGE_MINI_HEIGHT);
$objHomeElement->SetPhoto($destName . '.jpg');
}
MfHomeSiteDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editHomeSite', array('_value' => 'HomeSite')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function LinksAction($param) {
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 5);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteLinkDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
//$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(6);
$arrayObjHome = MfHomeSiteLinkDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteLinkDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditLinkAction($param) {
$countArray = range(0, 5);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteLinkDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
//$objHomeElement->SetDescription($post['elementText'][$key]);
MfHomeSiteLinkDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirect(Router::GenerateUrl('editHomeSite', array('HomeSite' => 'links')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function BanerAction($param) {
//Utils::ArrayDisplay($param);
$lang = SessionProxy::GetValue('lang');
$countArray = range(0, 9);
//Utils::ArrayDisplay($param);
$dalData = MfHomeSiteBanerDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('lang' =>$lang));
$dalData->setLimit(10);
$dalData->setSortBy('sort');
$arrayObjHome = MfHomeSiteBanerDAL::GetResult($dalData);
//Utils::ArrayDisplay($countArray);
$arrayToEdit = array();
foreach ($countArray as $key => $element) {
if (key_exists($key, $arrayObjHome)) {
$arrayToEdit[] = $arrayObjHome[$key];
} else {
$arrayToEdit[] = MfHomeSiteBanerDAL::GetEmptyObj();
}
}
//Utils::ArrayDisplay($arrayToEdit);
$this->smarty->assign('arrayToEdit', $arrayToEdit);
$this->smarty->assign('lang', $lang);
}
/**
* Dodawanie/edycja klient/banera
*
*/
public function EditBanerAction($param) {
$countArray = range(0, 9);
$post = Request::GetAllPost();
foreach ($countArray as $key => $element) {
$objHomeElement = MfHomeSiteBanerDAL::GetById($post['elementId'][$key]);
//$objHomeElement = new MfHomeSite();
$objHomeElement->SetName($post['elementName'][$key]);
$objHomeElement->SetSourceUrl($post['elementUrl'][$key]);
$objHomeElement->SetSort($post['elementSort'][$key]);
$objHomeElement->SetDescription($post['elementText'][$key]);
if ($_FILES['elementImg_' . $key]['tmp_name']) {
$photoSize = getimagesize($_FILES['elementImg_' . $key]['tmp_name']);
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER) {
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER / $photoProp;
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_WIDTH_BANER;
}
if ($photoHeight > self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER) {
$photoWidth = self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER * $photoProp;
$photoHeight = self::CROPPER_BIG_PHOTO_MAX_HEIGHT_BANER;
}
//$photoFile = PhotoDAL::SimplePhotoUpload($_FILES['elementImg_'.$key], self::AVATAR_TEMP_DIR . DIRECTORY_SEPARATOR , $photoWidth, $photoHeight, 100);
$destName = md5('photo' . microtime());
//Utils::ArrayDisplay($_FILES['elementImg_'.$key]['tmp_name']);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT.'upload/home/'.$destName.'.jpg');
include_once (Config::Get('PATH_CORE') . '/lib/WideImage/WideImage.php');
if (file_exists(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg'))
unlink(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
$img = WideImage::loadFromUpload('elementImg_' . $key);
$img->resizeDown('1920', null)->saveToFile(PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg', 90);
//move_uploaded_file($_FILES['elementImg_' . $key]['tmp_name'], PATH_STATIC_CONTENT . 'upload/home/' . $destName . '.jpg');
$propW = $photoWidth / self::IMAGE_MINI_WIDTH_BANER;
$propH = $photoHeight / self::IMAGE_MINI_HEIGHT_BANER;
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
//$photoMini = PhotoDAL::SaveTempFile($photoFile, $destName, '/upload/home', 0, 0, self::IMAGE_MINI_WIDTH_BANER*$prop, self::IMAGE_MINI_HEIGHT_BANER*$prop, self::IMAGE_MINI_WIDTH_BANER, self::IMAGE_MINI_HEIGHT_BANER);
$objHomeElement->SetPhoto($destName . '.jpg');
}
if (isset($post['elementClear'][$key])) {
$objHomeElement->SetName('');
$objHomeElement->SetSourceUrl('');
$objHomeElement->SetPhoto('');
$objHomeElement->SetSort(100);
}
MfHomeSiteBanerDAL::Save($objHomeElement);
//Utils::ArrayDisplay($objHomeElement);
}
$this->AddRedirect(Router::GenerateUrl('editHomeSite', array('HomeSite' => 'Baner')), 0);
//Utils::ArrayDisplay($_POST);
//Utils::ArrayDisplay($_FILES);
}
public function LogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$this->smarty->assign('type', $param['type']);
$dalData = MfLogaDAL::GetDalDataObj();
$dalData->addCondition('type', $param['type']);
$arrayObj = MfLogaDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function AddLogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$obj = MfLogaDAL::GetEmptyObj();
if (Request::GetPost('doLogoEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
if (!$_FILES['logo']['tmp_name']) {
$validator->AddError('logo', 'Dodaj plik');
}
$out = $validator->GetErrorList();
$active = Request::Get('active');
$active ? $active = 1 : $active = '0';
$obj->setPublication($active);
$obj->setName($data['name']);
$obj->setUrl($data['url']);
$obj->setSort($data['sort']);
$obj->setType($param['type']);
$obj->setDateAdd(Utils::GetNowDate());
//Utils::ArrayDisplay($out);
if (empty($out)) {
$destNameOrg = $_FILES["logo"]["name"];
include(Config::Get('PATH_CORE') . '/lib/WideImage/WideImage.php');
move_uploaded_file($_FILES["logo"]["tmp_name"], PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $destNameOrg);
// $img = WideImage::loadFromUpload('logo');
// $img->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg);
// $img->resizeDown('100%', 75)->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg, 90);
$obj->setPhoto($destNameOrg);
$idLoga = MfLogaDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
} else {
$this->smarty->assign('obj', $obj);
$this->smarty->assign('info', 'Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type', 'error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error', $error);
}
}
$this->smarty->assign('obj', $obj);
$this->smarty->assign('type', $param['type']);
}
public function EditLogoAction($param) {
if (!isset($param['type'])) {
$param['type'] = 1;
}
$dalData = MfLogaDAL::GetDalDataObj();
$obj = MfLogaDAL::GetById($param['id']);
if (Request::GetPost('doLogoEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$active = Request::Get('active');
$active ? $active = 1 : $active = '0';
$obj->setPublication($active);
$obj->setName($data['name']);
$obj->setUrl($data['url']);
$obj->setSort($data['sort']);
$obj->setType($param['type']);
$obj->setDateAdd(Utils::GetNowDate());
//Utils::ArrayDisplay($out);
if (empty($out)) {
if ($_FILES['logo']['tmp_name']) {
$destNameOrg = $_FILES["logo"]["name"];
move_uploaded_file($_FILES["logo"]["tmp_name"], PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $destNameOrg);
// include(Config::Get('PATH_CORE').'/lib/WideImage/WideImage.php');
// $img = WideImage::loadFromUpload('logo');
// $img->resizeDown('100%', 75)->saveToFile(PATH_STATIC_CONTENT.self::LOGO_DEST_DIR.'/'.$destNameOrg, 90);
$obj->setPhoto($destNameOrg);
}
$idLoga = MfLogaDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
} else {
$this->smarty->assign('obj', $obj);
$this->smarty->assign('info', 'Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type', 'error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error', $error);
}
}
$this->smarty->assign('obj', $obj);
}
public function DeleteLogoAction($param) {
$this->SetNoRender();
if (!isset($param['type'])) {
$param['type'] = 1;
}
$dalData = MfLogaDAL::GetDalDataObj();
$obj = MfLogaDAL::GetById($param['id']);
if ($obj->getId() > 0) {
$dalData->setObj($obj);
$param['type'] = $obj->getType();
//Utils::ArrayDisplay(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto());
if (file_exists(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto())) {
unlink(PATH_STATIC_CONTENT . self::LOGO_DEST_DIR . '/' . $param['type'] . '/' . $obj->getPhoto());
}
MfLogaDAL::Delete($dalData);
} else {
$this->AddRedirectInfo('Brak elementu', 'error', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
}
$this->AddRedirectInfo('Usunięto', 'ok', Router::GenerateUrl('editLoga', array('HomeSite' => 'Logo', 'type' => $param['type'])));
}
public function BoxAction($param) {
//Utils::ArrayDisplay($param);
//Utils::ArrayDisplay($_FILES);
if (Request::GetPost('doBoxEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
if ($_FILES['box']['tmp_name']) {
move_uploaded_file($_FILES['box']['tmp_name'], PATH_STATIC_CONTENT . "/upload/baner.jpg");
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editBox', array('HomeSite' => 'Box')));
} else {
//Utils::ArrayDisplay('err');
$this->AddRedirectInfo('Dodaj plik', 'info', Router::GenerateUrl('editBox', array('HomeSite' => 'Box')));
}
}
}
public function ArticleBoxAction($param) {
$dalData = MfArticleBoxDAL::GetDalDataObj();
$arrayObj = MfArticleBoxDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
}
public function EditArticleAction($param) {
$arrayIdLang = array('pl' => 1, 'en' => 2);
$lang = SessionProxy::GetValue('lang');
if (isset($arrayIdLang[$lang])) {
$id = $arrayIdLang[$lang];
$obj = MfArticleBoxDAL::GetById($id);
//Utils::ArrayDisplay($obj);
if ($obj->getId() != $id) {
$dalData = MfArticleBoxDAL::GetDalDataObj();
$obj->setId($id);
$obj->setLang($lang);
$dalData->setObj($obj);
MfArticleBoxDAL::Insert($dalData);
}
$this->smarty->assign('obj', $obj);
if (Request::IsPost()) {
$data = Request::GetAllPost();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$obj->setDescription($data['description']);
$obj->setShortnote($data['shortnote']);
$obj->setPublication($publication);
$obj->setLang($lang);
//$obj->setDatePublication($data['datePublication']);
$obj->setName($data['name']);
$dalData = MfArticleBoxDAL::GetDalDataObj();
$dalData->setObj($obj);
MfArticleBoxDAL::Save($obj);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('', array('HomeSite'=>'EditArticle')));
}
} else {
$obj = MfArticleBoxDAL::GetEmptyObj();
}
$this->smarty->assign('obj', $obj);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'Formularz');
$struct = array(
//'User' => array('User' => 'Index'),
'Rejestracja' => array('Calc' => 'Reg'),
// 'Parametry' => array('Calc' => 'Index', 'type' => 1),
//'Parametry mieszkanie' => array('Calc' => 'Index', 'type' => 2),
'Treści' => array('HomeSite' => 'EditArticle')
);
$this->smarty->assign('structure', $this->renderStruct($struct));
}
private function renderStruct($struct) {
$return = '';
foreach ($struct AS $k => $row) {
$return .= '<li><a href="' . Router::GenerateUrl('dictpig', $row) . '">' . $k . '</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,355 @@
<?
class ImageController extends MainController implements ControllerInterface {
const IMAGE_NORMAL_WIDTH = 1000;
const IMAGE_NORMAL_HEIGHT = 800;
public function IndexAction($param) {
$zip = new ZipArchive();
$archiveName = PATH_STATIC_CONTENT . 'test.zip';
if ($zip->open($archiveName) === true) {
//Utils::ArrayDisplay('ss');
for ($i = 0; $i < $zip->numFiles; $i++) {
$entry = $zip->getNameIndex($i);
//Utils::ArrayDisplay('zip://' . $archiveName . '#' . $entry);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT . 'temp/zip/' . $entry);
copy('zip://' . $archiveName . '#' . $entry, PATH_STATIC_CONTENT . 'temp/zip/' . $entry);
}
$zip->close();
}
}
public function UploadAction($param) {
if (!SessionProxy::IsSetValue('_ARRAY_PHOTO_')) {
SessionProxy::SetValue('_ARRAY_PHOTO_', array());
}
$arrayPhoto = SessionProxy::GetValue('_ARRAY_PHOTO_');
$this->SetAjaxRender();
include(Config::Get('PATH_CORE') . '/lib/WideImage/WideImage.php');
$destDir = 'temp/';
//Utils::ArrayDisplay($_FILES);
if ($_FILES['uploadfile']['name']) {
$ext = Utils::FileExtFromName($_FILES['uploadfile']['name']);
$uploadFileName = Utils::FileNameFromName($_FILES['uploadfile']['name']);
$destNameOrg = 'org_' . $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
$destName = $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
$destNameth = "th_" . $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
if (strtolower($ext) == 'zip') {
//======Muliti=ZIP=File====================================================
move_uploaded_file($_FILES['uploadfile']['tmp_name'], PATH_STATIC_CONTENT . 'temp/zip/' . $_FILES['uploadfile']['name']);
$zip = new ZipArchive();
$archiveName = PATH_STATIC_CONTENT . 'temp/zip/' . $_FILES['uploadfile']['name'];
if ($zip->open($archiveName) === true) {
//Utils::ArrayDisplay('ss');
for ($i = 0; $i < $zip->numFiles; $i++) {
$entry = $zip->getNameIndex($i);
// Kopiowanie do temp/zip;
$uploadFileName = Utils::FileNameFromName($entry);
$destNameOrg = 'org_' . $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
$destName = $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
$destNameth = "th_" . $uploadFileName . '_' . md5('photo' . time()) . '.jpg';
//Utils::ArrayDisplay($entry);
copy('zip://' . $archiveName . '#' . $entry, PATH_STATIC_CONTENT . 'temp/zip/' . $entry);
// wczytywanie do obróbki
$img = WideImage::loadFromFile(PATH_STATIC_CONTENT . 'temp/zip/' . $entry);
$img->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameOrg, 90);
$photoSize = getimagesize(PATH_STATIC_CONTENT . $destDir . $destNameOrg);
if ($photoSize[0] < $photoSize[1]) {
$cropH = true;
} else {
$cropH = false;
}
$img = WideImage::loadFromFile(PATH_STATIC_CONTENT . $destDir . $destNameOrg);
$img->resizeDown('1000', '800')->saveToFile(PATH_STATIC_CONTENT . $destDir . $destName, 90);
//
if ($cropH) {
// zmieniam zmniejszam obrazem do szerokości a potem go obcinam już tylko po wysokości
$img->resizeDown('137', null)->crop('center', 'center', 137, 77)->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameth, 90);
} else {
//Poziom OK!
// zmieniam zmniejszam obrazem do wysokości a potem go obcinam już tylko po szerokości
$img->resizeDown(null, '137')->crop('center', 'center', 137, 77)->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameth, 90);
}
$file = URL_STATIC_CONTENT . $destDir . $destNameth;
$array = array($destName => array('normal' => $destName, 'th' => $destNameth, 'full' => $destNameOrg));
$arrayPhoto = array_merge($arrayPhoto, $array);
SessionProxy::SetValue('_ARRAY_PHOTO_', $arrayPhoto);
$this->smarty->assign('photo', PATH_STATIC_CONTENT . $destDir . $destName);
unlink(PATH_STATIC_CONTENT . 'temp/zip/' . $entry);
}
$zip->close();
}
unlink(PATH_STATIC_CONTENT . 'temp/zip/' . $_FILES['uploadfile']['name']);
} else {
//======Simple=File====================================================
$img = WideImage::loadFromUpload('uploadfile');
$img->resizeDown('1920', null)->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameOrg, 90);
// $img->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameOrg, 90);
$photoSize = getimagesize(PATH_STATIC_CONTENT . $destDir . $destNameOrg);
//Utils::ArrayDisplay($photoSize);
if ($photoSize[0] < $photoSize[1]) {
$cropH = true;
} else {
$cropH = false;
}
$img = WideImage::loadFromFile(PATH_STATIC_CONTENT . $destDir . $destNameOrg);
$img->resizeDown('800', '600')->saveToFile(PATH_STATIC_CONTENT . $destDir . $destName, 90);
//
if ($cropH) {
// zmieniam zmniejszam obrazem do szerokości a potem go obcinam już tylko po wysokości
$img->resizeDown('137', null)->crop('center', 'center', 137, 77)->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameth, 90);
} else {
//Poziom OK!
// zmieniam zmniejszam obrazem do wysokości a potem go obcinam już tylko po szerokości
$img->resizeDown(null, '137')->crop('center', 'center', 137, 77)->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameth, 90);
}
$file = URL_STATIC_CONTENT . $destDir . $destNameth;
$array = array($destName => array('normal' => $destName, 'th' => $destNameth, 'full' => $destNameOrg));
$arrayPhoto = array_merge($arrayPhoto, $array);
SessionProxy::SetValue('_ARRAY_PHOTO_', $arrayPhoto);
$this->smarty->assign('photo', PATH_STATIC_CONTENT . $destDir . $destName);
}
}
$this->smarty->assign('arrayPhoto', $arrayPhoto);
}
public function UploadImageAction($param) {
if (!SessionProxy::IsSetValue('_ARRAY_PHOTO_')) {
SessionProxy::SetValue('_ARRAY_PHOTO_', array());
}
$arrayPhoto = SessionProxy::GetValue('_ARRAY_PHOTO_');
//$this->SetAjaxRender();
// $uploaddir = PATH_STATIC_CONTENT.'/upload/test/';
// $file = $uploaddir . basename($_FILES['uploadfile']['name']);
//Utils::ArrayDisplay($file);
// if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
// echo "success";
// } else {
// echo "error";
// }
//
$destName = md5('photo' . time());
$destName = md5('photo' . time());
$destNameth = "th_" . $destName . ".jpg";
$destName .= ".jpg";
//$destNamea = "test.jpg";
$destDir = 'temp/';
//Utils::ArrayDisplay($_FILES);
if (isset($_FILES['uploadfile']) && $_FILES['uploadfile']['name']) {
//$photoSize = getimagesize(PATH_STATIC_CONTENT.$destDir.$destName);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT);
$photo = PhotoDAL::SimplePhotoUpload($_FILES['uploadfile'], $destDir);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT.$photo);
$img_oryginal = new mImage(PATH_STATIC_CONTENT . $photo);
//$img_oryginal->scaleProp(600, 600, 'ffffff', false, 'c', 0);
$img_oryginal->saveToFile(PATH_STATIC_CONTENT . $destDir . $destName, 'jpg', 90, true);
$normalW = 242;
$normalH = 340;
// $photoSize = getimagesize(PATH_STATIC_CONTENT.$destDir.$destName);
//
// //Utils::ArrayDisplay($photoSize);
//
//// if ($photoSize[0] < $photoSize[1]) {
//// $cropH = true;
//// } else {
//// $cropH = false;
//// }
//
// $propW = $photoSize[0]/$normalW;
// $propH = $photoSize[1]/$normalH;
//
// // Utils::ArrayDisplay($propW.' - '.$propH);
//
// if ($propW > $propH) {
// $prop = $propH;
// } else {
// $prop = $propW;
// }
//
// if ($photoSize[1] < $normalH*$prop) {
// $photoSizeH = $normalH;
// } else {
// $photoSizeH = $photoSize[1];
// }
//
//
// $photoSizeH = $normalW*$prop;
// $photoSizeW =$normalH*$prop;
//
//
//Utils::ArrayDisplay($photoSizeH.'-'.$photoSizeW);
//$img_oryginal->crop1(0, 0, $photoSizeH, $photoSizeW);
//$img_oryginal->scaleProp($normalW, $normalH, 0, 'ffffff', false, 'c', 0);
//$img_oryginal->
//$img_oryginal->saveToFile(PATH_STATIC_CONTENT.$destDir.$destName, 'jpg', 90, true);
//move_uploaded_file($_FILES['uploadfile']['tmp_name'], PATH_STATIC_CONTENT.$destDir.$_FILES['uploadfile']['name']);
$miniW = 242;
$miniH = 340;
//Utils::ArrayDisplay(PATH_STATIC_CONTENT.$photo);
$photoSize = getimagesize(PATH_STATIC_CONTENT . $photo);
//$photoSize = getimagesize(PATH_STATIC_CONTENT.$destDir.$_FILES['uploadfile']['name']);
// if ($photoSize[0] < $photoSize[1]) {
// $cropH = true;
// } else {
// $cropH = false;
// }
$propW = $photoSize[0] / $miniW;
$propH = $photoSize[1] / $miniH;
// Utils::ArrayDisplay($propW.' - '.$propH);
if ($propW > $propH) {
$prop = $propH;
} else {
$prop = $propW;
}
if ($photoSize[1] < $miniH * $prop) {
$photoSizeH = $miniH;
} else {
$photoSizeH = $photoSize[1];
}
$photoSizeH = $miniW * $prop;
$photoSizeW = $miniH * $prop;
$y = ($photoSize[1] - $photoSizeH) / 2;
//Utils::ArrayDisplay($y . '=' .'('.$photoSize[1].' - '.$photoSizeH.') / 2');
if ($y < 0) {
$y = 0;
}
$y = 0;
// Utils::ArrayDisplay($y);
$img_oryginal->crop1(0, $y, $photoSizeH, $photoSizeW);
$img_oryginal->scaleProp(242, 340, 0, 'ffffff', false, 'c', 0);
//$img_oryginal->
$img_oryginal->saveToFile(PATH_STATIC_CONTENT . $destDir . $destNameth, 'jpg', 90, true);
//Utils::ArrayDisplay(PATH_STATIC_CONTENT.$destDir.$destNameth);
if (is_file(PATH_STATIC_CONTENT . $photo)) {
unlink(PATH_STATIC_CONTENT . $photo);
}
$file = URL_STATIC_CONTENT . $destDir . $destNameth;
//$fileName = $destName;
$array = array($destName => array('normal' => $destName, 'th' => $destNameth));
$arrayPhoto = array_merge($arrayPhoto, $array);
SessionProxy::SetValue('_ARRAY_PHOTO_', $arrayPhoto);
$this->smarty->assign('photo', PATH_STATIC_CONTENT . $destDir . $destName);
//Utils::ArrayDisplay($arrayPhoto);
$idImageGroup = ImageDAL::SaveImage(111, 'Banner', 5);
if (is_file(PATH_STATIC_CONTENT . "upload/Banner/111/" . $destName)) {
unlink(PATH_STATIC_CONTENT . "upload/Banner/111/" . $destName);
}
SessionProxy::ClearValue('_ARRAY_PHOTO_');
}
$arrayPhoto = ImageDAL::GetResult(array('id_image_group' => 5, 'size' => 1), null, 'position ASC');
//Utils::ArrayDisplay($arrayPhoto);
$this->smarty->assign('arrayPhoto', $arrayPhoto);
}
public function FormAction($param) {
$this->SetAjaxRender();
$this->addScript('jQuery/jquery-1.4.2.js', 'file', 'top', 1);
$this->addScript('imageUpload.js', 'file', 'top', 3);
$this->addScript('ajaxupload.3.5.js', 'file', 'top', 2);
}
public function DeleteImageAction($param) {
$this->SetAjaxRender();
if ($_POST['photo']) {
$obj = ImageDAL::GetResult(array('id_mf_image' => $_POST['photo']));
if (isset($obj[0])) {
ImageDAL::Delete($obj[0]);
}
}
$this->smarty->assign('photo', 'image_' . $_POST['photo']);
}
public function DeleteImageBannerAction($param) {
//$this->SetAjaxRender();
if ($param['photo']) {
$obj = ImageDAL::GetResult(array('id_mf_image' => $param['photo']));
if (isset($obj[0])) {
ImageDAL::Delete($obj[0]);
}
}
$this->AddRedirect(Router::GenerateUrl('ReloadImage', array('Image' => 'UploadImage')), 0);
//$this->smarty->assign('photo', 'image_'.$_POST['photo']);
}
public function SortImageAction($param) {
$this->SetNoRender();
//Utils::ArrayDisplay($_POST);
if ($_POST['sort']) {
$arraySort = $_POST['sort'];
foreach ($arraySort as $id => $sort) {
//$obj = ImageDAL::GetResult(array('id_mf_image' => $id));
ImageDAL::UpdateSort($id, $sort);
}
}
$this->AddRedirect(Router::GenerateUrl('ReloadImage', array('Image' => 'UploadImage')), 0);
}
public static function ImportProductAction() {
}
/**
* preDispatch
* @param array $param
* @return null
*/
public function preDispatch($param) {
//$this->AddScript("jQuery/jquery-1.4.2.js");
//$this->AddScript("ajaxupload.3.5.js");
//$this->AddScript("UploadImage.js");
$this->RunShared('Auth', array());
$this->Run($param);
$this->smarty->assign('titleAdmin', 'Slideshow');
$this->smarty->assign('structure', '');
}
/**
* postDispatch
* @param array $param
* @return null
*/
public function postDispatch($param) {
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* $Id: IndexController.php 423 2008-05-30 14:42:41Z dakl $
* Strona glowna
*
*/
class IndexController extends MainController implements ControllerInterface {
/**
* strona glowna
*
*/
public function IndexAction($param) {
$kat = '../temp/compile';
$katalog = opendir($kat);
while ($plik = readdir($katalog)) {
if ($plik != '.' AND $plik != '..') {
unlink($kat . '/' . $plik);
}
}
//$this->AddRedirect(URL_MAIN . '/Structure/', 0);
$this->AddRedirect(URL_MAIN . '/Calc/Reg', 0);
}
public function ParserXmlAction($param) {
//ini_set($varname, $newvalue)
$xml = simplexml_load_file(PATH_STATIC_CONTENT . "/wanda.xml");
//$arrayXml = XML2Array::createArray($xml->channel);
$k = 0;
foreach ($xml->channel->item as $key => $entry) {
//Utils::ArrayDisplay($entry);
$htmlString[$k]['content'] = (string) $entry->children('content', true)->encoded;
$htmlString[$k]['title'] = (string) $entry->title;
$date = $entry->pubDate;
$htmlString[$k]['pubDate'] = (string) $entry->children('wp', true)->post_date;
$htmlString[$k]['autor'] = (string) $entry->children('dc', true)->creator;
$content = (string) $entry->children('content', true)->encoded;
$arrayContent = explode("<!--more-->", $content);
Utils::ArrayDisplay($arrayContent);
$htmlString[$k]['shortnote'] = nl2br($arrayContent[0]);
if (isset($arrayContent[1])) {
$htmlString[$k]['content'] = nl2br($arrayContent[1]);
} else {
$htmlString[$k]['content'] = "";
}
//Utils::ArrayDisplay((string)$entry->children('wp', true)->post_date);
$objArticle = SimpleArticle_MfArticleDAL::GetEmptyObj();
$objArticleDescription = $objArticle->GetDescriptionObj();
$objArticle->SetDate(date('Y-m-d'));
$objArticle->SetDatePublication((string) $entry->children('wp', true)->post_date);
$objArticle->SetDateShown(Utils::GetNowDate());
$objArticle->SetWeight(0);
$objArticle->SetPublication(1);
$objArticle->SetType(2);
$objArticle->SetDateUpdate(Utils::GetNowDate());
$objArticle->SetAddDate(Utils::GetNowDate());
$objArticle->SetEditDate(Utils::GetNowDate());
$objArticle->SetIdStructure(1);
$objArticle->SetIdCategory(0);
$objArticleDescription->SetLang('pl');
$objArticleDescription->SetDescription($htmlString[$k]['content']);
$objArticleDescription->SetShortnote($htmlString[$k]['shortnote']);
$objArticleDescription->SetTitle((string) $entry->title);
$objArticleDescription->SetBrowserTitle((string) $entry->title);
$objArticleDescription->SetPublication(1);
$objArticleDescription->SetAutor($htmlString[$k]['autor']);
// $iid = SimpleArticle_MfArticleDAL::Save($objArticle);
// $objArticleDescription->SetIdMfArticle($iid);
//
//
// $objLink = new MfLink('-1');
// $objLink->SetSourceType('mf_article');
// $objLink->SetIdSource($iid);
// $objLink->SetDestinationType('mf_article_category');
// $objLink->SetIdDestination(2);
// $objLink->SetLinkType(1);
// MfLinkDAL::Save($objLink);
//
// SimpleArticle_MfArticleDescriptionDAL::Save($objArticleDescription);
//
//
//echo $entry;
$k++;
}
Utils::ArrayDisplay($htmlString);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->smarty->assign('titleAdmin', 'Panel Administracyjny');
// $this->RunShared('Auth');
// $this->RunShared('Auth', array());
// $this->smarty->assign("menuSelected", "");
// $this->smarty->assign('activeTab', 'index');
// $this->AddScript("formAction.js");
// $this->Run($param);
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,66 @@
<?php
/**
* $Id: LoginController.php 969 2008-07-29 13:55:14Z pawy $
* Kontroler autoryzacji
*
*/
class LoginController extends MainController implements ControllerInterface {
/**
* domyslna metoda
*
*/
public function IndexAction($param) {
}
/**
* Autoryzacja
*
*/
public function AuthAction($param) {
if(isset($_REQUEST['eLogin']) && isset($_REQUEST['ePassword'])){
$result = AuthDAL::Login($_REQUEST['eLogin'], $_REQUEST['ePassword']);
//Utils::ArrayDisplay($_REQUEST);
Utils::ArrayDisplay($result);
if($result == true){
//$logger = LoggerManager::getLogger(__CLASS__);
//$logger->info('Zalogowal sie uzytkownik: '.$_REQUEST['eLogin'].', z ip: '.getenv('REMOTE_ADDR').', z domeny: '.getenv('REMOTE_HOST'));
Header("Location: ". Router::GenerateUrl('indexURL', array('Index' => 'Index')) );
} else {
$this->smarty->assign("loginError", "1");
}
}
}
/**
* Wylogowanie
*
*/
public function LogoutAction($param) {
SessionProxy::ClearSession();
AuthDAL::Logout();
die(Header("Location: login".APPLICATION_FILE_TYPE));
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->smarty->assign('projectName', PROJECT_NAME);
//session_start();
$template = 'login.tpl';
Registry::Remove('smartyTemplate');
Registry::Set('smartyTemplate', $template);
$this->smarty->assign("loginError", "");
}
public function postDispatch($param)
{
}
}
?>

View File

@@ -0,0 +1,236 @@
<?php
/**
* $Id$
* przypominarka
*
*/
class MailingController extends ModuleController implements ControllerInterface {
const REDIRECT_URL = "mailing.frmx";
/**
* Domyslna metoda
*
*/
public function IndexAction($param) {
//Utils::ArrayDisplay($param);
//$arrayAddress = MailingDAL::GetMailingAddressList(1);
//PEJDZOWANIE
$countLimit = 10;
if(isset($param['strona']) && $param['strona'] > 0 ){
$offset = ($param['strona']-1) * $countLimit;
$this->smarty->assign('currentPage', ($param['strona']-1)* $countLimit);
}
else{
$offset = 0;
$this->smarty->assign('currentPage', 0);
}
$this->smarty->assign('PageCount', ceil(MailingDAL::GetCountAll()/$countLimit));
$this->RunShared('Pagination', $param);
//AKCJE DOMY<4D>LNE
$arrayObjMailing = MailingDAL::GetAll($offset, $countLimit);
//Utils::ArrayDisplay($_SERVER['DOCUMENT_ROOT']);
$this->smarty->assign('arrayObjMailing', $arrayObjMailing);
}
/**
* Wysy<73>ka metoda
*
*/
public function SendAction($param) {
if (isset($_POST['sendEmail'])) {
//Utils::ArrayDisplay($_POST);
$objMailing = new Mailing('', $_POST['subjet'], $_POST['content'], 0, '', 2, 0);
MailingDAL::Save($objMailing);
$this->smarty->assign('sendInfo', "Email zosta<74> przekazany do wysy<73>i");
Utils::Redirect(URL_MAIN.'/index,'.self::REDIRECT_URL);
}
include("plugins/fckeditor/fckeditor_php5.php");
$oFCKeditor = new FCKeditor('content');
$oFCKeditor->BasePath = 'plugins/fckeditor/';
$oFCKeditor->Value = '';
$oFCKeditor->ToolbarSet = 'Formix';
$oFCKeditor->Height = 400;
$this->smarty->assign('fck', $oFCKeditor);
}
/**
* Podgl<67>d
*
*/
public function ShowAction($param) {
//$arrayAddress = MailingDAL::GetMailingAddressList();
//Utils::ArrayDisplay($arrayAddress);
//Utils::ArrayDisplay($param);
if (isset($param['id'])) {
$objMailing = MailingDAL::GetMailingById($param['id']);
$this->smarty->assign('objMailing', $objMailing);
}
// if (!isset($objMailing)) {
// die(Header('Location: mailing'.APPLICATION_FILE_TYPE));
// }
}
public function GetSendAction() {
$logger = LoggerManager::getLogger(__CLASS__);
$objMailing = MailingDAL::GetMailingToSend();
//while (($objMailing = MailingDAL::GetMailingToSend())) {
// }
if (is_object($objMailing)) {
$logger = LoggerManager::getLogger(__CLASS__);
$limit = $objMailing->GetLastSend() + 50;
$mailList = array();
$logger->info("limit: $limit ".$objMailing->GetLastSend());
$mailList = MailingDAL::GetMailingAddressList(2, $objMailing->GetLastSend(), 50);
MailingDAL::UpdateLastSend($objMailing->GetId(), $limit);
//Utils::ArrayDisplay($mailList);
// pobiera z tabeli user (jezeli taka istnije w tym przypadku nie potrzebna)
// if (!is_array($mailList) || count($mailList) < 50 && $objMailing->GetType() == 1) {
// MailingDAL::UpdateLastSend($objMailing->GetId(), 0);
// MailingDAL::UpdateType($objMailing->GetId());
//
// }
if (!is_array($mailList) || count($mailList) < 50 && $objMailing->GetType() == 2) {
MailingDAL::UpdateLastSend($objMailing->GetId(), 0);
MailingDAL::SetExecuted($objMailing->GetId());
}
//$this->smarty->assign('content', $objMailing->GetText());
//$txtmessage = $this->smarty->fetch('MailTxt.tpl');
//Utils::ArrayDisplay($mailList);
foreach ($mailList as $key => $arrayPackage) {
foreach ($arrayPackage as $keyPackege => $value) {
$subjet = " DB Druk - ".$objMailing->GetTitle();
$mail = new PHPMailer();
$mail -> CharSet = "utf-8";
$mail -> Subject = $subjet;
$mail -> SMTPAuth = true;
$mail -> Mailer = 'smtp';
$mail -> Host = "dbdruk.formix.eu";
$mail -> Port = 25;
$mail -> Priority = 3;
$mail ->IsHTML(true);
//$mail -> ConfirmReadingTo = "wino@wino.formix.eu";
$mail ->From = "smtp@dbdruk.formix.eu";
$mail -> FromName = "DB Druk";
$mail -> Username = "smtp@dbdruk.formix.eu";
$mail -> Password = "smtp1234";
//$mail->AddAddress('maciek@formix.pl', 'Maciej Kloch');
$mail->AddAddress($value['email'], $value['name']);
$mail -> AddBCC("maciek@formix.pl", "Mailing - dbdruk.pl ".$value['email']."- ".$value['name']." ".$key."-".$keyPackege);
$mail -> Body = $objMailing->GetText();
$mail -> Send();
}
//sleep(2);
}
//sleep(25);
}
Utils::Redirect(URL_MAIN.'/index,'.self::REDIRECT_URL);
}
public function ListAction($param) {
//PEJDZOWANIE
$countLimit = 10;
if(isset($param['strona']) && $param['strona'] > 0 ){
$offset = ($param['strona']-1) * $countLimit;
$this->smarty->assign('currentPage', ($param['strona']-1)* $countLimit);
}
else{
$offset = 0;
$this->smarty->assign('currentPage', 0);
}
$this->smarty->assign('PageCount', ceil(MailingDAL::GetCountAllEmail()/$countLimit));
$this->RunShared('Pagination', $param);
//AKCJE DOMY<4D>LNE
$arrayEmail = MailingDAL::GetAllEmail($offset, $countLimit);
//Utils::ArrayDisplay($arrayEmail);
$this->smarty->assign('arrayEmail', $arrayEmail);
}
/**
* usuwanie emial z list mailingowej
*
*/
public function DeleteAction($param) {
$logger = LoggerManager::getLogger(__CLASS__);
//$idCustomer = SessionProxy::GetValue(EnumSessionValue::IDCUSTOMER);
if(isset($param['id'])) {
$id=$param['id'];
} else{
$id = null;
}
if($id) {
MailingDAL::Delete($id);
die(Header('Location: list,mailing'.APPLICATION_FILE_TYPE));
if (Pat) {
}
}
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
//Utils::ArrayDisplay($param);
$this->Run($param);
$this->RunShared('Mailing');
$this->smarty->assign('titleAdmin', 'Mailing');
//$this->smarty->assign('showIcon', false);
if($this->IsUser()==false) {
$this->AddRedirect(URL_MAIN.'/Login.frmx', 0);
}
}
public function postDispatch($param) {
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,540 @@
<?php
/**
* Produkty
*
*
*/
class ProductAttributeController extends MainController implements ControllerInterface {
const AVATAR_DEST_DIR = '/upload/Product';
const AVATAR_TEMP_DIR = '/upload/temp';
const NO_PHOTO_IMG_BIG = "image/Admin/cropperNoPhotoBig.gif";
const NO_PHOTO_IMG_SMALL = "image/Admin/przekatne.gif";
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const PHOTO_WIDTH = 800;
const PHOTO_HEIGHT = 600;
const IMAGE_MINI_WIDTH = 240;
const IMAGE_MINI_HEIGHT = 180;
const IMAGE_NORMAL_WIDTH = 800;
const IMAGE_NORMAL_HEIGHT = 600;
public function IndexAction($param) {
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$dalData->setCondition(array('lang' => $param['lang']));
$arrayObjProductAttribute = MfProductAttributeDAL::GetResult($dalData);
// $param['runSharedVariable'] = 'linkedAttribute';
// $this->RunModuleController( 'ProductAttributeController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductAttributeController', 'UnlinkedAttribute', $param, true);
$this->smarty->assign('arrayObjProductAttribute', $arrayObjProductAttribute);
//Utils::ArrayDisplay($arrayObjProductAttribute);
}
// public function UpdateLangAttrAction($param) {
//
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
// $dalData->setCondition(array('lang' => 'pl'));
// $arrayObjProductAttribute = MfProductAttributeDAL::GetResult($dalData);
//
// //Utils::ArrayDisplay($arrayObjProductAttribute);
//
// foreach ($arrayObjProductAttribute as $objProductAttribute) {
// //Utils::ArrayDisplay($objProductAttribute->GetDescriptionObj());
// $objDesc = $objProductAttribute->GetDescriptionObj();
// foreach (Router::$arrayLang as $lang) {
// if ($lang != 'pl') {
//
// $objDesc->setLang($lang);
// $objDesc->setId('-1');
// Utils::ArrayDisplay($objDesc);
// MfProductAttributeDescriptionDAL::Save($objDesc);
//
// }
// }
// }
//
// }
//
// public function UpdateLangCatAction($param) {
//
// $dalData = MfProductCategoryDAL::GetDalDataObj();
// $dalData->setJoin(array('MfProductCategoryDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
// $dalData->setCondition(array('lang' => 'pl'));
// $arrayObjProductCategory = MfProductCategoryDAL::GetResult($dalData);
//
// //Utils::ArrayDisplay($arrayObjProductAttribute);
//
// foreach ($arrayObjProductCategory as $objProductCategory) {
// //Utils::ArrayDisplay($objProductAttribute->GetDescriptionObj());
// $objDesc = $objProductCategory->GetDescriptionObj();
// foreach (Router::$arrayLang as $lang) {
// if ($lang != 'pl') {
//
// $objDesc->setLang($lang);
// $objDesc->setId('-1');
// Utils::ArrayDisplay($objDesc);
// MfProductCategoryDescriptionDAL::Save($objDesc);
//
// }
// }
// }
//
// }
public function LinkedAttributeAction($param) {
//Utils::ArrayDisplay($param);
if (isset($param['idAttribute'])) {
$idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_attribute', 'mf_product_attribute', $param['idAttribute'], $param['lang']);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
} else {
$this->smarty->assign('arrayObjAttribute', array());
$this->smarty->assign('clikAttribute', true);
}
}
public function UnlinkedAttributeAction($param) {
//Utils::ArrayDisplay($param);
if (isset($param['idAttribute'])) {
$idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_attribute', 'mf_product_attribute', $param['idAttribute'], $param['lang']);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
} else {
$this->smarty->assign('arrayObjAttribute', array());
$this->smarty->assign('clikAttribute', true);
}
}
public function IndexStructureAction($param) {
$idAttribute = SessionProxy::GetValue('idAttribute');
$this->smarty->assign('idAttribute', $idAttribute);
$idsProduct = MfProductLinkDAL::GetIdStringDestinaion('mf_product_attribute', 'mf_product',$idAttribute, $param['lang']);
$dalData = MfProductDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductDescription' => ' LEFT JOIN mf_product_description ON mf_product.id_mf_product=mf_product_description.id_mf_product '));
$dalData->setCondition(array('lang' => $param['lang']));
//Utils::ArrayDisplay('ss'.$idsProduct);
$dalData->addCondition(' ', 'mf_product.id_mf_product IN (' .$idsProduct. ') ', ' ');
$arrayObj = MfProductDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
if (isset($param['methodToRun']) && $param['methodToRun'] == 'Add') {
$this->smarty->assign('add', true);
}
}
public function AddAction($param) {
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_attribute', $idAttribute, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttribue);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', array());
$objAttributeProduct = MfProductAttributeDAL::GetEmptyObj();
if (Request::GetPost('doAttributeAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name_pl', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsEmpty('name_en', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsEmpty('name_ru', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objAttributeProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objAttributeProduct->setDate("0000-00-00");
$objAttributeProduct->setPublication($publication);
$objAttributeProductDesc = new MfProductAttributeDescription();
$objAttributeProductDescEn = new MfProductAttributeDescription();
$objAttributeProductDescRu = new MfProductAttributeDescription();
$objAttributeProductDesc->setLang('pl');
$objAttributeProductDesc->setDescription($data['name_pl']);
$objAttributeProductDescEn->setLang('en');
$objAttributeProductDescEn->setDescription($data['name_en']);
$objAttributeProductDescRu->setLang('ru');
$objAttributeProductDescRu->setDescription($data['name_ru']);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
//Utils::ArrayDisplay($objAttributeProductDesc);
//Utils::ArrayDisplay($objAttributeProductDescEn);
//Utils::ArrayDisplay($objAttributeProductDescRu);
$idAttributeProduct = MfProductAttributeDAL::Save($objAttributeProduct);
$objAttributeProductDesc->setIdMfProductAttribute($idAttributeProduct);
$objAttributeProductDescEn->setIdMfProductAttribute($idAttributeProduct);
$objAttributeProductDescRu->setIdMfProductAttribute($idAttributeProduct);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDesc);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDescEn);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDescRu);
// foreach ($data['attr'] as $attrKey => $attrId ) {
// $objMfProductLink = new MfProductLink();
// $objMfProductLink->setDestinationType('mf_product_attribute');
// $objMfProductLink->setSourceType('mf_product_attribute');
// $objMfProductLink->setIdDestination($attrId);
// $objMfProductLink->setIdSource($idAttributeProduct);
// $objMfProductLink->setLang($param['lang']);
// $objMfProductLink->setPublication(1);
// MfProductLinkDAL::Save($objMfProductLink);
// }
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editAttribute', array('ProductAttribute' => 'index')));
} else {
// if (isset($data['attr'])) {
// $idAttrLinked = implode(', ',$data['attr']);
// } else {
// $idAttrLinked = '-1';
// }
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
// //$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_attribute', $idAttribute, 'mf_product_attribute');
// //Utils::ArrayDisplay($arrayObjAttributeLinked);
//
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//
// $this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
// $this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objAttributeProduct->SetDescriptionObj($objAttributeProductDesc);
$this->smarty->assign('objAttributeProductDesc',$objAttributeProductDesc);
$this->smarty->assign('objAttributeProductDescRu',$objAttributeProductDescRu);
$this->smarty->assign('objAttributeProductDescEn',$objAttributeProductDescEn);
$this->smarty->assign('objAttributeProduct',$objAttributeProduct);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
// $idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_attribute', 'mf_product_attribute', $param['id'], $param['lang']);
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idsAttribute.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
// //$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_attribute', $idAttribute, 'mf_product_attribute');
// //Utils::ArrayDisplay($arrayObjAttribue);
// $this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
// $this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objAttributeProduct = MfProductAttributeDAL::GetById($param['id'], 'pl');
$objAttributeProductRu = MfProductAttributeDAL::GetById($param['id'], 'ru');
$objAttributeProductEn = MfProductAttributeDAL::GetById($param['id'], 'en');
//$objAttributeProduct->setLang('pl');
$this->smarty->assign('objAttributeProduct', $objAttributeProduct);
$this->smarty->assign('objAttributeProductDesc',$objAttributeProduct->getDescriptionObj());
//$objAttributeProduct->setLang('en');
$this->smarty->assign('objAttributeProductDescRu',$objAttributeProductRu->getDescriptionObj());
//$objAttributeProduct->setLang('ru');
$this->smarty->assign('objAttributeProductDescEn',$objAttributeProductEn->getDescriptionObj());
if (Request::GetPost('doAttributeEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name_pl', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsEmpty('name_en', 'Pole nazwa musi zostać wypełnione.');
//$validator->IsEmpty('name_ru', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objAttributeProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objAttributeProduct->setDate("0000-00-00");
$objAttributeProduct->setPublication($publication);
$objAttributeProductDesc = $objAttributeProduct->getDescriptionObj();
$objAttributeProductDescEn = $objAttributeProductEn->getDescriptionObj();
$objAttributeProductDescRu = $objAttributeProductRu->getDescriptionObj();
//$objAttributeProductDesc->setDatePublication("0000-00-00 00:00:00");
$objAttributeProductDesc->setLang('pl');
$objAttributeProductDesc->setDescription($data['name_pl']);
$objAttributeProductDescEn->setLang('en');
$objAttributeProductDescEn->setDescription($data['name_en']);
$objAttributeProductDescRu->setLang('ru');
$objAttributeProductDescRu->setDescription($data['name_ru']);
$objAttributeProduct->setLang('pl');
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
//Utils::ArrayDisplay($objAttributeProductDesc);
//Utils::ArrayDisplay($objAttributeProductDescEn);
//Utils::ArrayDisplay($objAttributeProductDescRu);
$idAttributeProduct = MfProductAttributeDAL::Save($objAttributeProduct);
$objAttributeProductDesc->setIdMfProductAttribute($idAttributeProduct);
$objAttributeProductDescEn->setIdMfProductAttribute($idAttributeProduct);
$objAttributeProductDescRu->setIdMfProductAttribute($idAttributeProduct);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDesc);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDescEn);
MfProductAttributeDescriptionDAL::Save($objAttributeProductDescRu);
// MfProductLinkDAL::DeleteFromLink($idAttributeProduct, 'mf_product_attribute', null, 'mf_product_attribute');
//
// foreach ($data['attr'] as $attrKey => $attrId ) {
// $objMfProductLink = new MfProductLink();
// $objMfProductLink->setDestinationType('mf_product_attribute');
// $objMfProductLink->setSourceType('mf_product_attribute');
// $objMfProductLink->setIdDestination($attrId);
// $objMfProductLink->setIdSource($idAttributeProduct);
// $objMfProductLink->setLang($param['lang']);
// $objMfProductLink->setPublication(1);
// //Utils::ArrayDisplay($objMfProductLink);
// MfProductLinkDAL::Save($objMfProductLink);
// }
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editAttribute', array('ProductAttribute' => 'index')));
} else {
// if (isset($data['attr'])) {
// $idAttrLinked = implode(', ',$data['attr']);
// } else {
// $idAttrLinked = '-1';
// }
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
// //$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_attribute', $idAttribute, 'mf_product_attribute');
// //Utils::ArrayDisplay($arrayObjAttributeLinked);
//
// $dalData = MfProductAttributeDAL::GetDalDataObj();
// $dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
// $dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//
// //Utils::ArrayDisplay($dalData);
// $arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//
// $this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
// $this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
//
$objAttributeProduct->SetDescriptionObj($objAttributeProductDesc);
$this->smarty->assign('objAttributeProduct',$objAttributeProduct);
$this->smarty->assign('objAttributeProductDesc',$objAttributeProductDesc);
$this->smarty->assign('objAttributeProductDescRu',$objAttributeProductDescRu);
$this->smarty->assign('objAttributeProductDescEn',$objAttributeProductDescEn);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function AjaxAddLinkAttrAction($param) {
//$array
}
public function DeleteAction($param) {
$isLinked = MfProductLinkDAL::IsLinked(null, 'mf_product_category', $param['id'], 'mf_product_attribute');
$delete = true;
$error = '';
if ($isLinked > 0 ) {
$delete = false;
}
$arrayLang = (Router::$arrayLang);
unset($arrayLang[$param['lang']]);
$langString = implode(',', $arrayLang);
$isLang = MfProductAttributeDAL::CheakDescLang($param['id'], $param['lang']);
// if ($isLang) {
// $delete = false;
// }
if ($delete) {
foreach (Router::$arrayLang as $lang) {
$objAttribute = MfProductAttributeDAL::GetById($param['id'], $lang);
$objAttributeDesc = $objAttribute->getDescriptionObj();
$dalDataDesc = MfProductAttributeDescriptionDAL::GetDalDataObj();
$dalDataDesc->setObj($objAttributeDesc);
MfProductAttributeDescriptionDAL::Delete($dalDataDesc);
}
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setObj($objAttribute);
MfProductAttributeDAL::Delete($dalData);
$this->AddRedirectInfo('Element został usunięty', 'ok', Router::GenerateUrl('editAttribute', array('ProductAttribute' => 'Index')));
} else {
if ($isLinked) {
$error .= 'Parametr jest powiązany z kategorią.';
}
// if ($isLang) {
// $error .= $error ? '<br/><br/>' : '';
// $error .= 'Parametr posiada wersję jezykową';
// }
$this->AddRedirectInfo($error, 'error', Router::GenerateUrl('editAttribute', array('ProductAttribute' => 'Index')));
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$this->AddScript('structure.js');
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
//'Kategorie produktów' => array('ProductCategory' => 'Index'),
'Parametry produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function PostDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,572 @@
<?php
/**
* Produkty
*
*
*/
class ProductCategoryController extends MainController implements ControllerInterface {
const AVATAR_DEST_DIR = '/upload/Product';
const AVATAR_TEMP_DIR = '/upload/temp';
const NO_PHOTO_IMG_BIG = "image/Admin/cropperNoPhotoBig.gif";
const NO_PHOTO_IMG_SMALL = "image/Admin/przekatne.gif";
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const PHOTO_WIDTH = 800;
const PHOTO_HEIGHT = 600;
const IMAGE_MINI_WIDTH = 240;
const IMAGE_MINI_HEIGHT = 180;
const IMAGE_NORMAL_WIDTH = 800;
const IMAGE_NORMAL_HEIGHT = 600;
public function IndexAction($param) {
//Utils::ArrayDisplay($param);
$dalData = MfProductCategoryDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductCategoryDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
$dalData->setCondition(array('lang' => $param['lang']));
$arrayObjProductCategory = MfProductCategoryDAL::GetResult($dalData);
$param['runSharedVariable'] = 'linkedAttribute';
$this->RunModuleController( 'ProductCategoryController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductCategoryController', 'UnlinkedAttribute', $param, true);
foreach ($arrayObjProductCategory as $item) {
$menu[$item->GetId()] = $item;
}
foreach ($menu as $key => $obj) {
if ($obj->GetIdParent() != 0) {
if (key_exists($obj->GetIdParent(), $menu)) {
$menu[$obj->GetIdParent()]->SetHaveChildren(true);
$menu[$obj->GetIdParent()]->AddChildren(array($obj->GetId() => $obj));
} else {
$arrayTree[$key] = $obj;
}
}
if ($obj->GetIdParent() == 0) {
//Utils::ArrayDisplay('ones');
$arrayTree[$key] = $obj;
}
}
foreach ($menu as $key => $obj) {
}
//Utils::ArrayDisplay($arrayTree);
$this->smarty->assign('menuProductCategory', $arrayTree);
$this->smarty->assign('arrayObjProductCategory', $arrayObjProductCategory);
//Utils::ArrayDisplay($arrayObjProductCategory);
}
public function LinkedAttributeAction($param) {
//Utils::ArrayDisplay($param);
if (isset($param['idCategory'])) {
$idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_category', 'mf_product_attribute', $param['idCategory'], 'pl');
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$dalData->setSortBy(' FIELD(mf_product_attribute.id_mf_product_attribute, '.$idsAttribute.')');
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('idCategory', $param['idCategory']);
} else {
$this->smarty->assign('arrayObjAttribute', array());
$this->smarty->assign('clikCategory', true);
}
}
public function SaveSortAction($param) {
$this->SetNoRender();
//Utils::ArrayDisplay($param);
if (Request::GetPost('doSaveSort')) {
$arrayAttrSort = Request::GetPost('attr');
$idCategory = Request::GetPost('idCategory');
//Utils::ArrayDisplay($arrayAttrSort);
//source_type id_source destination_type id_destination
//mf_product_category 2 mf_product_attribute 6 0
foreach ($_POST['attr'] as $idAttr => $sort) {
//Utils::ArrayDisplay($idAttr);
$dalData = MfProductLinkDAL::GetDalDataObj();
$dalData->setCondition(array('source_type' => 'mf_product_category', 'id_source' => $idCategory, 'destination_type'=> 'mf_product_attribute', 'id_destination' => $idAttr, 'lang' => 'pl'));
$arrayAttrLink = MfProductLinkDAL::GetResult($dalData);
//Utils::ArrayDisplay($arrayAttrLink);
foreach ($arrayAttrLink as $link) {
$link->setWeight($sort);
//Utils::ArrayDisplay($link);
MfProductLinkDAL::Save($link);
}
}
// Utils::ArrayDisplay($_POST);
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editCategory', array('ProductCategory' => 'index', 'idCategory' => $idCategory)));
}
public function UnlinkedAttributeAction($param) {
//Utils::ArrayDisplay($param);
if (isset($param['idCategory'])) {
$idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_category', 'mf_product_attribute', $param['idCategory'], $param['lang']);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => 'pl'));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
} else {
$this->smarty->assign('arrayObjAttribute', array());
$this->smarty->assign('clikCategory', true);
}
}
public function IndexStructureAction($param) {
$idCategory = SessionProxy::GetValue('idCategory');
$this->smarty->assign('idCategory', $idCategory);
$idsProduct = MfProductLinkDAL::GetIdStringDestinaion('mf_product_category', 'mf_product',$idCategory, $param['lang']);
$dalData = MfProductDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductDescription' => ' LEFT JOIN mf_product_description ON mf_product.id_mf_product=mf_product_description.id_mf_product '));
$dalData->setCondition(array('lang' => $param['lang']));
//Utils::ArrayDisplay('ss'.$idsProduct);
$dalData->addCondition(' ', 'mf_product.id_mf_product IN (' .$idsProduct. ') ', ' ');
$arrayObj = MfProductDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObj);
if (isset($param['methodToRun']) && $param['methodToRun'] == 'Add') {
$this->smarty->assign('add', true);
}
}
public function AddAction($param) {
// Pobiernie rodziców kategorii
$dalData = MfProductCategoryDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductCategoryDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
$dalData->setCondition(array('lang' => $param['lang'], 'mf_product_category.id_parent' => 0));
$arrayObjProductCategory = MfProductCategoryDAL::GetResult($dalData);
//$param['runSharedVariable'] = 'linkedAttribute';
//$this->RunModuleController( 'ProductCategoryController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductCategoryController', 'UnlinkedAttribute', $param, true);
//Utils::ArrayDisplay($arrayObjProductCategory);
$this->smarty->assign('arrayObjProductCategory', $arrayObjProductCategory);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttribue);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', array());
$objCategoryProduct = MfProductCategoryDAL::GetEmptyObj();
if (Request::GetPost('doCategoryAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objCategoryProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objCategoryProduct->setPublication($publication);
$objCategoryProduct->setIdParent($data['idParent']);
$objCategoryProduct->setWeight($data['weight']);
$objCategoryProductDesc = new MfProductCategoryDescription();
$objCategoryProductDesc->setDatePublication("0000-00-00 00:00:00");
$objCategoryProductDesc->setLang('pl');
$objCategoryProductDesc->setName($data['name']);
$objCategoryProductDesc->setPublication($publication);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
$idCategoryProduct = MfProductCategoryDAL::Save($objCategoryProduct);
$objCategoryProductDesc->setIdMfProductCategory($idCategoryProduct);
$objCategoryProductDescEn = $objCategoryProductDesc;
//$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescRu = $objCategoryProductDesc;
//$objCategoryProductDescRu->setLang('ru');
MfProductCategoryDescriptionDAL::Save($objCategoryProductDesc);
///Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescEn->setId(-1);
MfProductCategoryDescriptionDAL::Save($objCategoryProductDescEn);
//Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescRu->setLang('ru');
$objCategoryProductDescRu->setId(-1);
MfProductCategoryDescriptionDAL::Save($objCategoryProductDescRu);
//Utils::ArrayDisplay($objCategoryProductDesc);
if (isset($data['attr'])) {
foreach ($data['attr'] as $attrKey => $attrId ) {
$objMfProductLink = new MfProductLink();
$objMfProductLink->setDestinationType('mf_product_attribute');
$objMfProductLink->setSourceType('mf_product_category');
$objMfProductLink->setIdDestination($attrId);
$objMfProductLink->setIdSource($idCategoryProduct);
$objMfProductLink->setLang('pl');
$objMfProductLink->setPublication(1);
MfProductLinkDAL::Save($objMfProductLink);
}
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editCategory', array('ProductCategory' => 'index')));
} else {
if (isset($data['attr'])) {
$idAttrLinked = implode(', ',$data['attr']);
} else {
$idAttrLinked = '-1';
}
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttributeLinked);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objCategoryProduct->SetDescriptionObj($objCategoryProductDesc);
$this->smarty->assign('objCategoryProduct',$objCategoryProduct);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
// Pobiernie rodziców kategorii
$dalData = MfProductCategoryDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductCategoryDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
$dalData->setCondition(array('lang' => $param['lang'], 'mf_product_category.id_parent' => 0, ' ' => array('value' => ' mf_product_category.id_mf_product_category NOT IN('.$param['id'].')' ,'condition' => '')));
$arrayObjProductCategory = MfProductCategoryDAL::GetResult($dalData);
//$param['runSharedVariable'] = 'linkedAttribute';
//$this->RunModuleController( 'ProductCategoryController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductCategoryController', 'UnlinkedAttribute', $param, true);
//Utils::ArrayDisplay($arrayObjProductCategory);
$this->smarty->assign('arrayObjProductCategory', $arrayObjProductCategory);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$idsAttribute = MfProductLinkDAL::GetIdStringDestinaion('mf_product_category', 'mf_product_attribute', $param['id'], 'pl');
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idsAttribute.') ', ' ');
$dalData->setSortBy(' FIELD(mf_product_attribute.id_mf_product_attribute, '.$idsAttribute.')');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
$dalData->setSortBy(' FIELD(mf_product_attribute.id_mf_product_attribute, '.$idsAttribute.')');
//Utils::ArrayDisplay($dalData);
$arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttribue);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objCategoryProduct = MfProductCategoryDAL::GetById($param['id'], $param['lang']);
$this->smarty->assign('objCategoryProduct', $objCategoryProduct);
if (Request::GetPost('doCategoryEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objCategoryProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objCategoryProduct->setDatePublication("0000-00-00 00:00:00");
$objCategoryProduct->setPublication($publication);
$objCategoryProduct->setIdParent($data['idParent']);
$objCategoryProduct->setWeight($data['weight']);
$objCategoryProductDesc = $objCategoryProduct->getDescriptionObj();
$objCategoryProductDesc->setDatePublication("0000-00-00 00:00:00");
$objCategoryProductDesc->setLang($param['lang']);
$objCategoryProductDesc->setName($data['name']);
$objCategoryProductDesc->setPublication($publication);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
//Utils::ArrayDisplay($data);
$idCategoryProduct = MfProductCategoryDAL::Save($objCategoryProduct);
$objCategoryProductDesc->setIdMfProductCategory($idCategoryProduct);
MfProductCategoryDescriptionDAL::Save($objCategoryProductDesc);
MfProductLinkDAL::DeleteFromLink($idCategoryProduct, 'mf_product_category', null, 'mf_product_attribute');
foreach ($data['attr'] as $attrKey => $attrId ) {
$objMfProductLink = new MfProductLink();
$objMfProductLink->setDestinationType('mf_product_attribute');
$objMfProductLink->setSourceType('mf_product_category');
$objMfProductLink->setIdDestination($attrId);
$objMfProductLink->setIdSource($idCategoryProduct);
$objMfProductLink->setLang('pl');
$objMfProductLink->setPublication(1);
$objMfProductLink->setWeight($data['linked_attr_weight'][$attrId]);
//Utils::ArrayDisplay($objMfProductLink);
MfProductLinkDAL::Save($objMfProductLink);
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editCategory', array('ProductCategory' => 'index')));
} else {
if (isset($data['attr'])) {
$idAttrLinked = implode(', ',$data['attr']);
} else {
$idAttrLinked = '-1';
}
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttributeLinked);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objCategoryProduct->SetDescriptionObj($objCategoryProductDesc);
$this->smarty->assign('objCategoryProduct',$objCategoryProduct);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function AjaxAddLinkAttrAction($param) {
//$array
}
public function DeleteAction($param) {
$isLinked = MfProductLinkDAL::IsLinked($param['id'], 'mf_product_category', null, 'mf_product');
$delete = true;
$error = '';
if ($isLinked > 0 ) {
$delete = false;
}
$arrayLang = (Router::$arrayLang);
unset($arrayLang[$param['lang']]);
$langString = implode(',', $arrayLang);
$isLang = MfProductCategoryDAL::CheakDescLang($param['id'], $param['lang']);
// if ($isLang) {
// $delete = false;
// }
if ($delete) {
foreach (Router::$arrayLang as $lang) {
$objCategory = MfProductCategoryDAL::GetById($param['id'], $lang);
$objCategoryDesc = $objCategory->getDescriptionObj();
$dalDataDesc = MfProductCategoryDescriptionDAL::GetDalDataObj();
$dalDataDesc->setObj($objCategoryDesc);
MfProductCategoryDescriptionDAL::Delete($dalDataDesc);
}
$dalData = MfProductCategoryDAL::GetDalDataObj();
$dalData->setObj($objCategory);
MfProductCategoryDAL::Delete($dalData);
$this->AddRedirectInfo('Element został usunięty', 'ok', Router::GenerateUrl('editCategory', array('ProductCategory' => 'Index')));
} else {
if ($isLinked) {
$error .= 'Kategoria jest powiązana z produktem.';
}
// if ($isLang) {
// $error .= $error ? '<br/><br/>' : '';
// $error .= 'Kategoria posiada wersję jezykową';
// }
$this->AddRedirectInfo($error, 'error', Router::GenerateUrl('editCategory', array('ProductCategory' => 'Index')));
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$this->AddScript('structure.js');
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
'Kategorie produktów' => array('ProductCategory' => 'Index'),
'Serie produktów' => array('ProductSeries' => 'Index'),
'Materiał produktów' => array('ProductSpec' => 'Index', 'type' => 2),
'Kolor produktów' => array('ProductSpec' => 'Index', 'type' => 1),
'Żarówki produktów' => array('ProductSpec' => 'Index', 'type' => 3),
//'Parametry produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function PostDispatch($param) {
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,308 @@
<?php
/**
* Produkty serie
*
*
*/
class ProductSeriesController extends MainController implements ControllerInterface {
public function IndexAction($param) {
//Utils::ArrayDisplay($param);
$dalData = ShopSeriesDAL::GetDalDataObj();
//$dalData->setCondition(array('lang' => $param['lang']));
$arryObjSeries = ShopSeriesDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arryObjSeries);
}
public function AddAction($param) {
// Pobiernie rodziców kategorii
$dalData = MfProductCategoryDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductCategoryDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
$dalData->setCondition(array('lang' => $param['lang'], 'mf_product_category.id_parent' => 0));
$arrayObjProductCategory = MfProductCategoryDAL::GetResult($dalData);
//$param['runSharedVariable'] = 'linkedAttribute';
//$this->RunModuleController( 'ProductCategoryController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductCategoryController', 'UnlinkedAttribute', $param, true);
//Utils::ArrayDisplay($arrayObjProductCategory);
$this->smarty->assign('arrayObjProductCategory', $arrayObjProductCategory);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttribue);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', array());
$objCategoryProduct = MfProductCategoryDAL::GetEmptyObj();
if (Request::GetPost('doCategoryAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objCategoryProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objCategoryProduct->setPublication($publication);
$objCategoryProduct->setIdParent($data['idParent']);
$objCategoryProduct->setWeight($data['weight']);
$objCategoryProductDesc = new MfProductCategoryDescription();
$objCategoryProductDesc->setDatePublication("0000-00-00 00:00:00");
$objCategoryProductDesc->setLang('pl');
$objCategoryProductDesc->setName($data['name']);
$objCategoryProductDesc->setPublication($publication);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
$idCategoryProduct = MfProductCategoryDAL::Save($objCategoryProduct);
$objCategoryProductDesc->setIdMfProductCategory($idCategoryProduct);
$objCategoryProductDescEn = $objCategoryProductDesc;
//$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescRu = $objCategoryProductDesc;
//$objCategoryProductDescRu->setLang('ru');
MfProductCategoryDescriptionDAL::Save($objCategoryProductDesc);
///Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescEn->setId(-1);
MfProductCategoryDescriptionDAL::Save($objCategoryProductDescEn);
//Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescRu->setLang('ru');
$objCategoryProductDescRu->setId(-1);
MfProductCategoryDescriptionDAL::Save($objCategoryProductDescRu);
//Utils::ArrayDisplay($objCategoryProductDesc);
if (isset($data['attr'])) {
foreach ($data['attr'] as $attrKey => $attrId ) {
$objMfProductLink = new MfProductLink();
$objMfProductLink->setDestinationType('mf_product_attribute');
$objMfProductLink->setSourceType('mf_product_category');
$objMfProductLink->setIdDestination($attrId);
$objMfProductLink->setIdSource($idCategoryProduct);
$objMfProductLink->setLang('pl');
$objMfProductLink->setPublication(1);
MfProductLinkDAL::Save($objMfProductLink);
}
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editCategory', array('ProductCategory' => 'index')));
} else {
if (isset($data['attr'])) {
$idAttrLinked = implode(', ',$data['attr']);
} else {
$idAttrLinked = '-1';
}
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttributeLinked);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objCategoryProduct->SetDescriptionObj($objCategoryProductDesc);
$this->smarty->assign('objCategoryProduct',$objCategoryProduct);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
$objSeries = ShopSeriesDAL::GetById($param['id'], $param['lang']);
$this->smarty->assign('obj', $objSeries);
if (Request::GetPost('doSeriesEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
$objSeries->setLang($param['lang']);
$objSeries->setName($data['name']);
$objSeries->setPublication($publication);
if(empty($out)) {
//Utils::ArrayDisplay($data);
$idseries = ShopSeriesDAL::Save($objSeries);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editSeries', array('ProductSeries' => 'index')));
} else {
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function AjaxAddLinkAttrAction($param) {
//$array
}
public function DeleteAction($param) {
$isLinked = MfProductLinkDAL::IsLinked($param['id'], 'mf_product_series', null, 'mf_product');
$delete = true;
$error = '';
if ($isLinked > 0 ) {
$delete = false;
}
if ($delete) {
$objSeries = ShopSeriesDAL::GetById($param['id']);
$dalData = ShopSeriesDAL::GetDalDataObj();
$dalData->setObj($objSeries);
ShopSeriesDAL::Delete($dalData);
$this->AddRedirectInfo('Element został usunięty', 'ok', Router::GenerateUrl('editSeries', array('ProductSeries' => 'Index')));
} else {
if ($isLinked) {
$error .= 'seria jest powiązana z produktem.';
}
$this->AddRedirectInfo($error, 'error', Router::GenerateUrl('editCategory', array('ProductSeries' => 'Index')));
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$this->AddScript('structure.js');
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
'Kategorie produktów' => array('ProductCategory' => 'Index'),
'Serie produktów' => array('ProductSeries' => 'Index'),
'Materiał produktów' => array('ProductSpec' => 'Index', 'type' => 2),
'Kolor produktów' => array('ProductSpec' => 'Index', 'type' => 1),
'Żarówki produktów' => array('ProductSpec' => 'Index', 'type' => 3),
//'Parametry produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function PostDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,340 @@
<?php
/**
* Produkty
*
*
*/
class ProductSpecController extends MainController implements ControllerInterface {
const AVATAR_DEST_DIR = '/upload/Product';
const AVATAR_TEMP_DIR = '/upload/temp';
const NO_PHOTO_IMG_BIG = "image/Admin/cropperNoPhotoBig.gif";
const NO_PHOTO_IMG_SMALL = "image/Admin/przekatne.gif";
const MAX_AVATAR_FILE_SIZE = 5; //Rozmiar w mb
const CROPPER_BIG_PHOTO_MAX_WIDTH = 800;
const CROPPER_BIG_PHOTO_MAX_HEIGHT = 800;
const PHOTO_WIDTH = 800;
const PHOTO_HEIGHT = 600;
const IMAGE_MINI_WIDTH = 240;
const IMAGE_MINI_HEIGHT = 180;
const IMAGE_NORMAL_WIDTH = 800;
const IMAGE_NORMAL_HEIGHT = 600;
public function IndexAction($param) {
//Utils::ArrayDisplay($param);
$dalData = MfProductSpecificationDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->setCondition(array('typ' => isset($param['type']) ? $param['type'] : 1));
$arrayObjProductSpec = MfProductSpecificationDAL::GetResult($dalData);
$this->smarty->assign('arrayObj', $arrayObjProductSpec);
//Utils::ArrayDisplay($arrayObjProductSpec);
}
public function AddAction($param) {
// Pobiernie rodziców kategorii
$dalData = MfProductSpecDAL::GetDalDataObj();
$dalData->setJoin(array('MfProductSpecDescription' => ' LEFT JOIN mf_product_category_description ON mf_product_category.id_mf_product_category=mf_product_category_description.id_mf_product_category '));
$dalData->setCondition(array('lang' => $param['lang'], 'mf_product_category.id_parent' => 0));
$arrayObjProductSpec = MfProductSpecDAL::GetResult($dalData);
//$param['runSharedVariable'] = 'linkedAttribute';
//$this->RunModuleController( 'ProductSpecController', 'LinkedAttribute', $param, true);
//
// $param['runSharedVariable'] = 'unlinkedAttribute';
// $this->RunModuleController( 'ProductSpecController', 'UnlinkedAttribute', $param, true);
//Utils::ArrayDisplay($arrayObjProductSpec);
$this->smarty->assign('arrayObjProductSpec', $arrayObjProductSpec);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
// $dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idsAttribute.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttribue);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', array());
$objCategoryProduct = MfProductSpecDAL::GetEmptyObj();
if (Request::GetPost('doCategoryAdd')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objCategoryProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objCategoryProduct->setPublication($publication);
$objCategoryProduct->setIdParent($data['idParent']);
$objCategoryProduct->setWeight($data['weight']);
$objCategoryProductDesc = new MfProductSpecDescription();
$objCategoryProductDesc->setDatePublication("0000-00-00 00:00:00");
$objCategoryProductDesc->setLang('pl');
$objCategoryProductDesc->setName($data['name']);
$objCategoryProductDesc->setPublication($publication);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
$idCategoryProduct = MfProductSpecDAL::Save($objCategoryProduct);
$objCategoryProductDesc->setIdMfProductSpec($idCategoryProduct);
$objCategoryProductDescEn = $objCategoryProductDesc;
//$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescRu = $objCategoryProductDesc;
//$objCategoryProductDescRu->setLang('ru');
MfProductSpecDescriptionDAL::Save($objCategoryProductDesc);
///Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescEn->setLang('en');
$objCategoryProductDescEn->setId(-1);
MfProductSpecDescriptionDAL::Save($objCategoryProductDescEn);
//Utils::ArrayDisplay($objCategoryProductDesc);
$objCategoryProductDescRu->setLang('ru');
$objCategoryProductDescRu->setId(-1);
MfProductSpecDescriptionDAL::Save($objCategoryProductDescRu);
//Utils::ArrayDisplay($objCategoryProductDesc);
if (isset($data['attr'])) {
foreach ($data['attr'] as $attrKey => $attrId ) {
$objMfProductLink = new MfProductLink();
$objMfProductLink->setDestinationType('mf_product_attribute');
$objMfProductLink->setSourceType('mf_product_category');
$objMfProductLink->setIdDestination($attrId);
$objMfProductLink->setIdSource($idCategoryProduct);
$objMfProductLink->setLang('pl');
$objMfProductLink->setPublication(1);
MfProductLinkDAL::Save($objMfProductLink);
}
}
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editCategory', array('ProductSpec' => 'index')));
} else {
if (isset($data['attr'])) {
$idAttrLinked = implode(', ',$data['attr']);
} else {
$idAttrLinked = '-1';
}
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttributeLinked = MfProductAttributeDAL::GetResult($dalData);
//$objProductAttribute = MfProductAttributeDAL::GetResultByLink('mf_product_category', $idCategory, 'mf_product_attribute');
//Utils::ArrayDisplay($arrayObjAttributeLinked);
$dalData = MfProductAttributeDAL::GetDalDataObj();
$dalData->setCondition(array('lang' => $param['lang']));
$dalData->addCondition(' ', 'mf_product_attribute.id_mf_product_attribute NOT IN ('.$idAttrLinked.') ', ' ');
$dalData->setJoin(array('MfProductAttributeDescription' => ' LEFT JOIN mf_product_attribute_description ON mf_product_attribute.id_mf_product_attribute=mf_product_attribute_description.id_mf_product_attribute '));
//Utils::ArrayDisplay($dalData);
$arrayObjAttribute = MfProductAttributeDAL::GetResult($dalData);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('arrayObjAttributeLinked', $arrayObjAttributeLinked);
$objCategoryProduct->SetDescriptionObj($objCategoryProductDesc);
$this->smarty->assign('objCategoryProduct',$objCategoryProduct);
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function EditAction($param) {
// Pobiernie rodziców kategorii
$dalData = MfProductSpecificationDAL::GetDalDataObj();
$objSpec = MfProductSpecificationDAL::GetById($param['id'], $param['lang']);
$this->smarty->assign('obj', $objSpec);
if (Request::GetPost('doSpecEdit')) {
//Utils::ArrayDisplay(Request::GetAllPost());
$out = array();
$validator = new Validator(Request::GetAllPost());
$data = Request::GetAllPost();
$validator->IsEmpty('name', 'Pole nazwa musi zostać wypełnione.');
$out = $validator->GetErrorList();
$publication = Request::Get('publication');
$publication ? $publication = 1 : $publication = '0';
//$objProduct = new MfProduct();
//$objCategoryProduct->setDate($data['datepublication']." ".$data['timepublication'].":00:00");
$objSpec->setPublication($publication);
//$objSpec->setWeight($data['weight']);
$objSpec->setLang($param['lang']);
$objSpec->setValue($data['name']);
//$arrayObjAttributeWithValue = array();
//Utils::ArrayDisplay($arrayObjAttribute);
if(empty($out)) {
//Utils::ArrayDisplay($data);
$idSpec = MfProductSpecificationDAL::Save($objSpec);
$this->AddRedirectInfo('Zapisano', 'ok', Router::GenerateUrl('editSpec', array('ProductSpec' => 'Index', 'type' => $objSpec->GetTyp())));
} else {
$this->smarty->assign('arrayObjAttribute', $arrayObjAttribute);
$this->smarty->assign('info','Pola obowiązkowe muszą zostać wypełnione.');
$this->smarty->assign('type','error');
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
}
public function AjaxAddLinkAttrAction($param) {
//$array
}
public function DeleteAction($param) {
$isLinked = MfProductLinkDAL::IsLinked($param['id'], 'mf_product_specyfication', null, 'mf_product');
$delete = true;
$error = '';
if ($isLinked > 0 ) {
$delete = false;
}
$objSpec = MfProductSpecificationDAL::GetById($param['id']);
if ($delete) {
$dalData = MfProductSpecificationDAL::GetDalDataObj();
$dalData->setObj($objSpec);
MfProductSpecificationDAL::Delete($dalData);
$this->AddRedirectInfo('Element został usunięty', 'ok', Router::GenerateUrl('editSpec', array('ProductSpec' => 'Index', 'type' => $objSpec->GetTyp())));
} else {
if ($isLinked) {
$error .= 'Parametr jest powiązana z produktem.';
}
$this->AddRedirectInfo($error, 'error', Router::GenerateUrl('editSpec', array('ProductSpec' => 'Index', 'type' => $objSpec->GetTyp())));
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$this->AddScript('structure.js');
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
'Kategorie produktów' => array('ProductCategory' => 'Index'),
'Serie produktów' => array('ProductSeries' => 'Index'),
'Materiał produktów' => array('ProductSpec' => 'Index', 'type' => 2),
'Kolor produktów' => array('ProductSpec' => 'Index', 'type' => 1),
'Żarówki produktów' => array('ProductSpec' => 'Index', 'type' => 3),
//'Parametry produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function PostDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,182 @@
<?php
/**
* $Id: SetupController.php 639 2008-06-18 10:51:32Z mija $
* Kontroler Ustawien
*
*/
class SetupController extends MainController implements ControllerInterface {
/**
* Strona glowna
*
*/
public function IndexAction($param) {
if ( isset($_REQUEST["addVariable"]) ) {
//Utils::ArrayDisplay($_REQUEST);
SetupDAL::SaveVariable($_REQUEST["variable"], $_REQUEST["value"], $_REQUEST["description"]);
}
$this->smarty->assign('arrayVariables', SetupDAL::GetAllVariables(false) );
//Utils::ArrayDisplay(SetupDAL::GetAllVariables(false));
}
/**
* Nowy parametr
*
*/
public function NewAction() {
$this->partialTemplate = 'Edit.tpl';
$this->smarty->assign('objVariable', NULL );
}
/**
* Edycja parametru
*
* @param array $param
*/
public function EditAction($param) {
//$this->partialTemplate = 'Edit.tpl';
$objVariable = SetupDAL::GetVariableByName($param["variable"]);
$this->smarty->assign('objVariable', $objVariable );
}
/**
* Czyszczenie cache strony
*
*/
public function ClearCacheAction() {
$directory = PATH_SITE_CACHE;
if( !$dirhandle = @opendir($directory) )
return;
while( false !== ($filename = readdir($dirhandle)) ) {
if( $filename != "." && $filename != ".." ) {
$filename = $directory. "/". $filename;
if(is_file($filename)) {
@unlink($filename);
}
}
}
}
public function ManualPathInstallerAction($param) {
if(Request::IsPost()) {
$post = Request::GetAllPost();
$controller = $post['controller'];
$method = $post['method'];
$matchUri = $post['matchUri'];
$actionSetText = $post['actionSet'];
$paramSet = $post['param'];
$module = $post['module'];
$actionSet = array();
$actionSetText = explode(',', $actionSetText);
foreach($actionSetText as $item) {
$item = explode(':', $item);
if(isset($item[0]) && isset($item[1]) && isset($item[2]))
$actionSet[] = array('module'=>$item[0], 'controller'=>$item[1], 'method'=>$item[2]);
}
$paramText = array();
$paramText = explode(',', $paramSet);
//Utils::ArrayDisplay($paramText);
foreach($paramText as $item) {
$item = explode(':', $item);
if(isset($item[0]) && isset($item[1]))
$paramArray[] = array('var'=>$item[0], 'value'=>$item[1]);
}
$router = new MfRouter();
$router->SetController($controller);
$router->SetMethod($method);
$router->SetUrl($matchUri);
$router->SetParam(serialize($paramArray));
$router->SetConfig(serialize(array('module'=>$module, 'actionSet'=>$actionSet)));
MfRouterDAL::Save($router);
Router::GenerateDbRoutes();
}
}
public function PackageInstallerAction($param) {
$dir = Config::Get('PATH_CORE').'/modules';
$files = scandir($dir);
$modules = array();
foreach($files as $file) {
if(preg_match('((.*)(.zip))', $file)) {
$modules[] = str_replace('.zip', '', $file);
}
}
$this->smarty->assign('modulesList', $modules);
if(isset($param['package'])) {
$installer = new ModuleInstaler($param['package']);
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
//$this->RunShared('Admin');
$this->Run($param);
//$admin = AuthDAL::GetAdmin();
$this->RunShared('Auth', array());
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
//'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
// 'Kategorie produktów' => array('ProductCategory' => 'Index'),
// 'Serie produktów' => array('ProductSeries' => 'Index'),
// 'Materiał produktów' => array('ProductSpec' => 'Index', 'type' => 2),
// 'Kolor produktów' => array('ProductSpec' => 'Index', 'type' => 1),
// 'Żarówki produktów' => array('ProductSpec' => 'Index', 'type' => 3),
//'Parametry produktów' => array('ProductAttribute' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,191 @@
<?php
/**
* $Id: SharedController.php 969 2008-07-29 13:55:14Z pawy $
* Kontroller wspolny
*
*/
class SharedController extends MainController implements ControllerInterface {
/**
* domyslna metoda
*
*/
public function IndexAction($param) {
}
public function infoFrame($param) {
$this->smarty->assign('info',$param['info']);
$this->smarty->assign('type',$param['type']);
}
public function Pagination($param) {
if(isset($param['strona']) && $param['strona'] > 0 ){
$page = $param['strona'];
$URLparam = $this->GetUrlParam($param);
}
else{
$page = 1;
$URLtemp = $this->GetUrlParam($param);
if (!isset($URLtemp[1])) {
$URLtemp[1] = '';
}
$URLparam = array($URLtemp[0], $URLtemp[1], 1, 'strona');
$URLparam = array_merge($URLparam, array_slice($URLtemp, 2));
}
$this->smarty->assign('CurrentPage', $page);
$URLParam = array("", "");
$URLParam[0] = $URLparam[3];
$URLParam[1] = $URLparam[1] . ',' . $URLparam[0];
for ( $i = 4, $size = sizeof($URLparam) ; $i < $size ; $i++)
{
$URLParam[0] = $URLparam[$i] . ',' . $URLParam[0];
}
$this->smarty->assign("URLParam", $URLParam);
$this->smarty->assign('pagination', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Admin($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function DefaultPanel($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Login($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Page($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Mailing($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function News($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Offer($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Structure($param) {
$lang = SessionProxy::GetValue('lang');
$location = SessionProxy::GetValue('location');
//Utils::ArrayDisplay($param);
$arrayObjStructureMain = StructureDAL::GetTree(array('lang' => $lang, 'type' => 1, 'location' => $location ),array());
$arrayObjStructureBottom = StructureDAL::GetTree(array('lang' => $lang, 'type' => 2, 'location' => $location),array());
$arrayObjStructureOther = StructureDAL::GetTree(array('lang' => $lang, 'type' => 3, 'location' => $location),array());
//$arrayRouter = RouterParamDAL::GetArrayRouter();
//Utils::ArrayDisplay($arrayObjStructureMain);
if (isset($param['id'])) {
$id = $param['id'];
} elseif (isset($param['idElement'])) {
$id = $param['idElement'];
} else {
$id = '';
}
$this->smarty->assign('idStucture', $id);
$this->smarty->assign( 'arrayObjStructure' ,$arrayObjStructureMain);
$this->smarty->assign( 'arrayObjStructureBottom' ,$arrayObjStructureBottom);
$this->smarty->assign( 'arrayObjStructureOther' ,$arrayObjStructureOther);
//Utils::ArrayDisplay($this->smarty->fetch($this->templatePath.$this->partialTemplate));
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function Preferences($param) {
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function StructureAction($param) {
//$this->SetAjaxRender();
$lang = SessionProxy::GetValue('lang');
//Utils::ArrayDisplay($param);
$arrayObjStructure = StructureDAL::GetTree(array('lang' => $lang),array());
//$arrayRouter = RouterParamDAL::GetArrayRouter();
$this->smarty->assign( 'arrayObjStructure' ,$arrayObjStructure);
$this->smarty->assign('leftBox', $this->smarty->fetch($this->templatePath.$this->partialTemplate));
}
public function CustomerLink($param) {
//$this->SetAjaxRender();
$lang = SessionProxy::GetValue('lang');
//Utils::ArrayDisplay($param);
$type = ( isset($param['tagType']) ? $param['tagType'] : " 2 ");
$arrayCustomer = Utils::GetArrayList('mf_tag', 'id_mf_tag', 'tag', $lang, ' AND type = '.$type, 'tag');
//$arrayRouter = RouterParamDAL::GetArrayRouter();
$this->smarty->assign('arrayCustomer' ,$arrayCustomer);
}
/**
* Startuje sesje, weryfikuje autoryzacje admina
*
*/
/**
* Startuje sesje, weryfikuje autoryzacje admina
*
*/
public function Auth($param) {
$this->SetNoRender();
//session_start();
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
//Utils::ArrayDisplay($this);
$this->smarty->assign('admin', $admin);
Registry::Set('admin', $admin);
if(!is_object($admin)) {
//$this->AddRedirectInfo("NIE ZALOGOWANY", null, Router::GenerateUrl('LOGIN', array("Login" => "Index")));
die(header("Location: ". Router::GenerateUrl('LOGIN', array("Login" => "Index")) ));
//$this->SetActionRedirect('AdminLoginRedirectAction');
}
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->Run($param);
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
<?php
/**
* Struktura menu
*
*
*/
class UploaderController extends MainController implements ControllerInterface {
/**
* strona glowna
*
*/
public function IndexAction($param) {
}
public function UploaderAction($param) {
//Utils::ArrayDisplay($_FILES);
if (isset($_FILES['file'])) {
move_uploaded_file ( $_FILES['file']['tmp_name'], PATH_STATIC_CONTENT.'temp/'.$_FILES['file']['name'] );
}
}
public function preDispatch($param) {
$this->AddScript("prototype.js");
$this->AddScript("GetContent.js");
$this->AddScript('structure.js');
$this->AddScript('Dosia.js');
$this->AddScript('drag-drop-folder-tree.js');
$this->AddScript('calendar.js');
//Utils::ArrayDisplay($param);
//$this->Run($param);
$arrayModuleName = MfModuleDAL::GetArrayModuleName();
$this->smarty->assign( 'arrayModuleName' ,$arrayModuleName);
$this->smarty->assign('showIcon', true);
//Utils::ArrayDisplay(Utils::ArrayDisplay(SessionProxy::GetValue(EnumSessionValue::USER_OBJECT)));
//$this->RunShared('Auth', array());
//$this->smarty->assign("menuSelected", "");
$this->smarty->assign('activeTab', 'index');
$this->AddScript("formAction.js");
$this->Run($param);
$this->RunShared('Structure', $param);
$this->smarty->assign('titleAdmin', 'Struktura strony');
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>

View File

@@ -0,0 +1,735 @@
<?php
/**
* $Id: UserController.php 969 2008-07-29 13:55:14Z pawy $
* Zarzadzanie uzytkownikami
*
*/
class UserController extends MainController implements ControllerInterface {
// cropper const
const PHOTO_ORG_SMALL_SIZE = 70; // minimalny wymiar oryginalnego obrazka
const MAX_PHOTO_ORG_FILE_SIZE = 5; // maksymalny rozmiar oryginalnego obrazka w mb
const CROPPER_MIN_SIZE = 70; // minimalny wymiar croppera
const CROPPER_MAX_SIZE = 300; // maksymalny wymiar dla croppera
const PHOTO_SESSION_NAME = '__avatar_photo_name__';
const PHOTO_SESSION_ID = '__avatar_photo_id__';
const SIZE_SESSION_NAME = '__avatar_photo_size__';
const AVATAR_DEST_DIR = 'images/upload/Avatar';
const AVATAR_TEMP_DIR = 'images/upload/temp/Avatar';
const GALLERY_DEST_DIR = 'images/upload/Avatar';
const GALLERY_TEMP_DIR = 'images/upload/temp/Avatar';
const NO_PHOTO_IMG_BIG = "image/Admin/cropperNoPhotoBig.gif";
const NO_PHOTO_IMG_SMALL = "image/Admin/cropperNoPhotoSmall.gif";
/**
* Strona glowna
*
*/
public function IndexAction($param) {
if(isset($param['sort']) && isset($param['direction']))
$this->smarty->assign($param['sort'],$param['direction']);
else {
$param['sort'] = "";
$param['direction'] = "";
}
if(isset($param['sort2']) && isset($param['direction2']))
$this->smarty->assign($param['sort2'],$param['direction2']);
else {
$param['sort2'] = "";
$param['direction2'] = "";
}
$this->smarty->assign('userList', AdminDAL::GetResult(array(),array(),null,$param['sort'] . " " . $param['direction']));
$this->smarty->assign('archiveUserList', AdminDAL::GetResult(array('archive' => 1),array(),null,$param['sort2'] . " " . $param['direction2']));
}
public function JoinAction($param)
{
if(isset($param['sort']) && isset($param['direction']))
$this->smarty->assign($param['sort'],$param['direction']);
else
{
$param['sort'] = "";
$param['direction'] = "";
}
$this->smarty->assign('type',$param['type']);
$this->smarty->assign('ids',Request::Get($param['type']));
$this->smarty->assign('UserList', AdminDAL::GetResult(array(),array(),null,$param['sort'] . " " . $param['direction']));
}
public function AjaxJoinAction($param)
{
foreach(Request::Get($param['type']) as $key2 => $value2)
{
MfLinkDAL::DeleteFromLink($value2, $param['type'], null , 'mf_admin');
$i = 0;
foreach(Request::Get('admin') as $key => $value)
{
//przypisujemy łączenia
$mfLinkObj = new MfLink();
$mfLinkObj->SetIdSource($value2);
$mfLinkObj->SetSourceType($param['type']);
$mfLinkObj->SetIdDestination($value);
$mfLinkObj->SetDestinationType('mf_admin');
MfLinkDAL::Insert($mfLinkObj);
$i++;
}
$className = str_replace('mf_','',$param['type']);
$className = ucfirst($className);
$obj = new $className();
$obj->setId($value2);
$obj->setAdminCount($i);
eval($className . 'DAL::Update($obj);');
}
$this->SetAjaxRender();
$param['hide']=false;
$this->content=$this->FormatAjaxOutput(array(),$param);
}
public function AjaxDeleteAction($param)
{
foreach(Request::Get($param['type']) as $key2 => $value2)
{
MfLinkDAL::DeleteFromLink($value2, $param['type'], $param['mf_admin'] , 'mf_admin');
$this->user->SetForumCount($this->user->GetForumCount()-1);
AdminDAL::Update($this->user);
$className = str_replace('mf_','',$param['type']);
$className = ucfirst($className);
$obj = null;
eval('$obj =' .$className . 'DAL::GetById($value2);');
$obj->SetAdminCount($obj->GetAdminCount() - 1);
eval($className . 'DAL::Update($obj);');
}
$this->SetAjaxRender();
$param['hide']=false;
$this->content=$this->FormatAjaxOutput(array(),$param);
}
/**
* Edycja uzytkownika
*
* @param array $param
*/
public function EditAction($param) {
$url = Router::GenerateUrl('UserList',array('User' => 'Index'));
if(Request::IsPost()) {
// [login] =>
// [password] =>
// [passwordconf] =>
// [firstName] =>
// [lastName] =>
// [email] =>
// [description] =>
// [role] => admin
$postData = Request::GetAllPost(false);
//if(Request::GetPost('action') == 'submit' ) {
$validator = new Validator($postData);
$validator->IsEmpty('login','To pole nie może być puste');
$validator->IsEmpty('password','To pole nie może być puste');
$validator->IsEmpty('passwordconf','To pole nie może być puste');
// $validator->IsEmpty('firstName','To pole nie może być puste');
// $validator->IsEmpty('lastName', 'To pole nie może być puste');
//$validator->IsEmpty('email', 'To pole nie może być puste');
//$validator->IsEmpty('role', 'To pole nie może być puste');
if(Request::GetPost('passwordconf') !== Request::GetPost('password')) {
$validator -> AddError('passwordconfDif', 'Hasła są różne');
}
$out = $validator->GetErrorList();
$user = AdminDAL::GetById($postData['id']);
$user->SetLogin(Request::RemoveXss($postData['login']));
$user->SetEmail(Request::RemoveXss($postData['email']));
$user->SetFirstName($postData['firstName']);
$user->SetLastName($postData['lastName']);
$user->SetRole($postData['role']);
$user->SetDescription($postData['description']);
$pass = trim($postData['password']);
$user->SetPassword(md5($pass));
if(empty($out)) {
$postData = Request::GetAllPost(false);
$userId = AdminDAL::Save($user);
$this->AddRedirectInfo('Edycja u<>ytkownika przebieg<65>o pomy<6D>lnie.');
Utils::Redirect($url);
}else {
//Utils::ArrayDisplay($out);
$this->smarty->assign('userData',$user);
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
}
if(isset($param['id']) && is_numeric($param['id']) ) {
$user = AdminDAL::GetById($param['id']);
} else {
$user = new Admin();
}
$this->smarty->assign('userData', $user );
$this->smarty->assign('userRole', AdminDAL::GetArrayObjRoles());
}
public function AjaxEditFormAction($param) {
$this -> SetAjaxRender(true);
if(isset($param['id'])) {
$id = $param['id'];
SessionProxy::SetValue('editedUser', AdminDAL::GetById($id));
} else {
return;
}
$url = Router::GenerateUrl(array('_value' => 'user'));
if(Request::IsPost()) {
if(isset($param['field'])) {
$out = $this->ValidateEdit($param);
$param['msg'] = 'Pole zostało zwalidowane';
$this->content=$this->FormatAjaxOutput($out,$param);
return;
}
if(Request::GetPost('action') == 'submit' ) {
$out = $this -> ValidateEdit($param);
$param['msg'] = 'Twoje zgłoszenie zostało przyjęte';
if(empty($out) && Request::GetPost('action') == 'submit' ) {
$postData = Request::GetAllPost(false);
$mail = Request::RemoveXss($postData['email']);
$editedUser = AdminDAL::GetById($id);
$editedUser->SetEmail(Request::RemoveXss($postData['email']));
$editedUser->SetFirstName($postData['firstName']);
$editedUser->SetLastName($postData['lastName']);
$editedUser->SetRole($postData['role']);
$editedUser->SetDescription($postData['description']);
$photo = SessionProxy::GetValue(self::PHOTO_SESSION_ID);
if($photo) {
$obj->SetPhotoSrc($photo);
SessionProxy::ClearValue(self::PHOTO_SESSION_ID);
}
if(trim(Request::GetPost('password')) != '' && $editedUser->GetPassword() != md5(trim(Request::GetPost('password'))) ) {
$pass = trim($postData['password']);
$editedUser->SetPassword(md5($pass));
}
$userId = AdminDAL::Save($editedUser);
// $mailer = new Mailer();
// $mailer->SendEmail($this->smarty->fetch('partial/Mail/RegisterMail.tpl'), '', 'Rejestracja konta',$postData['email']);
$this->AddRedirectInfo('Dodawanie użytkownika przebiegło pomyślnie.');
$param['redirect'] = $url;
$this->content=$this->FormatAjaxOutput($out,$param);
}else {
$this->content=$this->FormatAjaxOutput($out,$param);
}
}
}
}
private function ValidateEdit($param) {
$validator = new Validator(Request::GetAllPost());
$user = SessionProxy::GetValue('editedUser');
if(isset($param['field']) && !Request::Check(ereg_replace('((\[)(.*)(\]))','',urldecode($param['field'])))) {
$validator -> AddError($param['field'], $this->GetDictionary('validator_field'));
}
//e-mail
if((isset($param['field']) && $param['field'] == 'email') || !isset($param['field']) ) {
if($user->GetEmail() != Request::GetPost('email') )
$validator -> IsNotInDatabase('email', $this->GetDictionary('validator_email_exist'), 'email');
$validator -> IsEmailAddress('email', $this->GetDictionary('validator_email_error'));
$validator -> IsEmpty('email',$this->GetDictionary('validator_email_empty'));
}
if((isset($param['field']) && $param['field'] == 'password') || !isset($param['field']) ) {
if(trim(Request::GetPost('password')) != '' ) {
SessionProxy::SetValue('password',Request::GetPost('password'));
$validator -> IsEmpty('password',$this->GetDictionary('validator_password_empty'));
}
}
//potwierdzenie hasła
if((isset($param['field']) && $param['field'] == 'passwordconf') || !isset($param['field']) ) {
if(trim(Request::GetPost('passwordconf')) != '' ) {
$password = SessionProxy::GetValue('password');
if(!is_null($password) && Request::GetPost('passwordconf') !== $password && strlen(Request::GetPost('passwordconf')) > 0) {
$validator -> AddError('passwordconf',$this->GetDictionary('validator_password_different'));
}
$validator -> IsEmpty('passwordconf',$this->GetDictionary('validator_password_empty'));
}
}
// if((isset($param['field']) && $param['field'] == 'education') || !isset($param['field']) ) {
// $validator -> IsEmpty('education','Nie wybrano wykształcenia','education');
// }
// $param['submitForm'] = 'walidacja';
return $validator->GetErrorList();
}
/**
* Dodawanie uzytkownika
*
* @param array $param
*/
public function AddAction($param) {
$url = Router::GenerateUrl('UserList',array('User' => 'Index'));
//Utils::ArrayDisplay($_POST);
if(Request::IsPost()) {
// [login] =>
// [password] =>
// [passwordconf] =>
// [firstName] =>
// [lastName] =>
// [email] =>
// [description] =>
// [role] => admin
$postData = Request::GetAllPost(false);
//if(Request::GetPost('action') == 'submit' ) {
$validator = new Validator($postData);
$validator->IsEmpty('login','To pole nie może być puste');
$validator->IsEmpty('password','To pole nie może być puste');
$validator->IsEmpty('passwordconf','To pole nie może być puste');
$validator->IsEmpty('firstName','To pole nie może być puste');
$validator->IsEmpty('lastName', 'To pole nie może być puste');
$validator->IsEmpty('email', 'To pole nie może być puste');
$validator->IsEmpty('role', 'To pole nie może być puste');
if(Request::GetPost('passwordconf') !== Request::GetPost('password')) {
$validator -> AddError('passwordconfDif', 'Hasła są róne');
}
$out = $validator->GetErrorList();
if(empty($out)) {
$postData = Request::GetAllPost(false);
$mail = Request::RemoveXss($postData['email']);
$newuser = new Admin();
$newuser->SetId(-1);
$newuser->SetLogin(Request::RemoveXss($postData['login']));
$newuser->SetEmail(Request::RemoveXss($postData['email']));
$newuser->SetFirstName($postData['firstName']);
$newuser->SetLastName($postData['lastName']);
$newuser->SetRole($postData['role']);
$newuser->SetDescription($postData['description']);
$pass = trim($postData['password']);
$newuser->SetPassword(md5($pass));
$userId = AdminDAL::Save($newuser);
$this->AddRedirectInfo('Dodawanie u<>ytkownika przebieg<65>o pomy<6D>lnie.');
Utils::Redirect($url);
}else {
//Utils::ArrayDisplay($out);
$this->smarty->assign('user',$postData);
foreach ($out as $item) {
$error[$item['field']] = $item['msg'];
}
$this->smarty->assign('error',$error);
}
//}
}
$this->smarty->assign('userRole', AdminDAL::GetArrayObjRoles());
}
public function AjaxAddFormAction($param) {
$this -> SetAjaxRender(true);
}
private function ValidateAdd($param) {
$validator = new Validator(Request::GetAllPost());
if(isset($param['field']) && !Request::Check(ereg_replace('((\[)(.*)(\]))','',urldecode($param['field'])))) {
$validator -> AddError($param['field'], $this->GetDictionary('validator_field'));
}
//e-mail
if((isset($param['field']) && $param['field'] == 'email') || !isset($param['field']) ) {
$validator -> IsNotInDatabase('email', $this->GetDictionary('validator_email_exist'), 'email');
$validator -> IsEmailAddress('email', $this->GetDictionary('validator_email_error'));
$validator -> IsEmpty('email',$this->GetDictionary('validator_email_empty'));
}
if((isset($param['field']) && $param['field'] == 'password') || !isset($param['field']) ) {
SessionProxy::SetValue('password',Request::GetPost('password'));
$validator -> IsEmpty('password',$this->GetDictionary('validator_password_empty'));
}
//potwierdzenie hasła
if((isset($param['field']) && $param['field'] == 'passwordconf') || !isset($param['field']) ) {
$password = SessionProxy::GetValue('password');
if(!is_null($password) && Request::GetPost('passwordconf') !== $password && strlen(Request::GetPost('passwordconf')) > 0) {
$validator -> AddError('passwordconf',$this->GetDictionary('validator_password_different'));
}
$validator -> IsEmpty('passwordconf',$this->GetDictionary('validator_password_empty'));
}
// if((isset($param['field']) && $param['field'] == 'education') || !isset($param['field']) ) {
// $validator -> IsEmpty('education','Nie wybrano wykształcenia','education');
// }
// $param['submitForm'] = 'walidacja';
return $validator->GetErrorList();
}
/**
* Usuwanie uzytkownika
*
* @param array $param
*/
public function DeleteAction($param) {
$this->SetAjaxRender(true);
if(isset($param['ok'])) {
$res = null;
if(isset($param['id'])) {
$res = AdminDAL::GetById($param['id']);
} else {
return;
}
if(is_object($res)) {
AdminDAL::Delete($res);
}
$this->AddRedirectInfo('U<>ytkownik zosta<74> usuni<6E>ty');
$this->AddRedirect(Router::GenerateUrl('userIndex', array('User'=>'Index')), 0);
} else {
$buttons = new HtmlButton();
$buttons->AddButton('popoverAbort', 'button anuluj lbAction', 'Anuluj', null, 'deactivate');
$buttons->AddButton('popoverOk', 'button zapisz', 'Ok', 'document.location.href=\''.Router::GenerateUrl(array('User'=>'Delete', 'id'=>$param['id'], 'ok'=>'1')).'\';', null);
$this->content = $this->GeneratePopover('Usuwanie użytkownika', 'usun.gif', 'Czy na pewno chcesz usunąć tego użytkownika?', $buttons->GetElements());
}
}
/**
* Zmiana hasla
*
*/
public function ChangePasswordAction() {
$this->AddScript('prototype.js');
$this->AddScript('scriptaculous.js');
$this->partialTemplate = 'Password.tpl';
$this->smarty->assign('msg', '');
if(isset($_POST['oldPassword']) && isset($_POST['newPassword']) && isset($_POST['confirmPassword'])) {
$admin = AuthDAL::GetAdmin();
if(AdminDAL::CheckPassword($admin->GetId(), $_POST['oldPassword'])) {
AdminDAL::UpdatePassword($admin->GetId(), $_POST['newPassword'], $_POST['oldPassword']);
$this->smarty->assign('msg', 'Hasło zostało zmienione');
} else {
$this->smarty->assign('msg', 'Podano nieprawidłowe hasło. Spróbuj ponownie.');
}
}
}
/**
* Wspolna metoda
*
*/
public function preDispatch($param) {
$this->RunShared('Auth', $param);
$this->Run($param);
$admin = AuthDAL::GetAdmin();
$this->user = $admin;
$this->smarty->assign('titleAdmin', 'Administracja');
$struct = array(
'User' => array('User' => 'Index'),
'Słowniki' => array('Dictionary' => 'Index'),
'Zmienne serwisu' => array('Setup' => 'Index'),
//'Kategorie produktów' => array('ProductCategory' => 'Index')
);
$this->smarty->assign('structure',$this->renderStruct($struct));
}
private function renderStruct($struct){
$return = '';
foreach($struct AS $k => $row){
$return .= '<li><a href="' . Router::GenerateUrl('dictpig',$row).'">'.$k.'</a></li>';
}
$html = '<ul>';
$html .= $return;
$html .= '</ul>';
return $html;
}
public function postDispatch($param) {
}
// cropper
// cropper //
public function AjaxPhotoCropperAction($param) {
$this->SetAjaxRender();
$photoPath = Request::GetPost('photoPath');
$photoHeight = Request::GetPost('photoHeight');
$photoWidth = Request::GetPost('photoWidth');
$this->smarty->assign('photoWidth', $photoWidth);
$this->smarty->assign('photoHeight', $photoHeight);
$this->smarty->assign('minPhotoWidth', self::CROPPER_MIN_SIZE);
$this->smarty->assign('minPhotoHeight', self::CROPPER_MIN_SIZE);
$this->smarty->assign('noPhotoImgBig', URL_STATIC_CONTENT . URL_DELIMITER . self::NO_PHOTO_IMG_BIG);
$this->smarty->assign('noPhotoImgSmall', URL_STATIC_CONTENT . URL_DELIMITER . self::NO_PHOTO_IMG_SMALL);
$this->smarty->assign('photoPath', Request::GetPost('photoPath'));
if (isset($param['id'])) {
$this->smarty->assign('cutUrl', array('user' => 'AjaxPhotoCropped', 'id' => $param['id']));
} else {
$this->smarty->assign('cutUrl', array('user' => 'AjaxPhotoCropped'));
}
$this->smarty->assign('fields',
array(
0 => array('name'=>'colSize', 'type'=>'radio', 'value'=>1, 'label'=>'pół kolumny', 'options'=>'checked="checked"'),
1 => array('name'=>'colSize', 'type'=>'radio', 'value'=>2, 'label'=>'cała kolumna', 'options'=>''),
2 => array('name'=>'colSize', 'type'=>'radio', 'value'=>3, 'label'=>'bez skalowania', 'options'=>''),
)
);
$this->smarty->assign('uploadUrl', array('user' => 'AjaxPhotoUpload'));
}
public function AjaxPhotoCroppedAction($param) {
$upload = true;
$oldPhoto = null;
$redirect = 'self';
$this->SetAjaxRender();
$photoFile = SessionProxy::GetValue(self::PHOTO_SESSION_NAME);
SessionProxy::ClearValue(self::PHOTO_SESSION_NAME);
$tmpPhotoArray = array();
$tmpPhotoArray['name'] = $photoFile . '.' . PhotoDAL::PHOTO_NEW_EXT;
$tmpPhotoArray['tmp_name'] = Config::Get('PATH_STATIC_CONTENT') . self::GALLERY_TEMP_DIR . DIRECTORY_SEPARATOR . $tmpPhotoArray['name'];
$croppSize = SessionProxy::GetValue(self::SIZE_SESSION_NAME);
SessionProxy::ClearValue(self::SIZE_SESSION_NAME);
$orgSize = getimagesize($tmpPhotoArray['tmp_name']);
$sc = 1;
if($upload) {
if($orgSize[0] != $croppSize['w']) {
$sc = $orgSize[0]/$croppSize['w'];
}
} else {
$cs = getimagesize(Config::Get('PATH_STATIC_CONTENT') . self::GALLERY_TEMP_DIR . DIRECTORY_SEPARATOR . $oldPhoto[0]->GetPhoto('temp') . '.' . PhotoDAL::PHOTO_NEW_EXT);
if($orgSize[0] != $cs[0]) {
$sc = $orgSize[0] / $cs[0];
}
}
$croppArray = array(
'x' => Request::Get('x') * $sc,
'y' => Request::Get('y') * $sc,
'w' => Request::Get('w') * $sc,
'h' => Request::Get('h') * $sc
);
$destDir = self::GALLERY_DEST_DIR;
$photo = PhotoDAL::ExtSimplePhotoUpload($tmpPhotoArray, $destDir, 'user', null, null, $croppArray);
$id = null;
// $objPhoto = new Picture();
// $objPhoto->SetLink($photoFile);
// $idPhoto = PictureDAL::Insert($objPhoto);
if (isset($param['id'])) {
$admin = AdminDAL::GetById($param['id']);
$admin->SetPhotoSrc($photoFile);
AdminDAL::Save($admin);
// $articleObj = MfArticleDAL::GetById($param['id']);
// $articleObj->SetIdPicture($idPhoto);
// MfArticleDAL::Save($articleObj);
} else {
SessionProxy::SetValue(self::PHOTO_SESSION_ID, $photoFile);
}
if(isset($param['id'])) {
$redirect = Router::GenerateUrl(array('user'=>'Edit', 'id'=>$param['id']));
} else {
$redirect = Router::GenerateUrl(array('user'=>'Edit'));
}
$this->smarty->assign('photoPath', $photoFile);
$this->smarty->assign('redirect', null);
}
public function AjaxPhotoUploadAction($param) {
$this->SetAjaxRender();
$photoFile = $_FILES['photo']['tmp_name'];
$photoSize = getimagesize($photoFile);
if ($photoSize[0] < self::PHOTO_ORG_SMALL_SIZE) {
$error = "Szerokość zdjęcia jest zbyt mała.";
} else if($photoSize[1] < self::PHOTO_ORG_SMALL_SIZE) {
$error = "Wysokość zdjęcia jest zbyt mała.";
} else if (filesize($photoFile) > (self::MAX_PHOTO_ORG_FILE_SIZE*1048576)) {
$error = "Przekroczony rozmiar zdjęcia(max: " . self::MAX_PHOTO_ORG_FILE_SIZE . "MB).";
}
if (!MimeType::IsImage($_FILES['photo'])) {
$error = "Podany przez ciebie plik ma niepoprawny format.";
}
if (isset($error)) {
$this->smarty->assign('error', $error);
} else {
$photoProp = $photoSize[0] / $photoSize[1];
$photoWidth = $photoSize[0];
$photoHeight = $photoSize[1];
if ($photoWidth > self::CROPPER_MAX_SIZE) {
$photoHeight = self::CROPPER_MAX_SIZE / $photoProp;
$photoWidth = self::CROPPER_MAX_SIZE;
}
if ($photoHeight > self::CROPPER_MAX_SIZE) {
$photoWidth = self::CROPPER_MAX_SIZE * $photoProp;
$photoHeight = self::CROPPER_MAX_SIZE;
}
$newName = md5(time());
SessionProxy::SetValue(self::PHOTO_SESSION_NAME, $newName);
SessionProxy::SetValue(self::SIZE_SESSION_NAME, array('w' => $photoWidth, 'h' => $photoHeight));
$photoFile = PhotoDAL::ExtSimplePhotoUpload($_FILES['photo'], self::GALLERY_TEMP_DIR , 'gallery_cropp_temporary', $newName, 'temp');
$photoFile = self::GALLERY_TEMP_DIR . URL_DELIMITER . $photoFile;
$this->smarty->assign('page2load', Router::GenerateUrl(array('zdjecia' => 'edycja')));
$this->smarty->assign('photoFile', $photoFile);
$this->smarty->assign('photoWidth', (int)$photoWidth);
$this->smarty->assign('photoHeight', (int)$photoHeight);
$this->smarty->assign('onFly', (Request::Check('onFly') ? 'true' : 'false'));
$this->smarty->assign('cropPrefix', Request::GetPost('cropPrefix'));
}
}
}
?>

View File

@@ -0,0 +1 @@
ERROR 404

View File

@@ -0,0 +1,65 @@
<?php
ini_set('default_charset','utf-8');
include('../core/core.php');
ini_set("display_errors" ,true);
/**
* Autoloader klas
*
* @param unknown_type $className
*/
spl_autoload_register(function ($className) {
//echo $className;
Core::LoadClass($className);
});
Core::Init(PageType::ADMIN);
//$logger = LoggerManager::getLogger(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : __FILE__);
Core::LoadSmarty();
session_start();
$scripts = array();
Registry::Set('javascript', $scripts);
Router::AddRoute('addStructure','Structure/Add', array('controller'=>'StructureController', 'method'=>'Add', 'push' => array('paramStr' => true), 'config'=>array('actionSet'=>array())));
Router::AddRoute('editStructure','Structure/Edit/id/:id', array('controller'=>'StructureController', 'method'=>'Edit', 'push' => array('paramStr' => true), 'config'=>array('actionSet'=>array())));
Router::AddRoute('copyStructure','Structure/Copy/id/:id', array('controller'=>'StructureController', 'method'=>'Copy', 'push' => array('paramStr' => true), 'config'=>array('actionSet'=>array())));
Router::AddRoute('customerEditpl', 'customer/gallery/pl', array('controller'=>'StructureController', 'method'=>'Edit', 'push' => array('id' => 18, 'lang' => 'pl'), 'config'=>array('actionSet'=>array())));
Router::AddRoute('customerEditen', 'customer/gallery/en', array('controller'=>'StructureController', 'method'=>'Edit', 'push' => array('id' => 52, 'lang' => 'en'), 'config'=>array('actionSet'=>array())));
Router::AddRoute('customerEditru', 'customer/gallery/ru', array('controller'=>'StructureController', 'method'=>'Edit', 'push' => array('id' => 30, 'lang' => 'ru'), 'config'=>array('actionSet'=>array())));
Router::AddRoute('customerEditde', 'customer/gallery/de', array('controller'=>'StructureController', 'method'=>'Edit', 'push' => array('id' => 40, 'lang' => 'de'), 'config'=>array('actionSet'=>array())));
//Router::AddRoute('HomeSite','HomeSite', array('controller'=>'SimpleArticle_Index', 'method'=>'Edit', 'push' => array('idArticle' => 3 , 'paramStr' => true), 'config'=>array('actionSet'=>array())));
//Router::AddRoute('SaveStructure','Structure/Save', array('controller'=>'StructureController', 'method'=>'Save', 'push' => array('paramStr' => true), 'config'=>array('actionSet'=>array(array('module'=>'SimpleArticle', 'controller'=>'SimpleArticle_IndexController', 'method'=>'EditStructureAction')))));
//Router::AddRoute('indexStructure','Structure', array('controller'=>'StructureController', 'method'=>'Index', 'push' => array()));
Router::$controllerMethodSeek = false;
Router::$popParamUnpaired = false;
Router::$reverseRoute = true;
Router::$parseLang = false;
if (SessionProxy::GetValue('lang')) {
Router::$curLang=SessionProxy::GetValue('lang');
//Utils::ArrayDisplay(Router::$curLang);
//Router::$curLang = $param['lang'];
}
//Utils::ArrayDisplay($_SESSION);
$front = new FrontController();
$front->SetTitleDelimiter(' - ');
$front->AddTitle('MF.CMS');
$front->AddTitle('Administracja');
$front->FlipTitle();
$front->Dispatch();
Core::Garbage();
?>

View File

@@ -0,0 +1,364 @@
<?
/**
* $Id: Admin.mod.php 703 2008-06-26 11:15:09Z pawy $
* Klasa przechowujaca dane zalogowanego admina
*
*/
class Admin extends DataObject {
const SMARTY_NAME = 'admin';
const SMARTY_DEFAULT_ACCESS = 'admin';
static $tableName = 'mf_admin';
static $classTablePK = 'id_mf_admin';
static $className = __CLASS__;
static $fields = array(
'id_mf_admin' => 'id',
'email' => 'email',
'first_name' => 'firstName',
'last_name' => 'lastName',
'login' => 'login',
'password' => 'password',
'role' => 'role',
'last_login' => 'lastLogin',
'description' => 'description',
'online' => 'online',
'last_activity' => 'lastActivity',
'phone' => 'phone',
'authorized' => 'authorized',
'photo_src' => 'photoSrc',
'forum_count' => 'forumCount',
'_create_time' => 'createTime',
'moderated_post_count' => 'moderatedPostCount',
'archive' => 'archive',
'delete_time' => 'deleteTime'
);
public function GetTableName(){
return self::$tableName;
}
public function GetFields(){
return self::$fields;
}
public function GetClassName(){
return self::$className;
}
public function GetClassTablePK() {
return self::$classTablePK;
}
/**
* id admnina
*
* @var integer
*/
protected $id;
/**
* email admina
*
* @var string
*/
private $email;
/**
* Imie i nazwisko admina
*
* @var string
*/
private $firstName;
private $lastName;
/**
* login admina
*
* @var string
*/
private $login;
private $password;
/**
* Rola admina
*
* @var string
*/
private $role;
/**
* Szablon uprawnien
*
* @var array
*/
private $access;
/**
* Data i godzina ostatniego logowania
*
* @var string
*/
private $lastLogin;
private $online;
private $lastActivity;
private $phone;
private $description;
private $authorized;
private $photoSrc;
private $forumCount;
private $createTime;
private $moderatedPostCount;
private $archive;
private $deleteTime;
function __construct($id = -1, $description = null, $email = null, $firstName = null, $lastName = null, $login = null, $password = null, $role = null, $access = null, $lastLogin = null, $online = null, $phone = null, $authorized = null, $moderatedPostCount = null,$archive =null) {
$this->id = $id;
$this->description = $description;
$this->email = $email;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->login = $login;
$this->role = $role;
$this->access = $access;
$this->lastLogin = $lastLogin;
$this->online = $online;
$this->phone = $phone;
$this->authorized = $authorized;
$this->moderatedPostCount = $moderatedPostCount;
$this->archive = $archive;
}
public function getModeratedPostCount() {
return $this->moderatedPostCount;
}
public function setModeratedPostCount($moderatedPostCount) {
$this->moderatedPostCount = $moderatedPostCount;
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getEmail() {
return $this->email;
}
public function setEmail($email) {
$this->email = $email;
}
public function getName() {
return $this->firstName . " " . $this->lastName;
}
public function getFirstName() {
return $this->firstName;
}
public function setFirstName($firstName) {
$this->firstName = $firstName;
}
public function getLastName() {
return $this->lastName;
}
public function setLastName($lastName) {
$this->lastName = $lastName;
}
public function getLogin() {
return $this->login;
}
public function setLogin($login) {
$this->login = $login;
}
public function getPassword() {
return $this->password;
}
public function setPassword($password) {
$this->password = $password;
}
public function getRole() {
return $this->role;
}
public function setRole($role) {
$this->role = $role;
}
public function getLastLogin() {
return $this->lastLogin;
}
public function setLastLogin($lastLogin) {
$this->lastLogin = $lastLogin;
}
public function getOnline() {
return $this->online;
}
public function setOnline($online) {
$this->online = $online;
}
public function getLastActivity() {
return $this->lastActivity;
}
public function setLastActivity($lastActivity) {
$this->lastActivity = $lastActivity;
}
public function getPhone() {
return $this->phone;
}
public function setPhone($phone) {
$this->phone = $phone;
}
public function getDescription() {
return $this->description;
}
public function setDescription($description) {
$this->description = $description;
}
public function getAuthorized() {
return $this->authorized;
}
public function setAuthorized($authorized) {
$this->authorized = $authorized;
}
public function getPhotoSrc() {
return $this->photoSrc;
}
public function setPhotoSrc($photoSrc) {
$this->photoSrc = $photoSrc;
}
public function getForumCount() {
return $this->forumCount;
}
public function setForumCount($forumCount) {
$this->forumCount = $forumCount;
}
public function GetPhotoUrl($type = 120) {
if($this->photoSrc) {
switch($type) {
case 50:
return $this->photoSrc .'_50.' . PhotoDAL::PHOTO_NEW_EXT;
break;
case 120:
return $this->photoSrc .'_120.' . PhotoDAL::PHOTO_NEW_EXT;
break;
default:
return $this->photoSrc .'_120.'. PhotoDAL::PHOTO_NEW_EXT;
break;
}
}
return null;
}
/**
* Funkcja kontrolna
*
* @return boolean
*/
public function IsAuthorized() {
return $this->authorized;
}
public function getAccess() {
if($this->access == null){
$this->access = AdminDAL::GetArrayAccess($this);
}
return $this->access;
}
public function setAccess($access) {
$this->access = $access;
}
public function getCreateTime() {
return $this->createTime;
}
public function setCreateTime($createTime) {
$this->createTime = $createTime;
}
public function getArchive() {
return $this->archive;
}
public function setArchive($archive) {
$this->archive = $archive;
}
public function getDeleteTime() {
return $this->deleteTime;
}
public function setDeleteTime($deleteTime) {
$this->deleteTime = $deleteTime;
}
/**
* Sprawdza uprawnienia do zasobu
*
* @param string $where
* @return boolean
*/
public function CheckAccess($where) {
if (array_key_exists($where, $this->access)) {
return true;
} else {
return false;
}
}
}
?>

View File

@@ -0,0 +1,320 @@
<?php
/**
* $Id: AdminDAL.mod.php 773 2008-07-01 06:19:05Z dakl $
* Klasa do obs<62>ugi odwo<77>a<EFBFBD> do bazy danych:
* - pobieranie danych
* - usuwanie
* - dodawanie
* - edycja
* - modyfikacja has<61>a
*
*/
class AdminDAL extends DefaultDAL {
// <editor-fold defaultstate="collapsed" desc="Ustawienia tabeli na której operuje DAL">
protected static $objClassName;
protected static $objClassTable;
protected static $objClassTablePK;
private static $optClass;
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Funkcje pobierające nazwy tabeli, klucza głównego, nazwy klasy na której operuje DAL">
/**
* @return string
*
*/
public static function GetObjClassName() {
if (self::$objClassName != '') {
$class = self::$objClassName;
} else {
$class = str_replace('DAL', '', __CLASS__);
}
return $class;
}
/**
* @return string
*
*/
public static function GetOptClass() {
if (self::$optClass != null) {
return self::$optClass;
} else {
return self::GetObjClassName();
}
}
/**
* @return string
*
*/
public static function GetObjClassTablePK() {
if (self::$objClassTablePK != '') {
$return = self::$objClassTablePK;
} else {
$class = self::GetObjClassName();
$classObj = new $class();
$return = $classObj->GetClassTablePK();
}
return $return;
}
/**
* @return string
*
*/
public static function GetObjClassTable() {
if (!is_null(self::$objClassTable)) {
$return = self::$objClassTable;
} else {
$class = self::GetObjClassName();
$classObj = new $class();
$return = $classObj->GetTableName();
}
return $return;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Domyślne metody wymagane przez IDefaultDAL">
/**
* @param User $obj
*
*/
public static function Save($obj) {
if ($obj->GetId() == -1) {
return self::Insert($obj);
} else {
return self::Update($obj);
}
}
/**
* @param User $obj
*
*/
public static function Insert($obj) {
$dalData = new DalData();
$dalData->setObjClassTable(self::GetObjClassTable());
$dalData->setObj($obj);
return self::DefaultInsert($dalData);
}
/**
* @param User $obj
*
*/
public static function Update($obj) {
$dalData = new DalData();
$dalData->setObjClassTable(self::GetObjClassTable());
$dalData->setObjClassTablePK(self::GetObjClassTablePK());
$dalData->setObj($obj);
return self::DefaultUpdate($dalData);
}
/**
*
* @param integer $id
*
*/
public static function Delete($obj) {
$dalData = new DalData();
$dalData->setObjClassTable(self::GetObjClassTable());
$dalData->setObjClassTablePK(self::GetObjClassTablePK());
$dalData->setObj($obj);
$dalData->setId($obj->GetId());
return self::DefaultDelete($dalData);
}
public static function GetDalDataObj() {
$dalData = new DalData();
$dalData->setObjClassName(self::GetObjClassName());
$dalData->setObjClassTable(self::GetObjClassTable());
$dalData->setObjClassTablePK(self::GetObjClassTablePK());
$dalData->setOptClass(self::GetOptClass());
return $dalData;
}
/**
*
* @param integer $id
* @return User
*/
public static function GetById($id) {
$result = self::GetResult(array(self::GetObjClassTablePK() => $id), array(), 1);
if (is_object($result[0])) {
return $result[0];
} else {
throw new Exception('Brak rekordu w tablicy ' . self::GetObjClassTable() . ' o id <b>' . $id . '</b>!');
}
}
/**
* pobiera liste rekordow
* @param <array> $data - pola do where
* @param <array> $queryFields - pobierane pola
* @param <string> $limit - limit rekordow
* @param <string> $sortBy - sortowanie
* @param <bool> $count - czy ma zwracac ilosc rekordow
* @return <array> - tablica obiektow lub jesli usawiony count liczba rekordow
*/
public static function GetResult($data = array(), $queryFields = array(), $limit = 0, $sortBy = null, $count = null) {
$dalData = new DalData();
$dalData->setObjClassName(self::GetObjClassName());
$dalData->setObjClassTable(self::GetObjClassTable());
$dalData->setObjClassTablePK(self::GetObjClassTablePK());
$dalData->setOptClass(self::GetOptClass());
$dalData->setCondition($data);
$dalData->setQueryFields($queryFields);
$dalData->setLimit($limit);
$dalData->setSortBy($sortBy);
$dalData->setCount($count);
return self::DefaultGetResult($dalData, false);
}
// </editor-fold>
public static function GetArrayAccess($obj) {
$db = Registry::Get('db');
$sql = "SELECT access from mf_admin_access where role=:1";
$stmt = $db->Prepare($sql)
->BindParam(1, $obj->getRole())
->Execute();
$access = array();
while ($row = $stmt->FetchArray()) {
$access[$row['access']] = true;
}
return $access;
}
/**
* Pobieranie listy rol
*
* @return array
*/
public static function GetArrayObjRoles() {
$db = Registry::Get('db');
$sql = "SELECT DISTINCT role from mf_admin_access";
$stmt = $db->execute($sql);
return $stmt->FetchAllAssoc();
}
public static function UpdateAvatar($id, $files) {
$filename = PhotoDAL::SimplePhotoUpload($files, "avatar", 100, 100, 90, "_$id");
$db = Registry::Get('db');
$sql = "UPDATE " . self::GetObjClassTable() . " set avatar=:*#1#* WHERE " . self::GetObjClassTablePK() . "=:*#2#*";
$stmt = $db->prepare($sql)
->bindParam("*#1#*", $filename)
->bindParam("*#2#*", $id)
->execute();
}
/**
* Zmiana hasla
*
* @param integer $id
* @param string $password
* @param string $oldPassword
*/
public static function UpdatePassword($id, $password, $oldPassword = null) {
$db = Registry::Get('db');
$sql = "UPDATE " . self::GetObjClassTable() . " set password=:1 WHERE " . self::GetObjClassTablePK() . "=:2";
$stmt = $db->prepare($sql)
->bindParam(1, $password)
->bindParam(2, $id)
->bindParam(3, $oldPassword)
->execute();
}
public static function CheckPassword($id, $password) {
$db = Registry::Get('db');
$sql = "select count(*) from " . self::GetObjClassTable() . " WHERE password=:1 AND " . self::GetObjClassTablePK() . "=:2";
$stmt = $db->prepare($sql)
->bindParam(1, $password)
->bindParam(2, $id)
->execute();
$result = $stmt->FetchRow();
return $result[0];
}
public static function DoActivity($obj) {
$db = Registry::Get('db');
$sql = "UPDATE " . self::GetObjClassTable() . " SET last_activity = NOW() WHERE " . self::GetObjClassTablePK() . "=:*#1#*";
$stmt = $db->prepare($sql)
->bindParam('*#1#*', $obj->GetId())
->execute();
return $obj->GetId();
}
public static function GetResultByLink($table, $id, $data = array(), $limit = 0, $sortBy = null, $count = null) {
if (!is_array($data)) {
$data = array();
}
$db = Registry::Get('db');
if ($count == true)
$select = 'count(*) as count';
else
$select = " " . SQL::ToSelect('Admin') . " ";
$sql = " SELECT $select FROM " . self::GetObjClassTable() . " INNER JOIN mf_link ON " . self::GetObjClassTable() . "." . self::GetObjClassTablePK() . "=mf_link.id_destination WHERE mf_link.destination_type='" . self::GetObjClassTable() . "' AND mf_link.source_type='$table' AND mf_link.id_source=$id ";
foreach ($data as $key => $value) {
if ($key == "id")
$key = 'id_mf_admin';
if (is_array($value))
$sql .= ( is_numeric($value['value']) || $value ? " AND " . $key . " " . $value['condition'] . " " . $value['value'] : "");
else
$sql .= ( is_numeric($value) || $value ? " AND " . $key . " = " . $value : "");
}
$sql .= ( trim($sortBy) ? " ORDER BY $sortBy " : "") .
( $limit ? " LIMIT " . $limit : "") .
" ";
$stmt = $db->prepare($sql)
->execute();
$array = $stmt->fetchAllAssoc();
if ($count == true)
return $array[0]['count'];
$done = array();
for ($i = 0; $i < count($array); $i++) {
$obj = new Admin();
$obj->FromArray($array[$i], 1);
$done[$obj->GetId()] = $obj;
}
return $done;
}
public static function GetLinkedProfiles($id, $limit) {
return self::GetResult(array(self::GetObjClassTablePK() => array('condition' => '<>', 'value' => $id)), array(), $limit);
}
public static function NewMessageNotify($userId, $subject = null, $sender = null, $smarty, $messageId = null) {
$admin = new Admin();
$admin = self::GetById($userId);
// $physSet = new ProfileSettings();
// $physSet = ProfileSettingsDAL::GetByAdminId($userId);
// if($physSet -> GetNotifyNewMessage() == 1){
$smarty->assign('msgId', $messageId);
$smarty->assign('subject', $subject);
$smarty->assign('sender', $sender);
$mail = new Mailer();
$mail->AddAddress($admin->GetEmail(), $admin->GetEmail());
$mail->SendEmail($smarty->fetch('partial/Mail/Newmessage.tpl'), '', 'Nowa wiadomość w Twojej skrzynce odbiorczej');
// }
}
}
?>

View File

@@ -0,0 +1,105 @@
<?
/**
* $Id: AuthDAL.mod.php 708 2008-06-26 13:48:43Z pawy $
* Klasa autoryzacji usera
*
*/
class AuthDAL {
/**
* Pusty konstruktor
*
*/
public function __construct() {
}
/**
* Sprawdza uzytkownika i haslo, loguje usera , zapisuje obiekt klasy User do sesji i zwraca 1/0
*
* @param string $login
* @param string $password
* @return boolean
*/
public static function Login($login, $password) {
$adminList = AdminDAL::GetResult(array("login" => $login, "password" => md5(trim($password))), array(), 1);
//Utils::ArrayDisplay($adminList);
if(!empty($adminList)) {
$admin = $adminList[0];
$admin->SetAuthorized(true);
$lastLogin = $admin->GetLastLogin();
$admin->SetLastLogin('NOW()');
AdminDAL::Save($admin);
$admin->SetLastLogin($lastLogin);
$admin->GetAccess();
SessionProxy::SetValue(EnumSessionValue::ADMIN_OBJECT, $admin);
return $admin->GetId();
} else {
return false;
}
}
/**
* Zwraca obiekt klasy User lub 0
*
* @return boolean
*/
public static function GetAdmin() {
$admin = SessionProxy::GetValue(EnumSessionValue::ADMIN_OBJECT);
$remember = Request::GetCookie('remember');
if(is_object($admin) ){
return $admin;
} else if(isset($remember) && $remember == '1'){
$adminList = AdminDAL::GetResult(array("hash" => Request::GetCookie('key')), array(), 1);
if(!empty($adminList)) {
$admin = $adminList[0];
$admin->SetAuthorized(true);
$admin->GetAccess();
Registry::Set('admin', $admin);
SessionProxy::SetValue(EnumSessionValue::ADMIN_OBJECT, $admin);
return $admin;
} else {
return false;
}
} else {
return false;
}
}
/**
* Przeladowuje uzytkownika w sesji
*
* @param
*/
public static function ReloadUser() {
$admin = SessionProxy::GetValue(EnumSessionValue::ADMIN_OBJECT);
$adminId = $admin->GetId();
$admin = AdminDAL::GetById($adminId);
$admin->GetAccess();
$admin->SetAuthorized(true);
SessionProxy::ClearValue(EnumSessionValue::ADMIN_OBJECT);
SessionProxy::SetValue(EnumSessionValue::ADMIN_OBJECT, $admin);
}
/**
* Czysci sesje wylogowujac usera
*
*/
public static function Logout() {
SessionProxy::ClearValue(EnumSessionValue::ADMIN_OBJECT);
}
}
?>

View File

@@ -0,0 +1,34 @@
<?
/**
* $Id$
* Paramerty chache dla poszczegolnych elementow
*
*/
class CacheParam {
/**
* Globalny parametr uzywany wszedzie tam, gdzie nie jest zdefiniowane inaczej
*
* @var unknown_type
*/
public static $global = '30';
/**
* Metoda do pobierania konkretnego parametru
*
* @param string $param
* @return int
*/
public static function Get($param) {
if(isset(self::$$param)) {
return self::$$param;
}
else {
return self::$global;
}
}
}
?>

View File

@@ -0,0 +1,68 @@
<?php
/**
* Class for parsing BBCode
*
* This class can be use for parsing common BBCode tags.
*
* @license GNU General Public License
* @author Nikola Posa, www.nikolaposa.in.rs
*/
class LightBBCodeParser {
//array of bbcode patterns
protected $patterns = array
(
'/\n/Ui',
'/\[b\]/Ui',
'/\[\/b\]/Ui',
'/\[i\]/Ui',
'/\[\/i\]/Ui',
'/\[u\]/Ui',
'/\[\/u\]/Ui',
'/\[s\]/Ui',
'/\[\/s\]/Ui',
'/\[size=([0-9]+)\]/Ui',
'/\[\/size\]/Ui',
'/\[url=([^\]]+)\](.*?)\[\/url\]/Ui',
'/\[url\](.*?)\[\/url\]/Ui',
'/\[img\](.*?)\[\/img\]/Ui',
'/\[color=([^\]]*?)\]([^\[]*?)\[\/color\]/Ui',
'/\[code\](.*?)\[\/code\]/Ui',
'/\[quote.*?\](.*?)\[\/quote\]/Ui'
);
//array of HTML tags that correspond to bbcode patterns
protected $replacements = array
(
'<br />',
'<span class="bbcodeB">',
'</span>',
'<span class="bbcodeI">',
'</span>',
'<span class="bbcodeU">',
'</span>',
'<span class="bbcodeS">',
'</span>',
'<span style="font-size: \1px;">',
'</span>',
'<a href="\1">\2</a>',
'<a href="\1">\1</a>',
'<img src="\1" />',
'<span style="color: \1">\2</span>',
'<span class="bbcodeCode">\1</span>',
'<span class="bbcodeQuote">\1</span>'
);
/**
* This function converts bbcode to (x)HTML tags.
*
* @param string Text that will be parsed.
* @return string
*/
public function bbc2html($subject){
$subject = preg_replace($this->patterns, $this->replacements, $subject);
return $subject;
}
}
?>

View File

@@ -0,0 +1,24 @@
#
# Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
# For licensing, see LICENSE.html or http://ckeditor.com/license
#
#
# On some specific Linux installations you could face problems with Firefox.
# It could give you errors when loading the editor saying that some illegal
# characters were found (three strange chars in the beginning of the file).
# This could happen if you map the .js or .css files to PHP, for example.
#
# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files.
# All FCKeditor files are Unicode encoded.
#
AddType application/x-javascript .js
AddType text/css .css
#
# If PHP is mapped to handle XML files, you could have some issues. The
# following will disable it.
#
AddType text/xml .xml

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,671 @@
CKEditor 4 Changelog
====================
## CKEditor 4.4.5
New Features:
* [#12279](http://dev.ckeditor.com/ticket/12279): Added a possibility to pass a custom evaluator to [`node.getAscendant()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.node-method-getAscendant).
Fixed Issues:
* [#12423](http://dev.ckeditor.com/ticket/12423): [Safari7.1+] Fixed: *Enter* key moved cursor to a strange position.
* [#12381](http://dev.ckeditor.com/ticket/12381): [iOS] Fixed: Selection issue. Thanks to [Remiremi](https://github.com/Remiremi)!
* [#10804](http://dev.ckeditor.com/ticket/10804): Fixed: `CKEDITOR_GETURL` is not used with some plugins where it should be used. Thanks to [Thomas Andraschko](https://github.com/tandraschko)!
* [#9137](http://dev.ckeditor.com/ticket/9137): Fixed: The `<base>` tag is not created when `<head>` has an attribute. Thanks to [naoki.fujikawa](https://github.com/naoki-fujikawa)!
* [#12377](http://dev.ckeditor.com/ticket/12377): Fixed: Errors thrown in the [Image](http://ckeditor.com/addon/image) plugin when removing preview from the dialog window definition. Thanks to [Axinet](https://github.com/Axinet)!
* [#12162](http://dev.ckeditor.com/ticket/12162): Fixed: Auto paragraphing and *Enter* key in nested editables.
* [#12315](http://dev.ckeditor.com/ticket/12315): Fixed: Marked [`config.autoParagraph`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoParagraph) as deprecated.
* [#12113](http://dev.ckeditor.com/ticket/12113): Fixed: A [code snippet](http://ckeditor.com/addon/codesnippet) should be presented in the [elements path](http://ckeditor.com/addon/elementspath) as "code snippet" (translatable).
* [#12311](http://dev.ckeditor.com/ticket/12311): Fixed: [Remove Format](http://ckeditor.com/addon/removeformat) should also remove `<cite>` elements.
* [#12261](http://dev.ckeditor.com/ticket/12261): Fixed: Filter has to be destroyed and removed from [`CKEDITOR.filter.instances`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter-static-property-instances) on editor destroy.
* [#12398](http://dev.ckeditor.com/ticket/12398): Fixed: [Maximize](http://ckeditor.com/addon/maximize) does not work on an instance without a [title](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-title).
* [#12097](http://dev.ckeditor.com/ticket/12097): Fixed: JAWS not reading the number of options correctly in the [Text Color and Background Color](http://ckeditor.com/addon/colorbutton) button menu.
* [#12411](http://dev.ckeditor.com/ticket/12411): Fixed: [Page Break](http://ckeditor.com/addon/pagebreak) used directly in the editable breaks the editor.
* [#12354](http://dev.ckeditor.com/ticket/12354): Fixed: Various issues in undo manager when holding keys.
* [#12324](http://dev.ckeditor.com/ticket/12324): [IE8] Fixed: Undo steps are not recorded when changing the caret position by clicking below the body.
* [#12332](http://dev.ckeditor.com/ticket/12332): Fixed: Lowered DOM events listeners' priorities in undo manager in order to avoid ambiguity.
* [#12402](http://dev.ckeditor.com/ticket/12402): [Blink] Fixed: Workaround for Blink bug with `document.title` which breaks updating title in the full HTML mode.
* [#12338](http://dev.ckeditor.com/ticket/12338): Fixed: The CKEditor package contains unoptimized images.
## CKEditor 4.4.4
Fixed Issues:
* [#12268](http://dev.ckeditor.com/ticket/12268): Cleanup of [UI Color](http://ckeditor.com/addon/uicolor) YUI styles. Thanks to [CasherWest](https://github.com/CasherWest)!
* [#12263](http://dev.ckeditor.com/ticket/12263): Fixed: [Paste from Word]((http://ckeditor.com/addon/pastefromword)) filter does not properly normalize semicolons style text. Thanks to [Alin Purcaru](https://github.com/mesmerizero)!
* [#12243](http://dev.ckeditor.com/ticket/12243): Fixed: Text formatting lost when pasting from Word. Thanks to [Alin Purcaru](https://github.com/mesmerizero)!
* [#111739](http://dev.ckeditor.com/ticket/11739): Fixed: `keypress` listeners should not be used in the undo manager. A complete rewrite of keyboard handling in the undo manager was made. Numerous smaller issues were fixed, among others:
* [#10926](http://dev.ckeditor.com/ticket/10926): [Chrome@Android] Fixed: Typing does not record snapshots and does not fire the [`editor.change`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change) event.
* [#11611](http://dev.ckeditor.com/ticket/11611): [Firefox] Fixed: The [`editor.change`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change) event is fired when pressing Arrow keys.
* [#12219](http://dev.ckeditor.com/ticket/12219): [Safari] Fixed: Some modifications of the [`UndoManager.locked`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.undo.UndoManager-property-locked) property violate strict mode in the [Undo](http://ckeditor.com/addon/undo) plugin.
* [#10916](http://dev.ckeditor.com/ticket/10916): Fixed: [Magic Line](http://ckeditor.com/addon/magicline) icon in Right-To-Left environments.
* [#11970](http://dev.ckeditor.com/ticket/11970): [IE] Fixed: CKEditor `paste` event is not fired when pasting with *Shift+Ins*.
* [#12111](http://dev.ckeditor.com/ticket/12111): Fixed: Linked image attributes are not read when opening the image dialog window by doubleclicking.
* [#10030](http://dev.ckeditor.com/ticket/10030): [IE] Fixed: Prevented "Unspecified Error" thrown in various cases when IE8-9 does not allow access to `document.activeElement`.
* [#12273](http://dev.ckeditor.com/ticket/12273): Fixed: Applying block style in a description list breaks it.
* [#12218](http://dev.ckeditor.com/ticket/12218): Fixed: Minor syntax issue in CSS files.
* [#12178](http://dev.ckeditor.com/ticket/12178): [Blink/WebKit] Fixed: Iterator does not return the block if the selection is located at the end of it.
* [#12185](http://dev.ckeditor.com/ticket/12185): [IE9QM] Fixed: Error thrown when moving the mouse over focused editor's scrollbar.
* [#12215](http://dev.ckeditor.com/ticket/12215): Fixed: Basepath resolution does not recognize semicolon as a query separator.
* [#12135](http://dev.ckeditor.com/ticket/12135): Fixed: [Remove Format](http://ckeditor.com/addon/removeformat) does not work on widgets.
* [#12298](http://dev.ckeditor.com/ticket/12298): [IE11] Fixed: Clicking below `<body>` in Compatibility Mode will no longer reset selection to the first line.
* [#12204](http://dev.ckeditor.com/ticket/12204): Fixed: Editor's voice label is not affected by [`config.title`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-title).
* [#11915](http://dev.ckeditor.com/ticket/11915): Fixed: With [SCAYT](http://ckeditor.com/addon/scayt) enabled, cursor moves to the beginning of the first highlighted, misspelled word after typing or pasting into the editor.
* [SCAYT](https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/69): Fixed: Error thrown in the console after enabling [SCAYT](http://ckeditor.com/addon/scayt) and trying to add a new image.
Other Changes:
* [#12296](http://dev.ckeditor.com/ticket/12296): Merged `benderjs-ckeditor` into the main CKEditor repository.
## CKEditor 4.4.3
**Security Updates:**
* Fixed XSS vulnerability in the Preview plugin reported by Mario Heiderich of [Cure53](https://cure53.de/).
**An upgrade is highly recommended!**
New Features:
* [#12164](http://dev.ckeditor.com/ticket/12164): Added the "Justify" option to the "Horizontal Alignment" drop-down in the Table Cell Properties dialog window.
Fixed Issues:
* [#12110](http://dev.ckeditor.com/ticket/12110): Fixed: Editor crash after deleting a table. Thanks to [Alin Purcaru](https://github.com/mesmerizero)!
* [#11897](http://dev.ckeditor.com/ticket/11897): Fixed: **Enter** key used in an empty list item creates a new line instead of breaking the list. Thanks to [noam-si](https://github.com/noam-si)!
* [#12140](http://dev.ckeditor.com/ticket/12140): Fixed: Double-clicking linked widgets opens two dialog windows.
* [#12132](http://dev.ckeditor.com/ticket/12132): Fixed: Image is inserted with `width` and `height` styles even when they are not allowed.
* [#9317](http://dev.ckeditor.com/ticket/9317): [IE] Fixed: [`config.disableObjectResizing`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-disableObjectResizing) does not work on IE. **Note**: We were not able to fix this issue on IE11+ because necessary events stopped working. See a [last resort workaround](http://dev.ckeditor.com/ticket/9317#comment:16) and make sure to [support our complaint to Microsoft](https://connect.microsoft.com/IE/feedback/details/742593/please-respect-execcommand-enableobjectresizing-in-contenteditable-elements).
* [#9638](http://dev.ckeditor.com/ticket/9638): Fixed: There should be no information about accessibility help available under the *Alt+0* keyboard shortcut if the [Accessibility Help](http://ckeditor.com/addon/a11yhelp) plugin is not available.
* [#8117](http://dev.ckeditor.com/ticket/8117) and [#9186](http://dev.ckeditor.com/ticket/9186): Fixed: In HTML5 `<meta>` tags should be allowed everywhere, including inside the `<body>` element.
* [#10422](http://dev.ckeditor.com/ticket/10422): Fixed: [`config.fillEmptyBlocks`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fillEmptyBlocks) not working properly if a function is specified.
## CKEditor 4.4.2
Important Notes:
* The CKEditor testing environment is now publicly available. Read more about how to set up the environment and execute tests in the [CKEditor Testing Environment](http://docs.ckeditor.com/#!/guide/dev_tests) guide.
Please note that the [`tests/`](https://github.com/ckeditor/ckeditor-dev/tree/master/tests) directory which contains editor tests is not available in release packages. It can only be found in the development version of CKEditor on [GitHub](https://github.com/ckeditor/ckeditor-dev/).
New Features:
* [#11909](http://dev.ckeditor.com/ticket/11909): Introduced a parameter to prevent the [`editor.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData) method from recording undo snapshots.
Fixed Issues:
* [#11757](http://dev.ckeditor.com/ticket/11757): Fixed: Imperfections in the [Moono](http://ckeditor.com/addon/moono) skin. Thanks to [danyaPostfactum](https://github.com/danyaPostfactum)!
* [#10091](http://dev.ckeditor.com/ticket/10091): Blockquote should be treated like an object by the styles system. Thanks to [dan-james-deeson](https://github.com/dan-james-deeson)!
* [#11478](http://dev.ckeditor.com/ticket/11478): Fixed: Issue with passing jQuery objects to [adapter](http://docs.ckeditor.com/#!/guide/dev_jquery) configuration.
* [#10867](http://dev.ckeditor.com/ticket/10867): Fixed: Issue with setting encoded URI as image link.
* [#11983](http://dev.ckeditor.com/ticket/11983): Fixed: Clicking a nested widget does not focus it. Additionally, performance of the [`widget.repository.getByElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-getByElement) method was improved.
* [#12000](http://dev.ckeditor.com/ticket/12000): Fixed: Nested widgets should be initialized on [`editor.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData) and [`nestedEditable.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.nestedEditable-method-setData).
* [#12022](http://dev.ckeditor.com/ticket/12022): Fixed: Outer widget's drag handler is not created at all if it has any nested widgets inside.
* [#11960](http://dev.ckeditor.com/ticket/11960): [Blink/WebKit] Fixed: The caret should be scrolled into view on *Backspace* and *Delete* (covers only the merging blocks case).
* [#11306](http://dev.ckeditor.com/ticket/11306): [OSX][Blink/WebKit] Fixed: No widget entries in the context menu on widget right-click.
* [#11957](http://dev.ckeditor.com/ticket/11957): Fixed: Alignment labels in the [Enhanced Image](http://ckeditor.com/addon/image2) dialog window are not translated.
* [#11980](http://dev.ckeditor.com/ticket/11980): [Blink/WebKit] Fixed: `<span>` elements created when joining adjacent elements (non-collapsed selection).
* [#12009](http://dev.ckeditor.com/ticket/12009): [Nested widgets] Integration with the [Magic Line](http://ckeditor.com/addon/magicline) plugin.
* [#11387](http://dev.ckeditor.com/ticket/11387): Fixed: `role="radiogroup"` should be applied only to radio inputs' container.
* [#7975](http://dev.ckeditor.com/ticket/7975): [IE8] Fixed: Errors when trying to select an empty table cell.
* [#11947](http://dev.ckeditor.com/ticket/11947): [Firefox+IE11] Fixed: *Shift+Enter* in lists produces two line breaks.
* [#11972](http://dev.ckeditor.com/ticket/11972): Fixed: Feature detection in the [`element.setText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-setText) method should not trigger the layout engine.
* [#7634](http://dev.ckeditor.com/ticket/7634): Fixed: The [Flash Dialog](http://ckeditor.com/addon/flash) plugin omits the `allowFullScreen` parameter in the editor data if set to `true`.
* [#11910](http://dev.ckeditor.com/ticket/11910): Fixed: [Enhanced Image](http://ckeditor.com/addon/image2) does not take [`config.baseHref`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-baseHref) into account when updating image dimensions.
* [#11753](http://dev.ckeditor.com/ticket/11753): Fixed: Wrong [`checkDirty()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty) method value after focusing or blurring a widget.
* [#11830](http://dev.ckeditor.com/ticket/11830): Fixed: Impossible to pass some arguments to [CKBuilder](https://github.com/ckeditor/ckbuilder) when using the `/dev/builder/build.sh` script.
* [#11945](http://dev.ckeditor.com/ticket/11945): Fixed: [Form Elements](http://ckeditor.com/addon/forms) plugin should not change a core method.
* [#11384](http://dev.ckeditor.com/ticket/11384): [IE9+] Fixed: `IndexSizeError` thrown when pasting into a non-empty selection anchored in one text node.
## CKEditor 4.4.1
New Features:
* [#9661](http://dev.ckeditor.com/ticket/9661): Added the option to [configure](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-linkJavaScriptLinksAllowed) anchor tags with JavaScript code in the `href` attribute.
Fixed Issues:
* [#11861](http://dev.ckeditor.com/ticket/11861): [Webkit/Blink] Fixed: Span elements created while joining adjacent elements. **Note:** This patch only covers cases when *Backspace* or *Delete* is pressed on a collapsed (empty) selection. The remaining case, with a non-empty selection, will be fixed in the next release.
* [#10714](http://dev.ckeditor.com/ticket/10714): [iOS] Fixed: Selection and drop-downs are broken if a touch event listener is used due to a [Webkit bug](https://bugs.webkit.org/show_bug.cgi?id=128924). Thanks to [Arty Gus](https://github.com/artygus)!
* [#11911](http://dev.ckeditor.com/ticket/11911): Fixed setting the `dir` attribute for a preloaded language in [CKEDITOR.lang](http://docs.ckeditor.com/#!/api/CKEDITOR.lang). Thanks to [Akash Mohapatra](https://github.com/akashmohapatra)!
* [#11926](http://dev.ckeditor.com/ticket/11926): Fixed: [Code Snippet](http://ckeditor.com/addon/codesnippet) does not decode HTML entities when loading code from the `<code>` element.
* [#11223](http://dev.ckeditor.com/ticket/11223): Fixed: Issue when [Protected Source](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-protectedSource) was not working in the `<title>` element.
* [#11859](http://dev.ckeditor.com/ticket/11859): Fixed: Removed the [Source Dialog](http://ckeditor.com/addon/sourcedialog) plugin dependency from the [Code Snippet](http://ckeditor.com/addon/codesnippet) sample.
* [#11754](http://dev.ckeditor.com/ticket/11754): [Chrome] Fixed: Infinite loop when content includes not closed attributes.
* [#11848](http://dev.ckeditor.com/ticket/11848): [IE] Fixed: [`editor.insertElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertElement) throwing an exception when there was no selection in the editor.
* [#11801](http://dev.ckeditor.com/ticket/11801): Fixed: Editor anchors unavailable when linking the [Enhanced Image](http://ckeditor.com/addon/image2) widget.
* [#11626](http://dev.ckeditor.com/ticket/11626): Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) sets invalid column width.
* [#11872](http://dev.ckeditor.com/ticket/11872): Made [`element.addClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-addClass) chainable symmetrically to [`element.removeClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-removeClass).
* [#11813](http://dev.ckeditor.com/ticket/11813): Fixed: Link lost while pasting a captioned image and restoring an undo snapshot ([Enhanced Image](http://ckeditor.com/addon/image2)).
* [#11814](http://dev.ckeditor.com/ticket/11814): Fixed: _Link_ and _Unlink_ entries persistently displayed in the [Enhanced Image](http://ckeditor.com/addon/image2) context menu.
* [#11839](http://dev.ckeditor.com/ticket/11839): [IE9] Fixed: The caret jumps out of the editable area when resizing the editor in the source mode.
* [#11822](http://dev.ckeditor.com/ticket/11822): [Webkit] Fixed: Editing anchors by double-click is broken in some cases.
* [#11823](http://dev.ckeditor.com/ticket/11823): [IE8] Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) throws an error over scrollbar.
* [#11788](http://dev.ckeditor.com/ticket/11788): Fixed: It is not possible to change the language back to _Not set_ in the [Code Snippet](http://ckeditor.com/addon/codesnippet) dialog window.
* [#11788](http://dev.ckeditor.com/ticket/11788): Fixed: [Filter](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.filter) rules are not applied inside elements with the `contenteditable` attribute set to `true`.
* [#11798](http://dev.ckeditor.com/ticket/11798): Fixed: Inserting a non-editable element inside a table cell breaks the table.
* [#11793](http://dev.ckeditor.com/ticket/11793): Fixed: Drop-down is not "on" when clicking it while the editor is blurred.
* [#11850](http://dev.ckeditor.com/ticket/11850): Fixed: Fake objects with the `contenteditable` attribute set to `false` are not downcasted properly.
* [#11811](http://dev.ckeditor.com/ticket/11811): Fixed: Widget's data is not encoded correctly when passed to an attribute.
* [#11777](http://dev.ckeditor.com/ticket/11777): Fixed encoding ampersand in the [Mathematical Formulas](http://ckeditor.com/addon/mathjax) plugin.
* [#11880](http://dev.ckeditor.com/ticket/11880): [IE8-9] Fixed: Linked image has a default thick border.
Other Changes:
* [#11807](http://dev.ckeditor.com/ticket/11807): Updated jQuery version used in the sample to 1.11.0 and tested CKEditor jQuery Adapter with version 1.11.0 and 2.1.0.
* [#9504](http://dev.ckeditor.com/ticket/9504): Stopped using deprecated `attribute.specified` in all browsers except Internet Explorer.
* [#11809](http://dev.ckeditor.com/ticket/11809): Changed tab size in `<pre>` to 4 spaces.
## CKEditor 4.4
**Important Notes:**
* Marked the [`editor.beforePaste`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-beforePaste) event as deprecated.
* The default class of captioned images has changed to `image` (was: `caption`). Please note that once edited in CKEditor 4.4+, all existing images of the `caption` class (`<figure class="caption">`) will be [filtered out](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) unless the [`config.image2_captionedClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-image2_captionedClass) option is set to `caption`. For backward compatibility (i.e. when upgrading), it is highly recommended to use this setting, which also helps prevent CSS conflicts, etc. This does not apply to new CKEditor integrations.
* Widgets without defined buttons are no longer registered automatically to the [Advanced Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter). Before CKEditor 4.4 widgets were registered to the ACF which was an incorrect behavior ([#11567](http://dev.ckeditor.com/ticket/11567)). This change should not have any impact on standard scenarios, but if your button does not execute the widget command, you need to set [`allowedContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.feature-property-allowedContent) and [`requiredContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.feature-property-requiredContent) properties for it manually, because the editor will not be able to find them.
* The [Show Borders](http://ckeditor.com/addon/showborders) plugin was added to the Standard installation package in order to ensure that unstyled tables are still visible for the user ([#11665](http://dev.ckeditor.com/ticket/11665)).
* Since CKEditor 4.4 the editor instance should be passed to [`CKEDITOR.style`](http://docs.ckeditor.com/#!/api/CKEDITOR.style) methods to ensure full compatibility with other features (e.g. applying styles to widgets requires that). We ensured backward compatibility though, so the [`CKEDITOR.style`](http://docs.ckeditor.com/#!/api/CKEDITOR.style) will work even when the editor instance is not provided.
New Features:
* [#11297](http://dev.ckeditor.com/ticket/11297): Styles can now be applied to widgets. The definition of a style which can be applied to a specific widget must contain two additional properties &mdash; `type` and `widget`. Read more in the [Widget Styles](http://docs.ckeditor.com/#!/guide/dev_styles-section-widget-styles) section of the "Syles Drop-down" guide. Note that by default, widgets support only classes and no other attributes or styles. Related changes and features:
* Introduced the [`CKEDITOR.style.addCustomHandler()`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-static-method-addCustomHandler) method for registering custom style handlers.
* The [`CKEDITOR.style.apply()`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-apply) and [`CKEDITOR.style.remove()`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-remove) methods are now called with an editor instance instead of the document so they can be reused by the [`CKEDITOR.editor.applyStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-applyStyle) and [`CKEDITOR.editor.removeStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-removeStyle) methods. Backward compatibility was preserved, but from CKEditor 4.4 it is highly recommended to pass an editor instead of a document to these methods.
* Many new methods and properties were introduced in the [Widget API](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget) to make the handling of styles by widgets fully customizable. See: [`widget.definition.styleableElements`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.definition-property-styleableElements), [`widget.definition.styleToAllowedContentRule`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.definition-property-styleToAllowedContentRules), [`widget.addClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-addClass), [`widget.removeClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-removeClass), [`widget.getClasses()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-getClasses), [`widget.hasClass()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-hasClass), [`widget.applyStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-applyStyle), [`widget.removeStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-removeStyle), [`widget.checkStyleActive()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-method-checkStyleActive).
* Integration with the [Allowed Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) required an introduction of the [`CKEDITOR.style.toAllowedContent()`](http://docs.ckeditor.com/#!/api/CKEDITOR.style-method-toAllowedContentRules) method which can be implemented by the custom style handler and if exists, it is used by the [`CKEDITOR.filter`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter) to translate a style to [allowed content rules](http://docs.ckeditor.com/#!/api/CKEDITOR.filter.allowedContentRules).
* [#11300](http://dev.ckeditor.com/ticket/11300): Various changes in the [Enhanced Image](http://ckeditor.com/addon/image2) plugin:
* Introduced the [`config.image2_captionedClass`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-image2_captionedClass) option to configure the class of captioned images.
* Introduced the [`config.image2_alignClasses`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-image2_alignClasses) option to configure the way images are aligned with CSS classes.
If this setting is defined, the editor produces classes instead of inline styles for aligned images.
* Default image caption can be translated (customized) with the `editor.lang.image2.captionPlaceholder` string.
* [#11341](http://dev.ckeditor.com/ticket/11341): [Enhanced Image](http://ckeditor.com/addon/image2) plugin: It is now possible to add a link to any image type.
* [#10202](http://dev.ckeditor.com/ticket/10202): Introduced wildcard support in the [Allowed Content Rules](http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules) format.
* [#10276](http://dev.ckeditor.com/ticket/10276): Introduced blacklisting in the [Allowed Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter).
* [#10480](http://dev.ckeditor.com/ticket/10480): Introduced code snippets with code highlighting. There are two versions available so far &mdash; the default [Code Snippet](http://ckeditor.com/addon/codesnippet) which uses the [highlight.js](http://highlightjs.org) library and the [Code Snippet GeSHi](http://ckeditor.com/addon/codesnippetgeshi) which uses the [GeSHi](http://qbnz.com/highlighter/) library.
* [#11737](http://dev.ckeditor.com/ticket/11737): Introduced an option to prevent [filtering](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) of an element that matches custom criteria (see [`filter.addElementCallback()`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addElementCallback)).
* [#11532](http://dev.ckeditor.com/ticket/11532): Introduced the [`editor.addContentsCss()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-addContentsCss) method that can be used for [adding custom CSS files](http://docs.ckeditor.com/#!/guide/plugin_sdk_styles).
* [#11536](http://dev.ckeditor.com/ticket/11536): Added the [`CKEDITOR.tools.htmlDecode()`](http://docs.ckeditor.com/#!/api/CKEDITOR.tools-method-htmlDecode) method for decoding HTML entities.
* [#11225](http://dev.ckeditor.com/ticket/11225): Introduced the [`CKEDITOR.tools.transparentImageData`](http://docs.ckeditor.com/#!/api/CKEDITOR.tools-property-transparentImageData) property which contains transparent image data to be used in CSS or as image source.
Other Changes:
* [#11377](http://dev.ckeditor.com/ticket/11377): Unified internal representation of empty anchors using the [fake objects](http://ckeditor.com/addon/fakeobjects).
* [#11422](http://dev.ckeditor.com/ticket/11422): Removed Firefox 3.x, Internet Explorer 6 and Opera 12.x leftovers in code.
* [#5217](http://dev.ckeditor.com/ticket/5217): Setting data (including switching between modes) creates a new undo snapshot. Besides that:
* Introduced the [`editable.status`](http://docs.ckeditor.com/#!/api/CKEDITOR.editable-property-status) property.
* Introduced a new `forceUpdate` option for the [`editor.lockSnapshot`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-lockSnapshot) event.
* Fixed: Selection not being unlocked in inline editor after setting data ([#11500](http://dev.ckeditor.com/ticket/11500)).
* The [WebSpellChecker](http://ckeditor.com/addon/wsc) plugin was updated to the latest version.
Fixed Issues:
* [#10190](http://dev.ckeditor.com/ticket/10190): Fixed: Removing block style with [`editor.removeStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-removeStyle) should result in a paragraph and not a div.
* [#11727](http://dev.ckeditor.com/ticket/11727): Fixed: The editor tries to select a non-editable image which was clicked.
## CKEditor 4.3.5
New Features:
* Added new translation: Tatar.
Fixed Issues:
* [#11677](http://dev.ckeditor.com/ticket/11677): Fixed: Undo/Redo keystrokes are blocked in the source mode.
* [#11717](http://dev.ckeditor.com/ticket/11717): [Document Properties](http://ckeditor.com/addon/docprops) plugin requires the [Color Dialog](http://ckeditor.com/addon/colordialog) plugin to work.
## CKEditor 4.3.4
Fixed Issues:
* [#11597](http://dev.ckeditor.com/ticket/11597): [IE11] Fixed: Error thrown when trying to open the [preview](http://ckeditor.com/addon/preview) using the keyboard.
* [#11544](http://dev.ckeditor.com/ticket/11544): [Placeholders](http://ckeditor.com/addon/placeholder) will no longer be upcasted in parents not accepting `<span>` elements.
* [#8663](http://dev.ckeditor.com/ticket/8663): Fixed [`element.renameNode()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-renameNode) not clearing the [`element.getName()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-getName) cache.
* [#11574](http://dev.ckeditor.com/ticket/11574): Fixed: *Backspace* destroying the DOM structure if an inline editable is placed in a list item.
* [#11603](http://dev.ckeditor.com/ticket/11603): Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) attaches to tables outside the editable.
* [#9205](http://dev.ckeditor.com/ticket/9205), [#7805](http://dev.ckeditor.com/ticket/7805), [#8216](http://dev.ckeditor.com/ticket/8216): Fixed: `{cke_protected_1}` appearing in data in various cases where HTML comments are placed next to `"` or `'`.
* [#11635](http://dev.ckeditor.com/ticket/11635): Fixed: Some attributes are not protected before the content is passed through the fix bin.
* [#11660](http://dev.ckeditor.com/ticket/11660): [IE] Fixed: Table content is lost when some extra markup is inside the table.
* [#11641](http://dev.ckeditor.com/ticket/11641): Fixed: Switching between modes in the classic editor removes content styles for the inline editor.
* [#11568](http://dev.ckeditor.com/ticket/11568): Fixed: [Styles](http://ckeditor.com/addon/stylescombo) drop-down list is not enabled on selection change.
## CKEditor 4.3.3
Fixed Issues:
* [#11500](http://dev.ckeditor.com/ticket/11500): [Webkit/Blink] Fixed: Selection lost when setting data in another inline editor. Additionally, [`selection.removeAllRanges()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.selection-method-removeAllRanges) is now scoped to selection's [root](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.selection-property-root).
* [#11104](http://dev.ckeditor.com/ticket/11104): [IE] Fixed: Various issues with scrolling and selection when focusing widgets.
* [#11487](http://dev.ckeditor.com/ticket/11487): Moving mouse over the [Enhanced Image](http://ckeditor.com/addon/image2) widget will no longer change the value returned by the [`editor.checkDirty()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty) method.
* [#8673](http://dev.ckeditor.com/ticket/8673): [WebKit] Fixed: Cannot select and remove the [Page Break](http://ckeditor.com/addon/pagebreak).
* [#11413](http://dev.ckeditor.com/ticket/11413): Fixed: Incorrect [`editor.execCommand()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand) behavior.
* [#11438](http://dev.ckeditor.com/ticket/11438): Splitting table cells vertically is no longer changing table structure.
* [#8899](http://dev.ckeditor.com/ticket/8899): Fixed: Links in the [About CKEditor](http://ckeditor.com/addon/about) dialog window now open in a new browser window or tab.
* [#11490](http://dev.ckeditor.com/ticket/11490): Fixed: [Menu button](http://ckeditor.com/addon/menubutton) panel not showing in the source mode.
* [#11417](http://dev.ckeditor.com/ticket/11417): The [`widget.doubleclick`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget-event-doubleclick) event is not canceled anymore after editing was triggered.
* [#11253](http://dev.ckeditor.com/ticket/11253): [IE] Fixed: Clipped upload button in the [Enhanced Image](http://ckeditor.com/addon/image2) dialog window.
* [#11359](http://dev.ckeditor.com/ticket/11359): Standardized the way anchors are discovered by the [Link](http://ckeditor.com/addon/link) plugin.
* [#11058](http://dev.ckeditor.com/ticket/11058): [IE8] Fixed: Error when deleting a table row.
* [#11508](http://dev.ckeditor.com/ticket/11508): Fixed: [`htmlDataProcessor`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlDataProcessor) discovering protected attributes within other attributes' values.
* [#11533](http://dev.ckeditor.com/ticket/11533): Widgets: Avoid recurring upcasts if the DOM structure was modified during an upcast.
* [#11400](http://dev.ckeditor.com/ticket/11400): Fixed: The [`domObject.removeAllListeners()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.domObject-method-removeAllListeners) method does not remove custom listeners completely.
* [#11493](http://dev.ckeditor.com/ticket/11493): Fixed: The [`selection.getRanges()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.selection-method-getRanges) method does not override cached ranges when used with the `onlyEditables` argument.
* [#11390](http://dev.ckeditor.com/ticket/11390): [IE] All [XML](http://ckeditor.com/addon/xml) plugin [methods](http://docs.ckeditor.com/#!/api/CKEDITOR.xml) now work in IE10+.
* [#11542](http://dev.ckeditor.com/ticket/11542): [IE11] Fixed: Blurry toolbar icons when Right-to-Left UI language is set.
* [#11504](http://dev.ckeditor.com/ticket/11504): Fixed: When [`config.fullPage`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fullPage) is set to `true`, entities are not encoded in editor output.
* [#11004](http://dev.ckeditor.com/ticket/11004): Integrated [Enhanced Image](http://ckeditor.com/addon/image2) dialog window with [Advanced Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter).
* [#11439](http://dev.ckeditor.com/ticket/11439): Fixed: Properties get cloned in the Cell Properties dialog window if multiple cells are selected.
## CKEditor 4.3.2
Fixed Issues:
* [#11331](http://dev.ckeditor.com/ticket/11331): A menu button will have a changed label when selected instead of using the `aria-pressed` attribute.
* [#11177](http://dev.ckeditor.com/ticket/11177): Widget drag handler improvements:
* [#11176](http://dev.ckeditor.com/ticket/11176): Fixed: Initial position is not updated when the widget data object is empty.
* [#11001](http://dev.ckeditor.com/ticket/11001): Fixed: Multiple synchronous layout recalculations are caused by initial drag handler positioning causing performance issues.
* [#11161](http://dev.ckeditor.com/ticket/11161): Fixed: Drag handler is not repositioned in various situations.
* [#11281](http://dev.ckeditor.com/ticket/11281): Fixed: Drag handler and mask are duplicated after widget reinitialization.
* [#11207](http://dev.ckeditor.com/ticket/11207): [Firefox] Fixed: Misplaced [Enhanced Image](http://ckeditor.com/addon/image2) resizer in the inline editor.
* [#11102](http://dev.ckeditor.com/ticket/11102): `CKEDITOR.template` improvements:
* [#11102](http://dev.ckeditor.com/ticket/11102): Added newline character support.
* [#11216](http://dev.ckeditor.com/ticket/11216): Added "\\'" substring support.
* [#11121](http://dev.ckeditor.com/ticket/11121): [Firefox] Fixed: High Contrast mode is enabled when the editor is loaded in a hidden iframe.
* [#11350](http://dev.ckeditor.com/ticket/11350): The default value of [`config.contentsCss`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-contentsCss) is affected by [`CKEDITOR.getUrl()`](http://docs.ckeditor.com/#!/api/CKEDITOR-method-getUrl).
* [#11097](http://dev.ckeditor.com/ticket/11097): Improved the [Autogrow](http://ckeditor.com/addon/autogrow) plugin performance when dealing with very big tables.
* [#11290](http://dev.ckeditor.com/ticket/11290): Removed redundant code in the [Source Dialog](http://ckeditor.com/addon/sourcedialog) plugin.
* [#11133](http://dev.ckeditor.com/ticket/11133): [Page Break](http://ckeditor.com/addon/pagebreak) becomes editable if pasted.
* [#11126](http://dev.ckeditor.com/ticket/11126): Fixed: Native Undo executed once the bottom of the snapshot stack is reached.
* [#11131](http://dev.ckeditor.com/ticket/11131): [Div Editing Area](http://ckeditor.com/addon/divarea): Fixed: Error thrown when switching to source mode if the selection was in widget's nested editable.
* [#11139](http://dev.ckeditor.com/ticket/11139): [Div Editing Area](http://ckeditor.com/addon/divarea): Fixed: Elements Path is not cleared after switching to source mode.
* [#10778](http://dev.ckeditor.com/ticket/10778): Fixed a bug with range enlargement. The range no longer expands to visible whitespace.
* [#11146](http://dev.ckeditor.com/ticket/11146): [IE] Fixed: Preview window switches Internet Explorer to Quirks Mode.
* [#10762](http://dev.ckeditor.com/ticket/10762): [IE] Fixed: JavaScript code displayed in preview window's URL bar.
* [#11186](http://dev.ckeditor.com/ticket/11186): Introduced the [`widgets.repository.addUpcastCallback()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-addUpcastCallback) method that allows to block upcasting given element to a widget.
* [#11307](http://dev.ckeditor.com/ticket/11307): Fixed: Paste as Plain Text conflict with the [MooTools](http://mootools.net) library.
* [#11140](http://dev.ckeditor.com/ticket/11140): [IE11] Fixed: Anchors are not draggable.
* [#11379](http://dev.ckeditor.com/ticket/11379): Changed default contents `line-height` to unitless values to avoid huge text overlapping (like in [#9696](http://dev.ckeditor.com/ticket/9696)).
* [#10787](http://dev.ckeditor.com/ticket/10787): [Firefox] Fixed: Broken replacement of text while pasting into `div`-based editor.
* [#10884](http://dev.ckeditor.com/ticket/10884): Widgets integration with the [Show Blocks](http://ckeditor.com/addon/showblocks) plugin.
* [#11021](http://dev.ckeditor.com/ticket/11021): Fixed: An error thrown when selecting entire editable contents while fake selection is on.
* [#11086](http://dev.ckeditor.com/ticket/11086): [IE8] Re-enable inline widgets drag&drop in Internet Explorer 8.
* [#11372](http://dev.ckeditor.com/ticket/11372): Widgets: Special characters encoded twice in nested editables.
* [#10068](http://dev.ckeditor.com/ticket/10068): Fixed: Support for protocol-relative URLs.
* [#11283](http://dev.ckeditor.com/ticket/11283): [Enhanced Image](http://ckeditor.com/addon/image2): A `<div>` element with `text-align: center` and an image inside is not recognised correctly.
* [#11196](http://dev.ckeditor.com/ticket/11196): [Accessibility Instructions](http://ckeditor.com/addon/a11yhelp): Allowed additional keyboard button labels to be translated in the dialog window.
## CKEditor 4.3.1
**Important Notes:**
* To match the naming convention, the `language` button is now `Language` ([#11201](http://dev.ckeditor.com/ticket/11201)).
* [Enhanced Image](http://ckeditor.com/addon/image2) button, context menu, command, and icon names match those of the [Image](http://ckeditor.com/addon/image) plugin ([#11222](http://dev.ckeditor.com/ticket/11222)).
Fixed Issues:
* [#11244](http://dev.ckeditor.com/ticket/11244): Changed: The [`widget.repository.checkWidgets()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-checkWidgets) method now fires the [`widget.repository.checkWidgets`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-event-checkWidgets) event, so from CKEditor 4.3.1 it is preferred to use the method rather than fire the event.
* [#11171](http://dev.ckeditor.com/ticket/11171): Fixed: [`editor.insertElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertElement) and [`editor.insertText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText) methods do not call the [`widget.repository.checkWidgets()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-checkWidgets) method.
* [#11085](http://dev.ckeditor.com/ticket/11085): [IE8] Replaced preview generated by the [Mathematical Formulas](http://ckeditor.com/addon/mathjax) widget with a placeholder.
* [#11044](http://dev.ckeditor.com/ticket/11044): Enhanced WAI-ARIA support for the [Language](http://ckeditor.com/addon/language) plugin drop-down menu.
* [#11075](http://dev.ckeditor.com/ticket/11075): With drop-down menu button focused, pressing the *Down Arrow* key will now open the menu and focus its first option.
* [#11165](http://dev.ckeditor.com/ticket/11165): Fixed: The [File Browser](http://ckeditor.com/addon/filebrowser) plugin cannot be removed from the editor.
* [#11159](http://dev.ckeditor.com/ticket/11159): [IE9-10] [Enhanced Image](http://ckeditor.com/addon/image2): Fixed buggy discovery of image dimensions.
* [#11101](http://dev.ckeditor.com/ticket/11101): Drop-down lists no longer break when given double quotes.
* [#11077](http://dev.ckeditor.com/ticket/11077): [Enhanced Image](http://ckeditor.com/addon/image2): Empty undo step recorded when resizing the image.
* [#10853](http://dev.ckeditor.com/ticket/10853): [Enhanced Image](http://ckeditor.com/addon/image2): Widget has paragraph wrapper when de-captioning unaligned image.
* [#11198](http://dev.ckeditor.com/ticket/11198): Widgets: Drag handler is not fully visible when an inline widget is in a heading.
* [#11132](http://dev.ckeditor.com/ticket/11132): [Firefox] Fixed: Caret is lost after drag and drop of an inline widget.
* [#11182](http://dev.ckeditor.com/ticket/11182): [IE10-11] Fixed: Editor crashes (IE11) or works with minor issues (IE10) if a page is loaded in Quirks Mode. See [`env.quirks`](http://docs.ckeditor.com/#!/api/CKEDITOR.env-property-quirks) for more details.
* [#11204](http://dev.ckeditor.com/ticket/11204): Added `figure` and `figcaption` styles to the `contents.css` file so [Enhanced Image](http://ckeditor.com/addon/image2) looks nicer.
* [#11202](http://dev.ckeditor.com/ticket/11202): Fixed: No newline in [BBCode](http://ckeditor.com/addon/bbcode) mode.
* [#10890](http://dev.ckeditor.com/ticket/10890): Fixed: Error thrown when pressing the *Delete* key in a list item.
* [#10055](http://dev.ckeditor.com/ticket/10055): [IE8-10] Fixed: *Delete* pressed on a selected image causes the browser to go back.
* [#11183](http://dev.ckeditor.com/ticket/11183): Fixed: Inserting a horizontal rule or a table in multiple row selection causes a browser crash. Additionally, the [`editor.insertElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertElement) method does not insert the element into every range of a selection any more.
* [#11042](http://dev.ckeditor.com/ticket/11042): Fixed: Selection made on an element containing a non-editable element was not auto faked.
* [#11125](http://dev.ckeditor.com/ticket/11125): Fixed: Keyboard navigation through menu and drop-down items will now cycle.
* [#11011](http://dev.ckeditor.com/ticket/11011): Fixed: The [`editor.applyStyle()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-applyStyle) method removes attributes from nested elements.
* [#11179](http://dev.ckeditor.com/ticket/11179): Fixed: [`editor.destroy()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-destroy) does not cleanup content generated by the [Table Resize](http://ckeditor.com/addon/tableresize) plugin for inline editors.
* [#11237](http://dev.ckeditor.com/ticket/11237): Fixed: Table border attribute value is deleted when pasting content from Microsoft Word.
* [#11250](http://dev.ckeditor.com/ticket/11250): Fixed: HTML entities inside the `<textarea>` element are not encoded.
* [#11260](http://dev.ckeditor.com/ticket/11260): Fixed: Initially disabled buttons are not read by JAWS as disabled.
* [#11200](http://dev.ckeditor.com/ticket/11200): Added [Clipboard](http://ckeditor.com/addon/clipboard) plugin as a dependency for [Widget](http://ckeditor.com/addon/widget) to fix drag and drop.
## CKEditor 4.3
New Features:
* [#10612](http://dev.ckeditor.com/ticket/10612): Internet Explorer 11 support.
* [#10869](http://dev.ckeditor.com/ticket/10869): Widgets: Added better integration with the [Elements Path](http://ckeditor.com/addon/elementspath) plugin.
* [#10886](http://dev.ckeditor.com/ticket/10886): Widgets: Added tooltip to the drag handle.
* [#10933](http://dev.ckeditor.com/ticket/10933): Widgets: Introduced drag and drop of block widgets with the [Line Utilities](http://ckeditor.com/addon/lineutils) plugin.
* [#10936](http://dev.ckeditor.com/ticket/10936): Widget System changes for easier integration with other dialog systems.
* [#10895](http://dev.ckeditor.com/ticket/10895): [Enhanced Image](http://ckeditor.com/addon/image2): Added file browser integration.
* [#11002](http://dev.ckeditor.com/ticket/11002): Added the [`draggable`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.definition-property-draggable) option to disable drag and drop support for widgets.
* [#10937](http://dev.ckeditor.com/ticket/10937): [Mathematical Formulas](http://ckeditor.com/addon/mathjax) widget improvements:
* loading indicator ([#10948](http://dev.ckeditor.com/ticket/10948)),
* applying paragraph changes (like font color change) to iframe ([#10841](http://dev.ckeditor.com/ticket/10841)),
* Firefox and IE9 clipboard fixes ([#10857](http://dev.ckeditor.com/ticket/10857)),
* fixing same origin policy issue ([#10840](http://dev.ckeditor.com/ticket/10840)),
* fixing undo bugs ([#10842](http://dev.ckeditor.com/ticket/10842), [#10930](http://dev.ckeditor.com/ticket/10930)),
* fixing other minor bugs.
* [#10862](http://dev.ckeditor.com/ticket/10862): [Placeholder](http://ckeditor.com/addon/placeholder) plugin was rewritten as a widget.
* [#10822](http://dev.ckeditor.com/ticket/10822): Added styles system integration with non-editable elements (for example widgets) and their nested editables. Styles cannot change non-editable content and are applied in nested editable only if allowed by its type and content filter.
* [#10856](http://dev.ckeditor.com/ticket/10856): Menu buttons will now toggle the visibility of their panels when clicked multiple times. [Language](http://ckeditor.com/addon/language) plugin fixes: Added active language highlighting, added an option to remove the language.
* [#10028](http://dev.ckeditor.com/ticket/10028): New [`config.dialog_noConfirmCancel`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-dialog_noConfirmCancel) configuration option that eliminates the need to confirm closing of a dialog window when the user changed any of its fields.
* [#10848](http://dev.ckeditor.com/ticket/10848): Integrate remaining plugins ([Styles](http://ckeditor.com/addon/stylescombo), [Format](http://ckeditor.com/addon/format), [Font](http://ckeditor.com/addon/font), [Color Button](http://ckeditor.com/addon/colorbutton), [Language](http://ckeditor.com/addon/language) and [Indent](http://ckeditor.com/addon/indent)) with [active filter](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-activeFilter).
* [#10855](http://dev.ckeditor.com/ticket/10855): Change the extension of emoticons in the [BBCode](http://ckeditor.com/addon/bbcode) sample from GIF to PNG.
Fixed Issues:
* [#10831](http://dev.ckeditor.com/ticket/10831): [Enhanced Image](http://ckeditor.com/addon/image2): Merged `image2inline` and `image2block` into one `image2` widget.
* [#10835](http://dev.ckeditor.com/ticket/10835): [Enhanced Image](http://ckeditor.com/addon/image2): Improved visibility of the resize handle.
* [#10836](http://dev.ckeditor.com/ticket/10836): [Enhanced Image](http://ckeditor.com/addon/image2): Preserve custom mouse cursor while resizing the image.
* [#10939](http://dev.ckeditor.com/ticket/10939): [Firefox] [Enhanced Image](http://ckeditor.com/addon/image2): hovering the image causes it to change.
* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the [Enhanced Image](http://ckeditor.com/addon/image2) dialog window.
* [#10833](http://dev.ckeditor.com/ticket/10833): Fixed: *Lock ratio* option should be on by default in the [Enhanced Image](http://ckeditor.com/addon/image2) dialog window.
* [#10881](http://dev.ckeditor.com/ticket/10881): Various improvements to *Enter* key behavior in nested editables.
* [#10879](http://dev.ckeditor.com/ticket/10879): [Remove Format](http://ckeditor.com/addon/removeformat) should not leak from a nested editable.
* [#10877](http://dev.ckeditor.com/ticket/10877): Fixed: [WebSpellChecker](http://ckeditor.com/addon/wsc) fails to apply changes if a nested editable was focused.
* [#10877](http://dev.ckeditor.com/ticket/10877): Fixed: [SCAYT](http://ckeditor.com/addon/wsc) blocks typing in nested editables.
* [#11079](http://dev.ckeditor.com/ticket/11079): Add button icons to the [Placeholder](http://ckeditor.com/addon/placeholder) sample.
* [#10870](http://dev.ckeditor.com/ticket/10870): The `paste` command is no longer being disabled when the clipboard is empty.
* [#10854](http://dev.ckeditor.com/ticket/10854): Fixed: Firefox prepends `<br>` to `<body>`, so it is stripped by the HTML data processor.
* [#10823](http://dev.ckeditor.com/ticket/10823): Fixed: [Link](http://ckeditor.com/addon/link) plugin does not work with non-editable content.
* [#10828](http://dev.ckeditor.com/ticket/10828): [Magic Line](http://ckeditor.com/addon/magicline) integration with the Widget System.
* [#10865](http://dev.ckeditor.com/ticket/10865): Improved hiding copybin, so copying widgets works smoothly.
* [#11066](http://dev.ckeditor.com/ticket/11066): Widget's private parts use CSS reset.
* [#11027](http://dev.ckeditor.com/ticket/11027): Fixed: Block commands break on widgets; added the [`contentDomInvalidated`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-contentDomInvalidated) event.
* [#10430](http://dev.ckeditor.com/ticket/10430): Resolve dependence of the [Image](http://ckeditor.com/addon/image) plugin on the [Form Elements](http://ckeditor.com/addon/forms) plugin.
* [#10911](http://dev.ckeditor.com/ticket/10911): Fixed: Browser *Alt* hotkeys will no longer be blocked while a widget is focused.
* [#11082](http://dev.ckeditor.com/ticket/11082): Fixed: Selected widget is not copied or cut when using toolbar buttons or context menu.
* [#11083](http://dev.ckeditor.com/ticket/11083): Fixed list and div element application to block widgets.
* [#10887](http://dev.ckeditor.com/ticket/10887): Internet Explorer 8 compatibility issues related to the Widget System.
* [#11074](http://dev.ckeditor.com/ticket/11074): Temporarily disabled inline widget drag and drop, because of seriously buggy native `range#moveToPoint` method.
* [#11098](http://dev.ckeditor.com/ticket/11098): Fixed: Wrong selection position after undoing widget drag and drop.
* [#11110](http://dev.ckeditor.com/ticket/11110): Fixed: IFrame and Flash objects are being incorrectly pasted in certain conditions.
* [#11129](http://dev.ckeditor.com/ticket/11129): Page break is lost when loading data.
* [#11123](http://dev.ckeditor.com/ticket/11123): [Firefox] Widget is destroyed after being dragged outside of `<body>`.
* [#11124](http://dev.ckeditor.com/ticket/11124): Fixed the [Elements Path](http://ckeditor.com/addon/elementspath) in an editor using the [Div Editing Area](http://ckeditor.com/addon/divarea).
## CKEditor 4.3 Beta
New Features:
* [#9764](http://dev.ckeditor.com/ticket/9764): Widget System.
* [Widget plugin](http://ckeditor.com/addon/widget) introducing the [Widget API](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget).
* New [`editor.enterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-enterMode) and [`editor.shiftEnterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-shiftEnterMode) properties &ndash; normalized versions of [`config.enterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode) and [`config.shiftEnterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode).
* Dynamic editor settings. Starting from CKEditor 4.3 Beta, *Enter* mode values and [content filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) instances may be changed dynamically (for example when the caret was placed in an element in which editor features should be adjusted). When you are implementing a new editor feature, you should base its behavior on [dynamic](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-activeEnterMode) or [static](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-enterMode) *Enter* mode values depending on whether this feature works in selection context or globally on editor content.
* Dynamic *Enter* mode values &ndash; [`editor.setActiveEnterMode()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setActiveEnterMode) method, [`editor.activeEnterModeChange`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-activeEnterModeChange) event, and two properties: [`editor.activeEnterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-activeEnterMode) and [`editor.activeShiftEnterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-activeShiftEnterMode).
* Dynamic content filter instances &ndash; [`editor.setActiveFilter()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setActiveFilter) method, [`editor.activeFilterChange`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-activeFilterChange) event, and [`editor.activeFilter`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-activeFilter) property.
* "Fake" selection was introduced. It makes it possible to virtually select any element when the real selection remains hidden. See the [`selection.fake()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.selection-method-fake) method.
* Default [`htmlParser.filter`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.filter) rules are not applied to non-editable elements (elements with `contenteditable` attribute set to `false` and their descendants) anymore. To add a rule which will be applied to all elements you need to pass an additional argument to the [`filter.addRules()`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.filter-method-addRules) method.
* Dozens of new methods were introduced &ndash; most interesting ones:
* [`document.find()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.document-method-find),
* [`document.findOne()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.document-method-findOne),
* [`editable.insertElementIntoRange()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editable-method-insertElementIntoRange),
* [`range.moveToClosestEditablePosition()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-moveToClosestEditablePosition),
* New methods for [`htmlParser.node`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.node) and [`htmlParser.element`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.element).
* [#10659](http://dev.ckeditor.com/ticket/10659): New [Enhanced Image](http://ckeditor.com/addon/image2) plugin that introduces a widget with integrated image captions, an option to center images, and dynamic "click and drag" resizing.
* [#10664](http://dev.ckeditor.com/ticket/10664): New [Mathematical Formulas](http://ckeditor.com/addon/mathjax) plugin that introduces the MathJax widget.
* [#7987](https://dev.ckeditor.com/ticket/7987): New [Language](http://ckeditor.com/addon/language) plugin that implements Language toolbar button to support [WCAG 3.1.2 Language of Parts](http://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html).
* [#10708](http://dev.ckeditor.com/ticket/10708): New [smileys](http://ckeditor.com/addon/smiley).
## CKEditor 4.2.3
Fixed Issues:
* [#10994](http://dev.ckeditor.com/ticket/10994): Fixed: Loading external jQuery library when opening the [jQuery Adapter](http://docs.ckeditor.com/#!/guide/dev_jquery) sample directly from file.
* [#10975](http://dev.ckeditor.com/ticket/10975): [IE] Fixed: Error thrown while opening the color palette.
* [#9929](http://dev.ckeditor.com/ticket/9929): [Blink/WebKit] Fixed: A non-breaking space is created once a character is deleted and a regular space is typed.
* [#10963](http://dev.ckeditor.com/ticket/10963): Fixed: JAWS issue with the keyboard shortcut for [Magic Line](http://ckeditor.com/addon/magicline).
* [#11096](http://dev.ckeditor.com/ticket/11096): Fixed: TypeError: Object has no method 'is'.
## CKEditor 4.2.2
Fixed Issues:
* [#9314](http://dev.ckeditor.com/ticket/9314): Fixed: Incorrect error message on closing a dialog window without saving changs.
* [#10308](http://dev.ckeditor.com/ticket/10308): [IE10] Fixed: Unspecified error when deleting a row.
* [#10945](http://dev.ckeditor.com/ticket/10945): [Chrome] Fixed: Clicking with a mouse inside the editor does not show the caret.
* [#10912](http://dev.ckeditor.com/ticket/10912): Prevent default action when content of a non-editable link is clicked.
* [#10913](http://dev.ckeditor.com/ticket/10913): Fixed [`CKEDITOR.plugins.addExternal()`](http://docs.ckeditor.com/#!/api/CKEDITOR.resourceManager-method-addExternal) not handling paths including file name specified.
* [#10666](http://dev.ckeditor.com/ticket/10666): Fixed [`CKEDITOR.tools.isArray()`](http://docs.ckeditor.com/#!/api/CKEDITOR.tools-method-isArray) not working cross frame.
* [#10910](http://dev.ckeditor.com/ticket/10910): [IE9] Fixed JavaScript error thrown in Compatibility Mode when clicking and/or typing in the editing area.
* [#10868](http://dev.ckeditor.com/ticket/10868): [IE8] Prevent the browser from crashing when applying the Inline Quotation style.
* [#10915](http://dev.ckeditor.com/ticket/10915): Fixed: Invalid CSS filter in the Kama skin.
* [#10914](http://dev.ckeditor.com/ticket/10914): Plugins [Indent List](http://ckeditor.com/addon/indentlist) and [Indent Block](http://ckeditor.com/addon/indentblock) are now included in the build configuration.
* [#10812](http://dev.ckeditor.com/ticket/10812): Fixed [`range.createBookmark2()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.range-method-createBookmark2) incorrectly normalizing offsets. This bug was causing many issues: [#10850](http://dev.ckeditor.com/ticket/10850), [#10842](http://dev.ckeditor.com/ticket/10842).
* [#10951](http://dev.ckeditor.com/ticket/10951): Reviewed and optimized focus handling on panels (combo, menu buttons, color buttons, and context menu) to enhance accessibility. Fixed [#10705](http://dev.ckeditor.com/ticket/10705), [#10706](http://dev.ckeditor.com/ticket/10706) and [#10707](http://dev.ckeditor.com/ticket/10707).
* [#10704](http://dev.ckeditor.com/ticket/10704): Fixed a JAWS issue with the Select Color dialog window title not being announced.
* [#10753](http://dev.ckeditor.com/ticket/10753): The floating toolbar in inline instances now has a dedicated accessibility label.
## CKEditor 4.2.1
Fixed Issues:
* [#10301](http://dev.ckeditor.com/ticket/10301): [IE9-10] Undo fails after 3+ consecutive paste actions with a JavaScript error.
* [#10689](http://dev.ckeditor.com/ticket/10689): Save toolbar button saves only the first editor instance.
* [#10368](http://dev.ckeditor.com/ticket/10368): Move language reading direction definition (`dir`) from main language file to core.
* [#9330](http://dev.ckeditor.com/ticket/9330): Fixed pasting anchors from MS Word.
* [#8103](http://dev.ckeditor.com/ticket/8103): Fixed pasting nested lists from MS Word.
* [#9958](http://dev.ckeditor.com/ticket/9958): [IE9] Pressing the "OK" button will trigger the `onbeforeunload` event in the popup dialog.
* [#10662](http://dev.ckeditor.com/ticket/10662): Fixed styles from the Styles drop-down list not registering to the ACF in case when the [Shared Spaces plugin](http://ckeditor.com/addon/sharedspace) is used.
* [#9654](http://dev.ckeditor.com/ticket/9654): Problems with Internet Explorer 10 Quirks Mode.
* [#9816](http://dev.ckeditor.com/ticket/9816): Floating toolbar does not reposition vertically in several cases.
* [#10646](http://dev.ckeditor.com/ticket/10646): Removing a selected sublist or nested table with *Backspace/Delete* removes the parent element.
* [#10623](http://dev.ckeditor.com/ticket/10623): [WebKit] Page is scrolled when opening a drop-down list.
* [#10004](http://dev.ckeditor.com/ticket/10004): [ChromeVox] Button names are not announced.
* [#10731](http://dev.ckeditor.com/ticket/10731): [WebSpellChecker](http://ckeditor.com/addon/wsc) plugin breaks cloning of editor configuration.
* It is now possible to set per instance [WebSpellChecker](http://ckeditor.com/addon/wsc) plugin configuration instead of setting the configuration globally.
## CKEditor 4.2
**Important Notes:**
* Dropped compatibility support for Internet Explorer 7 and Firefox 3.6.
* Both the Basic and the Standard distribution packages will not contain the new [Indent Block](http://ckeditor.com/addon/indentblock) plugin. Because of this the [Advanced Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) might remove block indentations from existing contents. If you want to prevent this, either [add an appropriate ACF rule to your filter](http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules) or create a custom build based on the Basic/Standard package and add the Indent Block plugin in [CKBuilder](http://ckeditor.com/builder).
New Features:
* [#10027](http://dev.ckeditor.com/ticket/10027): Separated list and block indentation into two plugins: [Indent List](http://ckeditor.com/addon/indentlist) and [Indent Block](http://ckeditor.com/addon/indentblock).
* [#8244](http://dev.ckeditor.com/ticket/8244): Use *(Shift+)Tab* to indent and outdent lists.
* [#10281](http://dev.ckeditor.com/ticket/10281): The [jQuery Adapter](http://docs.ckeditor.com/#!/guide/dev_jquery) is now available. Several jQuery-related issues fixed: [#8261](http://dev.ckeditor.com/ticket/8261), [#9077](http://dev.ckeditor.com/ticket/9077), [#8710](http://dev.ckeditor.com/ticket/8710), [#8530](http://dev.ckeditor.com/ticket/8530), [#9019](http://dev.ckeditor.com/ticket/9019), [#6181](http://dev.ckeditor.com/ticket/6181), [#7876](http://dev.ckeditor.com/ticket/7876), [#6906](http://dev.ckeditor.com/ticket/6906).
* [#10042](http://dev.ckeditor.com/ticket/10042): Introduced [`config.title`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-title) setting to change the human-readable title of the editor.
* [#9794](http://dev.ckeditor.com/ticket/9794): Added [`editor.change`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change) event.
* [#9923](http://dev.ckeditor.com/ticket/9923): HiDPI support in the editor UI. HiDPI icons for [Moono skin](http://ckeditor.com/addon/moono) added.
* [#8031](http://dev.ckeditor.com/ticket/8031): Handle `required` attributes on `<textarea>` elements &mdash; introduced [`editor.required`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-required) event.
* [#10280](http://dev.ckeditor.com/ticket/10280): Ability to replace `<textarea>` elements with the inline editor.
Fixed Issues:
* [#10599](http://dev.ckeditor.com/ticket/10599): [Indent](http://ckeditor.com/addon/indent) plugin is no longer required by the [List](http://ckeditor.com/addon/list) plugin.
* [#10370](http://dev.ckeditor.com/ticket/10370): Inconsistency in data events between framed and inline editors.
* [#10438](http://dev.ckeditor.com/ticket/10438): [FF, IE] No selection is done on an editable element on executing [`editor.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData).
## CKEditor 4.1.3
New Features:
* Added new translation: Indonesian.
Fixed Issues:
* [#10644](http://dev.ckeditor.com/ticket/10644): Fixed a critical bug when pasting plain text in Blink-based browsers.
* [#5189](http://dev.ckeditor.com/ticket/5189): [Find/Replace](http://ckeditor.com/addon/find) dialog window: rename "Cancel" button to "Close".
* [#10562](http://dev.ckeditor.com/ticket/10562): [Housekeeping] Unified CSS gradient filter formats in the [Moono](http://ckeditor.com/addon/moono) skin.
* [#10537](http://dev.ckeditor.com/ticket/10537): Advanced Content Filter should register a default rule for [`config.shiftEnterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode).
* [#10610](http://dev.ckeditor.com/ticket/10610): [`CKEDITOR.dialog.addIframe()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dialog-static-method-addIframe) incorrectly sets the iframe size in dialog windows.
## CKEditor 4.1.2
New Features:
* Added new translation: Sinhala.
Fixed Issues:
* [#10339](http://dev.ckeditor.com/ticket/10339): Fixed: Error thrown when inserted data was totally stripped out after filtering and processing.
* [#10298](http://dev.ckeditor.com/ticket/10298): Fixed: Data processor breaks attributes containing protected parts.
* [#10367](http://dev.ckeditor.com/ticket/10367): Fixed: [`editable.insertText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editable-method-insertText) loses characters when `RegExp` replace controls are being inserted.
* [#10165](http://dev.ckeditor.com/ticket/10165): [IE] Access denied error when `document.domain` has been altered.
* [#9761](http://dev.ckeditor.com/ticket/9761): Update the *Backspace* key state in [`keystrokeHandler.blockedKeystrokes`](http://docs.ckeditor.com/#!/api/CKEDITOR.keystrokeHandler-property-blockedKeystrokes) when calling [`editor.setReadOnly()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly).
* [#6504](http://dev.ckeditor.com/ticket/6504): Fixed: Race condition while loading several [`config.customConfig`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-customConfig) files.
* [#10146](http://dev.ckeditor.com/ticket/10146): [Firefox] Empty lines are being removed while [`config.enterMode`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode) is [`CKEDITOR.ENTER_BR`](http://docs.ckeditor.com/#!/api/CKEDITOR-property-ENTER_BR).
* [#10360](http://dev.ckeditor.com/ticket/10360): Fixed: ARIA `role="application"` should not be used for dialog windows.
* [#10361](http://dev.ckeditor.com/ticket/10361): Fixed: ARIA `role="application"` should not be used for floating panels.
* [#10510](http://dev.ckeditor.com/ticket/10510): Introduced unique voice labels to differentiate between different editor instances.
* [#9945](http://dev.ckeditor.com/ticket/9945): [iOS] Scrolling not possible on iPad.
* [#10389](http://dev.ckeditor.com/ticket/10389): Fixed: Invalid HTML in the "Text and Table" template.
* [WebSpellChecker](http://ckeditor.com/addon/wsc) plugin user interface was changed to match CKEditor 4 style.
## CKEditor 4.1.1
New Features:
* Added new translation: Albanian.
Fixed Issues:
* [#10172](http://dev.ckeditor.com/ticket/10172): Pressing *Delete* or *Backspace* in an empty table cell moves the cursor to the next/previous cell.
* [#10219](http://dev.ckeditor.com/ticket/10219): Error thrown when destroying an editor instance in parallel with a `mouseup` event.
* [#10265](http://dev.ckeditor.com/ticket/10265): Wrong loop type in the [File Browser](http://ckeditor.com/addon/filebrowser) plugin.
* [#10249](http://dev.ckeditor.com/ticket/10249): Wrong undo/redo states at start.
* [#10268](http://dev.ckeditor.com/ticket/10268): [Show Blocks](http://ckeditor.com/addon/showblocks) does not recover after switching to Source view.
* [#9995](http://dev.ckeditor.com/ticket/9995): HTML code in the `<textarea>` should not be modified by the [`htmlDataProcessor`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlDataProcessor).
* [#10320](http://dev.ckeditor.com/ticket/10320): [Justify](http://ckeditor.com/addon/justify) plugin should add elements to Advanced Content Filter based on current [Enter mode](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode).
* [#10260](http://dev.ckeditor.com/ticket/10260): Fixed: Advanced Content Filter blocks [`tabSpaces`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-tabSpaces). Unified `data-cke-*` attributes filtering.
* [#10315](http://dev.ckeditor.com/ticket/10315): [WebKit] [Undo manager](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.undo.UndoManager) should not record snapshots after a filling character was added/removed.
* [#10291](http://dev.ckeditor.com/ticket/10291): [WebKit] Space after a filling character should be secured.
* [#10330](http://dev.ckeditor.com/ticket/10330): [WebKit] The filling character is not removed on `keydown` in specific cases.
* [#10285](http://dev.ckeditor.com/ticket/10285): Fixed: Styled text pasted from MS Word causes an infinite loop.
* [#10131](http://dev.ckeditor.com/ticket/10131): Fixed: [`undoManager.update()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.undo.UndoManager-method-update) does not refresh the command state.
* [#10337](http://dev.ckeditor.com/ticket/10337): Fixed: Unable to remove `<s>` using [Remove Format](http://ckeditor.com/addon/removeformat).
## CKEditor 4.1
Fixed Issues:
* [#10192](http://dev.ckeditor.com/ticket/10192): Closing lists with the *Enter* key does not work with [Advanced Content Filter](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) in several cases.
* [#10191](http://dev.ckeditor.com/ticket/10191): Fixed allowed content rules unification, so the [`filter.allowedContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter-property-allowedContent) property always contains rules in the same format.
* [#10224](http://dev.ckeditor.com/ticket/10224): Advanced Content Filter does not remove non-empty `<a>` elements anymore.
* Minor issues in plugin integration with Advanced Content Filter:
* [#10166](http://dev.ckeditor.com/ticket/10166): Added transformation from the `align` attribute to `float` style to preserve backward compatibility after the introduction of Advanced Content Filter.
* [#10195](http://dev.ckeditor.com/ticket/10195): [Image](http://ckeditor.com/addon/image) plugin no longer registers rules for links to Advanced Content Filter.
* [#10213](http://dev.ckeditor.com/ticket/10213): [Justify](http://ckeditor.com/addon/justify) plugin is now correctly registering rules to Advanced Content Filter when [`config.justifyClasses`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-justifyClasses) is defined.
## CKEditor 4.1 RC
New Features:
* [#9829](http://dev.ckeditor.com/ticket/9829): Advanced Content Filter - data and features activation based on editor configuration.
Brand new data filtering system that works in 2 modes:
* Based on loaded features (toolbar items, plugins) - the data will be filtered according to what the editor in its
current configuration can handle.
* Based on [`config.allowedContent`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent) rules - the data
will be filtered and the editor features (toolbar items, commands, keystrokes) will be enabled if they are allowed.
See the `datafiltering.html` sample, [guides](http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter) and [`CKEDITOR.filter` API documentation](http://docs.ckeditor.com/#!/api/CKEDITOR.filter).
* [#9387](http://dev.ckeditor.com/ticket/9387): Reintroduced [Shared Spaces](http://ckeditor.com/addon/sharedspace) - the ability to display toolbar and bottom editor space in selected locations and to share them by different editor instances.
* [#9907](http://dev.ckeditor.com/ticket/9907): Added the [`contentPreview`](http://docs.ckeditor.com/#!/api/CKEDITOR-event-contentPreview) event for preview data manipulation.
* [#9713](http://dev.ckeditor.com/ticket/9713): Introduced the [Source Dialog](http://ckeditor.com/addon/sourcedialog) plugin that brings raw HTML editing for inline editor instances.
* Included in [#9829](http://dev.ckeditor.com/ticket/9829): Introduced new events, [`toHtml`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-toHtml) and [`toDataFormat`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-toDataFormat), allowing for better integration with data processing.
* [#9981](http://dev.ckeditor.com/ticket/9981): Added ability to filter [`htmlParser.fragment`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.fragment), [`htmlParser.element`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.element) etc. by many [`htmlParser.filter`](http://docs.ckeditor.com/#!/api/CKEDITOR.htmlParser.filter)s before writing structure to an HTML string.
* Included in [#10103](http://dev.ckeditor.com/ticket/10103):
* Introduced the [`editor.status`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-status) property to make it easier to check the current status of the editor.
* Default [`command`](http://docs.ckeditor.com/#!/api/CKEDITOR.command) state is now [`CKEDITOR.TRISTATE_DISABLE`](http://docs.ckeditor.com/#!/api/CKEDITOR-property-TRISTATE_DISABLED). It will be activated on [`editor.instanceReady`](http://docs.ckeditor.com/#!/api/CKEDITOR-event-instanceReady) or immediately after being added if the editor is already initialized.
* [#9796](http://dev.ckeditor.com/ticket/9796): Introduced `<s>` as a default tag for strikethrough, which replaces obsolete `<strike>` in HTML5.
## CKEditor 4.0.3
Fixed Issues:
* [#10196](http://dev.ckeditor.com/ticket/10196): Fixed context menus not opening with keyboard shortcuts when [Autogrow](http://ckeditor.com/addon/autogrow) is enabled.
* [#10212](http://dev.ckeditor.com/ticket/10212): [IE7-10] Undo command throws errors after multiple switches between Source and WYSIWYG view.
* [#10219](http://dev.ckeditor.com/ticket/10219): [Inline editor] Error thrown after calling [`editor.destroy()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-destroy).
## CKEditor 4.0.2
Fixed Issues:
* [#9779](http://dev.ckeditor.com/ticket/9779): Fixed overriding [`CKEDITOR.getUrl()`](http://docs.ckeditor.com/#!/api/CKEDITOR-method-getUrl) with `CKEDITOR_GETURL`.
* [#9772](http://dev.ckeditor.com/ticket/9772): Custom buttons in the dialog window footer have different look and size ([Moono](http://ckeditor.com/addon/moono), [Kama](http://ckeditor.com/addon/kama) skins).
* [#9029](http://dev.ckeditor.com/ticket/9029): Custom styles added with the [`stylesSet.add()`](http://docs.ckeditor.com/#!/api/CKEDITOR.stylesSet-method-add) are displayed in the wrong order.
* [#9887](http://dev.ckeditor.com/ticket/9887): Disable [Magic Line](http://ckeditor.com/addon/magicline) when [`editor.readOnly`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-property-readOnly) is set.
* [#9882](http://dev.ckeditor.com/ticket/9882): Fixed empty document title on [`editor.getData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData) if set via the Document Properties dialog window.
* [#9773](http://dev.ckeditor.com/ticket/9773): Fixed rendering problems with selection fields in the Kama skin.
* [#9851](http://dev.ckeditor.com/ticket/9851): The [`selectionChange`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-selectionChange) event is not fired when mouse selection ended outside editable.
* [#9903](http://dev.ckeditor.com/ticket/9903): [Inline editor] Bad positioning of floating space with page horizontal scroll.
* [#9872](http://dev.ckeditor.com/ticket/9872): [`editor.checkDirty()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty) returns `true` when called onload. Removed the obsolete `editor.mayBeDirty` flag.
* [#9893](http://dev.ckeditor.com/ticket/9893): [IE] Fixed broken toolbar when editing mixed direction content in Quirks mode.
* [#9845](http://dev.ckeditor.com/ticket/9845): Fixed TAB navigation in the [Link](http://ckeditor.com/addon/link) dialog window when the Anchor option is used and no anchors are available.
* [#9883](http://dev.ckeditor.com/ticket/9883): Maximizing was making the entire page editable with [divarea](http://ckeditor.com/addon/divarea)-based editors.
* [#9940](http://dev.ckeditor.com/ticket/9940): [Firefox] Navigating back to a page with the editor was making the entire page editable.
* [#9966](http://dev.ckeditor.com/ticket/9966): Fixed: Unable to type square brackets with French keyboard layout. Changed [Magic Line](http://ckeditor.com/addon/magicline) keystrokes.
* [#9507](http://dev.ckeditor.com/ticket/9507): [Firefox] Selection is moved before editable position when the editor is focused for the first time.
* [#9947](http://dev.ckeditor.com/ticket/9947): [WebKit] Editor overflows parent container in some edge cases.
* [#10105](http://dev.ckeditor.com/ticket/10105): Fixed: Broken [sourcearea](http://ckeditor.com/addon/sourcearea) view when an RTL language is set.
* [#10123](http://dev.ckeditor.com/ticket/10123): [WebKit] Fixed: Several dialog windows have broken layout since the latest WebKit release.
* [#10152](http://dev.ckeditor.com/ticket/10152): Fixed: Invalid ARIA property used on menu items.
## CKEditor 4.0.1.1
Fixed Issues:
* Security update: Added protection against XSS attack and possible path disclosure in the PHP sample.
## CKEditor 4.0.1
Fixed Issues:
* [#9655](http://dev.ckeditor.com/ticket/9655): Support for IE Quirks Mode in the new [Moono skin](http://ckeditor.com/addon/moono).
* Accessibility issues (mainly in inline editor): [#9364](http://dev.ckeditor.com/ticket/9364), [#9368](http://dev.ckeditor.com/ticket/9368), [#9369](http://dev.ckeditor.com/ticket/9369), [#9370](http://dev.ckeditor.com/ticket/9370), [#9541](http://dev.ckeditor.com/ticket/9541), [#9543](http://dev.ckeditor.com/ticket/9543), [#9841](http://dev.ckeditor.com/ticket/9841), [#9844](http://dev.ckeditor.com/ticket/9844).
* [Magic Line](http://ckeditor.com/addon/magicline) plugin:
* [#9481](http://dev.ckeditor.com/ticket/9481): Added accessibility support for Magic Line.
* [#9509](http://dev.ckeditor.com/ticket/9509): Added Magic Line support for forms.
* [#9573](http://dev.ckeditor.com/ticket/9573): Magic Line does not disappear on `mouseout` in a specific case.
* [#9754](http://dev.ckeditor.com/ticket/9754): [WebKit] Cutting & pasting simple unformatted text generates an inline wrapper in WebKit browsers.
* [#9456](http://dev.ckeditor.com/ticket/9456): [Chrome] Properly paste bullet list style from MS Word.
* [#9699](http://dev.ckeditor.com/ticket/9699), [#9758](http://dev.ckeditor.com/ticket/9758): Improved selection locking when selecting by dragging.
* Context menu:
* [#9712](http://dev.ckeditor.com/ticket/9712): Opening the context menu destroys editor focus.
* [#9366](http://dev.ckeditor.com/ticket/9366): Context menu should be displayed over the floating toolbar.
* [#9706](http://dev.ckeditor.com/ticket/9706): Context menu generates a JavaScript error in inline mode when the editor is attached to a header element.
* [#9800](http://dev.ckeditor.com/ticket/9800): Hide float panel when resizing the window.
* [#9721](http://dev.ckeditor.com/ticket/9721): Padding in content of div-based editor puts the editing area under the bottom UI space.
* [#9528](http://dev.ckeditor.com/ticket/9528): Host page `box-sizing` style should not influence the editor UI elements.
* [#9503](http://dev.ckeditor.com/ticket/9503): [Form Elements](http://ckeditor.com/addon/forms) plugin adds context menu listeners only on supported input types. Added support for `tel`, `email`, `search` and `url` input types.
* [#9769](http://dev.ckeditor.com/ticket/9769): Improved floating toolbar positioning in a narrow window.
* [#9875](http://dev.ckeditor.com/ticket/9875): Table dialog window does not populate width correctly.
* [#8675](http://dev.ckeditor.com/ticket/8675): Deleting cells in a nested table removes the outer table cell.
* [#9815](http://dev.ckeditor.com/ticket/9815): Cannot edit dialog window fields in an editor initialized in the jQuery UI modal dialog.
* [#8888](http://dev.ckeditor.com/ticket/8888): CKEditor dialog windows do not show completely in a small window.
* [#9360](http://dev.ckeditor.com/ticket/9360): [Inline editor] Blocks shown for a `<div>` element stay permanently even after the user exits editing the `<div>`.
* [#9531](http://dev.ckeditor.com/ticket/9531): [Firefox & Inline editor] Toolbar is lost when closing the Format drop-down list by clicking its button.
* [#9553](http://dev.ckeditor.com/ticket/9553): Table width incorrectly set when the `border-width` style is specified.
* [#9594](http://dev.ckeditor.com/ticket/9594): Cannot tab past CKEditor when it is in read-only mode.
* [#9658](http://dev.ckeditor.com/ticket/9658): [IE9] Justify not working on selected images.
* [#9686](http://dev.ckeditor.com/ticket/9686): Added missing contents styles for `<pre>` elements.
* [#9709](http://dev.ckeditor.com/ticket/9709): [Paste from Word](http://ckeditor.com/addon/pastefromword) should not depend on configuration from other styles.
* [#9726](http://dev.ckeditor.com/ticket/9726): Removed [Color Dialog](http://ckeditor.com/addon/colordialog) plugin dependency from [Table Tools](http://ckeditor.com/addon/tabletools).
* [#9765](http://dev.ckeditor.com/ticket/9765): Toolbar Collapse command documented incorrectly in the [Accessibility Instructions](http://ckeditor.com/addon/a11yhelp) dialog window.
* [#9771](http://dev.ckeditor.com/ticket/9771): [WebKit & Opera] Fixed scrolling issues when pasting.
* [#9787](http://dev.ckeditor.com/ticket/9787): [IE9] `onChange` is not fired for checkboxes in dialogs.
* [#9842](http://dev.ckeditor.com/ticket/9842): [Firefox 17] When opening a toolbar menu for the first time and pressing the *Down Arrow* key, focus goes to the next toolbar button instead of the menu options.
* [#9847](http://dev.ckeditor.com/ticket/9847): [Elements Path](http://ckeditor.com/addon/elementspath) should not be initialized in the inline editor.
* [#9853](http://dev.ckeditor.com/ticket/9853): [`editor.addRemoveFormatFilter()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-addRemoveFormatFilter) is exposed before it really works.
* [#8893](http://dev.ckeditor.com/ticket/8893): Value of the [`pasteFromWordCleanupFile`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-pasteFromWordCleanupFile) configuration option is now taken from the instance configuration.
* [#9693](http://dev.ckeditor.com/ticket/9693): Removed "Live Preview" checkbox from UI color picker.
## CKEditor 4.0
The first stable release of the new CKEditor 4 code line.
The CKEditor JavaScript API has been kept compatible with CKEditor 4, whenever
possible. The list of relevant changes can be found in the [API Changes page of
the CKEditor 4 documentation][1].
[1]: http://docs.ckeditor.com/#!/guide/dev_api_changes "API Changes"

View File

@@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Installation Guide - CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
h3
{
border-bottom: 1px solid #AAAAAA;
}
pre
{
background-color: #F9F9F9;
border: 1px dashed #2F6FAB;
padding: 1em;
line-height: 1.1em;
}
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
</style>
</head>
<body>
<h1>
CKEditor Installation Guide</h1>
<h3>
What&#39;s CKEditor?</h3>
<p>
CKEditor is a text editor to be used inside web pages. It&#39;s not a replacement
for desktop text editors like Word or OpenOffice, but a component to be used as
part of web applications and web sites.</p>
<h3>
Installation</h3>
<p>
Installing CKEditor is an easy task. Just follow these simple steps:</p>
<ol>
<li><strong>Download</strong> the latest version of the editor from our web site: <a
href="http://ckeditor.com">http://ckeditor.com</a>. You should have already completed
this step, but be sure you have the very latest version.</li>
<li><strong>Extract</strong> (decompress) the downloaded file into the root of your
web site.</li>
</ol>
<p>
<strong>Note:</strong> CKEditor is by default installed in the &quot;ckeditor&quot;
folder. You can place the files in whichever you want though.</p>
<h3>
Checking Your Installation
</h3>
<p>
The editor comes with a few sample pages that can be used to verify that installation
proceeded properly. Take a look at the <a href="_samples">_samples</a> directory.</p>
<p>
To test your installation, just call the following page at your web site:</p>
<pre>
http://&lt;your site&gt;/&lt;CKEditor installation path&gt;/_samples/index.html
For example:
http://www.example.com/ckeditor/_samples/index.html</pre>
<h3>
Documentation</h3>
<p>
The full editor documentation is available online at the following address:<br />
<a href="http://docs.cksource.com/ckeditor">http://docs.cksource.com/ckeditor</a></p>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
CKEditor 4
==========
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
http://ckeditor.com - See LICENSE.md for license information.
CKEditor is a text editor to be used inside web pages. It's not a replacement
for desktop text editors like Word or OpenOffice, but a component to be used as
part of web applications and websites.
## Documentation
The full editor documentation is available online at the following address:
http://docs.ckeditor.com
## Installation
Installing CKEditor is an easy task. Just follow these simple steps:
1. **Download** the latest version from the CKEditor website:
http://ckeditor.com. You should have already completed this step, but be
sure you have the very latest version.
2. **Extract** (decompress) the downloaded file into the root of your website.
**Note:** CKEditor is by default installed in the `ckeditor` folder. You can
place the files in whichever you want though.
## Checking Your Installation
The editor comes with a few sample pages that can be used to verify that
installation proceeded properly. Take a look at the `samples` directory.
To test your installation, just call the following page at your website:
http://<your site>/<CKEditor installation path>/samples/index.html
For example:
http://www.example.com/ckeditor/samples/index.html

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<application xmlns="http://ns.adobe.com/air/application/1.0">
<id>com.ckeditor.air.sample</id>
<name>CKEditor - Adobe AIR Sample Application</name>
<version>1.0</version>
<filename>CKEditor AIR Samples</filename>
<description>This is a sample AIR application of CKEditor.</description>
<copyright>Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.</copyright>
<initialWindow>
<content>_samples/adobeair/sample.html</content>
<title>CKEditor - Adobe AIR Sample</title>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<minimizable>true</minimizable>
<maximizable>true</maximizable>
<resizable>true</resizable>
<x>100</x>
<y>80</y>
<width>950</width>
<height>700</height>
<minSize>900 600</minSize>
</initialWindow>
<installFolder>CKEditor/Sample AIR Application</installFolder>
<programMenuFolder>CKEditor/Sample AIR Application</programMenuFolder>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
</application>

View File

@@ -0,0 +1,9 @@
@ECHO OFF
::
:: Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
:: For licensing, see LICENSE.html or http://ckeditor.com/license
::
:: Use this file to quickly run the sample in a Windows environment.
::
adl application.xml ../../

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
# For licensing, see LICENSE.html or http://ckeditor.com/license
# Use this file to quickly run the sample under Linux.
adl application.xml ../../

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Textarea by Code - CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../../ckeditor.js"></script>
<link href="../sample.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body { margin: 10px ; }
</style></head>
<body>
<h1 class="samples">
CKEditor - Adobe AIR Sample
</h1>
<p>
This is a sample HTML/JavaScript Adobe AIR application with CKEditor with default features.
</p>
<p>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1' );
//]]>
</script>
</p>
<div id="footer" style="position:absolute;bottom:0;left:0;right:0;width:100%;padding-bottom:10px;">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="#" onclick="window.runtime.flash.net.navigateToURL(new window.runtime.flash.net.URLRequest('http://ckeditor.com/'));return false;">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="#" onclick="window.runtime.flash.net.navigateToURL(new window.runtime.flash.net.URLRequest('http://cksource.com/'));return false;">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ajax &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var editor, html = '';
function createEditor()
{
if ( editor )
return;
// Create a new editor inside the <div id="editor">, setting its value to html
var config = {};
editor = CKEDITOR.appendTo( 'editor', config, html );
}
function removeEditor()
{
if ( !editor )
return;
// Retrieve the editor contents. In an Ajax application, this data would be
// sent to the server or used in any other way.
document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
document.getElementById( 'contents' ).style.display = '';
// Destroy the editor.
editor.destroy();
editor = null;
}
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Create and Destroy Editor Instances for Ajax Applications
</h1>
<div class="description">
<p>
This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
area will be displayed in a <code>&lt;div&gt;</code> element.
</p>
<p>
For details of how to create this setup check the source code of this sample page
for JavaScript code responsible for the creation and destruction of a CKEditor instance.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>Click the buttons to create and remove a CKEditor instance.</p>
<p>
<input onclick="createEditor();" type="button" value="Create Editor" />
<input onclick="removeEditor();" type="button" value="Remove Editor" />
</p>
<!-- This div will hold the editor. -->
<div id="editor">
</div>
<div id="contents" style="display: none">
<p>
Edited Contents:</p>
<!-- This div will be used to display the editor contents. -->
<div id="editorcontents">
</div>
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,192 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>API Usage &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev )
{
// Show the editor name and description in the browser status bar.
document.getElementById( 'eMessage' ).innerHTML = '<p>Instance <code>' + ev.editor.name + '<\/code> loaded.<\/p>';
// Show this sample buttons.
document.getElementById( 'eButtons' ).style.display = 'block';
});
function InsertHTML()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'htmlArea' ).value;
// Check the active editing mode.
if ( oEditor.mode == 'wysiwyg' )
{
// Insert HTML code.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertHtml
oEditor.insertHtml( value );
}
else
alert( 'You must be in WYSIWYG mode!' );
}
function InsertText()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'txtArea' ).value;
// Check the active editing mode.
if ( oEditor.mode == 'wysiwyg' )
{
// Insert as plain text.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertText
oEditor.insertText( value );
}
else
alert( 'You must be in WYSIWYG mode!' );
}
function SetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
var value = document.getElementById( 'htmlArea' ).value;
// Set editor contents (replace current contents).
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData
oEditor.setData( value );
}
function GetContents()
{
// Get the editor instance that you want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Get editor contents
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#getData
alert( oEditor.getData() );
}
function ExecuteCommand( commandName )
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Check the active editing mode.
if ( oEditor.mode == 'wysiwyg' )
{
// Execute the command.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#execCommand
oEditor.execCommand( commandName );
}
else
alert( 'You must be in WYSIWYG mode!' );
}
function CheckDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Checks whether the current editor contents present changes when compared
// to the contents loaded into the editor at startup
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#checkDirty
alert( oEditor.checkDirty() );
}
function ResetDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = CKEDITOR.instances.editor1;
// Resets the "dirty state" of the editor (see CheckDirty())
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#resetDirty
oEditor.resetDirty();
alert( 'The "IsDirty" status has been reset' );
}
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using CKEditor JavaScript API
</h1>
<div class="description">
<p>
This sample shows how to use the
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html">CKEditor JavaScript API</a>
to interact with the editor at runtime.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor1"> with an CKEditor instance.
var editor = CKEDITOR.replace( 'editor1' );
//]]>
</script>
<div id="eMessage">
</div>
<div id="eButtons" style="display: none">
<input onclick="InsertHTML();" type="button" value="Insert HTML" />
<input onclick="SetContents();" type="button" value="Set Editor Contents" />
<input onclick="GetContents();" type="button" value="Get Editor Contents (XHTML)" />
<br />
<textarea cols="100" id="htmlArea" rows="3">&lt;h2&gt;Test&lt;/h2&gt;&lt;p&gt;This is some &lt;a href="/Test1.html"&gt;sample&lt;/a&gt; HTML code.&lt;/p&gt;</textarea>
<br />
<br />
<input onclick="InsertText();" type="button" value="Insert Text" />
<br />
<textarea cols="100" id="txtArea" rows="3"> First line with some leading whitespaces.
Second line of text preceded by two line breaks.</textarea>
<br />
<input onclick="ExecuteCommand('bold');" type="button" value="Execute &quot;bold&quot; Command" />
<input onclick="ExecuteCommand('link');" type="button" value="Execute &quot;link&quot; Command" />
<br />
<br />
<input onclick="CheckDirty();" type="button" value="checkDirty()" />
<input onclick="ResetDirty();" type="button" value="resetDirty()" />
</div>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,198 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using API to Customize Dialog Windows &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
.cke_button_myDialogCmd .cke_icon
{
display: none !important;
}
.cke_button_myDialogCmd .cke_label
{
display: inline !important;
}
</style>
<script type="text/javascript">
//<![CDATA[
// When opening a dialog, its "definition" is created for it, for
// each editor instance. The "dialogDefinition" event is then
// fired. We should use this event to make customizations to the
// definition of existing dialogs.
CKEDITOR.on( 'dialogDefinition', function( ev )
{
// Take the dialog name and its definition from the event
// data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested on (the "Link" dialog).
if ( dialogName == 'link' )
{
// Get a reference to the "Link Info" tab.
var infoTab = dialogDefinition.getContents( 'info' );
// Add a text field to the "info" tab.
infoTab.add( {
type : 'text',
label : 'My Custom Field',
id : 'customField',
'default' : 'Sample!',
validate : function()
{
if ( /\d/.test( this.getValue() ) )
return 'My Custom Field must not contain digits';
}
});
// Remove the "Link Type" combo and the "Browser
// Server" button from the "info" tab.
infoTab.remove( 'linkType' );
infoTab.remove( 'browse' );
// Set the default value for the URL field.
var urlField = infoTab.get( 'url' );
urlField['default'] = 'www.example.com';
// Remove the "Target" tab from the "Link" dialog.
dialogDefinition.removeContents( 'target' );
// Add a new tab to the "Link" dialog.
dialogDefinition.addContents({
id : 'customTab',
label : 'My Tab',
accessKey : 'M',
elements : [
{
id : 'myField1',
type : 'text',
label : 'My Text Field'
},
{
id : 'myField2',
type : 'text',
label : 'Another Text Field'
}
]
});
// Rewrite the 'onFocus' handler to always focus 'url' field.
dialogDefinition.onFocus = function()
{
var urlField = this.getContentElement( 'info', 'url' );
urlField.select();
};
}
});
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using CKEditor Dialog API
</h1>
<div class="description">
<p>
This sample shows how to use the
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html">CKEditor Dialog API</a>
to customize CKEditor dialog windows without changing the original editor code.
The following customizations are being done in the example below:
</p>
<ol>
<li><strong>Adding dialog window tabs</strong> &ndash; "My Tab" in the "Link" dialog window.</li>
<li><strong>Removing a dialog window tab</strong> &ndash; "Target" tab from the "Link" dialog window.</li>
<li><strong>Adding dialog window fields</strong> &ndash; "My Custom Field" in the "Link" dialog window.</li>
<li><strong>Removing dialog window fields</strong> &ndash; "Link Type" and "Browse Server" in the "Link"
dialog window.</li>
<li><strong>Setting default values for dialog window fields</strong> &ndash; "URL" field in the
"Link" dialog window. </li>
<li><strong>Creating a custom dialog window</strong> &ndash; "My Dialog" dialog window opened with the "My Dialog" toolbar button.</li>
</ol>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your
pages. -->
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor1"> with an CKEditor instance.
var editor = CKEDITOR.replace( 'editor1',
{
// Defines a simpler toolbar to be used in this sample.
// Note that we have added out "MyButton" button here.
toolbar : [ [ 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike','-','Link', '-', 'MyButton' ] ]
});
// Listen for the "pluginsLoaded" event, so we are sure that the
// "dialog" plugin has been loaded and we are able to do our
// customizations.
editor.on( 'pluginsLoaded', function( ev )
{
// If our custom dialog has not been registered, do that now.
if ( !CKEDITOR.dialog.exists( 'myDialog' ) )
{
// We need to do the following trick to find out the dialog
// definition file URL path. In the real world, you would simply
// point to an absolute path directly, like "/mydir/mydialog.js".
var href = document.location.href.split( '/' );
href.pop();
href.push( 'api_dialog', 'my_dialog.js' );
href = href.join( '/' );
// Finally, register the dialog.
CKEDITOR.dialog.add( 'myDialog', href );
}
// Register the command used to open the dialog.
editor.addCommand( 'myDialogCmd', new CKEDITOR.dialogCommand( 'myDialog' ) );
// Add the a custom toolbar buttons, which fires the above
// command..
editor.ui.addButton( 'MyButton',
{
label : 'My Dialog',
command : 'myDialogCmd'
} );
});
//]]>
</script>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,28 @@
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'myDialog', function( editor )
{
return {
title : 'My Dialog',
minWidth : 400,
minHeight : 200,
contents : [
{
id : 'tab1',
label : 'First Tab',
title : 'First Tab',
elements :
[
{
id : 'input1',
type : 'text',
label : 'Input 1'
}
]
}
]
};
} );

View File

@@ -0,0 +1,105 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!-- #INCLUDE file="../../ckeditor.asp" -->
<%
' You must set "Enable Parent Paths" on your web site
' in order for the above relative include to work.
' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="sample_posteddata.asp" method="post">
<p>
<label>Editor 1:</label><br/>
</p>
<%
' Create class instance.
dim editor, initialValue, code, textareaAttributes
set editor = New CKEditor
' Do not print the code directly to the browser, return it instead
editor.returnOutput = true
' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
' editor.basePath = "/ckeditor/"
' If not set, CKEditor will default to /ckeditor/
editor.basePath = "../../"
' Set global configuration (will be used by all instances of CKEditor).
editor.config("width") = 600
' Change default textarea attributes
set textareaAttributes = CreateObject("Scripting.Dictionary")
textareaAttributes.Add "rows", 10
textareaAttributes.Add "cols", 80
Set editor.textareaAttributes = textareaAttributes
' The initial value to be displayed in the editor.
initialValue = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://ckeditor.com/"">CKEditor</a>.</p>"
' Create first instance.
code = editor.editor("editor1", initialValue)
response.write code
%>
<p>
<label>Editor 2:</label><br/>
</p>
<%
' Configuration that will be used only by the second editor.
editor.instanceConfig("toolbar") = Array( _
Array( "Source", "-", "Bold", "Italic", "Underline", "Strike" ), _
Array( "Image", "Link", "Unlink", "Anchor" ) _
)
editor.instanceConfig("skin") = "v2"
' Create second instance.
response.write editor.editor("editor2", initialValue)
%>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,136 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!-- #INCLUDE file="../../ckeditor.asp" -->
<%
' You must set "Enable Parent Paths" on your web site
' in order for the above relative include to work.
' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="sample_posteddata.asp" method="post">
<p>
<label>Editor 1:</label><br/>
</p>
<%
''
' Adds global event, will hide "Target" tab in Link dialog in all instances.
'
function CKEditorHideLinkTargetTab(editor)
dim functionCode
functionCode = "function (ev) {" & vbcrlf & _
"// Take the dialog name and its definition from the event data" & vbcrlf & _
"var dialogName = ev.data.name;" & vbcrlf & _
"var dialogDefinition = ev.data.definition;" & vbcrlf & _
"" & vbcrlf & _
"// Check if the definition is from the Link dialog." & vbcrlf & _
"if ( dialogName == 'link' )" & vbcrlf & _
" dialogDefinition.removeContents('target')" & vbcrlf & _
"}" & vbcrlf
editor.addGlobalEventHandler "dialogDefinition", functionCode
end function
''
' Adds global event, will notify about opened dialog.
'
function CKEditorNotifyAboutOpenedDialog(editor)
dim functionCode
functionCode = "function (evt) {" & vbcrlf & _
"alert('Loading dialog: ' + evt.data.name);" & vbcrlf & _
"}"
editor.addGlobalEventHandler "dialogDefinition", functionCode
end function
dim editor, initialValue
' Create class instance.
set editor = new CKEditor
' Set configuration option for all editors.
editor.config("width") = 750
' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
' editor.basePath = "/ckeditor/"
' If not set, CKEditor will default to /ckeditor/
editor.basePath = "../../"
' The initial value to be displayed in the editor.
initialValue = "<p>This is some <strong>sample text</strong>. You are using <a href=""http://ckeditor.com/"">CKEditor</a>.</p>"
' Event that will be handled only by the first editor.
editor.addEventHandler "instanceReady", "function (evt) { alert('Loaded editor: ' + evt.editor.name );}"
' Create first instance.
editor.editor "editor1", initialValue
' Clear event handlers, instances that will be created later will not have
' the 'instanceReady' listener defined a couple of lines above.
editor.clearEventHandlers empty
%>
<p>
<label>Editor 2:</label><br/>
</p>
<%
' Configuration that will be used only by the second editor.
editor.instanceConfig("width") = 600
editor.instanceConfig("toolbar") = "Basic"
' Add some global event handlers (for all editors).
CKEditorHideLinkTargetTab(editor)
CKEditorNotifyAboutOpenedDialog(editor)
' Event that will be handled only by the second editor.
editor.addInstanceEventHandler "instanceReady", "function (evt) { alert('Loaded second editor: ' + evt.editor.name );}"
' Create second instance.
editor.editor "editor2", initialValue
%>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,103 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP integration Samples List &mdash; CKEditor</title>
<link type="text/css" rel="stylesheet" href="../sample.css" />
</head>
<body>
<h1 class="samples">
CKEditor Samples List for ASP &mdash; CKEditor Sample
</h1>
<h2 class="samples">
Overview
</h2>
<p>The ckeditor.asp file provides a wrapper to ease the work of creating CKEditor instances from classic Asp.</p>
<p>To use it, you must first include it into your page:
<code>
&lt;!-- #INCLUDE file="../../ckeditor.asp" --&gt;
</code>
Of course, you should adjust the path to make it point to the correct location, and maybe use a full path (with virtual="" instead of file="")
</p>
<p>After that script is included, you can use it in different ways, based on the following pattern:</p>
<ol>
<li>
Create an instance of the CKEditor class:
<pre class="samples">dim editor
set editor = New CKEditor</pre>
</li>
<li>
Set the path to the folder where CKEditor has been installed, by default it will use /ckeditor/
<pre class="samples">editor.basePath = "../../"</pre>
</li>
<li>
Now use one of the three main methods to create the CKEditor instances:
<ul class="samples">
<li>
Replace textarea with id (or name) "editor1".
<pre class="samples">editor.replaceInstance "editor1"</pre>
</li>
<li>
Replace all textareas with CKEditor.
<pre class="samples">editor.replaceAll empty</pre>
</li>
<li>
Create a textarea element and attach CKEditor to it.
<pre class="samples">editor.editor "editor1", initialValue</pre>
</li>
</ul>
</li>
</ol>
<p>Before step 3 you can use a number of methods and properties to adjust the behavior of this class and the CKEditor instances
that will be created:</p>
<ul class="samples">
<li>returnOutput : if set to true, the functions won't dump the code with response.write, but instead they will return it so
you can do anything you want</li>
<li>basePath: location of the CKEditor scripts</li>
<li>initialized: if you set it to true, it means that you have already included the CKEditor.js file into the page and it
doesn't have to be generated again.</li>
<li>textareaAttributes: You can set here a Dictionary object with the attributes that you want to output in the call to the "editor" method.</li>
<li>config: Allows to set config values for all the instances from now on.</li>
<li>instanceConfig: Allows to set config values just for the next instance.</li>
<li>addEventHandler: Adds an event handler for all the instances from now on.</li>
<li>addInstanceEventHandler: Adds an event handler just for the next instance.</li>
<li>addGlobalEventHandler: Adds an event handler for the global CKEDITOR object.</li>
<li>clearEventHandlers: Removes one or all the event handlers from all the instances from now on.</li>
<li>clearInstanceEventHandlers: Removes one or all the event handlers from the next instance.</li>
<li>clearGlobalEventHandlers: Removes one or all the event handlers from the global CKEDITOR object.</li>
</ul>
<h2 class="samples">
Basic Samples
</h2>
<ul class="samples">
<li><a class="samples" href="replace.asp">Replace existing textareas by code</a></li>
<li><a class="samples" href="replaceall.asp">Replace all textareas by code</a></li>
<li><a class="samples" href="standalone.asp">Create instances in asp</a></li>
</ul>
<h2 class="samples">
Advanced Samples
</h2>
<ul class="samples">
<li><a class="samples" href="advanced.asp">Advanced example</a></li>
<li><a class="samples" href="events.asp">Listening to events</a></li>
</ul>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,72 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!-- #INCLUDE file="../../ckeditor.asp" -->
<%
' You must set "Enable Parent Paths" on your web site
' in order for the above relative include to work.
' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="sample_posteddata.asp" method="post">
<p>
<label for="editor1">
Editor 1:</label><br/>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<%
' Create class instance.
dim editor
set editor = New CKEditor
' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
' editor.basePath = "/ckeditor/"
' If not set, CKEditor will default to /ckeditor/
editor.basePath = "../../"
' Replace textarea with id (or name) "editor1".
editor.replaceInstance "editor1"
%>
</body>
</html>

View File

@@ -0,0 +1,77 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!-- #INCLUDE file="../../ckeditor.asp" -->
<%
' You must set "Enable Parent Paths" on your web site
' in order for the above relative include to work.
' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="sample_posteddata.asp" method="post">
<p>
<label for="editor1">
Editor 1:</label><br/>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor2">
Editor 2:</label><br/>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<%
' Create class instance.
dim editor
set editor = New CKEditor
' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
' editor.basePath = "/ckeditor/"
' If not set, CKEditor will default to /ckeditor/
editor.basePath = "../../"
' Replace all textareas with CKEditor.
editor.replaceAll empty
%>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../sample.css" />
</head>
<body>
<h1 class="samples">
CKEditor - Posted Data
</h1>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="100" /></colgroup>
<thead>
<tr>
<th>Field&nbsp;Name</th>
<th>Value</th>
</tr>
</thead>
<%
Dim sForm
For Each sForm in Request.Form
%>
<tr>
<th><%=Server.HTMLEncode( sForm )%></th>
<td><pre class="samples"><%=Server.HTMLEncode( Request.Form(sForm) )%></pre></td>
</tr>
<% Next %>
</table>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,72 @@
<%@ codepage="65001" language="VBScript" %>
<% Option Explicit %>
<!-- #INCLUDE file="../../ckeditor.asp" -->
<%
' You must set "Enable Parent Paths" on your web site
' in order for the above relative include to work.
' Or you can use #INCLUDE VIRTUAL="/full path/ckeditor.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample - CKEditor</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample
</h1>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your pages. -->
<fieldset title="Output">
<legend>Output</legend>
<form action="sample_posteddata.asp" method="post">
<p>
Editor 1:
</p>
<p>
<%
dim initialValue, editor
' The initial value to be displayed in the editor.
initialValue = "<p>This is some <strong>sample text</strong>.</p>"
' Create class instance.
set editor = New CKEditor
' Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
' editor.basePath = "/ckeditor/"
' If not set, CKEditor will default to /ckeditor/
editor.basePath = "../../"
' Create textarea element and attach CKEditor to it.
editor.editor "editor1", initialValue
%>
<input type="submit" value="Submit"/>
</p>
</form>
</fieldset>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample &mdash; CKEditor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="sample.css" />
</head>
<body>
<h1 class="samples">
CKEditor &mdash; Posted Data
</h1>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="100" /></colgroup>
<thead>
<tr>
<th>Field&nbsp;Name</th>
<th>Value</th>
</tr>
</thead>
<?php
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
foreach ( $postArray as $sForm => $value )
{
if ( get_magic_quotes_gpc() )
$postedValue = htmlspecialchars( stripslashes( $value ) ) ;
else
$postedValue = htmlspecialchars( $value ) ;
?>
<tr>
<th style="vertical-align: top"><?php echo htmlspecialchars($sForm); ?></th>
<td><pre class="samples"><?php echo $postedValue?></pre></td>
</tr>
<?php
}
?>
</table>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,204 @@
/*
* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*
* Styles used by the XHTML 1.1 sample page (xhtml.html).
*/
/**
* Basic definitions for the editing area.
*/
body
{
font-family: Arial, Verdana, sans-serif;
font-size: 80%;
color: #000000;
background-color: #ffffff;
padding: 5px;
margin: 0px;
}
/**
* Core styles.
*/
.Bold
{
font-weight: bold;
}
.Italic
{
font-style: italic;
}
.Underline
{
text-decoration: underline;
}
.StrikeThrough
{
text-decoration: line-through;
}
.Subscript
{
vertical-align: sub;
font-size: smaller;
}
.Superscript
{
vertical-align: super;
font-size: smaller;
}
/**
* Font faces.
*/
.FontComic
{
font-family: 'Comic Sans MS';
}
.FontCourier
{
font-family: 'Courier New';
}
.FontTimes
{
font-family: 'Times New Roman';
}
/**
* Font sizes.
*/
.FontSmaller
{
font-size: smaller;
}
.FontLarger
{
font-size: larger;
}
.FontSmall
{
font-size: 8pt;
}
.FontBig
{
font-size: 14pt;
}
.FontDouble
{
font-size: 200%;
}
/**
* Font colors.
*/
.FontColor1
{
color: #ff9900;
}
.FontColor2
{
color: #0066cc;
}
.FontColor3
{
color: #ff0000;
}
.FontColor1BG
{
background-color: #ff9900;
}
.FontColor2BG
{
background-color: #0066cc;
}
.FontColor3BG
{
background-color: #ff0000;
}
/**
* Indentation.
*/
.Indent1
{
margin-left: 40px;
}
.Indent2
{
margin-left: 80px;
}
.Indent3
{
margin-left: 120px;
}
/**
* Alignment.
*/
.JustifyLeft
{
text-align: left;
}
.JustifyRight
{
text-align: right;
}
.JustifyCenter
{
text-align: center;
}
.JustifyFull
{
text-align: justify;
}
/**
* Other.
*/
code
{
font-family: courier, monospace;
background-color: #eeeeee;
padding-left: 1px;
padding-right: 1px;
border: #c0c0c0 1px solid;
}
kbd
{
padding: 0px 1px 0px 1px;
border-width: 1px 2px 2px 1px;
border-style: solid;
}
blockquote
{
color: #808080;
}

View File

@@ -0,0 +1,70 @@
body
{
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
color: #222;
background-color: #fff;
}
/* preserved spaces for rtl list item bullets. (#6249)*/
ol,ul,dl
{
padding-right:40px;
}
h1,h2,h3,h4
{
font-family: Georgia, Times, serif;
}
h1.lightBlue
{
color: #00A6C7;
font-size: 1.8em;
font-weight:normal;
}
h3.green
{
color: #739E39;
font-weight:normal;
}
span.markYellow { background-color: yellow; }
span.markGreen { background-color: lime; }
img.left
{
padding: 5px;
margin-right: 5px;
float:left;
border:2px solid #DDD;
}
img.right
{
padding: 5px;
margin-right: 5px;
float:right;
border:2px solid #DDD;
}
a.green
{
color:#739E39;
}
table.grey
{
background-color : #F5F5F5;
}
table.grey th
{
background-color : #DDD;
}
ul.square
{
list-style-type : square;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,108 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AutoGrow Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using AutoGrow Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor instances to use the
<strong>AutoGrow</strong> (<code>autogrow</code>) plugin that lets the editor window expand
and shrink depending on the amount and size of content entered in the editing area.
</p>
<p>
In its default implementation the <strong>AutoGrow feature</strong> can expand the
CKEditor window infinitely in order to avoid introducing scrollbars to the editing area.
</p>
<p>
It is also possible to set a maximum height for the editor window. Once CKEditor
editing area reaches the value in pixels specified in the <code>
<a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoGrow_maxHeight">autoGrow_maxHeight</a>
</code> configuration setting, scrollbars will be added and the editor window will no longer expand.
</p>
<p>
To add a CKEditor instance using the <code>autogrow</code> plugin and its
<code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>extraPlugins : 'autogrow',</strong>
autoGrow_maxHeight : 800,
// Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin.
removePlugins : 'resize'
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. The maximum height should
be given in pixels.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
CKEditor using the <code>autogrow</code> plugin with its default configuration:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1', {
extraPlugins : 'autogrow',
removePlugins : 'resize'
});
//]]>
</script>
</p>
<p>
<label for="editor2">
CKEditor using the <code>autogrow</code> plugin with maximum height set to 400 pixels:</label>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor2', {
extraPlugins : 'autogrow',
autoGrow_maxHeight : 400,
removePlugins : 'resize'
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,125 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BBCode Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; BBCode Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output <a href="http://en.wikipedia.org/wiki/BBCode">BBCode</a> format instead of HTML.
Please note that the editor configuration was modified to reflect what is needed in a BBCode editing environment.
Smiley images, for example, were stripped to the emoticons that are commonly used in some BBCode dialects.
</p>
<p>
Please note that currently there is no standard for the BBCode markup language, so its implementation
for different platforms (message boards, blogs etc.) can vary. This means that before using CKEditor to
output BBCode you may need to adjust the implementation to your own environment.
</p>
<p>
A snippet of the configuration code can be seen below; check the source of this page for
a full definition:
</p>
<pre class="samples">
CKEDITOR.replace( 'editor1',
{
<strong>extraPlugins : 'bbcode',</strong>
toolbar :
[
['Source', '-', 'Save','NewPage','-','Undo','Redo'],
['Find','Replace','-','SelectAll','RemoveFormat'],
['Link', 'Unlink', 'Image'],
'/',
['FontSize', 'Bold', 'Italic','Underline'],
['NumberedList','BulletedList','-','Blockquote'],
['TextColor', '-', 'Smiley','SpecialChar', '-', 'Maximize']
],
... <i>some other configurations omitted here</i>
}); </pre>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">This is some [b]sample text[/b]. You are using [url=http://ckeditor.com/]CKEditor[/url].</textarea>
<script type="text/javascript">
//<![CDATA[
// Replace the <textarea id="editor"> with an CKEditor
// instance, using the "bbcode" plugin, shaping some of the
// editor configuration to fit BBCode environment.
CKEDITOR.replace( 'editor1',
{
extraPlugins : 'bbcode',
// Remove unused plugins.
removePlugins : 'bidi,button,dialogadvtab,div,filebrowser,flash,format,forms,horizontalrule,iframe,indent,justify,liststyle,pagebreak,showborders,stylescombo,table,tabletools,templates',
// Width and height are not supported in the BBCode format, so object resizing is disabled.
disableObjectResizing : true,
// Define font sizes in percent values.
fontSize_sizes : "30/30%;50/50%;100/100%;120/120%;150/150%;200/200%;300/300%",
toolbar :
[
['Source', '-', 'Save','NewPage','-','Undo','Redo'],
['Find','Replace','-','SelectAll','RemoveFormat'],
['Link', 'Unlink', 'Image', 'Smiley','SpecialChar'],
'/',
['Bold', 'Italic','Underline'],
['FontSize'],
['TextColor'],
['NumberedList','BulletedList','-','Blockquote'],
['Maximize']
],
// Strip CKEditor smileys to those commonly used in BBCode.
smiley_images :
[
'regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','tounge_smile.gif',
'embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angel_smile.gif','shades_smile.gif',
'cry_smile.gif','kiss.gif'
],
smiley_descriptions :
[
'smiley', 'sad', 'wink', 'laugh', 'cheeky', 'blush', 'surprise',
'indecision', 'angel', 'cool', 'crying', 'kiss'
]
} );
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,94 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using DevTools Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using the Developer Tools Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor instances to use the
<strong>Developer Tools</strong> (<code>devtools</code>) plugin that displays
information about dialog window elements, including the name of the dialog window,
tab, and UI element. Please note that the tooltip also contains a link to the
<a href="http://docs.cksource.com/ckeditor_api/">CKEditor JavaScript API</a>
documentation for each of the selected elements.
</p>
<p>
This plugin is aimed at developers who would like to customize their CKEditor
instances and create their own plugins. By default it is turned off; it is
usually useful to only turn it on in the development phase. Note that it works with
all CKEditor dialog windows, including the ones that were created by custom plugins.
</p>
<p>
To add a CKEditor instance using the <strong>devtools</strong> plugin, insert
the following JavaScript call into your code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>extraPlugins : 'devtools'</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1' ,
{
extraPlugins : 'devtools'
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,154 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace DIV &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
div.editable
{
border: solid 2px Transparent;
padding-left: 15px;
padding-right: 15px;
}
div.editable:hover
{
border-color: black;
}
</style>
<script type="text/javascript">
//<![CDATA[
// Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5;
window.onload = function()
{
// Listen to the double click event.
if ( window.addEventListener )
document.body.addEventListener( 'dblclick', onDoubleClick, false );
else if ( window.attachEvent )
document.body.attachEvent( 'ondblclick', onDoubleClick );
};
function onDoubleClick( ev )
{
// Get the element which fired the event. This is not necessarily the
// element to which the event has been attached.
var element = ev.target || ev.srcElement;
// Find out the div that holds this element.
var name;
do
{
element = element.parentNode;
}
while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' )
if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )
replaceDiv( element );
}
var editor;
function replaceDiv( div )
{
if ( editor )
editor.destroy();
editor = CKEDITOR.replace( div );
}
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Replace DIV with CKEditor on the Fly
</h1>
<div class="description">
<p>
This sample shows how to automatically replace <code>&lt;div&gt;</code> elements
with a CKEditor instance on the fly, following user's doubleclick. The content
that was previously placed inside the <code>&lt;div&gt;</code> element will now
be moved into CKEditor editing area.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<p>
Double-click any of the following <code>&lt;div&gt;</code> elements to transform them into
editor instances.</p>
<div class="editable">
<h3>
Part 1</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
</div>
<div class="editable">
<h3>
Part 2</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
<p>
Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus
sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum
vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate.
</p>
</div>
<div class="editable">
<h3>
Part 3</h3>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
</p>
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,115 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ENTER Key Configuration &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var editor;
function changeEnter()
{
// If we already have an editor, let's destroy it first.
if ( editor )
editor.destroy( true );
// Create the editor again, with the appropriate settings.
editor = CKEDITOR.replace( 'editor1',
{
enterMode : Number( document.getElementById( 'xEnter' ).value ),
shiftEnterMode : Number( document.getElementById( 'xShiftEnter' ).value )
});
}
window.onload = changeEnter;
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; ENTER Key Configuration
</h1>
<div class="description">
<p>
This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
to perform actions specified in the
<a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode"><code>enterMode</code></a>
and <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.shiftEnterMode"><code>shiftEnterMode</code></a>
parameters, respectively.
You can choose from the following options:
</p>
<ul class="samples">
<li><strong><code>ENTER_P</code></strong> &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
<li><strong><code>ENTER_BR</code></strong> &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
<li><strong><code>ENTER_DIV</code></strong> &ndash; new <code>&lt;div&gt;</code> blocks are created.</li>
</ul>
<p>
The sample code below shows how to configure CKEditor to create a <code>&lt;div&gt;</code> block when <em>Enter</em> key is pressed.
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>enterMode : CKEDITOR.ENTER_DIV</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<div style="float: left; margin-right: 20px">
When <em>Enter</em> is pressed:<br />
<select id="xEnter" onchange="changeEnter();">
<option selected="selected" value="1">Create a new &lt;P&gt; (recommended)</option>
<option value="3">Create a new &lt;DIV&gt;</option>
<option value="2">Break the line with a &lt;BR&gt;</option>
</select>
</div>
<div style="float: left">
When <em>Shift+Enter</em> is pressed:<br />
<select id="xShiftEnter" onchange="changeEnter();">
<option value="1">Create a new &lt;P&gt;</option>
<option value="3">Create a new &lt;DIV&gt;</option>
<option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option>
</select>
</div>
<br style="clear: both" />
<form action="sample_posteddata.php" method="post">
<p>
<br />
<textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Full Page Editing with Document Properties Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Full Page Editing with Document Properties Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to edit entire HTML pages, from the
<code>&lt;html&gt;</code> tag to the <code>&lt;/html&gt;</code> tag.
</p>
<p>
The <strong>Document Properties</strong> (<code>docprops</code>) plugin is also turned on.
This plugin allows you to set the metadata of the page, including the page encoding, margins,
meta tags, or background.
</p>
<p>
The CKEditor instance below is inserted with a JavaScript call using the following code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>fullPage : true,
extraPlugins : 'docprops'</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<label for="editor1">
CKEditor using the <code>docprops</code> plugin and working in the Full Page mode:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;html&gt;&lt;head&gt;&lt;title&gt;CKEditor Sample&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1',
{
fullPage : true,
extraPlugins : 'docprops'
});
//]]>
</script>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,116 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CKEditor Samples</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<link type="text/css" rel="stylesheet" href="sample.css" />
</head>
<body>
<h1 class="samples">
CKEditor Samples Site
</h1>
<h2 class="samples">
Basic Samples
</h2>
<ul class="samples">
<li>
<a class="samples" href="replacebyclass.html">Replace textarea elements by class name</a><br />
Automatic replacement of all textarea elements of a given class with a CKEditor instance.
</li>
<li><a class="samples" href="replacebycode.html">Replace textarea elements by code</a><br />
Replacement of textarea elements with CKEditor instances by using a JavaScript call.
</li>
<li><a class="samples" href="fullpage.html">Full page support with the Document Properties plugin</a><br />
CKEditor inserted with a JavaScript call and used to edit the whole page from <code>&lt;html&gt;</code> to <code>&lt;/html&gt;</code>.
</li>
</ul>
<h2 class="samples">
Basic Customization
</h2>
<ul class="samples">
<li><a class="samples" href="skins.html">Skins</a><br />
Changing the CKEditor skin by adjusting a single configuration option.
</li>
<li><a class="samples" href="ui_color.html">User Interface color</a><br />
Changing CKEditor User Interface color and adding a toolbar button that lets the user set the UI color.
</li>
<li><a class="samples" href="ui_languages.html">User Interface languages</a><br />
Changing CKEditor User Interface language and adding a drop-down list that lets the user choose the UI language.
</li>
</ul>
<h2 class="samples">
Advanced Samples
</h2>
<ul class="samples">
<li><a class="samples" href="divreplace.html">Replace DIV elements on the fly</a><br />
Transforming a <code>div</code> element into an instance of CKEditor with a mouse click.
</li>
<li><a class="samples" href="ajax.html">Create and destroy editor instances for Ajax applications</a><br />
Creating and destroying CKEditor instances on the fly and saving the contents entered into the editor window.
</li>
<li><a class="samples" href="api.html">Basic usage of the API</a><br />
Using the CKEditor JavaScript API to interact with the editor at runtime.
</li>
<li><a class="samples" href="api_dialog.html">Using the JavaScript API to customize dialog windows</a><br />
Using the dialog windows API to customize dialog windows without changing the original editor code.
</li>
<li><a class="samples" href="enterkey.html">Using the "Enter" key in CKEditor</a><br />
Configuring the behavior of <em>Enter</em> and <em>Shift+Enter</em> keys.
</li>
<li><a class="samples" href="sharedspaces.html">Shared toolbars</a><br />
Displaying multiple editor instances that share the toolbar and/or the elements path.
</li>
<li><a class="samples" href="jqueryadapter.html">jQuery adapter example</a><br />
Using the jQuery adapter to configure CKEditor.
</li>
<li><a class="samples" href="output_xhtml.html">Output XHTML</a><br />
Configuring CKEditor to produce XHTML 1.1 compliant code.
</li>
<li><a class="samples" href="output_html.html">Output HTML</a><br />
Configuring CKEditor to produce legacy HTML 4 code.
</li>
<li><a class="samples" href="output_for_flash.html">Output for Flash</a><br />
Configuring CKEditor to produce HTML code that can be used with Adobe Flash.
</li>
<li><a class="samples" href="readonly.html">Read-only mode</a><br />
Using the readOnly API to block introducing changes to the editor contents.
</li>
</ul>
<h2 class="samples">
Additional plugins
</h2>
<ul class="samples">
<li><a class="samples" href="autogrow.html">AutoGrow plugin</a><br />
Using the AutoGrow plugin in order to make the editor grow to fit the size of its content.
</li>
<li><a class="samples" href="bbcode.html">Output for BBCode</a><br />
Configuring CKEditor to produce BBCode tags instead of HTML.
</li>
<li><a class="samples" href="stylesheetparser.html">Stylesheet Parser plugin</a><br />
Using the Stylesheet Parser plugin to fill the Styles drop-down list based on the CSS classes available in the document stylesheet.
</li>
<li><a class="samples" href="devtools.html">Developer Tools plugin</a><br />
Using the Developer Tools plugin to display information about dialog window UI elements to allow for easier customization.
</li>
<li><a class="samples" href="placeholder.html">Placeholder plugin</a><br />
Using the Placeholder plugin to create uneditable sections that can only be created and modified with a proper dialog window.
</li>
<li><a class="samples" href="tableresize.html">TableResize plugin</a><br />
Using the TableResize plugin to enable table column resizing.
</li>
</ul>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,99 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Adapter &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="../ckeditor.js"></script>
<script type="text/javascript" src="../adapters/jquery.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
$(function()
{
var config = {
toolbar:
[
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'],
['UIColor']
]
};
// Initialize the editor.
// Callback function can be passed and executed after full instance creation.
$('.jquery_ckeditor').ckeditor(config);
});
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using jQuery Adapter
</h1>
<div class="description">
<p>
This sample shows how to load CKEditor and configure it using the
<a class="samples" href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/jQuery_Adapter">jQuery adapter</a>.
In this case the jQuery adapter is responsible for transforming a <code>&lt;textarea&gt;</code>
element into a CKEditor instance and setting the configuration of the toolbar.
</p>
<p>
CKEditor instance with custom configuration set in jQuery can be inserted with the
following JavaScript code:
</p>
<pre class="samples">$(function()
{
var config = {
skin:'v2'
};
$('.<em>textarea_class</em>').ckeditor(config);
});</pre>
<p>
Note that <code><em>textarea_class</em></code> in the code above is the
<code>class</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with
CKEditor. Any other jQuery selector can be used to match the target element.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML that you will usually find in your
pages. -->
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea class="jquery_ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,275 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Output for Flash &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="assets/swfobject.js"></script>
<script type="text/javascript">
function sendToFlash()
{
var html = CKEDITOR.instances.editor1.getData() ;
var flash = document.getElementById( 'ckFlash' ) ;
flash.setData( html ) ;
}
function init()
{
var so = new SWFObject("assets/output_for_flash.swf", "ckFlash", "550", "400", "8", "#ffffff") ;
so.addParam("wmode", "transparent");
so.write("ckFlashContainer") ;
}
</script>
</head>
<body onload="init()">
<h1 class="samples">
CKEditor Sample &mdash; Producing Flash Compliant HTML Output
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output
HTML code that can be used with
<a class="samples" href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&amp;file=00000922.html">
Adobe Flash</a>.
The code will contain a subset of standard HTML elements like <code>&lt;b&gt;</code>,
<code>&lt;i&gt;</code>, and <code>&lt;p&gt;</code> as well as HTML attributes.
</p>
<p>
To add a CKEditor instance outputting Flash compliant HTML code, load the editor using a standard
JavaScript call, and define CKEditor features to use HTML elements and attributes.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<p>
To see how it works, create some content in the editing area of CKEditor on the left
and send it to the Flash object on the right side of the page by using the
<strong>Send to Flash</strong> button.
</p>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<hr />
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 100%">
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
if ( document.location.protocol == 'file:' )
alert( 'Warning: This samples does not work when loaded from local filesystem due to security restrictions implemented in Flash.' +
'\n\nPlease load the sample from a web server instead.') ;
CKEDITOR.replace( 'editor1',
{
height : 300,
width : '100%',
toolbar : [
['Source','-','Bold','Italic','Underline','-','BulletedList','-','Link','Unlink'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
'/',
['Font','FontSize'],
['TextColor','-','About']
],
/*
* Style sheet for the contents
*/
contentsCss : 'body {color:#000; background-color#FFF; font-family: Arial; font-size:80%;} p, ol, ul {margin-top: 0px; margin-bottom: 0px;}',
/*
* Quirks doctype
*/
docType : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
/*
* Core styles.
*/
coreStyles_bold : { element : 'b' },
coreStyles_italic : { element : 'i' },
coreStyles_underline : { element : 'u'},
/*
* Font face
*/
// Define the way font elements will be applied to the document. The "font"
// element will be used.
font_style :
{
element : 'font',
attributes : { 'face' : '#(family)' }
},
/*
* Font sizes.
* The CSS part of the font sizes isn't used by Flash, it is there to get the
* font rendered correctly in CKEditor.
*/
fontSize_sizes : '8px/8;9px/9;10px/10;11px/11;12px/12;14px/14;16px/16;18px/18;20px/20;22px/22;24px/24;26px/26;28px/28;36px/36;48px/48;72px/72',
fontSize_style :
{
element : 'font',
attributes : { 'size' : '#(size)' },
styles : { 'font-size' : '#(size)px' }
} ,
/*
* Font colors.
*/
colorButton_enableMore : true,
colorButton_foreStyle :
{
element : 'font',
attributes : { 'color' : '#(color)' }
},
colorButton_backStyle :
{
element : 'font',
styles : { 'background-color' : '#(color)' }
},
on : { 'instanceReady' : configureFlashOutput }
});
/*
* Adjust the behavior of the dataProcessor to match the
* requirements of Flash
*/
function configureFlashOutput( ev )
{
var editor = ev.editor,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
// Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting match Flash expectations
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
{
dataProcessor.writer.setRules( e,
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
}
dataProcessor.writer.setRules( 'br',
{
indent : false,
breakBeforeOpen : false,
breakAfterOpen : false,
breakBeforeClose : false,
breakAfterClose : false
});
// Output properties as attributes, not styles.
htmlFilter.addRules(
{
elements :
{
$ : function( element )
{
var style, match, width, height, align;
// Output dimensions of images as width and height
if ( element.name == 'img' )
{
style = element.attributes.style;
if ( style )
{
// Get the width from the style.
match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style );
width = match && match[1];
// Get the height from the style.
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style );
height = match && match[1];
if ( width )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width;
}
if ( height )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height;
}
}
}
// Output alignment of paragraphs using align
if ( element.name == 'p' )
{
style = element.attributes.style;
if ( style )
{
// Get the align from the style.
match = /(?:^|\s)text-align\s*:\s*(\w*);?/i.exec( style );
align = match && match[1];
if ( align )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
element.attributes.align = align;
}
}
}
if ( element.attributes.style === '' )
delete element.attributes.style;
return element;
}
}
} );
}
//]]>
</script>
<input type="button" value="Send to Flash" onclick="sendToFlash();" />
</td>
<td valign="top" style="padding-left: 15px" id="ckFlashContainer">
</td>
</tr>
</table>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,285 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HTML Compliant Output &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Producing HTML Compliant Output
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output valid
<a class="samples" href="http://www.w3.org/TR/html401/">HTML 4.01</a> code.
Traditional HTML elements like <code>&lt;b&gt;</code>,
<code>&lt;i&gt;</code>, and <code>&lt;font&gt;</code> are used in place of
<code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code>, and CSS styles.
</p>
<p>
To add a CKEditor instance outputting legacy HTML 4.01 code, load the editor using a standard
JavaScript call, and define CKEditor features to use the HTML compliant elements and attributes.
</p>
<p>
A snippet of the configuration code can be seen below; check the source of this page for
full definition:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
coreStyles_bold : { element : 'b' },
coreStyles_italic : { element : 'i' },
fontSize_style :
{
element : 'font',
attributes : { 'size' : '#(size)' }
}
// More definitions follow.
});</pre>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;b&gt;sample text&lt;/b&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1',
{
/*
* Style sheet for the contents
*/
contentsCss : 'body {color:#000; background-color#:FFF;}',
/*
* Simple HTML5 doctype
*/
docType : '<!DOCTYPE HTML>',
/*
* Core styles.
*/
coreStyles_bold : { element : 'b' },
coreStyles_italic : { element : 'i' },
coreStyles_underline : { element : 'u'},
coreStyles_strike : { element : 'strike' },
/*
* Font face
*/
// Define the way font elements will be applied to the document. The "font"
// element will be used.
font_style :
{
element : 'font',
attributes : { 'face' : '#(family)' }
},
/*
* Font sizes.
*/
fontSize_sizes : 'xx-small/1;x-small/2;small/3;medium/4;large/5;x-large/6;xx-large/7',
fontSize_style :
{
element : 'font',
attributes : { 'size' : '#(size)' }
} ,
/*
* Font colors.
*/
colorButton_enableMore : true,
colorButton_foreStyle :
{
element : 'font',
attributes : { 'color' : '#(color)' }
},
colorButton_backStyle :
{
element : 'font',
styles : { 'background-color' : '#(color)' }
},
/*
* Styles combo.
*/
stylesSet :
[
{ name : 'Computer Code', element : 'code' },
{ name : 'Keyboard Phrase', element : 'kbd' },
{ name : 'Sample Text', element : 'samp' },
{ name : 'Variable', element : 'var' },
{ name : 'Deleted Text', element : 'del' },
{ name : 'Inserted Text', element : 'ins' },
{ name : 'Cited Work', element : 'cite' },
{ name : 'Inline Quotation', element : 'q' }
],
on : { 'instanceReady' : configureHtmlOutput }
});
/*
* Adjust the behavior of the dataProcessor to avoid styles
* and make it look like FCKeditor HTML output.
*/
function configureHtmlOutput( ev )
{
var editor = ev.editor,
dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
// Out self closing tags the HTML4 way, like <br>.
dataProcessor.writer.selfClosingEnd = '>';
// Make output formatting behave similar to FCKeditor
var dtd = CKEDITOR.dtd;
for ( var e in CKEDITOR.tools.extend( {}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent ) )
{
dataProcessor.writer.setRules( e,
{
indent : true,
breakBeforeOpen : true,
breakAfterOpen : false,
breakBeforeClose : !dtd[ e ][ '#' ],
breakAfterClose : true
});
}
// Output properties as attributes, not styles.
htmlFilter.addRules(
{
elements :
{
$ : function( element )
{
// Output dimensions of images as width and height
if ( element.name == 'img' )
{
var style = element.attributes.style;
if ( style )
{
// Get the width from the style.
var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec( style ),
width = match && match[1];
// Get the height from the style.
match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec( style );
var height = match && match[1];
if ( width )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)width\s*:\s*(\d+)px;?/i , '' );
element.attributes.width = width;
}
if ( height )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)height\s*:\s*(\d+)px;?/i , '' );
element.attributes.height = height;
}
}
}
// Output alignment of paragraphs using align
if ( element.name == 'p' )
{
style = element.attributes.style;
if ( style )
{
// Get the align from the style.
match = /(?:^|\s)text-align\s*:\s*(\w*);/i.exec( style );
var align = match && match[1];
if ( align )
{
element.attributes.style = element.attributes.style.replace( /(?:^|\s)text-align\s*:\s*(\w*);?/i , '' );
element.attributes.align = align;
}
}
}
if ( !element.attributes.style )
delete element.attributes.style;
return element;
}
},
attributes :
{
style : function( value, element )
{
// Return #RGB for background and border colors
return convertRGBToHex( value );
}
}
} );
}
/**
* Convert a CSS rgb(R, G, B) color back to #RRGGBB format.
* @param Css style string (can include more than one color
* @return Converted css style.
*/
function convertRGBToHex( cssStyle )
{
return cssStyle.replace( /(?:rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\))/gi, function( match, red, green, blue )
{
red = parseInt( red, 10 ).toString( 16 );
green = parseInt( green, 10 ).toString( 16 );
blue = parseInt( blue, 10 ).toString( 16 );
var color = [red, green, blue] ;
// Add padding zeros if the hex value is less than 0x10.
for ( var i = 0 ; i < color.length ; i++ )
color[i] = String( '0' + color[i] ).slice( -2 ) ;
return '#' + color.join( '' ) ;
});
}
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,177 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML Compliant Output &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Producing XHTML Compliant Output
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor to output valid
<a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code.
Deprecated elements (<code>&lt;font&gt;</code>, <code>&lt;u&gt;</code>) or attributes
(<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.
</p>
<p>
To add a CKEditor instance outputting valid XHTML code, load the editor using a standard
JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.
</p>
<p>
A snippet of the configuration code can be seen below; check the source of this page for
full definition:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
contentsCss : 'assets/output_xhtml.css',
coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'} },
// More definitions follow.
});</pre>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;span class="Bold"&gt;sample text&lt;/span&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1',
{
/*
* Style sheet for the contents
*/
contentsCss : 'assets/output_xhtml.css',
/*
* Core styles.
*/
coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'}},
coreStyles_underline : { element : 'span', attributes : {'class': 'Underline'}},
coreStyles_strike : { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' },
coreStyles_subscript : { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' },
coreStyles_superscript : { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' },
/*
* Font face
*/
// List of fonts available in the toolbar combo. Each font definition is
// separated by a semi-colon (;). We are using class names here, so each font
// is defined by {Combo Label}/{Class Name}.
font_names : 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',
// Define the way font elements will be applied to the document. The "span"
// element will be used. When a font is selected, the font name defined in the
// above list is passed to this definition with the name "Font", being it
// injected in the "class" attribute.
// We must also instruct the editor to replace span elements that are used to
// set the font (Overrides).
font_style :
{
element : 'span',
attributes : { 'class' : '#(family)' }
},
/*
* Font sizes.
*/
fontSize_sizes : 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
fontSize_style :
{
element : 'span',
attributes : { 'class' : '#(size)' }
} ,
/*
* Font colors.
*/
colorButton_enableMore : false,
colorButton_colors : 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
colorButton_foreStyle :
{
element : 'span',
attributes : { 'class' : '#(color)' }
},
colorButton_backStyle :
{
element : 'span',
attributes : { 'class' : '#(color)BG' }
},
/*
* Indentation.
*/
indentClasses : ['Indent1', 'Indent2', 'Indent3'],
/*
* Paragraph justification.
*/
justifyClasses : [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
/*
* Styles combo.
*/
stylesSet :
[
{ name : 'Strong Emphasis', element : 'strong' },
{ name : 'Emphasis', element : 'em' },
{ name : 'Computer Code', element : 'code' },
{ name : 'Keyboard Phrase', element : 'kbd' },
{ name : 'Sample Text', element : 'samp' },
{ name : 'Variable', element : 'var' },
{ name : 'Deleted Text', element : 'del' },
{ name : 'Inserted Text', element : 'ins' },
{ name : 'Cited Work', element : 'cite' },
{ name : 'Inline Quotation', element : 'q' }
]
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,120 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Setting Configuration Options &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Setting Configuration Options
</h1>
<p>
This sample shows how to insert a CKEditor instance with custom configuration options.
</p>
<p>
To set configuration options, use the <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html"><code>config</code></a> property. To set the attributes of a <code>&lt;textarea&gt;</code> element (which is displayed instead of CKEditor in unsupported browsers), use the <code>textareaAttributes</code> property.
</p>
<pre class="samples">
&lt;?php
// Include the CKEditor class.
include_once "ckeditor/ckeditor.php";
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';
// Set global configuration (used by every instance of CKEditor).
$CKEditor-><strong>config['width']</strong> = 600;
// Change default textarea attributes.
$CKEditor-><strong>textareaAttributes</strong> = array("cols" => 80, "rows" => 10);
// The initial value to be displayed in the editor.
$initialValue = 'This is some sample text.';
// Create the first instance.
$CKEditor->editor("textarea_id", $initialValue);
?&gt;</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>name</code> attribute of
the <code>&lt;textarea&gt;</code> element to be created.
</p>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="../sample_posteddata.php" method="post">
<label>Editor 1:</label>
<?php
// Include the CKEditor class.
include("../../ckeditor.php");
// Create a class instance.
$CKEditor = new CKEditor();
// Do not print the code directly to the browser, return it instead.
$CKEditor->returnOutput = true;
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// Set global configuration (will be used by all instances of CKEditor).
$CKEditor->config['width'] = 600;
// Change default textarea attributes.
$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);
// The initial value to be displayed in the editor.
$initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
// Create the first instance.
$code = $CKEditor->editor("editor1", $initialValue);
echo $code;
?>
<br />
<label>Editor 2:</label>
<?php
// Configuration that will only be used by the second editor.
$config['toolbar'] = array(
array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
array( 'Image', 'Link', 'Unlink', 'Anchor' )
);
$config['skin'] = 'v2';
// Create the second instance.
echo $CKEditor->editor("editor2", $initialValue, $config);
?>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,153 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Adding Event Handlers &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Adding Event Handlers
</h1>
<div class="description">
<p>
This sample shows how to add event handlers to CKEditor with PHP.
</p>
<p>
A snippet of the configuration code can be seen below; check the source code of this page for
the full definition:
</p>
<pre class="samples">&lt;?php
// Include the CKEditor class.
include("ckeditor/ckeditor.php");
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';
// The initial value to be displayed in the editor.
$initialValue = 'This is some sample text.';
// Add event handler, <em>instanceReady</em> is fired when editor is loaded.
$CKEditor-><strong>addEventHandler</strong>('instanceReady', 'function (evt) {
alert("Loaded editor: " + evt.editor.name);
}');
// Create an editor instance.
$CKEditor->editor("editor1", $initialValue);
</pre>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="../sample_posteddata.php" method="post">
<label>Editor 1:</label>
<?php
/**
* Adds a global event, will hide the "Target" tab in the "Link" dialog window in all instances.
*/
function CKEditorHideLinkTargetTab(&$CKEditor) {
$function = 'function (ev) {
// Take the dialog window name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition comes from the "Link" dialog window.
if ( dialogName == "link" )
dialogDefinition.removeContents("target")
}';
$CKEditor->addGlobalEventHandler('dialogDefinition', $function);
}
/**
* Adds a global event, will notify about an open dialog window.
*/
function CKEditorNotifyAboutOpenedDialog(&$CKEditor) {
$function = 'function (evt) {
alert("Loading a dialog window: " + evt.data.name);
}';
$CKEditor->addGlobalEventHandler('dialogDefinition', $function);
}
// Include the CKEditor class.
include("../../ckeditor.php");
// Create a class instance.
$CKEditor = new CKEditor();
// Set a configuration option for all editors.
$CKEditor->config['width'] = 750;
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// The initial value to be displayed in the editor.
$initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
// Event that will be handled only by the first editor.
$CKEditor->addEventHandler('instanceReady', 'function (evt) {
alert("Loaded editor: " + evt.editor.name);
}');
// Create the first instance.
$CKEditor->editor("editor1", $initialValue);
// Clear event handlers. Instances that will be created later will not have
// the 'instanceReady' listener defined a couple of lines above.
$CKEditor->clearEventHandlers();
?>
<br />
<label>Editor 2:</label>
<?php
// Configuration that will only be used by the second editor.
$config['width'] = '600';
$config['toolbar'] = 'Basic';
// Add some global event handlers (for all editors).
CKEditorHideLinkTargetTab($CKEditor);
CKEditorNotifyAboutOpenedDialog($CKEditor);
// Event that will only be handled by the second editor.
// Instead of calling addEventHandler(), events may be passed as an argument.
$events['instanceReady'] = 'function (evt) {
alert("Loaded second editor: " + evt.editor.name);
}';
// Create the second instance.
$CKEditor->editor("editor2", $initialValue, $config, $events);
?>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>CKEditor Samples &mdash; PHP Integration</title>
<link type="text/css" rel="stylesheet" href="../sample.css" />
</head>
<body>
<h1 class="samples">
CKEditor Samples List for PHP
</h1>
<h2 class="samples">
Basic Samples
</h2>
<ul class="samples">
<li><a class="samples" href="replace.php">Replace existing textarea elements by code</a><br />
Replacement of selected textarea elements with CKEditor instances by using a JavaScript call.</li>
<li><a class="samples" href="replaceall.php">Replace all textarea elements by code</a><br />
Replacement of all textarea elements with CKEditor instances by using a JavaScript call.</li>
<li><a class="samples" href="standalone.php">Create CKEditor instances in PHP</a><br />
Creating a CKEditor instance (no initial textarea element is required).</li>
</ul>
<h2 class="samples">
Advanced Samples
</h2>
<ul class="samples">
<li><a class="samples" href="advanced.php">Setting configuration options</a><br />
Creating a CKEditor instance with custom configuration options.</li>
<li><a class="samples" href="events.php">Listening to events</a><br />
Creating event handlers.
</li>
</ul>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,87 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Selected Textarea Elements &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Replace Selected Textarea Elements Using PHP Code
</h1>
<div class="description">
<p>
This sample shows how to replace a selected <code>&lt;textarea&gt;</code> element
with a CKEditor instance by using PHP code.
</p>
<p>
To replace a <code>&lt;textarea&gt;</code> element, place the following call at any point
after the <code>&lt;textarea&gt;</code> element:
</p>
<pre class="samples">
&lt;?php
// Include the CKEditor class.
include_once "ckeditor/ckeditor.php";
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';
// Replace a textarea element with an id (or name) of "textarea_id".
$CKEditor->replace("textarea_id");
?&gt;</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<?php
// Include the CKEditor class.
include_once "../../ckeditor.php";
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// Replace a textarea element with an id (or name) of "editor1".
$CKEditor->replace("editor1");
?>
</body>
</html>

View File

@@ -0,0 +1,88 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace All Textarea Elements &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Replace All Textarea Elements Using PHP Code
</h1>
<div class="description">
<p>
This sample shows how to replace all <code>&lt;textarea&gt;</code> elements
with CKEditor by using PHP code.
</p>
<p>
To replace all <code>&lt;textarea&gt;</code> elements, place the following call at any point
after the last <code>&lt;textarea&gt;</code> element:
</p>
<pre class="samples">
&lt;?php
// Include the CKEditor class.
include("ckeditor/ckeditor.php");
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';
// Replace all textarea elements with CKEditor.
$CKEditor->replaceAll();
?&gt;</pre>
</div>
<!-- This <div> holds alert messages to be displayed in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor2">
Editor 2:</label>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<?php
// Include the CKEditor class.
include("../../ckeditor.php");
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// Replace all textarea elements with CKEditor.
$CKEditor->replaceAll();
?>
</body>
</html>

View File

@@ -0,0 +1,83 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Creating CKEditor Instances &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link href="../sample.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Creating CKEditor Instances
</h1>
<div class="description">
<p>
This sample shows how to create a CKEditor instance with PHP.
</p>
<pre class="samples">
&lt;?php
include_once "ckeditor/ckeditor.php";
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';
// Create a textarea element and attach CKEditor to it.
$CKEditor->editor("textarea_id", "This is some sample text");
?&gt;</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of
the <code>&lt;textarea&gt;</code> element that will be created.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<!-- This <fieldset> holds the HTML code that you will usually find in your pages. -->
<form action="../sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
</p>
<p>
<?php
// Include the CKEditor class.
include_once "../../ckeditor.php";
// The initial value to be displayed in the editor.
$initialValue = '<p>This is some <strong>sample text</strong>.</p>';
// Create a class instance.
$CKEditor = new CKEditor();
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
// $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = '../../';
// Create a textarea element and attach CKEditor to it.
$CKEditor->editor("editor1", $initialValue);
?>
<input type="submit" value="Submit"/>
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Placeholder Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using the Placeholder Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor instances to use the
<strong>Placeholder</strong> plugin that lets you insert read-only elements
into your content. To enter and modify read-only text, use the
<strong>Create Placeholder</strong> button and its matching dialog window.
</p>
<p>
To add a CKEditor instance that uses the <code>placeholder</code> plugin and a related
<strong>Create Placeholder</strong> toolbar button, insert the following JavaScript
call to your code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>extraPlugins : 'placeholder',</strong>
toolbar : [ [ 'Source', 'Bold' ], [<strong>'CreatePlaceholder'</strong>] ]
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
CKEditor using the <code>placeholder</code> plugin with its default configuration:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is a [[sample placeholder]]. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;. &lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor1', {
extraPlugins : 'placeholder',
toolbar : [ [ 'Source', 'CreatePlaceholder' ] ]
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Read-only State &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var editor;
// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev )
{
editor = ev.editor;
// Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes.
editor.on( 'readOnly', function()
{
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
});
});
function toggleReadOnly( isReadOnly )
{
// Change the read-only state of the editor.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly
editor.setReadOnly( isReadOnly );
}
//]]>
</script>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using the CKEditor Read-Only API
</h1>
<div class="description">
<p>
This sample shows how to use the
<code><a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly</a></code>
API to put editor into the read-only state that makes it impossible for users to change the editor contents.
</p>
<p>
For details on how to create this setup check the source code of this sample page.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none" />
<input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Textareas by Class Name &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Replace Textarea Elements by Class Name
</h1>
<div class="description">
<p>
This sample shows how to automatically replace all <code>&lt;textarea&gt;</code> elements
of a given class with a CKEditor instance.
</p>
<p>
To replace a <code>&lt;textarea&gt;</code> element, simply assign it the <code>ckeditor</code>
class, as in the code below:
</p>
<pre class="samples">&lt;textarea <strong>class="ckeditor</strong>" name="editor1"&gt;&lt;/textarea&gt;</pre>
<p>
Note that other <code>&lt;textarea&gt;</code> attributes (like <code>id</code> or <code>name</code>) need to be adjusted to your document.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Replace Textarea by Code &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Replace Textarea Elements Using JavaScript Code
</h1>
<div class="description">
<p>
This sample shows how to automatically replace all <code>&lt;textarea&gt;</code> elements
with a CKEditor instance by using a JavaScript call.
</p>
<p>
To replace a <code>&lt;textarea&gt;</code> element, place the following call at any point
after the <code>&lt;textarea&gt;</code> element or inside a <code>&lt;script&gt;</code> element located
in the <code>&lt;head&gt;</code> section of the page, in a <code>window.onload</code> event handler:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>' );</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
Editor 1:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1' );
//]]>
</script>
</p>
<p>
<label for="editor2">
Editor 2:</label>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor2' );
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,163 @@
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
html, body, h1, h2, h3, h4, h5, h6, div, span, blockquote, p, address, form, fieldset, img, ul, ol, dl, dt, dd, li, hr, table, td, th, strong, em, sup, sub, dfn, ins, del, q, cite, var, samp, code, kbd, tt, pre {
line-height: 1.5em;
}
body {
padding:10px 30px;
}
input, textarea, select, option, optgroup, button, td, th {
font-size: 100%;
}
pre,
code,
kbd,
samp,
tt{
font-family: monospace,monospace;
font-size: 1em;
}
h1.samples {
color:#0782C1;
font-size:200%;
font-weight:normal;
margin: 0;
padding: 0;
}
h2.samples {
color:#000000;
font-size:130%;
margin: 0;
padding: 0;
}
p, blockquote, address, form, pre, dl, h1.samples, h2.samples {
margin-bottom:15px;
}
ul.samples {
margin-bottom:15px;
}
.clear {
clear:both;
}
fieldset
{
margin: 0;
padding: 10px;
}
body, input, textarea {
color: #333333;
font-family: Arial, Helvetica, sans-serif;
}
body {
font-size: 75%;
}
a.samples {
color:#189DE1;
text-decoration:none;
}
a.samples:hover {
text-decoration:underline;
}
form
{
margin: 0;
padding: 0;
}
pre.samples
{
background-color: #F7F7F7;
border: 1px solid #D7D7D7;
overflow: auto;
padding: 0.25em;
}
#alerts
{
color: Red;
}
#footer hr
{
margin: 10px 0 15px 0;
height: 1px;
border: solid 1px gray;
border-bottom: none;
}
#footer p
{
margin: 0 10px 10px 10px;
float: left;
}
#footer #copy
{
float: right;
}
#outputSample
{
width: 100%;
table-layout: fixed;
}
#outputSample thead th
{
color: #dddddd;
background-color: #999999;
padding: 4px;
white-space: nowrap;
}
#outputSample tbody th
{
vertical-align: top;
text-align: left;
}
#outputSample pre
{
margin: 0;
padding: 0;
white-space: pre; /* CSS2 */
white-space: -moz-pre-wrap; /* Mozilla*/
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
word-wrap: break-word; /* IE */
}
.description {
border: 1px dotted #B7B7B7;
margin-bottom: 10px;
padding: 10px 10px 0;
}
label {
display: block;
margin-bottom:6px;
}
.cke_dialog label
{
display: inline;
margin-bottom: auto;
}

View File

@@ -0,0 +1,65 @@
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
// This file is not required by CKEditor and may be safely ignored.
// It is just a helper file that displays a red message about browser compatibility
// at the top of the samples (if incompatible browser is detected).
if ( window.CKEDITOR )
{
(function()
{
var showCompatibilityMsg = function()
{
var env = CKEDITOR.env;
var html = '<p><strong>Your browser is not compatible with CKEditor.</strong>';
var browsers =
{
gecko : 'Firefox 2.0',
ie : 'Internet Explorer 6.0',
opera : 'Opera 9.5',
webkit : 'Safari 3.0'
};
var alsoBrowsers = '';
for ( var key in env )
{
if ( browsers[ key ] )
{
if ( env[key] )
html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.';
else
alsoBrowsers += browsers[ key ] + '+, ';
}
}
alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' );
html += ' It is also compatible with ' + alsoBrowsers + '.';
html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>';
var alertsEl = document.getElementById( 'alerts' );
alertsEl && ( alertsEl.innerHTML = html );
};
var onload = function()
{
// Show a friendly compatibility message as soon as the page is loaded,
// for those browsers that are not compatible with CKEditor.
if ( !CKEDITOR.env.isCompatible )
showCompatibilityMsg();
};
// Register the onload listener.
if ( window.addEventListener )
window.addEventListener( 'load', onload, false );
else if ( window.attachEvent )
window.attachEvent( 'onload', onload );
})();
}

View File

@@ -0,0 +1,21 @@
<?php /*
-------------------------------------------------------------------------------------------
CKEditor - Posted Data
We are sorry, but your Web server does not support the PHP language used in this script.
Please note that CKEditor can be used with any other server-side language than just PHP.
To save the content created with CKEditor you need to read the POST data on the server
side and write it to a file or a database.
Copyright 2003-2011, CKSource - Frederico Knabben.
All rights reserved.
-------------------------------------------------------------------------------------------
*/ include "assets/_posteddata.php"; ?>

View File

@@ -0,0 +1,153 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Shared Toolbars &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
<style id="styles" type="text/css">
#editorsForm
{
height: 400px;
overflow: auto;
border: solid 1px #555;
margin: 10px 0;
padding: 0 10px;
}
</style>
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Shared Toolbars
</h1>
<div class="description">
<p>
This sample shows how to configure multiple CKEditor instances to share some parts of the interface.
You can choose to share the toolbar (<code>topSpace</code>), the elements path
(<code>bottomSpace</code>), or both.
</p>
<p>
CKEditor instances with shared spaces can be inserted with a JavaScript call using the following code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>sharedSpaces :
{
top : 'topSpace',
bottom : 'bottomSpace'
}</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<div id="topSpace">
</div>
<form action="sample_posteddata.php" id="editorsForm" method="post">
<p>
<label for="editor1">
Editor 1 (uses the shared toolbar and elements path):</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor2">
Editor 2 (uses the shared toolbar and elements path):</label>
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor3">
Editor 3 (uses the shared toolbar only):</label>
<textarea cols="80" id="editor3" name="editor3" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<label for="editor4">
Editor 4 (no shared spaces):</label>
<textarea cols="80" id="editor4" name="editor4" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="bottomSpace">
</div>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<script type="text/javascript">
//<![CDATA[
// Create all editor instances at the end of the page, so we are sure
// that the "bottomSpace" div is available in the DOM (IE issue).
CKEDITOR.replace( 'editor1',
{
sharedSpaces :
{
top : 'topSpace',
bottom : 'bottomSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
// Removes the resizer as it's not usable in a
// shared elements path.
removePlugins : 'maximize,resize'
} );
CKEDITOR.replace( 'editor2',
{
sharedSpaces :
{
top : 'topSpace',
bottom : 'bottomSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
// Removes the resizer as it's not usable in a
// shared elements path.
removePlugins : 'maximize,resize'
} );
CKEDITOR.replace( 'editor3',
{
sharedSpaces :
{
top : 'topSpace'
},
// Removes the maximize plugin as it's not usable
// in a shared toolbar.
removePlugins : 'maximize'
} );
CKEDITOR.replace( 'editor4' );
//]]>
</script>
</body>
</html>

View File

@@ -0,0 +1,110 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Skins &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Skins
</h1>
<div class="description">
<p>
This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
with a CKEditor instance using a specific <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.skin">skin</a>.
</p>
<p>
CKEditor with a specified skin (in this case, the "Office 2003" skin) is inserted with a JavaScript call using the following code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>skin : 'office2003'</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<h2 class="samples">&quot;Kama&quot; skin</h2>
<p>The default skin used in CKEditor. No additional configuration is required.</p>
<p>
<textarea cols="80" id="editor_kama" name="editor_kama" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_kama',
{
skin : 'kama'
});
//]]>
</script>
</p>
<h2 class="samples">&quot;Office 2003&quot; skin</h2>
<p>Use the following code to configure a CKEditor instance to use the "Office 2003" skin.</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>skin : 'office2003'</strong>
});</pre>
<p>
<textarea cols="80" id="editor_office2003" name="editor_office2003" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_office2003',
{
skin : 'office2003'
});
//]]>
</script>
</p>
<h2 class="samples">&quot;V2&quot; skin</h2>
<p>Use the following code to configure a CKEditor instance to use the "V2" skin.</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>skin : 'v2'</strong>
});</pre>
<textarea cols="80" id="editor_v2" name="editor_v2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'editor_v2',
{
skin : 'v2'
});
//]]>
</script>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,93 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using Stylesheet Parser Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using the Stylesheet Parser Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor instances to use the
<strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
the <strong>Styles</strong> drop-down list based on the CSS rules available in the document stylesheet.
</p>
<p>
To add a CKEditor instance using the <code>stylesheetparser</code> plugin, insert
the following JavaScript call into your code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>extraPlugins : 'stylesheetparser'</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
CKEditor using the <code>stylesheetparser</code> plugin with its default configuration:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1' ,
{
extraPlugins : 'stylesheetparser',
/*
* Stylesheet for the contents.
*/
contentsCss : 'assets/parsesample.css',
/*
* Do not load the default Styles configuration.
*/
stylesSet : []
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,115 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using TableResize Plugin &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="../ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="samples">
CKEditor Sample &mdash; Using the TableResize Plugin
</h1>
<div class="description">
<p>
This sample shows how to configure CKEditor instances to use the
<strong>TableResize</strong> (<code>tableresize</code>) plugin that allows
the user to edit table columns by using the mouse.
</p>
<p>
The TableResize plugin makes it possible to modify table column width. Hover
your mouse over the column border to see the cursor change to indicate that
the column can be resized. Click and drag your mouse to set the desired width.
</p>
<p>
By default the plugin is turned off. To add a CKEditor instance using the
TableResize plugin, insert the following JavaScript call into your code:
</p>
<pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
{
<strong>extraPlugins : 'tableresize'</strong>
});</pre>
<p>
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
</p>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
<noscript>
<p>
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.
</p>
</noscript>
</div>
<form action="sample_posteddata.php" method="post">
<p>
<label for="editor1">
CKEditor using the <code>tableresize</code> plugin:</label>
<textarea cols="80" id="editor1" name="editor1" rows="10">
&lt;table style="width: 500px;"&gt;
&lt;caption&gt;
A sample table&lt;/caption&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
Column 1&lt;/td&gt;
&lt;td&gt;
Column 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
You can resize a table column.&lt;/td&gt;
&lt;td&gt;
Hover your mouse over its border.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Watch the cursor change.&lt;/td&gt;
&lt;td&gt;
Now click and drag to resize.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'editor1', {
extraPlugins : 'tableresize'
});
//]]>
</script>
</p>
<p>
<input type="submit" value="Submit" />
</p>
</form>
<div id="footer">
<hr />
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More