Polishing

This commit is contained in:
Timothy Warren 2012-09-12 16:57:41 +00:00
parent bb6d8ce624
commit ba319c711d
11 changed files with 105 additions and 114 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
sys/*.sqlite
docs/*
assets/js/cache/*

View File

@ -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();
}

View File

@ -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

View File

@ -1,6 +1,6 @@
<h2>Outline</h2>
<dl>
<dl class="outline">
<dt>Genre</dt>
<dd>
<ul>

View File

@ -23,6 +23,37 @@
</dl>
</fieldset>
</form>
<script src="<?= SCRIPT_PATH.'wysiwyg'; ?>"></script>
<script type="text/javascript">
// WYSIWYG
new TINY.editor.edit('editor',
{
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
document.querySelector('form').onsubmit = function(e) {
window.editor.toggle();
};
</script>
<?php if ( ! empty($sdata)): ?>

View File

@ -1,8 +1,5 @@
<div id="overlay_bg"></div>
<div id="overlay"></div>
<script type="text/javascript">
var APP_URL = '<?= \miniMVC\site_url(); ?>';
</script>
<?php if ($foot_js != ""): ?>
<?= $foot_js ?>
<?php endif ?>

View File

@ -9,5 +9,9 @@
<?= $head_js ?>
</head>
<body<?= (!empty($body_class)) ? "class=\"" . $body_class . "\"" : ""; ?><?= (!empty($body_id)) ? " id=\"" . $body_id . "\"" : ""; ?>>
<script type="text/javascript">
var APP_URL = '<?= \miniMVC\site_url(); ?>';
var ASSET_URL = APP_URL.replace('index.php/', '') + 'assets/';
</script>
<h1><a href="<?= miniMVC\site_url('') ?>">Meta</a></h1>
[<a href="<?= miniMVC\site_url('outline')?>">Data Outline</a>]<br />

View File

@ -28,7 +28,9 @@ return array(
'js' => array(
'kis-lite-dom.js',
'tinyeditor.js',
'meta.js'
),
'wysiwyg' => array(
'tinyeditor.js',
),
);

View File

@ -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;

41
assets/js/cache/js vendored
View File

@ -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;d<c;d++)b=f.item(d)?f.item(d):f[d],a.call(b,b)}else a.call(f,
f)});g.type=function(a){return function(){return a&&a!==this}.call(a)?(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};g=window.$_=window.$_||g;g.$=e}})();"undefined"===typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")});
"undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event&&(Event.prototype.preventDefault=function(){window.event.returnValue=false},Event.prototype.stopPropagation=function(){window.event.cancelBubble=true});"undefined"===typeof Array.isArray&&(Array.isArray=function(g){return Object.prototype.toString.apply(g)==="[object Array]"});
(function(){if(typeof window.XMLHttpRequest!=="undefined"){var g={_do:function(e,d,f,a,c){var b=new XMLHttpRequest;typeof f==="undefined"&&(f=function(){});c=c?"POST":"GET";e=e+(c==="GET"?"?"+this._serialize(d):"");b.open(c,e);b.onreadystatechange=function(){b.readyState===4&&(b.status===200?f.call(b.responseText,b.responseText):typeof a!=="undefined"&&a.call(b.status,b.status))};if(c==="POST"){b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(this._serialize(d))}else b.send(null)},
_serialize:function(e){var d,f,a=[];for(d in e)if(e.hasOwnProperty(d)&&typeof e[d]!=="function"){f=e[d].toString();d=encodeURIComponent(d);f=encodeURIComponent(f);a.push(d+"="+f)}return a.join("&")}};$_.ext("get",function(e,d,f,a){g._do(e,d,f,a,false)});$_.ext("post",function(e,d,f,a){g._do(e,d,f,a,true)});$_.ext("sse",function(e,d){var f;if(typeof EventSource!=="undefined"){f=new EventSource(e);f.onmessage=function(a){d.call(a.data,a.data)}}})}})();
(function(){var g,e,d,f;if(typeof document.addEventListener!=="undefined"){g=function(a,c,b){typeof a.addEventListener!=="undefined"&&a.addEventListener(c,b,false)};e=function(a,c,b){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(c,b,false)}}else if(typeof document.attachEvent!=="undefined"){g=function(a,c,b){function d(a){b.apply(a)}if(typeof a.attachEvent!=="undefined"){e(c,b);a.attachEvent("on"+c,d);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[c]=a.listeners[c]||
[];a.listeners[c].push({callback:b,_listener:d})}};e=function(a,c,b){if(typeof a.detachEvent!=="undefined"){var d=a.KIS_0_6_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],e=f.length,g=0;g<e;g++)if(f[g].callback===b){a.detachEvent("on"+c,f[g]._listener);f.splice(g,1);f.length===0&&delete d.listeners[c];break}}}}d=function(a,c,b,f){var n,h;if(typeof a==="undefined")return null;if(c.match(/^([\w\-]+)$/))f===true?g(a,c,b):e(a,c,b);else{c=c.split(" ");h=c.length;for(n=0;n<h;n++)d(a,c[n],
b,f)}};f=function(a,c,b,f){d(a,b,function(b){var d,e,g,b=b||window.event;e=$_.$(c,a);for(d in e){g=b.target||b.srcElement;if(g==e[d]){f.call(e[d],b);b.stopPropagation()}}},true)};$_.ext("event",{add:function(a,c){$_.each(function(b){d(b,a,c,true)})},remove:function(a,c){$_.each(function(b){d(b,a,c,false)})},live:function(a,c,b){f(document.documentElement,a,c,b)},delegate:function(a,c,b){$_.each(function(d){f(d,a,c,b)})}})})();
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(g){var g=(g.HTMLElement||g.Element).prototype,e=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},f=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},c=function(b,c){if(c==="")throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(c))throw new a("INVALID_CHARACTER_ERR",
"String contains an invalid character");return f.call(b,c)},b=function(a){for(var b=d.call(a.className),b=b?b.split(/\s+/):[],c=0,f=b.length;c<f;c++)this.push(b[c]);this._updateClassName=function(){a.className=this.toString()}},k=b.prototype=[],n=function(){return new b(this)};a.prototype=Error.prototype;k.item=function(a){return this[a]||null};k.contains=function(a){return c(this,a+"")!==-1};k.add=function(a){a=a+"";if(c(this,a)===-1){this.push(a);this._updateClassName()}};k.remove=function(a){a=
c(this,a+"");if(a!==-1){this.splice(a,1);this._updateClassName()}};k.toggle=function(a){a=a+"";c(this,a)===-1?this.add(a):this.remove(a)};k.toString=function(){return this.join(" ")};if(e.defineProperty){k={get:n,enumerable:true,configurable:true};try{e.defineProperty(g,"classList",k)}catch(h){if(h.number===-2146823252){k.enumerable=false;e.defineProperty(g,"classList",k)}}}else e.prototype.__defineGetter__&&g.__defineGetter__("classList",n)}(self);
(function(){function g(d,f,a){var c,b;if(typeof d.hasAttribute!=="undefined"){d.hasAttribute(f)&&(c=d.getAttribute(f));b=true}else if(typeof d[f]!=="undefined"){c=d[f];b=false}else if(f==="class"&&typeof d.className!=="undefined"){f="className";c=d.className;b=false}if(typeof c==="undefined"&&(typeof a==="undefined"||a===null))return null;if(typeof a==="undefined")return c;typeof a!=="undefined"&&a!==null?b===true?d.setAttribute(f,a):d[f]=a:a===null&&(b===true?d.removeAttribute(f):delete d[f]);return typeof a!==
"undefined"?a:c}function e(d,f,a){var c,f=f.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")});c={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(typeof a==="undefined"&&d.style[f]!=="undefined")return d.style[f];if(typeof a==="undefined"&&d.style[c[f]]!=="undefined")return d.style[c[f]];if(typeof d.style[f]!=="undefined"){d.style[f]=a;return null}if(d.style[c[f]]){d.style[c[f]]=a;return null}}$_.ext("dom",{addClass:function(d){$_.each(function(f){f.classList.add(d)})},
removeClass:function(d){$_.each(function(f){f.classList.remove(d)})},hide:function(){this.css("display","none")},show:function(d){typeof d==="undefined"&&(d="block");this.css("display",d)},attr:function(d,f){var a=this.el;if(a.length>1&&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<j;o++){b=c.controls[o];if(b=="n"){i=document.createElement("div");i.className=c.rowclass||"teheader";h.appendChild(i)}else if(b=="|"){e=document.createElement("div");e.className=c.dividerclass||"tedivider";i.appendChild(e)}else if(b=="font"){b=document.createElement("select");fonts=c.fonts||["Verdana","Arial","Georgia"];fl=fonts.length;e=0;b.className="tefont";b.onchange=new Function(this.n+'.ddaction(this,"fontname")');b.options[0]=new Option("Font",
"");for(e;e<fl;e++){g=fonts[e];b.options[e+1]=new Option(g,g)}i.appendChild(b)}else if(b=="size"){b=document.createElement("select");sizes=c.sizes||[1,2,3,4,5,6,7];g=sizes.length;e=0;b.className="tesize";b.onchange=new Function(this.n+'.ddaction(this,"fontsize")');for(e;e<g;e++){var m=sizes[e];b.options[e]=new Option(m,m)}i.appendChild(b)}else if(b=="style"){b=document.createElement("select");styles=c.styles||[["Style",""],["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],["Header 3","<h3>"],
["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]];g=styles.length;e=0;b.className="testyle";b.onchange=new Function(this.n+'.ddaction(this,"formatblock")');for(e;e<g;e++){m=styles[e];b.options[e]=new Option(m[0],m[1])}i.appendChild(b)}else if(d[b]){e=d[b];g=document.createElement("div");var p=e[2],m=e[0]*f;g.className=c.controlclass;g.style.backgroundPosition="0px "+m+"px";g.title=e[1];e=p=="a"?'.action("'+e[3]+'",0,'+(e[4]||0)+")":'.insert("'+e[4]+'","'+e[5]+'","'+e[3]+'")';g.onclick=
new Function(this.n+(b=="print"?".print()":e));g.onmouseover=new Function(this.n+".hover(this,"+m+",1)");g.onmouseout=new Function(this.n+".hover(this,"+m+",0)");i.appendChild(g);if(this.ie)g.unselectable="on"}}this.t.parentNode.insertBefore(h,this.t);this.t.style.width=this.i.width+"px";l.appendChild(this.t);l.appendChild(this.i);h.appendChild(l);this.t.style.display="none";if(c.footer){l=document.createElement("div");l.className=c.footerclass||"tefooter";if(c.toggle){i=c.toggle;j=document.createElement("div");
j.className=i.cssclass||"toggle";j.innerHTML=c.toggletext||"source";j.onclick=new Function(this.n+".toggle(0,this);return false");l.appendChild(j)}if(c.resize){i=c.resize;j=document.createElement("div");j.className=i.cssclass||"resize";j.onmousedown=new Function("event",this.n+".resize(event);return false");j.onselectstart=function(){return false};l.appendChild(j)}h.appendChild(l)}this.e=this.i.contentWindow.document;this.e.open();h="<html><head>";l=c.bodyid?' id="'+c.bodyid+'"':"";c.cssfile&&(h=
h+('<link rel="stylesheet" href="'+c.cssfile+'" />'));c.css&&(h=h+('<style type="text/css">'+c.css+"</style>"));h=h+("</head><body"+l+">"+(c.content||this.t.value));this.e.write(h+"</body></html>");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 class="apple-style-span">(.*)<\/span>/gi,"$1");b=b.replace(/ class="apple-style-span"/gi,"");b=b.replace(/<span style="">/gi,
"");b=b.replace(/<br>/gi,"<br />");b=b.replace(/<br ?\/?>$/gi,"");b=b.replace(/^<br ?\/?>/gi,"");b=b.replace(/(<img [^>]+[^\/])>/gi,"$1 />");b=b.replace(/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>");b=b.replace(/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,"<em>$1</em>");b=b.replace(/<u\b[^>]*>(.*?)<\/u[^>]*>/gi,'<span style="text-decoration:underline">$1</span>');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,
'<span style="$2"><$4>$3</$4></span>');b=b.replace(/<span style="font-weight: normal;?">(.*)<\/span>/gi,"$1");b=b.replace(/<span style="font-weight: bold;?">(.*)<\/span>/gi,"<strong>$1</strong>");b=b.replace(/<span style="font-style: italic;?">(.*)<\/span>/gi,"<em>$1</em>");b=b.replace(/<span style="font-weight: bold;?">(.*)<\/span>|<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>")}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>(.*)<\/strong>/gi,'<span style="font-weight: bold;">$1</span>');b=b.replace(/<em>(.*)<\/em>/gi,'<span style="font-weight: italic;">$1</span>')}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()}})();

View File

@ -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();
};
}
}());