Advertisement
Guest User

formuploadv

a guest
Sep 16th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.95 KB | None | 0 0
  1. <!-- scroll -->
  2. <div style="background-color: #white; border: 0px solid 00000; color: black; font-family: arial; font-size: 12px; height: auto; overflow: auto; padding: 6px;
  3.  width: 1010px;">
  4. <script type="text/javascript">
  5. var url;
  6.  
  7. //kalender
  8.     $('#cc').calendar({
  9.     current:new Date()
  10.     });
  11.    
  12.     $.fn.datebox.defaults.formatter = function(date){
  13.     var y = date.getFullYear();
  14.     var m = date.getMonth()+1;
  15.     var d = date.getDate();
  16.     return y+'/'+m+'/'+d;
  17. }
  18. //end kalender
  19.  
  20. function upload_video(){
  21.         jQuery('#dlg').dialog('open').dialog('setTitle','Tambah Berita');
  22.         jQuery('#fupload').form('clear').form('load','<?php echo site_url('cuploadvideo/getTgl'); ?>');
  23.         url = '<?php echo site_url('cuploadvideo/upload_video'); ?>';
  24. }
  25.  
  26. function update(){
  27.         var row = jQuery('#dg').datagrid('getSelected');
  28.         if(row){
  29.                 jQuery('#dlg').dialog('open').dialog('setTitle','Edit Berita');
  30.                 jQuery('#fupload').form('load',row);
  31.                 url = '<?php echo site_url('cuploadvideo/update'); ?>';
  32.         }
  33. }
  34.  
  35. function save(){
  36.         jQuery('#fupload').form('submit',{
  37.                 url: url,
  38.                 onSubmit: function(){
  39.                         return jQuery(this).form('validate');
  40.                 },
  41.                 success: function(result){
  42.                         var result = eval('('+result+')');
  43.                         if(result.success){
  44.                                 jQuery('#dlg').dialog('close');
  45.                                 jQuery('#dg').datagrid('reload');
  46.                         } else {
  47.                                 jQuery.messager.show({
  48.                                         title: 'Error',
  49.                                         msg: result.msg
  50.                                 });
  51.                         }
  52.                 }
  53.         });
  54. }
  55.  
  56. function remove_video(){
  57.         var row = jQuery('#dg').datagrid('getSelected');
  58.         if (row){
  59.                 jQuery.messager.confirm('Confirm','Are you sure you want to remove this user?',function(r){
  60.                         if (r){
  61.                                 jQuery.post('<?php echo site_url('cuploadvideo/remove'); ?>',{Id:row.Id},function(result){
  62.                                         if (result.success){
  63.                                                 jQuery('#dg').datagrid('reload');
  64.                                         } else {
  65.                                                 jQuery.messager.show({
  66.                                                         title: 'Error',
  67.                                                         msg: result.msg
  68.                                                 });
  69.                                         }
  70.                                 },'json');
  71.                         }
  72.                 });
  73.         }
  74. }
  75. </script>
  76.  
  77.        
  78.  
  79.     <table width="auto" id="dg" class="easyui-datagrid full-width simple-table responsive-table responsive-table-on"
  80.     style="width:auto;height:auto;" title="Video"
  81.     url="<?php echo site_url('cuploadvideo/gridvideo');?>" pageList="[25,50,75,100]"
  82.     toolbar="#toolbar" pagination="true" rownumbers="true"
  83.     collapsible="false" nowrap="true" fitColumns="false"
  84.     striped="true" resizeHandle="both" showFooter="true"
  85.     singleSelect="true" >
  86.     <thead>
  87.         <tr>
  88.        
  89.             <th field="Kode" width="50px" sortable="true">Kode</th>
  90.             <th field="Kode_Video" sortable="true">Kode Video</th>
  91.             <th field="Tanggal" width="100"  sortable="true">Tanggal</th>
  92.             <th field="Judul" width="150"  sortable="true">Judul</th>
  93.             <th field="img" width="150px" sortable="true">Video</th>
  94.             <th field="Deskripsi" width="420px" sortable="true" >Deskripsi</th>
  95.         </tr>
  96.     </thead>
  97. </table>
  98.    
  99. <div id="toolbar">
  100.         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="upload_video()">Tambah Video</a>
  101.         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="update()">Edit Video</a>
  102.         <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="remove_video()">Hapus Video</a>
  103. </div>
  104.  
  105. <div id="dlg" class="easyui-dialog" style="width:360px;height:490px;padding:5px 20px" closed="true" buttons="#dlg-buttons" modal="true">
  106.     <form id="fupload" enctype="multipart/form-data" method="post" action="<?php echo site_url('cuploadvideo/upload_video'); ?>" novalidate>
  107.         <div class="form-item">
  108.             <label for="Kode">Kode</label><br />
  109.           <input type="text" name="Kode" class="easyui-validatebox" required="true" size="47" maxlength="50" />
  110.         </div>
  111.         <br />
  112.        
  113.         <div class="form-item">
  114.             <label for="Kode_Video">Kode Video</label><br />
  115.           <input type="text" name="Kode_Video" class="easyui-validatebox" required="true" size="47" maxlength="50" />
  116.         </div>
  117.         <br />        
  118.        
  119.       <div class="form-item"  >
  120.         <label for="Tanggal" >Tanggal</label><br />
  121.         <input name="Tanggal" id="cc"   type="text" required="true" class="easyui-datebox" style="width:305px;height:180px;" />
  122.         </div>
  123.         <br />
  124.        
  125.         <div class="form-item">
  126.             <label for="Judul">Judul</label><br />
  127.           <input type="text" name="Judul" class="easyui-validatebox" required="true" size="47" maxlength="50" />
  128.         </div>
  129.         <br />
  130.         <div class="form-item">
  131.             <label for="Deskripsi">Deskripsi</label><br />
  132.             <textarea name="Deskripsi"   style="width:300px;height:80px;"></textarea>
  133.         </div>
  134.         <br />
  135.         <label for="File">File:</label><br />
  136.        
  137.                 <input type="hidden" name="Id" id="Id" />
  138.                
  139.         <input type="file" name="file" size="35" maxlength="50">
  140.     </form>
  141. </div>
  142.  
  143. <div id="dlg-buttons">
  144.         <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">Save</a>
  145.         <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
  146. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement