SimpleExcel.php
[Pman.Core] / Pman.Dialog.VerifyAccess.js
index bcaa086..45f7613 100644 (file)
@@ -8,14 +8,13 @@ Pman.Dialog.VerifyAccess= function() {}
 Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
 
  _strings : {
-  'd41d8cd98f00b204e9800998ecf8427e' :"",
-  'b945ed1d61d8edbe16a1192ad6d2fd58' :"Please enter a memorable password for logging into your application",
-  '07ae22a49223522664766d12c37a4eeb' :"Activate Your account",
-  'ee7ad62ad69b9ab5f25d273e4e0a1736' :"Your Username",
-  '51eea3dc60ae3a0b1bb8188bc6337dc2' :"enter password",
-  '1849ffc8731b5e74ae6157c91ba73575' :"Please confirm your password",
-  'd71940f24ee38ee09f6e06b908480bcf' :"Resend email",
-  '14cf5e829f5cb6fbf8cb54f7c5ff4ca9' :"Start the application process   "
+  'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access",
+  'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
+  'f6039d44b29456b20f8f373155ae4973' :"Username",
+  '004bf6c9a40003140292e97330236c53' :"Action",
+  '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date",
+  'dfb790522fdea3859af206d32916fe77' :"User Agent",
+  '70d9be9b139893aa6c69b5e77e614311' :"Confirm"
  },
 
  dialog : false,
@@ -45,13 +44,8 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
     xtype : 'Modal',
     allow_close : false,
     cls : 'enable-overflow',
-    size : 'sm',
-    title : _this._strings['07ae22a49223522664766d12c37a4eeb'] /* Activate Your account */,
+    title : _this._strings['e2c9d024b79dfb48b42a7807206c6aed'] /* Verify New IP Access */,
     listeners : {
-     render : function (_self)
-      {
-          _this.modal = _self;
-      },
      show : function (_self)
       {
           var path = window.location.pathname.split('/');
@@ -63,15 +57,42 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
           new Pman.Request({
               url: baseURL + '/Core/VerifyAccess',
               method : 'POST',
+              mask : 'Loading...',
               params : {
                   id : id,
                   authorized_key : authorized_key,
                   _to_data : 1
               }, 
               success : function(res) {
-                  _this.form.setValues(res.data);
+              
+                  _this.data = res.data;
+                  
+                  if(_this.data.status != 0){
+                      _this.dialog.hide();
+                      Roo.bootstrap.MessageBox.alert('Notice', 'This IP has been verified [' + _this.data.ip + ']');
+                      return;
+                  }
+                  
+                  _this.form.setValues(_this.data);
+                  
+                  if(_this.data.status * 1 == 0){
+                      _this.form.findField('status').reset();
+                  }
+                  
+                  _this.form.findField('expire_dt').reset();
+                  
+                  _this.form.clearInvalid();
+                  
                   return;
-              }
+              },
+              failure: function(res) {
+                  
+                  _this.dialog.hide();
+                  
+                  Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
+                  
+                  return;
+             }
           });
       }
     },
