Changeset 174

Show
Ignore:
Timestamp:
Sat Aug 26 06:10:29 2006
Author:
Brian
Message:

First draft of script to merge databases together on to the server.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/client/Install Web Server Columns.py

    r91 r174  
    1   # Install Server Columns  
    2   # Copyright 2005, 2006 by Brian C. Christensen  
    3    
    4   # Note: The fonts used in this script are larger than in GanttPV. To reduce font  
    5   #       size to more closely match GanttPV, change the "font-size" lines below.  
    6    
    7   #    This file is part of GanttPV.  
    8   #  
    9   #    GanttPV is free software; you can redistribute it and/or modify  
    10   #    it under the terms of the GNU General Public License as published by  
    11   #    the Free Software Foundation; either version 2 of the License, or  
    12   #    (at your option) any later version.  
    13   #  
    14   #    GanttPV is distributed in the hope that it will be useful,  
    15   #    but WITHOUT ANY WARRANTY; without even the implied warranty of  
    16   #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
    17   #    GNU General Public License for more details.  
    18   #  
    19   #    You should have received a copy of the GNU General Public License  
    20   #    along with GanttPV; if not, write to the Free Software  
    21   #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    22    
    23   # 060406 - first draft of program  
    24    
    25   debug = 1  
    26    
    27   def DoAdd():  
    28       # Specified all required Report Types and Column Types  
    29       # It will either add them or update them if they already exist.  
    30    
    31   #    rt = { 'Name': 'Resource', 'TableA': 'Resource', 'TableB': None, 'Also': None, 'AllOrEach': 'both' }   
    32       rt = { 'Name': 'Resource' }   
    33       ct = [  
    34       { 'Name': 'WebEditKey', 'Label': 'Web Edit\nKey', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 60  },  
    35           ]  
    36       Data.AddReportType(rt, ct)  
    37    
    38       rt = { 'Name': 'Project/Report' }   
    39       ct = [  
    40       { 'Name': 'Web', 'Label': 'Web', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 40  },  
    41       { 'Name': 'WebOffset', 'Label': 'Web\nOffset', 'DataType': 'i', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 60  },  
    42       { 'Name': 'WebStartDate', 'Label': 'Web Start\nDate', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 80  },  
    43       { 'Name': '????Filter', 'Label': '???\nFilter', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 80  },  
    44           ]  
    45       Data.AddReportType(rt, ct)  
    46    
    47   #    rt = { 'Name': 'Report/ReportColumn' }   
    48   #    ct = [  
    49   #    { 'Name': 'WebEditDateRule', 'Label': 'Web Edit\nDate Rule', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 60  },  
    50   #        ]  
    51   #    Data.AddReportType(rt, ct)  
    52    
    53       Data.SetUndo("Install Web Server Columns")  
    54    
    55   DoAdd()  
      1 # Install Server Columns  
      2 # Copyright 2005, 2006 by Brian C. Christensen  
      3  
      4 # Note: The fonts used in this script are larger than in GanttPV. To reduce font  
      5 #       size to more closely match GanttPV, change the "font-size" lines below.  
      6  
      7 #    This file is part of GanttPV.  
      8 #  
      9 #    GanttPV is free software; you can redistribute it and/or modify  
      10 #    it under the terms of the GNU General Public License as published by  
      11 #    the Free Software Foundation; either version 2 of the License, or  
      12 #    (at your option) any later version.  
      13 #  
      14 #    GanttPV is distributed in the hope that it will be useful,  
      15 #    but WITHOUT ANY WARRANTY; without even the implied warranty of  
      16 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
      17 #    GNU General Public License for more details.  
      18 #  
      19 #    You should have received a copy of the GNU General Public License  
      20 #    along with GanttPV; if not, write to the Free Software  
      21 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
      22  
      23 # 060406 - first draft of program  
      24  
      25 debug = 1  
      26  
      27 def DoAdd():  
      28     # Specified all required Report Types and Column Types  
      29     # It will either add them or update them if they already exist.  
      30  
      31 #    rt = { 'Name': 'Resource', 'TableA': 'Resource', 'TableB': None, 'Also': None, 'AllOrEach': 'both' }   
      32     rt = { 'Name': 'Resource' }   
      33     ct = [  
      34     { 'Name': 'WebEditKey', 'Label': 'Web Edit\nKey', 'DataType': 't', 'AccessType': 'd', 'T': 'A', 'Edit': True, 'Width': 60  },  
      35         ]  
      36     Data.AddReportType(rt, ct)  
      37  
      38     rt = { 'Name': 'Project/Report' }   
      39     ct = [  
      40     { 'Name': 'Web', 'Label': 'Web', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 40  },  
      41     { 'Name': 'WebOffset', 'Label': 'Web\nOffset', 'DataType': 'i', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 60  },  
      42     { 'Name': 'WebStartDate', 'Label': 'Web Start\nDate', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 80  },  
      43     { 'Name': '????Filter', 'Label': '???\nFilter', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 80  },  
      44         ]  
      45     Data.AddReportType(rt, ct)  
      46  
      47 #    rt = { 'Name': 'Report/ReportColumn' }   
      48 #    ct = [  
      49 #    { 'Name': 'WebEditDateRule', 'Label': 'Web Edit\nDate Rule', 'DataType': 't', 'AccessType': 'd', 'T': 'B', 'Edit': True, 'Width': 60  },  
      50 #        ]  
      51 #    Data.AddReportType(rt, ct)  
      52  
      53     Data.SetUndo("Install Web Server Columns")  
      54  
      55 DoAdd()  
  • server/trunk/update/client/Set Web Edit Date Rule.py

    r91 r174  
    1   #!/usr/bin/env python  
    2    
    3   # Edit Column Options  
    4   # Copyright 2004 by Brian C. Christensen  
    5    
    6   #    This file is part of GanttPV.  
    7   #  
    8   #    GanttPV is free software; you can redistribute it and/or modify  
    9   #    it under the terms of the GNU General Public License as published by  
    10   #    the Free Software Foundation; either version 2 of the License, or  
    11   #    (at your option) any later version.  
    12   #  
    13   #    GanttPV is distributed in the hope that it will be useful,  
    14   #    but WITHOUT ANY WARRANTY; without even the implied warranty of  
    15   #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
    16   #    GNU General Public License for more details.  
    17   #  
    18   #    You should have received a copy of the GNU General Public License  
    19   #    along with GanttPV; if not, write to the Free Software  
    20   #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    21    
    22   # 040715 - first version of this script  
    23   # 040902 - added edit for column label  
    24   # 050912 - Alex - get the column list from GanttReport  
    25    
    26   def UpdateColumn(self):  
    27       sel = self.Report.GetSelectedCols()  # current selection  
    28       if not sel: return  # must select a column  
    29    
    30       columns = self.Report.table.columns  # map selection to column id  
    31       s = sel[0]  
    32       cid = columns[s]  
    33    
    34       sel_cids = [columns[s] for s in sel]  
    35       if sel_cids.count(cid) != len(sel_cids): return  
    36           # only one report column allowed  
    37    
    38       c = Data.Database['ReportColumn'][cid]  
    39       ctid = c.get('ColumnTypeID')  
    40       # ct = Data.Database['ColumnType'][ctid]  
    41    
    42       oldvalue = c.get('WebEditDateRule') or ""  
    43       msg = 'Specify rule for which time scale dates should be editable'  
    44       dlg = wx.TextEntryDialog(None, msg, 'Edit Column Label', oldvalue)  
    45       dlg.SetValue(oldvalue)  
    46       if dlg.ShowModal() == wx.ID_OK:  
    47           newvalue = dlg.GetValue()  
    48           if newvalue != oldvalue:  
    49               change = {'Table': 'ReportColumn', 'ID': cid, 'WebEditDateRule': newvalue}  
    50               Data.Update(change)  
    51               Data.SetUndo('Edit Column Date Rule')  
    52       dlg.Destroy()  
    53    
    54   UpdateColumn(self)  
      1 #!/usr/bin/env python  
      2  
      3 # Edit Column Options  
      4 # Copyright 2004 by Brian C. Christensen  
      5  
      6 #    This file is part of GanttPV.  
      7 #  
      8 #    GanttPV is free software; you can redistribute it and/or modify  
      9 #    it under the terms of the GNU General Public License as published by  
      10 #    the Free Software Foundation; either version 2 of the License, or  
      11 #    (at your option) any later version.  
      12 #  
      13 #    GanttPV is distributed in the hope that it will be useful,  
      14 #    but WITHOUT ANY WARRANTY; without even the implied warranty of  
      15 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
      16 #    GNU General Public License for more details.  
      17 #  
      18 #    You should have received a copy of the GNU General Public License  
      19 #    along with GanttPV; if not, write to the Free Software  
      20 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
      21  
      22 # 040715 - first version of this script  
      23 # 040902 - added edit for column label  
      24 # 050912 - Alex - get the column list from GanttReport  
      25  
      26 def UpdateColumn(self):  
      27     sel = self.Report.GetSelectedCols()  # current selection  
      28     if not sel: return  # must select a column  
      29  
      30     columns = self.Report.table.columns  # map selection to column id  
      31     s = sel[0]  
      32     cid = columns[s]  
      33  
      34     sel_cids = [columns[s] for s in sel]  
      35     if sel_cids.count(cid) != len(sel_cids): return  
      36         # only one report column allowed  
      37  
      38     c = Data.Database['ReportColumn'][cid]  
      39     ctid = c.get('ColumnTypeID')  
      40     # ct = Data.Database['ColumnType'][ctid]  
      41  
      42     oldvalue = c.get('WebEditDateRule') or ""  
      43     msg = 'Specify rule for which time scale dates should be editable'  
      44     dlg = wx.TextEntryDialog(None, msg, 'Edit Column Label', oldvalue)  
      45     dlg.SetValue(oldvalue)  
      46     if dlg.ShowModal() == wx.ID_OK:  
      47         newvalue = dlg.GetValue()  
      48         if newvalue != oldvalue:  
      49             change = {'Table': 'ReportColumn', 'ID': cid, 'WebEditDateRule': newvalue}  
      50             Data.Update(change)  
      51             Data.SetUndo('Edit Column Date Rule')  
      52     dlg.Destroy()  
      53  
      54 UpdateColumn(self)