Removed all default plugins, Updated ReadMe

This commit is contained in:
xevidos 2018-10-01 16:22:11 -04:00
parent 79f02158fd
commit 3d2acc9b5d
113 changed files with 12 additions and 23132 deletions

View File

@ -15,6 +15,7 @@ Features:
* Auto Save.
* Collaborative Editing.
* Multi Cursor.
* Overscroll ( Ability to center bottom of code ).
* PHP 7.2 Compatibility.
* Self updating.
* Split editor mode.
@ -24,24 +25,22 @@ When you see a - in front of a task that means it is a possibility but we aren't
Task List:
* Add ability to center bottom of code.
* Add ability to hide cursors when in collaboration mode.
* Add ability to login with LDAP.
* Add ability to save users in database.
* -Add ability to see what people are highlighting in collaboration mode.
* Add custom market.
* Add if file could not be saved 5 times close the editor.
* Add multi level users. ( Projects for only certain groups, Permission levels )
* Add if file could not be saved 5 times close the open file.
* Add multi level users. ( Projects for only certain groups, Permission levels )
* Add mobile compatibility.
* Clean up Collaborative compatibility.
* Clean up update script.
* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit)
* Fix [WangYihangs execution exploit](https://github.com/WangYihang/Codiad-Remote-Code-Execute-Exploit).
* Fix site settings identification issue.
Completed:
* Add Auto Save.
* Add ability to center bottom of code.
* Add Self Updating Script.
* Add Site renaming.
* Fix Auto Complete.

View File

@ -43,19 +43,19 @@ if (isset($_GET['type']) && ($_GET['type']=='directory' || $_GET['type']=='root'
//////////////////////////////////////////////////////////////////
// Check system() command and a non windows OS
//////////////////////////////////////////////////////////////////
if (isAvailable('system') && stripos(PHP_OS, 'win') === false) {
# Execute the tar command and save file
$filename .= '.tar.gz';
system("tar -pczf ".escapeshellarg($targetPath.$filename)." -C ".escapeshellarg(WORKSPACE)." ".escapeshellarg($_GET['path']));
$download_file = $targetPath.$filename;
} elseif (extension_loaded('zip')) { //Check if zip-Extension is availiable
if (extension_loaded('zip')) { //Check if zip-Extension is availiable
//build zipfile
require_once 'class.dirzip.php';
$filename .= '.zip';
$download_file = $targetPath.$filename;
DirZip::zipDir($dir, $targetPath .$filename);
} elseif (isAvailable('system') && stripos(PHP_OS, 'win') === false) {
# Execute the tar command and save file
$filename .= '.tar.gz';
system("tar -pczf ".escapeshellarg($targetPath.$filename)." -C ".escapeshellarg(WORKSPACE)." ".escapeshellarg($_GET['path']));
$download_file = $targetPath.$filename;
} else {
exit('<script>parent.codiad.message.error("Could not pack the folder, zip-extension missing")</script>');
}

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Raphaël Dartigues
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,59 +0,0 @@
#Unpack archives
Unpack archives directly through the filemanager.
Supports:
- .zip
- .tar
- .rar
- .tar.bzip2
- .tar.gz
To support all types of archives you might have to install the packages for your server, for Ubunt/Debian for example:
```bash
apt-get install tar unzip bzip2 gzip unrar gcc phpize php-pear php5-dev
```
To install the php rar package
```bash
pecl -v install rar
```
###Activation
To use the plugin you also need to activate it in the php.ini file on your server and put this on the top
```bash
[PHP]
zend_extension=/usr/local/lib/ioncube/ioncube_loader_lin_5.3.so
zend_extension=/usr/local/lib/Zend/ZendGuardLoader.so
zend_optimizer.optimization_level=15
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
;extension=php_curl.dll
;extension=curl.so
extension=rar.so
```
Please restart your Server
```bash
/etc/init.d/apache2 restart
```
##Installation
- Download the zip file and extract it to your plugin folder.
##TODO
- ~~Extract .zip~~ -> ~~Extract subZip~~
- ~~Extract .gzip~~ -> ~~Extract subGZ~~
- ~~Extract .bzip2~~ -> ~~Extract subBzip2~~
- ~~Extract .rar~~ -> Extract subRar
- ~~Extract .tar~~ -> Extract subTar
- Extract .7z
- ~~Open and navigate inside~~ (select markup implementation)
- Extract subdirectory only

View File

@ -1,260 +0,0 @@
<?php
/*
* Copyright (c) Codiad, Rafasashi & beli3ver, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
error_reporting(0);
require_once('../../common.php');
checkSession();
require_once('./functions.php');
//need for rar filelist check
$error = false;
switch($_GET['action']) {
case 'extract':
if(isset($_GET['path'])){
$source = getWorkspacePath($_GET['path']);
$source_info=pathinfo($source);
if(!isset($source_info['extension'])||empty($source_info['extension'])){
echo '{"status":"error","message":"Not an archive"}';
}
else{
$des = dirname($source);
if($source_info['extension']=='zip') {
if(class_exists('ZipArchive') && $zip = new ZipArchive) {
if($res = $zip->open($source)){
$epath = '';
if(isset($_GET['epath'])){
$epath = trim($_GET['epath']);
}
if($epath==''||$epath=='/'||$epath==$source_info['basename']){
// extract all archive to the path we determined above
if($zip->extractTo($des)){
echo '{"status":"success","message":"Archive extracted"}';
}
else{
echo '{"status":"error","message":"Failed to extract contents"}';
}
}
else{
// extract epath to the path we determined above
if(substr($epath, -1)!=='/'){
//extract single file
if(copy("zip://".$source."#".$epath, $des.'/'.basename($epath)) === TRUE){
echo '{"status":"success","message":"Sub contents extracted"}';
}
else{
echo '{"status":"error","message":"Failed to extract sub contents"}';
}
}
else{
//extract sub directory recursively
$response='{"status":"success","message":"Sub contents extracted"}';
for($i = 0; $i < $zip->numFiles; $i++){
$info = $zip->statIndex($i);
$entry = $info['name'];
$is_dir=false;
if($info['crc'] == 0 && substr($entry, -1)=='/'){
$is_dir=true;
}
if(strpos($entry,$epath)===0){
//get branche path from targeted directory
$branche=explode($epath,$entry,2);
$branche=$branche[1];
if($is_dir){
if($branche!=''&&!is_dir($des.'/'.$branche)&&!mkdir($des.'/'.$branche,0755,true)){
$response= '{"status":"error","message":"Failed to create sub directory"}';
break;
}
}
elseif(!copy("zip://".$source."#".$entry, $des.'/'.$branche)){
$response= '{"status":"error","message":"Failed to copy sub file"}';
break;
}
}
}
echo $response;
}
}
$zip->close();
}
else {
echo '{"status":"error","message":"Could not open zip archive"}';
}
}
}
elseif($source_info['extension']=='tar') {
if(class_exists('PharData') && $tar = new PharData($source)) {
if($tar->extractTo($des)){
echo '{"status":"success","message":"File extracted"}';
}
else{
echo '{"status":"error","message":"Failed to extract contents"}';
}
}
else {
echo '{"status":"error","message":"PharData extension missing or cloud not open tar archive"}';
}
}
elseif($source_info['extension']=='gz') {
if(class_exists('PharData') && $gz = new PharData($source)) {
if($tar_gzip_files = $gz->decompress()) {
$tar_gzip = new PharData($tar_gzip_files);
if($$tar_gzip->extractTo($des)){
echo '{"status":"success","message":"File extracted"}';
}
else {
echo '{"status":"error","message":"Failed to extract the files"}';
}
}
else {
echo '{"status":"error","message":"Failed to extract the .gzip file"}';
}
}
else {
echo '{"status":"error","message":"PharData extension missing or cloud not open tar archive"}';
}
}
elseif($source_info['extension']=='bz2') {
if(class_exists('PharData') && $bz = new PharData($source)) {
if($tar_bzip2_files = $bz->decompress()) {
$tar_bzip2 = new PharData($tar_bzip2_files);
if($$tar_bzip2->extractTo($des)){
echo '{"status":"success","message":"File extracted"}';
}
else {
echo '{"status":"error","message":"Failed to extract the files"}';
}
}
else {
echo '{"status":"error","message":"Failed to extract the .bzip2 file"}';
}
}
else {
echo '{"status":"error","message":"PharData extension missing or cloud not open tar archive"}';
}
}
elseif($source_info['extension']=='rar') {
if(class_exists('rar_open') && $rar = new rar_open) {
if($res = $rar->open($source)){
$entries = rar_list($res);
try {
foreach ($entries as $entry) {
$entry->extract($des);
}
} catch (Exception $e) {
$error = true;
}
// extract it to the path we determined above
if($error === false){
echo '{"status":"success","message":"File extracted"}';
}
else{
echo '{"status":"error","message":"Failed to extract contents"}';
}
$rar->close();
}
else {
echo '{"status":"error","message":"Could not open rar archive"}';
}
}
else {
echo '{"status":"error","message":"Cloud not open rar archive"}';
}
}
else {
echo '{"status":"error","message":"Looks like a .'.$source_info['extension'].'"}';
}
}
}
else {
echo '{"status":"error","message":"Missing Parameter"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
break;
}
?>

View File

@ -1,41 +0,0 @@
<!--
Copyright (c) Codiad & Rafasashi, distributed
as-is and without warranty under the MIT License.
See http://opensource.org/licenses/MIT for more information.
This information must remain intact.
-->
<?php
require_once('../../common.php');
checkSession();
require_once('./functions.php');
echo'<form>';
echo'<label>Extract contents</label>';
//echo'<input type="text" id="extract_name" value="'. $_GET['name']'.">';
echo'<select id="extract_path">';
echo'<option value="">'.basename($_GET['path']).'</option>';
//---------------fetch ArchiveTree-------------------------
$tree = getArchiveTree(1);
foreach($tree as $name => $path){
echo'<option value="'.$path.'">'.htmlentities('├').' '.$name.'</option>';
}
echo'</select>';
echo'<button onclick="codiad.Extract.extract(); return false;">Extract here</button>';
echo'<button onclick="codiad.modal.unload(); return false;">Close</button>';
echo'</form>';
?>

View File

@ -1,106 +0,0 @@
<?php
/*
* Copyright (c) Codiad, Rafasashi, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
function getWorkspacePath($path, $error='Invalid path'){
//Security check
if (!Common::checkPath($path)) {
die($error);
}
if (strpos($path, "/") === 0) {
//Unix absolute path
return $path;
}
if (strpos($path, ":/") !== false) {
//Windows absolute path
return $path;
}
if (strpos($path, ":\\") !== false) {
//Windows absolute path
return $path;
}
return WORKSPACE . "/" . $path;
}
function getArchiveTree($level=1){
$tree=[];
if(isset($_GET['path'])){
//TODO: Common::checkPath($path) return false...
$source = getWorkspacePath($_GET['path']);
//$source = WORKSPACE . "/" . $_GET['path'];
if(file_exists($source)){
$source_info=pathinfo($source);
if(isset($source_info['extension'])&&!empty($source_info['extension'])){
$des = dirname($source);
if($source_info['extension']=='zip'){
if(class_exists('ZipArchive') && $zip = new ZipArchive) {
if($res = $zip->open($source)){
for ($i = 0; $i < $zip->numFiles; $i++) {
$name = $zip->getNameIndex($i);
$path = $name;
$count=substr_count($path, '/');
if($count > $level){
continue;
}
$tree[$name]=$path;
}
$zip->close();
}
}
}
elseif($source_info['extension']=='tar') {
if(class_exists('PharData') && $tar = new PharData($source)) {
//TODO: get tar tree
}
}
elseif($source_info['extension']=='rar') {
if(class_exists('rar_open') && $rar = new rar_open) {
if($res = $rar->open($source)){
$entries = rar_list($res);
//TODO: get rar tree
$rar->close();
}
}
}
}
}
}
return $tree;
}
?>

View File

@ -1,82 +0,0 @@
/*
* Copyright (c) Codiad & Rafasashi, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
(function(global, $){
var codiad = global.codiad,
scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
$(function() {
codiad.Extract.init();
});
codiad.Extract = {
path: curpath,
file: "",
init: function() {
},
//////////////////////////////////////////////////////////
//
// Show dialog to enter new epath
//
// Parameter
//
// path - {String} - File path
//
//////////////////////////////////////////////////////////
showDialog: function(path) {
this.file = path;
var epath = this.getName(path);
codiad.modal.load(400, this.path+"dialog.php?path="+path+"&epath="+epath);
},
//////////////////////////////////////////////////////////
//
// Extract file
//
// Parameter
//
// path - {String} - File path
// epath - {String} - Archive path
//
//////////////////////////////////////////////////////////
extract: function(path, epath) {
var _this = this;
if (typeof(path) == 'undefined') {
path = this.file;
}
if (typeof(epath) == 'undefined') {
epath = $('#extract_path').val();
codiad.modal.unload();
}
// console.log(_this.path+"controller.php?action=extract&path="+path+"&epath="+epath);
$.getJSON(_this.path+"controller.php?action=extract&path="+path+"&epath="+epath, function(json){
codiad.message[json.status](json.message);
codiad.filemanager.rescan(codiad.project.getCurrent());
});
},
//////////////////////////////////////////////////////////
//
// Get basename of file
//
// Parameter
//
// path - {String} - File path
//
//////////////////////////////////////////////////////////
getName: function(path) {
return path.substring(path.lastIndexOf("/")+1);
}
};
})(this, jQuery);

View File

@ -1,11 +0,0 @@
[{ "author" : "Rafasashi & beli3ver",
"version": "0.0.4",
"name" : "Archives",
"url" : "https://github.com/rafasashi/Codiad-Archives",
"contextmenu" : [{
"action" : "codiad.Extract.showDialog($('#context-menu').attr('data-path'));",
"icon" : "icon-list-add",
"applies-to" : "file-only",
"title" : "Extract"
}]
}]

View File

@ -1,20 +0,0 @@
#AutoPrefixer
Parse CSS and add vendor prefixes to rules
#Installation
- Download the zip file and unzip it to your plugin folder.
#Usage
- Select "AutoPrefixer" in the context menu
- Press "Ctrl-Alt-P" without any selection to prefix complete file
- Press "Ctrl-Alt-P" with selected rules to prefix them
#Example
![Example](http://andrano.de/Plugins/img/autoprefixer.jpg)
#Credit
Uses [autoprefixer](https://github.com/postcss/autoprefixer)

File diff suppressed because one or more lines are too long

View File

@ -1,72 +0,0 @@
<?php
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
require_once('../../common.php');
checkSession();
error_reporting(0);
switch($_GET['action']) {
/**
* Compress a css file.
*
* @param {string} path The path of the file to compress
* @param {string} content Prefixed content
*/
case 'saveContent':
if (isset($_GET['path']) && isset($_POST['content'])) {
$path = getWorkspacePath($_GET['path']);
$nFile = substr($path, 0, strrpos($path, ".css"));
$nFile = $nFile . ".pre.css";
file_put_contents($nFile, $_POST['content']);
echo '{"status":"success","message":"CSS prefixed!"}';
} else {
echo '{"status":"error","message":"Missing Parameter!"}';
}
break;
/**
* Get file content
*
* @param {string} path The path of the file
*/
case 'getContent':
if (isset($_GET['path'])) {
$content = file_get_contents(getWorkspacePath($_GET['path']));
echo json_encode(array("status" => "success", "content" => $content));
} else {
echo '{"status":"error","message":"Missing Parameter!"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
break;
}
function getWorkspacePath($path) {
//Security check
if (!Common::checkPath($path)) {
die('{"status":"error","message":"Invalid path"}');
}
if (strpos($path, "/") === 0) {
//Unix absolute path
return $path;
}
if (strpos($path, ":/") !== false) {
//Windows absolute path
return $path;
}
if (strpos($path, ":\\") !== false) {
//Windows absolute path
return $path;
}
return WORKSPACE . "/".$path;
}
?>

View File

@ -1,27 +0,0 @@
<!--
Copyright (c) Codiad & Andr3as, distributed
as-is and without warranty under the MIT License.
See http://opensource.org/licenses/MIT for more information.
This information must remain intact.
-->
<form class="settings prefixer-settings">
<label><span class="icon-traffic-cone big-icon"></span> AutoPrefixer options</label>
<hr>
<table>
<tr>
<td><label>Supported browsers</label></td>
<td>
<input type="text" class="setting" data-setting="codiad.plugin.prefixer.browsers" value="> 1%, last 2 versions, Firefox ESR, Opera 12.1">
</td>
</tr>
<tr>
<td><label>Visual Cascade</label></td>
<td>
<select class="setting" data-setting="codiad.plugin.prefixer.cascade">
<option value="true">True</option>
<option value="false">False</option>
</select>
</tr>
</table>
<p>Check <a href="https://github.com/postcss/autoprefixer#browsers">Github.com/Postcss/Autoprefixer</a> for more details.</p>
</form>

View File

@ -1,168 +0,0 @@
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
* @author Andr3as
* @version 0.1.1
*/
(function(global, $){
var codiad = global.codiad,
scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
$(function() {
codiad.Prefixer.init();
});
codiad.Prefixer = {
path: curpath,
error: {},
init: function() {
var _this = this;
amplify.subscribe('active.onOpen', function(path){
if (/(\.css)$/.test(path)) {
_this.addKeyBindings();
}
});
amplify.subscribe("context-menu.onShow", function(obj){
if (/(\.css)$/.test(obj.path)) {
$('#context-menu').append('<hr class="file-only prefixer">');
$('#context-menu').append('<a class="file-only prefixer" onclick="codiad.Prefixer.contextMenu($(\'#context-menu\').attr(\'data-path\'));"><span class="icon-traffic-cone"></span>AutoPrefixer</a>');
}
});
amplify.subscribe("context-menu.onHide", function(){
$('.prefixer').remove();
});
//Load lib
$.getScript(this.path + 'autoprefixer.js');
},
//////////////////////////////////////////////////////////
//
// Add key bindings
//
//////////////////////////////////////////////////////////
addKeyBindings: function() {
if (codiad.editor.getActive() !== null) {
var _this = this;
var manager = codiad.editor.getActive().commands;
manager.addCommand({
name: 'autoprefixer',
bindKey: {
"win": "Ctrl-Alt-P",
"mac": "Command-Alt-P"
},
exec: function() {
_this.command();
}
});
}
},
//////////////////////////////////////////////////////////
//
// Command
//
//////////////////////////////////////////////////////////
command: function() {
var editor = codiad.editor.getActive();
var selText = codiad.editor.getSelectedText();
if (selText === "") {
codiad.editor.getActive().selectAll();
}
var result = true;
if (editor.inMultiSelectMode) {
//Multiselection
var multiRanges = editor.multiSelect.getAllRanges();
for (var i = 0; i < multiRanges.length; i++) {
result = result && this.runCommandForRange(multiRanges[i], this.runPrefixer.bind(this));
}
} else {
//Singleselection
result = this.runCommandForRange(editor.getSelectionRange(), this.runPrefixer.bind(this));
}
if (result) {
codiad.message.success("AutoPrefixer executed");
} else {
codiad.message.error(this.error.message || "Failed to execute AutoPrefixer");
}
return result;
},
runCommandForRange: function(range, handler) {
var session = codiad.editor.getActive().getSession();
if ((range.start.row == range.end.row) && (range.start.column == range.end.column)) {
return false;
}
//Get selection
var selection = session.getTextRange(range);
if (selection === "") {
/* No selection at the given position. */
return false;
}
selection = handler(selection);
if (selection === false) {
return false;
}
session.replace(range, selection);
return true;
},
contextMenu: function(path) {
var _this = this;
$.getJSON(this.path + 'controller.php?action=getContent&path='+ path, function(result){
if (result.status == "success") {
var prefixed = _this.runPrefixer(result.content);
if (prefixed === false) {
codiad.message.error(_this.error.message);
return false;
}
$.post(_this.path + 'controller.php?action=saveContent&path=' + path, {content: prefixed}, function(result){
result = JSON.parse(result);
codiad.message[result.status](result.message);
if (result.status == "success") {
codiad.filemanager.rescan($('#project-root').attr('data-path'));
}
});
}
});
},
runPrefixer: function(content) {
var options = this.getSettings();
try {
return autoprefixer.process(content, options).css;
} catch (error) {
this.error = error;
return false;
}
},
getSettings: function() {
var options = {};
//Browsers
var browsers = localStorage.getItem('codiad.plugin.prefixer.browsers');
if (browsers !== null) {
browsers = browsers.split(',');
for (var i = 0; i < browsers.length; i++) {
browsers[i] = browsers[i].trim();
}
options.browsers = browsers;
}
//Cascade
var cascade = localStorage.getItem('codiad.plugin.prefixer.cascade');
if (cascade !== null) {
options.cascade = (cascade == 'true');
}
return options;
}
};
})(this, jQuery);

View File

@ -1,11 +0,0 @@
[{
"author": "Andr3as",
"version": "0.1.1",
"name": "AutoPrefixer",
"url": "https://github.com/Andr3as/Codiad-AutoPrefixer.git",
"config": [{
"title": "AutoPrefixer",
"icon": "icon-traffic-cone",
"file": "dialog.php"
}]
}]

View File

@ -1,9 +0,0 @@
.prefixer-settings input {
display: inline;
line-height: 18px;
margin: 0;
}
.prefixer-settings a {
color: white;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Andr3as <andranode@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,48 +0,0 @@
#CodeGit
Git integration for Codiad
##Requirements
- Git version: ≥1.7.2
- Either one of the following for clone, push and pull
- Expect (Shell) (`sudo apt-get install expect` or [http://expect.sourceforge.net/](http://expect.sourceforge.net/))
- pexpect (Python) (`pip install pexpect`, [More details](https://github.com/pexpect/pexpect))
##Installation
- Download the zip file and unzip it to your plugin folder.
- Change if necessary the config in `config.php`, f.e. if you use pexpect
###Installation Guides
The standard installation works with Debian based systems, for other check the installation guides:
- [FreeBSD](https://github.com/Andr3as/Codiad-CodeGit/wiki/FreeBSD-installation)
###Lock Git User to Login User
By default, the username for the commit is the same as the login to Codiad. However, codegit does let the user override the username and commit as a different name.
If you wish to prevent the user overriding the username, forcing the name for all commits to be identical to the Codiad login, update the settings file `data/config/git.settings.php` to have the json value `lockuser` to `true`. For example, contents:
````php
<?php/*|{"lockuser":"true"}|*/?>
````
###Suppress diff on commit
For large changes it may be better to suppress a further diff on commit. Just activate the option in the settings.
##Problems?
Check the [wiki](https://github.com/Andr3as/Codiad-CodeGit/wiki) or open an issue.
##Example
![Example](http://andrano.de/Plugins/img/git.png "Example")
## Contributing
Contributions are always welcome.
####Formatting
- Indentation: 4 Spaces

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +0,0 @@
<?php
/* Define authentication program */
define("shellProgram","expect");
//define("shellProgram","empty"); //DO NOT USE, empty will be added in a future version
//define("shellProgram","python");
/* Add your git config here
Example:
"http.sslVerify" => "false"
*/
function getConfig() {
return array(
);
}
?>

View File

@ -1,437 +0,0 @@
<?php
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
error_reporting(0);
require_once('../../common.php');
require_once('class.git.php');
checkSession();
set_time_limit(0);
if ($_GET['action'] != 'checkRepo') {
$git = new Git();
define('CONFIG', 'git.' . $_SESSION['user'] . '.php');
}
switch($_GET['action']) {
case 'checkRepo':
if (isset($_GET['path'])) {
if (file_exists(getWorkspacePath($_GET['path'] . '/.git'))) {
echo '{"status": true,"message":"Repo exists"}';
} else {
echo '{"status": false,"message":"Repo doesn\'t exits"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'init':
if (isset($_GET['path'])) {
if ($git->init(getWorkspacePath($_GET['path']))) {
echo '{"status":"success","message":"Initialized empty Git repository!"}';
} else {
echo '{"status":"error","message":"' . $git->result . '!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'clone':
if (isset($_GET['path']) && isset($_GET['repo']) && isset($_GET['init_submodules'])) {
echo $git->cloneRepo(getWorkspacePath($_GET['path']), $_GET['repo'], $_GET['init_submodules']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'status':
if (isset($_GET['path'])) {
$result = $git->status(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get status!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'add':
if (isset($_GET['path']) && isset($_POST['files'])) {
$files = json_decode($_POST['files']);
if ($files) {
$result = true;
foreach($files as $file) {
$result = !(!$result | !$git->add(getWorkspacePath($_GET['path']), $file));
}
if ($result) {
echo '{"status":"success","message":"Changes added"}';
break;
}
}
echo '{"status":"success","message":"Failed to add changes"}';
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'commit':
if (isset($_GET['path']) && isset($_POST['message'])) {
echo $git->commit(getWorkspacePath($_GET['path']), $_POST['message']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'log':
if (isset($_GET['repo'])) {
$result = $git->getLog(getWorkspacePath($_GET['repo']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get log!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'diff':
if (isset($_GET['repo']) && isset($_GET['path'])) {
$result = $git->diff(getWorkspacePath($_GET['repo']), $_GET['path']);
if ($result === false) {
echo '{"status":"error","message":"Failed to get diff!"}';
} else {
echo $result;
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'checkout':
if (isset($_GET['repo']) && isset($_GET['path'])) {
if ($git->checkout(getWorkspacePath($_GET['repo']), $_GET['path'])) {
echo '{"status":"success","message":"Changes reverted!"}';
} else {
echo '{"status":"error","message":"Failed to undo changes!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'getRemotes':
if (isset($_GET['path'])) {
$result = $git->getRemotes(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get remotes!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'newRemote':
if (isset($_GET['path']) && isset($_GET['name']) && isset($_GET['url'])) {
$result = $git->newRemote(getWorkspacePath($_GET['path']), $_GET['name'], $_GET['url']);
if ($result === false) {
echo '{"status":"error","message":"Failed to create remotes!"}';
} else {
echo '{"status":"success","message": "New Remote created."}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'removeRemote':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->removeRemote(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to remove remote!"}';
} else {
echo '{"status":"success","message":"Remote removed!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'renameRemote':
if (isset($_GET['path']) && isset($_GET['name']) && isset($_GET['newName'])) {
$result = $git->renameRemote(getWorkspacePath($_GET['path']), $_GET['name'], $_GET['newName']);
if ($result === false) {
echo '{"status":"error","message":"Failed to rename remote!"}';
} else {
echo '{"status":"success","message":"Remote renamed!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'getRemoteBranches':
if (isset($_GET['path'])) {
$result = $git->getRemoteBranches(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get remote branches!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'checkoutRemote':
if (isset($_GET['path']) && isset($_GET['name']) && isset($_GET['remoteName'])) {
$result = $git->checkoutRemote(getWorkspacePath($_GET['path']), $_GET['name'], $_GET['remoteName']);
if ($result === false) {
echo '{"status":"error","message":"Failed to checkout remote!"}';
} else {
echo '{"status":"success","message":"Remote checkedout!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'getBranches':
if (isset($_GET['path'])) {
$result = $git->getBranches(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get branches!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'newBranch':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->newBranch(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to create branch!"}';
} else {
echo '{"status":"success","message": "New branch created."}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'deleteBranch':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->deleteBranch(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to delete branch!"}';
} else {
echo '{"status":"success","message":"Branch deleted!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'checkoutBranch':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->checkoutBranch(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to checkout branch!"}';
} else {
echo '{"status":"success","message":"Switched to branch: ' . $_GET['name'] .'!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'renameBranch':
if (isset($_GET['path']) && isset($_GET['name']) && isset($_GET['newName'])) {
$result = $git->renameBranch(getWorkspacePath($_GET['path']), $_GET['name'], $_GET['newName']);
if ($result === false) {
echo '{"status":"error","message":"Failed to rename branch!"}';
} else {
echo '{"status":"success","message":"Branch renamed!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'merge':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->merge(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to merge branch!"}';
} else {
echo '{"status":"success","message":"Branch merged!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'push':
if (isset($_GET['path']) && isset($_GET['remote']) && isset($_GET['branch'])) {
echo $git->push(getWorkspacePath($_GET['path']), $_GET['remote'], $_GET['branch']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'pull':
if (isset($_GET['path']) && isset($_GET['remote']) && isset($_GET['branch'])) {
echo $git->pull(getWorkspacePath($_GET['path']), $_GET['remote'], $_GET['branch']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'fetch':
if (isset($_GET['path']) && isset($_GET['remote'])) {
echo $git->fetch(getWorkspacePath($_GET['path']), $_GET['remote']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'rename':
if (isset($_GET['path']) && isset($_GET['old_name']) && isset($_GET['new_name'])) {
echo $git->renameItem(getWorkspacePath($_GET['path']), $_GET['old_name'], $_GET['new_name']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'submodule':
if (isset($_GET['repo']) && isset($_GET['path']) && isset($_GET['submodule'])) {
echo $git->submodule(getWorkspacePath($_GET['repo']), $_GET['path'], $_GET['submodule']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'initSubmodule':
if (isset($_GET['path'])) {
echo $git->initSubmodule(getWorkspacePath($_GET['path']));
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'numstat':
if (isset($_GET['path'])) {
$result = $git->numstat(getWorkspacePath($_GET['path']));
if ($result !== false) {
echo $result;
} else {
echo '{"status":"error","message":"Failed to get numstat"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'showCommit':
if (isset($_GET['path']) && isset($_GET['commit'])) {
echo $git->showCommit(getWorkspacePath($_GET['path']), $_GET['commit']);
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'blame':
if (isset($_GET['repo']) && isset($_GET['path'])) {
$result = $git->blame(getWorkspacePath($_GET['repo']), $_GET['path']);
if ($result === false) {
echo '{"status":"error","message":"Failed to get diff!"}';
} else {
echo $result;
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'network':
if (isset($_GET['path'])) {
$result = $git->network(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get network!"}';
} else {
echo '{"status":"success","data":'. json_encode($result) .'}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'getSettings':
if (isset($_GET['path'])) {
$settings = $git->getSettings(getWorkspacePath($_GET['path']));
echo '{"status":"success","data":'. json_encode($settings) .'}';
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'setSettings':
if (isset($_POST['settings']) && isset($_GET['path'])) {
$settings = json_decode($_POST['settings'], true);
$pluginSettings = getJSON('git.settings.php', 'config');
if ($pluginSettings['lockuser'] == "true") {
$settings['username'] = $_SESSION['user'];
if (strlen($settings['local_username']) != 0) {
$settings['local_username'] = $_SESSION['user'];
}
}
$git->setSettings($settings, getWorkspacePath($_GET['path']));
echo '{"status":"success","message":"Settings saved"}';
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
break;
}
function getWorkspacePath($path) {
//Security check
if (!Common::checkPath($path)) {
die('{"status":"error","message":"Invalid path"}');
}
if (strpos($path, "/") === 0) {
//Unix absolute path
return $path;
}
if (strpos($path, ":/") !== false) {
//Windows absolute path
return $path;
}
if (strpos($path, ":\\") !== false) {
//Windows absolute path
return $path;
}
return WORKSPACE."/".$path;
}
?>

View File

@ -1,81 +0,0 @@
<?php
require_once('../../common.php');
?>
<!--
Copyright (c) Codiad & Andr3as, distributed
as-is and without warranty under the MIT License.
See http://opensource.org/licenses/MIT for more information.
This information must remain intact.
-->
<form>
<?php
switch($_GET['action']) {
case 'blame':
include('templates/blame.html');
break;
case 'branches':
include('templates/branch.html');
break;
case 'clone':
include('templates/clone.html');
break;
case 'commit':
include('templates/commit.html');
break;
case 'diff':
include('templates/diff.html');
break;
case 'log':
include('templates/log.html');
break;
case 'login':
include('templates/login.html');
break;
case 'newBranch':
include('templates/newBranch.html');
break;
case 'newRemote':
include('templates/newRemote.html');
break;
case 'network':
include('templates/network.html');
break;
case 'passphrase':
include('templates/passphrase.html');
break;
case 'renameBranch':
include('templates/renameBranch.html');
break;
case 'renameRemote':
include('templates/renameRemote.html');
break;
case 'checkoutRemote':
include('templates/checkoutRemote.html');
break;
case 'overview':
include('templates/overview.html');
break;
case 'push':
include('templates/push.html');
break;
case 'remote':
include('templates/remote.html');
break;
case 'settings':
include('templates/settings.html');
break;
case 'showCommit':
include('templates/showCommit.html');
break;
case 'submodule':
include('templates/submodule.html');
break;
case 'userConfig':
include('templates/userConfig.html');
break;
default:
echo "No page defined!";
break;
}
?>
</form>

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +0,0 @@
/*
* Copyright (c) Andr3as, Gitlab.org, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*
* Bases on branch_graph.js
* https://gitlab.com/gitlab-org/gitlab-ce/blob/f49868adf1a2ea24815d432640cd0d996e0d87a0/app/assets/javascripts/network/branch_graph.js
* MIT License: https://gitlab.com/gitlab-org/gitlab-ce/blob/32da7602686f2b8161175d82b121deb9e01b2db5/LICENSE
*/
codiad.CodeGit.network_graph = {
branch: "",
commits: [],
element: "git_network",
hash_to_id: [],
heads: [],
lines: 0,
levels: 0,
tags: [],
colors: [],
offsetSubject: -1,
offsetDot: -1,
offsetX: 100,
offsetY: 20,
unitTime: 20,
unitSpace: 20,
generate: function() {
this.prepare();
this.collectColors();
this.draw();
},
draw: function() {
var subject, level, color, x, y, commit, hash, parent_hash, parent_id, parent, parent_x, parent_y, path;
var fn_click = function() {
hash = this.data('hash');
codiad.CodeGit.showCommit(codiad.CodeGit.location, hash);
};
for (var i = 0; i < this.commits.length; i++) {
commit = this.commits[i];
subject = commit.subject;
y = this.offsetY + i * this.unitTime;
this.paper.text(this.offsetSubject, y, subject)
.attr({
"text-anchor": "start",
fill: "#fff",
font: "14px Ubuntu",
cursor: "pointer"
})
.click(fn_click)
.data("hash", commit.hash);
level = commit.level;
color = this.colors[commit.level];
x = this.offsetDot - level * this.unitSpace;
this.paper.circle(x, y + 2, 3)
.attr({
fill: color,
stroke: "none",
cursor: "pointer"
})
.click(fn_click)
.data("hash", commit.hash);
for (var j = 0; j < commit.parents.length; j++) {
parent_hash = commit.parents[j];
parent_id = this.hash_to_id[parent_hash];
parent = this.commits[parent_id];
parent_x = this.offsetDot - parent.level * this.unitSpace;
parent_y = this.offsetY + parent_id * this.unitTime;
path = "M" + x + " " + (y + 2);
if (x != parent_x) {
if (j === 0) {
path += "L" + x + " " + (parent_y - this.unitTime / 2);
} else {
path += "L" + parent_x + " " + (y + this.unitTime / 2);
}
}
path += "L" + parent_x + " " + (parent_y + 2);
//Merge
if (j > 0) {
color = this.colors[parent.level];
}
this.paper.path(path).toBack().attr({
stroke: color
});
}
}
var labels = this.heads, seen = {}, id, name, text, textbox, rect, triangle, label;
//http://stackoverflow.com/a/30026006
//Tags are currently missing since tags have an indepentent hash wich does not refer to the commit
for (i = 0; i < labels.length; i++) {
id = this.hash_to_id[labels[i].hash];
name = labels[i].name;
commit = this.commits[id];
x = this.offsetDot - commit.level * this.unitSpace;
y = this.offsetY + id * this.unitTime;
// Truncate if longer than 17 chars
if (name.length > 17) {
name = name.substr(0, 15) + "…";
}
text = this.paper.text(x + 4, y + 2, name).attr({
"text-anchor": "start",
font: "10px Ubuntu",
fill: "#000",
title: name
});
textbox = text.getBBox();
// Create rectangle based on the size of the textbox
rect = this.paper.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr({
fill: "#fff",
stroke: "none"
});
triangle = this.paper.path(["M", x - 5, y + 2, "L", x - 15, y - 2, "L", x - 15, y + 6, "Z"]).attr({
fill: "#fff",
stroke: "none"
});
label = this.paper.set(rect, text);
label.transform(["t", -rect.getBBox().width - 15, 0]);
// Set text to front
text.toFront();
}
},
prepare: function() {
var ch, cw, gh,gw;
gh = $(this.element).height();
gw = $(this.element).width();
ch = Math.max(gh, this.offsetY + this.unitTime * this.commits.length);
cw = Math.max(gw, this.offsetX + this.unitSpace + 600);
this.paper = Raphael(this.element, cw, ch);
// Calculate offsets
this.offsetDot = this.offsetX + this.levels * this.unitSpace;
this.offsetSubject = this.offsetDot + 20;
},
collectColors: function() {
Raphael.getColor.reset();
this.colors = [];
for (var i = 0; i < this.lines; i++) {
this.colors.push(Raphael.getColor(0.8));
// Skipping a few colors in the spectrum to get more contrast between colors
Raphael.getColor();
Raphael.getColor();
}
},
setData: function(data) {
this.branch = data.branch;
this.commits = data.commits;
this.heads = data.heads;
this.lines = data.lines;
this.levels = data.levels;
this.tags = data.tags;
this.hash_to_id = data.hash_to_id;
}
};

View File

@ -1,15 +0,0 @@
[{ "author" : "Andr3as",
"version": "0.7.5",
"name" : "CodeGit",
"url" : "https://github.com/Andr3as/Codiad-CodeGit",
"rightbar": [{
"action": "codiad.CodeGit.showSidebarDialog();",
"icon": "icon-flow-branch",
"title": "CodeGit"
}],
"config": [{
"file": "dialog.php?action=settings",
"icon": "icon-flow-branch",
"title": "CodeGit"
}]
}]

File diff suppressed because one or more lines are too long

View File

@ -1,232 +0,0 @@
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
/* Global */
h1,h2,h3,h4,h5,h6 {
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}
h1>span,h2>span,h3>span,h4>span,h5>span,h6>span {
font-size: 13px;
}
h1 {
font-size: 20px;
}
h2 {
font-size: 16px;
}
h3 {
font-size: 15px;
}
/* Git status */
.git_area table th, .git_area table td {
padding: 0;
font-weight: 100;
}
.git_area header input {
display: inline;
}
.git_area #check_all {
margin-left: 5px;
}
.git_area > div {
max-height: 45vh;
overflow-y: scroll;
}
.git_list td {
padding-left: 5px;
}
.git_area .col_1 {
width: 30px;
}
.git_area .col_2 {
width: 70px;
}
.git_area .col_3 {
width: 400px;
}
.git_area .col_4 {
width: 160px;
}
.git_area input[type="checkbox"] {
margin: auto;
}
.git_button {
border-radius: 3px;
font-size: 12px;
line-height: 1em;
padding: 5px;
margin: 2px 0;
}
.git_area .right {
position: relative;
left: 5px;
top: 15px;
}
.git_area .modified, .git_area .untracked, .git_area .deleted {
color: red;
}
.git_area .added, .git_area .renamed {
color: green;
}
/* Git log */
.git_log_area .git_log {
max-height: 55vh;
max-width: 60vw;
overflow: auto;
}
/* Commit hash */
.commit_hash {
color: yellow;
cursor: pointer;
margin-top: 5px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.commit_hash:hover {
text-decoration: underline;
}
.commit_hash:hover:after {
content: "\e74c";
font-family: entypo;
font-style: normal;
font-size: 75%;
display: inline-block;
margin-right: 8px;
text-align: center;
vertical-align: top;
}
.git_network_area .content {
max-height: 40vh;
overflow: auto;
}
/* Show commit */
/* Git diff */
.git_diff, .git_show_commit_area .content {
max-height: 40vh;
max-width: 800px;
overflow: auto;
}
/* Git Blame */
.git_blame_area .content {
max-height: 40vh;
overflow-y: auto;
}
.git_blame_area table td:nth-of-type(1) {
width: 250px;
}
.git_blame_area table td:nth-of-type(2) {
width: 90px;
}
.git_blame_area table td:nth-of-type(3) {
max-width: 500px;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
white-space: nowrap;
}
/* Git changes */
[class^="git_"] .file-info, [class*=" git_"] .file-info {
background: #3b3b3b;
font-size: 14px;
font-weight: bold;
margin: 10px 0 0 0;
padding: 5px;
}
[class^="git_"] .wrapper, [class*=" git_"] .wrapper {
background-color: rgba(60, 118, 221, 0.5);
}
[class^="git_"] .plus, [class*=" git_"] .plus {
color: green;
}
[class^="git_"] .minus, [class*=" git_"] .minus {
color: red;
}
/* Git remotes */
/* Git branches */
#git_remotes, #git_branches {
display: inline;
margin-left: 10px;
width: 400px;
}
/* Git clone */
.git_clone_area table td, .git_clone_area table th {
border: none;
}
/* Git pull/push */
.git_push_area table td, .git_push_area table th {
border: none;
padding: 0;
}
/* Git stats */
.git-stat {
color: rgb(255, 152, 45);
color: rgba(255, 152, 45, 0.7);
}
/* Editor Botom Bar */
#git-stat {
float: left;
}
#git-repo-stat-wrapper {
margin: 5px 0px 0px 0px;
padding: 2px 10px 2px 10px;
cursor: pointer;
}
.git-repo-stat-valid {
background-color: green;
}
.git-repo-stat-invalid {
background-color: red;
}
.git-repo-stat-untracked {
background-color: blue;
}
.git-repo-icon-valid {
color: green;
}
.git-repo-icon-invalid {
color: red;
}
.git-repo-icon-untracked {
color: blue;
}
.hidden {
display: none;
}
#file-manager span.uncommit:before {
content: "\25cf";
font-size: 1.9em;
}
#file-manager span.uncommit {
float: left;
padding-top: 8px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@ -1,141 +0,0 @@
#!/bin/bash
#Author: Andr3as
#Last Edit: 11.09.14
#Purpose: Handler for a git requests with authentification
# Copyright (c) Codiad & Andr3as, distributed
# as-is and without warranty under the MIT License.
# See http://opensource.org/licenses/MIT for more information.
# This information must remain intact.
command=""
password=0
passphrase=0
path=""
user=0
#Handle inputs
while [ "$1" != "" ]
do
if [ "$1" == "-u" ]
then
user=$2
shift
shift
elif [ "$1" == "-p" ]
then
password=$2
shift
shift
elif [ "$1" == "-k" ]
then
passphrase=$2
shift
shift
elif [ "$1" == "-c" ]
then
command=$2
shift
shift
elif [ "$1" == "-s" ]
then
path=$2
shift
shift
else
echo "Unknown parameter"
echo "$1"
shift
fi
done
if [ "$command" == "" ]
then
echo "No command specified"
exit 64
fi
if [ "$path" == "" ]
then
echo "No path specified"
exit 64
fi
#Execute command
cd "$path"
/usr/bin/expect <<EOD
set result 0
set timeout 180
spawn -noecho $command
expect {
"Username for" {
if { "$user" == 0 } {
set result 3
exit 3
}
send "$user\n"
}
"Enter passphrase for key" {
if { "$passphrase" == 0 } {
set result 7
exit 7
}
send "$passphrase\n"
}
"assword" {
if { "$password" == 0 } {
set result 4
exit 4
}
send "$password\n"
}
"fatal" {
set result 5
exit 5
}
"error" {
set result 6
exit 6
}
"eof" {
exit 0
}
}
expect {
"Password for" {
if { "$password" == 0 } {
set result 4
exit 4
}
send "$password\n"
}
"fatal" {
set result 5
exit 5
}
"error" {
set result 6
exit 6
}
"eof" {
exit 0
}
}
expect {
"fatal" {
set result 5
exit 5
}
"error" {
set result 6
exit 6
}
"eof" {
exit 0
}
}
EOD
exit $result

View File

@ -1,121 +0,0 @@
#!/usr/bin/env python
#Author: Andr3as
#Year: 2016
#Purpose: Handler for git requests with authentification
#MinPython 2.7
# Copyright (c) Andr3as
# as-is and without warranty under the MIT License.
# See http://opensource.org/licenses/MIT for more information.
# This information must remain intact.
#http://www.tutorialspoint.com/python/python_command_line_arguments.htm
import os, sys, argparse, pexpect
#Parse arguments
parser = argparse.ArgumentParser(description='Handler for git requests with authentification.')
parser.add_argument('-u', '--user',
action="store", dest="user",
help="Username for authentification", default="")
parser.add_argument('-p', '--password',
action="store", dest="password",
help="Password for authentification", default="")
parser.add_argument('-k', '--passphrase',
action="store", dest="passphrase",
help="Passphrase for authentification", default="")
parser.add_argument('-c', '--command',
action="store", dest="command",
help="Command to execute", default="")
parser.add_argument('-s', '--path',
action="store", dest="path",
help="Repository location", default="")
parser.add_argument('--debug', dest='debug', action='store_const',
const=True, default=False,
help='Either to debug script')
parser.add_argument('--test', dest='test', action='store_const',
const=True, default=False,
help='Test python for modules')
arguments = parser.parse_args()
if arguments.debug:
print(arguments)
if arguments.test:
exit(0)
#Check arguments
if arguments.command == "":
print("No command specified")
sys.exit(64)
if arguments.path == "":
print("No path specified")
sys.exit(64)
#Change current path
os.chdir(arguments.path)
#Execute command
timeout = 180
child = pexpect.spawn(arguments.command, timeout=timeout)
index = child.expect(['Username for', 'Enter passphrase for key', 'assword', 'fatal', 'error',
pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
if arguments.user == "":
sys.exit(3)
child.sendline(arguments.user)
elif index == 1:
if arguments.passphrase == "":
sys.exit(7)
child.sendline(arguments.passphrase)
elif index == 2:
if arguments.password == "":
sys.exit(4)
child.sendline(arguments.password)
elif index == 3:
#Fatal
sys.exit(5)
elif index == 4:
#Error
sys.exit(6)
elif index == 5:
#EOF
sys.exit(0)
elif index == 6:
#TIMEOUT
sys.exit(65)
index = child.expect(['Password for', 'fatal', 'error',
pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
if arguments.password == "":
sys.exit(4)
child.sendline(arguments.password)
elif index == 1:
#Fatal
sys.exit(5)
elif index == 2:
#Error
sys.exit(6)
elif index == 3:
#EOF
sys.exit(0)
elif index == 4:
#TIMEOUT
sys.exit(65)
index = child.expect(['fatal', 'error', pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
#Fatal
sys.exit(5)
elif index == 1:
#Error
sys.exit(6)
elif index == 2:
#EOF
sys.exit(0)
elif index == 3:
#TIMEOUT
sys.exit(65)

View File

@ -1,16 +0,0 @@
<div class="git_blame_area">
<label>Blame view</label>
<div class="content">
<table>
<thead>
<tr>
<th class="file-info" colspan="3"></th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
</div>

View File

@ -1,21 +0,0 @@
<div class="git_branch_area">
<div class="content">
<label>Branches</label>
Current branches: <select id="git_branches"></select>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
<button onclick="codiad.CodeGit.merge(codiad.CodeGit.location); return false;">Merge</button>
<button onclick="codiad.CodeGit.checkoutBranch(codiad.CodeGit.location); return false;">Checkout</button>
<button onclick="codiad.CodeGit.showDialog('newBranch', codiad.CodeGit.location); return false;">New</button>
<button onclick="renameBranch(); return false;">Rename</button>
<button onclick="codiad.CodeGit.deleteBranch(); return false;">Delete</button>
</footer>
<script>
codiad.CodeGit.getBranches();
function renameBranch() {
codiad.CodeGit.name = $('#git_branches').val();
codiad.CodeGit.showDialog('renameBranch', codiad.CodeGit.location);
}
</script>
</div>

View File

@ -1,15 +0,0 @@
<div class="git_checkout_remote_area">
<div class="content">
<label>Checkout <span id="git_remote"></span></label>
Remote branches: <select id="git_remote_branches" onchange="onChangeCombobox();"></select>
New branch: <input type="text" id="git_new_branch">
</div>
<footer>
<button onclick="codiad.CodeGit.checkoutRemote(); return false;">Checkout</button>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
<script>
codiad.CodeGit.getRemoteBranches();
$('#git_remote_branches').focus();
</script>
</div>

View File

@ -1,26 +0,0 @@
<div class="git_clone_area">
<table>
<tbody>
<tr>
<td>
<label>Git Repository</label>
<input id="git_clone_repo">
</td>
</tr>
<tr>
<td>
Initialize submodules
<select id="git_init_submodules">
<option value="true" selected>Yes</option>
<option value="false">No</option>
</select>
</td>
</tr>
</tbody>
</table>
<button onclick="codiad.CodeGit.clone(codiad.CodeGit.location, $('#git_clone_repo').val(), $('#git_init_submodules').val()); return false;">Clone</button>
<button onclick="codiad.modal.unload(); return false;">Cancel</button>
<script>
$('#git_clone_repo').focus();
</script>
</div>

View File

@ -1,22 +0,0 @@
<div class="git_commit_area">
<div class="content">
<label>Commit</label>
<ul class="git_diff"></ul>
<input type="text" id="commit_msg" placeholder="Enter commit message here...">
</div>
<footer>
<button onclick="codiad.CodeGit.commit(codiad.CodeGit.location, $('#commit_msg').val()); return false;">Commit</button>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
<script>
if (codiad.CodeGit.files.length === 0) {
codiad.message.error("Nothing to commit!");
codiad.CodeGit.showDialog('overview', codiad.CodeGit.location);
} else {
if (!codiad.CodeGit.suppressCommitDiff()) {
codiad.CodeGit.filesDiff();
}
$('.git_commit_area #commit_msg').focus();
}
</script>
</div>

View File

@ -1,13 +0,0 @@
<div class="git_diff_area">
<div class="content">
<label>Diff</label>
<ul class="git_diff"></ul>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
<button class="git_undo">Undo changes</button>
</footer>
<script>
codiad.CodeGit.filesDiff();
</script>
</div>

View File

@ -1,12 +0,0 @@
<div class="git_log_area">
<label>Commits: <span class="path"></span></label>
<div class="content">
<ul class="git_log"></ul>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
<script>
codiad.CodeGit.log();
</script>
</div>

View File

@ -1,16 +0,0 @@
<div class="git_login_area">
<div class="content">
<label>Login</label>
<label for="username">Username</label>
<input type="text" name="username" id="username">
<label for="password">Password</label>
<input type="password" name="password" id="password">
</div>
<footer>
<button onclick="codiad.CodeGit.login(); return false;">Login</button>
<button onclick="codiad.modal.unload(); return false;">Close</button>
</footer>
<script>
$('#username').focus();
</script>
</div>

View File

@ -1,9 +0,0 @@
<div class="git_network_area">
<label>Network view</label>
<div class="content" id="git_network">
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
</div>

View File

@ -1,10 +0,0 @@
<div class="git_new_branch_area">
<div class="content">
<label>New branch</label>
<input type="text" id="branch_name" placeholder="Branch name">
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('branches', codiad.CodeGit.location); return false;">Close</button>
<button onclick="codiad.CodeGit.newBranch(codiad.CodeGit.location); return false;">New branch</button>
</footer>
</div>

View File

@ -1,11 +0,0 @@
<div class="git_new_remote_area">
<div class="content">
<label>New remote</label>
<input type="text" id="remote_name" placeholder="Remote name">
<input type="text" id="remote_url" placeholder="Remote url">
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('remote', codiad.CodeGit.location); return false;">Close</button>
<button onclick="codiad.CodeGit.newRemote(codiad.CodeGit.location); return false;">New remote</button>
</footer>
</div>

View File

@ -1,32 +0,0 @@
<div class="git_area">
<label>Status: <span class="git_area_path"></span></label>
<header>
<input type="checkbox" id="check_all">
<button onclick="codiad.CodeGit.status(); return false;"><i class="icon-arrows-ccw"></i></button>
<button onclick="codiad.CodeGit.showCommitDialog(); return false;">Commit</button>
<button onclick="codiad.CodeGit.showDialog('branches', codiad.CodeGit.location); return false;">Branches</button>
<button onclick="codiad.CodeGit.showDialog('remote', codiad.CodeGit.location); return false;">Remotes</button>
<button onclick="codiad.CodeGit.showDialog('log', codiad.CodeGit.location); return false;">Log</button>
<button onclick="codiad.CodeGit.showDialog('push', codiad.CodeGit.location); return false;">Pull/Push</button>
<button onclick="codiad.CodeGit.network(codiad.CodeGit.location); return false;">Network</button>
<div class="right">
<i class="icon-flow-branch"></i>Branch: <span class="branch">master</span>
</div>
</header>
<div>
<table class="git_list">
<thead>
<td class="col_1"></td><td class="col_2"></td><td class="col_3"></td><td class="col_4"></td>
</thead>
<tbody></tbody>
</table>
</div>
<footer>
<button onclick="codiad.modal.unload(); return false;">Close</button>
<button onclick="codiad.CodeGit.showDialog('userConfig', codiad.CodeGit.location); return false;">User config</button>
</footer>
<script>
codiad.CodeGit.status();
$('.git_area_path').text(codiad.CodeGit.location);
</script>
</div>

View File

@ -1,14 +0,0 @@
<div class="git_login_area">
<div class="content">
<label>Login</label>
<label for="passphrase">Passphrase</label>
<input type="password" name="passphrase" id="passphrase">
</div>
<footer>
<button onclick="codiad.CodeGit.login(); return false;">Login</button>
<button onclick="codiad.modal.unload(); return false;">Close</button>
</footer>
<script>
$('#passphrase').focus();
</script>
</div>

View File

@ -1,24 +0,0 @@
<div class="git_push_area">
<div class="content">
<label>Pull/Push</label>
<table>
<tr>
<td>Remote:</td>
<td><select id="git_remotes"></select></td>
</tr>
<tr>
<td>Branch:</td>
<td><select id="git_branches"></select></td>
</tr>
</table>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
<button onclick="codiad.CodeGit.push(); return false;">Push</button>
<button onclick="codiad.CodeGit.pull(); return false;">Pull</button>
</footer>
<script>
codiad.CodeGit.getRemotes();
codiad.CodeGit.getBranches();
</script>
</div>

View File

@ -1,25 +0,0 @@
<div class="git_remote_area">
<div class="content">
<label>Remote</label>
Current remotes: <select id="git_remotes"></select>
<div class="git_remote_info"></div>
</div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
<button onclick="codiad.CodeGit.removeRemote(); return false;">Remove</button>
<button onclick="codiad.CodeGit.showDialog('newRemote', codiad.CodeGit.location); return false;">New</button>
<button onclick="renameRemote(); return false;">Rename</button>
<button onclick="codiad.CodeGit.fetch(); return false;">Fetch</button>
<button onclick="checkoutRemote(); return false;">Checkout</button>
</footer>
<script>
codiad.CodeGit.getRemotes();
function renameRemote() {
codiad.CodeGit.name = $('#git_remotes').val();
codiad.CodeGit.showDialog('renameRemote', codiad.CodeGit.location);
}
function checkoutRemote() {
codiad.CodeGit.showDialog('checkoutRemote', codiad.CodeGit.location);
}
</script>
</div>

View File

@ -1,14 +0,0 @@
<div class="git_rename_branch_area">
<div class="content">
<label>Rename <span id="git_branch"></span></label>
<input type="text" id="git_new_name" placeholder="New name">
</div>
<footer>
<button onclick="codiad.CodeGit.renameBranch(); return false;">Rename</button>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
<script>
$('#git_new_name').focus();
$('#git_branch').text(codiad.CodeGit.name);
</script>
</div>

View File

@ -1,14 +0,0 @@
<div class="git_rename_remote_area">
<div class="content">
<label>Rename <span id="git_remote"></span></label>
<input type="text" id="git_new_name" placeholder="New name">
</div>
<footer>
<button onclick="codiad.CodeGit.renameRemote(); return false;">Rename</button>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
<script>
$('#git_new_name').focus();
$('#git_remote').text(codiad.CodeGit.name);
</script>
</div>

View File

@ -1,39 +0,0 @@
<div class="codegit_settings">
<label><span class="icon-flow-branch big-icon"></span>CodeGit Settings</label>
<hr>
<table class="settings">
<tr>
<td style="width: 80%;">
Disable repo-wide status
</td>
<td>
<select class="setting" data-setting="codiad.plugin.codegit.disableRepoStatus">
<option value="true"><?php i18n("Yes"); ?></option>
<option value="false" selected><?php i18n("No"); ?></option>
</select>
</td>
</tr>
<tr>
<td style="width: 80%;">
Disable repo-wide status header
</td>
<td>
<select class="setting" data-setting="codiad.plugin.codegit.disableHeader">
<option value="true"><?php i18n("Yes"); ?></option>
<option value="false" selected><?php i18n("No"); ?></option>
</select>
</td>
</tr>
<tr>
<td style="width: 80%;">
Suppress diff on commit
</td>
<td>
<select class="setting" data-setting="codiad.plugin.codegit.suppressCommitDiff">
<option value="true"><?php i18n("Yes"); ?></option>
<option value="false" selected><?php i18n("No"); ?></option>
</select>
</td>
</tr>
</table>
</div>

View File

@ -1,7 +0,0 @@
<div class="git_show_commit_area">
<label class="hash"></label>
<div class="content"><ul></ul></div>
<footer>
<button onclick="codiad.CodeGit.showDialog('overview', codiad.CodeGit.location); return false;">Close</button>
</footer>
</div>

View File

@ -1,24 +0,0 @@
<div class="git_submodule_area">
<label>Git Submodule</label>
<table>
<tbody>
<tr>
<td>
<span>Repository</span>
<input id="git_submodule_repo" placeholder="Submodule url">
</td>
</tr>
<tr>
<td>
<span>Directory name</span>
<input id="git_submodule_dir" placeholder="Directory name">
</td>
</tr>
</tbody>
</table>
<button onclick="codiad.CodeGit.submodule(codiad.CodeGit.location, $('#git_submodule_dir').val(), $('#git_submodule_repo').val()); return false;">Add submodule</button>
<button onclick="codiad.modal.unload(); return false;">Cancel</button>
<script>
$('#git_submodule_repo').focus();
</script>
</div>

View File

@ -1,36 +0,0 @@
<div class="git_settings_area">
<div class="content">
<h2>User config</h2>
<hr>
<h3>Global<span> - Global for all repositories</span></h3>
<label for="username">Username</label>
<input type="text" name="username" id="username">
<label for="email">E-Mail</label>
<input type="text" name="email" id="email">
<hr>
<h3><input type="checkbox" id="box_local" class="no_setting" checked style="display: inline;"/> Local<span> - Local for current repository</span></h3>
<br>
<div id="local">
<label for="local_username">Username</label>
<input type="text" name="local_username" id="local_username" class="local">
<label for="local_email">E-Mail</label>
<input type="text" name="local_email" id="local_email" class="local">
</div>
</div>
<footer>
<button onclick="codiad.CodeGit.setSettings(); return false;">Close</button>
</footer>
<script>
codiad.CodeGit.getSettings();
var checked = true;
$('#box_local').click(function(){
checked = !checked;
if (checked) {
$('#local').show();
} else {
$('#local').hide();
$('.local').val("");
}
});
</script>
</div>

View File

@ -1,9 +0,0 @@
# Color Picker
This plugin displays a HEX and RGB color chooser/modification utility through the [Codiad](http://www.codiad.com) user interface.
# Installation
- Download the zip file and extract it to your plugins folder
- Enable this plugin in the plugins manager in Codiad

View File

@ -1,287 +0,0 @@
/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* @link http://www.phpied.com/rgb-color-parser-in-javascript/
* @license Use it if you like it
*/
function RGBColor(colorString)
{
this.ok = false;
// strip any leading #
if (colorString.charAt(0) == '#') { // remove # if any
colorString = colorString.substr(1,6);
}
colorString = colorString.replace(/ /g,'');
colorString = colorString.toLowerCase();
// before getting into regexps, try simple matches
// and overwrite the input
var simpleColors = {
aliceblue: 'f0f8ff',
antiquewhite: 'faebd7',
aqua: '00ffff',
aquamarine: '7fffd4',
azure: 'f0ffff',
beige: 'f5f5dc',
bisque: 'ffe4c4',
black: '000000',
blanchedalmond: 'ffebcd',
blue: '0000ff',
blueviolet: '8a2be2',
brown: 'a52a2a',
burlywood: 'deb887',
cadetblue: '5f9ea0',
chartreuse: '7fff00',
chocolate: 'd2691e',
coral: 'ff7f50',
cornflowerblue: '6495ed',
cornsilk: 'fff8dc',
crimson: 'dc143c',
cyan: '00ffff',
darkblue: '00008b',
darkcyan: '008b8b',
darkgoldenrod: 'b8860b',
darkgray: 'a9a9a9',
darkgreen: '006400',
darkkhaki: 'bdb76b',
darkmagenta: '8b008b',
darkolivegreen: '556b2f',
darkorange: 'ff8c00',
darkorchid: '9932cc',
darkred: '8b0000',
darksalmon: 'e9967a',
darkseagreen: '8fbc8f',
darkslateblue: '483d8b',
darkslategray: '2f4f4f',
darkturquoise: '00ced1',
darkviolet: '9400d3',
deeppink: 'ff1493',
deepskyblue: '00bfff',
dimgray: '696969',
dodgerblue: '1e90ff',
feldspar: 'd19275',
firebrick: 'b22222',
floralwhite: 'fffaf0',
forestgreen: '228b22',
fuchsia: 'ff00ff',
gainsboro: 'dcdcdc',
ghostwhite: 'f8f8ff',
gold: 'ffd700',
goldenrod: 'daa520',
gray: '808080',
green: '008000',
greenyellow: 'adff2f',
honeydew: 'f0fff0',
hotpink: 'ff69b4',
indianred : 'cd5c5c',
indigo : '4b0082',
ivory: 'fffff0',
khaki: 'f0e68c',
lavender: 'e6e6fa',
lavenderblush: 'fff0f5',
lawngreen: '7cfc00',
lemonchiffon: 'fffacd',
lightblue: 'add8e6',
lightcoral: 'f08080',
lightcyan: 'e0ffff',
lightgoldenrodyellow: 'fafad2',
lightgrey: 'd3d3d3',
lightgreen: '90ee90',
lightpink: 'ffb6c1',
lightsalmon: 'ffa07a',
lightseagreen: '20b2aa',
lightskyblue: '87cefa',
lightslateblue: '8470ff',
lightslategray: '778899',
lightsteelblue: 'b0c4de',
lightyellow: 'ffffe0',
lime: '00ff00',
limegreen: '32cd32',
linen: 'faf0e6',
magenta: 'ff00ff',
maroon: '800000',
mediumaquamarine: '66cdaa',
mediumblue: '0000cd',
mediumorchid: 'ba55d3',
mediumpurple: '9370d8',
mediumseagreen: '3cb371',
mediumslateblue: '7b68ee',
mediumspringgreen: '00fa9a',
mediumturquoise: '48d1cc',
mediumvioletred: 'c71585',
midnightblue: '191970',
mintcream: 'f5fffa',
mistyrose: 'ffe4e1',
moccasin: 'ffe4b5',
navajowhite: 'ffdead',
navy: '000080',
oldlace: 'fdf5e6',
olive: '808000',
olivedrab: '6b8e23',
orange: 'ffa500',
orangered: 'ff4500',
orchid: 'da70d6',
palegoldenrod: 'eee8aa',
palegreen: '98fb98',
paleturquoise: 'afeeee',
palevioletred: 'd87093',
papayawhip: 'ffefd5',
peachpuff: 'ffdab9',
peru: 'cd853f',
pink: 'ffc0cb',
plum: 'dda0dd',
powderblue: 'b0e0e6',
purple: '800080',
red: 'ff0000',
rosybrown: 'bc8f8f',
royalblue: '4169e1',
saddlebrown: '8b4513',
salmon: 'fa8072',
sandybrown: 'f4a460',
seagreen: '2e8b57',
seashell: 'fff5ee',
sienna: 'a0522d',
silver: 'c0c0c0',
skyblue: '87ceeb',
slateblue: '6a5acd',
slategray: '708090',
snow: 'fffafa',
springgreen: '00ff7f',
steelblue: '4682b4',
tan: 'd2b48c',
teal: '008080',
thistle: 'd8bfd8',
tomato: 'ff6347',
turquoise: '40e0d0',
violet: 'ee82ee',
violetred: 'd02090',
wheat: 'f5deb3',
white: 'ffffff',
whitesmoke: 'f5f5f5',
yellow: 'ffff00',
yellowgreen: '9acd32'
};
for (var key in simpleColors) {
if (colorString == key) {
colorString = simpleColors[key];
}
}
// emd of simple type-in colors
// array of color definition objects
var colorDefs = [
{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process: function (bits){
return [
parseInt(bits[1]),
parseInt(bits[2]),
parseInt(bits[3])
];
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process: function (bits){
return [
parseInt(bits[1], 16),
parseInt(bits[2], 16),
parseInt(bits[3], 16)
];
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process: function (bits){
return [
parseInt(bits[1] + bits[1], 16),
parseInt(bits[2] + bits[2], 16),
parseInt(bits[3] + bits[3], 16)
];
}
}
];
// search through the definitions to find a match
for (var i = 0; i < colorDefs.length; i++) {
var re = colorDefs[i].re;
var processor = colorDefs[i].process;
var bits = re.exec(colorString);
if (bits) {
channels = processor(bits);
this.r = channels[0];
this.g = channels[1];
this.b = channels[2];
this.ok = true;
}
}
// validate/cleanup values
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
// some getters
this.toRGB = function () {
return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
}
this.toHex = function () {
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
if (r.length == 1) r = '0' + r;
if (g.length == 1) g = '0' + g;
if (b.length == 1) b = '0' + b;
return '#' + r + g + b;
}
// help
this.getHelpXML = function () {
var examples = new Array();
// add regexps
for (var i = 0; i < colorDefs.length; i++) {
var example = colorDefs[i].example;
for (var j = 0; j < example.length; j++) {
examples[examples.length] = example[j];
}
}
// add type-in colors
for (var sc in simpleColors) {
examples[examples.length] = sc;
}
var xml = document.createElement('ul');
xml.setAttribute('id', 'rgbcolor-examples');
for (var i = 0; i < examples.length; i++) {
try {
var listItem = document.createElement('li');
var listColor = new RGBColor(examples[i]);
var exampleDiv = document.createElement('div');
exampleDiv.style.cssText =
'margin: 3px; '
+ 'border: 1px solid black; '
+ 'background:' + listColor.toHex() + '; '
+ 'color:' + listColor.toHex()
;
exampleDiv.appendChild(document.createTextNode('test'));
var listItemValue = document.createTextNode(
' ' + examples[i] + ' -> ' + listColor.toRGB() + ' -> ' + listColor.toHex()
);
listItem.appendChild(exampleDiv);
listItem.appendChild(listItemValue);
xml.appendChild(listItem);
} catch(e){}
}
return xml;
}
}

View File

@ -1,51 +0,0 @@
<?php
/*
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
require_once('../../common.php');
?>
<div id="colorpicker_region">
</div>
<button class="right" onclick="codiad.modal.unload();"><?php i18n("Close"); ?></button>
<button class="btn-left" onclick="codiad.colorPicker.insert('hex');"><?php i18n("Insert HEX"); ?></button
><button class="btn-right" onclick="codiad.colorPicker.insert('rgb');"><?php i18n("Insert RGB"); ?></button>
<script>
$(function(){
selected = codiad.active.getSelectedText();
if(selected==null){
selected = '#45818a';
sellength = 7;
}else{
sellength = selected.length;
}
var colorRegEx = /^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$/;
seltest = colorRegEx.test(selected);
// Fix format issues with rgb for parser
returnRGBWrapper = true;
if(selected.indexOf(',')>0 && selected.indexOf('rgb')){
selected='rgb('+selected+')';
returnRGBWrapper = false;
}
var color = new RGBColor(selected);
if (color.ok) { // 'ok' is true when the parsing was a success
$('#colorpicker_region').ColorPicker({flat: true, color: color.toHex() });
}else{
$('#colorpicker_region').ColorPicker({flat: true, color: '#454b8a' });
}
});
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
(function(global, $){
var codiad = global.codiad,
scripts= document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
$(function() {
codiad.colorPicker.init();
});
codiad.colorPicker = {
path: curpath,
init: function() {
$.loadScript(this.path+"color_parser.js");
$.loadScript(this.path+"jquery.colorpicker.js");
},
open: function() {
codiad.modal.load(400, this.path+'dialog.php');
},
insert: function(type) {
var color = '';
if (type == 'rgb') {
color = $('.colorpicker_rgb_r input')
.val() + ',' + $('.colorpicker_rgb_g input')
.val() + ',' + $('.colorpicker_rgb_b input')
.val();
if (returnRGBWrapper === false) {
insert = (color);
} else {
insert = ('rgb(' + color + ')');
}
} else {
color = $('.colorpicker_hex input')
.val();
if (sellength == 3 || sellength == 6) {
if (seltest) {
insert = color;
} else {
insert = '#' + color;
}
} else {
insert = '#' + color;
}
}
codiad.active.insertText(insert);
codiad.modal.unload();
}
};
})(this, jQuery);

View File

@ -1,642 +0,0 @@
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dual licensed under the MIT and GPL licenses
*
*/
(function($) {
var ColorPicker = function() {
var
ids = {},
inAction,
charMin = 65,
visible,
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
defaults = {
eventName: 'click',
onShow: function() {},
onBeforeShow: function() {},
onHide: function() {},
onChange: function() {},
onSubmit: function() {},
color: 'ff0000',
livePreview: true,
flat: false
},
fillRGBFields = function(hsb, cal) {
var rgb = HSBToRGB(hsb);
$(cal)
.data('colorpicker')
.fields.eq(1)
.val(rgb.r)
.end()
.eq(2)
.val(rgb.g)
.end()
.eq(3)
.val(rgb.b)
.end();
},
fillHSBFields = function(hsb, cal) {
$(cal)
.data('colorpicker')
.fields.eq(4)
.val(hsb.h)
.end()
.eq(5)
.val(hsb.s)
.end()
.eq(6)
.val(hsb.b)
.end();
},
fillHexFields = function(hsb, cal) {
$(cal)
.data('colorpicker')
.fields.eq(0)
.val(HSBToHex(hsb))
.end();
},
setSelector = function(hsb, cal) {
$(cal)
.data('colorpicker')
.selector.css('backgroundColor', '#' + HSBToHex({
h: hsb.h,
s: 100,
b: 100
}));
$(cal)
.data('colorpicker')
.selectorIndic.css({
left: parseInt(150 * hsb.s / 100, 10),
top: parseInt(150 * (100 - hsb.b) / 100, 10)
});
},
setHue = function(hsb, cal) {
$(cal)
.data('colorpicker')
.hue.css('top', parseInt(150 - 150 * hsb.h / 360, 10));
},
setCurrentColor = function(hsb, cal) {
$(cal)
.data('colorpicker')
.currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
setNewColor = function(hsb, cal) {
$(cal)
.data('colorpicker')
.newColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
keyDown = function(ev) {
var pressedKey = ev.charCode || ev.keyCode || -1;
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
var cal = $(this)
.parent()
.parent();
if (cal.data('colorpicker')
.livePreview === true) {
change.apply(this);
}
},
change = function(ev) {
var cal = $(this)
.parent()
.parent(),
col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpicker')
.color = col = HexToHSB(fixHex(this.value));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpicker')
.color = col = fixHSB({
h: parseInt(cal.data('colorpicker')
.fields.eq(4)
.val(), 10),
s: parseInt(cal.data('colorpicker')
.fields.eq(5)
.val(), 10),
b: parseInt(cal.data('colorpicker')
.fields.eq(6)
.val(), 10)
});
} else {
cal.data('colorpicker')
.color = col = RGBToHSB(fixRGB({
r: parseInt(cal.data('colorpicker')
.fields.eq(1)
.val(), 10),
g: parseInt(cal.data('colorpicker')
.fields.eq(2)
.val(), 10),
b: parseInt(cal.data('colorpicker')
.fields.eq(3)
.val(), 10)
}));
}
if (ev) {
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpicker')
.onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
},
blur = function(ev) {
var cal = $(this)
.parent()
.parent();
cal.data('colorpicker')
.fields.parent()
.removeClass('colorpicker_focus');
},
focus = function() {
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
$(this)
.parent()
.parent()
.data('colorpicker')
.fields.parent()
.removeClass('colorpicker_focus');
$(this)
.parent()
.addClass('colorpicker_focus');
},
downIncrement = function(ev) {
var field = $(this)
.parent()
.find('input')
.focus();
var current = {
el: $(this)
.parent()
.addClass('colorpicker_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this)
.parent()
.parent()
.data('colorpicker')
.livePreview
};
$(document)
.bind('mouseup', current, upIncrement);
$(document)
.bind('mousemove', current, moveIncrement);
},
moveIncrement = function(ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function(ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpicker_slider')
.find('input')
.focus();
$(document)
.unbind('mouseup', upIncrement);
$(document)
.unbind('mousemove', moveIncrement);
return false;
},
downHue = function(ev) {
var current = {
cal: $(this)
.parent(),
y: $(this)
.offset()
.top
};
current.preview = current.cal.data('colorpicker')
.livePreview;
$(document)
.bind('mouseup', current, upHue);
$(document)
.bind('mousemove', current, moveHue);
},
moveHue = function(ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields.eq(4)
.val(parseInt(360 * (150 - Math.max(0, Math.min(150, (ev.pageY - ev.data.y)))) / 150, 10))
.get(0), [ev.data.preview]);
return false;
},
upHue = function(ev) {
fillRGBFields(ev.data.cal.data('colorpicker')
.color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker')
.color, ev.data.cal.get(0));
$(document)
.unbind('mouseup', upHue);
$(document)
.unbind('mousemove', moveHue);
return false;
},
downSelector = function(ev) {
var current = {
cal: $(this)
.parent(),
pos: $(this)
.offset()
};
current.preview = current.cal.data('colorpicker')
.livePreview;
$(document)
.bind('mouseup', current, upSelector);
$(document)
.bind('mousemove', current, moveSelector);
},
moveSelector = function(ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields.eq(6)
.val(parseInt(100 * (150 - Math.max(0, Math.min(150, (ev.pageY - ev.data.pos.top)))) / 150, 10))
.end()
.eq(5)
.val(parseInt(100 * (Math.max(0, Math.min(150, (ev.pageX - ev.data.pos.left)))) / 150, 10))
.get(0), [ev.data.preview]);
return false;
},
upSelector = function(ev) {
fillRGBFields(ev.data.cal.data('colorpicker')
.color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker')
.color, ev.data.cal.get(0));
$(document)
.unbind('mouseup', upSelector);
$(document)
.unbind('mousemove', moveSelector);
return false;
},
enterSubmit = function(ev) {
$(this)
.addClass('colorpicker_focus');
},
leaveSubmit = function(ev) {
$(this)
.removeClass('colorpicker_focus');
},
clickSubmit = function(ev) {
var cal = $(this)
.parent();
var col = cal.data('colorpicker')
.color;
cal.data('colorpicker')
.origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpicker')
.onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker')
.el);
},
show = function(ev) {
var cal = $('#' + $(this)
.data('colorpickerId'));
cal.data('colorpicker')
.onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this)
.offset();
var viewPort = getViewport();
var top = pos.top + this.offsetHeight;
var left = pos.left;
if (top + 176 > viewPort.t + viewPort.h) {
top -= this.offsetHeight + 176;
}
if (left + 356 > viewPort.l + viewPort.w) {
left -= 356;
}
cal.css({
left: left + 'px',
top: top + 'px'
});
if (cal.data('colorpicker')
.onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document)
.bind('mousedown', {
cal: cal
}, hide);
return false;
},
hide = function(ev) {
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
if (ev.data.cal.data('colorpicker')
.onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$(document)
.unbind('mousedown', hide);
}
},
isChildOf = function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (parentEl.contains) {
return parentEl.contains(el);
}
if (parentEl.compareDocumentPosition) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while (prEl && prEl != container) {
if (prEl == parentEl) return true;
prEl = prEl.parentNode;
}
return false;
},
getViewport = function() {
var m = document.compatMode == 'CSS1Compat';
return {
l: window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
t: window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
w: window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
h: window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
};
},
fixHSB = function(hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function(rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function(hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i = 0; i < len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
HexToRGB = function(hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {
r: hex >> 16,
g: (hex & 0x00FF00) >> 8,
b: (hex & 0x0000FF)
};
},
HexToHSB = function(hex) {
return RGBToHSB(HexToRGB(hex));
},
RGBToHSB = function(rgb) {
var hsb = {
h: 0,
s: 0,
b: 0
};
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
if (max != 0) {
}
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) {
hsb.h = (rgb.g - rgb.b) / delta;
} else if (rgb.g == max) {
hsb.h = 2 + (rgb.b - rgb.r) / delta;
} else {
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
} else {
hsb.h = -1;
}
hsb.h *= 60;
if (hsb.h < 0) {
hsb.h += 360;
}
hsb.s *= 100 / 255;
hsb.b *= 100 / 255;
return hsb;
},
HSBToRGB = function(hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s * 255 / 100);
var v = Math.round(hsb.b * 255 / 100);
if (s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255 - s) * v / 255;
var t3 = (t1 - t2) * (h % 60) / 60;
if (h == 360) h = 0;
if (h < 60) {
rgb.r = t1;
rgb.b = t2;
rgb.g = t2 + t3
} else if (h < 120) {
rgb.g = t1;
rgb.b = t2;
rgb.r = t1 - t3
} else if (h < 180) {
rgb.g = t1;
rgb.r = t2;
rgb.b = t2 + t3
} else if (h < 240) {
rgb.b = t1;
rgb.r = t2;
rgb.g = t1 - t3
} else if (h < 300) {
rgb.b = t1;
rgb.g = t2;
rgb.r = t2 + t3
} else if (h < 360) {
rgb.r = t1;
rgb.g = t2;
rgb.b = t1 - t3
} else {
rgb.r = 0;
rgb.g = 0;
rgb.b = 0
}
}
return {
r: Math.round(rgb.r),
g: Math.round(rgb.g),
b: Math.round(rgb.b)
};
},
RGBToHex = function(rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)];
$.each(hex, function(nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
},
HSBToHex = function(hsb) {
return RGBToHex(HSBToRGB(hsb));
},
restoreOriginal = function() {
var cal = $(this)
.parent();
var col = cal.data('colorpicker')
.origColor;
cal.data('colorpicker')
.color = col;
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
};
return {
init: function(opt) {
opt = $.extend({}, defaults, opt || {});
if (typeof opt.color == 'string') {
opt.color = HexToHSB(opt.color);
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
opt.color = RGBToHSB(opt.color);
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
opt.color = fixHSB(opt.color);
} else {
return this;
}
return this.each(function() {
if (!$(this)
.data('colorpickerId')) {
var options = $.extend({}, opt);
options.origColor = opt.color;
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this)
.data('colorpickerId', id);
var cal = $(tpl)
.attr('id', id);
if (options.flat) {
cal.appendTo(this)
.show();
} else {
cal.appendTo(document.body);
}
options.fields = cal.find('input')
.bind('keyup', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
cal.find('span')
.bind('mousedown', downIncrement)
.end()
.find('>div.colorpicker_current_color')
.bind('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color')
.bind('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.el = this;
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue')
.bind('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
if (options.flat) {
cal.css({
position: 'relative',
display: 'block'
});
} else {
$(this)
.bind(options.eventName, show);
}
}
});
},
showPicker: function() {
return this.each(function() {
if ($(this)
.data('colorpickerId')) {
show.apply(this);
}
});
},
hidePicker: function() {
return this.each(function() {
if ($(this)
.data('colorpickerId')) {
$('#' + $(this)
.data('colorpickerId'))
.hide();
}
});
},
setColor: function(col) {
if (typeof col == 'string') {
col = HexToHSB(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = RGBToHSB(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function() {
if ($(this)
.data('colorpickerId')) {
var cal = $('#' + $(this)
.data('colorpickerId'));
cal.data('colorpicker')
.color = col;
cal.data('colorpicker')
.origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setCurrentColor(col, cal.get(0));
setNewColor(col, cal.get(0));
}
});
}
};
}();
$.fn.extend({
ColorPicker: ColorPicker.init,
ColorPickerHide: ColorPicker.hidePicker,
ColorPickerShow: ColorPicker.showPicker,
ColorPickerSetColor: ColorPicker.setColor
});
})(jQuery)

View File

@ -1,10 +0,0 @@
[ { "author" : "Fluidbyte",
"version": "1.0",
"name" : "Color Tool",
"url" : "https://github.com/Fluidbyte/Codiad-ColorPicker.git",
"rightbar" : [{
"action" : "codiad.colorPicker.open();",
"icon" : "icon-palette",
"title" : "Color Tool"
}]
} ]

View File

@ -1,164 +0,0 @@
.colorpicker {
width: 356px;
height: 176px;
overflow: hidden;
position: absolute;
background: url(images/colorpicker_background.png);
font-family: Arial, Helvetica, sans-serif;
display: none;
}
.colorpicker_color {
width: 150px;
height: 150px;
left: 14px;
top: 13px;
position: absolute;
background: #f00;
overflow: hidden;
cursor: crosshair;
}
.colorpicker_color div {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: url(images/colorpicker_overlay.png);
}
.colorpicker_color div div {
position: absolute;
top: 0;
left: 0;
width: 11px;
height: 11px;
overflow: hidden;
background: url(images/colorpicker_select.gif);
margin: -5px 0 0 -5px;
}
.colorpicker_hue {
position: absolute;
top: 13px;
left: 171px;
width: 35px;
height: 150px;
cursor: n-resize;
}
.colorpicker_hue div {
position: absolute;
width: 35px;
height: 9px;
overflow: hidden;
background: url(images/colorpicker_indic.gif) left top;
margin: -4px 0 0 0;
left: 0px;
}
.colorpicker_new_color {
position: absolute;
width: 60px;
height: 30px;
left: 213px;
top: 13px;
background: #f00;
}
.colorpicker_current_color {
position: absolute;
width: 60px;
height: 30px;
left: 283px;
top: 13px;
background: #f00;
}
.colorpicker input {
background-color: transparent;
border: 1px solid transparent;
position: absolute;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #898989;
top: 4px;
right: 11px;
text-align: right;
margin: 0;
padding: 0;
height: 11px;
}
.colorpicker_hex {
position: absolute;
width: 72px;
height: 22px;
background: url(images/colorpicker_hex.png) top;
left: 212px;
top: 142px;
}
.colorpicker_hex input {
right: 6px;
}
.colorpicker_field {
height: 22px;
width: 62px;
background-position: top;
position: absolute;
}
.colorpicker_field span {
position: absolute;
width: 12px;
height: 22px;
overflow: hidden;
top: 0;
right: 0;
cursor: n-resize;
}
.colorpicker_rgb_r {
background-image: url(images/colorpicker_rgb_r.png);
top: 52px;
left: 212px;
}
.colorpicker_rgb_g {
background-image: url(images/colorpicker_rgb_g.png);
top: 82px;
left: 212px;
}
.colorpicker_rgb_b {
background-image: url(images/colorpicker_rgb_b.png);
top: 112px;
left: 212px;
}
.colorpicker_hsb_h {
background-image: url(images/colorpicker_hsb_h.png);
top: 52px;
left: 282px;
}
.colorpicker_hsb_s {
background-image: url(images/colorpicker_hsb_s.png);
top: 82px;
left: 282px;
}
.colorpicker_hsb_b {
background-image: url(images/colorpicker_hsb_b.png);
top: 112px;
left: 282px;
}
.colorpicker_submit {
position: absolute;
width: 22px;
height: 22px;
background: url(images/colorpicker_submit.png) top;
left: 322px;
top: 142px;
overflow: hidden;
}
.colorpicker_focus {
background-position: center;
}
.colorpicker_hex.colorpicker_focus {
background-position: bottom;
}
.colorpicker_submit.colorpicker_focus {
background-position: bottom;
}
.colorpicker_slider {
background-position: bottom;
}
.colorpicker_rgb_r input, .colorpicker_rgb_g input, .colorpicker_rgb_b input, .colorpicker_hsb_h input, .colorpicker_hsb_s input, .colorpicker_hsb_b input {
max-width: 30px;
}

View File

@ -1,13 +0,0 @@
#DragDrop
Drag'n'Drop for Codiad filemanager
##Installation
- Download the zip file and unzip it to your plugin folder.
#New Features
Drag files to insert or append content to current active file. (Activate it in the settings)
![Screenshot](https://andrano.de/Plugins/img/dragdrop.png "Screenshot")

View File

@ -1,64 +0,0 @@
<?php
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
error_reporting(0);
require_once('../../common.php');
checkSession();
switch($_GET['action']) {
case 'move':
if (isset($_GET['source']) && isset($_GET['dest'])) {
$source = getWorkspacePath($_GET['source']);
$dest = getWorkspacePath($_GET['dest']) ."/". basename($source);
if (!file_exists($dest)) {
if (rename($source, $dest)) {
echo '{"status":"success","message":"Path moved"}';
} else {
echo '{"status":"error","message":"Failed to move path!"}';
}
} else {
echo '{"status":"error","message":"Path already exists!"}';
}
} else {
echo '{"status":"error","message":"Missing Parameter"}';
}
break;
case 'getContent':
if (isset($_GET['path'])) {
$content = file_get_contents(getWorkspacePath($_GET['path']));
$result = array("status" => "success", "content" => $content);
echo json_encode($result);
} else {
echo '{"status":"error","message":"Missing Parameter"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
break;
}
function getWorkspacePath($path) {
if (strpos($path, "/") === 0) {
//Unix absolute path
return $path;
}
if (strpos($path, ":/") !== false) {
//Windows absolute path
return $path;
}
if (strpos($path, ":\\") !== false) {
//Windows absolute path
return $path;
}
return WORKSPACE . "/" . $path;
}
?>

View File

@ -1,20 +0,0 @@
<?php
require_once('../../common.php');
?>
<div class="dragdrop_settings">
<label><span class="icon-magnet big-icon"></span>Drag'n'Drop Settings</label>
<hr>
<table class="settings">
<tr>
<td style="width: 80%;">
Enable drag'n'drop to insert or append file content in active file
</td>
<td>
<select class="setting" data-setting="codiad.plugin.drag.insert">
<option value="true"><?php i18n("Yes"); ?></option>
<option value="false" selected><?php i18n("No"); ?></option>
</select>
</td>
</tr>
</table>
</div>

View File

@ -1,320 +0,0 @@
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
(function(global, $){
var codiad = global.codiad,
scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/',
instance = null;
$(function() {
codiad.Drag.init();
});
codiad.Drag = {
path: curpath,
files: [],
template: "",
init: function() {
var _this = this;
instance = this;
var fn = function(){
//Drag
$('#file-manager a:not(#project-root)').draggable({
opacity: 0.85,
revert: true,
start: _this.start,
stop: _this.stop,
zIndex: 100
});
//Drop
$('.directory').droppable({
accept : "#file-manager a:not(#project-root)",
drop : _this.drop,
over : _this.over,
out : _this.out
});
};
amplify.subscribe('filemanager.onIndex', function(obj){
setTimeout(fn, 250);
setTimeout(function(){
//Reopen closed files
$.each(instance.files, function(i, item){
codiad.filemanager.openFile(item, false);
});
instance.files = [];
}, 250);
});
amplify.subscribe('filemanager.onCreate', function(obj){
setTimeout(fn, 250);
});
amplify.subscribe('filemanager.onPaste', function(obj){
setTimeout(fn, 250);
});
amplify.subscribe('filemanager.onUpload', function(obj){
setTimeout(fn, 250);
});
//File drop
var apply = function() {
$('#file-manager').append(_this.template);
$('#drag_append').droppable({
accept : "#file-manager a.file",
drop : _this.appendDrop,
over : _this.over,
out : _this.out
});
$('#drag_insert').droppable({
accept : "#file-manager a.file",
drop : _this.insertDrop,
over : _this.over,
out : _this.out
});
};
$.get(this.path + 'template.html', function(html){
_this.template = html;
apply();
});
amplify.subscribe('filemanager.onIndex', function(obj){
if (obj.path == $('#project-root').attr('data-path')) {
setTimeout(function(){
apply();
}, 100);
}
});
},
//////////////////////////////////////////////////////////
//
// Start dragging
//
//////////////////////////////////////////////////////////
start: function() {
if (codiad.editor.getActive() !== null && instance.__editEnabled()) {
$('#dragdrop').show();
}
},
//////////////////////////////////////////////////////////
//
// Stop dragging
//
//////////////////////////////////////////////////////////
stop: function() {
$('#dragdrop').hide();
$('#dragdrop .drop_over').removeClass('drop_over');
},
//////////////////////////////////////////////////////////
//
// Drop item
//
// Parameters:
//
// event - {Event} - Check for more details
// ui - {Object} - http://api.jqueryui.com/droppable/
//
//////////////////////////////////////////////////////////
drop: function(event, ui) {
var dest = $(this).attr('data-path');
var source = $(ui.draggable).attr('data-path');
var target = dest + instance.getName(source);
//Close file(s) if open and save it/them for reopening
if (instance.isDir(ui.draggable)) {
$.each(codiad.active.sessions, function(i, item){
if (instance.startsWith(i,source)) {
codiad.active.save(i);
codiad.active.close(i);
instance.files.push(i.replace(source, target));
}
});
} else {
if (codiad.active.isOpen(source)) {
codiad.active.save(source);
codiad.active.close(source);
instance.files.push(target);
}
}
instance.move(source, dest, ui.draggable);
instance.out();
},
//////////////////////////////////////////////////////////
//
// Item over
//
// Parameters:
//
// event - {Event} - Check for more details
// ui - {Object} - http://api.jqueryui.com/droppable/
//
//////////////////////////////////////////////////////////
over: function(event, ui) {
$(this).addClass('drop_over');
},
//////////////////////////////////////////////////////////
//
// Item out
//
// Parameters:
//
// event - {Event} - Check for more details
// ui - {Object} - http://api.jqueryui.com/droppable/
//
//////////////////////////////////////////////////////////
out: function(event, ui) {
$(this).removeClass('drop_over');
},
//////////////////////////////////////////////////////////
//
// Move item
//
// Parameters:
//
// source - {String} - Dropping item path
// dest - {String} - Dropping zone path
// element - {jQuery} - Dropped item
//
//////////////////////////////////////////////////////////
move: function(source, dest, element) {
$.getJSON(this.path+"controller.php?action=move&source="+source+"&dest="+dest, function(json){
codiad.message[json.status](json.message);
if (json.status == "success") {
element.context.parentElement.remove();
codiad.filemanager.rescan(codiad.project.getCurrent());
}
});
},
//////////////////////////////////////////////////////////
//
// Is file or directory
//
// Parameters:
//
// element - {jQuery} - Item
//
//////////////////////////////////////////////////////////
isDir: function(element) {
if ($(element).hasClass('directory')) {
return true;
} else {
return false;
}
},
//////////////////////////////////////////////////////////
//
// Get name
//
// Parameters:
//
// path - {String} - File path
//
//////////////////////////////////////////////////////////
getName: function(path) {
return path.substring(path.lastIndexOf("/"));
},
//////////////////////////////////////////////////////////
//
// Starts string with something
//
// Parameters:
//
// string - {String} - String to search in
// needle - {String} - Needle to search for
//
//////////////////////////////////////////////////////////
startsWith: function(string, needle) {
if (string.indexOf(needle) === 0) {
return true;
} else {
return false;
}
},
//////////////////////////////////////////////////////////
//
// Drop item to append it to current file
//
// Parameters:
//
// event - {Event} - Check for more details
// ui - {Object} - http://api.jqueryui.com/droppable/
//
//////////////////////////////////////////////////////////
appendDrop: function(event, ui) {
var path = $(ui.draggable).attr('data-path');
instance.__edit(path, "append");
},
//////////////////////////////////////////////////////////
//
// Drop item to insert it
//
// Parameters:
//
// event - {Event} - Check for more details
// ui - {Object} - http://api.jqueryui.com/droppable/
//
//////////////////////////////////////////////////////////
insertDrop: function(event, ui) {
var path = $(ui.draggable).attr('data-path');
instance.__edit(path, "insert");
},
//////////////////////////////////////////////////////////
//
// Load content of dropped file and insert it
//
// Parameters:
//
// path - {String} - Path of dropped file
// type - {String} - Type of action: insert or append content
//
//////////////////////////////////////////////////////////
__edit: function(path, type) {
$.getJSON(instance.path + 'controller.php?action=getContent&path=' + path, function(result){
if (result.status == "success") {
var active = codiad.editor.getActive();
if (active === null) {
codiad.message.error("No Open Files");
return false;
}
if (type == "append") {
active.navigateFileEnd();
}
active.insert(result.content);
codiad.message.success("Content " + type + "ed");
} else {
codiad.message.error(result.message);
}
});
},
//////////////////////////////////////////////////////////
//
// Wheater dragging to insert file content is enabled or not
//
//////////////////////////////////////////////////////////
__editEnabled: function() {
var setting = localStorage.getItem('codiad.plugin.drag.insert');
if (setting === null) {
return false;
} else if (setting === "true") {
return true;
}
return false;
}
};
})(this, jQuery);

View File

@ -1,10 +0,0 @@
[{ "author" : "Andr3as",
"version": "0.3.0",
"name" : "DragDrop",
"url" : "https://github.com/Andr3as/Codiad-DragDrop",
"config": [{
"file": "dialog.php",
"icon": "icon-magnet",
"title": "DragDrop"
}]
}]

View File

@ -1,33 +0,0 @@
#dragdrop {
box-shadow: 0 0 5px 5px #111;
display: none;
float: left;
margin-top: 10px;
margin-bottom: 20px;
width: 100%;
}
#dragdrop div {
background-color: rgb(40,40,40);
background-color: rgba(40,40,40,0.25);
float: left;
width: 50%;
}
#dragdrop #drag_append {
border-right: 2px solid black;
}
#dragdrop label {
margin: 10px;
padding: 0;
text-align: center;
}
.ui-draggable-dragging {
min-width: 0 !important;
}
.drop_over {
background-color: #333333 !important;
}

View File

@ -1,8 +0,0 @@
<div id="dragdrop">
<div id="drag_append">
<label>Append</label>
</div>
<div id="drag_insert">
<label>Insert</label>
</div>
</div>

View File

@ -1,7 +0,0 @@
#Duplicate
Duplicate files directly through the filemanager.
##Installation
- Download the zip file and unzip it to your plugin folder.

View File

@ -1,54 +0,0 @@
<?php
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
error_reporting(0);
require_once('../../common.php');
checkSession();
switch($_GET['action']) {
case 'duplicate':
if (isset($_GET['path']) && isset($_GET['name'])) {
$source = getWorkspacePath($_GET['path']);
$des = getWorkspacePath(dirname($_GET['path'])."/".$_GET['name']);
if (copy($source, $des)) {
echo '{"status":"success","message":"File duplicated"}';
} else {
echo '{"status":"error","message":"Failed to duplicate"}';
}
} else {
echo '{"status":"error","message":"Missing Parameter"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
break;
}
function getWorkspacePath($path) {
//Security check
if (!Common::checkPath($path)) {
die('{"status":"error","message":"Invalid path"}');
}
if (strpos($path, "/") === 0) {
//Unix absolute path
return $path;
}
if (strpos($path, ":/") !== false) {
//Windows absolute path
return $path;
}
if (strpos($path, ":\\") !== false) {
//Windows absolute path
return $path;
}
return WORKSPACE . "/" . $path;
}
?>

View File

@ -1,13 +0,0 @@
<!--
Copyright (c) Codiad & Andr3as, distributed
as-is and without warranty under the MIT License.
See http://opensource.org/licenses/MIT for more information.
This information must remain intact.
-->
<form>
<label>Duplicate</label>
<p>Enter new name</p>
<input type="text" id="duplicate_name" value="<?php echo $_GET['name'] ?>">
<button onclick="codiad.Duplicate.duplicate(); return false;">Duplicate</button>
<button onclick="codiad.modal.unload(); return false;">Close</button>
</form>

View File

@ -1,81 +0,0 @@
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
(function(global, $){
var codiad = global.codiad,
scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length-1].src.split('?')[0],
curpath = path.split('/').slice(0, -1).join('/')+'/';
$(function() {
codiad.Duplicate.init();
});
codiad.Duplicate = {
path: curpath,
file: "",
init: function() {
},
//////////////////////////////////////////////////////////
//
// Show dialog to enter new name
//
// Parameter
//
// path - {String} - File path
//
//////////////////////////////////////////////////////////
showDialog: function(path) {
this.file = path;
var name = this.getName(path);
codiad.modal.load(400, this.path+"dialog.php?name="+name);
},
//////////////////////////////////////////////////////////
//
// Duplicate file
//
// Parameter
//
// path - {String} - File path
// name - {String} - Name of the duplicate
//
//////////////////////////////////////////////////////////
duplicate: function(path, name) {
var _this = this;
if (typeof(path) == 'undefined') {
path = this.file;
}
if (typeof(name) == 'undefined') {
name = $('#duplicate_name').val();
codiad.modal.unload();
}
$.getJSON(_this.path+"controller.php?action=duplicate&path="+path+"&name="+name, function(json){
codiad.message[json.status](json.message);
codiad.filemanager.rescan(codiad.project.getCurrent());
});
},
//////////////////////////////////////////////////////////
//
// Get basename of file
//
// Parameter
//
// path - {String} - File path
//
//////////////////////////////////////////////////////////
getName: function(path) {
return path.substring(path.lastIndexOf("/")+1);
}
};
})(this, jQuery);

View File

@ -1,11 +0,0 @@
[{ "author" : "Andr3as",
"version": "0.2.2",
"name" : "Duplicate",
"url" : "https://github.com/Andr3as/Codiad-Duplicate",
"contextmenu" : [{
"action" : "codiad.Duplicate.showDialog($('#context-menu').attr('data-path'));",
"icon" : "icon-list-add",
"applies-to" : "file-only",
"title" : "Duplicate"
}]
}]

View File

@ -1,7 +0,0 @@
# Macro
This plugin adds some kind of macro functionallity to Codiad
# Installation
- Download the zip file and extract it to your plugins folder

View File

@ -1,91 +0,0 @@
<?php
/*
* Copyright (c) Codiad & daeks, distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
require_once('../../common.php');
class Macro extends Common {
//////////////////////////////////////////////////////////////////
// PROPERTIES
//////////////////////////////////////////////////////////////////
public $id = 0;
public $path = '';
//////////////////////////////////////////////////////////////////
// METHODS
//////////////////////////////////////////////////////////////////
// -----------------------------||----------------------------- //
//////////////////////////////////////////////////////////////////
// Construct
//////////////////////////////////////////////////////////////////
public function __construct(){
if(!file_exists(DATA."/config/".get_called_class().".php")) {
@mkdir(DATA."/config");
saveJSON("/config/".get_called_class().".php", array());
}
}
//////////////////////////////////////////////////////////////////
// Load Contextmenu Macros
//////////////////////////////////////////////////////////////////
public function Load() {
return getJSON("/config/".get_called_class().".php");
}
//////////////////////////////////////////////////////////////////
// Save Contextmenu Macros
//////////////////////////////////////////////////////////////////
public function Save() {
$data = array();
if(isset($_GET['n'])) {
foreach ($_GET['n'] as $key => $name){
$tmp['n'] = trim($name);
$tmp['d'] = trim($_GET["d"][$key]);
$tmp['a'] = trim($_GET["a"][$key]);
$tmp['t'] = trim($_GET["t"][$key]);
$tmp['i'] = trim($_GET["i"][$key]);
$tmp['c'] = trim($_GET["c"][$key]);
array_push($data,$tmp);
}
}
saveJSON("/config/".get_called_class().".php", $data);
echo formatJSEND("success",null);
}
//////////////////////////////////////////////////////////////////
// Execute Macro
//////////////////////////////////////////////////////////////////
public function Execute() {
$macrolist = $this->Load();
$command = $macrolist[$this->id]['c'];
if(!$this->isAbsPath($this->path)) {
$this->path = WORKSPACE.'/'.$this->path;
}
if(is_file($this->path)) {
$command = str_replace('%FILE%',$this->path,$command);
$command = str_replace('%FOLDER%',dirname($this->path),$command);
$command = str_replace('%NAME%',basename($this->path),$command);
} else {
$command = str_replace('%FOLDER%',$this->path,$command);
$command = str_replace('%NAME%',basename($this->path),$command);
}
shell_exec($command);
echo formatJSEND("success",null);
}
}

View File

@ -1,51 +0,0 @@
<?php
/*
* Copyright (c) Codiad & daeks, distributed
* as-is and without warranty under the MIT License. See
* [root]/license.txt for more. This information must remain intact.
*/
require_once('../../common.php');
require_once('class.macro.php');
//////////////////////////////////////////////////////////////////
// Verify Session or Key
//////////////////////////////////////////////////////////////////
if(isset($_GET['action']) && $_GET['action']!='authenticate'){ checkSession(); }
$macro = new Macro();
//////////////////////////////////////////////////////////////////
// Load Contextmenu Macros
//////////////////////////////////////////////////////////////////
if($_GET['action']=='init'){
echo json_encode($macro->Load());
}
//////////////////////////////////////////////////////////////////
// Save Contextmenu Macros
//////////////////////////////////////////////////////////////////
if($_GET['action']=='save'){
if(checkAccess()) {
$macro->Save();
}
}
//////////////////////////////////////////////////////////////////
// Execute Macro
//////////////////////////////////////////////////////////////////
if($_GET['action']=='execute'){
if(checkAccess()) {
$macro->id = $_GET['id'];
$macro->path = $_GET['path'];
$macro->Execute();
}
}
?>

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