diff options
Diffstat (limited to 'apps/atnotes')
-rw-r--r-- | apps/atnotes/ajax/browse.php | 112 | ||||
-rw-r--r-- | apps/atnotes/ajax/check.php | 56 | ||||
-rw-r--r-- | apps/atnotes/ajax/delete.php | 34 | ||||
-rw-r--r-- | apps/atnotes/ajax/export.php | 56 | ||||
-rw-r--r-- | apps/atnotes/ajax/save.php | 36 | ||||
-rw-r--r-- | apps/atnotes/appinfo/app.php | 39 | ||||
-rw-r--r-- | apps/atnotes/appinfo/database.xml | 79 | ||||
-rw-r--r-- | apps/atnotes/appinfo/info.xml | 11 | ||||
-rw-r--r-- | apps/atnotes/atnotes.php | 29 | ||||
-rw-r--r-- | apps/atnotes/css/atnotes.min.css | 22 | ||||
-rw-r--r-- | apps/atnotes/css/jquery-te-1.0.3.min.css | 11 | ||||
-rw-r--r-- | apps/atnotes/css/jquery.qtip.min.css | 1 | ||||
-rw-r--r-- | apps/atnotes/img/action.png | bin | 0 -> 697 bytes | |||
-rw-r--r-- | apps/atnotes/img/icon.png | bin | 0 -> 117 bytes | |||
-rw-r--r-- | apps/atnotes/img/jquery-te-toolbar.png | bin | 0 -> 53849 bytes | |||
-rw-r--r-- | apps/atnotes/img/save.png | bin | 0 -> 201 bytes | |||
-rw-r--r-- | apps/atnotes/js/atnotes.min.js | 22 | ||||
-rw-r--r-- | apps/atnotes/js/jquery-te-1.0.3.min.js | 10 | ||||
-rw-r--r-- | apps/atnotes/js/jquery.qtip.min.js | 13 | ||||
-rw-r--r-- | apps/atnotes/lib/atnotes.class.php | 88 | ||||
-rw-r--r-- | apps/atnotes/templates/main.tpl.php | 71 |
21 files changed, 690 insertions, 0 deletions
diff --git a/apps/atnotes/ajax/browse.php b/apps/atnotes/ajax/browse.php new file mode 100644 index 00000000000..475b5e8614e --- /dev/null +++ b/apps/atnotes/ajax/browse.php @@ -0,0 +1,112 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +require_once('../../../lib/base.php'); +require_once('../../../lib/template.php'); + +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('atnotes'); + +$p = trim($_POST['p']); +$top = FALSE; +if($p == '/'){ + $p = OC::$CONFIG_DATADIRECTORY; + $top = TRUE; +} + +$files = Array(); +foreach(OC_Files::getdirectorycontent($p) as $i){ + $elt = ''; + + if($i['type'] == 'file'){ + $fileinfo = pathinfo($i['name']); + $i['basename'] = $fileinfo['filename']; + if (!empty($fileinfo['extension'])){ + $i['extention'] = '.'.$fileinfo['extension']; + }else{ + $i['extention'] = ''; + } + } + if($i['directory'] == '/'){ + $i['directory'] = ''; + } + if($i['extention'] == '.txt' || $i['type'] == 'dir'){ + $i["date"] = OC_Util::formatDate($i["mtime"]); + + $write = ($i['writeable'])?'true':'false'; + $simple_file_size = simple_file_size($i['size']); + $simple_size_color = intval(200 - $i['size'] / (1024 * 1024) * 2); + + if($simple_size_color < 0){ + $simple_size_color = 0; + } + + $relative_modified_date = relative_modified_date($i['mtime']); + $relative_date_color = round((time() - $i['mtime']) / 60 / 60 / 24 * 14); + + if($relative_date_color > 200){ + $relative_date_color = 200; + } + + $name = str_replace('+', '%20', urlencode($i['name'])); + $name = str_replace('%2F', '/', $name); + $directory = str_replace('+', '%20', urlencode($i['directory'])); + $directory = str_replace('%2F', '/', $directory); + + $elt .= '<tr data-file="'.$name.'" data-type="'.(($i['type'] == 'dir')?'dir':'file').'" data-mime="'.$i['mime'].'" data-size="'.$i['size'].'" data-write="'.$write.'">'; + $elt .= '<td class="filename svg" data-rel="'.$directory.'/'.$name.'" style="background-image:url('.(($i['type'] == 'dir')?mimetype_icon('dir'):mimetype_icon($i['mime'])).')">'; + $elt .= '<span class="nametext">'; + if($i['type'] == 'dir'){ + $elt .= htmlspecialchars($i['name']); + }else{ + $elt .= htmlspecialchars($i['basename']).'<span class="extention">'.$i['extention'].'</span>'; + } + $elt .= '</span>'; + $elt .= '</td>'; + $elt .= '<td class="filesize" title="'.human_file_size($i['size']).'" style="color:rgb('.$simple_size_color.','.$simple_size_color.','.$simple_size_color.')">'.$simple_file_size.'</td>'; + $elt .= '<td class="date"><span class="modified" title="'.$i['date'].'" style="color:rgb('.$relative_date_color.','.$relative_date_color.','.$relative_date_color.')">'.$relative_modified_date.'</span></td>'; + $elt .= '</tr>'; + + $files[] = $elt; + } +} + +if(!$top){ + $p = str_replace('+', '%20', urlencode($p)); + $p = str_replace('%2F', '/', $p); + $p = substr($p,0,strrpos($p,'/')); + if(strlen($p) == 0){ + $p = '/'; + } + + $elt = '<tr>'; + $elt .= '<td class="filename svg" data-rel="'.$p.'" style="background-image:url('.mimetype_icon('dir').')">'; + $elt .= '<span class="nametext">..</span>'; + $elt .= '</td>'; + $elt .= '<td class="filesize"> </td>'; + $elt .= '<td class="date"> </td>'; + $elt .= '</tr>'; + array_unshift($files, $elt); +} + +OC_JSON::encodedPrint($files);
\ No newline at end of file diff --git a/apps/atnotes/ajax/check.php b/apps/atnotes/ajax/check.php new file mode 100644 index 00000000000..c2642b620f6 --- /dev/null +++ b/apps/atnotes/ajax/check.php @@ -0,0 +1,56 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('atnotes'); + +$p = trim($_POST['p']); +$t = trim($_POST['t']); + +$normalizeChars = array( + 'Á'=>'A', 'À'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Å'=>'A', 'Ä'=>'A', 'Æ'=>'AE', 'Ç'=>'C', + 'É'=>'E', 'È'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Í'=>'I', 'Ì'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ð'=>'Eth', + 'Ñ'=>'N', 'Ó'=>'O', 'Ò'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', + 'Ú'=>'U', 'Ù'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', + 'á'=>'a', 'à'=>'a', 'â'=>'a', 'ã'=>'a', 'å'=>'a', 'ä'=>'a', 'æ'=>'ae', 'ç'=>'c', + 'é'=>'e', 'è'=>'e', 'ê'=>'e', 'ë'=>'e', 'í'=>'i', 'ì'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'eth', + 'ñ'=>'n', 'ó'=>'o', 'ò'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', + 'ú'=>'u', 'ù'=>'u', 'û'=>'u', 'ü'=>'u', 'ý'=>'y', + 'ß'=>'sz', 'þ'=>'thorn', 'ÿ'=>'y', ' ' => '_', '"' => '', "'" => ' ', '/' => '-' +); + +$r = Array('e' => FALSE, 'p' => ''); +if(strlen($p) != 0 && strlen($t) != 0){ + $fs = OCP\Files::getStorage('files'); + if($fs->is_dir($p)){ + $r['p'] = $p.'/'.strtr($t, $normalizeChars).'.txt'; + }else{ + $r['p'] = $p; + } + + if($fs->file_exists($r['p'])){ + $r['e'] = TRUE; + } +} + +OCP\JSON::encodedPrint($r); diff --git a/apps/atnotes/ajax/delete.php b/apps/atnotes/ajax/delete.php new file mode 100644 index 00000000000..dfb9e116478 --- /dev/null +++ b/apps/atnotes/ajax/delete.php @@ -0,0 +1,34 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('atnotes'); + +$i = trim($_POST['i']); + +$r = Array('e' => 1); +if(is_numeric($i)){ + $r['e'] = OC_ATNotes::deleteNote($i); +} + +OCP\JSON::encodedPrint($r);
\ No newline at end of file diff --git a/apps/atnotes/ajax/export.php b/apps/atnotes/ajax/export.php new file mode 100644 index 00000000000..d158f6b3c0c --- /dev/null +++ b/apps/atnotes/ajax/export.php @@ -0,0 +1,56 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('atnotes'); + +$p = trim($_POST['p']); +$t = trim($_POST['t']); +$c = trim($_POST['c']); + +$r = Array('e' => ''); +if(strlen($p) != 0 && strlen($t) != 0 && strlen($c) != 0){ + $fs = OCP\Files::getStorage('files'); + if(!$fp = $fs->fopen($p, 'w')){ + $r['e'] = 'Can not open file '.$p; + }else{ + if(fwrite($fp, $t."\n") === FALSE){ + $r['e'] = 'Can not write to file '.$p; + }else{ + $c = preg_replace('/<br[.*]{0,}>/',"\n",$c); + $c = preg_replace('/<u[.*]{0,}>/','',$c);$c = preg_replace('/<\/u>/','',$c); + $c = preg_replace('/<b[.*]{0,}>/','',$c);$c = preg_replace('/<\/b>/','',$c); + $c = preg_replace('/<i[.*]{0,}>/','',$c);$c = preg_replace('/<\/i>/','',$c); + $c = preg_replace('/<hr.*>/',"------------------------\n",$c); + $c = preg_replace('/<sup[.*]{0,}>/','(',$c);$c = preg_replace('/<\/sup>/',')',$c); + $c = preg_replace('/<sub[.*]{0,}>/','(',$c);$c = preg_replace('/<\/sub>/',')',$c); + if(fwrite($fp, $c) === FALSE){ + $r['e'] = 'Can not write to file '.$p; + }else{ + fclose($fp); + } + } + } +} + +OCP\JSON::encodedPrint($r); diff --git a/apps/atnotes/ajax/save.php b/apps/atnotes/ajax/save.php new file mode 100644 index 00000000000..1212c9ea4c3 --- /dev/null +++ b/apps/atnotes/ajax/save.php @@ -0,0 +1,36 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('atnotes'); + +$i = trim($_POST['i']); +$t = trim($_POST['t']); +$c = trim($_POST['c']); + +$r = Array('e' => '', 'i' => 0); +if(strlen($t) != 0){ + $r['i'] = OC_ATNotes::saveNote($i,$t,$c); +} + +OCP\JSON::encodedPrint($r);
\ No newline at end of file diff --git a/apps/atnotes/appinfo/app.php b/apps/atnotes/appinfo/app.php new file mode 100644 index 00000000000..4304e178714 --- /dev/null +++ b/apps/atnotes/appinfo/app.php @@ -0,0 +1,39 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\App::checkAppEnabled('atnotes'); +OC::$CLASSPATH['OC_ATNotes'] = 'apps/atnotes/lib/atnotes.class.php'; + +OCP\App::register(Array( + 'order' => 29, + 'id' => 'atnotes', + 'name' => 'ATNotes' +)); + +OCP\App::addNavigationEntry(Array( + 'id' => 'atnotes_index', + 'order' => 29, + 'href' => OCP\Util::linkTo('atnotes', 'atnotes.php'), + 'icon' => OCP\Util::imagePath('atnotes', 'icon.png'), + 'name' => 'ATNotes' +));
\ No newline at end of file diff --git a/apps/atnotes/appinfo/database.xml b/apps/atnotes/appinfo/database.xml new file mode 100644 index 00000000000..d075c90f5dc --- /dev/null +++ b/apps/atnotes/appinfo/database.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<database> + <name>*dbname*</name> + <create>true</create> + <overwrite>false</overwrite> + <charset>utf8</charset> + <table> + <name>*dbprefix*atnotes</name> + <declaration> + <field> + <name>note_id</name> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <autoincrement>1</autoincrement> + <unsigned>true</unsigned> + <length>4</length> + </field> + <field> + <name>oc_uid</name> + <type>text</type> + <notnull>true</notnull> + <length>64</length> + </field> + <field> + <name>create_ts</name> + <type>integer</type> + <notnull>true</notnull> + <length>11</length> + </field> + <field> + <name>update_ts</name> + <type>integer</type> + <notnull>false</notnull> + <default>0</default> + <length>11</length> + </field> + <field> + <name>note_title</name> + <type>text</type> + <notnull>true</notnull> + <length>255</length> + </field> + <field> + <name>note_content</name> + <type>clob</type> + <notnull>false</notnull> + </field> + <field> + <name>note_file</name> + <type>text</type> + <notnull>false</notnull> + <length>255</length> + </field> + <field> + <name>is_deleted</name> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <length>1</length> + </field> + <field> + <name>is_shared</name> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <length>1</length> + </field> + <index> + <name>note_pk</name> + <primary>true</primary> + <field> + <name>note_id</name> + <sorting>ascending</sorting> + </field> + </index> + </declaration> + </table> +</database>
\ No newline at end of file diff --git a/apps/atnotes/appinfo/info.xml b/apps/atnotes/appinfo/info.xml new file mode 100644 index 00000000000..0ea9a74200d --- /dev/null +++ b/apps/atnotes/appinfo/info.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<info> + <id>atnotes</id> + <name>ATNotes</name> + <description>ATNotes for Always Take Notes. Create/Edit/Delete notes in the application. You can export notes to save them in your ownCloud filesystem and you can access them through the WebDAV protocol.</description> + <version>1.0</version> + <licence>AGPL</licence> + <author>Xavier Beurois (www.djazz-lab.net)</author> + <require>4</require> + <shipped>true</shipped> +</info> diff --git a/apps/atnotes/atnotes.php b/apps/atnotes/atnotes.php new file mode 100644 index 00000000000..b028f0adcee --- /dev/null +++ b/apps/atnotes/atnotes.php @@ -0,0 +1,29 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\User::checkLoggedIn(); +OCP\App::checkAppEnabled('atnotes'); + +$tmpl = new OCP\Template('atnotes', 'main.tpl', 'user'); +$tmpl->assign('notes_list', OC_ATNotes::getNotesList()); +$tmpl->printPage(); diff --git a/apps/atnotes/css/atnotes.min.css b/apps/atnotes/css/atnotes.min.css new file mode 100644 index 00000000000..b98a2c50a80 --- /dev/null +++ b/apps/atnotes/css/atnotes.min.css @@ -0,0 +1,22 @@ +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +#atnotes_container{min-width:830px}#atnotes_container div#controls div.title{color:#BBB;font-style:italic;padding:.7em .5em .5em}#atnotes_container ul.atnotes-noteslist{background:none repeat scroll 0 0 #f8f8f8;border-right:1px solid #DDD;overflow:auto;position:fixed;top:6.3em;width:20em;box-shadow:-2px -3px 7px #000;z-index:2}#atnotes_container ul.atnotes-noteslist li.atnotes-elt{border-bottom:1px solid #CCC;padding:.3em .8em 1em;-moz-transition:background-color 500ms ease 0s;background:none repeat scroll 0 0 #f8f8f8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#atnotes_container ul.atnotes-noteslist li.atnotes-elt:hover,#atnotes_container ul.atnotes-noteslist li.atnotes-elt.active{background:none repeat scroll 0 0 #eee}#atnotes_container ul.atnotes-noteslist li.atnotes-elt:hover div{cursor:pointer}#atnotes_container ul.atnotes-noteslist li.atnotes-elt div.atnotes-elt-title{font-weight:bold;white-space:pre-wrap;width:18.4em}#atnotes_container ul.atnotes-noteslist li.atnotes-elt div.atnotes-elt-state{float:left;width:10em;font-style:italic;color:#AAA}#atnotes_container ul.atnotes-noteslist li.atnotes-elt div.atnotes-elt-date{color:#999;float:right;width:7em;text-align:right}#atnotes_container ul.atnotes-noteslist li.atnotes-elt div.atnotes-elt-prerender{display:none}#atnotes_container div.atnotes-notesedit{left:20em;position:absolute;top:2.9em}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-states{box-shadow:0 4px 7px #AAA}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-states div.atnotes-saved{float:right}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title,#atnotes_container div.atnotes-notesedit div.anotes-notesedit-states{padding:.5em 2em;background-color:#FFF;border-bottom:1px solid #CCC;height:1.8em;z-index:1;min-width:350px}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-states{padding:.5em 2em .5em 22em}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title input#note_title{box-shadow:none;background:0;-moz-border-radius:0;-webkit-border-radius:0;padding:0;margin:0;border:0 none}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title div.atnotes-actions-btns{float:right;margin-top:.5em}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title div.atnotes-actions-btns img{cursor:pointer}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title div.atnotes-actions-btns img.atnotes-actions-list{margin-right:1em}#atnotes_container div.atnotes-notesedit div.anotes-notesedit-title div.atnotes-actions-btns div.atnotes-actions-ddmenu{display:none}#atnotes_container div.jqte{left:20em;position:absolute;top:5.8em;border:0 none;resize:none;min-width:350px}#save_dialog div.atnotes-explorer{background-color:#FFF;border:1px solid #AAA;height:100%;width:100%;overflow-x:auto;overflow-y:visible}#save_dialog div.atnotes-explorer table{width:100%}#save_dialog div.atnotes-explorer table tr td.filename{width:70%;background-position:0 .1em;background-repeat:no-repeat;padding-left:1.7em;cursor:pointer}#save_dialog div.atnotes-explorer table tr td.filename span{cursor:pointer}#save_dialog div.atnotes-explorer table tr td.filesize{width:10%;text-align:center}#save_dialog div.atnotes-explorer table tr td.date{width:20%;text-align:center}.ui-tooltip-content ul li:hover{color:#AAA;background-color:#1a1a1a} diff --git a/apps/atnotes/css/jquery-te-1.0.3.min.css b/apps/atnotes/css/jquery-te-1.0.3.min.css new file mode 100644 index 00000000000..b60e50b1590 --- /dev/null +++ b/apps/atnotes/css/jquery-te-1.0.3.min.css @@ -0,0 +1,11 @@ +/*!
+ * http://jqueryte.com
+ * jQuery Text Editor 1.0.2
+ * Copyright (C) 2012, Fatih Koca (fatihkoca@me.com), AUTHOR.txt (http://jqueryte.com/about)
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+*/
+
+.jqte{overflow:hidden}.jqte *{font-family:Arial,Helvetica,sans-serif;font-size:14px;color:#333}.jqte_Panel{height:25px;padding:5px 8px}.jqte_Panel a{display:block;float:left;width:22px;height:22px;border:#FFF 1px solid;text-align:center;background:url('/apps/atnotes/img/jquery-te-toolbar.png') no-repeat;font-weight:bold;cursor:pointer;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.jqte_Panel a.bold{background-position:0 0}.jqte_Panel a.italic{background-position:-22px 0}.jqte_Panel a.underline{background-position:-44px 0}.jqte_Panel a.orderedlist{background-position:-66px 0}.jqte_Panel a.unorderedlist{background-position:-88px 0}.jqte_Panel a.subscript{background-position:-110px 0}.jqte_Panel a.superscript{background-position:-132px 0}.jqte_Panel a.strike{background-position:-154px 0}.jqte_Panel a.remove{background-position:-176px 0}.jqte_Panel a.rule{background-position:-198px 0}.jqte_Panel a:hover,.jqte_Active{border:#CCC 1px solid!important;box-shadow:inset 0 0 2px #999;background-color:#FFF}.jqte_Panel a:active,.jqte_Active{background-color:#DDD!important}.jqte_Content{overflow-y:auto;position:absolute;top:3.3em;left:.7em;padding-right:.3em}.jqte_Content div,.jqte_Content p{margin:7px 0}.jqte_Content ul{list-style-type:disc}.jqte_Content ol{list-style-type:decimal}.jqte_Content ol,.jqte_Content ul{list-style-position:inside}
\ No newline at end of file diff --git a/apps/atnotes/css/jquery.qtip.min.css b/apps/atnotes/css/jquery.qtip.min.css new file mode 100644 index 00000000000..3f5e39adc73 --- /dev/null +++ b/apps/atnotes/css/jquery.qtip.min.css @@ -0,0 +1 @@ +.ui-tooltip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;border-width:1px;border-style:solid;}.ui-tooltip-fluid{display:block;visibility:hidden;position:static!important;float:left!important;}.ui-tooltip-content{position:relative;padding:5px 9px;overflow:hidden;text-align:left;word-wrap:break-word;overflow:hidden;}.ui-tooltip-titlebar{position:relative;min-height:14px;padding:5px 35px 5px 10px;overflow:hidden;border-width:0 0 1px;font-weight:bold;}.ui-tooltip-titlebar+.ui-tooltip-content{border-top-width:0!important;}/*!Default close button class */ .ui-tooltip-titlebar .ui-state-default{position:absolute;right:4px;top:50%;margin-top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;}* html .ui-tooltip-titlebar .ui-state-default{top:16px;}.ui-tooltip-titlebar .ui-icon,.ui-tooltip-icon .ui-icon{display:block;text-indent:-1000em;}.ui-tooltip-icon,.ui-tooltip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.ui-tooltip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em;}/*!Default tooltip style */ .ui-tooltip-default{border-color:#F1D031;background-color:#FFFFA3;color:#555;}.ui-tooltip-default .ui-tooltip-titlebar{background-color:#FFEF93;}.ui-tooltip-default .ui-tooltip-icon{border-color:#CCC;background:#F1F1F1;color:#777;}.ui-tooltip-default .ui-tooltip-titlebar .ui-state-hover{border-color:#AAA;color:#111;}/*!Light tooltip style */ .ui-tooltip-light{background-color:white;border-color:#E2E2E2;color:#454545;}.ui-tooltip-light .ui-tooltip-titlebar{background-color:#f1f1f1;}/*!Dark tooltip style */ .ui-tooltip-dark{background-color:#505050;border-color:#303030;color:#f3f3f3;}.ui-tooltip-dark .ui-tooltip-titlebar{background-color:#404040;}.ui-tooltip-dark .ui-tooltip-icon{border-color:#444;}.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}/*!Cream tooltip style */ .ui-tooltip-cream{background-color:#FBF7AA;border-color:#F9E98E;color:#A27D35;}.ui-tooltip-cream .ui-tooltip-titlebar{background-color:#F0DE7D;}.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{background-position:-82px 0;}/*!Red tooltip style */ .ui-tooltip-red{background-color:#F78B83;border-color:#D95252;color:#912323;}.ui-tooltip-red .ui-tooltip-titlebar{background-color:#F06D65;}.ui-tooltip-red .ui-state-default .ui-tooltip-icon{background-position:-102px 0;}.ui-tooltip-red .ui-tooltip-icon{border-color:#D95252;}.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{border-color:#D95252;}/*!Green tooltip style */ .ui-tooltip-green{background-color:#CAED9E;border-color:#90D93F;color:#3F6219;}.ui-tooltip-green .ui-tooltip-titlebar{background-color:#B0DE78;}.ui-tooltip-green .ui-state-default .ui-tooltip-icon{background-position:-42px 0;}/*!Blue tooltip style */ .ui-tooltip-blue{background-color:#E5F6FE;border-color:#ADD9ED;color:#5E99BD;}.ui-tooltip-blue .ui-tooltip-titlebar{background-color:#D0E9F5;}.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{background-position:-2px 0;}/*!Add shadows to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE6+,Safari 2+*/ .ui-tooltip-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);}.ui-tooltip-shadow .ui-tooltip-titlebar,.ui-tooltip-shadow .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3);-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3)";_margin-bottom:-3px;.margin-bottom:-3px;}/*!Add rounded corners to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE9+,Safari 2+*/ .ui-tooltip-rounded,.ui-tooltip-tipsy,.ui-tooltip-youtube,.ui-tooltip-youtube>div,.ui-tooltip-bootstrap{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}/*!Youtube tooltip style */ .ui-tooltip-youtube{-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;color:white;border-color:#CCC;background:transparent;background:rgba(0,0,0,0.85);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";}.ui-tooltip-youtube .ui-tooltip-titlebar{background-color:transparent;}.ui-tooltip-youtube .ui-tooltip-icon{border-color:#222;}.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-jtools{background:#232323;background:rgba(0,0,0,0.7);background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333;}.ui-tooltip-jtools .ui-tooltip-titlebar{background-color:transparent;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";}.ui-tooltip-jtools .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";}.ui-tooltip-jtools .ui-tooltip-titlebar,.ui-tooltip-jtools .ui-tooltip-content{background:transparent;color:white;border:0 dashed transparent;}.ui-tooltip-jtools .ui-tooltip-icon{border-color:#555;}.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{border-color:#333;}.ui-tooltip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,0.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,0.4);box-shadow:4px 4px 5px rgba(0,0,0,0.4);background-color:#D9D9C2;color:#111;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-titlebar{background-color:#87876A;color:white;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-icon{border-color:#808064;}.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{border-color:#696952;color:#696952;}.ui-tooltip-tipsy{background:black;background:rgba(0,0,0,.87);color:white;border:0 solid transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:bold;line-height:16px;text-shadow:0 1px black;}.ui-tooltip-tipsy .ui-tooltip-titlebar{padding:6px 35px 0 10;background-color:transparent;}.ui-tooltip-tipsy .ui-tooltip-content{padding:6px 10;}.ui-tooltip-tipsy .ui-tooltip-icon{border-color:#222;text-shadow:none;}.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-tipped{border:3px solid #959FA9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-color:#F9F9F9;color:#454545;font-weight:normal;font-family:serif;}.ui-tooltip-tipped .ui-tooltip-titlebar{border-bottom-width:0;color:white;background:#3A79B8;background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";}.ui-tooltip-tipped .ui-tooltip-icon{border:2px solid #285589;background:#285589;}.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{background-color:#FBFBFB;color:#555;}.ui-tooltip-bootstrap{font-size:13px;line-height:18px;color:#333;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.ui-tooltip-bootstrap .ui-tooltip-titlebar{font-size:18px;line-height:22px;border-bottom:1px solid #ccc;background-color:transparent;}.ui-tooltip-bootstrap .ui-tooltip-titlebar .ui-state-default{right:9px;top:49%;border-style:none;}.ui-tooltip-bootstrap .ui-tooltip-icon{background:white;}.ui-tooltip-bootstrap .ui-tooltip-icon .ui-icon{width:auto;height:auto;float:right;font-size:20px;font-weight:bold;line-height:18px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20);}.ui-tooltip-bootstrap .ui-tooltip-icon .ui-icon:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40);}.ui-tooltip:not(.ie9haxors) div.ui-tooltip-content,.ui-tooltip:not(.ie9haxors) div.ui-tooltip-titlebar{filter:none;-ms-filter:none;}
\ No newline at end of file diff --git a/apps/atnotes/img/action.png b/apps/atnotes/img/action.png Binary files differnew file mode 100644 index 00000000000..5b24257a0e7 --- /dev/null +++ b/apps/atnotes/img/action.png diff --git a/apps/atnotes/img/icon.png b/apps/atnotes/img/icon.png Binary files differnew file mode 100644 index 00000000000..cce8f39255e --- /dev/null +++ b/apps/atnotes/img/icon.png diff --git a/apps/atnotes/img/jquery-te-toolbar.png b/apps/atnotes/img/jquery-te-toolbar.png Binary files differnew file mode 100644 index 00000000000..a330302d9f1 --- /dev/null +++ b/apps/atnotes/img/jquery-te-toolbar.png diff --git a/apps/atnotes/img/save.png b/apps/atnotes/img/save.png Binary files differnew file mode 100644 index 00000000000..49581985227 --- /dev/null +++ b/apps/atnotes/img/save.png diff --git a/apps/atnotes/js/atnotes.min.js b/apps/atnotes/js/atnotes.min.js new file mode 100644 index 00000000000..007c53c6fdc --- /dev/null +++ b/apps/atnotes/js/atnotes.min.js @@ -0,0 +1,22 @@ +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +function atnotes(){if(typeof atnotes.initialized=="undefined"){atnotes.prototype.A=function(c,g){if(c.val().length!=0){if(c.attr("rel")==0){if($("ul.atnotes-noteslist li.atnotes-elt.active").length!=0){$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-title").html(c.val());$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-prerender").html(g.html())}else{this.N(1)}}else{$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-title").html(c.val());$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-state").html("Unsaved");$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-date").html(this.B());$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-prerender").html(g.html())}$(window).bind("beforeunload",function(){return false})}};atnotes.prototype.B=function(){var j=new Date(),k,b,c;k=j.getDate();if(k<10){k="0"+k}b=parseInt(j.getMonth()+1);if(b<10){b="0"+b}c=j.getFullYear();j=b+"/"+k+"/"+c;return j};atnotes.prototype.C=function(g,e){if(e.val().length==0){e.val("Untitled note")}this.A(e,g)};atnotes.prototype.D=function(){d=$(".atnotes-elt.active");a=this;if(parseInt(d.attr("rel"))>0){$.ajax({type:"POST",dataType:"json",url:OC.linkTo("atnotes","ajax/delete.php"),data:{i:parseInt(d.attr("rel"))},async:false,success:function(c){if(c.e==0){a.E(d,1)}}})}else{a.E(d,1)}};atnotes.prototype.E=function(g,e){if(e==1){g.remove()}$("#note_title").val("");$("#note_title").attr("rel","0");$("#note_path").val("");$(".jqte_Content").html("");$("#note_title").focus()};atnotes.prototype.F=function(c,g){if(c.val().length==0){c.val("Untitled note");this.A($("#note_title"),g)}$.ajax({type:"POST",dataType:"json",url:OC.linkTo("atnotes","ajax/save.php"),data:{i:c.attr("rel"),t:c.val(),c:g.html()},async:false,error:function(b){alert(b.responseText)},success:function(b){if(!b.e){$("ul.atnotes-noteslist li.atnotes-elt.active div.atnotes-elt-state").empty();$("ul.atnotes-noteslist li.atnotes-elt.active").attr("rel",b.i);$("ul.atnotes-noteslist li.atnotes-elt.active").removeClass("unsaved");c.attr("rel",b.i);$(".atnotes-saved").empty().fadeIn(400);$(".atnotes-saved").css("color","#009700");$(".atnotes-saved").html("Saved !").delay(1000).fadeOut(400);if($("ul.atnotes-noteslist li.atnotes-elt.unsaved").length==0){$(window).unbind("beforeunload")}}}})};atnotes.prototype.G=function(i,c,h){if(h.html().length==0){$(".atnotes-saved").empty().fadeIn(400);$(".atnotes-saved").css("color","#990000");$(".atnotes-saved").html("File not exported: empty content ...").delay(1000).fadeOut(400)}else{$.ajax({type:"POST",dataType:"json",url:OC.linkTo("atnotes","ajax/check.php"),data:{p:i.val(),t:c.val()},async:false,success:function(b){f=true;if(b.e){if(!confirm("The file already exists. Are you sure to override it ?")){f=false}}if(f){$.ajax({type:"POST",dataType:"json",url:OC.linkTo("atnotes","ajax/export.php"),data:{p:b.p,t:c.val(),c:h.html()},async:false,success:function(e){$("#save_dialog").dialog("close")}})}}})}};atnotes.prototype.H=function(c,b){c.css("height",$("#content").height()-b+"px")};atnotes.prototype.I=function(e,g){if(typeof g=="undefined"){g="/"}a=this;e=e.find("div.atnotes-explorer table");$.ajax({type:"POST",dataType:"json",url:OC.linkTo("atnotes","ajax/browse.php"),data:{p:g},async:false,success:function(b){e.empty();$.each(b,function(c,i){e.append(i)});t=e.find("td.filename");t.click(function(c){var i=this;setTimeout(function(){var h=parseInt($(this).data("double"),10);if(h>0){$(this).data("double",h-1)}else{$("#note_path").val($(this).attr("data-rel"))}},300)}).dblclick(function(c){$(this).data("double",2);$("#note_path").val($(this).attr("data-rel"));a.I($("#save_dialog"),$(this).attr("data-rel"))})}})};atnotes.prototype.J=function(c){if(c.val().length==0){c.val("Untitled note")}$("#save_dialog").dialog("open")};atnotes.prototype.K=function(i,c,h){c.val(i.find("div.atnotes-elt-title").text());c.attr("rel",i.attr("rel"));h.html(i.find("div.atnotes-elt-prerender").html())};atnotes.prototype.N=function(c){$(".active").removeClass("active");if(c==1){$("ul.atnotes-noteslist").prepend('<li class="atnotes-elt active unsaved" rel="0"><div class="atnotes-elt-title">'+$("#note_title").val()+'</div><div class="atnotes-elt-state">Unsaved</div><div class="atnotes-elt-date">'+this.B()+'</div><div class="atnotes-elt-prerender">'+$(".jqte_Content").html()+"</div></li>")}else{$("ul.atnotes-noteslist").prepend('<li class="atnotes-elt active unsaved" rel="0"><div class="atnotes-elt-title">New note</div><div class="atnotes-elt-state">Unsaved</div><div class="atnotes-elt-date">'+this.B()+'</div><div class="atnotes-elt-prerender"></div></li>');this.E(0,0)}$("ul.atnotes-noteslist li.atnotes-elt.active").bind("click",function(){$(".active").removeClass("active");$(this).addClass("active");A.K($(this),$("#note_title"),$(".jqte_Content"))});$(window).bind("beforeunload",function(){return false})};atnotes.prototype.W=function(c,b){c.css("width",$("#content").width()-$(".atnotes-noteslist").width()-b+"px")}}}$(document).ready(function(){A=new atnotes();$(".atnotes-editor").jqte();$(window).resize(function(){A.H($(".atnotes-noteslist"),36);A.W($(".atnotes-notesedit"),0);A.H($(".jqte"),75);A.W($(".jqte"),0);A.H($(".jqte_Content"),122);A.W($(".jqte_Content"),0);$("#note_title").css("width",$(".anotes-notesedit-title").width()-70+"px")});$(window).trigger("resize");$("#save_dialog").dialog({autoOpen:false,height:300,width:550,modal:true,resizable:false,buttons:{Cancel:function(){$("#save_dialog").dialog("close")},Ok:function(){if($("#note_path").val().length==0){$("#note_path").val("/")}A.G($("#note_path"),$("#note_title"),$(".jqte_Content"))}},open:function(g,e){A.I($(this))}});$("#note_title").change(function(){A.A($(this),$(".jqte_Content"))});$("#note_title").keyup(function(){$(this).change()});$(".jqte_Content").keyup(function(){A.C($(this),$("#note_title"))});$(".atnotes-actions-btns img.atnotes-save").bind("click",function(){A.F($("#note_title"),$(".jqte_Content"))});$(".atnotes-elt").bind("click",function(){$(".active").removeClass("active");$(this).addClass("active");A.K($(this),$("#note_title"),$(".jqte_Content"))});$(".atnotes-actions-list").qtip({prerender:true,overwrite:false,content:{text:$(".atnotes-actions-ddmenu").html()},position:{my:"top right",at:"bottom right"},events:{show:function(g,e){$(".atnotes-delete").bind("click",function(){A.D()});$(".atnotes-new").bind("click",function(){A.N(0)})},hide:function(g,e){$(".atnotes-delete").unbind("click");$(".atnotes-new").unbind("click")}},hide:{delay:100,event:"unfocus mouseleave",fixed:true},style:{classes:"ui-tooltip-shadow ui-tooltip-rounded ui-tooltip-youtube",tip:false,width:150}});$("#note_title").focus()});
\ No newline at end of file diff --git a/apps/atnotes/js/jquery-te-1.0.3.min.js b/apps/atnotes/js/jquery-te-1.0.3.min.js new file mode 100644 index 00000000000..b94db89e8ef --- /dev/null +++ b/apps/atnotes/js/jquery-te-1.0.3.min.js @@ -0,0 +1,10 @@ +/*!
+ * http://jqueryte.com
+ * jQuery TE 1.0.3
+ * Copyright (C) 2012, Fatih Koca (fatihkoca@me.com), AUTHOR.txt (http://jqueryte.com/about)
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+*/
+(function(a){a.fn.jqte=function(b){var c=a.extend({css:"jqte",b:true,i:true,u:true,ol:true,ul:true,sub:true,sup:true,strike:true,remove:true,rule:true},b);var d=a.extend({b:{cls:"bold",command:"Bold",key:"B",tags:["b","strong"]},i:{cls:"italic",command:"Italic",key:"I",tags:["i","em"]},u:{cls:"underline",command:"Underline",key:"U",tags:["u"]},ol:{cls:"orderedlist",command:"insertorderedlist",key:"O",tags:["ol"]},ul:{cls:"unorderedlist",command:"insertunorderedlist",key:"F",tags:["ul"]},sub:{cls:"subscript",command:"subscript",key:"(",tags:["sub"]},sup:{cls:"superscript",command:"superscript",key:"&",tags:["sup"]},strike:{cls:"strike",command:"strikeThrough",key:"S",tags:["strike"]},remove:{cls:"remove",command:"removeformat",key:".",css:false},hr:{cls:"rule",command:"inserthorizontalrule",key:"H",tags:["hr"]}},b);return this.each(function(){function i(a){var b,c,d=navigator.userAgent.toLowerCase();if(window.getSelection){c=window.getSelection();if(c.getRangeAt){b=c.getRangeAt(0)}if(b){c.removeAllRanges();c.addRange(b)}if(!d.match(/msie/))document.execCommand("StyleWithCSS",false,false);document.execCommand(a,false,null)}else if(document.selection&&document.selection.createRange&&document.selection.type!="None"){b=document.selection.createRange();b.execCommand(a,false,null)}}function k(b,c){var d=false,e=j(),f,g;a.each(b,function(b,c){f=e.prop("tagName").toLowerCase();g=e.attr("style");if(f==c)d=true;else{e.parents().each(function(){f=a(this).prop("tagName").toLowerCase();if(f==c)d=true})}});return d}function l(b){if(c.b)k(d.b.tags,d.b.css)?f.find("."+d.b.cls).addClass(h):a("."+d.b.cls).removeClass(h);if(c.i)k(d.i.tags,d.i.css)?f.find("."+d.i.cls).addClass(h):a("."+d.i.cls).removeClass(h);if(c.u)k(d.u.tags,d.u.css)?f.find("."+d.u.cls).addClass(h):a("."+d.u.cls).removeClass(h);if(c.ol)k(d.ol.tags,d.ol.css)?f.find("."+d.ol.cls).addClass(h):a("."+d.ol.cls).removeClass(h);if(c.ul)k(d.ul.tags,d.ul.css)?f.find("."+d.ul.cls).addClass(h):a("."+d.ul.cls).removeClass(h);if(c.sub)k(d.sub.tags,d.sub.css)?f.find("."+d.sub.cls).addClass(h):a("."+d.sub.cls).removeClass(h);if(c.sup)k(d.sup.tags,d.sup.css)?f.find("."+d.sup.cls).addClass(h):a("."+d.sup.cls).removeClass(h);if(c.strike)k(d.strike.tags,d.strike.css)?f.find("."+d.strike.cls).addClass(h):a("."+d.strike.cls).removeClass(h)}function m(){var a=g.html().replace(/<p><\/p>/g,"").replace(/ /g," ").replace(/<p> <\/p>/g,""),c,d;c=[/\<div>(.*?)\<\/div>/ig,/\<br>(.*?)\<br>/ig,/\<br\/>(.*?)\<br\/>/ig,/\<strong>(.*?)\<\/strong>/ig,/\<em>(.*?)\<\/em>/ig];d=["<p>$1</p>","<p>$1</p>","<p>$1</p>","<b>$1</b>","<i>$1</i>"];for(var e=0;e<c.length;e++){a=a.replace(c[e],d[e])}b.val(g.html())}var b=a(this);b.hide().before('<div class="'+c.css+'" ></div>');var e=b.prev("."+c.css);e.html('<div class="'+c.css+"_Panel"+'" unselectable="on"></div> <div class="'+c.css+"_Content"+'" contenteditable="true"></div>');var f=e.find("."+c.css+"_Panel");var g=e.find("."+c.css+"_Content");var h=c.css+"_Active";g.html(b.val());f.bind("selectstart mousedown",function(a){a.preventDefault()});if(c.b)f.append('<a class="'+d.b.cls+'" toggletag="'+d.b.command+'" unselectable="on"></a>');if(c.i)f.append('<a class="'+d.i.cls+'" toggletag="'+d.i.command+'" unselectable="on"></a>');if(c.u)f.append('<a class="'+d.u.cls+'" toggletag="'+d.u.command+'" unselectable="on"></a>');if(c.ol)f.append('<a class="'+d.ol.cls+'" toggletag="'+d.ol.command+'" unselectable="on"></a>');if(c.ul)f.append('<a class="'+d.ul.cls+'" toggletag="'+d.ul.command+'" unselectable="on"></a>');if(c.sub)f.append('<a class="'+d.sub.cls+'" toggletag="'+d.sub.command+'" unselectable="on"></a>');if(c.sup)f.append('<a class="'+d.sup.cls+'" toggletag="'+d.sup.command+'" unselectable="on"></a>');if(c.strike)f.append('<a class="'+d.strike.cls+'" toggletag="'+d.strike.command+'" unselectable="on"></a>');if(c.remove)f.append('<a class="'+d.remove.cls+'" toggletag="'+d.remove.command+'" unselectable="on"></a>');if(c.rule)f.append('<a class="'+d.hr.cls+'" toggletag="'+d.hr.command+'" unselectable="on"></a>');g.focusout(function(){f.find("a").removeClass(h)});var j=function(){var b,c;if(window.getSelection){c=getSelection();b=c.anchorNode}if(!b&&document.selection){c=document.selection;var d=c.getRangeAt?c.getRangeAt(0):c.createRange();b=d.commonAncestorContainer?d.commonAncestorContainer:d.parentElement?d.parentElement():d.item(0)}if(b){return b.nodeName=="#text"?a(b.parentNode):a(b)}};g.bind("mouseup keyup",l);f.find("a").click(function(){$('.jqte_Content').focus();i(a(this).attr("toggletag"));m();a(this).hasClass(h)||a(this).is("[toggletag="+d.remove.command+"]")||a(this).is("[toggletag="+d.hr.command+"]")?a(this).removeClass(h):a(this).addClass(h)});a.ctrl=function(a,b,c){var d=false;g.keydown(function(e){if(!c)c=[];if(e.ctrlKey)d=true;if(e.keyCode==a.charCodeAt(0)&&d){b.apply(this,c);return false}}).keyup(function(a){if(a.ctrlKey)d=false})};a.ctrl(d.b.key,function(){i(d.b.command)});a.ctrl(d.i.key,function(){i(d.i.command)});a.ctrl(d.u.key,function(){i(d.u.command)});a.ctrl(d.ol.key,function(){i(d.ol.command)});a.ctrl(d.ul.key,function(){i(d.ul.command)});a.ctrl(d.sub.key,function(){i(d.sub.command)});a.ctrl(d.sup.key,function(){i(d.sup.command)});a.ctrl(d.strike.key,function(){i(d.strike.command)});a.ctrl(d.remove.key,function(){i(d.remove.command)});a.ctrl(d.hr.key,function(){i(d.hr.command)});g.bind("keypress keyup keydown drop",function(){setTimeout(m,0)})})}})(jQuery)
\ No newline at end of file diff --git a/apps/atnotes/js/jquery.qtip.min.js b/apps/atnotes/js/jquery.qtip.min.js new file mode 100644 index 00000000000..5be4613f94b --- /dev/null +++ b/apps/atnotes/js/jquery.qtip.min.js @@ -0,0 +1,13 @@ +/* +* qTip2 - Pretty powerful tooltips +* http://craigsworks.com/projects/qtip2/ +* +* Version: nightly +* Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com +* +* Dual licensed under MIT or GPLv2 licenses +* http://en.wikipedia.org/wiki/MIT_License +* http://en.wikipedia.org/wiki/GNU_General_Public_License +* +* Date: Sun May 13 12:07:36.0000000000 2012 +*//*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true *//*global window: false, jQuery: false, console: false, define: false */(function(a){typeof define==="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){function y(e,h){var i,j,k,l,m,n=a(this),o=a(document.body),p=this===document?o:n,q=n.metadata?n.metadata(h.metadata):d,r=h.metadata.type==="html5"&&q?q[h.metadata.name]:d,s=n.data(h.metadata.name||"qtipopts");try{s=typeof s==="string"?(new Function("return "+s))():s}catch(u){v("Unable to parse HTML5 attribute data: "+s)}l=a.extend(b,{},f.defaults,h,typeof s==="object"?w(s):d,w(r||q)),j=l.position,l.id=e;if("boolean"===typeof l.content.text){k=n.attr(l.content.attr);if(l.content.attr!==c&&k)l.content.text=k;else{v("Unable to locate content for tooltip! Aborting render of tooltip on element: ",n);return c}}j.container.length||(j.container=o),j.target===c&&(j.target=p),l.show.target===c&&(l.show.target=p),l.show.solo===b&&(l.show.solo=j.container.closest("body")),l.hide.target===c&&(l.hide.target=p),l.position.viewport===b&&(l.position.viewport=j.container),j.container=j.container.eq(0),j.at=new g.Corner(j.at),j.my=new g.Corner(j.my);if(a.data(this,"qtip"))if(l.overwrite)n.qtip("destroy");else if(l.overwrite===c)return c;l.suppress&&(m=a.attr(this,"title"))&&a(this).removeAttr("title").attr(t,m),i=new x(n,l,e,!!k),a.data(this,"qtip",i),n.bind("remove.qtip-"+e+" removeqtip.qtip-"+e,function(){i.destroy()});return i}function x(r,s,v,x){function Q(){var b=[s.show.target[0],s.hide.target[0],y.rendered&&F.tooltip[0],s.position.container[0],s.position.viewport[0],window,document];y.rendered?a([]).pushStack(a.grep(b,function(a){return typeof a==="object"})).unbind(E):s.show.target.unbind(E+"-create")}function P(){function o(a){y.rendered&&D[0].offsetWidth>0&&y.reposition(a)}function n(a){if(D.hasClass(l))return c;clearTimeout(y.timers.inactive),y.timers.inactive=setTimeout(function(){y.hide(a)},s.hide.inactive)}function k(b){if(D.hasClass(l)||B||C)return c;var f=a(b.relatedTarget||b.target),g=f.closest(m)[0]===D[0],h=f[0]===e.show[0];clearTimeout(y.timers.show),clearTimeout(y.timers.hide);if(d.target==="mouse"&&g||s.hide.fixed&&(/mouse(out|leave|move)/.test(b.type)&&(g||h)))try{b.preventDefault(),b.stopImmediatePropagation()}catch(i){}else s.hide.delay>0?y.timers.hide=setTimeout(function(){y.hide(b)},s.hide.delay):y.hide(b)}function j(a){if(D.hasClass(l))return c;clearTimeout(y.timers.show),clearTimeout(y.timers.hide);var d=function(){y.toggle(b,a)};s.show.delay>0?y.timers.show=setTimeout(d,s.show.delay):d()}var d=s.position,e={show:s.show.target,hide:s.hide.target,viewport:a(d.viewport),document:a(document),body:a(document.body),window:a(window)},g={show:a.trim(""+s.show.event).split(" "),hide:a.trim(""+s.hide.event).split(" ")},i=a.browser.msie&&parseInt(a.browser.version,10)===6;D.bind("mouseenter"+E+" mouseleave"+E,function(a){var b=a.type==="mouseenter";b&&y.focus(a),D.toggleClass(p,b)}),s.hide.fixed&&(e.hide=e.hide.add(D),D.bind("mouseover"+E,function(){D.hasClass(l)||clearTimeout(y.timers.hide)})),/mouse(out|leave)/i.test(s.hide.event)?s.hide.leave==="window"&&e.window.bind("mouseout"+E+" blur"+E,function(a){/select|option/.test(a.target)&&!a.relatedTarget&&y.hide(a)}):/mouse(over|enter)/i.test(s.show.event)&&e.hide.bind("mouseleave"+E,function(a){clearTimeout(y.timers.show)}),(""+s.hide.event).indexOf("unfocus")>-1&&d.container.closest("html").bind("mousedown"+E,function(b){var c=a(b.target),d=y.rendered&&!D.hasClass(l)&&D[0].offsetWidth>0,e=c.parents(m).filter(D[0]).length>0;c[0]!==r[0]&&c[0]!==D[0]&&!e&&!r.has(c[0]).length&&!c.attr("disabled")&&y.hide(b)}),"number"===typeof s.hide.inactive&&(e.show.bind("qtip-"+v+"-inactive",n),a.each(f.inactiveEvents,function(a,b){e.hide.add(F.tooltip).bind(b+E+"-inactive",n)})),a.each(g.hide,function(b,c){var d=a.inArray(c,g.show),f=a(e.hide);d>-1&&f.add(e.show).length===f.length||c==="unfocus"?(e.show.bind(c+E,function(a){D[0].offsetWidth>0?k(a):j(a)}),delete g.show[d]):e.hide.bind(c+E,k)}),a.each(g.show,function(a,b){e.show.bind(b+E,j)}),"number"===typeof s.hide.distance&&e.show.add(D).bind("mousemove"+E,function(a){var b=G.origin||{},c=s.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&y.hide(a)}),d.target==="mouse"&&(e.show.bind("mousemove"+E,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),d.adjust.mouse&&(s.hide.event&&(D.bind("mouseleave"+E,function(a){(a.relatedTarget||a.target)!==e.show[0]&&y.hide(a)}),F.target.bind("mouseenter"+E+" mouseleave"+E,function(a){G.onTarget=a.type==="mouseenter"})),e.document.bind("mousemove"+E,function(a){y.rendered&&G.onTarget&&!D.hasClass(l)&&D[0].offsetWidth>0&&y.reposition(a||h)}))),(d.adjust.resize||e.viewport.length)&&(a.event.special.resize?e.viewport:e.window).bind("resize"+E,o),(e.viewport.length||i&&D.css("position")==="fixed")&&e.viewport.bind("scroll"+E,o)}function O(b,d){function g(b){function i(e){e&&(delete h[e.src],clearTimeout(y.timers.img[e.src]),a(e).unbind(E)),a.isEmptyObject(h)&&(y.redraw(),d!==c&&y.reposition(G.event),b())}var g,h={};if((g=f.find("img[src]:not([height]):not([width])")).length===0)return i();g.each(function(b,c){if(h[c.src]===e){var d=0,f=3;(function g(){if(c.height||c.width||d>f)return i(c);d+=1,y.timers.img[c.src]=setTimeout(g,700)})(),a(c).bind("error"+E+" load"+E,function(){i(this)}),h[c.src]=c}})}var f=F.content;if(!y.rendered||!b)return c;a.isFunction(b)&&(b=b.call(r,G.event,y)||""),b.jquery&&b.length>0?f.empty().append(b.css({display:"block"})):f.html(b),y.rendered<0?D.queue("fx",g):(C=0,g(a.noop));return y}function N(b,d){var e=F.title;if(!y.rendered||!b)return c;a.isFunction(b)&&(b=b.call(r,G.event,y));if(b===c||!b&&b!=="")return J(c);b.jquery&&b.length>0?e.empty().append(b.css({display:"block"})):e.html(b),y.redraw(),d!==c&&y.rendered&&D[0].offsetWidth>0&&y.reposition(G.event)}function M(a){var b=F.button,d=F.title;if(!y.rendered)return c;a?(d||L(),K()):b.remove()}function L(){var c=A+"-title";F.titlebar&&J(),F.titlebar=a("<div />",{"class":j+"-titlebar "+(s.style.widget?"ui-widget-header":"")}).append(F.title=a("<div />",{id:c,"class":j+"-title","aria-atomic":b})).insertBefore(F.content).delegate(".ui-tooltip-close","mousedown keydown mouseup keyup mouseout",function(b){a(this).toggleClass("ui-state-active ui-state-focus",b.type.substr(-4)==="down")}).delegate(".ui-tooltip-close","mouseover mouseout",function(b){a(this).toggleClass("ui-state-hover",b.type==="mouseover")}),s.content.title.button?K():y.rendered&&y.redraw()}function K(){var b=s.content.title.button,d=typeof b==="string",e=d?b:"Close tooltip";F.button&&F.button.remove(),b.jquery?F.button=b:F.button=a("<a />",{"class":"ui-state-default ui-tooltip-close "+(s.style.widget?"":j+"-icon"),title:e,"aria-label":e}).prepend(a("<span />",{"class":"ui-icon ui-icon-close",html:"×"})),F.button.appendTo(F.titlebar).attr("role","button").click(function(a){D.hasClass(l)||y.hide(a);return c}),y.redraw()}function J(a){F.title&&(F.titlebar.remove(),F.titlebar=F.title=F.button=d,a!==c&&y.reposition())}function I(){var a=s.style.widget;D.toggleClass(k,a).toggleClass(n,s.style.def&&!a),F.content.toggleClass(k+"-content",a),F.titlebar&&F.titlebar.toggleClass(k+"-header",a),F.button&&F.button.toggleClass(j+"-icon",!a)}function H(a){var b=0,c,d=s,e=a.split(".");while(d=d[e[b++]])b<e.length&&(c=d);return[c||s,e.pop()]}var y=this,z=document.body,A=j+"-"+v,B=0,C=0,D=a(),E=".qtip-"+v,F,G;y.id=v,y.destroyed=y.rendered=c,y.elements=F={target:r},y.timers={img:{}},y.options=s,y.checks={},y.plugins={},y.cache=G={event:{},target:a(),disabled:c,attr:x,onTarget:c},y.checks.builtin={"^id$":function(d,e,g){var h=g===b?f.nextid:g,i=j+"-"+h;h!==c&&h.length>0&&!a("#"+i).length&&(D[0].id=i,F.content[0].id=i+"-content",F.title[0].id=i+"-title")},"^content.text$":function(a,b,c){O(c)},"^content.title.text$":function(a,b,c){if(!c)return J();!F.title&&c&&L(),N(c)},"^content.title.button$":function(a,b,c){M(c)},"^position.(my|at)$":function(a,b,c){"string"===typeof c&&(a[b]=new g.Corner(c))},"^position.container$":function(a,b,c){y.rendered&&D.appendTo(c)},"^show.ready$":function(){y.rendered?y.toggle(b):y.render(1)},"^style.classes$":function(a,b,c){D.attr("class",j+" qtip ui-helper-reset "+c)},"^style.widget|content.title":I,"^events.(render|show|move|hide|focus|blur)$":function(b,c,d){D[(a.isFunction(d)?"":"un")+"bind"]("tooltip"+c,d)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var a=s.position;D.attr("tracking",a.target==="mouse"&&a.adjust.mouse),Q(),P()}},a.extend(y,{render:function(d){if(y.rendered)return y;var e=s.content.text,f=s.content.title.text,h=s.position,i=a.Event("tooltiprender");a.attr(r[0],"aria-describedby",A),D=F.tooltip=a("<div/>",{id:A,"class":j+" qtip ui-helper-reset "+n+" "+s.style.classes+" "+j+"-pos-"+s.position.my.abbrev(),width:s.style.width||"",height:s.style.height||"",tracking:h.target==="mouse"&&h.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":c,"aria-describedby":A+"-content","aria-hidden":b}).toggleClass(l,G.disabled).data("qtip",y).appendTo(s.position.container).append(F.content=a("<div />",{"class":j+"-content",id:A+"-content","aria-atomic":b})),y.rendered=-1,B=C=1,f&&(L(),a.isFunction(f)||N(f,c)),a.isFunction(e)||O(e,c),y.rendered=b,I(),a.each(s.events,function(b,c){a.isFunction(c)&&D.bind(b==="toggle"?"tooltipshow tooltiphide":"tooltip"+b,c)}),a.each(g,function(){this.initialize==="render"&&this(y)}),P(),D.queue("fx",function(a){i.originalEvent=G.event,D.trigger(i,[y]),B=C=0,y.redraw(),(s.show.ready||d)&&y.toggle(b,G.event,c),a()});return y},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:D.outerHeight(),width:D.outerWidth()};break;case"offset":b=g.offset(D,s.position.container);break;default:c=H(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(e,f){function m(a,b){var c,d,e;for(c in k)for(d in k[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),k[c][d].apply(y,b)}var g=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,i=c,j=c,k=y.checks,l;"string"===typeof e?(l=e,e={},e[l]=f):e=a.extend(b,{},e),a.each(e,function(b,c){var d=H(b.toLowerCase()),f;f=d[0][d[1]],d[0][d[1]]="object"===typeof c&&c.nodeType?a(c):c,e[b]=[d[0],d[1],c,f],i=g.test(b)||i,j=h.test(b)||j}),w(s),B=C=1,a.each(e,m),B=C=0,y.rendered&&D[0].offsetWidth>0&&(i&&y.reposition(s.position.target==="mouse"?d:G.event),j&&y.redraw());return y},toggle:function(e,f){function t(){e?(a.browser.msie&&D[0].style.removeAttribute("filter"),D.css("overflow",""),"string"===typeof i.autofocus&&a(i.autofocus,D).focus(),i.target.trigger("qtip-"+v+"-inactive")):D.css({display:"",visibility:"",opacity:"",left:"",top:""}),r=a.Event("tooltip"+(e?"visible":"hidden")),r.originalEvent=f?G.event:d,D.trigger(r,[y])}if(!y.rendered)return e?y.render(1):y;var g=e?"show":"hide",i=s[g],j=s[e?"hide":"show"],k=s.position,l=s.content,n=D[0].offsetWidth>0,o=e||i.target.length===1,p=!f||i.target.length<2||G.target[0]===f.target,q,r;(typeof e).search("boolean|number")&&(e=!n);if(!D.is(":animated")&&n===e&&p)return y;if(f){if(/over|enter/.test(f.type)&&/out|leave/.test(G.event.type)&&s.show.target.add(f.target).length===s.show.target.length&&D.has(f.relatedTarget).length)return y;G.event=a.extend({},f)}r=a.Event("tooltip"+g),r.originalEvent=f?G.event:d,D.trigger(r,[y,90]);if(r.isDefaultPrevented())return y;a.attr(D[0],"aria-hidden",!e),e?(G.origin=a.extend({},h),y.focus(f),a.isFunction(l.text)&&O(l.text,c),a.isFunction(l.title.text)&&N(l.title.text,c),!u&&k.target==="mouse"&&k.adjust.mouse&&(a(document).bind("mousemove.qtip",function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),u=b),y.reposition(f,arguments[2]),(r.solo=!!i.solo)&&a(m,i.solo).not(D).qtip("hide",r)):(clearTimeout(y.timers.show),delete G.origin,u&&!a(m+'[tracking="true"]:visible',i.solo).not(D).length&&(a(document).unbind("mousemove.qtip"),u=c),y.blur(f)),i.effect===c||o===c?(D[g](),t.call(D)):a.isFunction(i.effect)?(D.stop(1,1),i.effect.call(D,y),D.queue("fx",function(a){t(),a()})):D.fadeTo(90,e?1:0,t),e&&i.target.trigger("qtip-"+v+"-inactive");return y},show:function(a){return y.toggle(b,a)},hide:function(a){return y.toggle(c,a)},focus:function(b){if(!y.rendered)return y;var c=a(m),d=parseInt(D[0].style.zIndex,10),e=f.zindex+c.length,g=a.extend({},b),h,i;D.hasClass(o)||(i=a.Event("tooltipfocus"),i.originalEvent=g,D.trigger(i,[y,e]),i.isDefaultPrevented()||(d!==e&&(c.each(function(){this.style.zIndex>d&&(this.style.zIndex=this.style.zIndex-1)}),c.filter("."+o).qtip("blur",g)),D.addClass(o)[0].style.zIndex=e));return y},blur:function(b){var c=a.extend({},b),d;D.removeClass(o),d=a.Event("tooltipblur"),d.originalEvent=c,D.trigger(d,[y]);return y},reposition:function(b,d){if(!y.rendered||B)return y;B=1;var e=s.position.target,f=s.position,i=f.my,k=f.at,l=f.adjust,m=l.method.split(" "),n=D.outerWidth(),o=D.outerHeight(),p=0,q=0,r=a.Event("tooltipmove"),t=D.css("position")==="fixed",u=f.viewport,v={left:0,top:0},w=f.container,x=c,A=y.plugins.tip,C=D[0].offsetWidth>0,E={horizontal:m[0],vertical:m[1]=m[1]||m[0],enabled:u.jquery&&e[0]!==window&&e[0]!==z&&l.method!=="none",left:function(a){var b=E.horizontal==="shift",c=l.x*(E.horizontal.substr(-6)==="invert"?2:0),d=-w.offset.left+u.offset.left+u.scrollLeft,e=i.x==="left"?n:i.x==="right"?-n:-n/2,f=k.x==="left"?p:k.x==="right"?-p:-p/2,g=A&&A.size?A.size.width||0:0,h=A&&A.corner&&A.corner.precedance==="x"&&!b?g:0,j=d-a+h,m=a+n-u.width-d+h,o=e-(i.precedance==="x"||i.x===i.y?f:0)-(k.x==="center"?p/2:0),q=i.x==="center";b?(h=A&&A.corner&&A.corner.precedance==="y"?g:0,o=(i.x==="left"?1:-1)*e-h,v.left+=j>0?j:m>0?-m:0,v.left=Math.max(-w.offset.left+u.offset.left+(h&&A.corner.x==="center"?A.offset:0),a-o,Math.min(Math.max(-w.offset.left+u.offset.left+u.width,a+o),v.left))):(j>0&&(i.x!=="left"||m>0)?v.left-=o+c:m>0&&(i.x!=="right"||j>0)&&(v.left-=(q?-o:o)+c),v.left<d&&-v.left>m&&(v.left=a));return v.left-a},top:function(a){var b=E.vertical==="shift",c=l.y*(E.vertical.substr(-6)==="invert"?2:0),d=-w.offset.top+u.offset.top+u.scrollTop,e=i.y==="top"?o:i.y==="bottom"?-o:-o/2,f=k.y==="top"?q:k.y==="bottom"?-q:-q/2,g=A&&A.size?A.size.height||0:0,h=A&&A.corner&&A.corner.precedance==="y"&&!b?g:0,j=d-a+h,m=a+o-u.height-d+h,n=e-(i.precedance==="y"||i.x===i.y?f:0)-(k.y==="center"?q/2:0),p=i.y==="center";b?(h=A&&A.corner&&A.corner.precedance==="x"?g:0,n=(i.y==="top"?1:-1)*e-h,v.top+=j>0?j:m>0?-m:0,v.top=Math.max(-w.offset.top+u.offset.top+(h&&A.corner.x==="center"?A.offset:0),a-n,Math.min(Math.max(-w.offset.top+u.offset.top+u.height,a+n),v.top))):(j>0&&(i.y!=="top"||m>0)?v.top-=n+c:m>0&&(i.y!=="bottom"||j>0)&&(v.top-=(p?-n:n)+c),v.top<0&&-v.top>m&&(v.top=a));return v.top-a}},H;if(a.isArray(e)&&e.length===2)k={x:"left",y:"top"},v={left:e[0],top:e[1]};else if(e==="mouse"&&(b&&b.pageX||G.event.pageX))k={x:"left",y:"top"},b=(b&&(b.type==="resize"||b.type==="scroll")?G.event:b&&b.pageX&&b.type==="mousemove"?b:h&&h.pageX&&(l.mouse||!b||!b.pageX)?{pageX:h.pageX,pageY:h.pageY}:!l.mouse&&G.origin&&G.origin.pageX&&s.show.distance?G.origin:b)||b||G.event||h||{},v={top:b.pageY,left:b.pageX};else{e==="event"?b&&b.target&&b.type!=="scroll"&&b.type!=="resize"?e=G.target=a(b.target):e=G.target:e=G.target=a(e.jquery?e:F.target),e=a(e).eq(0);if(e.length===0)return y;e[0]===document||e[0]===window?(p=g.iOS?window.innerWidth:e.width(),q=g.iOS?window.innerHeight:e.height(),e[0]===window&&(v={top:(u||e).scrollTop(),left:(u||e).scrollLeft()})):e.is("area")&&g.imagemap?v=g.imagemap(e,k,E.enabled?m:c):e[0].namespaceURI==="http://www.w3.org/2000/svg"&&g.svg?v=g.svg(e,k):(p=e.outerWidth(),q=e.outerHeight(),v=g.offset(e,w)),v.offset&&(p=v.width,q=v.height,x=v.flipoffset,v=v.offset);if(g.iOS<4.1&&g.iOS>3.1||g.iOS==4.3||!g.iOS&&t)H=a(window),v.left-=H.scrollLeft(),v.top-=H.scrollTop();v.left+=k.x==="right"?p:k.x==="center"?p/2:0,v.top+=k.y==="bottom"?q:k.y==="center"?q/2:0}v.left+=l.x+(i.x==="right"?-n:i.x==="center"?-n/2:0),v.top+=l.y+(i.y==="bottom"?-o:i.y==="center"?-o/2:0),E.enabled?(u={elem:u,height:u[(u[0]===window?"h":"outerH")+"eight"](),width:u[(u[0]===window?"w":"outerW")+"idth"](),scrollLeft:t?0:u.scrollLeft(),scrollTop:t?0:u.scrollTop(),offset:u.offset()||{left:0,top:0}},w={elem:w,scrollLeft:w.scrollLeft(),scrollTop:w.scrollTop(),offset:w.offset()||{left:0,top:0}},v.adjusted={left:E.horizontal!=="none"?E.left(v.left):0,top:E.vertical!=="none"?E.top(v.top):0},v.adjusted.left+v.adjusted.top&&D.attr("class",D[0].className.replace(/ui-tooltip-pos-\w+/i,j+"-pos-"+i.abbrev())),x&&v.adjusted.left&&(v.left+=x.left),x&&v.adjusted.top&&(v.top+=x.top)):v.adjusted={left:0,top:0},r.originalEvent=a.extend({},b),D.trigger(r,[y,v,u.elem||u]);if(r.isDefaultPrevented())return y;delete v.adjusted,d===c||!C||isNaN(v.left)||isNaN(v.top)||e==="mouse"||!a.isFunction(f.effect)?D.css(v):a.isFunction(f.effect)&&(f.effect.call(D,y,a.extend({},v)),D.queue(function(b){a(this).css({opacity:"",height:""}),a.browser.msie&&this.style.removeAttribute("filter"),b()})),B=0;return y},redraw:function(){if(y.rendered<1||C)return y;var a=s.position.container,b,c,d,e;C=1,s.style.height&&D.css("height",s.style.height),s.style.width?D.css("width",s.style.width):(D.css("width","").addClass(q),c=D.width()+1,d=D.css("max-width")||"",e=D.css("min-width")||"",b=(d+e).indexOf("%")>-1?a.width()/100:0,d=(d.indexOf("%")>-1?b:1)*parseInt(d,10)||c,e=(e.indexOf("%")>-1?b:1)*parseInt(e,10)||0,c=d+e?Math.min(Math.max(c,e),d):c,D.css("width",Math.round(c)).removeClass(q)),C=0;return y},disable:function(b){"boolean"!==typeof b&&(b=!D.hasClass(l)&&!G.disabled),y.rendered?(D.toggleClass(l,b),a.attr(D[0],"aria-disabled",b)):G.disabled=!!b;return y},enable:function(){return y.disable(c)},destroy:function(){var c=r[0],d=a.attr(c,t),e=r.data("qtip");y.destroyed=b,y.rendered&&(D.stop(1,0).remove(),a.each(y.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(y.timers.show),clearTimeout(y.timers.hide),Q();if(!e||y===e)a.removeData(c,"qtip"),s.suppress&&d&&(a.attr(c,"title",d),r.removeAttr(t)),r.removeAttr("aria-describedby");r.unbind(".qtip-"+v),delete i[y.id];return r}})}function w(b){var e;if(!b||"object"!==typeof b)return c;if(b.metadata===d||"object"!==typeof b.metadata)b.metadata={type:b.metadata};if("content"in b){if(b.content===d||"object"!==typeof b.content||b.content.jquery)b.content={text:b.content};e=b.content.text||c,!a.isFunction(e)&&(!e&&!e.attr||e.length<1||"object"===typeof e&&!e.jquery)&&(b.content.text=c);if("title"in b.content){if(b.content.title===d||"object"!==typeof b.content.title)b.content.title={text:b.content.title};e=b.content.title.text||c,!a.isFunction(e)&&(!e&&!e.attr||e.length<1||"object"===typeof e&&!e.jquery)&&(b.content.title.text=c)}}if("position"in b)if(b.position===d||"object"!==typeof b.position)b.position={my:b.position,at:b.position};if("show"in b)if(b.show===d||"object"!==typeof b.show)b.show.jquery?b.show={target:b.show}:b.show={event:b.show};if("hide"in b)if(b.hide===d||"object"!==typeof b.hide)b.hide.jquery?b.hide={target:b.hide}:b.hide={event:b.hide};if("style"in b)if(b.style===d||"object"!==typeof b.style)b.style={classes:b.style};a.each(g,function(){this.sanitize&&this.sanitize(b)});return b}function v(){v.history=v.history||[],v.history.push(arguments);if("object"===typeof console){var a=console[console.warn?"warn":"log"],b=Array.prototype.slice.call(arguments),c;typeof arguments[0]==="string"&&(b[0]="qTip2: "+b[0]),c=a.apply?a.apply(console,b):a(b)}}"use strict";var b=!0,c=!1,d=null,e,f,g,h,i={},j="ui-tooltip",k="ui-widget",l="ui-state-disabled",m="div.qtip."+j,n=j+"-default",o=j+"-focus",p=j+"-hover",q=j+"-fluid",r="-31000px",s="_replacedByqTip",t="oldtitle",u;f=a.fn.qtip=function(g,h,i){var j=(""+g).toLowerCase(),k=d,l=a.makeArray(arguments).slice(1),m=l[l.length-1],n=this[0]?a.data(this[0],"qtip"):d;if(!arguments.length&&n||j==="api")return n;if("string"===typeof g){this.each(function(){var d=a.data(this,"qtip");if(!d)return b;m&&m.timeStamp&&(d.cache.event=m);if(j!=="option"&&j!=="options"||!h)d[j]&&d[j].apply(d[j],l);else if(a.isPlainObject(h)||i!==e)d.set(h,i);else{k=d.get(h);return c}});return k!==d?k:this}if("object"===typeof g||!arguments.length){n=w(a.extend(b,{},g));return f.bind.call(this,n,m)}},f.bind=function(d,j){return this.each(function(k){function r(b){function d(){p.render(typeof b==="object"||l.show.ready),m.show.add(m.hide).unbind(o)}if(p.cache.disabled)return c;p.cache.event=a.extend({},b),p.cache.target=b?a(b.target):[e],l.show.delay>0?(clearTimeout(p.timers.show),p.timers.show=setTimeout(d,l.show.delay),n.show!==n.hide&&m.hide.bind(n.hide,function(){clearTimeout(p.timers.show)})):d()}var l,m,n,o,p,q;q=a.isArray(d.id)?d.id[k]:d.id,q=!q||q===c||q.length<1||i[q]?f.nextid++:i[q]=q,o=".qtip-"+q+"-create",p=y.call(this,q,d);if(p===c)return b;l=p.options,a.each(g,function(){this.initialize==="initialize"&&this(p)}),m={show:l.show.target,hide:l.hide.target},n={show:a.trim(""+l.show.event).replace(/ /g,o+" ")+o,hide:a.trim(""+l.hide.event).replace(/ /g,o+" ")+o},/mouse(over|enter)/i.test(n.show)&&!/mouse(out|leave)/i.test(n.hide)&&(n.hide+=" mouseleave"+o),m.show.bind("mousemove"+o,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"},p.cache.onTarget=b}),m.show.bind(n.show,r),(l.show.ready||l.prerender)&&r(j)})},g=f.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();var b=a.charAt(0);this.precedance=b==="t"||b==="b"?"y":"x",this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y},this.abbrev=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b},this.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,string:this.string,abbrev:this.abbrev,clone:this.clone}}},offset:function(b,c){function j(a,b){d.left+=b*a.scrollLeft(),d.top+=b*a.scrollTop()}var d=b.offset(),e=b.closest("body")[0],f=c,g,h,i;if(f){do f.css("position")!=="static"&&(h=f.position(),d.left-=h.left+(parseInt(f.css("borderLeftWidth"),10)||0)+(parseInt(f.css("marginLeft"),10)||0),d.top-=h.top+(parseInt(f.css("borderTopWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0),!g&&(i=f.css("overflow"))!=="hidden"&&i!=="visible"&&(g=f));while((f=a(f[0].offsetParent)).length);g&&g[0]!==e&&j(g,1)}return d},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||c,fn:{attr:function(b,c){if(this.length){var d=this[0],e="title",f=a.data(d,"qtip");if(b===e&&f&&"object"===typeof f&&f.options.suppress){if(arguments.length<2)return a.attr(d,t);f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",c);return this.attr(t,c)}}return a.fn["attr"+s].apply(this,arguments)},clone:function(b){var c=a([]),d="title",e=a.fn["clone"+s].apply(this,arguments);b||e.filter("["+t+"]").attr("title",function(){return a.attr(this,t)}).removeAttr(t);return e}}},a.each(g.fn,function(c,d){if(!d||a.fn[c+s])return b;var e=a.fn[c+s]=a.fn[c];a.fn[c]=function(){return d.apply(this,arguments)||e.apply(this,arguments)}}),a.ui||(a["cleanData"+s]=a.cleanData,a.cleanData=function(b){for(var c=0,d;(d=b[c])!==e;c++)try{a(d).triggerHandler("removeqtip")}catch(f){}a["cleanData"+s](b)}),f.version="nightly",f.nextid=0,f.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),f.zindex=15e3,f.defaults={prerender:c,id:c,overwrite:b,suppress:b,content:{text:b,attr:"title",title:{text:c,button:c}},position:{my:"top left",at:"bottom right",target:c,container:c,viewport:c,adjust:{x:0,y:0,mouse:b,resize:b,method:"flip flip"},effect:function(b,d,e){a(this).animate(d,{duration:200,queue:c})}},show:{target:c,event:"mouseenter",effect:b,delay:90,solo:c,ready:c,autofocus:c},hide:{target:c,event:"mouseleave",effect:b,delay:0,fixed:c,inactive:c,leave:"window",distance:c},style:{classes:"",widget:c,width:c,height:c,def:b},events:{render:d,move:d,show:d,hide:d,toggle:d,visible:d,hidden:d,focus:d,blur:d}}})
\ No newline at end of file diff --git a/apps/atnotes/lib/atnotes.class.php b/apps/atnotes/lib/atnotes.class.php new file mode 100644 index 00000000000..42100004eda --- /dev/null +++ b/apps/atnotes/lib/atnotes.class.php @@ -0,0 +1,88 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/** + * This class manages atnote db. + */ +class OC_ATNotes { + + /** + * Save note + * @param $title Title of the note + * @param $content Content of the note + * @return $id Id of the saved note + */ + public static function saveNote($id,$title,$content){ + if($id == 0){ + $query = OCP\DB::prepare('INSERT INTO *PREFIX*atnotes (oc_uid,create_ts,update_ts,note_title,note_content) VALUES (?,?,?,?,?)'); + $query->execute(Array(OCP\User::getUser(),time(),time(),$title,$content)); + $id = OCP\DB::insertid('*PREFIX*atnotes'); + }else{ + $query = OCP\DB::prepare('UPDATE *PREFIX*atnotes SET update_ts=?,note_title=?,note_content=? WHERE note_id=?'); + $query->execute(Array(time(),$title,$content,$id)); + } + return $id; + } + + /** + * Get list + * @return Array() + */ + public static function getNotesList(){ + $query = OCP\DB::prepare('SELECT * FROM *PREFIX*atnotes WHERE oc_uid=? AND is_deleted=? ORDER BY update_ts DESC'); + $results = $query->execute(Array(OCP\User::getUser(),0))->fetchAll(); + return $results; + } + + /** + * Get note + * @param $id The note db id + * @return Array if note found or Boolean FALSE + */ + public static function getNote($id){ + $query = OCP\DB::prepare('SELECT * FROM *PREFIX*atnotes WHERE oc_uid=? AND is_deleted=? AND note_id=?'); + $result = $query->execute(Array(OCP\User::getUser(),0,$id))->fetchRow(); + if($result){ + return $result; + }else{ + return FALSE; + } + } + + /** + * Delete note + * @param $id The note db id + * @return Boolean + */ + public static function deleteNote($id){ + if(self::getNote($id)){ + $query = OCP\DB::prepare('DELETE FROM *PREFIX*atnotes WHERE oc_uid=? AND note_id=?'); + $query->execute(Array(OCP\User::getUser(),$id)); + if(!self::getNote($id)){ + return 0; + } + } + return 1; + } + +} diff --git a/apps/atnotes/templates/main.tpl.php b/apps/atnotes/templates/main.tpl.php new file mode 100644 index 00000000000..907785c4afe --- /dev/null +++ b/apps/atnotes/templates/main.tpl.php @@ -0,0 +1,71 @@ +<?php + +/** +* ownCloud - ATNotes plugin +* +* @author Xavier Beurois +* @copyright 2012 Xavier Beurois www.djazz-lab.net +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\Util::addStyle('atnotes','jquery-te-1.0.3.min'); +OCP\Util::addScript('atnotes','jquery-te-1.0.3.min'); +OCP\Util::addStyle('atnotes','jquery.qtip.min'); +OCP\Util::addScript('atnotes','jquery.qtip.min'); +OCP\Util::addStyle('atnotes','atnotes.min'); +OCP\Util::addScript('atnotes','atnotes.min'); + +?> + +<div id="atnotes_container"> + <div id="save_dialog"> + <div class="atnotes-explorer"><table border="0" cellpadding="0" cellspacing="0"></table></div> + </div> + <div id="controls"> + <div class="title"><?php print('Always Take Notes !'); ?></div> + </div> + <ul class="atnotes-noteslist"> + <?php foreach($_['notes_list'] as $note){ ?> + <li class="atnotes-elt" rel="<?php print($note['note_id']); ?>"> + <div class="atnotes-elt-title"><?php print($note['note_title']); ?></div> + <div class="atnotes-elt-state"></div> + <div class="atnotes-elt-date"><?php print(date('m/d/Y', $note['update_ts'])); ?></div> + <div class="atnotes-elt-prerender"><?php print($note['note_content']); ?></div> + </li> + <?php } ?> + </ul> + <div class="atnotes-notesedit"> + <div class="anotes-notesedit-title"> + <input type="text" id="note_title" rel="0" maxlength="255" /> + <input type="hidden" id="note_path" maxlength="255" /> + <div class="atnotes-actions-btns"> + <img class="atnotes-actions-list" src="<?php print(OCP\Util::imagePath('atnotes','action.png')); ?>" /> + <div class="atnotes-actions-ddmenu"> + <ul> + <li class="atnotes-new">New note</li> + <li class="atnotes-delete">Delete note</li> + </ul> + </div> + <img class="atnotes-save" src="<?php print(OCP\Util::imagePath('atnotes','save.png')); ?>" /> + </div> + </div> + <div class="anotes-notesedit-states"> + <div class="atnotes-created"></div> + <div class="atnotes-saved"></div> + </div> + </div> + <textarea class="atnotes-editor"></textarea> +</div> |