Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Итоговый отчет.docx
Скачиваний:
6
Добавлен:
20.12.2018
Размер:
4.08 Mб
Скачать
    1. Шаблон с dojo виджетом

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html dir="ltr">

<head>

<meta name="adsk_ptw_template_name" content="Dojo AccordionContainer">

<meta name="adsk_ptw_template_image" content="ptw_template4_preview.bmp">

<meta name="adsk_ptw_template_content_image" content="">

<meta name="adsk_ptw_template_content_drawing_summary" content="">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<style type="text/css">

body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }

</style>

<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"

djConfig="parseOnLoad: true">

</script>

<script type="text/javascript">

dojo.require("dijit.layout.AccordionContainer");

</script>

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>

</head>

<body class=" claro " bgcolor="#5C564B">

<center>

<h2>Dojo</h2>

<div id="adsk_ptw_banner"></div>

<div id="adsk_ptw_banner_desc"></div>

<div style="width: 1000px; height: 1000px">

<div dojoType="dijit.layout.AccordionContainer" style="height: 750px;" id="test">

</div>

</div>

</center>

<script type="text/javascript">

test_func();

function test_func(){

var ro;

try {ro = new ActiveXObject("Msxml2.XMLHTTP");}

catch(e)

{

try

{

ro = new ActiveXObject("Microsoft.XMLHTTP");

}

catch(f)

{

ro = null;

}

}

if(!ro && typeof(XMLHttpRequest) != 'undefined')

{

ro = new XMLHttpRequest();

}

try {

ro.open('GET', 'acwebpublish.xml');

ro.onreadystatechange = response_callback;

ro.send(null);

}

catch(e)

{

}

function response_callback()

{

try {

if((ro.readyState == 4) && (ro.status == 200))

{

var response = ro.responseText;

var work_copy = response;

var first=work_copy.indexOf("<banner>");

var last = work_copy.indexOf("</banner>");

var x=work_copy.substring(first+8, last);

dwg_banner=document.getElementById("adsk_ptw_banner");

p = document.createElement("p");

p.appendChild(document.createTextNode(x));

dwg_banner.appendChild(p);

//get description of the banner

first=work_copy.indexOf("<description>");

last = work_copy.indexOf("</description>");

x = work_copy.substring(first+13, last);

dwg_banner_desc=dojo.byId("adsk_ptw_banner_desc");

p = document.createElement("p");

p.appendChild(document.createTextNode(x));

dwg_banner_desc.appendChild(p);

//find the count of images

var count=0;

first=0;

var len;

while(first !=-1){//get number of images

first = work_copy.indexOf("<content>");

count++;

len = work_copy.length;

work_copy = len=work_copy.length;

}

count--;

work_copy = response;

//delete the first description

first = work_copy.indexOf("</description>");

work_copy=work_copy.substr(first+14, response.length-first-14);

//parse the main part

for (i=0; i<count; i++){

var first = work_copy.indexOf("<title>");

var last = work_copy.indexOf("</title>");

var title = work_copy.substring(first+7, last);//get title

first = work_copy.indexOf("<image>");

last = work_copy.indexOf("</image>");

im = work_copy.substring(first+7, last);

first=work_copy.indexOf("<description>");

last = work_copy.indexOf("</description>");

x = work_copy.substring(first+13, last);

document.getElementById("test").innerHTML += "<div dojoType='dijit.layout.ContentPane' title='"+title+"("+x+")'><img src='"+im+"'></img></div>";

var len = work_copy.length;

var first = work_copy.indexOf("</content>");

var work_copy = work_copy.substr(first+10, len-first-10);

}

}

}

catch(e)

{

}

}

}

</script>

</body>

</html>