Location: PHPKode > projects > ADbNewsSender > ADbNewsSender 2.1.0/protected/admin/specialheaders/drafts.php.inc
<?php
//Copyright (c) Florian Grannemann
//Last change in version: 2.1 Alpha 3
/*
    ******************************************************************************
    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("DraftsOption") =="edit")
    {
	 //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("DraftType"))
	{
	    $MySessionHandler->setNLModuleKey("type",$MyRequestHandler->getNLModuleKeyValue("DraftType"));
	    $MySessionHandler->setNLModuleKey("body",$MyRequestHandler->getNLModuleKeyValue("DraftBody"));
	   $MySessionHandler->setNLModuleKey("subject",$MyRequestHandler->getNLModuleKeyValue("DraftSubject"));

	}



?>

<!-- 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("DraftsOption");?>')[0].value="edit";
    
    document.EditDraft.submit();
    
}


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








}
//if DraftsOption is not "edit", display the js function to enable the newsletter selection, if "copy to nl" was selected
if(!$MyRequestHandler->getNLModuleKeyValue("DraftsOption") || $MyRequestHandler->getNLModuleKeyValue("DraftsOption")=="save"|| $MyRequestHandler->getNLModuleKeyValue("DraftsOption")=="save_new"){
    ?>
	<script type="text/javascript">
	    function onDraftsActionchange(){
		 if(document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("DraftsAction");?>')[0].value=="copyNL"){
		    document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("CopyToNL");?>')[0].style.width="";
		    document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("CopyToNL");?>')[0].style.visibility="visible";
		}
		else{
			if(document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("CopyToNL");?>')[0].style.visibility=="visible"){
			    document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("CopyToNL");?>')[0].style.width="0px";
			    document.getElementsByName('<?php print $MyRequestHandler->getNLModuleKeyName("CopyToNL");?>')[0].style.visibility="hidden";   
			}
		}
	    }
	</script>
    <?php
}
?>


Return current item: ADbNewsSender