Qual: All text for html output is inside display_canvas()

This commit is contained in:
Laurent Destailleur 2011-05-31 22:31:38 +00:00
parent e92c686bcb
commit 31ff9bb739
13 changed files with 124 additions and 70 deletions

View File

@ -194,7 +194,7 @@ class ActionsContactCardCommon
$out='';
if ($action == 'view' || $action == 'edit') $out.= $langs->trans("Contact");
if ($action == 'view' || $action == 'edit') $out.= $langs->trans("ContactsAddresses");
if ($action == 'create') $out.= $langs->trans("AddContact");
return $out;

View File

@ -19,7 +19,7 @@
*/
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CONTACTCARD_CREATE.TPL.PHP DEFAULT -->
<?php
print_fiche_titre($this->control->tpl['title']);
@ -102,7 +102,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td><?php echo $langs->trans("IM"); ?></td>
<td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['jabberid']; ?>"></td>
</tr>

View File

@ -17,9 +17,12 @@
*
* $Id$
*/
$contact = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CONTACTCARD_EDIT.TPL.PHP DEFAULT -->
<?php
print_fiche_titre($this->control->tpl['title']);
@ -118,7 +121,7 @@ echo $this->control->tpl['ajax_selectcountry'];
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td><?php echo $langs->trans("IM"); ?></td>
<td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['jabberid']; ?>"></td>
</tr>

View File

