Merge branch 'master' of http://git.roojs.com:8081/Pman.Core
authorAlan Knowles <alan@akbkhome.com>
Sat, 27 Oct 2012 13:08:27 +0000 (21:08 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sat, 27 Oct 2012 13:08:27 +0000 (21:08 +0800)
32 files changed:
DataObjects/Companies.php
DataObjects/Core_enum.php
DataObjects/Events.php
DataObjects/Group_members.php [moved from DataObjects/Group_Members.php with 92% similarity]
DataObjects/Group_rights.php [moved from DataObjects/Group_Rights.php with 81% similarity]
DataObjects/Groups.php
DataObjects/Images.php
DataObjects/Person.php
DataObjects/core.sql
DataObjects/pman.ini
DataObjects/pman.links.ini
GroupMembers.php
Images.php
Notify.php
NotifySend.php
Pman.Dialog.Companies.js
Pman.Dialog.CoreCompanies.bjs [new file with mode: 0644]
Pman.Dialog.CoreCompanies.js [new file with mode: 0644]
Pman.Dialog.CorePersonContact.bjs
Pman.Dialog.CoreProject.bjs
Pman.Dialog.Image.bjs
Pman.Dialog.Image.js
Pman.Dialog.PersonEdit_1.js [deleted file]
Pman.Dialog.PersonEditor.js
Pman.Download.js
Pman.Tab.GroupsList.js
Pman.js
UploadProgress.php
core.css
templates/master.html
widgets/ColorField.js
widgets/Ext.bugs.js

index 0764d35..0b5d8ab 100644 (file)
@@ -288,6 +288,22 @@ class Pman_Core_DataObjects_Companies extends DB_DataObject
         return $fm->toHTML($size, $base);
     }
     
+    function toRooSingleArray($authUser, $request)
+    {
+        $ret = $this->toArray();
+       // DB_DataObject::debugLevel(1);
+        // get the comptype display
+        $e = DB_DataObject::Factory('core_enum');
+        $e->etype = 'COMPTYPE';
+        $e->name = $this->comptype;
+        $ret['comptype_display'] = $ret['comptype'];
+        if ($e->find(true) && !empty($e->name_display)) {
+            $ret['comptype_display'] = $e->name_display;
+        }
+        
+        
+        return $ret;
+    }
     
     
 }
index b6d1c39..c3e23e9 100644 (file)
@@ -16,7 +16,7 @@ class Pman_Core_DataObjects_Core_enum extends DB_DataObject
     public $active;                          // int(2)  not_null
     public $seqid;                           // int(11)  not_null multiple_key
     public $seqmax;                           // int(11)  not_null multiple_key
-
+    public $display_name;
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
index 25265c2..426e87b 100644 (file)
@@ -81,7 +81,7 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
             $this->selectAdd("count($tn.id) as qty");
             $this->selectAdd("count( distinct $tn.on_id) as uqty");
             $this->whereAdd('LENGTH(join_person_id_id.name) > 0 ');
-            $this->groupBy('person_id');
+            $this->groupBy('person_id,join_person_id_id.name,join_person_id_id.email');
         }
          if (isset($q['query']['table_sum'])) {
             //DB_DataObject::debugLevel(1);
@@ -389,4 +389,65 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
         $x->insert();
     
     }
+    
+    
+    
+    function onInsert($request,$roo)
+    {
+        $this->writeEventLog();
+    }
+    
+    function writeEventLog()
+    {
+        $ff  = HTML_FlexyFramework::get();
+        if (empty($ff->Pman['event_log_dir'])) {
+            return false;
+        }
+        
+        // add user (eg. www-data or local user if not..)
+        if (function_exists('posix_getpwuid')) {
+            $uinfo = posix_getpwuid( posix_getuid () ); 
+         
+            $user = $uinfo['name'];
+        } else {
+            $user = getenv('USERNAME'); // windows.
+        }
+        //print_r($this);
+        $file = $ff->Pman['event_log_dir']. '/'. $user. date('/Y/m/d/'). $this->id . ".json";
+        if (!file_exists(dirname($file))) {
+            mkdir(dirname($file),0700,true);
+        }
+        
+        // Remove all the password from logs...
+        $p =  empty($_POST) ? array() : $_POST;
+        foreach(array('passwd', 'password', 'passwd2', 'password2') as $rm) {
+            if (isset($p[$rm])) {
+                $p['passwd'] = '******';
+            }
+        }
+        $i=0;
+        $files = array();
+        foreach ($_FILES as $k=>$f){
+            if (empty($f['tmp_name']) || !file_exists($f['tmp_name'])) {
+                continue;
+            }
+            $i++;
+            $files[$k] = $f;
+            $files[$k]['tmp_name'] = $this->id . '.file_'. $i.'.jpg';
+            $nf = $ff->Pman['event_log_dir']. '/'. $this->id . ".file_$i.jpg";
+            if (!copy($f['tmp_name'], $nf)) {
+                print_r("failed to copy {$f['tmp_name']}...\n");
+            }
+        }
+        
+        file_put_contents($file, json_encode(array(
+            'REQUEST_URI' => empty($_SERVER['REQUEST_URI']) ? 'cli' : $_SERVER['REQUEST_URI'],
+            'GET' => empty($_GET) ? array() : $_GET,
+            'POST' =>$p,
+            'FILES' => $files,
+        )));
+        
+    }
+    
+    
 }
similarity index 92%
rename from DataObjects/Group_Members.php
rename to DataObjects/Group_members.php
index f0c305d..a03317f 100755 (executable)
@@ -4,12 +4,12 @@
  */
 require_once 'DB/DataObject.php';
 
