We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Hi guys, thought I might share this with you guys.

    I modified the core code to use MCPUK for files TV, just like images.
    The file that need to be modified is located on manager/includes/tmplvars.inc.php

    Hope it can be added to the next release or someone might find this to be useful.
    			case "image":	// handles image fields using htmlarea image manager
    				global $_lang;
    				global $ImageManagerLoaded;
    				global $content,$use_editor,$which_editor;
    				if (!$ImageManagerLoaded && !(($content['richtext']==1 || $_GET['a']==4) && $use_editor==1 && $which_editor==3)){ 
    					$field_html .="
    					<script type=\"text/javascript\">
    							var lastImageCtrl;
    							function OpenServerBrowser(url, width, height ) {
    								var iLeft = (screen.width  - width) / 2 ;
    								var iTop  = (screen.height - height) / 2 ;
    
    								var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
    								sOptions += ',width=' + width ;
    								sOptions += ',height=' + height ;
    								sOptions += ',left=' + iLeft ;
    								sOptions += ',top=' + iTop ;
    
    								var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
    							}			
    							function BrowseServer(ctrl,type) {
    								lastImageCtrl = ctrl;
    								var w = screen.width * 0.7;
    								var h = screen.height * 0.7;
    								OpenServerBrowser('".$base_url."manager/media/browser/mcpuk/browser.html?Type='+type+'&Connector=".$base_url."manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=".$base_url."', w, h);
    							}
    							function SetUrl(url, width, height, alt){
    								if(!lastImageCtrl) return;
    								var c = document.mutate[lastImageCtrl];
    								if(c) c.value = url;
    								lastImageCtrl = '';
    							}
    					</script>";
    					$ImageManagerLoaded  = true;					
    				} 
    				$field_html .='<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'"  value="'.$field_value .'" '.$field_style.' onchange="documentDirty=true;setVariableModified(\''.$field_name.'\');" /> <input type="button" value="'.$_lang['insert'].'" onclick="setVariableModified(\''.$field_name.'\');BrowseServer(\'tv'.$field_name.'\',\'images\')" />';
    				break;
    			case "file": // handles the input of file uploads
    			/* Modified by Timon for use with resource browser */
                    		global $_lang;
    				global $ImageManagerLoaded;
    				global $content,$use_editor,$which_editor;
    				if (!$ImageManagerLoaded && !(($content['richtext']==1 || $_GET['a']==4) && $use_editor==1 && $which_editor==3)){
    				/* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ 
    					$field_html .="
    					<script type=\"text/javascript\">
    							var lastFileCtrl;
    							function OpenServerBrowser(url, width, height ) {
    								var iLeft = (screen.width  - width) / 2 ;
    								var iTop  = (screen.height - height) / 2 ;
    
    								var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
    								sOptions += ',width=' + width ;
    								sOptions += ',height=' + height ;
    								sOptions += ',left=' + iLeft ;
    								sOptions += ',top=' + iTop ;
    
    								var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
    							}			
    							function BrowseServer(ctrl,type) {
    								lastFileCtrl = ctrl;
    								var w = screen.width * 0.7;
    								var h = screen.height * 0.7;
    								OpenServerBrowser('".$base_url."manager/media/browser/mcpuk/browser.html?Type='+type+'&Connector=".$base_url."manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=".$base_url."', w, h);
    							}
    							function SetUrl(url, width, height, alt){
    								if(!lastFileCtrl) return;
    								var c = document.mutate[lastFileCtrl];
    								if(c) c.value = url;
    								lastFileCtrl = '';
    							}
    					</script>";
    					$ImageManagerLoaded  = true;					
    				} 
    				$field_html .='<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'"  value="'.$field_value .'" '.$field_style.' onchange="documentDirty=true;setVariableModified(\''.$field_name.'\');" /> <input type="button" value="'.$_lang['insert'].'" onclick="setVariableModified(\''.$field_name.'\');BrowseServer(\'tv'.$field_name.'\',\'files\')" />';
                    
    
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 18397
      • 3,250 Posts
      I like the idea of having a file browser for a file TV. Good work Wendy!
        • 6726
        • 7,075 Posts
        Very nice, I’ll sure use that thanks Wendy !
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 6726
          • 7,075 Posts
          *bump* I didn’t check : has this been integrated in 0.9.5 ?

          It’s really a nice feature smiley
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id