Browse files

continued

  • Loading branch information...
1 parent 60dd61d commit 784c4585588f8256e1697e58e49900b1926aaaea @bartcc bartcc committed Oct 17, 2011
View
4 app/app_controller.php 100755 → 100644
@@ -33,7 +33,7 @@
*/
class AppController extends Controller {
- var $helpers = array('Session', 'Html', 'Js');
+ var $helpers = array('Ajax', 'Session', 'Html', 'Js');
var $components = array('RequestHandler', 'Session', 'Auth', 'Cookie');
function beforeFilter() {
@@ -46,7 +46,7 @@ function beforeFilter() {
$data = $this->getPayLoad();
if(!empty($data)) {
//$this->log('Payload', LOG_DEBUG);
- $this->log($data, LOG_DEBUG);
+ //$this->log($data, LOG_DEBUG);
$data = $this->object2Array($data);
if(empty($data[$this->modelClass])) {
$this->data[$this->modelClass] = $data;
View
1 app/app_model.php
@@ -31,5 +31,4 @@
* @subpackage cake.app
*/
class AppModel extends Model {
-
}
View
11 app/config/bootstrap.php
@@ -55,14 +55,3 @@
if (!defined('SIMPLE_JSON')) {
define('SIMPLE_JSON', '/elements/simple_json');
}
-define('OS_MS', 'Microsoft');
-define('OS_UX', 'Unix');
-define('NO_OS', 'None');
-$sw = $_SERVER['SERVER_SOFTWARE'];
-if(preg_match('/Microsoft/i', $sw)) {
- define('OS', OS_MS);
-} elseif (preg_match('/Unix/i', $sw)) {
- define('OS', OS_UX);
-} else {
- define('OS', NO_OS);
-}
View
3 app/config/routes.php
@@ -32,11 +32,12 @@
Router::connect('/q/*', array('controller' => 'kodaks', 'action' => 'develop'));
Router::connect('/git/*', array('controller' => 'gits', 'action' => 'exec'));
Router::connect('/mysql/*', array('controller' => 'mysql', 'action' => 'exec'));
+Router::connect('/logout', array('controller' => 'users', 'action' => 'logout'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::mapResources(array('todos', 'tasks', 'contacts' ,'users', 'galleries', 'albums', 'images'));
-//Router::parseExtensions();
+//Router::parseExtensions();
View
6 app/controllers/albums_controller.php
@@ -3,11 +3,9 @@
class AlbumsController extends AppController {
var $name = 'Albums';
- var $helpers = array('Ajax', 'Js');
- var $components = array('RequestHandler');
function beforeFilter() {
- $this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
+ //$this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
parent::beforeFilter();
}
@@ -26,7 +24,6 @@ function view($id = null) {
function add() {
if (!empty($this->data)) {
$this->Album->create();
- $this->log($this->data, LOG_DEBUG);
if ($this->Album->save($this->data)) {
$this->Session->setFlash(__('The album has been saved', true));
} else {
@@ -44,7 +41,6 @@ function edit($id = null) {
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
- $this->log($this->data, LOG_DEBUG);
if ($this->Album->save($this->data)) {
$this->Session->setFlash(__('The album has been saved', true));
$this->redirect(array('action' => 'index'));
View
3 app/controllers/director_app_controller.php
@@ -4,13 +4,12 @@ class DirectorAppController extends AppController {
var $name = 'DirectorApp';
var $uses = array('Gallery', 'Album', 'Image');
- var $helpers = array('Js');
function beforeFilter() {
Configure::write('debug', 0);
$this->autoRender = true;
$this->layout = 'director_layout';
- $this->Auth->allowedActions = array('index');
+ //$this->Auth->allowedActions = array('index');
}
function index() {
View
6 app/controllers/galleries_controller.php
@@ -3,11 +3,9 @@
class GalleriesController extends AppController {
var $name = 'Galleries';
- var $helpers = array('Ajax', 'Js');
- var $components = array('RequestHandler');
function beforeFilter() {
- $this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
+ //$this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
parent::beforeFilter();
}
@@ -26,8 +24,6 @@ function view($id = null) {
function add() {
if (!empty($this->data)) {
- $this->log('Galleries::add', LOG_DEBUG);
- $this->log($this->data, LOG_DEBUG);
$this->Gallery->create();
if ($this->Gallery->save($this->data)) {
$this->Session->setFlash(__('The gallery has been saved', true));
View
2 app/controllers/images_controller.php
@@ -5,7 +5,7 @@ class ImagesController extends AppController {
var $name = 'Images';
function beforeFilter() {
- $this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
+ //$this->Auth->allowedActions = array('index', 'view', 'add', 'edit', 'delete');
parent::beforeFilter();
}
View
0 app/controllers/pages_controller.php 100755 → 100644
File mode changed.
View
14 app/controllers/users_controller.php
@@ -31,13 +31,15 @@ function login() {
}
function logout() {
- if ($this->params['isAjax']) {
- $this->Auth->logout();
+ $this->Auth->logout();
+ if (!$this->params['isAjax']) {
+ $this->redirect(array('controller' => 'users', 'action' => 'login'));
+ } else {
+ $merged = array_merge($this->data['User'], array('id' => '', 'username' => '', 'name' => '', 'password' => '', 'sessionid' => '', 'flash' => '<strong>You\'re logged out successfully</strong>'));
+ $json = $merged;
+ $this->set(compact('json'));
+ $this->render(SIMPLE_JSON);
}
- $merged = array_merge($this->data['User'], array('id' => '', 'username' => '', 'name' => '', 'password' => '', 'sessionid' => '', 'flash' => '<strong>You\'re logged out successfully</strong>'));
- $json = $merged;
- $this->set(compact('json'));
- $this->render(SIMPLE_JSON);
}
function auth() {
View
0 app/tmp/cache/models/empty 100644 → 100755
File mode changed.
View
0 app/tmp/cache/persistent/empty 100644 → 100755
File mode changed.
View
0 app/tmp/cache/views/empty 100644 → 100755
File mode changed.
View
0 app/tmp/logs/empty 100644 → 100755
File mode changed.
View
0 app/tmp/sessions/empty 100644 → 100755
File mode changed.
View
51 app/views/layouts/default.ctp
@@ -19,22 +19,37 @@
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <?php echo $this->Html->charset(); ?>
- <title>
- <?php __('CakePHP: Welcome to CakePHP: '); ?>
- <?php echo $title_for_layout; ?>
- </title>
- <?php
- echo $this->Html->meta('icon');
-
- echo $this->Html->css('cake.generic');
-
- echo $scripts_for_layout;
- ?>
-</head>
-<body>
- <?php echo $content_for_layout; ?>
- <?php echo $this->element('sql_dump'); ?>
-</body>
+ <head>
+ <?php echo $this->Html->charset(); ?>
+ <title>
+ <?php __('CakePHP: Welcome to CakePHP: '); ?>
+ <?php echo $title_for_layout; ?>
+ </title>
+ <?php
+ echo $this->Html->meta('icon');
+ echo $this->Html->css('backbone/todos/application_boxmodel');
+
+ //$this->log($js->object($galleries), LOG_DEBUG);
+ echo $this->Html->script('lib/jquery/jquery-1.6.2');
+ echo $this->Html->script('spine/lib/spine');
+ echo $this->Html->script('spine/lib/ajax');
+ echo $this->Html->script('spine/lib/filter');
+ echo $this->Html->script('spine/lib/filter');
+ echo $this->Html->script('spine/app/director/plugins/main_login');
+
+ echo $html->scriptStart();
+ ?>
+
+ var base_url = '<?php echo $html->url('/'); ?>';
+
+ <?php
+ echo $html->scriptEnd();
+ echo $scripts_for_layout;
+
+ ?>
+ </head>
+ <body>
+<?php echo $content_for_layout; ?>
+ <?php echo $this->element('sql_dump'); ?>
+ </body>
</html>
View
40 app/views/layouts/default_original.ctp
@@ -0,0 +1,40 @@
+<?php
+/**
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.cake.console.libs.templates.skel.views.layouts
+ * @since CakePHP(tm) v 0.10.0.1076
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <?php echo $this->Html->charset(); ?>
+ <title>
+ <?php __('CakePHP: Welcome to CakePHP: '); ?>
+ <?php echo $title_for_layout; ?>
+ </title>
+ <?php
+ echo $this->Html->meta('icon');
+
+ echo $this->Html->css('cake.generic');
+
+ echo $scripts_for_layout;
+ ?>
+</head>
+<body>
+ <?php echo $content_for_layout; ?>
+ <?php echo $this->element('sql_dump'); ?>
+</body>
+</html>
View
2 app/views/layouts/director_layout.ctp
@@ -85,8 +85,6 @@
var galleries = <?php echo $js->object($galleries); ?>;
var albums = <?php echo $js->object($albums); ?>;
var images = <?php echo $js->object($images); ?>;
- //var galleries_album = <?php echo $js->object($galleries_album); ?>;
- //var albums_image = <?php echo $js->object($albums_image); ?>;
Image.refresh(images);
Album.refresh(albums);
Gallery.refresh(galleries);
View
49 app/views/users/login.ctp
@@ -0,0 +1,49 @@
+<div style="" id="login">
+ <div id="messenger" class="dialogue-wrap transparent">
+ <div class="dialogue">
+ <?php echo $form->create('User', array('onsubmit' => 'new MainLogin({el:this}).submit(); return false; ')); ?>
+ <div id="morph_messenger-wrap" class="morph dialogue-content" style="width:525px; min-width:500px;">
+ <div id="draggable-messenger-wrap" class="bg verticaltop">
+ <header>
+ <fieldset class="right">
+ <button class="_close light window input">x</button>
+ </fieldset>
+ </header>
+ <div class="dialogue-inner-wrap">
+ <div class="drag-handle">
+ <div>
+ <h1>Login</h1>
+ <p class="_flash"><span>
+ Enter Username and Password
+ </span></p>
+ </div>
+ <div class="clearfix"></div>
+ </div>
+ <div class="dialogue-scroll">
+ <fieldset>
+ <div class="left">
+ <label>User</label>
+ <?php echo $form->input('username', array('label' => false, 'autofocus' => 'autofocus')); ?>
+ </div>
+ <div class="left">
+ <label>Password</label>
+ <?php echo $form->input('password', array('label' => false)); ?>
+ </div>
+ </fieldset>
+ </div>
+ </div>
+ <footer>
+ <span>
+ <fieldset>
+ <?php echo $this->Form->button('Login', array('type'=>'submit', 'class' => 'light')); ?>
+ </fieldset>
+ </span>
+ </footer>
+ </div>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+
View
22 app/webroot/css/backbone/todos/application_boxmodel.css
@@ -214,6 +214,24 @@ footer div#storage-mode span {
left: 10px;
position: relative;
}
+#messenger footer {
+ -webkit-border-top-left-radius:0px ;
+ -webkit-border-top-right-radius:0px ;
+ -webkit-border-bottom-right-radius:8px ;
+ -webkit-border-bottom-left-radius:8px ;
+ -khtml-border-top-left-radius:0px ;
+ -khtml-border-top-right-radius:0px ;
+ -khtml-border-bottom-right-radius:8px ;
+ -khtml-border-bottom-left-radius:8px ;
+ -moz-border-radius-topleft:0px ;
+ -moz-border-radius-topright:0px ;
+ -moz-border-radius-bottomright:8px ;
+ -moz-border-radius-bottomleft:8px ;
+ border-top-left-radius:0px ;
+ border-top-right-radius:0px ;
+ border-bottom-right-radius:8px ;
+ border-bottom-left-radius:8px ;
+}
.right {
float: right;
}
@@ -567,9 +585,9 @@ div.bg div {
margin: 9px;
}
div.dialogue-content div.bg {
- -moz-border-radius: 0;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
-moz-box-shadow: 0 2px 14px 0 rgba(0, 0, 0, 0.6);
- -webkit-border-radius: 0;
-webkit-box-shadow: 0 2px 14px 0 rgba(0, 0, 0, 0.6);
background: none repeat scroll 0 0 #E3E3E3;
float: left;
View
6,082 app/webroot/js/lib/prototype.js
6,082 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
180 app/webroot/js/spine/app/director/plugins/ajax_relations.js
@@ -1,96 +1,94 @@
-(function() {
- var $, Builder, Model, Request;
- var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
- for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
- function ctor() { this.constructor = child; }
- ctor.prototype = parent.prototype;
- child.prototype = new ctor;
- child.__super__ = parent.prototype;
- return child;
- }, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
- if (typeof Spine === "undefined" || Spine === null) {
- Spine = require("spine");
+var $, Builder, Model, Request;
+var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
+ for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
+ function ctor() { this.constructor = child; }
+ ctor.prototype = parent.prototype;
+ child.prototype = new ctor;
+ child.__super__ = parent.prototype;
+ return child;
+}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+if (typeof Spine === "undefined" || Spine === null) {
+ Spine = require("spine");
+}
+$ = Spine.$;
+Model = Spine.Model;
+Builder = (function() {
+ function Builder(record) {
+ this.data = {};
+ this.record = record;
+ this.model = record.constructor;
+ this.foreignModels = this.model.foreignModels();
}
- $ = Spine.$;
- Model = Spine.Model;
- Builder = (function() {
- function Builder(record) {
- this.data = {};
- this.record = record;
- this.model = record.constructor;
- this.foreignModels = this.model.foreignModels();
+ Builder.prototype.newWrapper = function(key) {
+ var data;
+ if (!key.className) {
+ throw 'No Classname found';
}
- Builder.prototype.newWrapper = function(key) {
- var data;
- if (!key.className) {
- throw 'No Classname found';
- }
- data = {};
- data[key.className] = {};
- return data;
- };
- Builder.prototype.exec = function() {
- var key, model, records, selected, value, _i, _len, _ref;
- this.fModels = (function() {
- var _ref, _results;
- _ref = this.foreignModels;
- _results = [];
- for (key in _ref) {
- value = _ref[key];
- _results.push(this.foreignModels[key]);
- }
- return _results;
- }).call(this);
- _ref = this.fModels;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- key = _ref[_i];
- model = Spine.Model[key.className];
- records = model.filter(this.record.id);
- selected = this.newWrapper(model);
- selected[model.className] = this.model.toID(records);
- this.data[model.className] = selected;
+ data = {};
+ data[key.className] = {};
+ return data;
+ };
+ Builder.prototype.exec = function() {
+ var key, model, records, selected, value, _i, _len, _ref;
+ this.fModels = (function() {
+ var _ref, _results;
+ _ref = this.foreignModels;
+ _results = [];
+ for (key in _ref) {
+ value = _ref[key];
+ _results.push(this.foreignModels[key]);
}
- this.data[this.model.className] = this.record;
- return this.data;
- };
- return Builder;
- })();
- Request = (function() {
- __extends(Request, Singleton);
- function Request(record) {
- this.record = record;
- Request.__super__.constructor.apply(this, arguments);
- this.data = new Builder(this.record).exec();
- }
- Request.prototype.create = function(params) {
- return this.queue(__bind(function() {
- return this.ajax(params, {
- type: "POST",
- data: JSON.stringify(this.data),
- url: Ajax.getURL(this.model)
- }).success(this.recordResponse).error(this.errorResponse);
- }, this));
- };
- Request.prototype.update = function(params) {
- return this.queue(__bind(function() {
- return this.ajax(params, {
- type: "PUT",
- data: JSON.stringify(this.data),
- url: Ajax.getURL(this.record)
- }).success(this.recordResponse).error(this.errorResponse);
- }, this));
- };
- return Request;
- })();
- Model.AjaxRelations = {
- extended: function() {
- var Include;
- Include = {
- ajax: function() {
- return new Request(this);
- }
- };
- return this.include(Include);
+ return _results;
+ }).call(this);
+ _ref = this.fModels;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ key = _ref[_i];
+ model = Spine.Model[key.className];
+ records = model.filter(this.record.id);
+ selected = this.newWrapper(model);
+ selected[model.className] = this.model.toID(records);
+ this.data[model.className] = selected;
}
+ this.data[this.model.className] = this.record;
+ return this.data;
};
-}).call(this);
+ return Builder;
+})();
+Request = (function() {
+ __extends(Request, Singleton);
+ function Request(record) {
+ this.record = record;
+ Request.__super__.constructor.apply(this, arguments);
+ this.data = new Builder(this.record).exec();
+ }
+ Request.prototype.create = function(params) {
+ return this.queue(__bind(function() {
+ return this.ajax(params, {
+ type: "POST",
+ data: JSON.stringify(this.data),
+ url: Ajax.getURL(this.model)
+ }).success(this.recordResponse).error(this.errorResponse);
+ }, this));
+ };
+ Request.prototype.update = function(params) {
+ return this.queue(__bind(function() {
+ return this.ajax(params, {
+ type: "PUT",
+ data: JSON.stringify(this.data),
+ url: Ajax.getURL(this.record)
+ }).success(this.recordResponse).error(this.errorResponse);
+ }, this));
+ };
+ return Request;
+})();
+Model.AjaxRelations = {
+ extended: function() {
+ var Include;
+ Include = {
+ ajax: function() {
+ return new Request(this);
+ }
+ };
+ return this.include(Include);
+ }
+};
View
40 app/webroot/js/spine/app/director/plugins/main_login.coffee
@@ -0,0 +1,40 @@
+class MainLogin extends Spine.Controller
+
+ constructor: (form, displayField = '._flash') ->
+ super
+ @displayField = $('._flash')
+ @passwordField = $('#UserPassword')
+
+ submit: =>
+ $.ajax
+ data: @el.serialize()
+ type: 'POST'
+ success: @success
+ error: @error
+ complete: @complete
+
+ complete: (xhr) =>
+ json = xhr.responseText
+ @passwordField.val('').focus()
+
+ success: (json) =>
+ console.log 'success'
+ console.log json
+ #json = $.parseJSON(xhr)
+ redirect_url = base_url + 'director_app'
+ @displayField.html json.flash
+ delayedFunc = ->
+ window.location = redirect_url
+ @delay delayedFunc, 2000
+# new Effect.Shake 'loginform'
+# duration: 0.2
+# distance: 20
+
+ error: (xhr) =>
+ json = $.parseJSON(xhr.responseText)
+ oldMessage = @displayField.html()
+ delayedFunc = -> @displayField.html oldMessage
+
+ @displayField.html json.flash
+ @delay delayedFunc, 2000
+
View
60 app/webroot/js/spine/app/director/plugins/main_login.js
@@ -0,0 +1,60 @@
+var MainLogin;
+var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
+ for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
+ function ctor() { this.constructor = child; }
+ ctor.prototype = parent.prototype;
+ child.prototype = new ctor;
+ child.__super__ = parent.prototype;
+ return child;
+};
+MainLogin = (function() {
+ __extends(MainLogin, Spine.Controller);
+ function MainLogin(form, displayField) {
+ if (displayField == null) {
+ displayField = '._flash';
+ }
+ this.error = __bind(this.error, this);
+ this.success = __bind(this.success, this);
+ this.complete = __bind(this.complete, this);
+ this.submit = __bind(this.submit, this);
+ MainLogin.__super__.constructor.apply(this, arguments);
+ this.displayField = $('._flash');
+ this.passwordField = $('#UserPassword');
+ }
+ MainLogin.prototype.submit = function() {
+ return $.ajax({
+ data: this.el.serialize(),
+ type: 'POST',
+ success: this.success,
+ error: this.error,
+ complete: this.complete
+ });
+ };
+ MainLogin.prototype.complete = function(xhr) {
+ var json;
+ json = xhr.responseText;
+ return this.passwordField.val('').focus();
+ };
+ MainLogin.prototype.success = function(json) {
+ var delayedFunc, redirect_url;
+ console.log('success');
+ console.log(json);
+ redirect_url = base_url + 'director_app';
+ this.displayField.html(json.flash);
+ delayedFunc = function() {
+ return window.location = redirect_url;
+ };
+ return this.delay(delayedFunc, 2000);
+ };
+ MainLogin.prototype.error = function(xhr) {
+ var delayedFunc, json, oldMessage;
+ json = $.parseJSON(xhr.responseText);
+ oldMessage = this.displayField.html();
+ delayedFunc = function() {
+ return this.displayField.html(oldMessage);
+ };
+ this.displayField.html(json.flash);
+ return this.delay(delayedFunc, 2000);
+ };
+ return MainLogin;
+})();

0 comments on commit 784c458

Please sign in to comment.