YAFLogo

smaaza
  • smaaza
  • 67.4% (Friendly)
  • YAF Forumling Topic Starter
13 years ago
Hello everybody

Could u please help me

I could not setup Tinymce compressor v3.1.1 proberly for Yaf forum

i followed the instruction in thier site(Tinymce Site) and i moved the .dll

files to my Bin folder in yaf and files of the editor in editors folder

but when i select the editor from admin --->editors--->Tinymce i got this

UserPostedImage

Here is the files i'am dialing with

UserPostedImage

tiny_mce.js:


<script type="text/javascript" src="../editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js"></script>
<script type="text/javascript">
tinyMCE_GZ.init({
	plugins : 'style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras',
	themes : 'advanced',
	languages : 'en',
	disk_cache : true,
	debug : false
});
</script>

02.<script type="text/javascript"> 
03.tinyMCE.init({ 
04.// General options 
05.mode : "textareas",
06.theme : "advanced", 
07.plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", 
08. 
09.// Theme options 
10.theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", 
11.theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
12.theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 
13.theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", 
14.theme_advanced_toolbar_location : "top", 
15.theme_advanced_toolbar_align : "left", 
16.theme_advanced_statusbar_location : "bottom", 
17.theme_advanced_resizing : true, 
18. 
19.// Example content CSS (should be your site CSS) 
20.content_css : "css/example.css", 
21. 
22.// Drop lists for link/image/media/template dialogs 
23.template_external_list_url : "js/template_list.js", 
24.external_link_list_url : "js/link_list.js", 
25.external_image_list_url : "js/image_list.js", 
26.media_external_list_url : "js/media_list.js", 
27. 
28.// Replace values for the template plugin 
29.template_replace_values : { 
30.username : "Some User", 
31.staffid : "991234" 
32.} 
33.}); 
34.</script> 
35. 
36.<form method="post" action="somepage"> 
37.<textarea name="content" style="width:100%"> 
38.</textarea> 
39.</form>

tiny_mce_gzip.aspx:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="ICSharpCode.SharpZipLib.GZip" %>
<%
/**
 * $Id: tiny_mce_gzip.aspx 316 2007-10-25 14:50:55Z spocke $
 *
 * @author Moxiecode
 * @copyright Copyright © 2006, Moxiecode Systems AB, All rights reserved.
 *
 * This file compresses the TinyMCE JavaScript using GZip and
 * enables the browser to do two requests instead of one for each .js file.
 *
 * It's a good idea to use the diskcache option since it reduces the servers workload.
 */

	string cacheKey = "", cacheFile = "", content = "", enc, suffix, cachePath;
	string[] plugins, languages, themes;
	bool diskCache, supportsGzip, isJS, compress, core;
	int i, x, bytes, expiresOffset;
	GZipOutputStream gzipStream;
	Encoding encoding = Encoding.GetEncoding("windows-1252");
	byte[] buff;

	// Get input
	plugins = GetParam("plugins", "").Split(',');
	languages = GetParam("languages", "").Split(',');
	themes = GetParam("themes", "").Split(',');
	diskCache = GetParam("diskcache", "") == "true";
	isJS = GetParam("js", "") == "true";
	compress = GetParam("compress", "true") == "true";
	core = GetParam("core", "true") == "true";
	suffix = GetParam("suffix", "") == "_src" ? "_src" : "";
	cachePath = Server.MapPath("."); // Cache path, this is where the .gz files will be stored
	expiresOffset = 10; // Cache for 10 days in browser cache

	// Custom extra javascripts to pack
	string[] custom = {/*
		"some custom .js file",
		"some custom .js file"
	*/};

	// Set response headers
	Response.ContentType = "text/javascript";
	Response.Charset = "UTF-8";
	Response.Buffer = false;

	// Setup cache
	Response.Cache.SetExpires(DateTime.Now.AddDays(expiresOffset));
	Response.Cache.SetCacheability(HttpCacheability.Public);
	Response.Cache.SetValidUntilExpires(false);

	// Vary by all parameters and some headers
	Response.Cache.VaryByHeaders["Accept-Encoding"] = true;
	Response.Cache.VaryByParams["theme"] = true;
	Response.Cache.VaryByParams["language"] = true;
	Response.Cache.VaryByParams["plugins"] = true;
	Response.Cache.VaryByParams["lang"] = true;
	Response.Cache.VaryByParams["index"] = true;

	// Is called directly then auto init with default settings
	if (!isJS) {
		Response.WriteFile(Server.MapPath("tiny_mce_gzip.js"));
		Response.Write("tinyMCE_GZ.init({});");
		return;
	}

	// Setup cache info
	if (diskCache) {
		cacheKey = GetParam("plugins", "") + GetParam("languages", "") + GetParam("themes", "");

		for (i=0; i<custom.Length; i++)
			cacheKey += custom[i];

		cacheKey = MD5(cacheKey);

		if (compress)
			cacheFile = cachePath + "/tiny_mce_" + cacheKey + ".gz";
		else
			cacheFile = cachePath + "/tiny_mce_" + cacheKey + ".js";
	}

	// Check if it supports gzip
	enc = Regex.Replace("" + Request.Headers["Accept-Encoding"], @"\s+", "").ToLower();
	supportsGzip = enc.IndexOf("gzip") != -1 || Request.Headers["---------------"] != null;
	enc = enc.IndexOf("x-gzip") != -1 ? "x-gzip" : "gzip";

	// Use cached file disk cache
	if (diskCache && supportsGzip && File.Exists(cacheFile)) {
		Response.AppendHeader("Content-Encoding", enc);
		Response.WriteFile(cacheFile);
		return;
	}

	// Add core
	if (core) {
		content += GetFileContents("tiny_mce" + suffix + ".js");

		// Patch loading functions
		content += "tinyMCE_GZ.start();";
	}

	// Add core languages
	for (x=0; x<languages.Length; x++)
		content += GetFileContents("langs/" + languages❌ + ".js");

	// Add themes
	for (i=0; i<themes.Length; i++) {
		content += GetFileContents("themes/" + themes[i] + "/editor_template" + suffix + ".js");

		for (x=0; x<languages.Length; x++)
			content += GetFileContents("themes/" + themes[i] + "/langs/" + languages❌ + ".js");
	}

	// Add plugins
	for (i=0; i<plugins.Length; i++) {
		content += GetFileContents("plugins/" + plugins[i] + "/editor_plugin" + suffix + ".js");

		for (x=0; x<languages.Length; x++)
			content += GetFileContents("plugins/" + plugins[i] + "/langs/" + languages❌ + ".js");
	}

	// Add custom files
	for (i=0; i<custom.Length; i++)
		content += GetFileContents(custom[i]);

	// Restore loading functions
	if (core)
		content += "tinyMCE_GZ.end();";

	// Generate GZIP'd content
	if (supportsGzip) {
		if (compress)
			Response.AppendHeader("Content-Encoding", enc);

		if (diskCache && cacheKey != "") {
			// Gzip compress
			if (compress) {
				gzipStream = new GZipOutputStream(File.Create(cacheFile));
				buff = encoding.GetBytes(content.ToCharArray());
				gzipStream.Write(buff, 0, buff.Length);
				gzipStream.Close();
			} else {
				StreamWriter sw = File.CreateText(cacheFile);
				sw.Write(content);
				sw.Close();
			}

			// Write to stream
			Response.WriteFile(cacheFile);
		} else {
			gzipStream = new GZipOutputStream(Response.OutputStream);
			buff = encoding.GetBytes(content.ToCharArray());
			gzipStream.Write(buff, 0, buff.Length);
			gzipStream.Close();
		}
	} else
		Response.Write(content);
