Attachment 'ImageBrowser.inc'

Download

   1 <?php
   2 
   3 include_once "pagelist.inc";
   4 
   5 $imgbrwsr_content_counter = 0;
   6 
   7 function imgbrwsr_content($ndx = 0, $imgs)	{
   8 	global $imgbrwsr_content_counter, $intemplate, $content;
   9 	$output = "";
  10 	if (!$imgbrwsr_content_counter)	{
  11 		$output .= "
  12 <script type='text/javascript'>
  13 	function imgbrwsr_content_update()  {
  14 
  15 		link = document.getElementById(this.element.id+'_link');
  16 		link.href = this.images[this.index][0];
  17 		link.title = this.images[this.index][1];
  18 
  19 		img = document.getElementById(this.element.id+'_image');
  20 		img.src = 'images/placeholder.gif';
  21 		img.src = this.images[this.index][3];
  22 		img.alt = this.images[this.index][1];
  23 
  24 		for (i = 0; i < this.images.length; ++i)  {
  25 			document.getElementById(this.element.id+'_text_'+i).style.display = (i == this.index)? 'block': 'none';
  26 		}
  27 
  28 		document.getElementById(this.element.id+'_view').href = this.images[this.index][2]
  29 
  30 		if (this.index == 0 || this.images.length == 0)	{
  31 			document.getElementById(this.element.id+'_frst').style.display = 'none';
  32 			document.getElementById(this.element.id+'_back').style.display = 'none';
  33 		} else {
  34 			document.getElementById(this.element.id+'_frst').style.display = 'block';
  35 			document.getElementById(this.element.id+'_back').style.display = 'block';
  36 		}
  37 		if (this.index == this.images.length - 1 || this.images.length == 0)	{
  38 			document.getElementById(this.element.id+'_next').style.display = 'none';
  39 			document.getElementById(this.element.id+'_last').style.display = 'none';
  40 		} else {
  41 			document.getElementById(this.element.id+'_next').style.display = 'block';
  42 			document.getElementById(this.element.id+'_last').style.display = 'block';
  43 		}
  44 	}
  45 	function imgbrwsr_content_goto(imgno)	{
  46 		while (imgno < 0)
  47 			imgno += this.images.length;
  48 		if (imgno >= this.images.length)
  49 			imgno %= this.images.length;
  50 		this.index = imgno;
  51 		this.update();
  52 	}
  53 	function imgbrwsr_content_offset(off)	{
  54 		this.go(this.index+off);
  55 	}
  56 	function imgbrwsr_content_expand()   {
  57 		expand = document.getElementById(this.element.id+'_expand');
  58 		expandimg = document.getElementById(this.element.id+'_expand_img');
  59 		textdiv = document.getElementById(this.element.id+'_text');
  60 		buttondiv = document.getElementById(this.element.id+'_text_buttons');
  61 		if (textdiv.style.display == 'none')    {
  62 			this.element.style.width = '695px';
  63 			this.element.style.background = 'url(/images/imgbrwsr/frame_expanded_buttons.png)';
  64 			textdiv.style.display = 'block';
  65 			buttondiv.style.display = 'block';
  66 			expand.title = 'Hide the content panel';
  67 			expandimg.src = '/images/imgbrwsr/close.png';
  68                 } else  {
  69 			buttondiv.style.display = 'none';
  70 			textdiv.style.display = 'none';
  71 			this.element.style.background = 'url(/images/imgbrwsr/frame.png)';
  72 			this.element.style.width = '358px';
  73 			expand.title = 'Show the content panel';
  74 			expandimg.src = '/images/imgbrwsr/open.png';
  75 		}
  76 	}
  77 	var imgbrwsr_contents = new Array();
  78 	function imgbrwsr_content(element, ndx, imgs)   {
  79 		this.id     = imgbrwsr_contents.length;
  80 		this.element= element;
  81 		this.index  = ndx;
  82 		this.images = imgs;
  83 		this.go     = imgbrwsr_content_goto;
  84 		this.offset = imgbrwsr_content_offset;
  85 		this.update = imgbrwsr_content_update;
  86 		this.expand = imgbrwsr_content_expand;
  87 		imgbrwsr_contents[this.id] = this;
  88 		document.getElementById(this.element.id+'_frst').href = 'javascript:imgbrwsr_contents['+this.id+'].go(0);';
  89 		document.getElementById(this.element.id+'_back').href = 'javascript:imgbrwsr_contents['+this.id+'].offset(-1);';
  90 		document.getElementById(this.element.id+'_next').href = 'javascript:imgbrwsr_contents['+this.id+'].offset(1);';
  91 		document.getElementById(this.element.id+'_last').href = 'javascript:imgbrwsr_contents['+this.id+'].go(-1);';
  92 		document.getElementById(this.element.id+'_expand').href = 'javascript:imgbrwsr_contents['+this.id+'].expand();';
  93 	}
  94 </script>
  95 ";
  96 	}
  97 
  98 	$id = $imgbrwsr_content_counter;
  99 	++$imgbrwsr_content_counter;
 100 
 101 	$output .= "
 102 <div id='imgbrwsr_content{$id}' style='width:695px; height:312px; position:relative; background:url(/images/imgbrwsr/frame_expanded_buttons.png);'>
 103 	<a id='imgbrwsr_content{$id}_link' style='position:absolute; left:19px; top:20px; display:block;'><img id='imgbrwsr_content{$id}_image' src='images/placeholder.gif' lowsrc='images/placeholder.gif' style='width:320px; height:240px; border:none;' /></a>
 104 	<div id='imgbrwsr_content{$id}_text' style='position:absolute; left:354px; top:19px; width:320px; height:240px; overflow:auto; display:block;'>
 105 ";
 106 
 107 	$intemplatetmp = $intemplate;
 108 	$contenttmp = $content;
 109 	$intemplate = TRUE;
 110 	$i = 0;
 111 	foreach ($imgs as $value)	{
 112 		$content = "";
 113 		@include getpage($value[2]);
 114 		$output .= "<div id='imgbrwsr_content{$id}_text_{$i}' style='display:none;'>{$content}</div>";
 115 		++$i;
 116 	}
 117 	$intemplate = $intemplatetmp;
 118 	$content = $contenttmp;
 119 
 120 	$output .= "
 121 	</div>
 122 	<a id='imgbrwsr_content{$id}_frst' title='Go to the first image'    style='position:absolute; left: 11px; top:266px;'><img src='/images/imgbrwsr/first.png' style='border:none;' alt='first' /></a>
 123 	<a id='imgbrwsr_content{$id}_back' title='Go to the previous image' style='position:absolute; left: 55px; top:266px;'><img src='/images/imgbrwsr/back.png'  style='border:none;' alt='back'  /></a>
 124 	<a id='imgbrwsr_content{$id}_next' title='Go to the next image'     style='position:absolute; left:271px; top:266px;'><img src='/images/imgbrwsr/next.png' style='border:none;'  alt='next'  /></a>
 125 	<a id='imgbrwsr_content{$id}_last' title='Go to the last image'     style='position:absolute; left:303px; top:266px;'><img src='/images/imgbrwsr/last.png' style='border:none;'  alt='last'  /></a>
 126 	<a id='imgbrwsr_content{$id}_expand' title='Hide the content panel' style='position:absolute; left:343px; top:129px;'><img id='imgbrwsr_content{$id}_expand_img' src='/images/imgbrwsr/close.png' style='border:none;' /></a>
 127 	<div id='imgbrwsr_content{$id}_text_buttons' style='display:block;'>
 128 		<a id='imgbrwsr_content{$id}_view' title='View text' style='position:absolute; left:344px; top:270px;'><img src='/images/imgbrwsr/view.png' style='border:none;' alt='view' /></a>
 129 	</div>
 130 </div>
 131 <script type='text/javascript'>
 132 	(new imgbrwsr_content(document.getElementById('imgbrwsr_content{$id}'), {$ndx}, new Array(";
 133 
 134 	$i = 0;
 135 	foreach ($imgs as $value)	{
 136 		if ($i)	$output .= ",";
 137 		$output .= "new Array('{$value[0]}', '{$value[1]}', '".getlink($value[2])."', '{$value[3]}')";
 138 		++$i;
 139 	}
 140 
 141 	$output .= "))).update();
 142 </script>";
 143 
 144 	return $output;
 145 }
 146 
 147 ?>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-08-27 06:16:11, 0.5 KB) [[attachment:Clear.py]]
  • [get | view] (2007-08-28 23:30:49, 6.8 KB) [[attachment:Editor.py]]
  • [get | view] (2007-08-31 16:21:54, 6.5 KB) [[attachment:ImageBrowser.inc]]
  • [get | view] (2007-08-17 18:41:06, 23.6 KB) [[attachment:ImageBrowser.zip]]
  • [get | view] (2007-08-27 06:15:30, 12.1 KB) [[attachment:ImageBrowserContent.py]]
  • [get | view] (2007-08-17 20:07:21, 51.1 KB) [[attachment:ImageBrowserContent.zip]]
  • [get | view] (2007-08-27 22:38:27, 51.5 KB) [[attachment:ImageBrowserContent_0-2.zip]]
  • [get | view] (2007-08-28 19:24:15, 51.5 KB) [[attachment:ImageBrowserContent_0-3.zip]]
  • [get | view] (2007-08-30 21:15:21, 51.5 KB) [[attachment:ImageBrowserContent_0-4.zip]]
  • [get | view] (2007-08-30 22:05:48, 3.5 KB) [[attachment:ImageBrowserGenerator.zip]]
  • [get | view] (2007-08-17 18:41:18, 28.6 KB) [[attachment:ImageBrowserNoLoad.zip]]
  • [get | view] (2007-08-10 22:00:23, 23.1 KB) [[attachment:MacroMarket-ImageBrowser.zip]]
  • [get | view] (2007-08-14 18:43:08, 23.4 KB) [[attachment:MacroMarket-ImageBrowserNoLoad.zip]]
  • [get | view] (2007-08-28 23:30:19, 2.9 KB) [[attachment:SimpleInclude.py]]
  • [get | view] (2007-08-28 23:30:27, 0.2 KB) [[attachment:Test.py]]
  • [get | view] (2007-08-28 23:29:51, 0.9 KB) [[attachment:Thumbnail.py]]
  • [get | view] (2007-08-28 23:29:31, 5.2 KB) [[attachment:Thumbnail_action.py]]
  • [get | view] (2007-08-17 18:26:12, 160.3 KB) [[attachment:imagebrowser.png]]
  • [get | view] (2007-08-17 17:13:09, 39.0 KB) [[attachment:imagebrowsercontent.png]]
  • [get | view] (2007-08-17 17:55:36, 37.2 KB) [[attachment:imagebrowsercontent_closed.png]]
  • [get | view] (2007-08-22 16:42:34, 491.5 KB) [[attachment:imgbrwsr_images.zip]]
  • [get | view] (2007-08-28 23:28:39, 3.8 KB) [[attachment:imgbrwsrgen.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.