- Revised styles for a nicer/cleaner display of the details and forms.

SVN:trunk[1187]
This commit is contained in:
Denis Flaven
2011-04-07 07:44:09 +00:00
parent 1a74fe1ec3
commit 1a818f309d
9 changed files with 89 additions and 18 deletions

View File

@@ -1275,17 +1275,49 @@ EOF
$aEventsList[] ='keyup';
$aEventsList[] ='change';
$sEditValue = $oAttDef->GetEditValue($value);
$sHTMLValue = "<table><tr><td><textarea class=\"resizable\" title=\"$sHelpText\" name=\"attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}\" rows=\"8\" cols=\"40\" id=\"$iId\">$sEditValue</textarea></td><td>{$sValidationField}</td></tr></table>";
$aStyles = array();
$sStyle = '';
$sWidth = $oAttDef->GetWidth('width', '');
if (!empty($sWidth))
{
$aStyles[] = 'width:'.$sWidth;
}
$sHeight = $oAttDef->GetHeight('height', '');
if (!empty($sHeight))
{
$aStyles[] = 'height:'.$sHeight;
}
if (count($aStyles) > 0)
{
$sStyle = 'style="'.implode('; ', $aStyles).'"';
}
$sHTMLValue = "<table><tr><td><textarea class=\"resizable\" title=\"$sHelpText\" name=\"attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}\" rows=\"8\" cols=\"40\" id=\"$iId\" $sStyle>$sEditValue</textarea></td><td>{$sValidationField}</td></tr></table>";
break;
case 'CaseLog':
$aEventsList[] ='validate';
$aEventsList[] ='keyup';
$aEventsList[] ='change';
$aStyles = array("overflow:auto;border:1px #999 solid; background:#fff");
$sStyle = '';
$sWidth = $oAttDef->GetWidth('width', '');
if (!empty($sWidth))
{
$aStyles[] = 'width:'.$sWidth;
}
$sHeight = $oAttDef->GetHeight('height', '');
if (!empty($sHeight))
{
$aStyles[] = 'height:'.$sHeight;
}
if (count($aStyles) > 0)
{
$sStyle = 'style="'.implode('; ', $aStyles).'"';
}
$sHeader = '<div class="caselog_input_header">&nbsp;'.Dict::S('UI:CaseLogTypeYourTextHere').'</div>';
$sEditValue = $oAttDef->GetEditValue($value);
$sPreviousLog = $oAttDef->GetAsHTML($value);
$sHTMLValue = "<div style=\"overflow:auto;border:1px #999 solid; background:#fff;\"><table style=\"width:100%\"><tr><td>$sHeader<textarea class=\"resizable\" style=\"border:0;width:100%\" title=\"$sHelpText\" name=\"attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}\" rows=\"8\" cols=\"40\" id=\"$iId\">$sEditValue</textarea>$sPreviousLog</td><td>{$sValidationField}</td></tr></table></div>";
$sHTMLValue = "<div $sStyle><table style=\"width:100%\"><tr><td>$sHeader<textarea style=\"border:0;width:100%\" title=\"$sHelpText\" name=\"attr_{$sFieldPrefix}{$sAttCode}{$sNameSuffix}\" rows=\"8\" cols=\"40\" id=\"$iId\">$sEditValue</textarea>$sPreviousLog</td><td>{$sValidationField}</td></tr></table></div>";
break;
case 'HTML':
@@ -1529,7 +1561,7 @@ EOF
}
// Attribute is read-only
$sHTMLValue = $this->GetAsHTML($sAttCode);;
$sHTMLValue = $this->GetAsHTML($sAttCode);
$sHTMLValue .= '<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>';
$aFieldsMap[$sAttCode] = $sInputId;
$sComments = $sSynchroIcon;

View File

