Gabriel Finkelstein
|
Friday 12 September 2008 7:44:09 am
You want to choose the language instead of using the default? Try using this: In csvimport.php, around line 460 change:
$contentObject =& $class->instantiate( $creatorID, $sectionID, false);
To:
$contentObject =& $class->instantiate( $creatorID, $sectionID, false, $language );
Around 550:
$version =& $contentObject->createNewVersion(false,true);
$version =& $contentObject->createNewVersion(false,true,$language);
Around 400:
function addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, &$dataArray, &$logArray, $importKey, $folderClassID, $convertTag = false, $tagList = null , $objectRelationClassID = 0, $pdate)
function addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, &$dataArray, &$logArray, $importKey, $folderClassID, $convertTag = false, $tagList = null , $objectRelationClassID = 0, $pdate , $language = false)
Around: 370:
if ( $convertTag )
addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, $convertTag, $tagList, $objectRelationClassID, $pdate);
else
{
addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, false, null, $objectRelationClassID, $pdate);
}
if ( $convertTag )
addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, $convertTag, $tagList, $objectRelationClassID, $pdate, $language );
else
{
addContentObject( $rootNodeID, $parentNodeName, $parentNodeRemoteID, $creatorID, $classID, $sectionID, $dataArray, $logArray, $importKey, $folderClassID, false, null, $objectRelationClassID, $pdate, $language );
}
And then set the $language variable, around 200:
else
{
$logFieldList = null;
}
Add below:
if ( $http->hasVariable( 'language' ) ){
$language = $http->variable( 'language' );
} else {
$language = false;
}
(If you use the command line version, you'll have to do something similar in import.php) And then in csvimport.tpl, add somewhere:
<h2>Choose language</h2>
<div class="block">
<select name="language">
{foreach ezini('RegionalSettings', 'SiteLanguageList') as $lang}
<option value="{$lang}"{if $post.language|eq($lang)} selected="selected"{/if}>{$lang}</option>
{/section}
</select>
</div>
|