@ -158,7 +158,7 @@ function showIdentifiedQuestions(questions) {
var content = $ ( '<div></div>' ) ;
content . append ( $ ( '<div class="catelog">IDENTIFIED ISSUES</div>' ) ) ;
if ( questions && questions . length > 0 ) {
createQuestionContent1 ( content , questions ) ;
createQuestionContent1 ( content , questions , true );
}
else
content . append ( $ ( '<div class="question"></div>' ) . text ( GetTextByKey ( "P_IPT_NOQUESTIONS" , 'No Questions' ) ) ) ;
@ -210,8 +210,7 @@ function showSignature(report) {
else if ( layoutDivider == 2 ) //Grid
div _pic . addClass ( 'question_div_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _pic . css ( 'line-height' , '30px' ) ;
div _pic . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
}
@ -247,8 +246,7 @@ function showMedias() {
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30px' ) ;
div _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
else if ( layoutStyle == 2 ) { //Split
var div _question = $ ( '<table style="width:100%;" class="question_table"></table>' ) ;
@ -279,8 +277,7 @@ function showMedias() {
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30px' ) ;
div _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
else {
var div _question = $ ( '<table style="width:100%;" class="question_table"></table>' ) ;
@ -297,14 +294,13 @@ function showMedias() {
}
if ( layoutDivider == 1 ) //Line
div _question . addClass ( 'question_line' ) ;
div _question . addClass ( 'question_standard_table_ line' ) ;
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_table_grid' ) ;
div _question . addClass ( 'question_standard_ table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30 px') ;
div _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16 px') ;
}
$ ( '#divpages' ) . append ( content ) ;
}
@ -355,8 +351,7 @@ function createPage(page) {
else if ( layoutDivider == 2 ) //Grid
tabpage . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
tabpage . css ( 'line-height' , '30px' ) ;
tabpage . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
else {
var divpage = $ ( '<div class="page"></div>' ) ;
@ -404,8 +399,7 @@ function createSectionContent(page) {
else if ( layoutDivider == 2 ) //Grid
tabsection . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
tabsection . css ( 'line-height' , '30px' ) ;
tabsection . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
var qc = createQuestionContent ( s ) ;
content . append ( qc ) ;
@ -459,35 +453,36 @@ function createSectionContent(page) {
function createQuestionContent ( section ) {
var content = $ ( '<div style="margin-bottom:30px;"></div>' ) ;
if ( section . Questions && section . Questions . length > 0 ) {
createQuestionContent1 ( content , section . Questions ) ;
createQuestionContent1 ( content , section . Questions , false );
}
else
content . append ( $ ( '<div class="question"></div>' ) . text ( GetTextByKey ( "P_IPT_NOQUESTIONS" , 'No Questions' ) ) ) ;
return content ;
}
function createQuestionContent1 ( content , questions ) {
function createQuestionContent1 ( content , questions , isidentified ) {
if ( questions && questions . length > 0 ) {
if ( layoutStyle == 1 ) { //Compressed
var div _question = $ ( '<table style="width:100%;" class="question_table"></table>' ) ;
content . append ( div _question ) ;
for ( var i = 0 ; i < questions . length ; i ++ ) {
var q = questions [ i ] ;
if ( ignoreQuestion ( q , isidentified ) ) continue ;
var tr _question = $ ( '<tr style="width:100%;"></tr>' ) ;
div _question . append ( tr _question ) ;
tr _question . append ( $ ( '<td style="width:33%;"></td>' ) . text ( q . DisplayText ) ) ;
var td _answer = $ ( '<td style="width:33%;"></td>' ) ;
tr _question . append ( td _answer ) ;
createAnswerContent ( td _answer , q ) ;
createAnswerContent ( td _answer , q , isidentified );
var td _comment = $ ( '<td style="width:33%;"></td>' ) ;
tr _question . append ( td _comment ) ;
var comment = td _answer . data ( 'comment' ) ;
if ( comment && comment != "" ) {
td _comment . append ( $ ( '<div class="answer"></div>' ) . html ( replaceHtmlText ( comment ) ) ) ;
}
if ( q . IsImportant && layoutHighlightColor )
tr _question . css ( 'background- color' , layoutHighlightColor ) ;
tr _question . css ( 'color' , layoutHighlightColor ) ;
}
if ( layoutDivider == 1 ) //Line
@ -495,16 +490,18 @@ function createQuestionContent1(content, questions) {
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30px' ) ;
div _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
else if ( layoutStyle == 2 ) { //Split
var div _question = $ ( '<table style="width:100%;" class="question_table"></table>' ) ;
content . append ( div _question ) ;
var tr _question = "" ;
var qindex = 0 ;
for ( var i = 0 ; i < questions . length ; i ++ ) {
var q = questions [ i ] ;
if ( i % 2 == 0 ) {
if ( ignoreQuestion ( q , isidentified ) ) continue ;
if ( qindex % 2 == 0 ) {
tr _question = $ ( '<tr style="width:100%;"></tr>' ) ;
div _question . append ( tr _question ) ;
}
@ -512,13 +509,15 @@ function createQuestionContent1(content, questions) {
tr _question . append ( td _question ) ;
var td _answer = $ ( '<td style="width:25%;"></td>' ) ;
tr _question . append ( td _answer ) ;
createAnswerContent ( td _answer , q ) ;
createAnswerContent ( td _answer , q , isidentified );
if ( q . IsImportant && layoutHighlightColor ) {
td _question . css ( 'background- color' , layoutHighlightColor ) ;
td _answer . css ( 'background- color' , layoutHighlightColor ) ;
td _question . css ( 'color' , layoutHighlightColor ) ;
td _answer . css ( 'color' , layoutHighlightColor ) ;
}
qindex ++ ;
}
if ( questions . length % 2 != 0 ) {
if ( qindex % 2 != 0 ) {
tr _question . append ( $ ( '<td style="width:25%;"></td><td style="width:25%;"></td>' ) ) ;
}
if ( layoutDivider == 1 ) //Line
@ -526,16 +525,21 @@ function createQuestionContent1(content, questions) {
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_table_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30px' ) ;
div _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
}
else {
for ( var i = 0 ; i < questions . length ; i ++ ) {
var q = questions [ i ] ;
var div _question = $ ( '<div class="question"></div>' ) ;
content . append ( div _question ) ;
if ( ignoreQuestion ( q , isidentified ) ) continue ;
var tab _question = $ ( '<table style="width:100%;" class="question_table"></table>' ) ;
content . append ( tab _question ) ;
var tr _question = $ ( '<tr style="width:100%;"></tr>' ) ;
tab _question . append ( tr _question ) ;
var td _question = $ ( '<td style="width:100%;"></td>' ) ;
tr _question . append ( td _question ) ;
var div _question = $ ( '<div class="question"></div>' ) ;
td _question . append ( div _question ) ;
var div _title = $ ( '<div style="width:320px;flex-grow:1;"></div>' ) . text ( q . DisplayText ) ;
div _question . append ( div _title ) ;
if ( q . StaticPictures && q . StaticPictures . length > 0 ) {
@ -544,18 +548,23 @@ function createQuestionContent1(content, questions) {
div _question . append ( div _pic )
}
createAnswerContent ( content , q ) ;
tr _question = $ ( '<tr style="width:100%;"></tr>' ) ;
tab _question . append ( tr _question ) ;
var td _answer = $ ( '<td style="width:100%;"></td>' ) ;
tr _question . append ( td _answer ) ;
createAnswerContent ( td _answer , q , isidentified ) ;
if ( layoutDivider == 1 ) //Line
div _question . addClass ( 'question_line' ) ;
tab _question . addClass ( 'question_standard_table_ line' ) ;
else if ( layoutDivider == 2 ) //Grid
div _question . addClass ( 'question_div _grid' ) ;
tab _question . addClass ( 'question_standard_table _grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _question . css ( 'line-height' , '30px' ) ;
tab _question . css ( 'line-height' , layoutSpacing == 1 ? '32px' : '16px' ) ;
if ( q . IsImportant && layoutHighlightColor )
div _question . css ( 'background- color' , layoutHighlightColor ) ;
if ( q . IsImportant && layoutHighlightColor ) {
tab _question . css ( 'color' , layoutHighlightColor ) ;
div _question . css ( 'color' , layoutHighlightColor ) ;
}
}
}
@ -564,38 +573,12 @@ function createQuestionContent1(content, questions) {
if ( layoutStyle == 1 || layoutStyle == 2 ) {
div _answer . addClass ( 'table_content' ) ;
}
else {
var isimportant = div _answer . data ( 'isimportant' ) ;
if ( isimportant && layoutHighlightColor )
div _answer . css ( 'background-color' , layoutHighlightColor ) ;
if ( layoutDivider == 1 ) //Line
div _answer . addClass ( 'question_line' ) ;
else if ( layoutDivider == 2 ) //Grid
div _answer . addClass ( 'question_div_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _answer . css ( 'line-height' , '30px' ) ;
}
} ) ;
content . find ( '.div_media' ) . each ( function ( ) {
var div _media = $ ( this ) ;
if ( layoutStyle == 1 || layoutStyle == 2 ) {
div _media . css ( 'padding-left' , '3px' ) ;
}
else {
var isimportant = div _media . data ( 'isimportant' ) ;
if ( isimportant && layoutHighlightColor )
div _media . css ( 'background-color' , layoutHighlightColor ) ;
if ( layoutDivider == 1 ) //Line
div _media . addClass ( 'question_line' ) ;
else if ( layoutDivider == 2 ) //Grid
div _media . addClass ( 'question_div_grid' ) ;
if ( layoutSpacing == 1 ) //Double Space
div _media . css ( 'line-height' , '30px' ) ;
}
} ) ;
}
return content ;
@ -612,8 +595,39 @@ function createPictures(pictures, p) {
}
return p ;
}
function ignoreQuestion ( q , isidentified ) {
var ignore = false ;
if ( q . QuestionType == 10 || ( q . QuestionType == 15 && q . SubType == 15 ) ) { //Picture
var hasPicture = false ;
if ( reportdata && reportdata . Answers ) {
for ( var i = 0 ; i < reportdata . Answers . length ; i ++ ) {
var a = reportdata . Answers [ i ] ;
if ( a . QuestionId . toLowerCase ( ) == q . Id . toLowerCase ( ) ) {
if ( reportdata . Medias && reportdata . Medias . length > 0 ) {
for ( var j = 0 ; j < reportdata . Medias . length ; j ++ ) {
var m = reportdata . Medias [ j ] ;
if ( m . AnswerId . toLowerCase ( ) == a . Id . toLowerCase ( ) ) {
if ( layoutPicturesDisplay == 1 ) //Displayed At Bottom
{
if ( isidentified == false )
mediasdata . push ( m ) ;
}
else
hasPicture = true ;
}
}
}
}
}
}
ignore = ! hasPicture ;
}
else
ignore = false ;
return ignore ;
}
function createAnswerContent ( p , q ) {
function createAnswerContent ( p , q , isidentified ) {
var leveltext = showSeverityLevel ( q . SeverityLevel ) ;
var label _level = $ ( '<label class="label_level"></label>' ) . text ( leveltext ) ;
if ( reportdata && reportdata . Answers ) {
@ -638,16 +652,19 @@ function createAnswerContent(p, q) {
var div _answer = $ ( '<div class="answer"></div>' ) . data ( 'isimportant' , q . IsImportant ) ;
if ( q . QuestionType == 1
|| ( q . QuestionType == 15 && q . SubType == 14 ) )
p . append ( div _answer . html ( replaceHtmlText ( result ) ) ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( div _answer . html ( replaceHtmlText ( result ) ) ) ;
else if ( q . QuestionType == 17 && q . TextToCompare != null && result . toLowerCase ( ) != q . TextToCompare . toLowerCase ( ) ) // BarCodeValidate
p . append ( div _answer
. append ( $ ( '<span style="color:red"></span>' ) . text ( result ) )
. append ( $ ( '<span style="margin-left:6px"></span>' ) . text ( '(' + q . TextToCompare + ')' ) )
) . append ( "<div style='clear:both;'></div>" ) ;
) ;
else
p . append ( div _answer . text ( result ) ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( div _answer . text ( result ) ) ;
div _answer . append ( label _level ) ;
p . append ( item ) ;
if ( layoutStyle == 0 )
p . append ( "<div style='clear:both;'></div>" ) ;
}
else if ( q . QuestionType == 5 ) { //YesOrNo
if ( a . SelectedItems && a . SelectedItems . length > 0 ) {
@ -662,7 +679,10 @@ function createAnswerContent(p, q) {
if ( a . SelectedItems [ 0 ] . BackgroundColor && a . SelectedItems [ 0 ] . BackgroundColor != "" ) {
div _bg . css ( 'background-color' , a . SelectedItems [ 0 ] . BackgroundColor ) ;
}
p . append ( item ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( item ) ;
if ( layoutStyle == 0 )
p . append ( "<div style='clear:both;'></div>" ) ;
}
}
else if ( q . QuestionType == 8 || q . QuestionType == 9 //DropDown、List
@ -682,7 +702,10 @@ function createAnswerContent(p, q) {
if ( a . SelectedItems [ j ] . BackgroundColor && a . SelectedItems [ j ] . BackgroundColor != "" ) {
div _bg . css ( 'background-color' , a . SelectedItems [ j ] . BackgroundColor ) ;
}
p . append ( item ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( item ) ;
if ( layoutStyle == 0 )
p . append ( "<div style='clear:both;'></div>" ) ;
}
}
}
@ -699,7 +722,9 @@ function createAnswerContent(p, q) {
if ( a . SelectedItems [ 0 ] . BackgroundColor && a . SelectedItems [ 0 ] . BackgroundColor != "" ) {
div _bg . css ( 'background-color' , a . SelectedItems [ 0 ] . BackgroundColor ) ;
}
p . append ( item ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( item ) ;
if ( layoutStyle == 0 )
p . append ( "<div style='clear:both;'></div>" ) ;
}
}
}
@ -726,7 +751,10 @@ function createAnswerContent(p, q) {
var m = reportdata . Medias [ j ] ;
if ( m . AnswerId . toLowerCase ( ) == a . Id . toLowerCase ( ) ) {
if ( layoutPicturesDisplay == 1 ) //Displayed At Bottom
mediasdata . push ( m ) ;
{
if ( isidentified == false )
mediasdata . push ( m ) ;
}
else { //Displayed As Taken
var media = createMedias ( m ) ;
pics . append ( media ) ;
@ -745,8 +773,10 @@ function createAnswerContent(p, q) {
if ( a . SelectedItems [ 0 ] . BackgroundColor && a . SelectedItems [ 0 ] . BackgroundColor != "" ) {
div _bg . css ( 'background-color' , a . SelectedItems [ 0 ] . BackgroundColor ) ;
}
p . append ( divanswer ) . append ( "<div style='clear:both;'></div>" ) ;
p . append ( divanswer ) ;
if ( layoutStyle == 0 )
p . append ( "<div style='clear:both;'></div>" ) ;
}
divanswer . append ( label _level ) ;
if ( layoutPicturesDisplay != 1 ) { //Displayed At Bottom
@ -758,7 +788,10 @@ function createAnswerContent(p, q) {
var m = reportdata . Medias [ j ] ;
if ( m . AnswerId . toLowerCase ( ) == a . Id . toLowerCase ( ) ) {
if ( layoutPicturesDisplay == 1 ) //Displayed At Bottom
mediasdata . push ( m ) ;
{
if ( isidentified == false )
mediasdata . push ( m ) ;
}
else { //Displayed As Taken
var media = createMedias ( m ) ;
pics . append ( media ) ;
@ -767,17 +800,21 @@ function createAnswerContent(p, q) {
}
}
if ( a . Result && a . Result != "" ) {
p . append ( $ ( '<div class="answer" style="color:#808080" ></div>' ) . data ( 'isimportant' , q . IsImportant ) . html ( replaceHtmlText ( a . Result ) ) ) ;
var divresult = $ ( '<div class="answer"></div>' ) . data ( 'isimportant' , q . IsImportant ) . html ( replaceHtmlText ( a . Result ) ) ;
p . append ( divresult ) ;
if ( q . IsImportant && layoutHighlightColor )
divresult . css ( 'color' , layoutHighlightColor ) ;
}
}
if ( layoutStyle != 1 && layoutStyle != 2 && a . Comment && a . Comment != "" ) {
p . append ( $ ( '<div class="answer" style="color:#808080"></div>' ) . data ( 'isimportant' , q . IsImportant ) . html ( replaceHtmlText ( a . Comment ) ) ) ;
var divcomment = $ ( '<div class="answer" style="color:#808080"></div>' ) . data ( 'isimportant' , q . IsImportant ) . html ( replaceHtmlText ( a . Comment ) ) ;
p . append ( divcomment ) ;
if ( q . IsImportant && layoutHighlightColor )
divcomment . css ( 'color' , layoutHighlightColor ) ;
}
return ;
}
}
}
p . append ( $ ( '<div class="answer"></div>' ) . text ( "" ) ) ;
//public string Id { get; set; }
@ -811,7 +848,6 @@ function createAnswerContent(p, q) {
//如果AssetStatus类型, result存的是notes
return result ;
}
function convertUnits ( u ) {