Work on module website

This commit is contained in:
Laurent Destailleur 2016-09-17 21:03:20 +02:00
parent d0136f5c85
commit 97e396af69
5 changed files with 53 additions and 23 deletions

View File

@ -95,6 +95,7 @@ create table llx_product_lot_extrafields
ALTER TABLE llx_product_lot_extrafields ADD INDEX idx_product_lot_extrafields (fk_object); ALTER TABLE llx_product_lot_extrafields ADD INDEX idx_product_lot_extrafields (fk_object);
ALTER TABLE llx_website_page MODIFY content MEDIUMTEXT;

View File

@ -25,7 +25,7 @@ CREATE TABLE llx_website_page
title varchar(255), title varchar(255),
description varchar(255), description varchar(255),
keywords varchar(255), keywords varchar(255),
content text, content mediumtext, -- text is not enough in size
status integer, status integer,
date_creation datetime, date_creation datetime,
date_modification datetime, date_modification datetime,

View File

@ -2007,7 +2007,9 @@ span.tabspan {
/* Boutons actions */ /* Boutons actions */
/* ============================================================================== */ /* ============================================================================== */
div.divButAction { margin-bottom: 1.4em; } div.divButAction {
margin-bottom: 1.4em;
}
span.butAction, span.butActionDelete { span.butAction, span.butActionDelete {
cursor: pointer; cursor: pointer;
@ -3321,6 +3323,7 @@ td.hidden {
} }
.websitetools { .websitetools {
float: right; float: right;
height: 28px;
} }
.websiteinputurl { .websiteinputurl {
display: inline-block; display: inline-block;

View File

@ -32,7 +32,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
@ -580,7 +580,7 @@ div.myavailability {
margin-top: 25px !important; margin-top: 25px !important;
} }
/* for future usage (when left menu has been removed) */ /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */
.table-responsive { .table-responsive {
width: calc(100% - 330px); width: calc(100% - 330px);
margin-bottom: 15px; margin-bottom: 15px;
@ -615,7 +615,7 @@ div.myavailability {
.maxwidth500 { max-width: 500px; } .maxwidth500 { max-width: 500px; }
.minheight20 { min-height: 20px; } .minheight20 { min-height: 20px; }
.minheight40 { min-height: 40px; } .minheight40 { min-height: 40px; }
.titlefield { width: 30%; } .titlefield { width: 25%; }
.titlefieldcreate { width: 20%; } .titlefieldcreate { width: 20%; }
/* Force values for small screen */ /* Force values for small screen */
@ -849,7 +849,7 @@ div.ficheaddleft {
<?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } <?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; }
else print "margin-top: 10px;\n"; ?> else print "margin-top: 10px;\n"; ?>
} }
/* Force values for small screen */ /* Force values on one colum for small screen */
@media only screen and (max-width: 900px) @media only screen and (max-width: 900px)
{ {
div.fiche { div.fiche {
@ -1167,7 +1167,7 @@ div.mainmenu {
div.mainmenu.home{ div.mainmenu.home{
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png',1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png',1) ?>);
background-position-x: middle; background-position-x: center;
} }
div.mainmenu.accountancy { div.mainmenu.accountancy {
@ -1281,7 +1281,7 @@ foreach($mainmenuusedarray as $val)
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1);
$found=1; $found=1;
if ($generic < 4) $generic++; if ($generic < 4) $generic++;
print "/* A mainmenu entry but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
} }
if ($found) if ($found)
{ {
@ -1777,7 +1777,7 @@ img.toolbarbutton {
} }
/* hide the toggler-button when the pane is 'slid open' */ /* hide the toggler-button when the pane is 'slid open' */
.ui-layout-resizer-sliding ui-layout-toggler { .ui-layout-resizer-sliding .ui-layout-toggler {
display: none; display: none;
} }
@ -3216,7 +3216,18 @@ td.hidden {
} }
.websitetools { .websitetools {
float: right; float: right;
padding-top: 2px; height: 28px;
}
.websiteinputurl {
display: inline-block;
vertical-align: top;
}
.websiteiframenoborder {
border: 0px;
}
a.websitebuttonsitepreview img {
width: 26px;
display: inline-block;
} }
.websiteiframenoborder { .websiteiframenoborder {
border: 0px; border: 0px;

View File

@ -222,34 +222,47 @@ if ($action == 'delete')
// Update css // Update css
if ($action == 'updatecss') if ($action == 'updatecss')
{ {
$db->begin(); //$db->begin();
$res = $object->fetch(0, $website); $res = $object->fetch(0, $website);
/* /*
$res = $object->update($user); $res = $object->update($user);
if ($res > 0) if ($res > 0)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$action=''; $action='';
} }
else else
{ {
$error++;
$db->rollback(); $db->rollback();
}*/ }*/
$csscontent ='<?php'."\n"; $csscontent = '<!-- START DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
$csscontent.= '<?php '."\n";
$csscontent.= "header('Content-type: text/css');\n"; $csscontent.= "header('Content-type: text/css');\n";
$csscontent.= "?>"."\n"; $csscontent.= "?>"."\n";
$csscontent.= '<!-- END -->'."\n";
$csscontent.= GETPOST('WEBSITE_CSS_INLINE'); $csscontent.= GETPOST('WEBSITE_CSS_INLINE');
dol_syslog("Save file css into ".$filecss);
dol_mkdir($pathofwebsite); dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent); $result = file_put_contents($filecss, $csscontent);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK)); @chmod($filecss, octdec($conf->global->MAIN_UMASK));
if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); if (! $result)
else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); {
$error++;
setEventMessages('Failed to write file '.$filecss, null, 'errors');
}
if (! $error)
{
setEventMessages($langs->trans("Saved"), null, 'mesgs');
}
$action='preview'; $action='preview';
} }
@ -432,7 +445,7 @@ if ($action == 'updatecontent')
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */ /* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
$res = $objectpage->update($user); $res = $objectpage->update($user);
if (! $res > 0) if ($res < 0)
{ {
$error++; $error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors'); setEventMessages($objectpage->error, $objectpage->errors, 'errors');
@ -487,7 +500,7 @@ if ($action == 'updatecontent')
dol_delete_file($filetpl); dol_delete_file($filetpl);
$tplcontent =''; $tplcontent ='';
$tplcontent.= '<?php require "./master.inc.php"; ?>'."\n"; $tplcontent.= "<?php if (! defined('USEDOLIBARRSERVER')) require './master.inc.php'; ?>"."\n";
$tplcontent.= '<html>'."\n"; $tplcontent.= '<html>'."\n";
$tplcontent.= '<header>'."\n"; $tplcontent.= '<header>'."\n";
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n"; $tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
@ -840,6 +853,8 @@ if ($action == 'editcss')
print '<br>'; print '<br>';
$csscontent = @file_get_contents($filecss); $csscontent = @file_get_contents($filecss);
// Clean php css file to get only css part
$csscontent = preg_replace('/<!-- START DOLIBARR.*END -->/s', '', $csscontent);
dol_fiche_head(); dol_fiche_head();
@ -967,7 +982,7 @@ if ($action == 'editcontent')
$doleditor->Create(0, '', false); $doleditor->Create(0, '', false);
} }
print '</div></form>'; print "</div>\n</form>\n";