-class Pman_Core_DataObjects_Group_Members extends DB_DataObject 
+class Pman_Core_DataObjects_Group_members extends DB_DataObject 
 {
     ###START_AUTOCODE
     /* the code below is auto generated do not remove the above tag */
 
-    public $__table = 'Group_Members';                   // table name
+    public $__table = 'group_members';                   // table name
     public $group_id;                        // int(11)  
     public $id;                              // int(11)  not_null primary_key auto_increment
     public $user_id;                         // int(11)  not_null
@@ -23,7 +23,7 @@ class Pman_Core_DataObjects_Group_Members extends DB_DataObject
     
     function change($person, $group, $state)
     {
-        $gm = DB_DataObject::factory('Group_Members');
+        $gm = DB_DataObject::factory('group_members');
         $gm->group_id = $group->id;
         $gm->user_id = $person->id;
         $gm->find(true);
similarity index 81%
rename from DataObjects/Group_Rights.php
rename to DataObjects/Group_rights.php
index c1748fc..c84ef9b 100755 (executable)
 require_once 'DB/DataObject.php';
 
  
-class Pman_Core_DataObjects_Group_Rights extends DB_DataObject 
+class Pman_Core_DataObjects_Group_rights extends DB_DataObject 
 {
     ###START_AUTOCODE
     /* the code below is auto generated do not remove the above tag */
 
-    public $__table = 'Group_Rights';                    // table name
+    public $__table = 'group_rights';                    // table name
     public $rightname;                       // string(64)  not_null
     public $group_id;                        // int(11)  not_null
     public $accessmask;                      // string(10)  not_null
@@ -34,13 +34,19 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
     
     var $fullRights = "ADESPIM";
     
-    function listPermsFromGroupIds($grps, $isAdmin=false) {
+    function listPermsFromGroupIds($grps, $isAdmin=false, $isOwner = false) {
         
         $t = clone($this);
         $t->whereAdd('group_id IN ('. implode(',', $grps).')');
+        $t->autoJoin();
         $t->find();
-        $ret = array();
+        
+         $ret = array();
         while($t->fetch()) {
+            
+           
+            
+            
             if (isset($ret[$t->rightname])) {
                 $ret[$t->rightname] = $this->mergeMask($ret[$t->rightname], $t->accessmask);
                 continue;
@@ -49,9 +55,15 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
         }
         // blank out rights that are disabled by the system..
         $defs = $this->defaultPermData();
+        
+        
+        
         //echo "<PRE>";print_r($defs);
         $r = array();
         foreach($defs as $k=>$v) {
+            
+            
+            
             if (empty($v[0])) { // delete right if not there..
                 $r[$k] = '';
                 continue;
@@ -60,14 +72,18 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
             
             if (isset($ret[$k])) {
                 if (empty($ret[$k]) && $isAdmin) {
-                    $r[$k] = $v[0];
+                    $r[$k] = $v[0] ; // -- it's admin they get rights... can not be disabled..
                     continue;
                 }
-                
+                // in theory non-owners could sneak in rights here..??
                 $r[$k] = $ret[$k];
                 continue;
             }
             // not set contition...
+            if (!$isOwner) {
+                $r[$k] = '';
+                continue;
+            }
             
             $r[$k] = $isAdmin ? $v[0] : $v[1];
             
@@ -111,12 +127,22 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
         // M????
         
         
-        
+        $gid = empty($this->group_id) ? 0 : $this->group_id;
         static $Pman_DataObjects_Group_Right = array();
-        if (!empty($Pman_DataObjects_Group_Right)) {
-            return $Pman_DataObjects_Group_Right;
+        
+        
+        if (!empty($Pman_DataObjects_Group_Right[$gid])) {
+            return $Pman_DataObjects_Group_Right[$gid];
+        }
+        $has_admin = true; ///?? not sure..
+        if ($gid) {
+            $g = DB_DataObject::factory('groups');
+            $g->get($this->group_id);
+            $has_admin = $g->type  == 2 ? false : true;
         }
         
+        
+        
         $ff = HTML_FlexyFramework::get();
         //print_R($ff);
         $enabled =  array('Core') ;
@@ -126,6 +152,11 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
         $ret = array();
          //echo '<PRE>';print_r($enabled);
         foreach($enabled as $module) {
+            
+            if (($module == 'Admin') && !$has_admin) {
+                continue;
+            }
+            
             $fn = $pman. $module.  '/'.$module. '.perms.json';
             if (!file_exists($fn)) {
                 continue;
@@ -147,9 +178,9 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
             }
             
         }
-        $Pman_DataObjects_Group_Right = $ret;
+        $Pman_DataObjects_Group_Right[$gid] = $ret;
        // print_r($ret);
-        return $Pman_DataObjects_Group_Right;
+        return $Pman_DataObjects_Group_Right[$gid];
          
         
     }
@@ -170,7 +201,7 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
     {
         // all groups must have the minimum privaligess..
         // admin group must have all the privaliges
-        $g = DB_DataObject::Factory('Groups');
+        $g = DB_DataObject::Factory('groups');
         $g->get($this->group_id);
         $defs = $this->defaultPermData();
         switch($g->name) {
@@ -217,7 +248,7 @@ class Pman_Core_DataObjects_Group_Rights extends DB_DataObject
         //echo '<PRE>';print_r($defs);
         //$usecol = 1;
         foreach($defs as $rightname => $defdata) {
-            $gr = DB_DataObject::Factory('Group_Rights');
+            $gr = DB_DataObject::Factory('group_rights');
             $gr->rightname  = $rightname;
             $gr->group_id = $g->id;
             if (!$gr->find(true)) {
index ef4c082..03786a1 100755 (executable)
@@ -28,8 +28,8 @@ class Pman_Core_DataObjects_Groups extends DB_DataObject
     function beforeDelete()
     {
         $x = DB_DataObject::factory('Groups');
-        $x->query("DELETE FROM Group_Rights WHERE group_id = {$this->id}");
-        $x->query("DELETE FROM Group_Members WHERE group_id = {$this->id}");
+        $x->query("DELETE FROM group_rights WHERE group_id = {$this->id}");
+        $x->query("DELETE FROM group_members WHERE group_id = {$this->id}");
     }
     /**
      * check who is trying to access this. false == access denied..
@@ -58,7 +58,7 @@ class Pman_Core_DataObjects_Groups extends DB_DataObject
         $pi = DB_DataObject::factory(empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable']);
         $pi->get($this->leader);
             
-        $p = DB_DataObject::factory('Group_Members');
+        $p = DB_DataObject::factory('group_members');
         $p->group_id = $this->id;
         $p->user_id = $this->leader;
         //$p->type = 1; //???????
@@ -72,7 +72,7 @@ class Pman_Core_DataObjects_Groups extends DB_DataObject
     
     function memberIds()
     {
-        $gm = DB_Dataobject::factory('Group_Members');
+        $gm = DB_Dataobject::factory('group_members');
         $gm->group_id = $this->id;
         return $gm->fetchAll('user_id');
         
@@ -81,7 +81,7 @@ class Pman_Core_DataObjects_Groups extends DB_DataObject
     
     function addMember($person)
     {
-        $gm = DB_Dataobject::factory('Group_Members');
+        $gm = DB_Dataobject::factory('group_members');
         $gm->group_id = $this->id;
         $gm->user_id = $person->id;
         if (!$gm->count()) {
index 014e420..446fda1 100644 (file)
@@ -26,7 +26,6 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
     public $linkurl;                         // string(254)  not_null
     public $descript;                        // blob(65535)  not_null blob
     public $title;                           // string(128)  not_null
-
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
@@ -149,7 +148,6 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         ));
           
     }
-
      
     /**
      * deletes all the image instances of it...
@@ -451,6 +449,17 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         return $fc;
         
     }
+    
+    function fileExt()
+    {
+        require_once 'File/MimeType.php';
+        
+        $y = new File_MimeType();
+        return  $y->toExt($this->mimetype);
+        
+        
+    }
+    
     /**
      *
      *
index 129d9a6..3ab74eb 100644 (file)
@@ -82,13 +82,22 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             (isset($ff->HTTP_HOST) ? $ff->HTTP_HOST : 'localhost');
             
         /* use the regex compiler, as it doesnt parse <tags */
-        require_once 'HTML/Template/Flexy.php';
-        $template = new HTML_Template_Flexy( array(
+        
+        $tops = array(
             'compiler'    => 'Flexy',
             'nonHTML' => true,
             'filters' => array('SimpleTags','Mail'),
             //     'debug'=>1,
-        ));
+        );
+        
+        
+        
+        if (!empty($args['templateDir'])) {
+            $tops['templateDir'] = $args['templateDir'];
+        }
+        
+        require_once 'HTML/Template/Flexy.php';
+        $template = new HTML_Template_Flexy( $tops );
         
      
          
@@ -285,10 +294,10 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         $g = DB_DataObject::factory('Groups');
         $g->type = 0;
         $g->get('name', 'Administrators');
-        $gm = DB_DataObject::Factory('Group_Members');
+        $gm = DB_DataObject::Factory('group_members');
         if (in_array($g->id,$gm->listGroupMembership($this))) {
             // refresh admin groups.
-            $gr = DB_DataObject::Factory('Group_Rights');
+            $gr = DB_DataObject::Factory('group_rights');
             $gr->applyDefs($g, 0);
         }
              
@@ -347,7 +356,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
     }
     
     function active()
-    {
+    { 
         return $this->active;
     }
     function authUserName($n) // set username prior to acheck user exists query.
@@ -410,7 +419,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
       
         // perms + groups.
         $aur['perms']  = $this->getPerms();
-        $g = DB_DataObject::Factory('Group_Members');
+        $g = DB_DataObject::Factory('group_members');
         $aur['groups']  = $g->listGroupMembership($this, 'name');
         
         $aur['passwd'] = '';
@@ -429,7 +438,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         
         // ------ INIITIALIZE IF NO GROUPS ARE SET UP.
         
-        $g = DB_DataObject::Factory('Group_Rights');
+        $g = DB_DataObject::Factory('group_rights');
         if (!$g->count()) {
             $g->genDefault();
         }
@@ -438,13 +447,13 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             return $g->adminRights(); // system is not set up - so they get full rights.
         }
         //DB_DataObject::debugLevel(1);
-        $g = DB_DataObject::Factory('Group_Members');
+        $g = DB_DataObject::Factory('group_members');
         $g->whereAdd('group_id is NOT NULL AND user_id IS NOT NULL');
         if (!$g->count()) {
             // add the current user to the admin group..
             $g = DB_DataObject::Factory('Groups');
             if ($g->get('name', 'Administrators')) {
-                $gm = DB_DataObject::Factory('Group_Members');
+                $gm = DB_DataObject::Factory('group_members');
                 $gm->group_id = $g->id;
                 $gm->user_id = $this->id;
                 $gm->insert();
@@ -453,16 +462,16 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
         }
         
         // ------ STANDARD PERMISSION HANDLING.
-        
-        $g = DB_DataObject::Factory('Group_Members');
+        $isOwner = $this->company()->comptype == 'OWNER';
+        $g = DB_DataObject::Factory('group_members');
         $grps = $g->listGroupMembership($this);
        //var_dump($grps);
         $isAdmin = $g->inAdmin;
         //echo '<PRE>'; print_r($grps);var_dump($isAdmin);
         // the load all the perms for those groups, and add them all together..
         // then load all those 
-        $g = DB_DataObject::Factory('Group_Rights');
-        $ret =  $g->listPermsFromGroupIds($grps, $isAdmin);
+        $g = DB_DataObject::Factory('group_rights');
+        $ret =  $g->listPermsFromGroupIds($grps, $isAdmin, $isOwner);
         //echo '<PRE>';print_r($ret);
         return $ret;
          
@@ -476,7 +485,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
     
     function groups($what=false)
     {
-        $g = DB_DataObject::Factory('Group_Members');
+        $g = DB_DataObject::Factory('group_members');
         $grps = $g->listGroupMembership($this);
         $g = DB_DataObject::Factory('Groups');
         $g->whereAddIn('id', $grps, 'int');
@@ -554,7 +563,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             $this->active = 1;
         }
         $tn_p = $this->tableName();
-        $tn_gm = DB_DataObject::Factory('Group_Members')->tableName();
+        $tn_gm = DB_DataObject::Factory('group_members')->tableName();
         $tn_g = DB_DataObject::Factory('Groups')->tableName();
 
         ///---------------- Group views --------
@@ -766,7 +775,7 @@ class Pman_Core_DataObjects_Person extends DB_DataObject
             $g->type = 0;
             $g->get('name', 'Administrators');
             
-            $p = DB_DataObject::factory('Group_Members');
+            $p = DB_DataObject::factory('group_members');
             $p->group_id = $g->id;
             $p->user_id = $this->id;     
             if (!$p->count()) {
index 06db028..aa0b3ee 100644 (file)
@@ -16,7 +16,7 @@ ALTER TABLE Companies ADD COLUMN    email varchar(128)  default NULL;
 ALTER TABLE Companies ADD COLUMN    isOwner int(11) default NULL;
 ALTER TABLE Companies ADD COLUMN    logo_id INT(11)  NOT NULL DEFAULT 0;;
 ALTER TABLE Companies ADD COLUMN    background_color varchar(8)  NOT NULL;
-ALTER TABLE Companies ADD COLUMN    comptype varchar(8)  NOT NULL DEFAULT '';
+ALTER TABLE Companies ADD COLUMN    comptype varchar(32)  NOT NULL DEFAULT '';
 ALTER TABLE Companies ADD COLUMN    url varchar(254)  NOT NULL DEFAULT '';
 ALTER TABLE Companies ADD COLUMN    main_office_id int(11)  NOT NULL DEFAULT 0;
 ALTER TABLE Companies ADD COLUMN    created_by int(11)  NOT NULL DEFAULT 0;
@@ -30,6 +30,7 @@ ALTER TABLE Companies ADD COLUMN    country varchar(4) NOT NULL DEFAULT '';
 
 
 ALTER TABLE Companies CHANGE COLUMN isOwner isOwner int(11);
+ALTER TABLE Companies CHANGE COLUMN comptype comptype  VARCHAR(32) DEFAULT '';
 -- postres
 ALTER TABLE Companies ALTER isOwner TYPE int(11);
 ALTER TABLE Companies ALTER owner_id SET DEFAULT 0;
@@ -106,23 +107,30 @@ ALTER TABLE core_event_audit ADD COLUMN       old_audit_id int(11)  NOT NULL DEF
 ALTER TABLE core_event_audit ADD COLUMN       newvalue BLOB  NOT NULL DEFAULT '';
 ALTER TABLE core_event_audit ADD   INDEX lookup(event_id, name, old_audit_id);
 
-CREATE TABLE  Group_Members  (
+-- BC name..
+RENAME TABLE Group_Members TO group_members;
+
+CREATE TABLE  group_members  (
     id int(11)  NOT NULL AUTO_INCREMENT,
     PRIMARY KEY (id)
 );
-ALTER TABLE Group_Members ADD COLUMN  group_id int(11) default NULL;
-ALTER TABLE Group_Members ADD COLUMN   user_id int(11) NOT NULL default 0;
+ALTER TABLE group_members ADD COLUMN  group_id int(11) default NULL;
+ALTER TABLE group_members ADD COLUMN   user_id int(11) NOT NULL default 0;
+
+-- BC name..
+RENAME TABLE Group_Rights TO group_rights;
+
 
-CREATE TABLE  Group_Rights  (
+CREATE TABLE  group_rights  (
     id int(11)  NOT NULL AUTO_INCREMENT,
     PRIMARY KEY (id)
 );
-ALTER TABLE Group_Rights ADD COLUMN    rightname varchar(64)  NOT NULL DEFAULT '';
-ALTER TABLE Group_Rights ADD COLUMN     group_id int(11) NOT NULL DEFAULT 0;
-ALTER TABLE Group_Rights ADD COLUMN   accessmask varchar(10)  NOT NULL DEFAULT '';
+ALTER TABLE group_rights ADD COLUMN    rightname varchar(64)  NOT NULL DEFAULT '';
+ALTER TABLE group_rights ADD COLUMN     group_id int(11) NOT NULL DEFAULT 0;
+ALTER TABLE group_rights ADD COLUMN   accessmask varchar(10)  NOT NULL DEFAULT '';
 
 #old mysql.
-ALTER TABLE Group_Rights CHANGE COLUMN AccessMask accessmask varchar(10)  NOT NULL DEFAULT '';
+ALTER TABLE group_rights CHANGE COLUMN AccessMask accessmask varchar(10)  NOT NULL DEFAULT '';
 
 
 
@@ -310,14 +318,16 @@ CREATE TABLE   core_enum (
  
 );
  
-alter table  core_enum ADD COLUMN etype varchar(32)  NOT NULL DEFAULT '';
+alter table  core_enum ADD COLUMN  etype varchar(32)  NOT NULL DEFAULT '';
 alter table  core_enum ADD COLUMN  name varchar(255)  NOT NULL DEFAULT '';
-alter table  core_enum ADD COLUMN   active int(2)  NOT NULL DEFAULT 1;
+alter table  core_enum ADD COLUMN  active int(2)  NOT NULL DEFAULT 1;
 alter table  core_enum ADD COLUMN  seqid int(11)  NOT NULL DEFAULT 0;
 alter table  core_enum ADD COLUMN  seqmax int(11)  NOT NULL DEFAULT 0;
+alter table  core_enum ADD COLUMN  display_name varchar(255)  NOT NULL DEFAULT '';
 
 alter table  core_enum ADD  INDEX lookup(seqid, active, name, etype);
+
+UPDATE core_enum SET display_name = name WHERE display_name = '';
 
 
 
index 11106cc..0ac280c 100644 (file)
@@ -44,21 +44,21 @@ remarks = 66
 [Events__keys]
 id = N
 
-[Group_Members]
+[group_members]
 group_id = 1
 id = 129
 user_id = 129
 
-[Group_Members__keys]
+[group_members__keys]
 id = N
 
-[Group_Rights]
+[group_rights]
 rightname = 130
 group_id = 129
 AccessMask = 130
 id = 129
 
-[Group_Rights__keys]
+[group_rights__keys]
 id = N
 
 [Groups]
index cd4f6ec..a3e602c 100644 (file)
@@ -13,6 +13,7 @@ logo_id = Images:id
 owner_id = Person:id
 main_office_id = Office:id
 
+
 [Office]
 company_id = Companies:id
 
@@ -31,11 +32,11 @@ project_id = Projects:id
 [Groups]
 leader = Person:id
 
-[Group_Members]
+[group_members]
 group_id = Groups:id
 user_id =  Person:id
 
-[Group_Rights]
+[group_rights]
 group_id = Groups:id
 
 [Events]
index 576961d..c3428a7 100644 (file)
@@ -87,7 +87,7 @@ class Pman_Core_GroupMembers extends Pman
         
         
         
-        $p = DB_DataObject::factory('Group_Members');
+        $p = DB_DataObject::factory('group_members');
         $p->group_id = (int)$_GET['group_id'];
         $p->whereAdd('user_id IN ('. implode(',' ,array_keys($ret) ). ')');
         $p->find();
@@ -126,7 +126,7 @@ class Pman_Core_GroupMembers extends Pman
                 $pi = DB_DataObject::factory('Person');
                 $pi->get($uid);
                     
-                $p = DB_DataObject::factory('Group_Members');
+                $p = DB_DataObject::factory('group_members');
                 $p->group_id = (int)$_POST['group_id'];
                 $p->user_id = $uid;
                 //$p->type = (int)$_POST['type'];
@@ -155,7 +155,7 @@ class Pman_Core_GroupMembers extends Pman
            
             
             foreach($_POST['dataDelete'] as $id => $ac) {
-                $m = DB_DataObject::factory('Group_Members');
+                $m = DB_DataObject::factory('group_members');
                 $m->get($id);
                 $m->delete();
             }
@@ -165,7 +165,7 @@ class Pman_Core_GroupMembers extends Pman
         if (!empty($_POST['dataAdd'])) {
              
             foreach($_POST['dataAdd'] as $id => $ac) {
-                $p = DB_DataObject::factory('Group_Members');
+                $p = DB_DataObject::factory('group_members');
                 $p->group_id = (int)$_POST['group_id'];
                 $p->user_id = $id;
                 $p->insert();
index fcae94e..3e2680f 100644 (file)
@@ -59,6 +59,7 @@ class Pman_Core_Images extends Pman
         
         $bits= explode('/', $s);
         $id = 0;
+        
         // without id as first part...
         if (!empty($bits[0]) && $bits[0] == 'Thumb') {
             $this->thumb = true;
@@ -76,7 +77,24 @@ class Pman_Core_Images extends Pman
             $this->size = empty($bits[2]) ? '0x0' : $bits[2];
             $id = empty($bits[3]) ? 0 :   $bits[3];
             
+        } else if (!empty($bits[0]) && $bits[0] == 'events') {
+            $popts = PEAR::getStaticProperty('Pman','options');
+            
+            header ('Content-Type: image/jpeg');
+            if(!empty($bits[2]) && $bits[2] == 'download'){
+                $file = "{$popts['event_log_dir']}/{$bits[1]}";
+                header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
+                ob_clean();
+                flush();
+                readfile($file);
+            }else{
+                $file = "{$popts['event_log_dir']}/{$bits[1]}.jpg";
+                $fh = fopen($file,'r');
+                echo fread($fh,filesize($file));
+            }
+            exit;
         } else {
+        
             $id = empty($bits[0]) ? 0 :  $bits[0];
         }
         
@@ -214,11 +232,19 @@ class Pman_Core_Images extends Pman
         //echo "SKALING?  $this->size";
         // acutally if we generated the image, then we do not need to validate the size..
         
+        
+        
         // if the mimetype is not converted..
         // then the filename should be original.{size}.jpeg
         $fn = $img->getStoreName() . '.'. $this->size . '.jpeg'; // thumbs are currenly all jpeg.!???
-      // var_dump($fn);
+        
         if (!file_exists($fn)) {
+            $fn = $img->getStoreName()  . '.'. $this->size . '.'. $img->fileExt();
+            $this->as_mimetype = $img->mimetype;
+        }
+        
+        if (!file_exists($fn)) {            
+            
             $this->validateSize();
         }
         
@@ -340,7 +366,7 @@ class Pman_Core_Images extends Pman
         $attr_url = $attr[$attr_name];
         $umatch  = false;
         if(!preg_match('#/(Images|Images/Thumb/[a-z0-9]+|Images/Download)/([0-9]+)/(.*)$#', $attr_url, $umatch))  {
-            continue;
+            return $html;
         }
         $id = $umatch[2];
         $img = DB_DataObject::factory('Images');
index bacad59..15bbc7a 100644 (file)
@@ -123,8 +123,11 @@ class Pman_Core_Notify extends Pman
         $w = DB_DataObject::factory($this->table);
         
         if (!$showold) {
-            $w->whereAdd('act_when > sent'); // eg.. sent is not valid..
             
+            // standard
+            
+            $w->whereAdd('act_when > sent'); // eg.. sent is not valid..
+            $w->whereAdd('act_start > NOW() - INTERVAL 14 DAY'); // ignore the ones stuck in the queue
             if (!$this->force) {
                 $w->whereAdd('act_when < NOW()'); // eg.. not if future..
             }
index 9000039..b4a8d2a 100644 (file)
@@ -109,6 +109,23 @@ class Pman_Core_NotifySend extends Pman
         
         
         $o = $w->object();
+        
+        if ($o === false)  {
+            
+            $ev = $this->addEvent('NOTIFY', $w,
+                            "Notification event cleared (underlying object does not exist)" );;
+            $ww = clone($w);
+            $w->sent = date('Y-m-d H:i:s');
+            $w->msgid = '';
+            $w->event_id = $ev->id;
+            $w->update($ww);
+            die(date('Y-m-d h:i:s ') . 
+                     "Notification event cleared (underlying object does not exist)" 
+                    ."\n");
+        }
+     
+        
+        
         $p = $w->person();
         
         if (isset($p->active) && empty($p->active)) {
@@ -209,10 +226,15 @@ class Pman_Core_NotifySend extends Pman
         //print_r($email);exit;
         // should we fetch the watch that caused it.. - which should contain the method to call..
         // --send-to=test@xxx.com
-        if (!empty($opts['send-to'])) {
+       
+        if (!empty($email['send-to'])) {
+            $p->email = $email['send-to'];
+        }
+         if (!empty($opts['send-to'])) {
             $p->email = $opts['send-to'];
         }
         
+        //print_r($p);
         require_once 'Validate.php';
         if (!Validate::email($p->email, true)) {
             $ev = $this->addEvent('NOTIFY', $w, "INVALID ADDRESS: " . $p->email);
@@ -261,6 +283,17 @@ class Pman_Core_NotifySend extends Pman
             // older that 1 day.
             $retry = 120;
         }
+        if (strtotime($w->act_start) <  strtotime('NOW - 14 DAY')) {
+            $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - ". $p->email );
+            $w->sent = date('Y-m-d H:i:s');
+            $w->msgid = '';
+            $w->event_id = $ev->id;
+            $w->update($ww);
+            die(date('Y-m-d h:i:s') . " - FAILED -  GAVE UP TO OLD - {$p->email} \n");
+        }
+        
+        
+        
         $w->to_email = $p->email; 
         //$this->addEvent('NOTIFY', $w, 'GREYLISTED ' . $p->email . ' ' . $res->toString());
         $w->act_when = date('Y-m-d H:i:s', strtotime('NOW + ' . $retry . ' MINUTES'));
@@ -415,13 +448,16 @@ class Pman_Core_NotifySend extends Pman
     function makeEmail($object, $rcpt, $last_sent_date, $notify, $force =false)
     {
         $m = 'notify'. $notify->evtype;
-        var_dump($m);
+        //var_dump($m);
         
         if (!empty($notify->evtype) && method_exists($object,$m)) {
             return $object->$m($rcpt, $last_sent_date, $notify, $force);
         }
                 
-        
+        if (!method_exists($object, 'toEmail')) {
+            //var_Dump($object);
+            //exit;
+        }
         return $object->toEmail($rcpt, $last_sent_date, $notify, $force);
     }
     
index 7322d00..960e286 100644 (file)
@@ -1,4 +1,18 @@
+
+
+Pman.Dialog.Companies =   new Roo.util.Observable({
+    
+    show : function (data, callback)
+    {
+        Pman.Dialog.CoreCompanies.show({id:data.id});
+    }
+
+});
+
+
+
 //<script type="text/javascript">
+/*
 
 
 Pman.Dialog.Companies =   new Roo.util.Observable({
@@ -481,3 +495,4 @@ Pman.Dialog.Companies =   new Roo.util.Observable({
     }
          
 });
+*/
\ No newline at end of file
diff --git a/Pman.Dialog.CoreCompanies.bjs b/Pman.Dialog.CoreCompanies.bjs
new file mode 100644 (file)
index 0000000..355b965
--- /dev/null
@@ -0,0 +1,247 @@
+{
+    "id": "roo-file-97",
+    "name": "Pman.Dialog.CoreCompanies",
+    "parent": "",
+    "title": "",
+    "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreCompanies.bjs",
+    "items": [
+        {
+            "autoCreate": "true",
+            "closable": false,
+            "collapsible": false,
+            "draggable": false,
+            "height": 400,
+            "modal": true,
+            "shadow": "true",
+            "title": "Edit Company",
+            "width": 750,
+            "xtype": "LayoutDialog",
+            "|xns": "Roo",
+            "items": [
+                {
+                    "*prop": "center",
+                    "alwaysShowTabs": false,
+                    "autoScroll": false,
+                    "closeOnTab": true,
+                    "hideTabs": true,
+                    "titlebar": false,
+                    "xtype": "LayoutRegion",
+                    "|xns": "Roo"
+                },
+                {
+                    "autoCreate": "true",
+                    "fitToFrame": true,
+                    "region": "center",
+                    "xtype": "ContentPanel",
+                    "|xns": "Roo",
+                    "items": [
+                        {
+                            "listeners": {
+                                "actionfailed": "function(f, act) {\n    _this.dialog.el.unmask();\n    // error msg???\n    Pman.standardActionFailed(f,act);\n              \n}",
+                                "actioncomplete": "function(f, act) {\n    _this.dialog.el.unmask();\n    //console.log('load completed'); \n    // error messages?????\n    if(act.type == 'setdata'){\n        this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n        return;\n    }\n   \n    if (act.type == 'load') {\n        _this.data = act.result.data;\n        var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';\n     \n            \n        if (_this.form.findField('comptype')) {\n            _this.form.findField('comptype')[meth]();\n        }\n         \n       // _this.loaded();\n        return;\n    }\n    \n    \n    if (act.type == 'submit') { // only submitted here if we are \n        _this.dialog.hide();\n       \n        if (_this.callback) {\n            _this.callback.call(this, act.result.data);\n        }\n        return; \n    }\n    // unmask?? \n}",
+                                "rendered": "function (form)\n{\n    _this.form = form;\n}"
+                            },
+                            "fileUpload": true,
+                            "labelWidth": 160,
+                            "xtype": "Form",
+                            "|url": "baseURL + '/Roo/Companies.php'",
+                            "|xns": "Roo.form",
+                            "items": [
+                                {
+                                    "width": 500,
+                                    "xtype": "Column",
+                                    "|xns": "Roo.form",
+                                    "items": [
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Company ID (for filing Ref.)",
+                                            "name": "code",
+                                            "qtip": "Enter code",
+                                            "width": 100,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "render": "function (_self)\n{\n    _this.etypeCombo = _self;\n}"
+                                            },
+                                            "alwaysQuery": true,
+                                            "displayField": "display_name",
+                                            "emptyText": "Select Type",
+                                            "fieldLabel": "Type",
+                                            "forceSelection": true,
+                                            "hiddenName": "comptype",
+                                            "listWidth": 250,
+                                            "loadingText": "Searching...",
+                                            "minChars": 2,
+                                            "name": "comptype_display",
+                                            "pageSize": 20,
+                                            "qtip": "Select type",
+                                            "queryParam": "query[name]",
+                                            "selectOnFocus": true,
+                                            "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> : {display_name}</div>",
+                                            "triggerAction": "all",
+                                            "typeAhead": false,
+                                            "valueField": "name",
+                                            "width": 200,
+                                            "xtype": "ComboBox",
+                                            "|xns": "Roo.form",
+                                            "items": [
+                                                {
+                                                    "listeners": {
+                                                        "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n    //o.params['query[empty_etype]'] = 1;\n    o.params.etype = 'COMPTYPE';\n}\n"
+                                                    },
+                                                    "*prop": "store",
+                                                    "remoteSort": true,
+                                                    "xtype": "Store",
+                                                    "|sortInfo": "{ direction : 'ASC', field: 'id' }",
+                                                    "|xns": "Roo.data",
+                                                    "items": [
+                                                        {
+                                                            "*prop": "proxy",
+                                                            "xtype": "HttpProxy",
+                                                            "method": "GET",
+                                                            "|xns": "Roo.data",
+                                                            "|url": "baseURL + '/Roo/core_enum.php'"
+                                                        },
+                                                        {
+                                                            "*prop": "reader",
+                                                            "id": "id",
+                                                            "root": "data",
+                                                            "totalProperty": "total",
+                                                            "xtype": "JsonReader",
+                                                            "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"name\",\"type\":\"string\"}]",
+                                                            "|xns": "Roo.data"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Company Name",
+                                            "name": "name",
+                                            "qtip": "Enter Company Name",
+                                            "width": 300,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Phone",
+                                            "name": "tel",
+                                            "qtip": "Enter Phone Number",
+                                            "width": 300,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Fax",
+                                            "name": "fax",
+                                            "qtip": "Enter Fax Number",
+                                            "width": 300,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Email",
+                                            "name": "email",
+                                            "qtip": "Enter Email Address",
+                                            "width": 300,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Address",
+                                            "name": "address",
+                                            "qtip": "Enter Address",
+                                            "width": 300,
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "allowBlank": true,
+                                            "fieldLabel": "Remarks",
+                                            "height": 120,
+                                            "name": "remarks",
+                                            "qtip": "Enter remarks",
+                                            "width": 300,
+                                            "xtype": "TextArea",
+                                            "|xns": "Roo.form"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "labelAlign": "top",
+                                    "width": 200,
+                                    "xtype": "Column",
+                                    "|xns": "Roo.form",
+                                    "items": [
+                                        {
+                                            "fieldLabel": "Background Colour",
+                                            "name": "background_color",
+                                            "xtype": "ColorField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "fieldLabel": "Logo Image",
+                                            "height": 170,
+                                            "icon": "rootURL + 'images/default/dd/drop-add.gif'",
+                                            "name": "logo_id",
+                                            "style": "border: 1px solid #ccc;",
+                                            "width": 170,
+                                            "xtype": "DisplayField",
+                                            "|valueRenderer": "function(v) {\n    //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';\n    if (!v) {\n        return \"No Image Available\" + '<BR/>';\n    }\n    return String.format('<img src=\"{0}\" width=\"150\">', \n            baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'\n    );\n}",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "click": "function (_self, e)\n{\n    var _t = _this.form.findField('logo_id');\n                         \n    Pman.Dialog.Image.show({\n        onid :_this.data.id,\n        ontable : 'Companies',\n        imgtype : 'LOGO'\n    }, function(data) {\n        if  (data) {\n            _t.setValue(data.id);\n        }\n        \n    });\n}"
+                                            },
+                                            "text": "Add Image",
+                                            "xtype": "Button",
+                                            "|xns": "Roo"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "name": "isOwner",
+                                    "xtype": "Hidden",
+                                    "|xns": "Roo.form"
+                                },
+                                {
+                                    "name": "id",
+                                    "xtype": "Hidden",
+                                    "|xns": "Roo.form"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "listeners": {
+                        "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+                    },
+                    "*prop": "buttons[]",
+                    "text": "Cancel",
+                    "xtype": "Button",
+                    "|xns": "Roo"
+                },
+                {
+                    "listeners": {
+                        "click": "function (_self, e)\n{\n    // do some checks?\n     \n    \n    _this.dialog.el.mask(\"Saving\");\n    _this.form.doAction(\"submit\");\n\n}"
+                    },
+                    "*prop": "buttons[]",
+                    "text": "Save",
+                    "xtype": "Button",
+                    "|xns": "Roo"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": "001"
+}
\ No newline at end of file
diff --git a/Pman.Dialog.CoreCompanies.js b/Pman.Dialog.CoreCompanies.js
new file mode 100644 (file)
index 0000000..c3d0b54
--- /dev/null
@@ -0,0 +1,340 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Pman.Dialog.CoreCompanies = {
+
+    dialog : false,
+    callback:  false,
+
+    show : function(data, cb)
+    {
+        if (!this.dialog) {
+            this.create();
+        }
+
+        this.callback = cb;
+        this.data = data;
+        this.dialog.show(this.data._el);
+        if (this.form) {
+           this.form.reset();
+           this.form.setValues(data);
+           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
+        }
+
+    },
+
+    create : function()
+    {
+        var _this = this;
+        this.dialog = Roo.factory({
+            xtype: 'LayoutDialog',
+            xns: Roo,
+            autoCreate : 'true',
+            closable : false,
+            collapsible : false,
+            draggable : false,
+            height : 400,
+            modal : true,
+            shadow : 'true',
+            title : "Edit Company",
+            width : 750,
+            items : [
+                {
+                    xtype: 'ContentPanel',
+                    xns: Roo,
+                    autoCreate : 'true',
+                    fitToFrame : true,
+                    region : 'center',
+                    items : [
+                        {
+                            xtype: 'Form',
+                            xns: Roo.form,
+                            listeners : {
+                                actionfailed : function(f, act) {
+                                    _this.dialog.el.unmask();
+                                    // error msg???
+                                    Pman.standardActionFailed(f,act);
+                                              
+                                },
+                                actioncomplete : function(f, act) {
+                                    _this.dialog.el.unmask();
+                                    //console.log('load completed'); 
+                                    // error messages?????
+                                    if(act.type == 'setdata'){
+                                        this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                        return;
+                                    }
+                                   
+                                    if (act.type == 'load') {
+                                        _this.data = act.result.data;
+                                        var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';
+                                     
+                                            
+                                        if (_this.form.findField('comptype')) {
+                                            _this.form.findField('comptype')[meth]();
+                                        }
+                                         
+                                       // _this.loaded();
+                                        return;
+                                    }
+                                    
+                                    
+                                    if (act.type == 'submit') { // only submitted here if we are 
+                                        _this.dialog.hide();
+                                       
+                                        if (_this.callback) {
+                                            _this.callback.call(this, act.result.data);
+                                        }
+                                        return; 
+                                    }
+                                    // unmask?? 
+                                },
+                                rendered : function (form)
+                                {
+                                    _this.form = form;
+                                }
+                            },
+                            fileUpload : true,
+                            labelWidth : 160,
+                            url : baseURL + '/Roo/Companies.php',
+                            items : [
+                                {
+                                    xtype: 'Column',
+                                    xns: Roo.form,
+                                    width : 500,
+                                    items : [
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Company ID (for filing Ref.)',
+                                            name : 'code',
+                                            qtip : "Enter code",
+                                            width : 100
+                                        },
+                                        {
+                                            xtype: 'ComboBox',
+                                            xns: Roo.form,
+                                            listeners : {
+                                                render : function (_self)
+                                                {
+                                                    _this.etypeCombo = _self;
+                                                }
+                                            },
+                                            alwaysQuery : true,
+                                            displayField : 'display_name',
+                                            emptyText : "Select Type",
+                                            fieldLabel : 'Type',
+                                            forceSelection : true,
+                                            hiddenName : 'comptype',
+                                            listWidth : 250,
+                                            loadingText : "Searching...",
+                                            minChars : 2,
+                                            name : 'comptype_display',
+                                            pageSize : 20,
+                                            qtip : "Select type",
+                                            queryParam : 'query[name]',
+                                            selectOnFocus : true,
+                                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> : {display_name}</div>',
+                                            triggerAction : 'all',
+                                            typeAhead : false,
+                                            valueField : 'name',
+                                            width : 200,
+                                            store : {
+                                                xtype: 'Store',
+                                                xns: Roo.data,
+                                                listeners : {
+                                                    beforeload : function (_self, o){
+                                                        o.params = o.params || {};
+                                                        // set more here
+                                                        //o.params['query[empty_etype]'] = 1;
+                                                        o.params.etype = 'COMPTYPE';
+                                                    }
+                                                },
+                                                remoteSort : true,
+                                                sortInfo : { direction : 'ASC', field: 'id' },
+                                                proxy : {
+                                                    xtype: 'HttpProxy',
+                                                    xns: Roo.data,
+                                                    method : 'GET',
+                                                    url : baseURL + '/Roo/core_enum.php'
+                                                },
+                                                reader : {
+                                                    xtype: 'JsonReader',
+                                                    xns: Roo.data,
+                                                    id : 'id',
+                                                    root : 'data',
+                                                    totalProperty : 'total',
+                                                    fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
+                                                }
+                                            }
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Company Name',
+                                            name : 'name',
+                                            qtip : "Enter Company Name",
+                                            width : 300
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Phone',
+                                            name : 'tel',
+                                            qtip : "Enter Phone Number",
+                                            width : 300
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Fax',
+                                            name : 'fax',
+                                            qtip : "Enter Fax Number",
+                                            width : 300
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Email',
+                                            name : 'email',
+                                            qtip : "Enter Email Address",
+                                            width : 300
+                                        },
+                                        {
+                                            xtype: 'TextField',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Address',
+                                            name : 'address',
+                                            qtip : "Enter Address",
+                                            width : 300
+                                        },
+                                        {
+                                            xtype: 'TextArea',
+                                            xns: Roo.form,
+                                            allowBlank : true,
+                                            fieldLabel : 'Remarks',
+                                            height : 120,
+                                            name : 'remarks',
+                                            qtip : "Enter remarks",
+                                            width : 300
+                                        }
+                                    ]
+                                },
+                                {
+                                    xtype: 'Column',
+                                    xns: Roo.form,
+                                    labelAlign : 'top',
+                                    width : 200,
+                                    items : [
+                                        {
+                                            xtype: 'ColorField',
+                                            xns: Roo.form,
+                                            fieldLabel : 'Background Colour',
+                                            name : 'background_color'
+                                        },
+                                        {
+                                            xtype: 'DisplayField',
+                                            xns: Roo.form,
+                                            fieldLabel : 'Logo Image',
+                                            height : 170,
+                                            icon : 'rootURL + \'images/default/dd/drop-add.gif\'',
+                                            name : 'logo_id',
+                                            style : 'border: 1px solid #ccc;',
+                                            width : 170,
+                                            valueRenderer : function(v) {
+                                                //var vp = v ? v : 'Companies:' + _this.data.id + ':-LOGO';
+                                                if (!v) {
+                                                    return "No Image Available" + '<BR/>';
+                                                }
+                                                return String.format('<img src="{0}" width="150">', 
+                                                        baseURL + '/Images/Thumb/150x150/' + v + '/logo.jpg'
+                                                );
+                                            }
+                                        },
+                                        {
+                                            xtype: 'Button',
+                                            xns: Roo,
+                                            listeners : {
+                                                click : function (_self, e)
+                                                {
+                                                    var _t = _this.form.findField('logo_id');
+                                                                         
+                                                    Pman.Dialog.Image.show({
+                                                        onid :_this.data.id,
+                                                        ontable : 'Companies',
+                                                        imgtype : 'LOGO'
+                                                    }, function(data) {
+                                                        if  (data) {
+                                                            _t.setValue(data.id);
+                                                        }
+                                                        
+                                                    });
+                                                }
+                                            },
+                                            text : "Add Image"
+                                        }
+                                    ]
+                                },
+                                {
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'isOwner'
+                                },
+                                {
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'id'
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ],
+            center : {
+                xtype: 'LayoutRegion',
+                xns: Roo,
+                alwaysShowTabs : false,
+                autoScroll : false,
+                closeOnTab : true,
+                hideTabs : true,
+                titlebar : false
+            },
+            buttons : [
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    listeners : {
+                        click : function (_self, e)
+                        {
+                            _this.dialog.hide();
+                        }
+                    },
+                    text : "Cancel"
+                },
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    listeners : {
+                        click : function (_self, e)
+                        {
+                            // do some checks?
+                             
+                            
+                            _this.dialog.el.mask("Saving");
+                            _this.form.doAction("submit");
+                        
+                        }
+                    },
+                    text : "Save"
+                }
+            ]
+        });
+    }
+};
index 3cc4a1c..9e79bc2 100644 (file)
@@ -1,5 +1,5 @@
 {
-    "id": "roo-file-25",
+    "id": "roo-file-27",
     "name": "Pman.Dialog.CorePersonContact",
     "parent": "",
     "title": "",
                     "|xns": "Roo",
                     "items": [
                         {
-                            "|xns": "Roo.form",
-                            "xtype": "Form",
                             "listeners": {
                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
                             },
                             "method": "POST",
                             "style": "margin:10px;",
+                            "xtype": "Form",
                             "|url": "baseURL + '/Roo/Person.php'",
+                            "|xns": "Roo.form",
                             "items": [
                                 {
                                     "listeners": {
index 934d487..fce76a8 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "id": "roo-file-131",
+    "id": "roo-file-28",
     "name": "Pman.Dialog.CoreProject",
     "parent": "",
     "title": "",
-    "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreProject.bjs",
+    "path": "/home/chris/gitlive/Pman.Core/Pman.Dialog.CoreProject.bjs",
     "items": [
         {
             "closable": false,
                     "|xns": "Roo",
                     "items": [
                         {
-                            "|xns": "Roo.form",
-                            "xtype": "Form",
                             "listeners": {
                                 "|actioncomplete": "function(_self,action)\n{\n    if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n       return;\n    }\n    if (action.type == 'load') {\n        _this.dialog.el.unmask();\n        return;\n    }\n    if (action.type =='submit') {\n    \n        _this.dialog.el.unmask();\n        _this.dialog.hide();\n    \n         if (_this.callback) {\n            _this.callback.call(_this, _this.form.getValues());\n         }\n         _this.form.reset();\n         return;\n    }\n}\n",
                                 "|rendered": "function (form)\n{\n    _this.form= form;\n}\n"
                             },
                             "method": "POST",
                             "style": "margin:10px;",
+                            "xtype": "Form",
                             "|url": "baseURL + '/Roo/Projects.php'",
+                            "|xns": "Roo.form",
                             "items": [
                                 {
                                     "fieldLabel": "Code",
             ]
         }
     ],
-    "permname": ""
+    "permname": "",
+    "modOrder": "001"
 }
\ No newline at end of file
index 2452bfc..41446c4 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "id": "roo-file-29",
+    "id": "roo-file-101",
     "name": "Pman.Dialog.Image",
     "parent": "",
     "title": "",
-    "path": "/home/chris/gitlive/Pman.Core/Pman.Dialog.Image.bjs",
+    "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.Image.bjs",
     "items": [
         {
             "listeners": {
@@ -44,6 +44,7 @@
                             "labelWidth": 140,
                             "method": "POST",
                             "style": "margin:10px;",
+                            "timeout": 300,
                             "xtype": "Form",
                             "|url": "baseURL + '/Roo/Images.php'",
                             "|xns": "Roo.form",
index 60f3e50..5aa1a8d 100644 (file)
@@ -180,6 +180,7 @@ Pman.Dialog.Image = {
                             labelWidth : 140,
                             method : 'POST',
                             style : 'margin:10px;',
+                            timeout : 300,
                             url : baseURL + '/Roo/Images.php',
                             items : [
                                 {
diff --git a/Pman.Dialog.PersonEdit_1.js b/Pman.Dialog.PersonEdit_1.js
deleted file mode 100644 (file)
index a130cbf..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-//<script type="text/javascript">
-// for needed for new person in External contacts...
-
-
-
-// needs adding to init!!!!
-Pman.on('beforeload', function() {
-    
-    // edit - company readonly /office  - selectable..
-    // CONTACTS!!!!!
-    Pman.Dialog.PersonEdit = new Pman.Dialog.PersonEditor({
-        type : 'edit',
-        dialogConfig : {
-            title: "Edit Contact Details",
-            height: 350 // slightly taller..
-            
-        },
-        itemList : [
-            'company_id_name',
-            'office_id_name',
-            'name','role', 'phone', 'fax', 'email',
-       
-            'passwd1', 'passwd2',
-            'id', 
-            //'company_id', 
-            'company_id_email',
-            'company_id_address','company_id_tel','company_id_fax'
-        ]
-    });
-});
\ No newline at end of file
index cd5802e..8f32832 100644 (file)
@@ -720,7 +720,7 @@ Pman.Dialog.PersonEditor.prototype = {
              
             var c = ar[i];
             i++;
-            Pman.request({
+            new Pman.Request({
                 url : baseURL+'/Core/SendIntro.html',
                 method : 'POST',
                 params: c,
index 3057f14..34b74d7 100644 (file)
@@ -49,7 +49,7 @@ Pman.Download = function(cfg)
    
     
     
-    var submit = false;
+    this.submit = false;
     this.createCsvFrame();
     
     var requested = 0;
@@ -62,9 +62,9 @@ Pman.Download = function(cfg)
     
     if (this.method == 'GET' && !this.params) {
         (function() {
-            submit = true;
+            this.submit = true;
             this.csvFrame.src = cfg.url;
-            this.cleanup.defer(cfg.timeout || 30000,this);
+            //this.cleanup.defer(cfg.timeout || 30000,this);
         }).defer(100, this);
         
        
@@ -101,7 +101,7 @@ Pman.Download = function(cfg)
     }
     
     (function() {
-        submit = true;
+        this.submit = true;
         this.form.dom.submit();
         this.cleanup.defer(this.timeout || 30000,this);
     }).defer(100, this);
@@ -151,10 +151,11 @@ Roo.apply(Pman.Download.prototype, {
        // if (requested < 2) {
        //     return;
         //} // n
+        Roo.log('onload?');
         if (!this.submit) {
-            return;
+            return false;
         }
-        
+        return false;
       
         var frame = this.csvFrame;
         var success  = true; 
@@ -180,7 +181,9 @@ Roo.apply(Pman.Download.prototype, {
             Roo.log(e.toString());
             Roo.log(e);
         }
-        
+        // we can not actually do anything with the frame... as it may actually still be downloading..
+        return true;
+    
         this.cleanup();
         
         // this will never fire.. see 
@@ -189,7 +192,7 @@ Roo.apply(Pman.Download.prototype, {
             
             this.success();
         }
-       
+        return false;
         
 
     },
@@ -197,6 +200,7 @@ Roo.apply(Pman.Download.prototype, {
     // private - clean up download elements.
     cleanup :function()
     {
+        Roo.log('cleanup?');
         if (this.form) {
             this.form.remove();
             this.form= false;
index bf91aa8..702175c 100644 (file)
@@ -223,7 +223,7 @@ Pman.Tab.GroupsList.prototype = {
                     sels.push(data.selections[i].data.id);
                 }
                 
-                Pman.request({
+                new Pman.Request({
                     url: baseURL + '/Core/GroupMembers.php',
                     params: {
                         action : action,
diff --git a/Pman.js b/Pman.js
index 1fcd843..41bad06 100644 (file)
--- a/Pman.js
+++ b/Pman.js
@@ -417,13 +417,14 @@ Pman = new Roo.Document(
     onLoadTrackCall : function(id,cb, cls) {
         Roo.get(document.body).mask("Loading Document details");
 
-        Pman.request({
+        new Pman.Request({
             url: baseURL + '/Roo/Documents.html',  
             params: {
                 _id: id
             },  
             method: 'GET',  
-            success : function(data) {
+            success : function(res) {
+                var data = res.data;
                 Roo.get(document.body).unmask();
              
                 
@@ -562,7 +563,7 @@ Pman = new Roo.Document(
                 tab.grid.getView().mainWrap.mask("Deleting");
                 new Pman.Request({
                     url: baseURL + '/Roo/'+tbl+'.php',
-                    method: 'GET',
+                    method: 'POST',
                     params: {
                         _delete : r.join(',')
                     },
index 36c083c..bf1ac1e 100644 (file)
@@ -15,16 +15,12 @@ class Pman_Core_UploadProgress extends Pman
         return true; 
     }
     function get()
-    {
-        
-        
+    {   
         header("Cache-Control: no-cache, must-revalidate");
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-        //print_r('in');
         if (  !function_exists('uploadprogress_get_info')) {
             $this->jok(false);
            }
-        //print_r('in2');
         if (!empty($_GET['id'])) {
            // var_dump(uploadprogress_get_info($_GET['id']));
             $this->jok(uploadprogress_get_info($_GET['id']));
index e0e4247..dead470 100644 (file)
--- a/core.css
+++ b/core.css
@@ -535,5 +535,7 @@ span.ptcv-selectlang
     font-weight: bold;
 }
 
-
+.align-right {
+    text-align: right;
+}
 
index 016f1be..a5f648d 100644 (file)
        
         
 {if:bootLoader.Pman[roo_debug]}                  
-        <script type="text/javascript" src="{rootURL}/roojs1/roojs-debug.js"></script>
-        <script type="text/javascript" src="{rootURL}/roojs1/ux/Iscroll.js"></script>  
+        <script type="text/javascript" src="{rootURL}/roojs1/roojs-debug.js?ts={version}"></script>
+        <!-- <script type="text/javascript" src="{rootURL}/roojs1/ux/Iscroll.js"></script>  -->
          
 {else:}                  
-        <script type="text/javascript" src="{rootURL}/roojs1/roojs-all.js"></script>
+        <script type="text/javascript" src="{rootURL}/roojs1/roojs-all.js?ts={version}"></script>
                  
 {end:}                  
         <flexy:toJSON 
index 94f440f..a42aed2 100644 (file)
@@ -13,7 +13,10 @@ Roo.form.ColorField = function(config){
 };
 Roo.extend(Roo.form.ColorField, Roo.form.TriggerField , {
      
+     
     defaultAutoCreate : {tag: 'input', type: 'text', size: '6',   autocomplete: 'off'},
+    
+    triggerClass : 'x-form-arrow-trigger',
     validateValue : function(value){
         this.setBgColor(value);
         return true;
@@ -55,7 +58,7 @@ Roo.extend(Roo.form.ColorField, Roo.form.TriggerField , {
     },
     
     setBgColor : function(d) {
-        var d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
+        d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
         this.el.dom.style.background ='#' + d;
     }
 });
\ No newline at end of file
index 57a2779..22b402a 100644 (file)
@@ -156,6 +156,7 @@ Ext.form.Form.prototype.stackFind = function(id)
 };
 
 // This is in Roo???
+/*
 Ext.form.Hidden = function(config){
     Ext.form.Hidden.superclass.constructor.call(this, config);
 };
@@ -172,6 +173,9 @@ Ext.extend(Ext.form.Hidden, Ext.form.TextField, {
 
 
 });
+
+
+ Why is this here.. it does not work very well...
 Ext.form.DateField.prototype.getValue = function(fmt) {
     var r = this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || '';
     if (typeof(fmt) == 'undefined') {
@@ -182,7 +186,7 @@ Ext.form.DateField.prototype.getValue = function(fmt) {
     }
     return r.format(fmt);
 };
-
+*/
 //<script type="text/Javascript">
 
 /**