%><script runat="server">
	public string GetParam(string name, string def) {
		string value = Request.QueryString[name] != null ? "" + Request.QueryString[name] : def;

		return Regex.Replace(value, @"[^0-9a-zA-Z\\-_,]+", "");
	}

	public string GetFileContents(string path) {
		try {
			string content;

			path = Server.MapPath(path);

			if (!File.Exists(path))
				return "";

			StreamReader sr = new StreamReader(path);
			content = sr.ReadToEnd();
			sr.Close();

			return content;
		} catch (Exception ex) {
			// Ignore any errors
		}

		return "";
	}

	public string MD5(string str) {
		MD5 md5 = new MD5CryptoServiceProvider();
		byte[] result = md5.ComputeHash(Encoding.ASCII.GetBytes(str));
		str = BitConverter.ToString(result);

		return str.Replace("-", "");
	}
</script>

So anybody please could help me to setup Tinymce v3.1.1 or explaine the right steps for setup .

Thanks for all

Sponsor

logan
  • logan
  • 100% (Exalted)
  • YAF Leader
13 years ago

copy and save as tiny_mce_init.js - put in your editors/tiny_mce folder with the other .js files

tinyMCE.init({ 
// General options 
mode : "textareas", 
theme : "advanced", 
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", 
 
// Theme options 
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", 
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", 
theme_advanced_toolbar_location : "top", 
theme_advanced_toolbar_align : "left", 
theme_advanced_statusbar_location : "bottom", 
theme_advanced_resizing : true, 
 
// Example content CSS (should be your site CSS) 
content_css : "css/example.css", 
 
// Drop lists for link/image/media/template dialogs 
template_external_list_url : "js/template_list.js", 
external_link_list_url : "js/link_list.js", 
external_image_list_url : "js/image_list.js", 
media_external_list_url : "js/media_list.js", 
 
// Replace values for the template plugin 
template_replace_values : { 
username : "Some User", 
staffid : "991234" 
} 
}); 

test
smaaza
  • smaaza
  • 67.4% (Friendly)
  • YAF Forumling Topic Starter
13 years ago
logan wrote:

copy and save as tiny_mce_init.js - put in your editors/tiny_mce folder with the other .js files

tinyMCE.init({ 
// General options 
mode : "textareas", 
theme : "advanced", 
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", 
 
// Theme options 
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", 
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", 
theme_advanced_toolbar_location : "top", 
theme_advanced_toolbar_align : "left", 
theme_advanced_statusbar_location : "bottom", 
theme_advanced_resizing : true, 
 
// Example content CSS (should be your site CSS) 
content_css : "css/example.css", 
 
// Drop lists for link/image/media/template dialogs 
template_external_list_url : "js/template_list.js", 
external_link_list_url : "js/link_list.js", 
external_image_list_url : "js/image_list.js", 
media_external_list_url : "js/media_list.js", 
 
// Replace values for the template plugin 
template_replace_values : { 
username : "Some User", 
staffid : "991234" 
} 
}); 

Hello Mr Logan

first of all Thanku for help

I did what u said but it didn't work may be there are somthing wrong i'am waiting ur response

thanks again

logan
  • logan
  • 100% (Exalted)
  • YAF Leader
13 years ago
Smaaza,

move the tiny_mce folder out of the jscripts folder into the editors folder.


test
smaaza
  • smaaza
  • 67.4% (Friendly)
  • YAF Forumling Topic Starter
13 years ago
logan wrote:

Smaaza,

move the tiny_mce folder out of the jscripts folder into the editors folder.

Sorry it doesn't work