// log all errors!!!
//$this->addEvent("ERROR", false, $str);
- /*
- if (!empty($_REQUEST['returnHTML']) ||
- (isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
- ) {
+
+ if ((isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))) {
header('Content-type: text/html');
echo "<HTML><HEAD></HEAD><BODY>";
echo $json->encodeUnsafe(array(
echo "</BODY></HTML>";
exit;
}
- */
+
echo $json->encode(array(
'success'=> false,
'data'=> array(),
require_once 'Services/JSON.php';
$json = new Services_JSON();
- /*
- if (!empty($_REQUEST['returnHTML']) ||
- (isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
+
+ if ( (isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
) {
header('Content-type: text/html');
echo "</BODY></HTML>";
exit;
}
- */
+
echo $json->encode(array('success'=> true, 'data' => $str));
exit;
function get($pi)
{
-
+ die("not yet");
require_once 'MTrack/Attachment.php';
require_once 'File/MimeType.php';
$y = new File_MimeType();
$this->mimetype = $y->fromFilename($this->file->name);
-
+ $ext = strtolower(array_pop(explode('.', $this->file->name)));
//$this->mimetype = mtrack_mime_detect($location, $this->file->name);
-
+ // special cases..
list($major) = explode('/', $this->mimetype, 2);
+ switch ($ext) {
+ case 'sql':
+ $major = 'text';
+ break;
+
+
+ }
+
// Obscure-ish special cases for mime types;
// some .y files look like old image format data
switch ($this->mimetype) {
$this->showEditBar = true;
}
-
+ $this->issue->images = $this->issue->images();
}
$this->issue->updated = $CS->id;
$this->issue->update($old);
+
+
+
+ if (!empty($_FILES['attachments'])) {
+ foreach ($_FILES['attachments']['name'] as $fileid => $name) {
+ $i = DB_DataObject::factory('Images');
+ $i->associate($this->issue);
+ $i->ontable = $this->issue->tableName();
+ $i->onid = $this->issue->id;
+ $i->created_by = $this->authUser->id;
+ $i->mimetype = $_FILES['attachments']["type"][$fileid];
+ $i->createFrom($_FILES['attachments']['tmp_name'][$fileid],$_FILES['attachments']['name'][$fileid]);
+
+ // MTrackAttachment::add("ticket:{$this->issue->tid}",
+ // $_FILES['attachments']['tmp_name'][$fileid],
+ // $_FILES['attachments']['name'][$fileid],
+ // $CS
+ // );
+ //}
+ }
+ }
+ /*
+ if (!count($this->error) && $this->id != 'new') {
+ require_once 'MTrack/Attachment.php';
+ MTrackAttachment::process_delete("ticket:{$this->issue->tid}", $CS);
+ }
+ */
+
+
+
+
+
$notify_query = "
(ontable='mtrack_ticket' and onid = {$this->issue->id})
OR
// if the owner has changed.. then we should add them to the watch list...
// MTrackWatch::watch_object('ticket', $this->issue->tid, $this->issue->owner);
- /*
- if (!count($this->error)) {
- if (!empty($_FILES['attachments'])) {
- require_once 'MTrack/Attachment.php';
- foreach ($_FILES['attachments']['name'] as $fileid => $name) {
-
- MTrackAttachment::add("ticket:{$this->issue->tid}",
- $_FILES['attachments']['tmp_name'][$fileid],
- $_FILES['attachments']['name'][$fileid],
- $CS
- );
- }
- }
- }
- if (!count($this->error) && $this->id != 'new') {
- require_once 'MTrack/Attachment.php';
- MTrackAttachment::process_delete("ticket:{$this->issue->tid}", $CS);
- }
- */
+
$this->jok("OK");
}
div#readonly-tkt-description {
clear: both;
- border: solid 1px #ccc;
- min-width: 57em;
- background-color: #ffc;
- padding: 0.25em 0.5em 0.5em 0.5em;
+ border: solid 1px #9F2B33;
+ min-width: 57em;
+ background-color: #CEC;
+ padding: 0.25em 0.5em 0.5em 0.5em;
+ margin-bottom: 10px;
}
div.button-float {
- background-color: #CC3;
+ background-color: #9F2B33;
width: 100%;
padding: 0;
clear: both;
MTrack.reportActiveURL = false;
MTrack.ticketValues = false;
// reload the report..
+
+
+ MTrack.doFormUpload({
+ url: baseURL+'/Ticket/' + $(this.form).attr('id').split('-').pop(),
+ form : this.form,
+ scope : this,
+ success : function(o) {
+
+ var res = jQuery.parseJSON( o.responseText );
+ if (!res.success) {
+ alert("Saving failed");
+ return;
+ }
+
+
+ MTrack.ajaxLoad( MTrack.currentURL, true);
+ }
+ });
+
+ /*
jQuery.ajax({
url: baseURL+'/Ticket/' + $('.mtrack-ticket-comment').attr('id').split('-').pop(),
type : 'POST',
}
});
+ */
});
})
+MTrack.urlDecode = function(string, overwrite){
+ if(!string || !string.length){
+ return {};
+ }
+ var obj = {};
+ var pairs = string.split('&');
+ var pair, name, value;
+ for(var i = 0, len = pairs.length; i < len; i++){
+ pair = pairs[i].split('=');
+ name = decodeURIComponent(pair[0]);
+ value = decodeURIComponent(pair[1]);
+ if(overwrite !== true){
+ if(typeof obj[name] == "undefined"){
+ obj[name] = value;
+ }else if(typeof obj[name] == "string"){
+ obj[name] = [obj[name]];
+ obj[name].push(value);
+ }else{
+ obj[name].push(value);
+ }
+ }else{
+ obj[name] = value;
+ }
+ }
+ return obj;
+};
+/**
+ * hack of Roo's upload form.
+ *
+ *
+MTrack.doFormUpload({
+ url: http://...
+ form : $(...)[0],
+ success : function() { }
+ })
+
+ *
+ */
+MTrack.doFormUpload_id = 0
+MTrack.doFormUpload = function(o){
+ var id = MTrack.doFormUpload_id++;
+ var frame = document.createElement('iframe');
+ frame.id = id;
+ frame.name = id;
+ //frame.className = 'x-hidden'; //<<<
+ frame.setAttribute('style', 'position:absolute;top:0;left:0;visibility:hidden;display:none;');
+ //if($.browser.msie){
+ // frame.src = Roo.SSL_SECURE_URL;
+ //}
+ document.body.appendChild(frame);
+
+ if($.browser.msie){
+ document.frames[id].name = id;
+ }
+
+ var form = o.form;
+ form.target = id;
+ form.method = 'POST';
+ form.enctype = form.encoding = 'multipart/form-data';
+ if(o.url){
+ form.action = o.url;
+ }
+
+
+
+ function cb(){
+ var r = { // bogus response object
+ responseText : '',
+ responseXML : null
+ };
+
+ r.argument = o ? o.argument : null;
+
+ try { //
+ var doc;
+ if($.browser.msie){
+ doc = frame.contentWindow.document;
+ }else {
+ doc = (frame.contentDocument || window.frames[id].document);
+ }
+ if(doc && doc.body){
+ r.responseText = doc.body.innerHTML;
+ }
+ if(doc && doc.XMLDocument){
+ r.responseXML = doc.XMLDocument;
+ }else {
+ r.responseXML = doc;
+ }
+ }
+ catch(e) {
+ // ignore
+ }
+ $(frame).unbind('load');
+
+
+ //this.fireEvent("requestcomplete", this, r, o);
+ o.success.call( o.scope, r, o);
+ //o.callback.call( Roo.callback(o.callback, o.scope, [o, true, r]);
+
+ setTimeout(function(){document.body.removeChild(frame);}, 100);
+ }
+ $(frame).load(function() {
+ cb.call(this);
+
+ });
+ form.submit();
+
+}
+<!--
+ This is the image viewer and comment ui
+
+ The edit ui is in ticket_edit.html
+-->
<div flexy:if="preview" class='ui-state-highlight ui-corner-all'>
</div>
- {attachmentsToHtml(issue):h}
-
+
+ <div flexy:if="issue.images" class='attachment-list'><b>Attachments</b>
+ <ul>
+ <li flexy:foreach="issue.images,img"><a class='attachment' href="{img.URL(#-1#,#/Images/#)}">{img.filename}
+ ({img.filesize}) added by {img.created_by_name} {img.created}</a>
+ <br/>
+
+ <a href="{img.URL(#-1#,#/Images/#)}">{img.toHTML(#150#):h}</a>
+ </li>
+ </ul>
+ </div>
+
+
<div id='readonly-tkt-description'>{issue.descriptionToHtml():h}</div>
<div class='button-float mtrack-view-editbar'>
'working_dir' => '/var/lib/mtrack', // this needs to be writable by web user..
'email_address' => 'mtrack@roojs.com', // email address that spam comes from.
'url' => 'http://www.roojs.com/mtrack/index.php', // url for the link on the emails.
+ ),
+ 'Pman' => array(
+ // where the images go.
+ 'storedir' => '/home/mtrack',
)
-
));