@ -17,9 +17,12 @@
*
* $Id$
*/
$contact = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->
<?php
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
@ -103,7 +106,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
</tr>
<tr>
<td><?php echo $langs->trans("Jabberid"); ?></td>
<td><?php echo $langs->trans("IM"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['jabberid']; ?></td>
</tr>

View File

@ -313,7 +313,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
}
else if ($action == 'edit')
{
$objcanvas->control->object=$objcanvas->getObject($socid); // Load object
$objcanvas->control->object=$objcanvas->getObject($id); // Load object
if (empty($objcanvas->control->object))
{
$object = new Contact($db);
@ -326,7 +326,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
}
else
{
$objcanvas->control->object=$objcanvas->getObject($socid); // Load object
$objcanvas->control->object=$objcanvas->getObject($id); // Load object
if (empty($objcanvas->control->object))
{
$object = new Contact($db);

View File

@ -973,7 +973,6 @@ class Form
$sql.= $db->order("p.ref");
$sql.= $db->plimit($limit);
// Build output string
$outselect='';
$outjson=array();

View File

@ -360,17 +360,6 @@ class ActionsCardCommon
return $out;
}
/**
* Return the head of card (tabs)
*/
function showHead($action)
{
$head = societe_prepare_head($this->object);
$title = $this->getTitle($action);
return dol_fiche_head($head, 'card', $title, 0, 'company');
}
/**
* Assigne les valeurs par defaut pour le canvas
* @param action Type of template
@ -547,7 +536,13 @@ class ActionsCardCommon
}
else
{
$this->tpl['showhead']=$this->showHead('view');
/* TODO dol_fiche_head and dol_fiche_end must return a string and no do a print
$head = societe_prepare_head($this->object);
$title = $this->getTitle($action);
$this->tpl['showhead']=dol_fiche_head($head, 'card', $title, 0, 'company');
$this->tpl['showend']=dol_fiche_end();
*/
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom');

View File

@ -54,7 +54,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
<table class="border" width="100%">
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
<td><span class="fieldrequired"><?php echo $langs->trans('ThirdPartyName'); ?></span></td>
<td><input type="text" size="30" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?>
<td><?php echo $langs->trans('Prefix'); ?></td>

View File

@ -17,9 +17,12 @@
*
* $Id$
*/
$contact = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CARD_EDIT.TPL.PHP DEFAULT -->
<?php
print_fiche_titre($this->control->tpl['title']);
@ -42,7 +45,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
<table class="border" width="100%">
<tr>
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
<td><span class="fieldrequired"><?php echo $langs->trans('ThirdPartyName'); ?></span></td>
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
</tr>

View File

@ -17,9 +17,19 @@
*
* $Id$
*/
$soc = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CARD_VIEW.TPL.PHP DEFAULT -->
<?php
$head = societe_prepare_head($soc);
dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
?>
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
@ -28,7 +38,7 @@
<table class="border" width="100%">
<tr>
<td width="20%"><?php echo $langs->trans('Name'); ?></td>
<td width="20%"><?php echo $langs->trans('ThirdPartyName'); ?></td>
<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
</tr>
@ -226,7 +236,7 @@ for ($i=1; $i<=4; $i++) {
</table>
</div>
<?php dol_fiche_end(); ?>
<div class="tabsAction">
<?php if ($user->rights->societe->creer) { ?>
@ -248,4 +258,37 @@ for ($i=1; $i<=4; $i++) {
<br>
<table width="100%"><tr><td valign="top" width="50%">
<a name="builddoc"></a>
<?php
/*
* Documents generes
*/
$filedir=$conf->societe->dir_output.'/'.$socid;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
?>
</td>
<td></td>
</tr>
</table>
<br>
<?php
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$objcanvas->control->object);
// Contacts list
$result=show_contacts($conf,$langs,$db,$objcanvas->control->object);
// Projects list
$result=show_projects($conf,$langs,$db,$objcanvas->control->object);
?>
<!-- END PHP TEMPLATE -->

View File

@ -19,7 +19,7 @@
*/
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CARD_EDIT.TPL.PHP INDIVIDUAL -->
<?php
print_fiche_titre($this->control->tpl['title']);

View File

@ -17,9 +17,19 @@
*
* $Id$
*/
$soc = $GLOBALS['objcanvas']->control->object;
?>
<!-- BEGIN PHP TEMPLATE -->
<!-- BEGIN PHP TEMPLATE CARD_VIEW.TPL.PHP INDIVIDUAL -->
<?php
$head = societe_prepare_head($soc);
dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
?>
<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
@ -167,7 +177,7 @@
</table>
</div>
<?php dol_fiche_end(); ?>
<div class="tabsAction">
<?php if ($user->rights->societe->creer) { ?>
@ -189,4 +199,37 @@
<br>
<table width="100%"><tr><td valign="top" width="50%">
<a name="builddoc"></a>
<?php
/*
* Documents generes
*/
$filedir=$conf->societe->dir_output.'/'.$socid;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
?>
</td>
<td></td>
</tr>
</table>
<br>
<?php
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$objcanvas->control->object);
// Contacts list
$result=show_contacts($conf,$langs,$db,$objcanvas->control->object);
// Projects list
$result=show_projects($conf,$langs,$db,$objcanvas->control->object);
?>
<!-- END PHP TEMPLATE -->

View File

@ -418,40 +418,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$object->fetch($socid);
$objcanvas->control->object=$object;
}
$objcanvas->assign_values(); // Assign values
$objcanvas->display_canvas(); // Show template
// TODO Move this also into template
print '<table width="100%"><tr><td valign="top" width="50%">';
print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*/
$filedir=$conf->societe->dir_output.'/'.$socid;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$var=true;
$somethingshown=$formfile->show_documents('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
print '</td>';
print '<td></td>';
print '</tr>';
print '</table>';
print '<br>';
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$objcanvas->control->object);
// Contacts list
$result=show_contacts($conf,$langs,$db,$objcanvas->control->object);
// Projects list
$result=show_projects($conf,$langs,$db,$objcanvas->control->object);
$objcanvas->assign_values('view'); // Assign values
$objcanvas->display_canvas('view'); // Show template
}
}
else
@ -483,9 +451,6 @@ else
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;
/*
* Company Fact creation mode
*/
//if ($_GET["type"]=='cp') { $soc->client=3; }
if (GETPOST("type")!='f') $soc->client=3;
if (GETPOST("type")=='c') { $soc->client=1; }
@ -1684,7 +1649,7 @@ else
print '</table>';
print "</div>\n";
dol_fiche_end();
/*
@ -1704,7 +1669,7 @@ else
if ($conf->projet->enabled && $user->rights->projet->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
}
if ($user->rights->societe->supprimer)