diff --git a/.gitignore b/.gitignore index b471de2..0c70654 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ sys/*.sqlite -docs/* \ No newline at end of file +docs/* +assets/js/cache/* \ No newline at end of file diff --git a/app/classes/controller.php b/app/classes/controller.php index 84dd925..72b3813 100644 --- a/app/classes/controller.php +++ b/app/classes/controller.php @@ -58,7 +58,7 @@ abstract class Controller extends \miniMVC\Controller { */ public function __destruct() { - $this->page->set_foot_js_group('js', TRUE); + $this->page->set_foot_js_group('js'); $this->page->build_footer(); } diff --git a/app/config/config.php b/app/config/config.php index 425346a..841e1a9 100644 --- a/app/config/config.php +++ b/app/config/config.php @@ -128,7 +128,7 @@ define('DEFAULT_JS_GROUP', "js"); |-------------------------------------------------------------------------- | | Whether or not to show a backtrace for php errors -| +| | Must be defined as TRUE for the backtrace to display. | */ @@ -142,6 +142,6 @@ define('SHOW_DEBUG_BACKTRACE', TRUE); | Whether or not use gzip compression on page output | */ -define('GZ_COMPRESS', FALSE); +define('GZ_COMPRESS', TRUE); // End of config.php \ No newline at end of file diff --git a/app/modules/meta/views/outline.php b/app/modules/meta/views/outline.php index fb8f939..aafe6c6 100644 --- a/app/modules/meta/views/outline.php +++ b/app/modules/meta/views/outline.php @@ -1,6 +1,6 @@

Outline

-
+
Genre
    diff --git a/app/modules/meta/views/section_detail.php b/app/modules/meta/views/section_detail.php index 5007bf2..923586b 100644 --- a/app/modules/meta/views/section_detail.php +++ b/app/modules/meta/views/section_detail.php @@ -23,6 +23,37 @@
+ + diff --git a/app/views/footer.php b/app/views/footer.php index e72198f..63a0aec 100644 --- a/app/views/footer.php +++ b/app/views/footer.php @@ -1,8 +1,5 @@
- diff --git a/app/views/header.php b/app/views/header.php index 33226c1..cfaabcc 100644 --- a/app/views/header.php +++ b/app/views/header.php @@ -9,5 +9,9 @@ > +

Meta