@@ -80,7 +101,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
     buttons : [
      {
       xtype : 'Button',
-      html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
+      html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */,
       weight : 'primary',
       listeners : {
        click : function (_self, e)
@@ -88,66 +109,10 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
             if(!_this.form.isValid()){
                 return;
             }
-            
-            var p1 = _this.form.findField('password').getValue();
-            var p2 = _this.form.findField('password1').getValue();
-            
-            if (p1 != p2) {
-                _this.form.findField('password1').markInvalid('Password do not match');
-                return;
-            }
-            
+        
             _this.dialog.el.mask('Sending...');
             _this.form.doAction('submit');
             
-        },
-       render : function (_self)
-        {
-            _this.btn_ok = _self;
-        }
-      },
-      xns : Roo.bootstrap,
-      '|xns' : 'Roo.bootstrap'
-     },
-     {
-      xtype : 'Button',
-      html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
-      weight : 'primary',
-      listeners : {
-       click : function (_self, e)
-        {
-            var path = window.location.pathname.split('/');
-            
-            var verify_key = path.pop();
-            
-            var id = path.pop();
-            
-            new Pman.Request({
-                url: baseURL + '/Roo/Coba_application_signup',
-                method : 'POST',
-                mask : 'Sending...',
-                params : {
-                    _resend : id
-                }, 
-                success : function(res) {
-                    var msg = "We have re-sent you an invitation via email." +
-                                "<br/><br/>" + 
-                                "Please check your inbox for the final registration step." + 
-                                 "<br/><br/>" + 
-                                "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
-                                
-                    Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
-                },
-                failure: function(res) {
-                    Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
-                }
-            });
-        },
-       render : function (_self)
-        {
-            _this.btn_resend = _self;
-             this.el.setVisibilityMode(Roo.Element.DISPLAY);
-             this.el.hide();
         }
       },
       xns : Roo.bootstrap,
@@ -158,14 +123,13 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
      {
       xtype : 'Form',
       errorMask : true,
+      labelAlign : 'top',
       loadMask : false,
-      url : baseURL + '/Register/Confirm',
+      url : baseURL + '/Core/VerifyAccess',
       listeners : {
        actioncomplete : function (_self, action)
         {
             if (action.type == 'setdata') {
-            
-                _this.form.findField('password').focus();
                 
                 return;
             }
@@ -177,11 +141,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
                 
                 _this.dialog.hide();
                 
-                Roo.get(document.body).mask('Start your Application');
-                
-                setTimeout(function() {
-                    window.location.href = baseURL;
-                }, 500); 
+                Roo.bootstrap.MessageBox.alert('Notice', 'You have verified the IP [' + _this.data.ip + ']');
                 
                 return;
             }
@@ -227,28 +187,14 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
           items  : [
            {
             xtype : 'Input',
-            fieldLabel : _this._strings['ee7ad62ad69b9ab5f25d273e4e0a1736'] /* Your Username */,
-            labelAlign : 'top',
+            fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
             name : 'email',
             readOnly : true,
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap'
            }
           ]
-         }
-        ]
-       },
-       {
-        xtype : 'Row',
-        listeners : {
-         render : function (_self)
-          {
-              _this.row_pwd_label = _self;
-          }
-        },
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap',
-        items  : [
+         },
          {
           xtype : 'Column',
           xs : 12,
@@ -256,26 +202,15 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
           '|xns' : 'Roo.bootstrap',
           items  : [
            {
-            xtype : 'FieldLabel',
-            html : _this._strings['b945ed1d61d8edbe16a1192ad6d2fd58'] /* Please enter a memorable password for logging into your application */,
+            xtype : 'Input',
+            fieldLabel : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
+            name : 'ip',
+            readOnly : true,
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap'
            }
           ]
-         }
-        ]
-       },
-       {
-        xtype : 'Row',
-        listeners : {
-         render : function (_self)
-          {
-              _this.row_pwd1 = _self;
-          }
-        },
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap',
-        items  : [
+         },
          {
           xtype : 'Column',
           xs : 12,
@@ -283,30 +218,17 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
           '|xns' : 'Roo.bootstrap',
           items  : [
            {
-            xtype : 'SecurePass',
-            allowBlank : false,
-            inputType : 'password',
-            labelAlign : 'top',
-            name : 'password',
-            placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
+            xtype : 'TextArea',
+            fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
+            name : 'user_agent',
+            readOnly : true,
+            rows : 3,
+            style : 'margin-bottom: 15px;',
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap'
            }
           ]
-         }
-        ]
-       },
-       {
-        xtype : 'Row',
-        listeners : {
-         render : function (_self)
-          {
-              _this.row_pwd2 = _self;
-          }
-        },
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap',
-        items  : [
+         },
          {
           xtype : 'Column',
           xs : 12,
@@ -314,20 +236,77 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
           '|xns' : 'Roo.bootstrap',
           items  : [
            {
-            xtype : 'Input',
+            xtype : 'ComboBox',
             allowBlank : false,
-            inputType : 'password',
-            invalidText : 'The passwords you entered do not match',
-            name : 'password1',
-            placeholder : _this._strings['1849ffc8731b5e74ae6157c91ba73575'] /* Please confirm your password */,
-            validator : function(v){
-                
-                if(_this.form.findField('password').getValue() == v) {
-                    
-                    return true;
-                }
-                
-                return false;
+            alwaysQuery : true,
+            displayField : 'value',
+            editable : false,
+            fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
+            forceSelection : true,
+            hiddenName : 'status',
+            indicatorpos : 'right',
+            mode : 'local',
+            name : 'status_name',
+            selectOnFocus : true,
+            tpl : '<div class=\"roo-select2-result\"><b>{value}</b></div>',
+            triggerAction : 'all',
+            valueField : 'code',
+            listeners : {
+             select : function (combo, record, index)
+              {
+                  _this.expire_dt.allowBlank = true;
+                  _this.expire_dt.el.hide();
+                  
+                  if(record.data.code == '-2'){
+                      _this.expire_dt.allowBlank = false;
+                      _this.expire_dt.el.show();
+                  }
+              }
+            },
+            xns : Roo.bootstrap,
+            '|xns' : 'Roo.bootstrap',
+            store : {
+             xtype : 'SimpleStore',
+             data : [
+                 ['1', 'Approve'],
+                 ['-2', 'Temporary'],
+                 ['-1', 'Reject']
+             ],
+             fields : [ 'code', 'value' ],
+             xns : Roo.data,
+             '|xns' : 'Roo.data'
+            }
+           }
+          ]
+         },
+         {
+          xtype : 'Column',
+          xs : 12,
+          xns : Roo.bootstrap,
+          '|xns' : 'Roo.bootstrap',
+          items  : [
+           {
+            xtype : 'DateField',
+            allowBlank : false,
+            fieldLabel : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
+            format : 'Y-m-d',
+            indicatorpos : 'right',
+            name : 'expire_dt',
+            listeners : {
+             render : function (_self)
+              {
+                  _this.expire_dt = this;
+                  
+                  var d = new Date();
+                  
+                  d.setDate(d.getDate() - 1);
+              
+                  this.setStartDate(d);
+                  
+                  this.el.setVisibilityMode(Roo.Element.DISPLAY);
+                  
+                  this.el.hide();
+              }
             },
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap'
@@ -343,7 +322,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
         items  : [
          {
           xtype : 'Column',
-          xs : 8,
+          xs : 12,
           xns : Roo.bootstrap,
           '|xns' : 'Roo.bootstrap',
           items  : [
@@ -357,7 +336,7 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
            {
             xtype : 'Input',
             inputType : 'hidden',
-            name : 'verify_key',
+            name : 'authorized_key',
             xns : Roo.bootstrap,
             '|xns' : 'Roo.bootstrap'
            }
@@ -366,43 +345,6 @@ Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
         ]
        }
       ]
-     },
-     {
-      xtype : 'Row',
-      listeners : {
-       render : function (_self)
-        {
-            _this.error_row = this;
-            
-            this.el.setVisibilityMode(Roo.Element.DISPLAY);
-            
-            this.el.hide();
-        }
-      },
-      xns : Roo.bootstrap,
-      '|xns' : 'Roo.bootstrap',
-      items  : [
-       {
-        xtype : 'Column',
-        xs : 12,
-        xns : Roo.bootstrap,
-        '|xns' : 'Roo.bootstrap',
-        items  : [
-         {
-          xtype : 'Element',
-          html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
-          listeners : {
-           render : function (_self)
-            {
-                _this.text_el = _self;
-            }
-          },
-          xns : Roo.bootstrap,
-          '|xns' : 'Roo.bootstrap'
-         }
-        ]
-       }
-      ]
      }
     ]
    }  );