Location: PHPKode > projects > ADbNewsSender > ADbNewsSender 2.1.0/protected/admin/specialheaders/sendNL.php.inc
<?php
//Copyright (c) Florian Grannemann
//Last change in version: 2.1 Alpha 4
/*
    ******************************************************************************
    ADbNewsSender 2

    Copyright (C) 2010 Florian Grannemann (hide@address.com)
    Website: http://adbnewssender.sf.net



    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 3 of the License, or
    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.

    You should have received a copy of the GNU General Public License			
    along with this program.  If not, see http://www.gnu.org/licenses/
    ******************************************************************************
*/
//Adding TinyMCE 
//The TinyMCE librarys are licensed under LGPL

//is  TinyMCE enabled?
if($MyCFG->get_config_value("EnableTinyMCE")=="yes")
{
//yes: 
    if(!$MyRequestHandler->getNLModuleKeyValue("SendNLOPTION"))
    {

	    //if a file has been uploaded:
	if($_FILES["uploadfile".$MySessionHandler->getNLID()]['tmp_name'])
	{
	    if(!$_FILES["uploadfile".$MySessionHandler->getNLID()]["error"])
	    {
		if($_FILES["uploadfile".$MySessionHandler->getNLID()]["type"]!="text/html")
		{
		
		   $MySessionHandler->setNLModuleKey("type","text");
		}
		else
		{
		
		    $MySessionHandler->setNLModuleKey("type","html");
	    
		}
	    
	    }
	}
   
   
	
	  //setting default newsletter type to html:
	if(!$MySessionHandler->getNLModuleKeyValue("type"))
	{
	    $MySessionHandler->setNLModuleKey("type","html");
	 
	}

	 //because toggeling TinyMCE from hide to show via javascript caused some problems when submiting the form
	//i had to let the form do a submit()  after changing the newsletter type.
    
	if($MyRequestHandler->issetNLModuleKey("type"))
	{
	    $MySessionHandler->setNLModuleKey("type",$MyRequestHandler->getNLModuleKeyValue("type"));
	    $MySessionHandler->setNLModuleKey("body",$MyRequestHandler->getNLModuleKeyValue("body"));
	    $MySessionHandler->setNLModuleKey("subject",$MyRequestHandler->getNLModuleKeyValue("subject"));

	}


 
?>

<!-- TinyMCE -->
<script type="text/javascript" src="specialheaders/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
<?php
   

	if($MySessionHandler->getNLModuleKeyValue("type") =="html")
	{
		//including tinyMCE language settings:
		include "$path_to_languagefolder/tinymce_language.php.inc";
		//including the tinymCE init call:
		include "$path_to_protected/admin/specialheaders/include/init_tinyMCE.php.inc";

	} 
?>
    
function switchEditor(){
    document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("SendNLOPTION");?>')[0].value="";	 
    document.sendNL.submit();
}


</script>
<!-- /TinyMCE -->
<?
	
    }


}
//if not, nothing will happen.


if($MyRequestHandler->getNLModuleKeyValue("SendNLOPTION")=="previewNL"){
?>
    <script type="text/javascript">
	function setWaitMessage(message){
	    if(document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("SendNLOPTION");?>')[0].value){
		var submitButton = document.getElementById("submitButton");
		submitButton.value=message;
	    }
	    submitButton.disabled=true;
	    return true;
	}
	    
    </script>

<?php
}

?>
Return current item: ADbNewsSender