Created
October 25, 2012 00:22
-
-
Save luelista/3949777 to your computer and use it in GitHub Desktop.
Extend Taskfreak to support elRTE Wysiwyg Editor and Image upload via copy-paste ....... description of difference to regular taskFreak and SCREENSHOT here: http://test.teamwiki.de/taskfreak-mods/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (@constant('FRK_CONTEXT_ENABLE')) { | |
$objContextList = new ItemContextList(); | |
} | |
$objUserProjectList = new ProjectStats(); | |
$objUserProjectList->addOrder('statusKey ASC, name ASC'); | |
// $objUserProjectList->addWhere('ps.statusKey < 40'); | |
$objUserProjectList->addHaving('projectStatus_statusKey < 40'); | |
$objUserProjectList->loadList($objUser->id,(!$objUser->checkLevel(6))); | |
?> | |
<table cellpadding="2" cellspacing="0" border="0"> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['priority']; ?>:</th> | |
<td><?php | |
$objTemp = new ItemPriority(); | |
$objTemp->qSelect('priority',($objTask->priority)?$objTask->priority:3,'','','style="width:40px"'); | |
?></td> | |
<?php | |
if (@constant('FRK_CONTEXT_ENABLE')) { | |
?> | |
<th style="text-align:right"><?php echo $GLOBALS['langForm']['context']; ?>:</td> | |
<td><?php | |
$objContextList->qSelect('context',$objTask->context,'','width:100px'); | |
?></td> | |
<?php | |
} | |
?> | |
</tr> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['deadline']; ?>:</th> | |
<td<?php echo (@constant('FRK_CONTEXT_ENABLE'))?' colspan="3"':''; ?>> | |
<input type="text" name="deadlineDate" class="dead" id="freak_cal_d" value="<?php echo ($objTask->deadlineDate)?$objTask->getDte('deadlineDate','FRM'):''; ?>" /> | |
<img src="skins/<?php echo FRK_SKIN_FOLDER; ?>/images/cal.gif" id="freak_cal_b" style="cursor: pointer;" alt="Calendar" title="Date selector" /> | |
<span class="discrete"><?php echo $GLOBALS['langDate']['help']; ?></span> | |
</td> | |
</tr> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['project']; ?>:</th> | |
<td<?php echo (@constant('FRK_CONTEXT_ENABLE'))?' colspan="3"':''; ?>> | |
<span id="project_sel" style="display:block"><?php | |
$objUserProjectList->rReset(); | |
$objUserProjectList->qSelect('project','name',$objTask->project->id,'- - - - - - - - -','width:200px','onChange="freak_mp(this)"'); | |
if ($objUser->checkLevel(7)) { | |
?> <a href="javascript:freak_switch_protxt()" class="small">> <?php echo $GLOBALS['langForm']['project_new']; ?></a> | |
</span> | |
<span id="project_txt" style="display:none"><input type="text" name="project2" value="" style="width:200px"/> | |
<a href="javascript:freak_switch_prosel()" class="small">< <?php echo $GLOBALS['langForm']['project_list']; ?></a> | |
<?php | |
} | |
?> | |
</span> | |
</td> | |
</tr> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['title']; ?>:</th> | |
<td<?php echo (@constant('FRK_CONTEXT_ENABLE'))?' colspan="3"':''; ?>><input type="text" name="title" value="<?php echo ($objTask->title)?$objTask->getValue('title'):''; ?>" class="full" /></td> | |
</tr> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['user']; ?>:</th> | |
<td<?php echo (@constant('FRK_CONTEXT_ENABLE'))?' colspan="3"':''; ?>> | |
<select name="user" style="width:150px;"> | |
<option value="">-</option> | |
</select> | |
<?php | |
//$objUserList->qSelect('user','getName()',($objTask->member->id)?$objTask->member->id:$pDefaultUserId,'- not decided -','width:150px'); | |
?> | |
<span><input type="radio" name="showPrivate" value="0" <?php if ($objTask->showPrivate == 0) echo 'checked="checked" '; ?>/><label><?php echo $GLOBALS['langForm']['public']; ?></label></span> | |
<?php | |
if ($objUser->checkLevel(12)) { | |
?> | |
<span><input type="radio" name="showPrivate" value="1" <?php if ($objTask->showPrivate == 1) echo 'checked="checked" '; ?>/><label><?php echo $GLOBALS['langForm']['internal']; ?></label></span> | |
<?php | |
} else if ($objTask->showPrivate == 1) { | |
$objTask->showPrivate++; | |
} | |
?> | |
<span><input type="radio" name="showPrivate" value="2" <?php if ($objTask->showPrivate == 2) echo 'checked="checked" '; ?>/><label><?php echo $GLOBALS['langForm']['private']; ?></label></span> | |
</td> | |
</tr> | |
<tr> | |
<th><?php echo $GLOBALS['langForm']['status']; ?>:</th> | |
<td<?php echo (@constant('FRK_CONTEXT_ENABLE'))?' colspan="3"':''; ?>> | |
<select name="status" style="width:150px"> | |
<?php | |
for ($i = 0; $i <= FRK_STATUS_LEVELS; $i++) { | |
echo '<option value="'.$i.'"'; | |
if ($objTask->itemStatus->statusKey == $i) { | |
echo ' selected="selected"'; | |
} | |
echo '>'.$GLOBALS['langItemStatus'][$i].'</option>'; | |
echo "\n"; | |
} | |
?> | |
</select> | |
</td> | |
</tr> | |
</table> | |
<?php if (@constant('FRK_DESCRIPTION_ENABLE')) { ?> | |
<p> | |
<b><?php echo $GLOBALS['langForm']['description']; ?>:</b><br> | |
<textarea name="description" class="full"><?php echo $objTask->description; ?></textarea> | |
</p> | |
<?php } ?> | |
<p class="ctr"> | |
<input type="submit" value="<?php echo $GLOBALS['langForm']['save']; ?>" onClick="return freak_sav()" /> | |
| |
<input type="button" value="<?php echo $GLOBALS['langForm']['cancel']; ?>" onClick="freak_edit(0)" /> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************\ | |
* TaskFreak! * | |
* multi user * | |
****************************************************************************** | |
* Version: 0.6.3 * | |
* Authors: Stan Ozier <[email protected]> * | |
* License: http://www.gnu.org/licenses/gpl.txt (GPL) * | |
\****************************************************************************/ | |
var ff = ''; | |
var arrTr; | |
function freak_start() { | |
clk_date = new Date(); | |
clk_start = clk_date.getTime(); | |
gE('frk_status').src=frk_loading.src; | |
} | |
function freak_stop() { | |
gE('frk_status').src=frk_refresh.src; | |
} | |
function reconfirm(message) { | |
if (confirm(message)) { | |
return confirm("Are you sure?\nThis is, like, serious, you know!"); | |
} else { | |
return false; | |
} | |
} | |
function freak_pop_url(name,url,x,y) { | |
return window.open(url,name,'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=0,status=1,alwaysRaised=0,width='+x+',height='+y) | |
} | |
function freak_pop(name, x, y) { | |
return freak_pop_url(name,'',x,y); | |
} | |
function freak_sav() { | |
ff.mode.value = 'save'; | |
if (!ff.title.value) { | |
alert('please enter title!'); | |
return false; | |
} else { | |
freak_start(); | |
xajax_task_update_full(xajax.getFormValues("zappa")); | |
freak_edit(0); | |
return false; | |
} | |
} | |
function freak_clean() { | |
ff.elements['id'].value=''; | |
e = gE('fviewcontent'); | |
sD(gE('fviewload')); | |
hD(e); | |
/* | |
ff.priority.value = '3'; | |
ff.deadlineDate.value = ''; | |
ff.title.value=''; | |
if (ff.sProject.value > 0) { | |
for(i=0;i<ff.project.options.length;i++) { | |
if (ff.project.options[i].value == ff.sProject.value) { | |
ff.project.selectedIndex = i; | |
break; | |
} | |
} | |
} else { | |
ff.project.selectedIndex = 0; | |
} | |
g = gE('project_txt'); | |
if (isD(g)) { | |
ff.project2.value=''; | |
hD(g); | |
sD(gE('project_sel')); | |
} | |
if (ff.user) { | |
ff.user.selectedIndex = 0; | |
for (i=0; i<ff.user.length; i++) { | |
if (ff.user.options[i].value == frk_user) { | |
ff.user.selectedIndex = i; | |
break; | |
} | |
} | |
} | |
if (ff.description) { | |
ff.description.value=''; | |
} | |
if (ff.status) { | |
ff.status.selectedIndex = 0; | |
} | |
frk_prio = frk_priority; | |
if (ff.showPrivate.length < 2 && frk_prio == 2) | |
{ | |
frk_prio--; | |
} | |
ff.showPrivate[frk_prio].click(); | |
*/ | |
//freak_more('desc'); | |
} | |
function freak_rld() { | |
freak_clean(); | |
ff.mode.value = ''; | |
ff.method = 'GET'; | |
ff.submit(); | |
} | |
function freak_print() { | |
if (ff.mode) { | |
ff.mode.value = ''; | |
ff.method = 'GET'; | |
ff.action = 'print_list.php'; | |
ff.submit(); | |
ff.method= 'POST'; | |
ff.action = 'index.php'; | |
} else { | |
window.location.reload(true); | |
} | |
} | |
function freak_new() { | |
e = document.getElementById('fview'); | |
if (e) { | |
sD(e); | |
freak_clean(); | |
freak_start(); | |
xajax_task_load_edit(0); | |
} else { | |
e = gE('lnkRefresh'); | |
window.location.href=e.href; | |
} | |
} | |
function freak_sort(column) { | |
if (ff.sort.value == column) { | |
ff.dir.value = -ff.dir.value; | |
} else { | |
ff.sort.value=column; | |
ff.dir.value = 1; | |
} | |
ff.mode.value=''; | |
ff.submit(); | |
} | |
function freak_sts(id,status) { | |
q = true; | |
if (frk_status_close && status == frk_status) { | |
q = confirm(frk_status_close); | |
} | |
if (q == true) { | |
freak_start(); | |
xajax_task_update_status(id,status); | |
} | |
} | |
function freak_del(id) { | |
freak_start(); | |
freak_view(0); | |
xajax_task_delete(id); | |
} | |
function freak_del_remove(id) { | |
e = gE('taskSheet'); | |
rs = e.rows; | |
for(i=0;i<rs.length;i++) { | |
if (rs[i].id == id) { | |
e.deleteRow(i); | |
break; | |
} | |
} | |
} | |
function freak_adj(idx) { | |
vn = 'status'+idx; | |
if (!ff.elements[vn].checked) { | |
idx--; | |
} | |
for (i=1; i<=idx; i++) { | |
vn = 'status'+i; | |
ff.elements[vn].checked = true; | |
} | |
for (i=idx+1; i<6; i++) { | |
vn = 'status'+i; | |
ff.elements[vn].checked = false; | |
} | |
} | |
function freak_calc(sts) { | |
f = document.getElementById('vsts'); | |
f.innerHTML = (Math.round((sts * 100) / frk_status))+'% completed'; | |
} | |
function freak_view(id,tab) { | |
freak_clean(); | |
e = gE('fview'); | |
if (id == 0) { | |
hD(e); | |
freak_message(); | |
} else { | |
freak_start(); | |
sD(e); | |
if (tab) { | |
xajax_task_load_view(id,tab); | |
} else { | |
xajax_task_load_view(id); | |
} | |
} | |
} | |
function stripHtml(str) { | |
re = /<\S[^>]*>/g; | |
str = str.replace(re,""); | |
re = />/g; | |
str = str.replace(re,">"); | |
re = /</g; | |
str = str.replace(re,"<"); | |
re = /&/g; | |
if (str == '-') { str=''; } | |
return str.replace(re,"&"); | |
} | |
function freak_switch(field) { | |
g = gE(field+'_sel'); | |
if (isD(g)) { | |
hD(g); | |
ff.elements[field].selectedIndex = 0; | |
sD(gE(field+'_txt')); | |
} else { | |
ff.elements[field+'2'].value = ''; | |
hD(gE(field+'_txt')); | |
sD(g); | |
} | |
} | |
function freak_switch_protxt() { | |
freak_switch('project'); | |
freak_mp(0); | |
try { | |
document.forms[0].project2.focus(); | |
} catch (e) { } | |
} | |
function freak_switch_prosel() { | |
freak_switch('project'); | |
try { | |
document.forms[0].project.focus(); | |
} catch (e) { } | |
} | |
function freak_tab(tab) { | |
freak_body_edit(); | |
if (gE('vmore')) { | |
arr = new Array('desc','comm','hist'); | |
for (i=0;i<arr.length;i++) { | |
if (arr[i] != tab) { | |
e=gE('t'+arr[i]); | |
e.className=''; | |
} else { | |
e=gE('t'+arr[i]); | |
e.className='active'; | |
} | |
} | |
} | |
} | |
function freak_more(tab) { | |
freak_tab(tab); | |
if (id = ff.elements['id'].value) { | |
freak_start(); | |
xajax_task_load_more(id,tab); | |
} | |
} | |
function freak_more_scroll() { | |
e = gE('vmore'); | |
if (isD(e)) { | |
e.scrollTop = e.scrollHeight; | |
} | |
} | |
function freak_body_edit(id,body) { | |
e = gE('veditbody'); | |
if (id) { | |
if (typeof(id) != 'boolean') { | |
ff.elements['veditid'].value = id; | |
} | |
if (body) { | |
e.value = body; | |
} | |
ff.onsubmit = freak_body_submit; | |
hD(gE('vmore')); | |
sD(gE('vedit')); | |
} else { | |
if (e) { | |
e.value = ''; | |
ff.elements['veditid'].value = ''; | |
} | |
ff.onsubmit = function() { return true; }; | |
hD(gE('vedit')); | |
sD(gE('vmore')); | |
} | |
try { e.focus(); } catch(e) { ; } | |
} | |
function freak_comment_reply(id) { | |
if (ff.elements['id'].value) { | |
freak_body_edit(true); | |
} | |
} | |
function freak_comment_edit(id) { | |
if (ff.elements['id'].value) { | |
freak_start(); | |
xajax_task_comment_edit(id); | |
} | |
} | |
function freak_comment_delete(id) { | |
if (ff.elements['id'].value) { | |
freak_start(); | |
xajax_task_comment_delete(id); | |
} | |
} | |
function freak_body_submit() { | |
//alert('submiting taskId='+ff.elements['id'].value+' comment='+ff.elements['veditid'].value); | |
freak_start(); | |
xajax_task_update_comment(ff.elements['id'].value, ff.elements['veditid'].value, ff.elements['veditbody'].value); | |
return false; | |
} | |
function freak_edit(id) { | |
freak_clean(); | |
e = gE('fview'); | |
if (id == 0) { | |
hD(e); | |
} else { | |
freak_start(); | |
sD(e); | |
xajax_task_load_edit(id); | |
} | |
}; | |
function freak_edit_text(field,value) { | |
if (ff.elements[field]) { | |
ff.elements[field].value = value; | |
} | |
} | |
function freak_edit_select(field,value) { | |
sel=ff.elements[field]; | |
for (i=0;i<sel.options.length;i++) { | |
if (sel.options[i].value == value) { | |
sel.selectedIndex = i; | |
break; | |
} | |
} | |
} | |
function freak_edit_privacy(value) { | |
if (ff.showPrivate.length == 2 && value == 2) { | |
value = 1; | |
} | |
ff.showPrivate[value].click(); | |
} | |
function freak_edit_status(value) { | |
for (i=1; i<=5; i++) { | |
if (value >= i) { | |
ff.elements['status'+i].checked = true; | |
} else { | |
ff.elements['status'+i].checked = false; | |
} | |
} | |
} | |
function freak_edit_add_project_link(type,label,link) { | |
// does not work, can't figure it out | |
e0 = document.createElement('li'); | |
e1 = document.createElement('a'); | |
e1.href=link+'&show='+type; | |
e1.appendChild(document.createTextNode(label)); | |
e0.appendChild(e1); | |
return e0; | |
} | |
function freak_edit_add_project(id,name,link,future,past,all) { | |
ff.project.appendChild(opto(id,name)); | |
e = document.createElement('li'); | |
e.className = 'more'; | |
e0 = document.createElement('a'); | |
e0.href=link+'&show=today'; | |
e0.appendChild(document.createTextNode(name)); | |
e.appendChild(e0); | |
e1 = document.createElement('ul'); | |
// e1_1 = freak_edit_add_project_link('future',future,link); | |
e1_1 = document.createElement('li'); | |
e1_1_1 = document.createElement('a'); | |
e1_1_1.href=link+'&show=future'; | |
e1_1_1.appendChild(document.createTextNode(future)); | |
e1_1.appendChild(e1_1_1); | |
e1.appendChild(e1_1); | |
// e1_2 = freak_edit_add_project_link('past',past,link); | |
e1_2 = document.createElement('li'); | |
e1_2_1 = document.createElement('a'); | |
e1_2_1.href=link+'&show=past'; | |
e1_2_1.appendChild(document.createTextNode(past)); | |
e1_2.appendChild(e1_2_1); | |
e1.appendChild(e1_2); | |
//e1.appendChild(freak_edit_add_project_link('all',all,link)); | |
e1_3 = document.createElement('li'); | |
e1_3_1 = document.createElement('a'); | |
e1_3_1.href=link+'&show=all'; | |
e1_3_1.appendChild(document.createTextNode(all)); | |
e1_3.appendChild(e1_3_1); | |
e1.appendChild(e1_3); | |
e.appendChild(e1); | |
document.getElementById('nav_projects').appendChild(e); | |
} | |
function freak_mp_reset() { | |
for (i=ff.user.length-1; i>0; i--) { | |
ff.user.removeChild(ff.user.lastChild); | |
} | |
} | |
function freak_mp(sel) { | |
freak_start(); | |
ff.user.disabled=true; | |
if (sel) { | |
sel = sel.options[sel.selectedIndex].value; | |
} | |
xajax_task_load_users(sel); | |
} | |
function freak_mp_add(value,label) { | |
ff.user.appendChild(opto(value,label)); | |
} | |
function freak_mp_default(value) { | |
if (!value) { | |
value = frk_user; | |
} | |
for (i=0; i < ff.user.length; i++) { | |
if (ff.user.options[i].value == value) { | |
ff.user.selectedIndex=i; | |
break; | |
} | |
} | |
ff.user.disabled=false; | |
} | |
function freak_message(str) { | |
e = gE('message'); | |
if (!str) { | |
hD(e); | |
} else { | |
if (!e) { | |
e = document.createElement('div'); | |
e.id = 'message'; | |
e.className = ''; | |
wE(e,str); | |
gE('header').appendChild(e); | |
} else { | |
e.className = ''; | |
wE(e,str); | |
sD(e); | |
} | |
window.setTimeout('freak_message()',2000); | |
} | |
} | |
function freak_error(str) { | |
e = gE('message'); | |
if (!str) { | |
hD(e); | |
} else { | |
if (!e) { | |
e = document.createElement('div'); | |
e.id = 'message'; | |
e.className = 'error'; | |
wE(e,str); | |
gE('header').appendChild(e); | |
} else { | |
e.className = 'error'; | |
wE(e,str); | |
sD(e); | |
} | |
window.setTimeout('freak_message()',2500); | |
} | |
} | |
/* rows highlight on mouse over and click */ | |
function startList() { | |
if (document.all&&document.getElementById) { | |
elems = document.getElementsByTagName("ul"); | |
for(var i = 0; i < elems.length; i++) | |
{ | |
elem = elems[i]; | |
id = elem.id; | |
cls = elem.className; | |
if (id == 'nav' || cls == 'level1' || cls =='level2') { | |
for (m=0; m<elem.childNodes.length; m++) { | |
node = elem.childNodes[m]; | |
if (node.nodeName=="LI") { | |
node.onmouseover=function() { | |
this.className+=" over"; | |
} | |
node.onmouseout=function() { | |
this.className=this.className.replace(" over", ""); | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
function listenClick(e) { | |
// this function makes clicking area bigger on drop down menu | |
var targ; | |
if (!e) var e = window.event; | |
if (e.target) targ = e.target; | |
else if (e.srcElement) targ = e.srcElement; | |
if (targ.nodeType == 3) // defeat Safari bug | |
targ = targ.parentNode; | |
if (targ.tagName == 'TD' && !targ.onclick) { | |
var str = targ.parentNode; | |
if (!isNaN(str.id) && (str.id > 0)) { | |
freak_view(str.id); | |
} | |
} | |
} | |
function freak_highlist() { | |
ff = document.zappa; | |
arrTr = document.getElementsByTagName("tr"); | |
for (i=0, j=arrTr.length; i < j; i++) { | |
if (arrTr[i].className != 'nothanks') | |
{ | |
/* arrTr[i].onclick = function() { | |
if (this.className == 'high') { | |
this.className = ''; | |
} else { | |
this.className = 'high'; | |
} | |
} */ | |
arrTr[i].onmouseover = function() { | |
if (this.className != 'high') { | |
this.className = 'hover'; | |
} | |
} | |
arrTr[i].onmouseout = function() { | |
if (this.className != 'high') { | |
this.className = ''; | |
} | |
} | |
} | |
} | |
} | |
/* clock */ | |
var clk_date = new Date(); | |
var clk_start = 0; | |
function show_date() { | |
clk_date = new Date(); | |
if (clk_date.getSeconds() == 0) { // every minute | |
clk_intvl = clk_date.getTime() - clk_start; | |
if (frk_reload && (clk_intvl > (frk_reload * 60000)) && (!document.forms[0].elements['id'].value)) { | |
try { | |
freak_rld(); | |
} catch (e) {} | |
} | |
} | |
str = clk_date.toLocaleString(); | |
wE(gE('userdate'),str); | |
setTimeout("show_date()",1000); | |
} | |
function keep_alive() { | |
freak_start(); | |
xajax_staying_alive(); | |
} | |
function start_clock() { | |
clk_date = new Date(); | |
clk_start = clk_date.getTime(); | |
show_date(); | |
setTimeout("show_date()",1000); | |
} | |
/* init */ | |
function freak_init() { | |
if (fm = document.getElementById("message")) { | |
self.setTimeout("fm.style.display='none'",2000); // 2 secs | |
} | |
startList(); | |
freak_stop(); | |
if (frk_stay_alive) { | |
self.setTimeout('keep_alive()',300000); // 5 minutes | |
} | |
} | |
//--> | |
//-->MW WYSIWYG EDITOR | |
// | |
tWiki_loadScriptOnDemand=function(scriptFileSpec, onFinished) { | |
var headID = document.getElementsByTagName("head")[0]; | |
var req = document.createElement("SCRIPT"); | |
headID.appendChild(req); | |
req.src = scriptFileSpec; | |
if(onFinished)req.onload=onFinished; | |
return req; | |
} | |
window.tWiki_loadCSSFile=function(styleFileSpec) { | |
var headID = document.getElementsByTagName("head")[0]; | |
var cssNode = document.createElement('link'); | |
cssNode.type = 'text/css'; | |
cssNode.rel = 'stylesheet'; | |
cssNode.href = styleFileSpec; | |
cssNode.media = 'screen'; | |
headID.appendChild(cssNode); | |
} | |
tWiki_loadScriptOnDemand("http://static.teamwiki.net/inc/elrte-1.3/js/jquery-1.6.1.min.js"); | |
tWiki_loadScriptOnDemand("http://static.teamwiki.net/js/new_global.js"); | |
tWiki_loadScriptOnDemand("http://static.teamwiki.net/inc/elrte-1.3/js/jquery-ui-1.8.13.custom.min.js"); | |
tWiki_loadScriptOnDemand("http://static.teamwiki.net/inc/elrte-1.3/js/elrte.min.js"); | |
tWiki_loadCSSFile("http://static.teamwiki.net/inc/elrte-1.3/css/smoothness/jquery-ui-1.8.13.custom.css"); | |
tWiki_loadCSSFile("http://static.teamwiki.net/inc/elrte-1.3/css/elrte.min.css"); | |
function MW_INIT_WYSIWYG_EDITOR() { | |
window.ddUpload_clipboardPaste = function(event){ | |
var items = event.originalEvent.clipboardData.items; | |
console.log(JSON.stringify(items)); // will give you the mime types | |
var f = items[0].getAsFile(); | |
var filename = "paste-" + ((new Date()).getTime()) + ".png"; | |
if (f.type && f.type.substr(0,5) == 'image') { | |
var reader = new FileReader(); | |
reader.onload=(function(theFile) { | |
return function(e) { | |
myEditor.selection.deleteContents(); | |
myEditor.selection.insertHtml('<img src="' + e.target.result + '" style="opacity:0.5" id="' + filename + '">'); | |
uploadFileAsAsset(f,filename,function(progress){myEditor.statusbar.text("Uploading image... "+progress);}, | |
function(data) { | |
var imgTag=myEditor.doc.getElementById(filename); | |
imgTag.setAttribute('src', data.url); | |
imgTag.style.opacity="inherit"; | |
}); | |
}; | |
})(f); | |
reader.readAsDataURL(f); | |
} | |
} | |
window.uploadFileAsAsset=function(f,filename,onProgress,onDone) { | |
var reader = new FileReader(); | |
reader.onload=(function(theFile) { | |
return function(e) { | |
var xmlHttpRequest = new XMLHttpRequest(); | |
xmlHttpRequest.open("POST", "/upload_image.php?", true); | |
var dashes = '--', boundary = 'mwTfWysiwygEdImgUploader', crlf = "\r\n"; | |
//Post with the correct MIME type (If the OS can identify one) | |
var filetype = theFile.type == '' ? 'application/octet-stream' : theFile.type; | |
//Build a HTTP request to post the file | |
var data = dashes + boundary + crlf + "Content-Disposition: form-data;" + "name=\"file\";" + "filename=\"" + unescape(encodeURIComponent(filename)) + "\"" + crlf + "Content-Type: " + filetype + crlf + crlf + e.target.result + crlf + dashes + boundary + dashes; | |
xmlHttpRequest.upload.addEventListener("progress", function(e){ if (e.lengthComputable) { | |
onProgress(parseInt((e.loaded / e.total) * 100)+"%"); } }, false); | |
xmlHttpRequest.addEventListener("readystatechange", function (event) { | |
if (xmlHttpRequest.readyState == 4) { onDone(JSON.parse(xmlHttpRequest.responseText)) } }, false); | |
xmlHttpRequest.setRequestHeader("Content-Type", "multipart/form-data;boundary=" + boundary); | |
xmlHttpRequest.sendAsBinary(data); //Send the binary data | |
}; | |
})(f); | |
reader.readAsBinaryString(f); | |
} | |
elRTE.prototype.options.panels.web2pyPanel = [ | |
'bold', 'italic', 'underline', 'forecolor', 'justifyleft', 'justifyright', | |
'justifycenter', 'formatblock', 'insertorderedlist', 'insertunorderedlist', | |
'link', 'image', 'flash' | |
]; | |
elRTE.prototype.options.toolbars.web2pyToolbar = ['web2pyPanel']; | |
var opts = { | |
cssClass : 'el-rte', | |
// lang : 'ru', | |
height : 250, | |
toolbar : 'web2pyToolbar', | |
cssfiles : ['css/elrte-inner.css'], | |
allowSource:false | |
} | |
var $ed = $('textarea[name=description]'); | |
//var html_code=$ed.val(); | |
$ed.elrte(opts); | |
//$ed.elrte('val', html_code); | |
//hier kommt der monkeyPatcher ;) | |
var _freak_sav_internal = window.freak_sav; | |
window.freak_sav = function() { | |
$ed.elrte('updateSource'); | |
_freak_sav_internal(); | |
} | |
window.myEditor = $ed.get(0).elrte; | |
$(myEditor.doc).bind("paste", function(e) { | |
ddUpload_clipboardPaste(e); | |
}); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* File: SimpleImage.php | |
* Author: Simon Jarvis | |
* Copyright: 2006 Simon Jarvis | |
* Date: 08/11/06 | |
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php | |
* | |
* 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: | |
* http://www.gnu.org/licenses/gpl.html | |
* | |
*/ | |
class SimpleImage { | |
var $image; | |
var $image_type; | |
function load($filename) { | |
$image_info = getimagesize($filename); | |
$this->image_type = $image_info[2]; | |
if( $this->image_type == IMAGETYPE_JPEG ) { | |
$this->image = imagecreatefromjpeg($filename); | |
} elseif( $this->image_type == IMAGETYPE_GIF ) { | |
$this->image = imagecreatefromgif($filename); | |
} elseif( $this->image_type == IMAGETYPE_PNG ) { | |
$this->image = imagecreatefrompng($filename); | |
} | |
} | |
function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { | |
if( $image_type == IMAGETYPE_JPEG ) { | |
imagejpeg($this->image,$filename,$compression); | |
} elseif( $image_type == IMAGETYPE_GIF ) { | |
imagegif($this->image,$filename); | |
} elseif( $image_type == IMAGETYPE_PNG ) { | |
imagepng($this->image,$filename); | |
} | |
if( $permissions != null) { | |
chmod($filename,$permissions); | |
} | |
} | |
function output($image_type=IMAGETYPE_JPEG) { | |
if( $image_type == IMAGETYPE_JPEG ) { | |
imagejpeg($this->image); | |
} elseif( $image_type == IMAGETYPE_GIF ) { | |
imagegif($this->image); | |
} elseif( $image_type == IMAGETYPE_PNG ) { | |
imagepng($this->image); | |
} | |
} | |
function getWidth() { | |
return imagesx($this->image); | |
} | |
function getHeight() { | |
return imagesy($this->image); | |
} | |
function resizeToHeight($height) { | |
$ratio = $height / $this->getHeight(); | |
if ($ratio>1) return; | |
$width = $this->getWidth() * $ratio; | |
$this->resize($width,$height); | |
} | |
function resizeToWidth($width) { | |
$ratio = $width / $this->getWidth(); | |
if ($ratio>1) return; | |
$height = $this->getheight() * $ratio; | |
$this->resize($width,$height); | |
} | |
function resizeCropSquare($a) { | |
if ($this->getWidth() > $this->getHeight()) { | |
$ratio = $a / $this->getHeight(); | |
$width = $this->getWidth() * $ratio; | |
$this->resize($width,$a,$a,$a); | |
} else { | |
$ratio = $a / $this->getWidth(); | |
$height = $this->getheight() * $ratio; | |
$this->resize($a,$height,$a,$a); | |
} | |
} | |
function scale($scale) { | |
$width = $this->getWidth() * $scale/100; | |
$height = $this->getheight() * $scale/100; | |
$this->resize($width,$height); | |
} | |
function resizeToMaximum ($maxWidth, $maxHeight){ | |
$proportionsoll = $maxWidth / $maxHeight; | |
$proportionist = $this->getWidth() / $this->getheight(); | |
if ($proportionsoll < $proportionist) { | |
$width = $maxWidth; | |
$ratio = $width / $this->getWidth(); | |
$height = $this->getheight() * $ratio; | |
$this->resize($width,$height); | |
} else { | |
$height = $maxHeight; | |
$ratio = $height / $this->getheight(); | |
$width = $this->getWidth() * $ratio; | |
$this->resize($width,$height); | |
} | |
} | |
/* | |
function resize($width,$height) { | |
$new_image = imagecreatetruecolor($width, $height); | |
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); | |
$this->image = $new_image; | |
} | |
*/ | |
function resize($width,$height,$cropWidth=null,$cropHeight=null) { | |
if (!$cropWidth) $cropWidth = $width; if (!$cropHeight) $cropHeight = $height; | |
$deltaX = ($width-$cropWidth)/2; $deltaY = ($height-$cropHeight)/2; | |
$new_image = imagecreatetruecolor(intval($cropWidth), intval($cropHeight)); | |
if( $this->image_type == IMAGETYPE_GIF || $this->image_type == IMAGETYPE_PNG ) { | |
$current_transparent = imagecolortransparent($this->image); | |
if($current_transparent != -1) { | |
$transparent_color = imagecolorsforindex($this->image, $current_transparent); | |
$current_transparent = imagecolorallocate($new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); | |
imagefill($new_image, 0, 0, $current_transparent); | |
imagecolortransparent($new_image, $current_transparent); | |
} elseif( $this->image_type == IMAGETYPE_PNG) { | |
imagealphablending($new_image, false); | |
$color = imagecolorallocatealpha($new_image, 0, 0, 0, 127); | |
imagefill($new_image, 0, 0, $color); | |
imagesavealpha($new_image, true); | |
} | |
} | |
imagecopyresampled($new_image, $this->image, 0, 0, $deltaX, $deltaY, $width, $height, $this->getWidth(), $this->getHeight()); | |
$this->image = $new_image; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0px; | |
padding: 0px; | |
margin-bottom: 6px; | |
background-color: #fff; | |
} | |
div#horiz { | |
width: 500px; | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
text-align: left; | |
} | |
div#header { | |
position: fixed; | |
top: 0px; | |
left: 0px; | |
margin: 0px; | |
padding: 0px; | |
width: 100%; | |
height: 53px; | |
border-bottom: 2px solid #999; | |
z-index: 50; | |
} | |
body>div#header { | |
position: fixed; | |
} | |
#header1 { | |
position: relative; | |
top: 0px; | |
left: 0px; | |
height: 30px; | |
padding: 0px; | |
margin: 0px; | |
background-color: #666; | |
border-bottom: 1px solid #fff; | |
} | |
#user { | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
color: #fff; | |
float: right; | |
text-align: right; | |
padding-right: 10px; | |
} | |
#user a:link, #user a:visited { | |
color: #fff; | |
text-decoration: none; | |
} | |
#user a:hover { | |
text-decoration: underline; | |
} | |
#userlogout { | |
float: right; | |
padding: 6px 10px 0px 0px; | |
} | |
#username { | |
font-size: 12px; | |
font-weight: bold; | |
} | |
#userdate { | |
font-size: 9px; | |
} | |
#header2 { | |
position: relative; | |
top: 0px; | |
left: 0px; | |
height: 21px; | |
background-color: #933; | |
border-bottom: 1px solid #333; | |
voice-family: "\"}\""; | |
voice-family: inherit; | |
height: 22px; | |
z-index: 100; | |
} | |
.ign0 { | |
/* anti-BUG IE5 */ | |
} | |
#rightmenu { | |
float: right; | |
padding: 3px 10px 0px 0px; | |
height: 17px; | |
} | |
#rightmenu { | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
font-size: 10px; | |
font-weight: bold; | |
color: #fff; | |
} | |
#rightmenu select { | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
font-size: 9px; | |
font-weight: normal; | |
border: 0px solid #933; | |
} | |
#rightmenu a:link, #rightmenu a:visited { | |
color: #fff; | |
text-decoration: none; | |
} | |
#rightmenu a:hover { | |
text-decoration: underline; | |
} | |
#menu { | |
float: left; | |
width: 300px; | |
} | |
#menu ul { /* all lists */ | |
padding: 0px; | |
margin: 0px 14px 0px; | |
list-style: none; | |
} | |
#menu li { /* all list items */ | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
font-size: 12px; | |
font-weight: bold; | |
float: left; | |
position: relative; | |
color: #fff; | |
margin: 0px; | |
padding: 4px 30px 4px 3px; | |
z-index: 55; | |
cursor: default; | |
} | |
#menu li:hover, #menu li.over { | |
background-color:#fff; | |
color:#933; | |
border-bottom: 1px solid #dA8a8a; | |
} | |
#menu li a { | |
display: block; | |
color: #fff; | |
padding: 1px 0px 1px 0px; | |
text-decoration: none; | |
} | |
#menu li:hover ul li:hover a, #menu li.over ul li.over a { | |
display: block; | |
color:#933; | |
} | |
#menu li:hover ul li:hover ul li a { | |
color:#fff; | |
} | |
#menu li:hover ul li:hover ul li:hover a { | |
color:#933; | |
} | |
#menu li ul { /* second-level lists */ | |
display: none; | |
position: absolute; | |
margin: 4px -4px 0px; | |
top: 18px; | |
left: 4px; | |
z-index: 60; | |
} | |
#menu li>ul { | |
top: auto; | |
left: auto; | |
} | |
#menu li:hover ul.level1, #menu li.over ul.level1 { | |
display: block; | |
top: 19px; | |
left: 4px; | |
} | |
#menu li ul li { | |
position: relative; | |
width: 126px; | |
margin: 0px; | |
padding: 2px 3px 2px 3px; | |
font-size: 11px; | |
background-color: #c66; | |
border-left: 1px solid #dA8a8a; | |
border-right: 1px solid #dA8a8a; | |
border-bottom: 1px solid #dA8a8a; | |
cursor: pointer; | |
voice-family: "\"}\""; | |
voice-family: inherit; | |
width: 120px; | |
} | |
.ign1 { | |
/* anti-BUG IE5 */ | |
} | |
#menu li ul li ul { /* third-level lists */ | |
display: none; | |
position: absolute; | |
margin: 0px 0px; | |
top: 0px; | |
left: 126px; | |
z-index: 70; | |
} | |
#menu li ul li:hover ul, #menu li ul li.over ul { | |
display: block; | |
} | |
#menu ul li li.more { | |
voice-family: "\"}\""; | |
voice-family: inherit; | |
background-image: url(../images/more.png); | |
background-position: right; | |
background-repeat:no-repeat; | |
padding-right: 12px; | |
width: 111px; | |
} | |
.ign2 { | |
/* anti-BUG IE5 */ | |
} | |
#menu ul li ul li ul li { | |
border-left: 1px solid #e6b3b3; | |
border-right: 1px solid #e6b3b3; | |
border-bottom: 1px solid #e6b3b3; | |
background-color: #dA8a8a; | |
} | |
#container { | |
position: relative; | |
top: 66px; | |
width: 98%; | |
left: 1%; | |
z-index: 10; | |
} | |
#filters { | |
position: absolute; | |
top: -66px; | |
right: 10px; | |
width: 500px; | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
text-align: right; | |
} | |
#filters select { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: x-small; | |
} | |
#filters input { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: x-small; | |
width: 30px; | |
background-color: #ccc; | |
border: 1px solid #666; | |
} | |
#filters input.fff { | |
width: 14px; | |
} | |
#content { | |
} | |
#content h4 { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
margin: 12px 0px 9px 0px; | |
} | |
#content p { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
margin: 6px 0px 3px 0px; | |
} | |
/* TABS */ | |
div.tabmenu { | |
clear: both; | |
margin: 6px 0px 0px 0px; | |
border: 1px solid #fff; | |
} | |
div.tabmenu ul { | |
margin: 0px; | |
padding: 0px; | |
list-style: none; | |
} | |
div.tabmenu li { | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
font-size: x-small; | |
position: relative; | |
float: left; | |
margin: 0px 0px -1px 6px; | |
} | |
div.tabmenu li a:link, div.tabmenu li a:visited { | |
display: block; | |
padding: 3px 6px 3px 6px; | |
font-weight: bold; | |
color: #999; | |
border-top: 1px solid #ccc; | |
border-left: 1px solid #ccc; | |
border-right: 1px solid #ccc; | |
text-decoration: none; | |
background-color: #eee; | |
} | |
div.tabmenu li a:hover { | |
color: #666; | |
background-color: #fff; | |
} | |
div.tabmenu li.active a:link, div.tabmenu li.active a:visited { | |
color: #999; | |
border-top: 1px solid #999; | |
border-left: 1px solid #999; | |
border-right: 1px solid #999; | |
border-bottom: 1px solid #fff; | |
background-color: #fff; | |
} | |
div.tabmenu li.active a:hover { | |
color: #666; | |
} | |
div.tabcontent { | |
clear : both; | |
border: 1px solid #999; | |
padding: 1px; | |
margin: 0px; | |
text-align: left; | |
} | |
div.tabcontent h4 { | |
margin: 0px; | |
padding: 3px; | |
background-color: #ccc; | |
border: 1px solid #999; | |
} | |
div.tabcontent p { | |
margin: 0px; | |
padding: 3px; | |
background-color: #eee; | |
border: 1px solid #999; | |
border-top: none; | |
} | |
div.tabcontent div.sep { | |
margin-bottom: 6px; | |
} | |
/* TASK LIST */ | |
table.sheet { | |
border-top: 1px solid #999; | |
border-left: 1px solid #999; | |
} | |
fieldset a:link, fieldset a:visited, table.sheet a:link, table.sheet a:visited { | |
color: #00c; | |
text-decoration: none; | |
} | |
table.sheet tr.disabled a:link, table.sheet tr.disabled a:visited { | |
color: #666; | |
} | |
fieldset a:hover, table.sheet a:hover, table.sheet tr.disabled a:hover { | |
text-decoration: underline; | |
} | |
table.sheet tr { | |
background-color: #eee; | |
} | |
table.sheet tr.hover { | |
background-color: #fcc; | |
} | |
table.sheet tr.high { | |
background-color: #f99; | |
} | |
table.sheet tr.disabled td { | |
color: #666; | |
} | |
table.sheet th { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
text-align: left; | |
background-color: #ccc; | |
border-right: 1px solid #999; | |
border-bottom: 1px solid #999; | |
} | |
table.sheet th.sortable:hover, table.sheet th.sortable.hover { | |
cursor: pointer; | |
background-color: #ccf; | |
} | |
table.sheet th.cc { | |
text-align: center; | |
} | |
table.sheet th.rr { | |
text-align: right; | |
} | |
table.sheet td { | |
font-family:Arial, Helvetica, sans-serif; | |
font-size: small; | |
border-right: 1px solid #999; | |
border-bottom: 1px solid #999; | |
} | |
table.sheet th.act, table.sheet td.act { | |
text-align: center; | |
} | |
table.sheet input, table.sheet textarea { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: 12px; | |
background-color: #fff; | |
width: 95%; | |
} | |
table.sheet input#bsave { | |
width: 27px; | |
} | |
table.sheet input.fff { | |
width: 12px; | |
} | |
table.sheet td.sts0 { | |
font-size: 7px; | |
width: 8px; | |
} | |
table.sheet td.sts1 { | |
font-size: 8px; | |
background-color: #00C000; | |
width: 8px; | |
} | |
table.sheet td.sts2 { | |
font-size: 8px; | |
background-color: #90FF00; | |
width: 8px; | |
} | |
table.sheet td.sts3 { | |
font-size: 8px; | |
background-color: #FFE000; | |
width: 8px; | |
} | |
table.sheet td.sts4 { | |
font-size: 8px; | |
background-color: #FF6000; | |
width: 8px; | |
} | |
table.sheet td.sts5 { | |
font-size: 8px; | |
background-color: #E00000; | |
width: 8px; | |
} | |
table.sheet td.prio { | |
text-align: center; | |
} | |
table.sheet td.prio span, #vprio span { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: 10px; | |
color: #fff; | |
text-align: center; | |
padding: 2px 4px 1px 4px; | |
width: 14px; | |
} | |
table.sheet td.ctsh { | |
text-align: center; | |
} | |
table.sheet td.ctlg { | |
font-size: x-small; | |
} | |
table.sheet td.ctsh span { | |
font-family: "Courier New", Courier, monospace; | |
font-size: 10px; | |
color: #fff; | |
text-align: center; | |
padding: 2px 4px 1px 4px; | |
width: 14px; | |
} | |
span.dlate { | |
color: #C00; | |
} | |
span.dday { | |
font-weight: bold; | |
} | |
span.ddone { | |
color: #999; | |
} | |
span.dtodo { | |
color: #696; | |
} | |
p.small, span.small { | |
font-size: x-small; | |
} | |
small, span.discrete { | |
font-size: x-small; | |
color: #999; | |
} | |
a.small { | |
font-size: x-small; | |
color: #33c; | |
text-decoration: none; | |
} | |
a.small:hover { | |
color: #00f; | |
} | |
/* panels */ | |
#message { | |
position: absolute; | |
top: 54px; | |
left: 50%; | |
margin-left: -200px; | |
width: 400px; | |
padding: 5px; | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
background-color: #ffc; | |
border: 1px solid #666; | |
text-align: center; | |
z-index: 40; | |
} | |
#message.error { | |
background-color: #fcc; | |
} | |
#fview { | |
position: absolute; | |
top: 54px; | |
left: 50%; | |
margin-left: -250px; | |
width: 500px; | |
padding: 5px; | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
background-color: #fff; | |
border: 1px solid #666; | |
text-align: left; | |
z-index: 20; | |
} | |
table.setting { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
width: 100%; | |
} | |
#fview th { | |
color: #666; | |
font-weight: normal; | |
text-align: left; | |
} | |
table.setting th { | |
color: #666; | |
font-weight: normal; | |
text-align: right; | |
width: 15%; | |
} | |
#fview td, #fview td, table.setting td { | |
color: #000; | |
text-align: left; | |
} | |
#vctxt span { | |
font-weight: bold; | |
} | |
#fviewmenu { | |
float: right; | |
text-align: right; | |
} | |
#fviewmenu a:link, #fviewmenu a:visited { | |
color: #ccc; | |
text-decoration: none; | |
} | |
#fviewmenu a:hover { | |
color: #999; | |
} | |
#fviewmenu img { | |
vertical-align: middle; | |
margin: 0px 0px 6px 0px; | |
} | |
#fviewload, #fviewcontent .ctr { | |
text-align: center; | |
} | |
#fviewload img { | |
margin: 160px 0px 170px 0px; | |
} | |
#fview div.flabel { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: x-small; | |
color: #bbb; | |
} | |
#fview div.flabel2 { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: x-small; | |
color: #ccc; | |
float: left; | |
margin: 3px 20px 3px 0px; | |
} | |
#fprio { | |
float: left; | |
width: 120px; | |
height: 32px; | |
margin-left: 3px; | |
} | |
#fdead, #fctxt { | |
float: left; | |
width: 120px; | |
height: 32px; | |
} | |
#fproj { | |
clear: left; | |
float: left; | |
width: 400px; | |
height: 32px; | |
margin-left: 3px; | |
} | |
#ftitl { | |
clear: left; | |
float: left; | |
width: 492px; | |
height: 32px; | |
margin-left: 3px; | |
} | |
#fuser { | |
clear: both; | |
float: left; | |
width: 240px; | |
height: 36px; | |
margin-left: 3px; | |
margin-bottom: 6px; | |
} | |
#fvisi { | |
float: left; | |
width: 252px; | |
height: 36px; | |
} | |
#fsts { | |
margin: 3px 0px 6px 3px; | |
} | |
#vsts { | |
float: left; | |
} | |
/* form */ | |
form { | |
margin: 0px; | |
padding: 0px; | |
} | |
#vedit { | |
position: relative; | |
height: 170px; | |
padding: 3px; | |
display: none; | |
} | |
#vmore { | |
position: relative; | |
height: 270px; | |
width: 99%; | |
padding: 3px; | |
overflow: auto; | |
} | |
#vmore div.vheader { | |
font-size: 12px; | |
color: #999; | |
padding: 2px; | |
border-bottom: 1px solid #999; | |
} | |
#vmore div.vaction { | |
font-size: x-small; | |
float: right; | |
} | |
#vmore div.vaction a:link, #vmore div.vaction a:visited, #vmore div.vnewaction a:link, #vmore div.vnewaction a:visited { | |
text-decoration: none; | |
} | |
#vmore div.vaction a:hover, #vmore div.vnewaction a:hover { | |
text-decoration: underline; | |
} | |
#vmore div.vbody { | |
font-size: 12px; | |
padding: 2px 2px 10px 2px; | |
} | |
#vedit textarea { | |
width: 485px; | |
height: 140px; | |
} | |
#vmore #vempty { | |
padding: 30px 2px 10px 2px; | |
text-align: center; | |
color: #ccc; | |
} | |
#vmore #vhist { | |
position: relative; | |
left: 50%; | |
margin-left: -170px; | |
width: 340px; | |
} | |
#vmore #vhist th { | |
padding: 2px; | |
border-bottom: 1px solid #999; | |
} | |
#vmore #vhist td { | |
padding: 2px; | |
border-bottom: 1px solid #eee; | |
} | |
#footer { | |
margin: 12px 0px 100px 0px; | |
text-align: center; | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: xx-small; | |
color: #666; | |
} | |
#footer.butt { | |
position: absolute; | |
margin: 0px; | |
bottom: 10px; | |
width: 100%; | |
} | |
#footer a { | |
color: #666; | |
} | |
input.prio { | |
width: 30px; | |
} | |
input.dead { | |
width: 100px; | |
} | |
input.full { | |
width: 415px; | |
} | |
textarea.full { | |
width: 415px; | |
height: 150px; | |
} | |
/* fieldsets */ | |
form label { | |
cursor: pointer; | |
} | |
fieldset { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: small; | |
} | |
fieldset legend { | |
font-size: medium; | |
font-weight: bold; | |
text-align: left; | |
} | |
fieldset p { | |
padding: 2px; | |
} | |
form input.fMiText { | |
width:50%; | |
} | |
form input.fText { | |
width:90%; | |
} | |
form textarea.fText { | |
width:90%; | |
height:100px; | |
} | |
form textarea.fTextBig { | |
width:90%; | |
height:200px; | |
} | |
/* boxes */ | |
.box { | |
margin: 0px 5px 15px 5px; | |
padding: 15px; | |
} | |
h1.printheader { | |
display: none; | |
} | |
.printbox { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: .9em; | |
margin: 5px 0px 15px 0px; | |
padding: 8px; | |
border: 1px solid #333; | |
} | |
div.printbox h2 { | |
font-family: Verdana, Arial, Helvetica, sans-serif; | |
font-size: 1.1em; | |
margin: 0px 0px 15px 0px; | |
padding: 0px; | |
} | |
div.printbox div.description { | |
font-family: Arial, Helvetica, sans-serif; | |
font-size: .9em; | |
margin: 9px 0px 0px 0px; | |
} | |
.mellow { | |
background-color: #ff9; | |
border: 1px dotted #666; | |
} | |
.blueish { | |
background-color: #ccf; | |
border: 1px dotted #666; | |
} | |
.greenish { | |
background-color: #cfc; | |
border: 1px dotted #666; | |
} | |
.redish { | |
background-color: #f99; | |
border: 1px dotted #666; | |
} | |
.error { | |
background-color: #f99; | |
border: 1px dotted #666; | |
} | |
.tznError { | |
display: block; | |
font-size: x-small; | |
color: #c00; | |
} | |
.compulsory { | |
color: #c00; | |
} | |
.ctr { | |
text-align: center; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include '_common.php'; | |
/* --- INIT ----------------------------------------------------------- */ | |
include 'SimpleImage.class.php'; | |
if (is_uploaded_file($_FILES["file"]["tmp_name"])) { | |
$img = new SimpleImage(); | |
$img->load($_FILES["file"]["tmp_name"]); | |
$img->resizeToMaximum(450, 450); | |
$fn=time()."_".$_FILES["file"]["name"].".jpg"; | |
$img->save("./uploads/$fn"); | |
echo json_encode(array("success"=>true,"filename"=>$fn,"url"=>"/uploads/$fn")); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/****************************************************************************\ | |
* TaskFreak! * | |
* multi user * | |
****************************************************************************** | |
* Version: 0.6.3 * | |
* Authors: Stan Ozier <[email protected]> * | |
* License: http://www.gnu.org/licenses/gpl.txt (GPL) * | |
****************************************************************************** | |
* This file is part of "TaskFreak! multi user" program. * | |
* * | |
* TaskFreak! multi user 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. * | |
* * | |
* TaskFreak! multi user 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 program; if not, write to the Free Software * | |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * | |
\****************************************************************************/ | |
include './_include.php'; | |
define('FRK_LANGUAGE',FRK_DEFAULT_LANGUAGE); | |
define('FRK_CONTEXT_LONG',FRK_DEFAULT_CONTEXT_LONG); | |
include PRJ_CLASS_PATH.'tzn_generic.php'; | |
include PRJ_CLASS_PATH.TZN_DB_CLASS; | |
include PRJ_CLASS_PATH.'tzn_user.php'; | |
include PRJ_CLASS_PATH.'pkg_member.php'; | |
include PRJ_CLASS_PATH.'pkg_project.php'; | |
function ajaxCheckSession(&$objResponse) { | |
$objUser = new Member(); | |
if ($objUser->isLogged()) { | |
// already logged in | |
} else if ($objUser->checkAutoLogin()) { | |
// session timeout but auto logged in | |
} else { | |
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/freak.php'; | |
$_SESSION['tznMessage'] = $GLOBALS['langMessage']['session_expired']; | |
$objResponse->addRedirect('login.php'); | |
return false; | |
} | |
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/common.php'; | |
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/freak.php'; | |
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/options.php'; | |
define('FRK_SKIN_FOLDER',FRK_DEFAULT_SKIN_FOLDER); | |
return $objUser; | |
} | |
function ajaxLoadTask($id,$level,$userCanToo,&$objUser,&$objResponse) { | |
$objResponse = new xajaxResponse(); | |
if (!($objUser = ajaxCheckSession($objResponse))) { | |
return false; | |
} | |
$objTask = new ItemStats(); | |
$objTask->setUid($id); | |
if ($objTask->load($objUser->id)) { | |
//error_log('task loaded:'.$id.', user '.$objUser->id.' has position '.$objTask->position); | |
if ($objUser->checkLevel(13) || $objUser->checkLevel(14) || $objTask->checkRights($objUser->id,$level,$userCanToo)) { | |
return $objTask; | |
} | |
} | |
$objResponse->addScriptCall('freak_error',$GLOBALS['langMessage']['not_found_or_denied']); | |
return false; | |
} | |
function ajaxLoadTaskComment($id,$level,&$objUser,&$objTask,&$objResponse) { | |
$objResponse = new xajaxResponse(); | |
if (!($objUser = ajaxCheckSession($objResponse))) { | |
return false; | |
} | |
$objComment = new ItemComment(); | |
$objComment->setUid($id); | |
if ($objComment->load()) { | |
$objTask = new ItemStats(); | |
$objTask->setUid($objComment->itemId); | |
if ($objTask->load($objUser->id)) { | |
if ($objComment->checkRights($objUser->id,$level,$objTask) | |
|| $objUser->checkLevel(14) | |
|| $objTask->checkRights($objUser->id,0)) | |
{ | |
return $objComment; | |
} | |
} | |
} | |
return false; | |
} | |
function ajaxLoadDetails($objTask,$what,&$objResponse,$objUser=null) { | |
$str = ''; | |
switch ($what) { | |
case 'desc': | |
if ($objTask->description) { | |
$str = $objTask->getDescription(); | |
} else { | |
$str = '<div id="vempty">-'.$GLOBALS['langTaskDetails']['description_none'].'-</div>'; | |
} | |
$objResponse->addAssign('vmore','innerHTML', $str); | |
break; | |
case 'comm': | |
if (!$objTask->checkRights($objUser->id,1,true)) { | |
$objResponse->addAssign('vmore','innerHTML','<div id="vempty">-'.$GLOBALS['langTaskDetails']['comments_no_access'].'-</div>'); | |
break; | |
} | |
$objCommentList = new ItemComment(); | |
$objCommentList->addWhere('itemId='.$objTask->id); | |
$objCommentList->addOrder('postDate '.(@defined('FRK_DEFAULT_COMMENT_ORDER')?FRK_DEFAULT_COMMENT_ORDER:'ASC')); | |
$objCommentList->loadList(); | |
if ($objCommentList->rMore()) { | |
while ($objComment = $objCommentList->rNext()) { | |
$str .= '<div id="vcomm'.$objComment->id.'">' | |
.'<div class="vheader">' | |
.'<div class="vaction">'; | |
if ($objTask->checkRights($objUser->id,2,true)) { | |
$str .= '<a href="javascript:freak_comment_reply()">' | |
.$GLOBALS['langTaskDetails']['comments_reply'].'</a>'; | |
} else { | |
$str .= $GLOBALS['langTaskDetails']['comments_reply'].'</a>'; | |
} | |
$str .= ' | '; | |
if ($objComment->checkRights($objUser->id,3,$objTask)) { | |
$str .= '<a href="javascript:freak_comment_edit('.$objComment->id.')">' | |
.$GLOBALS['langTaskDetails']['comments_edit'].'</a>'; | |
} else { | |
$str .= $GLOBALS['langTaskDetails']['comments_edit']; | |
} | |
$str .= ' | '; | |
if ($objComment->checkRights($objUser->id,4,$objTask)) { | |
$str .='<a href="javascript:freak_comment_delete('.$objComment->id.')" ' | |
.'onClick="return confirm(\''.$GLOBALS['langTaskDetails']['comments_delete_confirm'].'\')">' | |
.$GLOBALS['langTaskDetails']['comments_delete'].'</a>'; | |
} else { | |
$str .= $GLOBALS['langTaskDetails']['comments_delete']; | |
} | |
$str .= '</div>' | |
.$objComment->getDtm('postDate','SHT').' ' | |
.$GLOBALS['langTaskDetails']['comments_by'] | |
.' '.$objComment->member->getName().'</div>' | |
.'<div class="vbody">'.$objComment->f('body').'</div></div>'; | |
} | |
$objResponse->addAssign('vmore','innerHTML', $str); | |
$objResponse->addAssign('ecomm'.$objTask->id,'innerHTML',$objCommentList->rTotal()); | |
if ((!defined('FRK_DEFAULT_COMMENT_ORDER')) || (@constant('FRK_DEFAULT_COMMENT_ORDER') == 'ASC')) { | |
$objResponse->addScript('freak_more_scroll()'); | |
} | |
} else { | |
$str .= '<div id="vempty">-'.$GLOBALS['langTaskDetails']['comments_none'].'-'; | |
if ($objTask->checkRights($objUser->id,2,true)) { | |
$str .= '<div class="vnewaction"><a href="javascript:freak_body_edit(true)">' | |
.$GLOBALS['langTaskDetails']['comments_new'].'</a></div></div>'; | |
} | |
$objResponse->addAssign('vmore','innerHTML', $str); | |
$objResponse->addAssign('ecomm'.$objTask->id,'innerHTML','0'); | |
} | |
break; | |
case 'hist': | |
$objStatusList = new ItemStatus(); | |
$objStatusList->addWhere('itemId='.$objTask->id); | |
$objStatusList->addOrder('statusDate ASC'); | |
$objStatusList->loadList(); | |
$str = '<table id="vhist"><tr>' | |
.'<th>'.$GLOBALS['langTaskDetails']['history_date'].'</th>' | |
.'<th>'.$GLOBALS['langTaskDetails']['history_user'].'</th>' | |
.'<th>'.$GLOBALS['langTaskDetails']['history_what'].'</th></tr>'; | |
while ($objStatus = $objStatusList->rNext()) { | |
$str .= '<tr><td>'.$objStatus->getDtm('statusDate','SHT',$objUser->timeZone).'</td>' | |
.'<td>'.$objStatus->member->getName().'</td>' | |
.'<td>'.$GLOBALS['langItemStatus'][$objStatus->statusKey].'</td></tr>'; | |
} | |
$str .= '</table>'; | |
$objResponse->addAssign('vmore','innerHTML', $str); | |
break; | |
} | |
} | |
function task_load_edit($id) { | |
$objResponse = new xajaxResponse(); | |
if ($id) { | |
// loading task | |
if ($objTask = ajaxLoadTask($id,7,false,$objUser,$objResponse)) { | |
ob_start(); | |
include PRJ_INCLUDE_PATH.'html/xajax_panel_edit.php'; | |
$str = ob_get_contents(); | |
ob_clean(); | |
$objResponse->addScriptCall('freak_edit_text','id',$objTask->id); | |
$objResponse->addAssign('fviewcontent','innerHTML',$str); | |
/* | |
$objResponse->addScriptCall('freak_edit_select','priority',$objTask->priority); | |
if (@constant('FRK_CONTEXT_ENABLE')) { | |
} | |
$objResponse->addScriptCall('freak_edit_text','deadlineDate',$objTask->getDte('deadlineDate',SHT)); | |
$objResponse->addScriptCall('freak_edit_text','title',$objTask->title); | |
$objResponse->addScriptCall('freak_edit_text','description',$objTask->description); | |
$objResponse->addScriptCall('freak_edit_select','project',$objTask->project->id); | |
$objResponse->addScriptCall('freak_edit_privacy',$objTask->showPrivate); | |
task_load_users_inside($objTask->project->id,$objUser,$objResponse); | |
$objResponse->addScriptCall('freak_edit_select','user',$objTask->member->id); | |
$objResponse->addScriptCall('freak_edit_select','status',$objTask->itemStatus->statusKey); | |
*/ | |
task_load_users_inside($objTask->project->id,$objUser,$objResponse); | |
$objResponse->addScriptCall('freak_edit_select','user',$objTask->member->id); | |
$objResponse->addScript('Calendar.setup({});'); | |
$objResponse->addScript('hD(gE("fviewload"))'); | |
$objResponse->addScript('sD(gE("fviewcontent"))'); | |
} else { | |
$objResponse->addScriptCall('freak_message',$GLOBALS['langMessage']['not_found_or_denied']); | |
} | |
} else if ($objUser = ajaxCheckSession($objResponse)) { | |
// form to create new task | |
$objTask = new Item(); | |
if ($_SESSION['linkItems']) { | |
preg_match('/sProject=([0-9]+)&/',$_SESSION['linkItems'],$matches); | |
$objTask->project->id = $matches[1]; | |
} | |
ob_start(); | |
include PRJ_INCLUDE_PATH.'html/xajax_panel_edit.php'; | |
$str = ob_get_contents(); | |
ob_clean(); | |
$objResponse->addScriptCall('freak_edit_text','id','0'); | |
$objResponse->addAssign('fviewcontent','innerHTML',$str); | |
task_load_users_inside(0,$objUser,$objResponse); | |
$objResponse->addScriptCall('freak_edit_select','user',$objUser->id); | |
$objResponse->addScript('Calendar.setup({});'); | |
$objResponse->addScript('hD(gE("fviewload"))'); | |
$objResponse->addScript('sD(gE("fviewcontent"))'); | |
} | |
$objResponse->addScript('MW_INIT_WYSIWYG_EDITOR()'); | |
$objResponse->addScript('freak_label()'); | |
$objResponse->addScript('freak_stop()'); | |
$objResponse->addScript('document.forms[0].priority.focus()'); | |
return $objResponse->getXML(); | |
} | |
function task_load_view($id,$tab='desc') { | |
$objResponse = new xajaxResponse(); | |
if ($objTask = ajaxLoadTask($id,0,false,$objUser,$objResponse)) { | |
// -todo- show private status | |
ob_start(); | |
include PRJ_INCLUDE_PATH.'html/xajax_panel_view.php'; | |
$str = ob_get_contents(); | |
ob_clean(); | |
$objResponse->addScriptCall('freak_edit_text','id',$objTask->id); | |
$objResponse->addAssign('fviewcontent','innerHTML',$str); | |
$tab = ($tab)?$tab:'desc'; | |
$objResponse->addScriptCall('freak_tab',$tab); | |
ajaxLoadDetails($objTask,$tab,$objResponse,$objUser); | |
if ($objUser->checkLevel(14) || $objTask->checkRights($objUser->id,7)) { | |
// can edit | |
$objResponse->addScript('sD(gE("fviewedit"))'); | |
} else { | |
$objResponse->addScript('hD(gE("fviewedit"))'); | |
} | |
if ($objUser->checkLevel(14) || $objTask->checkRights($objUser->id,9)) { | |
// can delete | |
$objResponse->addScript('sD(gE("fviewdelete"))'); | |
} else { | |
$objResponse->addScript('hD(gE("fviewdelete"))'); | |
} | |
} | |
$objResponse->addScript('hD(gE("fviewload"))'); | |
$objResponse->addScript('sD(gE("fviewcontent"))'); | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_load_more($id,$what) { | |
$objResponse = new xajaxResponse(); | |
if ($objTask = ajaxLoadTask($id,0,false,$objUser,$objResponse)) { | |
ajaxLoadDetails($objTask,$what,$objResponse,$objUser); | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_load_users($projectId) { | |
$objResponse = new xajaxResponse(); | |
if ($objUser = ajaxCheckSession($objResponse)) { | |
task_load_users_inside($projectId,$objUser,$objResponse); | |
$objResponse->addScriptCall('freak_mp_default',''); | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_load_users_inside($projectId,$objUser,&$objResponse) { | |
$objResponse->addScript('freak_mp_reset()'); | |
if ($projectId) { | |
$objMemberList = new MemberProject(); | |
$objMemberList->addWhere($objMemberList->gTable().".projectId='".intval($projectId)."'"); | |
$objMemberList->addOrder('level DESC, firstName ASC'); | |
$objMemberList->loadList(); | |
if ($objMemberList->rMore()) { | |
while ($objItem = $objMemberList->rNext()) { | |
$objResponse->addScriptCall('freak_mp_add',$objItem->member->id,$objItem->member->getName()); | |
} | |
} | |
} else { | |
$objMemberList = new Member(); | |
if (!$objUser->checkLevel(1)) { | |
$objMemberList->addWhere($objMemberList->gTable().'.memberId='.$objUser->id); | |
} | |
$objMemberList->loadList(); | |
if ($objMemberList->rMore()) { | |
while ($objItem = $objMemberList->rNext()) { | |
$objResponse->addScriptCall('freak_mp_add',$objItem->id,$objItem->getName()); | |
} | |
} | |
} | |
} | |
function task_update_status($id,$status) { | |
$objResponse = new xajaxResponse(); | |
if ($objTask = ajaxLoadTask($id,8,true,$objUser,$objResponse)) { | |
$newStatus = intval($status); | |
if ($newStatus != $objTask->itemStatus->statusKey) { | |
$objTask->setStatus($newStatus,$objUser->id); | |
if ($newStatus == FRK_STATUS_LEVELS) { | |
// task is completed | |
if (@constant('FRK_COMPLETE_DEADLINE') == TRUE) { | |
// update deadline to current date | |
$objTask->setDte('deadlineDate','NOW'); | |
$objTask->update('deadlineDate'); | |
} | |
} | |
if (!@constant('FRK_DEFAULT_NO_DEADLINE_KEEP') && ($newStatus == FRK_STATUS_LEVELS)) { | |
// completed task should disapear from task list view | |
$objResponse->addScriptCall('freak_del_remove',$id); | |
} else { | |
// show new status | |
for ($i = 0; $i < FRK_STATUS_LEVELS; $i++) { | |
$j = ($i < $newStatus)?(FRK_STATUS_LEVELS - $i):0; | |
$objResponse->addAssign('est'.($i+1).$objTask->id,'className','sts'.$j); | |
} | |
// update date? | |
if (($newStatus == FRK_STATUS_LEVELS) && (@constant('FRK_COMPLETE_DEADLINE') == TRUE)) { | |
$objResponse->addAssign('edead'.$objTask->id,'innerHTML',$objTask->getDeadline(true)); | |
} | |
} | |
$objResponse->addScriptCall('freak_message',$GLOBALS['langMessage']['done_status']); | |
} | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_update_full($data) { | |
$objResponse = new xajaxResponse(); | |
if (!($objUser = ajaxCheckSession($objResponse))) { | |
return false; | |
} | |
$objTask = new ItemStats(); | |
$objTask->setUid($data['id']); | |
if ($objTask->load($objUser->id)) { | |
$objOldTask = $objTask->cloneme(); | |
$pUserCanEdit = ($objUser->checkLevel(14) || $objTask->checkRights($objUser->id,7)); | |
} | |
$objTask->setAuto($data,null,'_setDirect'); | |
// project | |
$objProject = new Project(); | |
if ($objUser->checkLevel(7) && $data['project2']) { | |
// create new project on the fly | |
$objProject->set('name',$data['project2']); | |
$objProject->add(0,$objUser->id); | |
//$objResponse->addScript('freak_rld()'); | |
// update project list | |
$link = Tzn::concatUrl($_SESSION['linkItems'],'sProject='.$objProject->id); | |
$link = Tzn::concatUrl($link,'show='); | |
if ($objTask->isLoaded() && $pUserCanEdit) { | |
$objResponse->addScriptCall('freak_edit_add_project', | |
$objProject->id,$objProject->name,$link,$GLOBALS['langMenu']['future_tasks'], | |
$GLOBALS['langMenu']['past_tasks'],$GLOBALS['langMenu']['all_tasks']); | |
} | |
// associate task to new project | |
$objTask->project =& $objProject; | |
} else if ($tmpId = intval($data['project'])) { | |
$pCanAddTask = false; | |
if ($objUser->checkLevel(8)) { | |
// user is administrator | |
$objProject->setUid($tmpId); | |
if ($objProject->load()) { | |
$pCanAddTask = true; | |
} | |
} else { | |
// user is not administrator | |
// need to check rights to access project | |
$objMemberProject = new MemberProject(); | |
if ($objMemberProject->loadPosition($tmpId,$objUser->id)) | |
{ | |
$pCanAddTask = $objMemberProject->checkRights(6); | |
$objProject =& $objMemberProject->project; | |
} | |
} | |
if ($pCanAddTask) { | |
// associate to existing project | |
$objTask->project =& $objProject; | |
} | |
} else { | |
// no project | |
$objTask->project->name = '-'; | |
$objTask->project->id = 0; | |
} | |
// user(s) | |
$objMember = new Member(); | |
$objTask->member =& $objMember; | |
if ($tmpId = intval($data['user'])) { | |
$objMember->setUid($tmpId); | |
$objMember->load(); | |
} | |
// status | |
$newStatus = intval($data['status']); | |
$oldStatus = -1; | |
// update DB (if compulsory fields ok) | |
if ($objTask->check()) { | |
if ($objTask->isLoaded() && $pUserCanEdit) { | |
// update database | |
$objTask->update(); | |
$pMessage = $langMessage['done_updated']; | |
// check status changes | |
$oldStatus = intval($objOldTask->itemStatus->statusKey); | |
if ($objTask->sameSame($objOldTask)) { | |
// update list (dynamic) | |
/* | |
$objResponse->addAssign('eprio'.$objTask->id,'innerHTML','<span class="pr'.$objTask->priority | |
.'" title="'.$_GLOBALS['arrPriorities'][$objItem->priority].'">'.$objTask->priority.'</span>'); | |
if (@constant('FRK_CONTEXT_ENABLE')) { | |
$objResponse->addAssign('ectxt'.$objTask->id,'innerHTML',$objTask->getContext(@constant('FRK_CONTEXT_LONG'))); | |
} | |
*/ | |
$objResponse->addAssign('eproj'.$objTask->id,'innerHTML',$objTask->project->get('name','-')); | |
$strTitle = $objTask->get('title'); | |
if ($objTask->description) { | |
$strTitle .= '<img src="skins/'.FRK_SKIN_FOLDER | |
.'/images/desc.png" width="16" height="16" align="absmiddle" border="0" alt="" />'; | |
} | |
switch ($objTask->showPrivate) { | |
case 1: | |
$strTitle .= '<img src="skins/'.FRK_SKIN_FOLDER | |
.'/images/priv1.png" width="12" height="16" align="absmiddle" border="0" alt="" />'; | |
break; | |
case 2: | |
$strTitle .= '<img src="skins/'.FRK_SKIN_FOLDER | |
.'/images/priv2.png" width="12" height="16" align="absmiddle" border="0" alt="" />'; | |
break; | |
} | |
$objResponse->addAssign('ectxt'.$objTask->id,'innerHTML',$objTask->getContext(@constant('FRK_CONTEXT_LONG'))); | |
$objResponse->addAssign('etitl'.$objTask->id,'innerHTML',$strTitle); | |
$objResponse->addAssign('euser'.$objTask->id,'innerHTML',$objTask->member->getShortName('-')); | |
/* | |
$objResponse->addAssign('edead'.$objTask->id,'innerHTML',$objTask->member->getDeadline()); | |
*/ | |
for ($i = 0; $i < FRK_STATUS_LEVELS; $i++) { | |
$j = ($i < $newStatus)?(FRK_STATUS_LEVELS - $i):0; | |
$objResponse->addAssign('est'.($i+1).$objTask->id,'className','sts'.$j); | |
} | |
// -TODO- remove task if not in context or project | |
// -TODO- resort list | |
$objResponse->addScriptCall('freak_message',$GLOBALS['langMessage']['done_updated']); | |
} else { | |
// reload page | |
$_SESSION['tznMessage'] = $GLOBALS['langMessage']['done_updated']; | |
$objResponse->addScript('freak_rld()'); | |
} | |
} else if ($objUser->checkLevel(11)) { | |
$objTask->authorId = $objUser->id; | |
// add item to DB (if user has rights to do it) | |
$objTask->add(); | |
// reload page | |
$_SESSION['tznMessage'] = $GLOBALS['langMessage']['done_added']; | |
$objResponse->addScript('freak_rld()'); | |
} else { | |
$oldStatus = $newStatus; | |
} | |
// update status | |
if ($oldStatus != $newStatus) { | |
$objTask->setStatus($newStatus,$objUser->id); | |
if ($newStatus == FRK_STATUS_LEVELS) { | |
// task is completed | |
if (@constant('FRK_COMPLETE_DEADLINE') == TRUE) { | |
// update deadline to current date | |
$objTask->setDte('deadlineDate','NOW'); | |
$objTask->update('deadlineDate'); | |
} | |
if (!@constant('FRK_DEFAULT_NO_DEADLINE_KEEP')) { | |
// task should disapear from task list view | |
$objResponse->addScriptCall('freak_del_remove',$data['id']); | |
} | |
} | |
} | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_delete($id) { | |
$objResponse = new xajaxResponse(); | |
if ($objTask = ajaxLoadTask($id,9,false,$objUser,$objResponse)) { | |
$objTask->delete(); | |
$objResponse->addScriptCall('freak_del_remove',$id); | |
$objResponse->addScriptCall('freak_message',$GLOBALS['langMessage']['done_deleted']); | |
} else { | |
$objResponse->addScriptCall('freak_error',$GLOBALS['langMessage']['not_found_or_denied']); | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_comment_edit($id) { | |
$objResponse = new xajaxResponse(); | |
if ($objComment = ajaxLoadTaskComment($id,3,$objUser,$objTask,$objResponse)) { | |
//$objResponse->addAssign('veditbody','value',$objComment->body); | |
$objResponse->addScriptCall('freak_body_edit',$objComment->id,$objComment->body); | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_comment_delete($id) { | |
$objResponse = new xajaxResponse(); | |
if ($objComment = ajaxLoadTaskComment($id,4,$objUser,$objTask,$objResponse)) { | |
$objComment->delete(); | |
$objResponse->addRemove('vcomm'.$id); | |
$objCommentList = new ItemComment(); | |
$objCommentList->addWhere('itemId='.$objComment->itemId); | |
$objResponse->addAssign('ecomm'.$objTask->id,'innerHTML',$objCommentList->loadCount()); | |
$objResponse->addScriptCall('freak_message',$GLOBALS['langMessage']['done_comment_deleted']); | |
} | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function task_update_comment($taskId,$commId,$body) { | |
$objResponse = new xajaxResponse(); | |
$str = $GLOBALS['langMessage']['operation_failed']; | |
//error_log('receiving... task='.$taskId.' comment='.$commId.' body='.$body); | |
if ($commId && ($objComment = ajaxLoadTaskComment($commId,3,$objUser,$objTask,$objResponse))) { | |
// update comment | |
$objComment->set('body',$body); | |
if ($objComment->update('body')) { | |
$str = $GLOBALS['langMessage']['done_comment_updated']; | |
} | |
} else if ($objUser = ajaxCheckSession($objResponse)) { | |
if ($body && ($objTask = ajaxLoadTask($taskId,2,true,$objUser,$objResponse))) { | |
// add new comment | |
$objComment = new ItemComment(); | |
$objComment->set('body',$body); | |
$objComment->itemId = $objTask->id; | |
$objComment->member->id = $objUser->id; | |
if ($objComment->add()) { | |
$str = $GLOBALS['langMessage']['done_comment_added']; | |
} | |
} | |
} | |
if ($objUser->id) { | |
ajaxLoadDetails($objTask,'comm',$objResponse,$objUser); | |
} | |
$objResponse->addScript('freak_body_edit()'); | |
$objResponse->addScriptCall('freak_message',$str); | |
$objResponse->addScript('freak_stop()'); | |
return $objResponse->getXML(); | |
} | |
function staying_alive() { | |
// error_log('oh oh oh, staying alive, staying alive...!'); | |
$objResponse = new xajaxResponse(); | |
if ($objUser = ajaxCheckSession($objResponse)) { | |
// you're cool | |
$objResponse->addScript("self.setTimeout('keep_alive()',300000);"); // call again in 5 minutes | |
$objResponse->addScript('freak_stop()'); | |
} else { | |
// user has been disconnected for some reason | |
$_SESSION['tznMessage'] = $GLOBALS['langMessage']['session_expired']; | |
$objResponse->addRedirect('login.php'); | |
} | |
return $objResponse->getXML(); | |
} | |
session_start(); | |
require_once ('xajax/xajax.inc.php'); | |
$xajax = new xajax('xajax.task.php'); | |
$xajax->registerFunction("task_load_view"); | |
$xajax->registerFunction("task_load_more"); | |
$xajax->registerFunction("task_load_edit"); | |
$xajax->registerFunction("task_load_users"); | |
$xajax->registerFunction("task_update_status"); | |
$xajax->registerFunction("task_update_full"); | |
$xajax->registerFunction("task_delete"); | |
$xajax->registerFunction("task_comment_edit"); | |
$xajax->registerFunction("task_comment_delete"); | |
$xajax->registerFunction("task_update_comment"); | |
$xajax->registerFunction("staying_alive"); | |
$xajax->processRequests(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment