Skip to content
Browse files

init

  • Loading branch information...
0 parents commit 5df022c35c02cfae148ed1e75f71f5b7eb8d5dc1 @Vrtak-CZ Vrtak-CZ committed Jan 10, 2011
85 LICENSE.txt
@@ -0,0 +1,85 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+=================================
+Version 3, 29 June 2007
+
+Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+
+This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
+
+0. Additional Definitions.
+--------------------------
+
+As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
+
+"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
+
+An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
+
+A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
+
+The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
+
+The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
+
+1. Exception to Section 3 of the GNU GPL.
+-----------------------------------------
+
+You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
+
+2. Conveying Modified Versions.
+-------------------------------
+
+If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
+
+a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
+
+b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
+
+3. Object Code Incorporating Material from Library Header Files.
+----------------------------------------------------------------
+
+The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
+
+a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are
+ covered by this License.
+
+b) Accompany the object code with a copy of the GNU GPL and this license document.
+
+4. Combined Works.
+------------------
+
+You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
+
+a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
+
+b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
+
+c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
+
+d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
+
+e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
+
+5. Combined Libraries.
+----------------------
+
+You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
+
+a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
+
+b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+6. Revised Versions of the GNU Lesser General Public License.
+-------------------------------------------------------------
+
+The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
+
+If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
34 README.txt
@@ -0,0 +1,34 @@
+Welcome to Nella Framework
+==========================
+
+Nella Framework is a powerful Nette Framework overlay for creating web applications and services in PHP 5.3. Nella Framework is designed with simplicity, speed and flexibility in mind. It allows developers to easy built better websites.
+
+Nella Framework focuses on security and performance and is definitely one of the safest and fastest PHP frameworks. Nella Framework support the latest technologies and approaches like AJAX, HTML5, SEO, DRY, KISS, MVC, etc.
+
+
+Requirements
+------------
+
+Nella Framework prequires PHP 5.3.0 or later. Please run Nette Framework "Requirements Checker" to obtain more detailed information.
+
+
+Installation
+------------
+
+After downloading the latest distribution package from http://nellacms.com/download, extract it to a directory accessible by web server. The installation is done!
+
+The source tree includes the following directories:
+
+- Nella: this directory contains the source code of Nella Framework. This is the only directory that you will need in order to deploy with your application.
+
+- API: generated API documentation for the framework in HTML format. These files are build using Apidoc from the contents of the Nella directory.
+
+- sandbox: contains a pre-packaged Nella Framework project, basic configure structure for your application.
+
+- tests: contains Nella Framework unit tests.
+
+
+-----
+
+homepage: http://nellacms.com
+repository: http://github.com/nella/nella
2 app/.htaccess
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from all
50 app/bootstrap.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * My Application bootstrap file.
+ *
+ * @copyright Copyright (c) 2011 John Doe
+ * @package App
+ */
+
+
+use Nette\Debug;
+use Nette\Environment;
+use Nette\Application\Route;
+
+
+// Step 1: Load Nella Framework
+// this allows load Nella Framework classes automatically so that
+// you don't have to litter your code with 'require' statements
+require LIBS_DIR . '/Nella/loader.php';
+
+
+
+// Step 2: Configure environment
+// 2a) enable Nette\Debug for better exception and error visualisation
+Debug::enable();
+
+// 2b) load configuration from config.ini file
+Environment::loadConfig();
+
+
+
+// Step 3: Configure application
+// 3a) get and setup a front controller
+$application = Environment::getApplication();
+$application->errorPresenter = 'Error';
+//$application->catchExceptions = TRUE;
+
+
+
+// Step 4: Setup application router
+$router = $application->getRouter();
+
+$router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
+
+$router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
+
+
+
+// Step 5: Run the application!
+$application->run();
28 app/config.neon
@@ -0,0 +1,28 @@
+#
+# SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser!
+#
+# If you don't protect this directory from direct web access, anybody will be able to see your passwords.
+# http://nette.org/security-warning
+#
+common:
+ # PHP configuration
+ php:
+ date.timezone = "Europe/Prague"
+ session.save_path = "%tempDir%/sessions"
+ #zlib.output_compression = yes
+ #default_charset = "UTF-8"
+
+ # services
+ service:
+ Nette\Loaders\RobotLoader:
+ option:
+ directory = [%appDir%, %libsDir%]
+ run = TRUE
+
+production < common:
+ php:
+ default_charset = "UTF-8" # need this because empty section not supported yet
+
+development < common:
+ php:
+ default_charset = "UTF-8" # need this because empty section not supported yet
20 app/presenters/BasePresenter.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * My Application
+ *
+ * @copyright Copyright (c) 2010 John Doe
+ * @package MyApplication
+ */
+
+
+/**
+ * Base class for all application presenters.
+ *
+ * @author John Doe
+ * @package MyApplication
+ */
+abstract class BasePresenter extends Nette\Application\Presenter
+{
+
+}
44 app/presenters/ErrorPresenter.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * My Application
+ *
+ * @copyright Copyright (c) 2010 John Doe
+ * @package MyApplication
+ */
+
+use Nette\Debug,
+ Nette\Application\BadRequestException;
+
+
+
+/**
+ * Error presenter.
+ *
+ * @author John Doe
+ * @package MyApplication
+ */
+class ErrorPresenter extends BasePresenter
+{
+
+ /**
+ * @param Exception
+ * @return void
+ */
+ public function renderDefault($exception)
+ {
+ if ($this->isAjax()) { // AJAX request? Just note this error in payload.
+ $this->payload->error = TRUE;
+ $this->terminate();
+
+ } elseif ($exception instanceof BadRequestException) {
+ $code = $exception->getCode();
+ $this->setView(in_array($code, array(403, 404, 405, 410, 500)) ? $code : '4xx'); // load template 403.latte or 404.latte or ... 4xx.latte
+
+ } else {
+ $this->setView('500'); // load template 500.latte
+ Debug::log($exception, Debug::ERROR); // and log exception
+ }
+ }
+
+}
26 app/presenters/HomepagePresenter.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * My Application
+ *
+ * @copyright Copyright (c) 2010 John Doe
+ * @package MyApplication
+ */
+
+
+
+/**
+ * Homepage presenter.
+ *
+ * @author John Doe
+ * @package MyApplication
+ */
+class HomepagePresenter extends BasePresenter
+{
+
+ public function renderDefault()
+ {
+ $this->template->anyVariable = 'any value';
+ }
+
+}
35 app/templates/@layout.latte
@@ -0,0 +1,35 @@
+{**
+ * My Application layout template.
+ *
+ * @copyright Copyright (c) 2010 John Doe
+ * @package MyApplication
+ *
+ * @param string $basePath web base path
+ * @param string $robots tell robots how to index the content of a page (optional)
+ * @param array $flashes flash messages
+ *}
+
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+
+ <meta name="description" content="Nette Framework web application skeleton">
+ <meta name="robots" content="{$robots}" n:ifset="$robots">
+
+ <title>Nette Application Skeleton</title>
+
+ <link rel="stylesheet" media="screen,projection,tv" href="{$basePath}/css/screen.css" type="text/css">
+ <link rel="stylesheet" media="print" href="{$basePath}/css/print.css" type="text/css">
+ <link rel="shortcut icon" href="{$basePath}/favicon.ico" type="image/x-icon">
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
+ <script type="text/javascript" src="{$basePath}/js/netteForms.js"></script>
+</head>
+
+<body>
+ <div n:foreach="$flashes as $flash" class="flash {$flash->type}">{$flash->message}</div>
+
+ {include #content}
+</body>
+</html>
9 app/templates/Error/403.latte
@@ -0,0 +1,9 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Access Denied</h1>
+
+<p>You do not have permission to view this page. Please try contact the web
+site administrator if you believe you should be able to view this page.</p>
+
+<p><small>error 403</small></p>
10 app/templates/Error/404.latte
@@ -0,0 +1,10 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Page Not Found</h1>
+
+<p>The page you requested could not be found. It is possible that the address is
+incorrect, or that the page no longer exists. Please use a search engine to find
+what you are looking for.</p>
+
+<p><small>error 404</small></p>
8 app/templates/Error/405.latte
@@ -0,0 +1,8 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Method Not Allowed</h1>
+
+<p>The requested method is not allowed for the URL.</p>
+
+<p><small>error 405</small></p>
8 app/templates/Error/410.latte
@@ -0,0 +1,8 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Page Not Found</h1>
+
+<p>The page you requested has been taken off the site. We apologize for the inconvenience.</p>
+
+<p><small>error 410</small></p>
6 app/templates/Error/4xx.latte
@@ -0,0 +1,6 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Oops...</h1>
+
+<p>Your browser sent a request that this server could not understand or process.</p>
9 app/templates/Error/500.latte
@@ -0,0 +1,9 @@
+{var $robots = noindex}
+{block #content}
+
+<h1>Server Error</h1>
+
+<p>We're sorry! The server encountered an internal error and
+was unable to complete your request. Please try again later.</p>
+
+<p><small>error 500</small></p>
132 app/templates/Homepage/default.latte
@@ -0,0 +1,132 @@
+{* This is temporary page, you can delete it *}
+
+{block content}
+<div id="wrapper">
+ <div id="logo"></div>
+
+ <h1>Congratulations!</h1>
+
+ <h2>You have successfully created your Nella Framework project.</h2>
+
+ <hr>
+
+ <h2>What to do next?</h2>
+
+ <ol>
+ <li><h3>Edit this page</h3>
+ <p>To change the content of this page, modify file <code>/app/templates/Homepage/default.latte</code> and layout
+ <code>/app/templates/@layout.latte</code>. The corresponding presenter is found at <code>/app/presenters/HomepagePresenter.php</code>.</p>
+
+ <li><h3>Add new pages</h3>
+ <p>Add new actions in <code>HomepagePresenter.php</code> (or create new presenters)
+ and create corresponding templates under <code>/app/templates</code>.<p>
+
+ <li><h3>Learn more from the documentation</h3>
+ <p>If you are exploring Nette Framework for the very first time, you should start by reading the
+ <a href="http://doc.nette.org">documentation</a>, <a href="http://pla.nette.org">tutorials</a> and <a href="http://forum.nette.org">forum</a>.</p>
+ </ol>
+
+ <h2>We hope you enjoy this framework! <img src="{$basePath}/images/nette-powered.gif" width="80" height="15" alt="Nette Framework powered" /> <img src="{$basePath}/images/nella-powered.gif" width="80" height="15" alt="Nella Framework powered" /></h2>
+
+ <ul id="environment">
+ <li>PHP {=PHP_VERSION}</li>
+ <li n:ifset="$_SERVER['SERVER_SOFTWARE']">Server {$_SERVER['SERVER_SOFTWARE']}</li>
+ <li>Nette Framework {=Nette\Framework::VERSION}</li>
+ <li>Nella Framework {=Nella\Framework::VERSION}</li>
+ </ul>
+</div>
+
+<style>
+ html {
+ font: 16px/1.5 sans-serif;
+ border-top: 8.7em solid #F4EBDB;
+ }
+
+ body {
+ font: inherit;
+ border-top: 5px solid #E4DED5;
+ margin: 0;
+ background: white;
+ color: #333;
+ }
+
+ #wrapper {
+ max-width: 670px;
+ margin: -8.7em auto 0;
+ }
+
+ #logo {
+ position: absolute;
+ width: 150px;
+ height: 8.7em;
+ top: 0;
+ right: 3em;
+ background: url('data:image/gif;base64,R0lGODlhlQA/ALMAAPTr29LKvczEuPzz49rRw+PbzPbt3MK6ruri07u0qPjv3vnw3/Lp2e/m1vXs2/Ho1y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4em 0 -.3em;
+ text-shadow: 1px 1px 0 white;
+ }
+
+ h2, h3 {
+ font-size: 18px;
+ color: #7A7772;
+ margin: .6em 0;
+ text-shadow: 1px 1px 0 white;
+ }
+
+ h3 {
+ font-size: 16px;
+ color: #3484D2;
+ }
+
+ ol {
+ margin: 0;
+ padding: 0;
+ }
+
+ ol li {
+ margin: 1em 0;
+ }
+
+ ol li p {
+ font-size: 90%;
+ }
+
+ code {
+ color: #666;
+ }
+
+ hr {
+ visibility: hidden;
+ height: 2em;
+ }
+
+ img {
+ border: none;
+ }
+
+ a {
+ color: #3484D2;
+ padding: 3px 1px;
+ font-weight: bold;
+ }
+
+ a:hover, a:active, a:focus {
+ background-color: #3484D2;
+ text-decoration: none;
+ color: white;
+ }
+
+ #environment {
+ font-size: 70%;
+ margin: 3em 0;
+ padding: 1em 0;
+ border-top: 1px solid #EEE;
+ list-style: none;
+ color: gray;
+ }
+</style>
16 app/web.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="RequestBlocking" patternSyntax="Wildcard" stopProcessing="true">
+ <match url="*" />
+ <conditions>
+ <add input="{URL}" pattern="*" />
+ </conditions>
+ <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>
2 libs/.htaccess
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from all
1 libs/Nella/README.txt
@@ -0,0 +1 @@
+Put Nella here (http://github.com/nella/framework/tree/master/Nella)
1 libs/Nette/README.txt
@@ -0,0 +1 @@
+Put Nette here (http://github.com/nette/nette/tree/master/Nette)
16 libs/web.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="RequestBlocking" patternSyntax="Wildcard" stopProcessing="true">
+ <match url="*" />
+ <conditions>
+ <add input="{URL}" pattern="*" />
+ </conditions>
+ <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>
4 log/.gitignore
@@ -0,0 +1,4 @@
+*
+!.gitignore
+!.htaccess
+!web.config
2 log/.htaccess
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from all
16 log/web.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="RequestBlocking" patternSyntax="Wildcard" stopProcessing="true">
+ <match url="*" />
+ <conditions>
+ <add input="{URL}" pattern="*" />
+ </conditions>
+ <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>
6 temp/.gitignore
@@ -0,0 +1,6 @@
+*
+!.gitignore
+!.htaccess
+!web.config
+!cache
+!session
2 temp/.htaccess
@@ -0,0 +1,2 @@
+Order Allow,Deny
+Deny from all
2 temp/cache/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
16 temp/web.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="RequestBlocking" patternSyntax="Wildcard" stopProcessing="true">
+ <match url="*" />
+ <conditions>
+ <add input="{URL}" pattern="*" />
+ </conditions>
+ <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>
2 tests/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
41 www/.htaccess
@@ -0,0 +1,41 @@
+# Apache configuration file (see httpd.apache.org/docs/2.2/mod/quickreference.html)
+
+# disable directory listing
+Options -Indexes
+
+# allows symbolic links in this directory
+Options +FollowSymLinks
+
+# configure PHP
+# <IfModule mod_php5.c>
+# php_flag register_globals off
+# php_flag zend.ze1_compatibility_mode off
+# php_flag session.auto_start off
+# </IfModule>
+
+# enable cool URL
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ # RewriteBase /
+
+ # front controller
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
+</IfModule>
+
+# default charset should be UTF-8
+AddDefaultCharset utf-8
+
+# enable gzip compression
+<IfModule mod_deflate.c>
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
+</IfModule>
+
+# allow combined JavaScript & CSS. Inside of script.combined.js you could use <!--#include file="script.js" -->
+<IfModule mod_include.c>
+ <FilesMatch "\.combined\.(js|css)$">
+ Options +Includes
+ SetOutputFilter INCLUDES
+ </FilesMatch>
+</IfModule>
12 www/css/print.css
@@ -0,0 +1,12 @@
+body {
+ font: 12pt/1.4 "Trebuchet MS", "Geneva CE", lucida, sans-serif;
+ color: black;
+ background: none;
+ width: 100%;
+}
+
+a img { border: none; }
+
+#ajax-spinner {
+ display: none;
+}
32 www/css/screen.css
@@ -0,0 +1,32 @@
+body {
+ font: 16px/1.5 "Trebuchet MS", "Geneva CE", lucida, sans-serif;
+ color: #333;
+ background-color: #fff;
+}
+
+h1 {
+ font-size: 150%;
+ color: #3484D2;
+}
+
+#ajax-spinner {
+ margin: 15px 0 0 15px;
+ padding: 13px;
+ background: white url('../images/spinner.gif') no-repeat 50% 50%;
+ font-size: 0;
+ z-index: 123456;
+ display: none;
+}
+
+div.flash {
+ color: black;
+ background: #FFF9D7;
+ border: 1px solid #E2C822;
+ padding: 1em;
+ margin: 1em 0;
+}
+
+a[href^="error:"] {
+ background: red;
+ color: white;
+}
BIN www/favicon.ico
Binary file not shown.
BIN www/images/nella-powered.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN www/images/nette-powered.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN www/images/spinner.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 www/index.php
@@ -0,0 +1,19 @@
+<?php
+
+// the identification of this site
+define('SITE', '');
+
+// absolute filesystem path to the web root
+define('WWW_DIR', __DIR__);
+
+// absolute filesystem path to the application root
+define('APP_DIR', WWW_DIR . '/../app');
+
+// absolute filesystem path to the libraries
+define('LIBS_DIR', WWW_DIR . '/../libs');
+
+// absolute filesystem path to the temporary files
+define('TEMP_DIR', WWW_DIR . '/../temp');
+
+// load bootstrap file
+require APP_DIR . '/bootstrap.php';
266 www/js/netteForms.js
@@ -0,0 +1,266 @@
+/**
+ * NetteForms - simple form validation.
+ *
+ * This file is part of the Nette Framework.
+ * Copyright (c) 2010 David Grudl (http://davidgrudl.com)
+ */
+
+var Nette = Nette || {};
+
+Nette.addEvent = function (element, on, callback) {
+ var original = element['on' + on];
+ element['on' + on] = function () {
+ if (typeof original === 'function' && original.apply(element, arguments) === false) return false;
+ return callback.apply(element, arguments);
+ };
+};
+
+
+Nette.getValue = function(elem) {
+ if (!elem) {
+ return null;
+
+ } else if (!elem.nodeName) { // radio
+ for (var i = 0, len = elem.length; i < len; i++) {
+ if (elem[i].checked) {
+ return elem[i].value;
+ }
+ }
+ return null;
+
+ } else if (elem.nodeName.toLowerCase() === 'select') {
+ var index = elem.selectedIndex, options = elem.options;
+
+ if (index < 0) {
+ return null;
+
+ } else if (elem.type === 'select-one') {
+ return options[index].value;
+ }
+
+ for (var i = 0, values = [], len = options.length; i < len; i++) {
+ if (options[i].selected) {
+ values.push(options[i].value);
+ }
+ }
+ return values;
+
+ } else if (elem.type === 'checkbox') {
+ return elem.checked;
+
+ } else if (elem.type === 'radio') {
+ return Nette.getValue(elem.form.elements[elem.name]);
+
+ } else {
+ return elem.value.replace(/^\s+|\s+$/g, '');
+ }
+};
+
+
+Nette.validateControl = function(elem, rules, onlyCheck) {
+ rules = rules || eval('[' + (elem.getAttribute('data-nette-rules') || '') + ']');
+ for (var id in rules) {
+ var rule = rules[id], op = rule.op.match(/(~)?([^?]+)/);
+ rule.neg = op[1];
+ rule.op = op[2];
+ rule.condition = !!rule.rules;
+ var el = rule.control ? elem.form.elements[rule.control] : elem;
+
+ var success = Nette.validateRule(el, rule.op, rule.arg);
+ if (success === null) continue;
+ if (rule.neg) success = !success;
+
+ if (rule.condition && success) {
+ if (!Nette.validateControl(elem, rule.rules, onlyCheck)) {
+ return false;
+ }
+ } else if (!rule.condition && !success) {
+ if (el.disabled) continue;
+ if (!onlyCheck) {
+ Nette.addError(el, rule.msg.replace('%value', Nette.getValue(el)));
+ }
+ return false;
+ }
+ }
+ return true;
+};
+
+
+Nette.validateForm = function(sender) {
+ var form = sender.form || sender;
+ if (form['nette-submittedBy'] && form.elements[form['nette-submittedBy']] && form.elements[form['nette-submittedBy']].getAttribute('formnovalidate') !== null) {
+ return true;
+ }
+ for (var i = 0; i < form.elements.length; i++) {
+ var elem = form.elements[i];
+ if (!(elem.nodeName.toLowerCase() in {input:1, select:1, textarea:1}) || (elem.type in {hidden:1, submit:1, image:1, reset: 1}) || elem.disabled || elem.readonly) {
+ continue;
+ }
+ if (!Nette.validateControl(elem)) {
+ return false;
+ }
+ }
+ return true;
+};
+
+
+Nette.addError = function(elem, message) {
+ if (elem.focus) {
+ elem.focus();
+ }
+ if (message) {
+ alert(message);
+ }
+};
+
+
+Nette.validateRule = function(elem, op, arg) {
+ var val = Nette.getValue(elem);
+
+ if (elem.getAttribute) {
+ if (val === elem.getAttribute('data-nette-empty-value')) val = null;
+ }
+
+ switch (op) {
+ case ':filled':
+ return val !== '' && val !== false && val !== null;
+
+ case ':valid':
+ return Nette.validateControl(elem, null, true);
+
+ case ':equal':
+ arg = arg instanceof Array ? arg : [arg];
+ for (var i in arg) {
+ if (val == (arg[i].control ? Nette.getValue(elem.form.elements[arg[i].control]) : arg[i])) return true;
+ }
+ return false;
+
+ case ':minLength':
+ return val.length >= arg;
+
+ case ':maxLength':
+ return val.length <= arg;
+
+ case ':length':
+ if (typeof arg !== 'object') {
+ arg = [arg, arg];
+ }
+ return (arg[0] === null || val.length >= arg[0]) && (arg[1] === null || val.length <= arg[1]);
+
+ case ':email':
+ return /^[^@\s]+@[^@\s]+\.[a-z]{2,10}$/i.test(val);
+
+ case ':url':
+ return /^.+\.[a-z]{2,6}(\/.*)?$/i.test(val);
+
+ case ':regexp':
+ var parts = arg.match(/^\/(.*)\/([imu]*)$/);
+ if (parts) try {
+ return (new RegExp(parts[1], parts[2].replace('u', ''))).test(val);
+ } catch (e) {}
+ return;
+
+ case ':integer':
+ return /^-?[0-9]+$/.test(val);
+
+ case ':float':
+ return /^-?[0-9]*[.,]?[0-9]+$/.test(val);
+
+ case ':range':
+ return (arg[0] === null || parseFloat(val) >= arg[0]) && (arg[1] === null || parseFloat(val) <= arg[1]);
+
+ case ':submitted':
+ return elem.form['nette-submittedBy'] === elem.name;
+ }
+ return null;
+};
+
+
+Nette.toggleForm = function(form) {
+ for (var i = 0; i < form.elements.length; i++) {
+ if (form.elements[i].nodeName.toLowerCase() in {input:1, select:1, textarea:1, button:1}) {
+ Nette.toggleControl(form.elements[i]);
+ }
+ }
+};
+
+
+Nette.toggleControl = function(elem, rules, firsttime) {
+ rules = rules || eval('[' + (elem.getAttribute('data-nette-rules') || '') + ']');
+ var has = false;
+ for (var id in rules) {
+ var rule = rules[id], op = rule.op.match(/(~)?([^?]+)/);
+ rule.neg = op[1];
+ rule.op = op[2];
+ rule.condition = !!rule.rules;
+ if (!rule.condition) continue;
+
+ var el = rule.control ? elem.form.elements[rule.control] : elem;
+ var success = Nette.validateRule(el, rule.op, rule.arg);
+ if (success === null) continue;
+ if (rule.neg) success = !success;
+
+ if (Nette.toggleControl(elem, rule.rules, firsttime) || rule.toggle) {
+ has = true;
+ if (firsttime) {
+ if (!el.nodeName) { // radio
+ for (var i in el) {
+ Nette.addEvent(el[i], 'click', function() { Nette.toggleForm(elem.form); });
+ }
+ } else if (el.nodeName.toLowerCase() === 'select') {
+ Nette.addEvent(el, 'change', function() { Nette.toggleForm(elem.form); });
+ } else {
+ Nette.addEvent(el, 'click', function() { Nette.toggleForm(elem.form); });
+ }
+ }
+ for (var id in rule.toggle || []) {
+ Nette.toggle(id, success ? rule.toggle[id] : !rule.toggle[id]);
+ }
+ }
+ }
+ return has;
+};
+
+
+Nette.toggle = function(id, visible) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ elem.style.display = visible ? "" : "none";
+ }
+};
+
+
+Nette.initForm = function(form) {
+ Nette.addEvent(form, 'submit', function() {
+ return Nette.validateForm(form);
+ });
+
+ Nette.addEvent(form, 'click', function(e) {
+ e = e || event;
+ var target = e.target || e.srcElement;
+ form['nette-submittedBy'] = (target.type in {submit:1, image:1}) ? target.name : null;
+ });
+
+ for (var i = 0; i < form.elements.length; i++) {
+ Nette.toggleControl(form.elements[i], null, true);
+ }
+
+ if (/MSIE/.exec(navigator.userAgent)) {
+ var labels = {};
+ for (i = 0, elms = form.getElementsByTagName('label'); i < elms.length; i++) {
+ labels[elms[i].htmlFor] = elms[i];
+ }
+
+ for (i = 0, elms = form.getElementsByTagName('select'); i < elms.length; i++) {
+ Nette.addEvent(elms[i], 'mousewheel', function() { return false }); // prevents accidental change in IE
+ if (labels[elms[i].htmlId]) {
+ Nette.addEvent(labels[elms[i].htmlId], 'click', function() { document.getElementById(this.htmlFor).focus(); return false }); // prevents deselect in IE 5 - 6
+ }
+ }
+ }
+};
+
+
+Nette.addEvent(window, 'load', function () {
+ for (var i = 0; i < document.forms.length; i++) Nette.initForm(document.forms[i]);
+});
1 www/robots.txt
@@ -0,0 +1 @@
+# See http://www.robotstxt.org/orig.html for documentation
20 www/web.config
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- IIS configuration file -->
+
+<configuration>
+ <system.webServer>
+ <rewrite>
+ <rules>
+ <rule name="Enable COOL URL" stopProcessing="true">
+ <match url="\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$" ignoreCase="false" negate="true" />
+ <conditions logicalGrouping="MatchAll">
+ <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
+ <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
+ </conditions>
+ <action type="Rewrite" url="index.php" />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+</configuration>

0 comments on commit 5df022c

Please sign in to comment.
Something went wrong with that request. Please try again.