".'| global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").' | ';
print '';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index f3fa431daa0..da0e39d9ad7 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -69,7 +69,11 @@ class User extends CommonObject
public $gender;
public $birth;
public $email;
+
public $skype;
+ public $twitter;
+ public $facebook;
+
public $job; // job position
public $signature;
@@ -220,7 +224,8 @@ class User extends CommonObject
$login=trim($login);
// Get user
- $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.signature, u.office_phone, u.office_fax, u.user_mobile,";
+ $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.twitter, u.facebook,";
+ $sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile,";
$sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,";
$sql.= " u.admin, u.login, u.note,";
$sql.= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,";
@@ -325,6 +330,8 @@ class User extends CommonObject
$this->user_mobile = $obj->user_mobile;
$this->email = $obj->email;
$this->skype = $obj->skype;
+ $this->twitter = $obj->twitter;
+ $this->facebook = $obj->facebook;
$this->job = $obj->job;
$this->signature = $obj->signature;
$this->admin = $obj->admin;
@@ -1220,6 +1227,8 @@ class User extends CommonObject
$this->gender = $contact->gender;
$this->email = $contact->email;
$this->skype = $contact->skype;
+ $this->twitter = $contact->twitter;
+ $this->facebook = $contact->facebook;
$this->office_phone = $contact->phone_pro;
$this->office_fax = $contact->fax;
$this->user_mobile = $contact->phone_mobile;
@@ -1433,7 +1442,11 @@ class User extends CommonObject
$this->office_fax = trim($this->office_fax);
$this->user_mobile = trim($this->user_mobile);
$this->email = trim($this->email);
+
$this->skype = trim($this->skype);
+ $this->twitter = trim($this->twitter);
+ $this->facebook = trim($this->facebook);
+
$this->job = trim($this->job);
$this->signature = trim($this->signature);
$this->note = trim($this->note);
@@ -1483,6 +1496,8 @@ class User extends CommonObject
$sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'";
$sql.= ", email = '".$this->db->escape($this->email)."'";
$sql.= ", skype = '".$this->db->escape($this->skype)."'";
+ $sql.= ", twitter = '".$this->db->escape($this->twitter)."'";
+ $sql.= ", facebook = '".$this->db->escape($this->facebook)."'";
$sql.= ", job = '".$this->db->escape($this->job)."'";
$sql.= ", signature = '".$this->db->escape($this->signature)."'";
$sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'";
@@ -1567,7 +1582,11 @@ class User extends CommonObject
$adh->country_id=$this->country_id;
$adh->email=$this->email;
+
$adh->skype=$this->skype;
+ $adh->twitter=$this->twitter;
+ $adh->facebook=$this->facebook;
+
$adh->phone=$this->office_phone;
$adh->phone_mobile=$this->user_mobile;
@@ -1615,7 +1634,11 @@ class User extends CommonObject
//$tmpobj->societe=(empty($tmpobj->societe) && $this->societe_id ? $this->societe_id : $tmpobj->societe);
$tmpobj->email=$this->email;
+
$tmpobj->skype=$this->skype;
+ $tmpobj->twitter=$this->twitter;
+ $tmpobj->facebook=$this->facebook;
+
$tmpobj->phone_pro=$this->office_phone;
$tmpobj->phone_mobile=$this->user_mobile;
$tmpobj->fax=$this->office_fax;
@@ -2474,13 +2497,15 @@ class User extends CommonObject
'LDAP_FIELD_NAME' => 'lastname',
'LDAP_FIELD_FIRSTNAME' => 'firstname',
'LDAP_FIELD_LOGIN' => 'login',
- 'LDAP_FIELD_LOGIN_SAMBA' => 'login',
+ 'LDAP_FIELD_LOGIN_SAMBA'=> 'login',
'LDAP_FIELD_PHONE' => 'office_phone',
'LDAP_FIELD_MOBILE' => 'user_mobile',
- 'LDAP_FIELD_FAX' => 'office_fax',
+ 'LDAP_FIELD_FAX' => 'office_fax',
'LDAP_FIELD_MAIL' => 'email',
- 'LDAP_FIELD_SID' => 'ldap_sid',
- 'LDAP_FIELD_SKYPE' => 'skype'
+ 'LDAP_FIELD_SID' => 'ldap_sid',
+ 'LDAP_FIELD_SKYPE' => 'skype',
+ 'LDAP_FIELD_TWITTER' => 'twitter',
+ 'LDAP_FIELD_FACEBOOK' => 'facebook'
);
// Champs
@@ -2591,7 +2616,9 @@ class User extends CommonObject
$this->gender='man';
$this->note='This is a note';
$this->email='email@specimen.com';
- $this->skype='tom.hanson';
+ $this->skype='skypepseudo';
+ $this->twitter='twitterpseudo';
+ $this->facebook='facebookpseudo';
$this->office_phone='0999999999';
$this->office_fax='0999999998';
$this->user_mobile='0999999997';
@@ -2745,6 +2772,8 @@ class User extends CommonObject
$this->office_fax=$ldapuser->{$conf->global->LDAP_FIELD_FAX};
$this->email=$ldapuser->{$conf->global->LDAP_FIELD_MAIL};
$this->skype=$ldapuser->{$conf->global->LDAP_FIELD_SKYPE};
+ $this->twitter=$ldapuser->{$conf->global->LDAP_FIELD_TWITTER};
+ $this->facebook=$ldapuser->{$conf->global->LDAP_FIELD_FACEBOOK};
$this->ldap_sid=$ldapuser->{$conf->global->LDAP_FIELD_SID};
$this->job=$ldapuser->{$conf->global->LDAP_FIELD_TITLE};
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index 843304fbe45..b9be32bcafa 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -1079,20 +1079,72 @@ class Website extends CommonObject
}
/**
- * Component to select language (Full CSS Only)
+ * Component to select language inside a container (Full CSS Only)
*
- * @param array $languagecodes Language codes array. Example: array('en_US','fr_FR','de_DE','es_ES')
- * @param Translate $weblangs Language Object
- * @param string $morecss More CSS class on component
- * @param string $htmlname Suffix for HTML name
- * @return string HTML select component
+ * @param array|string $languagecodes 'auto' to show all languages available for page, or language codes array like array('en_US','fr_FR','de_DE','es_ES')
+ * @param Translate $weblangs Language Object
+ * @param string $morecss More CSS class on component
+ * @param string $htmlname Suffix for HTML name
+ * @return string HTML select component
*/
public function componentSelectLang($languagecodes, $weblangs, $morecss='', $htmlname='')
{
+ global $websitepagefile, $website;
+
if (! is_object($weblangs)) return 'ERROR componentSelectLang called with parameter $weblangs not defined';
- $languagecodeselected = $weblangs->defaultlang;
+ // Load tmppage if we have $websitepagefile defined
+ $tmppage=new WebsitePage($this->db);
+
+ $pageid = 0;
+ if (! empty($websitepagefile))
+ {
+ $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
+ if ($pageid > 0)
+ {
+ $tmppage->fetch($pageid);
+ }
+ }
+
+ // Fill with existing translation, nothing if none
+ if (! is_array($languagecodes) && $pageid > 0)
+ {
+ $languagecodes = array();
+
+ $sql ="SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
+ $sql.=" FROM ".MAIN_DB_PREFIX."website_page as wp";
+ $sql.=" WHERE wp.fk_website = ".$website->id;
+ $sql.=" AND (wp.fk_page = ".$pageid." OR wp.rowid = ".$pageid;
+ if ($tmppage->fk_page > 0) $sql.=" OR wp.fk_page = ".$tmppage->fk_page." OR wp.rowid = ".$tmppage->fk_page;
+ $sql.=")";
+
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ while ($obj = $this->db->fetch_object($resql))
+ {
+ $newlang = $obj->lang;
+ if ($obj->rowid == $pageid) $newlang = $obj->lang;
+ if (! in_array($newlang, $languagecodes)) $languagecodes[]=$newlang;
+ }
+ }
+ }
+ // Now $languagecodes is always an array
+
+ $languagecodeselected= $weblangs->defaultlang; // Because we must init with a value, but real value is the lang of main parent container
+ if (! empty($websitepagefile))
+ {
+ $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
+ if ($pageid > 0)
+ {
+
+ $languagecodeselected=$tmppage->lang;
+ if (! in_array($tmppage->lang, $languagecodes)) $languagecodes[]=$tmppage->lang; // We add language code of page into combo list
+ }
+ }
+
$weblangs->load('languages');
+ //var_dump($weblangs->defaultlang);
$url = $_SERVER["REQUEST_URI"];
$url = preg_replace('/(\?|&)l=([a-zA-Z_]*)/', '', $url); // We remove param l from url
diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php
index 4277a03167d..79ff3bc789d 100644
--- a/htdocs/website/class/websitepage.class.php
+++ b/htdocs/website/class/websitepage.class.php
@@ -193,8 +193,11 @@ class WebsitePage extends CommonObject
$this->fk_website = $obj->fk_website;
$this->type_container = $obj->type_container;
+
$this->pageurl = $obj->pageurl;
+ $this->ref = $obj->pageurl;
$this->aliasalt = preg_replace('/,+$/', '', preg_replace('/^,+/', '', $obj->aliasalt));
+
$this->title = $obj->title;
$this->description = $obj->description;
$this->keywords = $obj->keywords;
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 1d277c32ed7..e9e14c4f888 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -1749,7 +1749,7 @@ if (count($object->records) > 0) // There is at least one web site
$htmltext = $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot);
$htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
- $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
+ $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website '.DOL_DATA_ROOT.'/medias');
print '';
print $form->textwithpicto('', $htmltext, 1, 'preview');
print '';
@@ -1760,7 +1760,7 @@ if (count($object->records) > 0) // There is at least one web site
$htmltext =$langs->trans("SetHereVirtualHost", $dataroot);
$htmltext.=' ';
$htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
- $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
+ $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website '.DOL_DATA_ROOT.'/medias');
$htmltext.=' ';
$htmltext.=' ';
$htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
@@ -1782,7 +1782,7 @@ if (count($object->records) > 0) // There is at least one web site
$htmltext = $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").'');
$htmltext.=' ';
$htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
- $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
+ $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website '.DOL_DATA_ROOT.'/medias');
print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
print $form->textwithpicto('', $htmltext, 1, 'preview_ext');
print '';
@@ -1926,10 +1926,11 @@ if (count($object->records) > 0) // There is at least one web site
// Create an array for form
$preselectedlanguage = GETPOST('newlang', 'az09') ? GETPOST('newlang', 'az09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
$formquestion = array(
- array('type' => 'text', 'tdclass'=>'maxwidth200', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> 'copy_of_'.$objectpage->pageurl),
+ array('type' => 'hidden', 'name' => 'sourcepageurl', 'value'=> $objectpage->pageurl),
array('type' => 'checkbox', 'tdclass'=>'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0),
array('type' => 'other','name' => 'newlang', 'label' => $langs->trans("Language"), 'value' => $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, 1, 0, 0, 'minwidth200', 0, 1)),
array('type' => 'other','name' => 'newwebsite', 'label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)),
+ array('type' => 'text', 'tdclass'=>'maxwidth200 fieldrequired', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> 'copy_of_'.$objectpage->pageurl),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?website='.$object->ref.'&pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550);
@@ -1943,6 +1944,7 @@ if (count($object->records) > 0) // There is at least one web site
print '';
+ print ''."\n";
print '';
print ' ';
print $langs->trans("EditInLine");
@@ -1966,12 +1968,12 @@ if (count($object->records) > 0) // There is at least one web site
print ' ';
print ' ';
print $langs->trans("ShowSubcontainers");
- if ($websitepage->grabbed_from)
+ /*if ($websitepage->grabbed_from)
{
print ' '.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"),'switch_off','',false,0,0,'','nomarginleft').'';
}
else
- {
+ {*/
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
print ' ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOff"),'switch_off','',false,0,0,'','nomarginleft').'';
@@ -1980,7 +1982,7 @@ if (count($object->records) > 0) // There is at least one web site
{
print ' ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOn"),'switch_on','',false,0,0,'','nomarginleft').'';
}
- }
+ /*}*/
print ' ';
print ' ';
@@ -2002,7 +2004,7 @@ if (count($object->records) > 0) // There is at least one web site
$htmltext = $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot);
$htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
- $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
+ $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website '.DOL_DATA_ROOT.'/medias');
print '';
print $form->textwithpicto('', $htmltext, 1, 'preview');
@@ -2320,7 +2322,7 @@ if ($action == 'createsite')
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref');
$htmltext.=' ';
$htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
- $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
+ $htmltext.=' '.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website '.DOL_DATA_ROOT.'/medias');
print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'tooltipvirtual');
print ' | ';
@@ -2517,6 +2519,53 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1');
print ' |
';
+ if ($action != 'createcontainer')
+ {
+ // Translation of
+ if ($objectpage->fk_page > 0)
+ {
+ print '