Resolve client-side upload a File button (template included).

Discussion in 'Developing, APIs and extending' started by Narpas, Feb 7, 2012.

  1. Narpas

    Narpas New Member

    Hi all.

    I've made an update to the viewticket, the client-side form which allows them to seemingly seamlessly post files to their ticket (see below. Changes in green), as well as view files posted on the ticket. This was to match our old in house ticketing system's feature.

    Here's my problem: This is my first change to our Resolve system, and I don't have a good idea on how to implement a similar system to the staff-side. I have been disallowed from modifying the PHP directly, as we want to keep up with each release and not have to re-implement my code every time. Is there a good way using templates or addons to hide posts that say, "Attached File Hidden Post Do Not Display" or do something of that ilk?

    Thank you!

    Edit: I previously had a javascript function to check to see if a file was attached to the post, but I could never get it to correctly block posts without files.
  2. Narpas

    Narpas New Member

    -- SNIP --

    <div class="AttachmentsNotes">
    <table class="hlineheader"><tbody><tr><th rowspan="2" nowrap="">Attached Files </th><td>&nbsp;</td></tr><tr><td class="hlinelower">&nbsp;</td></tr></tbody></table>
    <{foreach key=_ticketPostID item=_ticketPost from=$_ticketPostContainer}>
    <{if $_ticketPost[hasattachments] == '1'}>
    <div class="ticketpostcontentsattachments">
    <{foreach key=_attachmentID item=_ticketAttachment from=$_ticketPost[attachments]}>
    <div class="ticketpostcontentsattachmentitem" onclick="javascript: PopupSmallWindow('<{$_ticketAttachment[link]}>');" style="background-image: URL('<{$_themePath}>images/<{$_ticketAttachment[icon]}>');">
    &nbsp;
    <div class="AttachmentTitle"><{$_ticketAttachment[name]}></div >
    <span class="AttachmentName"> Posted by: <{$_ticketPost[fullname]}>,</span > <span class="AttachmentTime"><{$_ticketPost[posttitle]}></span >
    <br/>
    </div>
    <{/foreach}>
    </div>
    <{/if}>
    <{/foreach}>
    <br/>
    <form method="post" action="<{$_baseName}><{$_templateGroupPrefix}>/Tickets/Ticket/Reply/<{$_ticketContainer[ticketid]}>" name="TicketReplyMiniForm" enctype="multipart/form-data" >
    <div class="ticketpaddingcontainer">
    <textarea cols="25" rows="1" id="replycontentsAttach" class="swifttextareawide" name="replycontents" style="display:none">Attached File Hidden Post Do Not Display</textarea></td>
    <input name="ticketattachments[]" id="AttachedFileMiniForm" type="file" size="20" class="swifttextlarge"> <input class="rebuttonwide2" value="Attach File" type="submit" name="button" /></div>
    </div>
    </form>
    </div>

    <div class="ticketpostsholder">
    <{foreach key=_ticketPostID item=_ticketPost from=$_ticketPostContainer}>
    <{if $_ticketPost[contents] !="Attached File Hidden Post Do Not Display"}>
    <div class="ticketpostcontainer">
    <div class="ticketpostbar">
    <div class="ticketpostbarname"><{$_ticketPost[fullname]}></div>
    <{if $_ticketPost[designation] != ''}><div class="ticketpostbardesignation"><{$_ticketPost[designation]}></div><{/if}>
    <div class="<{$_ticketPost[badgeclass]}>"><div class="tpbadgetext"><{$_ticketPost[badgetext]}></div></div>
    <{if $_ticketPost[avatar] != ''}><div class="ticketpostavatar"><div class="tpavatar"><img src="<{$_ticketPost[avatar]}>" align="absmiddle" border="0" /></div></div><{/if}>
    <{if $_ticketPostBenchmarkCount > 0 && $_ticketPost[creatorlabel] == 'staff'}>
    <div class="ticketpostbox">
    <{foreach key=_benchmarkID item=_ticketPostBenchmark from=$_ticketPostBenchmarkContainer}>
    <div class="ticketpostinfoitem"><div class="ticketpostinfoitemtitle"><{$_ticketPostBenchmark[benchmarktitle]}></div>
    <{for name=_benchmarkScale from=1 to=$_ticketPostBenchmark[benchmarkscale]}>
    <input name="benchmark_<{$_benchmarkID}>_<{$_ticketPostID}>" type="radio" class="rating" value="<{$_benchmarkScale}>" <{if $_ticketPostBenchmarkResults[$_benchmarkID][$_ticketPostID][isdisabled] == true}> disabled="disabled" <{/if}><{if $_ticketPostBenchmarkResults[$_benchmarkID][$_ticketPostID][benchmarkresult] == '$_benchmarkScale'}> checked="checked"<{/if}> />
    <{/for}>
    </div>
    <{/foreach}>
    </div>
    <{/if}>
    </div>

    <div style="min-height: <{$_ticketPost[minimumheight]}>px;" class="ticketpostcontents">

    <div class="ticketpostcontentsbar"><div onclick="javascript: QuoteTicketPost('<{$_ticketContainer[ticketid]}>', '<{$_ticketPost[ticketpostid]}>'); self.scrollTo(0, 0); return false;" class="ticketbarquote"></div><div class="ticketbarcontents"><{$_ticketPost[posttitle]}></div><span class="ticketbardatefold"></span></div>

    <div class="ticketpostcontentsdetails">
    <{if $_ticketPost[hasattachments] == '1'}><div class="ticketpostcontentsattachments"><{/if}>
    <{foreach key=_attachmentID item=_ticketAttachment from=$_ticketPost[attachments]}>
    <div class="ticketpostcontentsattachmentitem" onclick="javascript: PopupSmallWindow('<{$_ticketAttachment[link]}>');" style="background-image: URL('<{$_themePath}>images/<{$_ticketAttachment[icon]}>');">&nbsp;<{$_ticketAttachment[name]}> (<{$_ticketAttachment[size]}>)</div>
    <{/foreach}>
    <{if $_ticketPost[hasattachments] == '1'}></div><{/if}>
    <div class="ticketpostcontentsholder"><div class="ticketpostcontentsdetailscontainer"><{$_ticketPost[contents]}></div></div>
    </div>

    <div class="ticketpostcontentsbottom"><span class="ticketpostbottomright">&nbsp;</span><div class="ticketpostbottomcontents"><{$_ticketPost[postfooter]}>&nbsp;</div></div>
    </div>

    <div class="ticketpostbarbottom"><div class="ticketpostbottomcontents">&nbsp;&nbsp;</div></div>

    <div class="ticketpostclearer"></div>
    </div>
    <{/if}>
    <{/foreach}>

    </div>

    </div>
    </div>
  3. Narpas

    Narpas New Member

    Oh, a correction. The Div "AttachmentNotes" is also my own doing and it lives under the div classed "postreplycontainer". Also, relevant clientcss

    .AttachmentsNotes {
    BORDER-BOTTOM: 1px SOLID #ded5c7;
    FONT: Georgia,Arial,sans-serif;
    WIDTH: 100%;
    MARGIN-BOTTOM: 10px;
    PADDING-BOTTOM: 6px;
    Margin-left: 8px;
    }

    .AttachmentsNotes .ticketpostcontentsattachments {
    BORDER-BOTTOM: 0;
    FONT: Georgia,Arial,sans-serif;
    WIDTH: 100%;
    MARGIN-BOTTOM: 0;
    PADDING-BOTTOM: 0;
    }

    .AttachmentName {
    width: 200px;
    display: inline-block;
    }

    .AttachmentTitle {
    width: 300px;
    display: inline-block;
    }

    .AttachmentTime img{
    display: none;
    }

Share This Page