Changeset 5266


Ignore:
Timestamp:
Feb 14, 2009, 3:41:41 PM (15 years ago)
Author:
Takanori Suzuki
Message:

[workfloweditor]Ver1.0 Release

Location:
workfloweditorplugin/0.11
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • workfloweditorplugin/0.11/.settings/org.eclipse.core.resources.prefs

    r5239 r5266  
    1 #Mon Feb 09 00:04:30 JST 2009
     1#Sat Feb 14 23:25:00 JST 2009
    22eclipse.preferences.version=1
    33encoding//customworkflow/templates/customworkflow_admin.html=UTF-8
    44encoding//customworkflow/templates/customworkflow_admin_ja.html=UTF-8
     5encoding//workfloweditor/htdocs/js/workfloweditor-locale-ja.js=UTF-8
    56encoding//workfloweditor/htdocs/js/workfloweditor.js=UTF-8
    67encoding/<project>=UTF-8
  • workfloweditorplugin/0.11/setup.py

    r5239 r5266  
    66setup(
    77    name = 'WorkflowEditorPlugin',
    8     version = '1.0beta',
     8    version = '1.0',
    99    description = "Edit Ticket Workflow",
    1010    url = "http://trac-hacks.org/wiki/WorkflowEditorPlugin",
  • workfloweditorplugin/0.11/workfloweditor/api.py

    r5243 r5266  
    22
    33from os import environ
    4 from trac.core import Component
    54
    6 class LocaleUtil(Component):
     5class LocaleUtil:
    76   
    87    def get_locale(self, req):
    9         """Get client locale from the http request.
    10         """
     8        """Get client locale from the http request."""
    119       
    1210        locale = None
     
    1412        if (len(locale_array) > 0):
    1513            locale = locale_array[0].strip()
    16            
     14       
     15        if (len(locale) > 2):
     16            locale = locale[0:2];
     17       
    1718        return locale
  • workfloweditorplugin/0.11/workfloweditor/htdocs/js/workfloweditor.js

    r5243 r5266  
    22if (!workfloweditor) workfloweditor = {};
    33
     4/**
     5 * i18n
     6 */
     7workfloweditor.Localizer = function() {
     8    this.strings = {};
     9    this.lang = "";
     10   
     11    var htmlTag = document.getElementsByTagName("html")[0];
     12    this.lang = htmlTag.getAttribute("xml:lang") || htmlTag.getAttribute("lang");
     13   
     14    // If there isn't the lang attribute, use browser language.
     15    if (this.lang == null || this.lang == "") {
     16        var currentLanguage;
     17        if (navigator.browserLanguage) {
     18            currentLanguage = navigator.browserLanguage;
     19        } else if (navigator.language) {
     20            currentLanguage = navigator.language;
     21        } else if (navigator.userLanguage) {
     22            currentLanguage = navigator.userLanguage;
     23        }
     24       
     25        if (currentLanguage && currentLanguage.length >= 2) {
     26            this.lang = currentLanguage.substr(0,2);
     27        }
     28    }
     29   
     30    var self = this;
     31    this.getLocalizedString = function(str) {
     32        if (!workfloweditor.Localizer.strings)
     33        {
     34            return str;
     35        }
     36       
     37        var message = workfloweditor.Localizer.strings[str];
     38        if (!message || message == "") {
     39            message = str;
     40        }
     41        return message;
     42    };
     43   
     44    return this;
     45}
     46
     47workfloweditor.Localizer = new workfloweditor.Localizer();
     48_ = workfloweditor.Localizer.getLocalizedString;
     49
     50/**
     51 * Workflow Editor onload action.
     52 */
    453jQuery(document).ready(function(){
    554    var context = new workfloweditor.WorkflowContext();
     
    3483    // The workflow is updated before saving.
    3584    jQuery("#doChanges").click( function() {
    36         if (currentTab = "gridTab") {
     85        try
     86        {
     87            if (currentTab == "textTab") {
     88                context.updateModelByText("#workflowText");
     89                context.refreshGrid();           
     90            }
     91           
    3792            context.updateModelByGrid("#workflowGrid");
    3893            context.refreshText();
     94        }
     95        catch(ex)
     96        {
     97            alert(_("Error: Please fix the workflow text.")
     98                  + "\n(error code = " + ex.number + ")");
     99            return false;
    39100        }
    40101    });
     
    50111    this.DEFAULT_OPERATIONS = {
    51112                               ""                  : "",
    52                                "set_owner"         : "担当者を設定",
    53                                "del_owner"         : "担当者を削除",
    54                                "set_owner_to_self" : "自分を担当者に設定",
    55                                "set_resolution"    : "解決方法を設定",
    56                                "del_resolution"    : "解決方法を削除",
    57                                "leave_status"      : "ステータス表示のみ"
     113                               "set_owner"         : _("set owner"),
     114                               "del_owner"         : _("del owner"),
     115                               "set_owner_to_self" : _("set owner to self"),
     116                               "set_resolution"    : _("set resolution"),
     117                               "del_resolution"    : _("del resolution"),
     118                               "leave_status"      : _("leave status")
    58119                              };
    59120    this.DEFAULT_PERMISSIONS = {
     
    362423                );
    363424            } else {
    364                 alert("行を選択してください");
     425                alert(_("Please select row."));
    365426            }
    366427        });
     
    381442                );
    382443            } else {
    383                 alert("行を選択してください");
     444                alert(_("Please select row."));
    384445            }
    385446        });
     
    394455 */
    395456workfloweditor.WorkflowContext.prototype.createGridColNames = function() {
    396     var colNames = ['操作', '表示名', '処理', '権限', '順序', '次のステータス', ''];
     457    var colNames = [_('action'), _('name'), _('operation'), _('permission'), _('order'), _('next status'), ''];
    397458    colNames = colNames.concat(this.status);
    398459   
     
    531592        height      : 0,
    532593        width       : 0,
    533         colNames    : ["ステータス"],
     594        colNames    : [_("status")],
    534595        colModel    : [{
    535596                        name:'editableStatus', index:'status', width:100, editable:true,
  • workfloweditorplugin/0.11/workfloweditor/templates/workfloweditor_admin.html

    r5146 r5266  
    1818  <fieldset>
    1919    <legend>Workflow Configuration</legend>
    20     <div class="field">
    21       <textarea name="workflow_config" rows="25" cols="100" wrap="off">${template.workflow_config}</textarea>
    22       <br />
    23       <br />
    24       <div>How to set the workflow: <a href="${href.wiki('TracWorkflow')}">TracWorkflow</a></div>
     20    <br />
     21    <div id="workflowTabs" style="display:none;">
     22      <ul>
     23        <li><a href="#gridTab"><span>Grid</span></a></li>
     24        <li><a href="#textTab"><span>Text</span></a></li>
     25      </ul>
     26      <div id="gridTab">
     27        <table id="workflowStatusGrid" class="scroll" cellpadding="0" cellspacing="0"></table>
     28        <table id="workflowGrid" class="scroll" cellpadding="0" cellspacing="0"></table>
     29        <br />
     30        <ul>
     31          <li>If you edit the action, please click 'Add', 'Change' or 'Delete' button.</li>
     32          <li>If you edit the status, please click 'Edit status' button.</li>
     33        </ul>
     34        <input type="button" id="workflowGridItemAdd" value="Add" />
     35        <input type="button" id="workflowGridItemMod" value="Change" />
     36        <input type="button" id="workflowGridItemDel" value="Delete" />
     37        &nbsp;&nbsp;&nbsp;&nbsp;
     38        <input type="button" id="workflowStatusGridItemMod" value="Edit status" />
     39      </div>
     40      <div id="textTab">
     41        <textarea id="workflowText" name="workflow_config" rows="20" cols="100" wrap="off">${template.workflow_config}</textarea>
     42      </div>
    2543    </div>
     44    <br />
     45    <div>How to set the workflow: <a href="${href.wiki('TracWorkflow')}">TracWorkflow</a></div>
    2646  </fieldset>
     47
    2748  <div class="buttons">
    28     <input type="submit" value="Apply changes" />
     49    <input id="doChanges" type="submit" value="Apply changes" />
    2950  </div>
    3051</form>
  • workfloweditorplugin/0.11/workfloweditor/templates/workfloweditor_admin_ja.html

    r5239 r5266  
    2828        <table id="workflowGrid" class="scroll" cellpadding="0" cellspacing="0"></table>
    2929        <br />
     30        <ul>
     31          <li>操作を編集する場合は、「追加」「変更」「削除」ボタンをしてください。</li>
     32          <li>ステータスを編集する場合は、「ステータスの編集」ボタンを押下してください。</li>
     33        </ul>
    3034        <input type="button" id="workflowGridItemAdd" value="追加" />
    3135        <input type="button" id="workflowGridItemMod" value="変更" />
  • workfloweditorplugin/0.11/workfloweditor/workfloweditor_admin.py

    r5243 r5266  
    3030        if req.perm.has_permission('TRAC_ADMIN'):
    3131            # localization
    32             locale = LocaleUtil(self.env).get_locale(req)
    33             if locale in ['ja', 'ja-JP']:
     32            locale = LocaleUtil().get_locale(req)
     33            if (locale == 'ja'):
    3434                yield ('ticket', u'チケットシステム', 'workfloweditor', u'ワークフロー')
    3535            else:
     
    5858       
    5959        # localization
    60         locale = LocaleUtil(self.env).get_locale(req)
    61         if locale in ['ja', 'ja-JP']:
     60        locale = LocaleUtil().get_locale(req)
     61        if (locale == 'ja'):
     62            add_script(req, 'workfloweditor/js/workfloweditor-locale-ja.js')
    6263            page_template = 'workfloweditor_admin_ja.html'
    6364        else:
     
    107108       
    108109        # localization
    109         locale = LocaleUtil(self.env).get_locale(req)
    110         if locale in ['ja', 'ja-JP']:
     110        locale = LocaleUtil().get_locale(req)
     111        if (locale == 'ja'):
    111112            init_file = 'trac_jp.ini'
    112113        else:
Note: See TracChangeset for help on using the changeset viewer.