Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Reverted an re-commited several changes to clear large phar-archive b…
Browse files Browse the repository at this point in the history
…inary history mistake.

Included merges (but without history): 
chive-ace-editor
chive-phar
eliminate-chive-webapplication
Fixed editor for triggers/views/routines
Fixed Bug in CSS minifacation
Fixed bug where JSi18n resources were not included in phar distribution
Fixed JS message publishing in phar distribution.
  • Loading branch information
davidroth committed May 1, 2012
1 parent 0c8913c commit eef6c56
Show file tree
Hide file tree
Showing 110 changed files with 767 additions and 5,089 deletions.
15 changes: 15 additions & 0 deletions archiveExport.sh
Expand Up @@ -15,7 +15,22 @@ touch chive/index_changed.php
cat chive/index.php | sed "s/'YII_DEBUG', true/'YII_DEBUG', false/" >> chive/index_changed.php
rm chive/index.php
rm chive/archiveExport.sh
rm chive/protected/tests -rf
mv chive/pharExport.php pharExport.php
mv chive/index_changed.php chive/index.php

tar czf chive_$1.tar.gz chive
zip -rq chive_$1.zip chive

# Download JSMin
echo 'Download & compile JSMin ...'
wget https://raw.github.com/douglascrockford/JSMin/master/jsmin.c
gcc -o jsmin jsmin.c

# Do phar export
echo 'Run phar export ...'
/usr/bin/php pharExport.php $1
rm pharExport.php

