Can clone a page onto another website
This commit is contained in:
parent
764c7ac792
commit
336400d9ea
1254
htdocs/core/class/html.formwebsite.class.php
Normal file
1254
htdocs/core/class/html.formwebsite.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -500,9 +500,10 @@ class WebsitePage extends CommonObject
|
||||
* @param string $newref New ref/alias of page
|
||||
* @param string $newlang New language
|
||||
* @param int $istranslation 1=New page is a translation of the cloned page.
|
||||
* @param int $newwebsite 0=Same web site, 1=New web site
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid, $newref, $newlang='', $istranslation=0)
|
||||
public function createFromClone($fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0)
|
||||
{
|
||||
global $user, $langs;
|
||||
|
||||
@ -525,6 +526,7 @@ class WebsitePage extends CommonObject
|
||||
if (! empty($newlang)) $object->lang=$newlang;
|
||||
if ($istranslation) $object->fk_page = $fromid;
|
||||
else $object->fk_page = 0;
|
||||
if (! empty($newwebsite)) $object->fk_website=$newwebsite;
|
||||
|
||||
// Create clone
|
||||
$result = $object->create($user);
|
||||
|
||||
@ -66,12 +66,12 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
|
||||
}
|
||||
|
||||
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formwebsite.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
||||
|
||||
@ -549,7 +549,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
||||
if (! $error)
|
||||
{
|
||||
$objectpage = new WebsitePage($db);
|
||||
$result = $objectpage->createFromClone($pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation);
|
||||
$result = $objectpage->createFromClone($pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, GETPOST('newwebsite','int'));
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -745,6 +745,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formwebsite = new FormWebsite($db);
|
||||
|
||||
$help_url='';
|
||||
|
||||
@ -958,7 +959,9 @@ if (count($object->records) > 0)
|
||||
$formquestion = array(
|
||||
array('type' => 'text', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME") ,'value'=> 'copy_of_'.$objectpage->pageurl),
|
||||
array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0),
|
||||
array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, '', 0, 0, 'minwidth200')));
|
||||
array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, '', 0, 0, 'minwidth200')),
|
||||
array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("Website"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0))
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 250);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user