<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>jquery/external/jquery.bgiframe-2.1.1.js"></script>


<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>jquery/ui/minified/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>jquery/ui/minified/jquery.ui.draggable.min.js"></script>

<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>jquery/ui/minified/jquery.ui.resizable.min.js"></script>
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH;?>jquery/ui/minified/jquery.ui.dialog.min.js"></script>

<script type="text/javascript">
	$(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$("#dialog-modal").dialog("destroy");
	});
	
    function openModel(id)
	{
		//////////////////ajax called
		var response;
		$.ajax({
				 type: "GET",
				 url:"index.php" ,
				 data: "module=settings&view=modules&ajax=Y&task=popup&eid="+id,
				 async: false,
				 success: function(data){
					//alert(data);
					response=data;
				 }
				});	
		
		////////////ajax end
		$('#dialog-modal').html(response);
                $("#dialog-modal").dialog("destroy");

		
		$('#dialog-modal').dialog({
			autoOpen: false,
			height: 587,
			width: 859,
			modal: true
		});
                $('#dialog-modal').dialog('open');
	}
	
	
</script>

<div id="dialog-modal" title="Page Position Dialog"></div>

<div class="web-booking-main" id="gridbody">
            <div class="clear"></div>
   			
    <?php echo $headerpanel;?>        
    
    <?php echo $pagingTop;?>        
    
               <br class="clear" />

               <div class="grid-list-subtitle-bg" style="margin-top:10px;">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="2%" align="left" valign="top" class="grid-td-left"><input name="chkall" id="chkall" type="checkbox" onclick="checkall('chkgrow')"  /></td>
                       <td width="5%" align="left" valign="top" class="grid-td-top">&nbsp;</td>
                      
                      <td width="22%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?=$settingsObj->urlwithoutsort?>&orderby=var_modulename&sorting=Y','gridbody','ST')">Module Name<?=$setsortimgvar_modulename?></a></td>
                      <td width="28%" align="left" valign="top" class="grid-td-top">Pages&gt;&gt;positions</td>
                     <?php /*?><td width="22%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?=$settingsObj->urlwithoutsort?>&orderby=chr_publish&sorting=Y','gridbody','ST')">Publish<?=$setsortimgchr_publish?></a></td><?php */?>
                      <td width="21%" align="left" valign="top" class="grid-td-top"><a href="javascript:;" onclick="SendGridBindRequest('<?=$settingsObj->urlwithoutsort?>&orderby=chr_cached&sorting=Y','gridbody','ST')">Cache<?=$setsortimgchr_cached?></a></td>
                    </tr>
                  </table>
            </div>

            <div class="information-white-bg" id="dvpersonalinformation" >
            <div class="clear"></div>

    <div class="grid-list-inner-table-text">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
              
         <?php
		 		 if($numofrows > 0)
                 {
					$rowcount = 0;
		 			while($row=$configObj->glDbObj->fetch_array($result)) 
					{
						$clsname = ($row['chr_read'] == 'N')?"grid-list-inner-table-text-active":"grid-list-inner-table-text";	// For read unread class
						$clsname = 'grid-list-inner-table-text-active';
						
						$starimg = ($row['chr_star'] == 'Y')?"gstar.png":"gstar-disable.png"; // Displaying the stat and unstart image
						// Displaying the stat and unstart image
						
						 
						 $sql="select cp.var_pagename,cpmp.int_glcode as pmpid,cpmp.chr_publish as chr_publish,ctp.fk_positions as pid,cpo.var_positionname from ".DB_PREFIX."pages cp,".DB_PREFIX."pages_modules_positions cpmp,".DB_PREFIX."themes_positions ctp,".DB_PREFIX."positions cpo where cp.int_glcode=cpmp.fk_pages and cpmp.fk_modules=".$row['int_glcode']."  and cpmp.chr_delete='N' and ctp.int_glcode=cpmp.fk_themes_positions and cpo.int_glcode=ctp.fk_positions and cp.chr_publish='Y' and cp.chr_delete='N' and cpmp.fk_parent_modules=0";
					
						
						$rowcount=$configObj->glDbObj->get_sql_number($sql);
						if($rowcount>0)
								{
									$moduleposition = $configObj->glDbObj->query($sql);
								}
						else
							{
									 $sql="select cp.var_pagename,cpmp.int_glcode as pmpid,cpmp.chr_publish as chr_publish,ctp.fk_positions as
									 	  pid,cpo.var_positionname from ".DB_PREFIX."pages cp,".DB_PREFIX."pages_modules_positions cpmp,".DB_PREFIX."themes_positions ctp,".DB_PREFIX."positions cpo
										  where cp.int_glcode=cpmp.fk_pages and cpmp.fk_parent_modules=".$row['int_glcode']."
										  and cpmp.chr_delete='N' and ctp.int_glcode=cpmp.fk_themes_positions 
										  and cpo.int_glcode=ctp.fk_positions and cp.chr_publish='Y'
										  and cp.chr_delete='N' and cpmp.fk_parent_modules!=0";

									$moduleposition = $configObj->glDbObj->query($sql);
								
							}
						
		 ?>
       	  <tr id="gtr-<?=$row['int_glcode']?>"  style="background-color: transparent;"  class="<?=$clsname?>" onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'" >
                               
          <td width="2%" align="left" valign="top" class="grid-td-left"><input name="chkgrow" id="chkgrow" type="checkbox" value="<?php echo $row['int_glcode']?>" /></td>
          
          <td width="5%" align="center" valign="top" class="grid-left1"><img id="star-<?=$row['int_glcode']?>" height="16" width="16" alt="remember me" title="remember me" src="<?=GLOBAL_ADMIN_IMAGES_PATH?><?=$starimg?>" style="vertical-align:middle;cursor:pointer;"onclick="UpdateStar('tml_modules','chr_star','<?=$row['int_glcode']?>');"></td>
           
          <td width="25%" align="left" valign="top" class="grid-td-top"><span><?=$row['var_modulename']?></span></td>
          

          
          <td width="28%" align="left" valign="top" class="grid-td-top">
           <a style="cursor:pointer;" onclick="openModel('<?php echo $row['int_glcode']?>')">
            <img src="<?=GLOBAL_ADMIN_IMAGES_PATH?>edit.png" alt="popup" />   </a>
            </td>
           
          <?php /*?><table border="0" cellpadding="3" cellspacing="3" align="left">
          <?
		  while ($moduleposition1 = $configObj->glDbObj->fetch_array($moduleposition))
			{
				 $tickimg = ($moduleposition1['chr_publish'] == 'Y')?"tick.png":"tick_cross.png"; 
		?>
           <tr>
           <td width="33%" align="left" valign="middle" class="grid-td-top"><?=$moduleposition1['var_pagename']?>&gt;&gt;<?=$moduleposition1['var_positionname']?></td>
           <td width="20%" align="left" valign="middle" class="grid-td-top">
          <a href="#">
          <img id="tick-<?=$moduleposition1['pmpid']?>" height="16" width="16" alt="publish me" title="publish me" src="<?=GLOBAL_ADMIN_IMAGES_PATH?><?=$tickimg?>" style="vertical-align:middle;cursor:pointer;" onclick="UpdatePublish('tml_pages_modules_positions','chr_publish','<?=$moduleposition1['pmpid']?>','');">
          </a> 
          
           </td>
           </tr>
        		
		<?		
			}
		  
          ?>
          </table><?php */?>
         
          
          <td width="20%" align="left" valign="middle" class="grid-td-top">
          <a href="#">
            <?php if($row['chr_cached']=='Y') { ?>
            <img src="<?=GLOBAL_ADMIN_IMAGES_PATH?>/tick.png" alt="Tick" width="16" height="16" border="0" onclick="SendGridBindRequest('<?=$settingsObj->urlwithpara?>&cacheflag=<?=$row['chr_cached']?>&cacheid=<?=$row['int_glcode']?>','gridbody','CACHE')" />
            <?php } else { ?>
            <img src="<?=GLOBAL_ADMIN_IMAGES_PATH?>/tick_cross.png" alt="Tick" width="16" height="16" border="0" onclick="SendGridBindRequest('<?=$settingsObj->urlwithpara?>&cacheflag=<?=$row['chr_cached']?>&cacheid=<?=$row['int_glcode']?>','gridbody','CACHE')"  />
            <? } ?>
          </a> 
          
          
          </td>
        </tr>
                
        <?php  $rowcount++;
			} 
		 }
		 else
		 {
		?>
             <tr style="background-color: transparent;"  class="<?=$clsname?>" onmouseover="this.style.backgroundColor='#f6f6f6'" onmouseout="this.style.backgroundColor='transparent'"> 
                <td height="25" align="center" valign="middle" colspan="6" class="form_titles">Sorry! No records are available.</td>
             </tr>
		<?
		 }
		?>
			<input type="hidden" name="ptrecords" id="ptrecords" value="<?=$rowcount?>">
	  </table>
      </div>
  </div>
           <div class="clear"></div>
            
       	   <?php echo $pagingBottom;?>  
        
       	    <?php /*?><div class="add-new-user-button"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image47','','<?=GLOBAL_ADMIN_IMAGES_PATH?>delete-button-hover.jpg',0)"><img src="<?=GLOBAL_ADMIN_IMAGES_PATH?>delete-button.jpg" alt="Delete" name="Image47" width="80" height="25" border="0" id="Image47" /></a></div><?php */?>
</div>