From d8f4cd30b30f562c17cf77dae52d4d35e3b5a771 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Mon, 7 Jun 2010 13:38:58 +0200 Subject: [PATCH] Add a new function renderDetails_iphone --- www/iphone/example_client.js | 58 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/www/iphone/example_client.js b/www/iphone/example_client.js index 783a1d7..755b68c 100644 --- a/www/iphone/example_client.js +++ b/www/iphone/example_client.js @@ -77,7 +77,7 @@ function my_onshow(data) { } } if (hit.recid == curDetRecId) { - html.push(renderDetails(curDetRecData)); + html.push(renderDetails_iphone(curDetRecData)); } html.push(''); } @@ -243,7 +243,7 @@ function my_onrecord(data) { if (detRecordDiv) return; curDetRecData = data; var recordDiv = document.getElementById('recdiv_'+curDetRecData.recid); - var html = renderDetails(curDetRecData); + var html = renderDetails_iphone(curDetRecData); recordDiv.innerHTML += html; } @@ -446,7 +446,7 @@ function drawPager (pagerDiv) if (lastClkbl < pages) postdots = '...'; - pagerDiv.innerHTML += '
' + pagerDiv.innerHTML += '
' + prev + predots + middle + postdots + next + '

'; } @@ -554,4 +554,54 @@ function renderDetails(data, marker) details += '
'; return details; } - //EOF + +function renderLine(title, value) { + if (value != undefined) + return '
  • ' + title + '

    ' + value + '
  • '; + return ''; +} + +function renderLineURL(title, URL, display) { + if (URL != undefined) + return '
  • ' + title + '

    ' + display + '
  • '; + return ''; +} + +function renderLineEmail(dtitle, email, display) { + if (email != undefined) + return '
  • ' + title + '

    ' + display + '
  • '; + return ''; +} + +function renderDetails_iphone(data, marker) +{ + //return renderDetails(data,marker); + + var details = '
    '; + if (marker) + details += '

    '+ marker + '

    '; + details += '
      '; + if (data["md-title"] != undefined) { + details += '
    • Title

      ' + data["md-title"]; + if (data["md-title-remainder"] !== undefined) { + details += '' + data["md-title-remainder"] + ' '; + } + if (data["md-title-responsibility"] !== undefined) { + details += ' '+ data["md-title-responsibility"] +''; + } + details += '' + details += '
    • ' + } + details + +=renderLine('Date', data["md-date"]) + + renderLine('Author', data["md-author"]) + + renderLineURL('URL', data["md-electronic-url"], data["md-electronic-url"]) + + renderLine('Subject', data["location"][0]["md-subject"]); + + if (data["location"][0]["@name"] != undefined) + renderLine(details, 'Location', data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")"); + details += '
    '; + return details; +} + +//EOF -- 1.7.10.4