<!--{include file="<!--{$oetplpath}-->widget_header.tpl"}-->

<div class="oe_content_layout">
  <!--{include file="<!--{$oetplpath}-->widget_menu.tpl"}-->

  <div class="oe_cont_rt">
    
	<div class="oe_content_widget">
	
	  <div class="oe_tab_list">
        <ul>
          <li class="current"><a href="<!--{$oefile}-->&c=gallery">相册管理</a></li>
        </ul>
      </div>

      <div class="oe_gallery_block">
	    <dl>
		  <dt>
		    <!--{if !empty($gallery.drawimg)}-->
			<img src="<!--{$urlpath}--><!--{$gallery.drawimg}-->" />
			<!--{else}-->
			<img src="<!--{$urlpath}-->tpl/static/images/waitimg_s.jpg" />
			<!--{/if}-->
		  </dt>
		  <dd>
		    <h2>
			  <!--{$gallery.name}-->  <span><!--{$gallery.photos}--> 张  <!--{$gallery.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></span>
			</h2>
			<h3>
			  <span><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add&sgalleryid=<!--{$sgalleryid}-->">上传照片</a></span>
			</h3>
		  </dd>
		  <i>
		    <!--{if $a == "run"}-->
		    <a href="<!--{$oefile}-->&c=gallery">&lt;&lt;-返回到相册管理</a>
			<!--{else}-->
			<a href="<!--{$oefile}-->&c=<!--{$c}-->&sgalleryid=<!--{$sgalleryid}-->">&lt;&lt;-返回照片列表</a>
			<!--{/if}-->
		  </i>
		</dl>
		<div class="clear"></div>
      </div>

	  <!--{if $a == "run"}-->
	  
	  <div class="oe_mer_photolist">
	    <!--{if empty($photo)}-->
		<h6>对不起，没有找到匹配的信息！</h6>
		<!--{else}-->
		<ul>
		  <!--{foreach $photo as $volist}-->
		  <li>
		    <h2><img src="<!--{$volist.thumbimg}-->" /></h2>
			<h3><!--{$volist.title}--></h3>
			<p>
			  <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.photoid}-->&<!--{$comeurl}-->">编辑</a>&nbsp;|
			  <a href="javascript:;" onclick="oePopConfirm('确定要删除吗？', '<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$volist.photoid}-->&<!--{$comeurl}-->', 'url');">删除</a>&nbsp;| 
			  <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=setcover&id=<!--{$volist.photoid}-->&<!--{$comeurl}-->">设为封面</a>
			</p>
		  </li>
		  <!--{/foreach}-->
		</ul>
		<div class="clear"></div>
		<!--{/if}-->
	  </div>

	  <div class="oe_page_layout">
	    <!--{$showpage}-->
	  </div>
	  <!--{/if}-->


	  <!--{if $a == "add"}-->
	  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
	  <input type="hidden" name="a" id="a" value="saveadd" />
	  <input type="hidden" name="galleryid" id="galleryid" value="<!--{$sgalleryid}-->" />
	  <table class="oe_table_wrap">
		<tr>
		  <th width="18%"><font color="red"></font> 照片标题：</th>
		  <td width="82%">
		    <input type="text" name="title" id="title" class="input-b" maxlength="30" />（30个字以内）
		  </td>
		</tr>
		
		<tr>
	      <th>照片描述：</th>
		  <td>
		    <textarea name="intro" id="intro" style="width:65%;height:100px;"></textarea>
			<br />（照片描述，500个字以内）
		  </td>
	    </tr>

	    <tr>
		  <th><font color="red">*</font>上传照片：</th>
		  <td>
			<table class="oe_table_wrap">
			  <tr>
				<td width="80px">
				  <img f="view" style="cursor:pointer;" src="tpl/static/images/waitimg.jpg" width="80px" height="80px" class="_img_border" id="img_preview" />
				</td>
			    <td width="90px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/static/images/loading.gif" />
					</label>
					<input type="hidden" id="img_thumb" name="thumbimg" value="" />
					<input type="hidden" id="img_url" name="drawimg" value="" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=photo&thumbfiles=1");
					  });
				  });
				  </script>
				</td>
				<td></td>
			  </tr>
			</table>
		  </td>
		</tr>
		<tr>
		  <td></td>
		  <td>
			<input type="button" id="btn_post" class="submit_btn1" value="添加保存" /> 
		  </td>
		</tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){

		$("#btn_post").bind("click", function(){ //提交

			if ($("input[name='drawimg']").val().length == 0) {
				ToastShow("请上传照片");
				return false;
			}
			$("form").submit();
		});
	  });
	  </script>
	  <!--{/if}-->

	  <!--{if $a == "edit"}-->
	  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
	  <input type="hidden" name="a" id="a" value="saveedit" />
	  <input type="hidden" name="id" id="id" value="<!--{$id}-->" />
	  <input type="hidden" name="galleryid" id="galleryid" value="<!--{$photo.galleryid}-->" />
	  <table class="oe_table_wrap">
		<tr>
		  <th width="18%"><font color="red"></font> 照片标题：</th>
		  <td width="82%">
		    <input type="text" name="title" id="title" class="input-b" maxlength="30" value="<!--{$photo.title}-->" />（30个字以内）
		  </td>
		</tr>
		
		<tr>
	      <th>照片描述：</th>
		  <td>
		    <textarea name="intro" id="intro" style="width:65%;height:100px;"><!--{$photo.intro}--></textarea>
			<br />（照片描述，500个字以内）
		  </td>
	    </tr>

	    <tr>
		  <th><font color="red">*</font>上传照片：</th>
		  <td>
			<table class="oe_table_wrap">
			  <tr>
				<td width="80px">
				  <img f="view" style="cursor:pointer;" src="<!--{$photo.drawimg}-->" width="80px" height="80px" class="_img_border" id="img_preview" />
				</td>
			    <td width="90px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/static/images/loading.gif" />
					</label>
					<input type="hidden" id="img_thumb" name="thumbimg" value="<!--{$photo.thumbimg}-->" />
					<input type="hidden" id="img_url" name="drawimg" value="<!--{$photo.drawimg}-->" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=photo&thumbfiles=1");
					  });
				  });
				  </script>
				</td>
				<td></td>
			  </tr>
			</table>
		  </td>
		</tr>
		<tr>
		  <td></td>
		  <td>
			<input type="button" id="btn_post" class="submit_btn1" value="编辑保存" /> 
		  </td>
		</tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){

		$("#btn_post").bind("click", function(){ //提交

			if ($("input[name='drawimg']").val().length == 0) {
				ToastShow("请上传图片");
				return false;
			}

			$("form").submit();
		});
	  });
	  </script>
	  <!--{/if}-->


	</div>
	<!--//oe_content_widget End-->

  </div>
  <div class="clear"></div>
  <!--//oe_cont_rt Enc-->
</div>
<!--{include file="<!--{$oetplpath}-->widget_footer.tpl"}-->
</body>
</html>