# Delete JSMin
rm jsmin jsmin.c
Empty file modified images/icons/fugue/16/home.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/icons/fugue/16/logout.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/icons/fugue/16/refresh.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions index.php
Expand Up @@ -5,7 +5,19 @@ function pre($_value) { if($_value === null || $_value === false || $_value ===
function predie($_value) { pre($_value); Yii::app()->end(); }

// Yii debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
define('YII_DEBUG', true);

// Chive phar mode
define('CAP_ENABLED', strpos(__FILE__, "phar://") === 0);
if(CAP_ENABLED)
{
define("CAP_PATH", sys_get_temp_dir() . DIRECTORY_SEPARATOR . "chive_" . md5(__FILE__));
@mkdir(CAP_PATH, 0777);
@mkdir(CAP_PATH . DIRECTORY_SEPARATOR . "assets", 0777);
@mkdir(CAP_PATH . DIRECTORY_SEPARATOR . "sessions", 0777);
@mkdir(CAP_PATH . DIRECTORY_SEPARATOR . "user-config", 0777);
copy(__DIR__ . DIRECTORY_SEPARATOR . "protected/runtime/user-config/default.xml", CAP_PATH . DIRECTORY_SEPARATOR . "user-config" . DIRECTORY_SEPARATOR . "default.xml");
}

// Load Yii
require('yii/yii.php');
Expand All @@ -18,7 +30,7 @@ function predie($_value) { pre($_value); Yii::app()->end(); }
}

// Create web application
$app = Yii::createWebApplication('protected/config/main.php');
$app = YiiBase::createWebApplication(__DIR__ . DIRECTORY_SEPARATOR . 'protected/config/' . (CAP_ENABLED ? 'phar' : 'main') . '.php');
$app->getSession()->setCookieParams(array('path' => $app->getBaseUrl(false)));

// Define constants
Expand All @@ -28,6 +40,7 @@ function predie($_value) { pre($_value); Yii::app()->end(); }
$validPaths = array(
'site',
'index.php',
'asset',
);

if(!$app->user->isGuest)
Expand All @@ -44,7 +57,10 @@ function predie($_value) { pre($_value); Yii::app()->end(); }
{
$response = new AjaxResponse();
$response->redirectUrl = Yii::app()->createUrl('site/login');
$response->send();

header("Content-type: application/json");
echo $response->__toString();
$app->end();
}
else
{
Expand Down Expand Up @@ -78,7 +94,7 @@ function predie($_value) { pre($_value); Yii::app()->end(); }
}

// Publish messages for javascript usage
Yii::app()->getComponent('messages')->publishJavaScriptMessages();
$app->getComponent('messages')->publishJavaScriptMessages();

// Run application
$app->run();
10 changes: 10 additions & 0 deletions js/ace/ace.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/ace/mode-sql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

213 changes: 213 additions & 0 deletions js/ace/theme-chive-uncompressed.js
@@ -0,0 +1,213 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org> (tomorrow theme)
* Fusonic GmbH (chive theme, based on tomorrow theme)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */

define('ace/theme/chive', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {

exports.isDark = false;
exports.cssClass = "ace-chive";
exports.cssText = "\
.ace-chive .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-chive .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-chive .ace_gutter {\
background-color: #F7F7F7;\
color: #ccc;\
border-right: 1px solid #ccc;\
}\
\
.ace-chive .ace_gutter-cell {\
text-align: right;\
min-width: 30px;\
padding: 0px 5px;\
}\
\
.ace-chive .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-chive .ace_scroller {\
background-color: #F7F7F7;\
}\
\
.ace-chive .ace_text-layer {\
cursor: text;\
color: #444;\
}\
\
.ace-chive .ace_cursor {\
border-left: 2px solid #AEAFAD;\
}\
\
.ace-chive .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #AEAFAD;\
}\
\
.ace-chive .ace_marker-layer .ace_selection {\
background: #D6D6D6;\
}\
\
.ace-chive .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\
}\
\
.ace-chive .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #D1D1D1;\
}\
\
.ace-chive .ace_marker-layer .ace_active_line {\
background: #EFEFEF;\
}\
\
.ace-chive .ace_marker-layer .ace_selected_word {\
border: 1px solid #D6D6D6;\
}\
\
.ace-chive .ace_invisible {\
color: #D1D1D1;\
}\
\
.ace-chive .ace_identifier {\
color: #879EFA;\
}\
\
.ace-chive .ace_keyword, .ace-chive .ace_meta {\
color:#60CA00;\
}\
\
.ace-chive .ace_keyword.ace_operator {\
color:magenta;\
}\
\
.ace-chive .ace_constant.ace_language {\
color:#F5871F;\
}\
\
.ace-chive .ace_constant.ace_numeric {\
color:#F5871F;\
}\
\
.ace-chive .ace_constant.ace_other {\
color:#666969;\
}\
\
.ace-chive .ace_invalid {\
color:#FFFFFF;\
background-color:#C82829;\
}\
\
.ace-chive .ace_invalid.ace_deprecated {\
color:#FFFFFF;\
background-color:#8959A8;\
}\
\
.ace-chive .ace_support.ace_constant {\
color:#F5871F;\
}\
\
.ace-chive .ace_fold {\
background-color: #4271AE;\
border-color: #4D4D4C;\
}\
\
.ace-chive .ace_support.ace_function {\
color:#4271AE;\
}\
\
.ace-chive .ace_storage {\
color:#8959A8;\
}\
\
.ace-chive .ace_storage.ace_type, .ace-chive .ace_support.ace_type{\
color:#8959A8;\
}\
\
.ace-chive .ace_variable {\
color:#4271AE;\
}\
\
.ace-chive .ace_variable.ace_parameter {\
color:#F5871F;\
}\
\
.ace-chive .ace_string {\
color:#879EFA;\
}\
\
.ace-chive .ace_string.ace_regexp {\
color:#879EFA;\
}\
\
.ace-chive .ace_comment {\
color:#8E908C;\
}\
\
.ace-chive .ace_variable {\
color:#C82829;\
}\
\
.ace-chive .ace_meta.ace_tag {\
color:#C82829;\
}\
\
.ace-chive .ace_entity.ace_other.ace_attribute-name {\
color:#C82829;\
}\
\
.ace-chive .ace_entity.ace_name.ace_function {\
color:#4271AE;\
}\
\
.ace-chive .ace_markup.ace_underline {\
text-decoration:underline;\
}\
\
.ace-chive .ace_markup.ace_heading {\
color:#718C00;\
}";

var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
59 changes: 58 additions & 1 deletion js/chive.js
Expand Up @@ -105,7 +105,64 @@ var chive = {
});

},


initAce: function(config)
{
var editor = ace.edit(config.id + '_editor');
var session = editor.getSession();
var div = $('#' + config.id + '_editor');
var container = $('#' + config.id + '_container');

// Set SQL edit mode
var sqlMode = require("ace/mode/sql").Mode;
session.setMode(new sqlMode());

// Set theme and layout
editor.setTheme("ace/theme/chive");
editor.setShowPrintMargin(false);
editor.setFontSize("16px");

// Value
var textArea = $('#' + config.id);
session.setValue(textArea.val());
session.on('change', function() {
textArea.val(session.getValue());
});

// Set resizing to container width
var containerWidth = container.width();
window.setInterval(function() {
if(container.width() != containerWidth)
{
containerWidth = container.width();
editor.resize();
}
}, 100);

// Set autogrow
if(config.autogrow)
{
var minHeight = config.height;
var maxHeight = 300;
session.on('change', function() {
var lines = session.getValue().split("\n").length;

var calculatedHeight = lines * 18 + 20;
if(calculatedHeight > maxHeight)
{
calculatedHeight = maxHeight;
}
else if(calculatedHeight < minHeight)
{
calculatedHeight = minHeight;
}

div.height(calculatedHeight);
editor.resize();
});
}
},

/*
* Loads the specified page.
*/
Expand Down

0 comments on commit eef6c56

Please sign in to comment.