I use JSON for HTML output, so I fix it by replacing "!" to it's HTML code "!".
To fix - place simple formula in to the column value:
@ReplaceSubstring(HTMLinList;"!";"!")
@ReplaceSubstring(HTMLinList;"!";"!")
url.1=http://www.alexa.com/siteinfo/championselect.net url.2=http://www.alexa.com/siteinfo/elohell.net url.3=http://www.alexa.com/siteinfo/lolcounter.com url.4=http://www.alexa.com/siteinfo/lolcounterpicks.com url.5=http://www.alexa.com/siteinfo/counterlol.org url.6=http://www.alexa.com/siteinfo/picklol.net url.7=http://www.alexa.com/siteinfo/counterpicker.com
{
"http://www.alexa.com/siteinfo/championselect.net" : "10,546",
"http://www.alexa.com/siteinfo/elohell.net" : "16,323",
"http://www.alexa.com/siteinfo/lolcounter.com" : "16,487",
"http://www.alexa.com/siteinfo/lolcounterpicks.com" : "462,863",
"http://www.alexa.com/siteinfo/counterlol.org" : "4,722,060",
"http://www.alexa.com/siteinfo/picklol.net" : "7,679,714",
"http://www.alexa.com/siteinfo/counterpicker.com" : "12,461,834"
}
//log and statistic contains information
//about process and compression result
//
//file - file to optimize,
//generally opt rewrite file, but not in all cases.
//Look "Important" section
//
//opt - optimized file
StringBuilder log = new StringBuilder();
StringBuilder statistic = new StringBuilder();
SmushIt smushIt = new SmushIt();
smushIt.setVerbose(log);
smushIt.setVerboseStatistic(statistic);
smushIt.addFile(file.getCanonicalPath());
List<smushitresultvo> smushItResultVos = smushIt.smush();
ImageDownloader imageDownloader =
new ImageDownloader(file.getParent());
imageDownloader.setVerbose(log);
File opt = imageDownloader.download(smushItResultVos.get(0));
StringBuilder log variable after running code:Smushing files:
C:\Windows\Temp\notesE3A053\xspupload\0001.jpg
Adding file:C:\Windows\Temp\notesE3A053\xspupload\0001.jpg
{"src":"0b2c68eb%2F0001.jpg","src_size":40895,
"dest":"http:\/\/ysmushit.zenfs.com\
/results\/0b2c68eb%2Fsmush%2F0001.jpg",
"dest_size":38749,
"percent":"5.25","id":""}
Downloaded smushed image -
http://ysmushit.zenfs.com/results/0b2c68eb%2Fsmush%2F0001.jpg
Saved image - C:\Windows\TEMP\notesE3A053\xspupload\0001.jpgSource Image:0001.jpg Source image size:40895 Smushed image size:38749 Percentage saving:5.25
public void process() throws Exception {
HttpServletRequest request = getRequest();
Document document =
getEs().createDocument().getDocument();
document.replaceItemValue("Form", "picture");
Map parameters = request.getParameterMap();
UploadedFile uploadedFile=
(UploadedFile) parameters.get("upload");
document.replaceItemValue(
"FileName",
uploadedFile.getClientFileName());
File tmpFile = uploadedFile.getServerFile();
File fileToUpload = new File(
tmpFile.getParentFile().getAbsolutePath().
concat(java.io.File.separator).
concat(uploadedFile.getClientFileName()));
boolean success = tmpFile.renameTo(fileToUpload);
addAttachment(document, success?fileToUpload:tmpFile);
fileToUpload.renameTo(tmpFile);
document.save(true, true);
}
private void addAttachment(Document document, File file)
throws Exception{
RichTextItem item = document.createRichTextItem("Body");
item.embedObject(
EmbeddedObject.EMBED_ATTACHMENT,
"",
file.getCanonicalPath(), null);
}
p.resourceTypes.push(new a.aL.ResourceType(p, {
name: t.getNamedItem('name').value,
url: t.getNamedItem('url').value,
//Modification
download: t.getNamedItem('download').value,
hasChildren: t.getNamedItem('hasChildren').value,
allowedExtensions:
t.getNamedItem('allowedExtensions').value,
deniedExtensions:
t.getNamedItem('deniedExtensions').value,
acl: t.getNamedItem('acl').value,
hash: t.getNamedItem('hash').value,
maxSize: t.getNamedItem('maxSize').value
}));
a.aL.ResourceType = function (q, r) {
var s = this;
s.app = q;
s.name = r.name;
s.url = r.url;
//Modification
s.download = r.download;
s.hasChildren = r.hasChildren === 'true';
s.defaultView = 'Thumbnails';
s.allowedExtensions = r.allowedExtensions;
s.deniedExtensions = r.deniedExtensions;
s.oT = p(r.allowedExtensions);
s.ms = p(r.deniedExtensions);
s.nS = r.acl;
s.hash = r.hash;
s.maxSize = r.maxSize;
};
if (R.config.directDownload){
//Modification
var filename = encodeURIComponent(S.name);
var basenanme =
filename.substring(0, filename.lastIndexOf('.'));
T = S.folder.getResourceType().download +
basenanme+'/$file/'+filename;
//original CKFinder String
//T = S.folder.getUrl() + S.name + '?download';
}
J.push('<a href="', D.folder.getUrl(),
encodeURIComponent(C[K].name),
'" title="', C[K].name, '" rel="', E, '">a</a>'); and change it with if (!F || F(C[K])) {
var filename = encodeURIComponent(C[K].name);
var basenanme = filename.substring(0,
filename.lastIndexOf('.'));
var url = D.folder.getResourceType().url
+ basenanme+'/$file/'+filename;
J.push('<a href="', url, '" title="', C[K].name,
'" rel="', E, '">a</a>');
if (C[K].isSameFile(D)) H = I;
I++;
}
That will change image url. You also need to change File url. Findif (!W.open(S.folder.getUrl() +
encodeURIComponent(S.name), '_blank', V))
R.msgDialog('', R.lang.ErrorMsg.oo);
var filename = encodeURIComponent(S.name);
var basenanme = filename.substring(0, filename.lastIndexOf('.'));
var url = S.folder.getResourceType().download + basenanme+
'/$file/'+filename;
if (!W.open(url, '_blank', V))
R.msgDialog('', R.lang.ErrorMsg.oo);
if (L && N.config.thumbsDirectAccess) { var filename = encodeURIComponent(M); var dotIndex = filename.lastIndexOf('.'); var ext = filename.substring(dotIndex+1); var basenanme = filename.substring(0, dotIndex); return N.config.thumbsUrl + basenanme + '-thumb/$file/' + basenanme + '-thumb.' + ext + (!K ? '' : '?Open&hash=' + N.getResourceType(R.folder.type).hash + '&fileHash=' + P); }