@@ -119,6 +119,7 @@ try
changeYear: true
});
$('.resizable').resizable(); // Make resizable everything that claims to be resizable !
$('.caselog_header').click( function () { $(this).toggleClass('open').next('.caselog_entry').toggle(); });
}
catch(err)
{

View File

@@ -1,4 +1,4 @@
<div style="width:100%;background: url(../images/welcome.jpg) top left no-repeat;">
<div style="width:100%;background: #fff url(../images/welcome.jpg) top left no-repeat;">
<style>
.dashboard {
vertical-align:top;

View File

@@ -1412,6 +1412,16 @@ class AttributeText extends AttributeString
{
return Str::pure2xml($value);
}
public function GetWidth()
{
return $this->GetOptional('width', '');
}
public function GetHeight()
{
return $this->GetOptional('height', '');
}
}
/**

View File

@@ -14,8 +14,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
define('CASELOG_DATE_FORMAT', 'Y-m-d H:i:s');
define('CASELOG_HEADER_FORMAT', 'On %1$s, %2$s wrote:');
define('CASELOG_VISIBLE_ITEMS', 2);
define('CASELOG_SEPARATOR', "\n".'========== %1$s : %2$s (%3$d) ============'."\n\n");
@@ -81,7 +79,7 @@ class ormCaseLog {
$iPos += $this->m_aIndex[$index]['text_length'];
$sEntry = '<div class="caselog_header'.$sOpen.'">';
$sEntry .= sprintf(CASELOG_HEADER_FORMAT, $this->m_aIndex[$index]['date']->format(CASELOG_DATE_FORMAT), $this->m_aIndex[$index]['user_name']);
$sEntry .= sprintf(Dict::S('UI:CaseLog:Header_Date_UserName'), $this->m_aIndex[$index]['date']->format(Dict::S('UI:CaseLog:DateFormat')), $this->m_aIndex[$index]['user_name']);
$sEntry .= '</div>';
$sEntry .= '<div class="caselog_entry"'.$sDisplay.'>';
$sEntry .= $sTextEntry;
@@ -116,7 +114,7 @@ class ormCaseLog {
$sDisplay = '';
}
$sHtml .= '<div class="caselog_header'.$sOpen.'">';
$sHtml .= '&nbsp;';
$sHtml .= Dict::S('UI:CaseLog:InitialValue');
$sHtml .= '</div>';
$sHtml .= '<div class="caselog_entry"'.$sDisplay.'>';
$sHtml .= $sTextEntry;
@@ -133,7 +131,7 @@ class ormCaseLog {
*/
public function AddLogEntry($sText)
{
$sDate = date(CASELOG_DATE_FORMAT);
$sDate = date(Dict::S('UI:CaseLog:DateFormat'));
$sSeparator = sprintf(CASELOG_SEPARATOR, $sDate, UserRights::GetUserFriendlyName(), UserRights::GetUserId());
$iSepLength = strlen($sSeparator);
$iTextlength = strlen($sText);

View File

@@ -154,9 +154,26 @@ td.label span {
}
fieldset td.label span {
padding: 3px;
padding-right: 10px;
padding-right: 10px;
}
fieldset {
margin-top: 3px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
border-style: solid;
border-color: #ddd;
}
legend {
padding:8px;
color: #fff;
background-color: #1C94C4;
font-weight: bold;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.ui-widget-content td a, p a, p a:visited, td a, td a:visited {
text-decoration:none;
color: #1C94C4;
@@ -977,6 +994,13 @@ span.form_validation {
.caselog {
overflow-x: hidden;
}
.caselog_input_header {
padding-top:3px;
padding-bottom:3px;
border-top:1px solid #fff;
background: #ddd;
width:100%;
}
.caselog_header {
padding:3px;
border-top:1px solid #fff;
@@ -1000,12 +1024,12 @@ table.details {
width:100%;
}
table.details>tbody>tr>td {
noborder-top: 2px #fff solid;
border-bottom: 2px #ddd solid;
padding-bottom: 5px;
padding-top: 3px;
background: transparent url(../images/details_sep.gif) bottom repeat-x;
}
fieldset table.details>tbody>tr>td {
padding-top: 3px;
background: transparent;
border: 0;
}

View File

@@ -907,5 +907,9 @@ When associated with a trigger, each action is given an "order" number, specifyi
'UI:AttemptingToSetAReadOnlyAttribute_Name' => 'Attempting to set the read-only field: %1$s',
'UI:FailedToApplyStimuli' => 'The action has failed.',
'UI:StimulusModify_N_ObjectsOf_Class' => '%1$s: Modifying %2$d objects of class %3$s',
'UI:CaseLogTypeYourTextHere' => 'Type your text here:',
'UI:CaseLog:DateFormat' => 'Y-m-d H:i:s',
'UI:CaseLog:Header_Date_UserName' => '%1$s - %2$s:',
'UI:CaseLog:InitialValue' => 'Initial value:',
));
?>

View File

@@ -220,9 +220,9 @@ function RequestCreationForm($oP, $oUserOrg)
$oRequest->Set('servicesubcategory_id', $aParameters['servicesubcategory_id']);
$oAttDef = MetaModel::GetAttributeDef('UserRequest', 'service_id');
$aDetails[] = array('label' => $oAttDef->GetLabel(), 'value' => htmlentities($oService->GetName(), ENT_QUOTES, 'UTF-8'));
$aDetails[] = array('label' => '<span>'.$oAttDef->GetLabel().'</span>', 'value' => htmlentities($oService->GetName(), ENT_QUOTES, 'UTF-8'));
$oAttDef = MetaModel::GetAttributeDef('UserRequest', 'servicesubcategory_id');
$aDetails[] = array('label' => $oAttDef->GetLabel(), 'value' => htmlentities($oSubService->GetName(), ENT_QUOTES, 'UTF-8'));
$aDetails[] = array('label' => '<span>'.$oAttDef->GetLabel().'</span>', 'value' => htmlentities($oSubService->GetName(), ENT_QUOTES, 'UTF-8'));
$iFlags = 0;
foreach($aList as $sAttCode)
{
@@ -247,9 +247,9 @@ function RequestCreationForm($oP, $oUserOrg)
$aFieldsMap[$sAttCode] = 'attr_'.$sAttCode;
$sValue = $oRequest->GetFormElementForField($oP, get_class($oRequest), $sAttCode, $oAttDef, $value, '', 'attr_'.$sAttCode, '', $iFlags, $aArgs);
$aDetails[] = array('label' => $oAttDef->GetLabel(), 'value' => $sValue);
$aDetails[] = array('label' => '<span>'.$oAttDef->GetLabel().'</span>', 'value' => $sValue);
}
$aDetails[] = array('label' => Dict::S('Portal:Attachments'), 'value' => '&nbsp;');
$aDetails[] = array('label' => '<span>'.Dict::S('Portal:Attachments').'</span>', 'value' => '&nbsp;');
$aDetails[] = array('label' => '&nbsp;', 'value' => '<div id="attachments"></div><p><button type="button" onClick="AddAttachment();">'.Dict::S('Portal:AddAttachment').'</button/></p>');
$oP->add_linked_script("../js/json.js");
$oP->add_linked_script("../js/forms-json-utils.js");
@@ -261,8 +261,9 @@ function RequestCreationForm($oP, $oUserOrg)
$oP->add("<div class=\"wizContainer\" id=\"form_request_description\">\n");
$oP->add("<h1 id=\"title_request_form\">".Dict::S('Portal:DescriptionOfTheRequest')."</h1>\n");
$oP->add("<form action=\"../portal/index.php\" enctype=\"multipart/form-data\" id=\"request_form\" method=\"post\">\n");
$oP->add("<table>\n");
$oP->add("<table><tr><td>\n");
$oP->details($aDetails);
$oP->add("</td></tr></table>\n");
DumpHiddenParams($oP, $aList, $aParameters);
$oP->add("<input type=\"hidden\" name=\"step\" value=\"3\">");
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"create_request\">");
@@ -562,7 +563,7 @@ function DisplayRequestDetails($oP, UserRequest $oRequest)
$aDetails[] = array('label' => '<span title="'.MetaModel::GetDescription('UserRequest', $sAttCode).'">'.MetaModel::GetLabel('UserRequest', $sAttCode).'</span>', 'value' => $sDisplayValue);
}
}
$oP->add('<div id="request_details">');
$oP->add('<div id="request_details" class="ui-widget-content">');
$sOQL = 'SELECT FileDoc AS Doc JOIN lnkTicketToDoc AS L ON L.document_id = Doc.id WHERE L.ticket_id = :request_id';
$oSearch = DBObjectSearch::FromOQL($sOQL);
$oSet = new CMDBObjectSet($oSearch, array(), array('request_id' => $oRequest->GetKey()));

View File

@@ -114,6 +114,7 @@ a.button span {
}
#request_details table {
border: #f1f1f6 2px solid;
text-align: left;
}
#form_details {
display: inline-block;