[Data Outline]
\ No newline at end of file diff --git a/assets/config/js_groups.php b/assets/config/js_groups.php index 19b7c29..3928c8b 100755 --- a/assets/config/js_groups.php +++ b/assets/config/js_groups.php @@ -28,7 +28,9 @@ return array( 'js' => array( 'kis-lite-dom.js', - 'tinyeditor.js', 'meta.js' ), + 'wysiwyg' => array( + 'tinyeditor.js', + ), ); \ No newline at end of file diff --git a/assets/css/theme.css b/assets/css/theme.css index ecd50e9..90e95a1 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -23,8 +23,9 @@ button { vertical-align:middle; } -a { +a, a:visited { text-decoration:none; + color:#558BFF; } a:hover { @@ -61,9 +62,13 @@ dd { } /* Hide forms by default */ -/*fieldset dl { +fieldset dl { display:none; -}*/ +} + +#edit_form dl { + display:block; +} /* form styles */ form dt, form dd { @@ -78,7 +83,7 @@ form dt { } form dd { - width:59%; + width:58%; text-align:left; margin-left:0; padding-left:.25em; @@ -131,20 +136,20 @@ button.edit:hover { } button.delete { - background:#977; - background:-o-linear-gradient(#977, #955); - background:-moz-linear-gradient(#977, #955); - background:-webkit-linear-gradient(#977, #955); - background:linear-gradient(#977, #955); + background:#f55; + background:-o-linear-gradient(#f55, #955); + background:-moz-linear-gradient(#f55, #955); + background:-webkit-linear-gradient(#f55, #955); + background:linear-gradient(#f55, #955); color:#fff; } button.delete:hover { background:#955; - background:-o-linear-gradient(#955, #977); - background:-moz-linear-gradient(#955, #977); - background:-webkit-linear-gradient(#955, #977); - background:linear-gradient(#955, #977); + background:-o-linear-gradient(#955, #f55); + background:-moz-linear-gradient(#955, #f55); + background:-webkit-linear-gradient(#955, #f55); + background:linear-gradient(#955, #f55); } /* ! Outline styles */ @@ -157,9 +162,15 @@ button.delete:hover { margin-left:0.5em; } -dl.outline { +dl.outline dd { border-bottom:1px dotted #555; + margin-bottom:0.5em; } + +dl.outline dd:last-child { + border:0; +} + dl.outline dt { display:list-item; list-style:square inside; diff --git a/assets/js/cache/js b/assets/js/cache/js deleted file mode 100644 index 124373f..0000000 --- a/assets/js/cache/js +++ /dev/null @@ -1,41 +0,0 @@ -(function(){if("undefined"!==typeof document.querySelector){var g,e,d,f;g=function(a){f="undefined"===typeof a?"undefined"!==typeof g.el?g.el:document.documentElement:"object"!==typeof a?e(a):a;g.prototype.el=f;var a=d(g),c;for(c in a)"object"===typeof a[c]&&(a[c].el=f);a.el=f;return a};e=function(a,c){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a); -return 1===b.length?b[0]:b};d=function(a){var c;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);c=typeof a;if(!("object"!==c&&"function"!==c))return c=function(){},c.prototype=a,new c}};g.ext=function(a,c){c.el=f;g[a]=c};g.ext("each",function(a){if("undefined"!==typeof f.length&&f!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(f,a);else{var c=f.length;if(0!==c)for(var b,d=0;d1&&typeof f==="undefined")return null;if(a.length>1&&typeof f!=="undefined")$_.each(function(a){return g(a,d,f)});else return g(a,d,f)},text:function(d){var f,a,c;c=this.el;a=typeof c.textContent!=="undefined"?"textContent":typeof c.innerText!=="undefined"?"innerText": -"innerHTML";f=c[a];if(typeof d!=="undefined")return c[a]=d;return f},css:function(d,f){if(typeof f==="undefined")return e(this.el,d);$_.each(function(a){e(a,d,f)})},append:function(d){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",d):this.el.innerHTML=this.el.innerHTML+d},prepend:function(d){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",d):this.el.innerHTML=d+this.el.innerHTML},html:function(d){if(typeof d!=="undefined")this.el.innerHTML= -d;return this.el.innerHTML}})})(); -(function(){var g={};window.TINY=g;var e=function(a,c){var b,e,g;this.n=a;window[a]=this;this.t=document.getElementById(c.id);this.obj=c;this.xhtml=c.xhtml;var h=document.createElement("div"),l=document.createElement("div"),i=document.createElement("div"),j=c.controls.length,o=0;this.i=document.createElement("iframe");this.i.frameBorder=0;this.i.width=c.width||"500";this.i.height=c.height||"250";this.ie=document.all&&document.attachEvent?1:0;i.className=c.rowclass||"teheader";h.className=c.cssclass|| -"te";h.style.width=this.i.width+"px";h.appendChild(i);for(o;o"],["Header 1","

"],["Header 2","

"],["Header 3","

"], -["Header 4","

"],["Header 5","

"],["Header 6","
"]];g=styles.length;e=0;b.className="testyle";b.onchange=new Function(this.n+'.ddaction(this,"formatblock")');for(e;e";l=c.bodyid?' id="'+c.bodyid+'"':"";c.cssfile&&(h= -h+(''));c.css&&(h=h+('"));h=h+(""+(c.content||this.t.value));this.e.write(h+"");this.e.close();this.e.designMode="on";this.d=1;if(this.xhtml)try{this.e.execCommand("styleWithCSS",0,0)}catch(q){try{this.e.execCommand("useCSS",0,1)}catch(r){}}},d={},f=-30;d.cut=[1,"Cut","a","cut",1];d.copy=[2,"Copy","a","copy",1];d.paste=[3,"Paste","a","paste",1];d.bold=[4,"Bold","a","bold"];d.italic= -[5,"Italic","a","italic"];d.underline=[6,"Underline","a","underline"];d.strikethrough=[7,"Strikethrough","a","strikethrough"];d.subscript=[8,"Subscript","a","subscript"];d.superscript=[9,"Superscript","a","superscript"];d.orderedlist=[10,"Insert Ordered List","a","insertorderedlist"];d.unorderedlist=[11,"Insert Unordered List","a","insertunorderedlist"];d.outdent=[12,"Outdent","a","outdent"];d.indent=[13,"Indent","a","indent"];d.leftalign=[14,"Left Align","a","justifyleft"];d.centeralign=[15,"Center Align", -"a","justifycenter"];d.rightalign=[16,"Right Align","a","justifyright"];d.blockjustify=[17,"Block Justify","a","justifyfull"];d.undo=[18,"Undo","a","undo"];d.redo=[19,"Redo","a","redo"];d.image=[20,"Insert Image","i","insertimage","Enter Image URL:","http://"];d.hr=[21,"Insert Horizontal Rule","a","inserthorizontalrule"];d.link=[22,"Insert Hyperlink","i","createlink","Enter URL:","http://"];d.unlink=[23,"Remove Hyperlink","a","unlink"];d.unformat=[24,"Remove Formatting","a","removeformat"];d.print= -[25,"Print","a","print"];e.prototype.print=function(){this.i.contentWindow.print()};e.prototype.hover=function(a,c,b){a.style.backgroundPosition=(b?"34px ":"0px ")+c+"px"};e.prototype.ddaction=function(a,c){this.action(c,a.options[a.selectedIndex].value)};e.prototype.action=function(a,c,b){b&&!this.ie?alert("Your browser does not support this function."):this.e.execCommand(a,0,c||null)};e.prototype.insert=function(a,c,b){a=prompt(a,c);a!=null&&a!=""&&this.e.execCommand(b,0,a)};e.prototype.setfont= -function(){execCommand("formatblock",0,hType)};e.prototype.resize=function(a){this.mv&&this.freeze();this.i.bcs=g.cursor.top(a);this.mv=new Function("event",this.n+".move(event)");this.sr=new Function(this.n+".freeze()");if(this.ie){document.attachEvent("onmousemove",this.mv);document.attachEvent("onmouseup",this.sr)}else{document.addEventListener("mousemove",this.mv,1);document.addEventListener("mouseup",this.sr,1)}};e.prototype.move=function(a){a=g.cursor.top(a);this.i.height=parseInt(this.i.height, -10)+a-this.i.bcs;this.i.bcs=a};e.prototype.freeze=function(){if(this.ie){document.detachEvent("onmousemove",this.mv);document.detachEvent("onmouseup",this.sr)}else{document.removeEventListener("mousemove",this.mv,1);document.removeEventListener("mouseup",this.sr,1)}};e.prototype.toggle=function(a,c){var b;if(this.d){b=this.e.body.innerHTML;if(this.xhtml){b=b.replace(/(.*)<\/span>/gi,"$1");b=b.replace(/ class="apple-style-span"/gi,"");b=b.replace(//gi, -"");b=b.replace(/
/gi,"
");b=b.replace(/
$/gi,"");b=b.replace(/^
/gi,"");b=b.replace(/(]+[^\/])>/gi,"$1 />");b=b.replace(/]*>(.*?)<\/b[^>]*>/gi,"$1");b=b.replace(/]*>(.*?)<\/i[^>]*>/gi,"$1");b=b.replace(/]*>(.*?)<\/u[^>]*>/gi,'$1');b=b.replace(/<(b|strong|em|i|u) style="font-weight: normal;?">(.*)<\/(b|strong|em|i|u)>/gi,"$2");b=b.replace(/<(b|strong|em|i|u) style="(.*)">(.*)<\/(b|strong|em|i|u)>/gi, -'<$4>$3');b=b.replace(/(.*)<\/span>/gi,"$1");b=b.replace(/(.*)<\/span>/gi,"$1");b=b.replace(/(.*)<\/span>/gi,"$1");b=b.replace(/(.*)<\/span>|]*>(.*?)<\/b[^>]*>/gi,"$1")}if(c)c.innerHTML=this.obj.toggletext||"wysiwyg";this.t.value=b;if(!a){this.t.style.height=this.i.height+"px";this.i.style.display= -"none";this.t.style.display="block";this.d=0}}else{b=this.t.value;if(c)c.innerHTML=this.obj.toggletext||"source";if(this.xhtml&&!this.ie){b=b.replace(/(.*)<\/strong>/gi,'$1');b=b.replace(/(.*)<\/em>/gi,'$1')}this.e.body.innerHTML=b;this.t.style.display="none";this.i.style.display="block";this.d=1}};e.prototype.post=function(){this.d&&this.toggle(1)};g.editor={edit:e};g.cursor={top:function(a){return document.all&& -document.attachEvent?window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop:a.clientY+window.scrollY}};g.init=function(a){return new g.editor.edit("editor",a)}})(); -$_.ext("center",function(g){g=this.el;if(typeof g!=="undefined"){var e,d,f,a,c;e=typeof g.outerHeight!=="undefined"?g.outerHeight:g.offsetHeight;d=typeof g.outerWidth!=="undefined"?g.outerWidth:g.offsetWidth;f=typeof window.pageXOffset!=="undefined"?window.pageXOffset:document.documentElement.scrollLeft;a=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight;c=window.innerWidth?window.innerWidth:document.documentElement.offsetWidth;g.style.position="fixed";e=(a-e)/2;g.style.posTop? -g.style.posTop=e+"px":g.style.top=e+"px";g.style.left=(c-d)/2+f+"px"}}); -(function(){var g=window.TINY||{},e=window.$_||{},d=APP_URL.replace("index.php/","")+"assets/";e("fieldset dl").dom.hide();e("fieldset legend").event.add("click",function(){var a=e("fieldset dl").dom;a.css("display").trim()=="none"?a.show():a.hide()});var f={};window.meta=f;f._delete=function(a){a==1?e.get(APP_URL+"message",{type:"success",message:"Item successfully deleted"},function(a){e("body").dom.prepend(a)}):e.get(APP_URL+"message",{type:"error",message:"There was an error deleting that item"}, -function(a){e("body").dom.prepend(a)})};f.delete_item=function(){var a,c;a=this.parentNode.id;a=a.split("_");c=a[1];a=a[0];if(confirm("Are you sure you want to delete this "+a+"? Deleting this item will delete all items under it. There is no undo."))switch(a){case "genre":case "category":case "section":case "data":e.post(APP_URL+"delete",{id:c,type:a},f._delete)}};f.get_edit_form=function(){var a,c;a=this.parentNode.id;a=a.split("_");c=a[1];a=a[0];e("#overlay_bg, #overlay").dom.show();e.get(APP_URL+ -"edit",{id:c,type:a},function(a){e("#overlay").dom.html(a);e("#overlay").center()})};f.update_item=function(a){var c,b={};console.log(arguments);b.id=e.$("#id").value;b.type=e.$("#type").value;b.name=e.$("#name").value;if(c=document.getElementById("val"))b.val=c.value;e.post(APP_URL+"update",b,function(a){e("#overlay_bg").dom.css("display","");e("#overlay").dom.html("");e("#overlay").dom.hide();a==1?e.get(APP_URL+"message",{type:"success",message:"Item successfully updated."},function(a){e("body").dom.prepend(a)}): -e.get(APP_URL+"message",{type:"error",message:"There was an error updating that item."},function(a){e("body").dom.prepend(a)})})};e("button.delete").event.add("click",f.delete_item);e("button.edit").event.add("click",f.get_edit_form);e("#overlay_bg").event.add("click",function(){e("#overlay_bg").dom.css("display","");e("#overlay").dom.html("");e("#overlay").dom.hide()});e.event.live("#edit_form","submit",f.update_item);e.$("textarea").length>0&&g.init({id:"input",width:450,height:175,cssclass:"te", -controlclass:"tecontrol",rowclass:"teheader",dividerclass:"tedivider",controls:["bold","italic","underline","strikethrough","|","subscript","superscript","|","orderedlist","unorderedlist","|","leftalign","centeralign","rightalign","blockjustify","|","unformat","n","undo","redo","|","image","hr","link","unlink","|"],footer:true,fonts:["Verdana","Arial","Georgia","Trebuchet MS"],xhtml:true,cssfile:d+"css.php/g/css",bodyid:"editor",footerclass:"tefooter",toggle:{text:"source",activetext:"wysiwyg",cssclass:"toggle"}, -resize:{cssclass:"resize"}});if(window.editor)document.querySelector("form").onsubmit=function(){window.editor.toggle()}})(); diff --git a/assets/js/meta.js b/assets/js/meta.js index 8d5a80e..ad800e7 100644 --- a/assets/js/meta.js +++ b/assets/js/meta.js @@ -56,7 +56,6 @@ $_.ext('center', function (sel){ var TINY = window.TINY || {}; var $_ = window.$_ || {}; - var ASSET_URL = APP_URL.replace('index.php/', '') + 'assets/'; // ! Show/hide forms based on use $_("fieldset dl").dom.hide(); @@ -77,12 +76,8 @@ $_.ext('center', function (sel){ meta._delete = function(res){ if (res == 1) { - $_.get(APP_URL+'message', { - type: 'success', - message: 'Item successfully deleted' - }, function(h) { - $_('body').dom.prepend(h); - }); + // Reload the page + window.location = window.location; } else { @@ -156,6 +151,33 @@ $_.ext('center', function (sel){ // Center the form $_('#overlay').center(); + + if (type == 'data') + { + // WYSIWYG + new TINY.editor.edit('edit_wysiwyg', + { + id:'val', + width:450, + height:175, + cssclass:'te', + controlclass:'tecontrol', + rowclass:'teheader', + dividerclass:'tedivider', + controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|', + 'orderedlist','unorderedlist','|','leftalign', + 'centeralign','rightalign','blockjustify','|','unformat','n','undo','redo','|', + 'image','hr','link','unlink','|'], + footer:true, + fonts:['Verdana','Arial','Georgia','Trebuchet MS'], + xhtml:true, + cssfile:ASSET_URL+'css.php/g/css', + bodyid:'editor', + footerclass:'tefooter', + toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'}, + resize:{cssclass:'resize'} + }); + } }); }; @@ -165,7 +187,11 @@ $_.ext('center', function (sel){ meta.update_item = function(e) { var id, type, name, val, txt, data={}; - console.log(arguments); + // Update textarea from WYSIWYG + if (window.edit_wysiwyg) + { + window.edit_wysiwyg.toggle(); + } // Get the form values data.id = $_.$('#id').value; @@ -188,12 +214,8 @@ $_.ext('center', function (sel){ // Show the appropriate status message if (res == 1) { - $_.get(APP_URL+'message', { - type: 'success', - message: 'Item successfully updated.' - }, function(h) { - $_('body').dom.prepend(h); - }); + // Reload the page + window.location = window.location; } else { @@ -212,7 +234,6 @@ $_.ext('center', function (sel){ // ! Event binding // ------------------------------------------------- - // Delete Button functionality $_("button.delete").event.add('click', meta.delete_item); @@ -229,39 +250,4 @@ $_.ext('center', function (sel){ // Edit form submission $_.event.live('#edit_form', 'submit', meta.update_item); - // WYSIWYG - if ($_.$('textarea').length > 0) - { - TINY.init({ - id:'input', - width:450, - height:175, - cssclass:'te', - controlclass:'tecontrol', - rowclass:'teheader', - dividerclass:'tedivider', - controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|', - 'orderedlist','unorderedlist','|','leftalign', - 'centeralign','rightalign','blockjustify','|','unformat','n','undo','redo','|', - 'image','hr','link','unlink','|'], - footer:true, - fonts:['Verdana','Arial','Georgia','Trebuchet MS'], - xhtml:true, - cssfile:ASSET_URL+'css.php/g/css', - bodyid:'editor', - footerclass:'tefooter', - toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'}, - resize:{cssclass:'resize'} - }); - } - - // Make sure the WYSIWYG submits the text - // This just copies the text from the WYSIWYG into the textbox - if (window.editor) - { - document.querySelector('form').onsubmit = function(e) { - window.editor.toggle(); - }; - } - }()); \ No newline at end of file