Exemple #1
0
def send_feedback():
    """
    This function will collect basic non-critical data about the current server
    instance and send it to eve-corp-management.org official server for usage
    statistics feedback.
    """
    LOG.debug("Sending usage feedback to %r...", ECM_USAGE_FEEDBACK_URL)

    mycorp = Corporation.objects.mine()

    # fetch geolocalization info
    http_client = HttpClient()
    resp = http_client.get(url="http://freegeoip.net/json/")
    geoloc_info = json.loads(resp.read())
    resp.close()

    # we only consider users that are corp members
    users = get_members_group().user_set.order_by("-last_login")

    usage_data = {
        "key_fingerprint": mycorp.key_fingerprint,
        "active_user_count": users.count(),
        "avg_last_visit_top10": avg_last_login(users[:10]),
        "avg_last_visit": avg_last_login(users),
        "first_installed": find_oldest_entry(),
        "country_code": geoloc_info.get("country_code"),
        "country_name": geoloc_info.get("country_name"),
        "city": geoloc_info.get("city"),
        "ecm_version": ecm.VERSION,
    }

    # send the data to the server
    resp = http_client.post(ECM_USAGE_FEEDBACK_URL, json.dumps(usage_data))
    LOG.info("Usage feedback sent to %r. Thank you for your contribution.", ECM_USAGE_FEEDBACK_URL)

    new_version = resp.read().strip()
    old_version = ecm.VERSION

    if parse_version(new_version) > parse_version(old_version):
        LOG.info("New version of ecm is available: %r.", new_version)

        ctx_dict = {
            "host_name": settings.EXTERNAL_HOST_NAME,
            "use_https": settings.USE_HTTPS,
            "new_version": new_version,
            "old_version": old_version,
        }

        dummy_request = HttpRequest()
        dummy_request.user = AnonymousUser()

        subject = tr_lazy("ECM version %s is available" % new_version)
        msg = render_to_string("ecm/common/email/new_version.txt", ctx_dict, Ctx(dummy_request))
        html = render_to_string("ecm/common/email/new_version.html", ctx_dict, Ctx(dummy_request))

        mail_admins(subject=subject, message=msg, html_message=html)
Exemple #2
0
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'assets'
VERSION = '2.0'

DEPENDS_ON = {
    'ecm': '2.0',
}

MENUS = [
    {
        'title': tr_lazy('Assets'),
        'url': '',
        'items': [
            {
                'title': tr_lazy('Changes'),
                'url': 'changes/',
                'items': []
            },
        ]
    },
]

TASKS = [
    {
        'function': 'ecm.plugins.assets.tasks.assets.update',
        'priority': 0,
Exemple #3
0
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'accounting'
VERSION = '2.0'

DEPENDS_ON = {
    'ecm': '2.0',
}

MENUS = [
    {
        'title':
        tr_lazy('Accounting'),
        'url':
        '',
        'items': [
            {
                'title': tr_lazy('Wallets Journal'),
                'url': 'journal/',
                'items': []
            },
            {
                'title': tr_lazy('Wallets Transactions'),
                'url': 'transactions/',
                'items': []
            },
            {
                'title': tr_lazy('Tax Contributions'),
Exemple #4
0
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'op'

DEPENDS_ON = {
    'ecm' : '2.1',
}

MENUS = [
     {'title': tr_lazy('Fleet Ops'),    'url': '',      'items': [
     {'title': tr_lazy('Timers'), 'url': 'timers/', 'items': []},
     ]},
]

TASKS = [
    {
        'function' : 'ecm.plugins.op.tasks.op.update',
        'priority' : 100,
        'frequency' : 6,
        'frequency_units' : 3600, # hour
    },
]

URL_PERMISSIONS = [
    r'^/op/.*$',
Exemple #5
0
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

__date__ = "2011 8 17"
__author__ = "diabeteman"

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'industry'
VERSION = '1.0'

DEPENDS_ON = {
    'ecm' : '2.0',
}

MENUS = [
    {'title': tr_lazy('Industry'),    'url': '',      'items': [
        {'title': tr_lazy('Orders'), 'url': 'orders/', 'items': []},
        {'title': tr_lazy('Jobs'), 'url': 'jobs/', 'items': []},
        {'title': tr_lazy('Catalog'), 'url': 'catalog/', 'items': [
            {'title': tr_lazy('Items'),         'url': 'catalog/items/'},
            {'title': tr_lazy('Supplies'),      'url': 'catalog/supplies/'},
            {'title': tr_lazy('Blueprints'),    'url': 'catalog/blueprints/'},
        ]},
    ]},
]

TASKS = [
    {
        'function' : 'ecm.plugins.industry.tasks.industry.update_supply_prices',
        'priority' : 0,
        'frequency' : 1,
Exemple #6
0
# option) any later version.
#
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

__date__ = "2011 11 12"
__author__ = "diabeteman"

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'shop'

DEPENDS_ON = {
    'ecm.plugins.industry' : '1.0',
}

MENUS = [
    {'title': tr_lazy('Shop'),    'url': '',      'items': []},
]

TASKS = []

URL_PERMISSIONS = [
    r'^/shop/.*$',
]
Exemple #7
0
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'pos'

DEPENDS_ON = {
    'ecm' : '2.0',
}

MENUS = [
     {'title': tr_lazy('POS'),    'url': '',      'items': [
        {'title': tr_lazy('Fuel Summary'), 'url': 'fuel_summary/', 'items': []},
     ]},
]

TASKS = [
    {
        'function' : 'ecm.plugins.pos.tasks.pos.update',
        'priority' : 100,
        'frequency' : 6,
        'frequency_units' : 3600, # hour
    },
]

URL_PERMISSIONS = [
    r'^/pos/.*$',
Exemple #8
0
#
# You should have received a copy of the GNU General Public License along with
# csv-plugin. If not, see <http://www.gnu.org/licenses/>.

__date__ = "2014-05-20"
__author__ = "vittoros"

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'csv'
VERSION = '1.0'

DEPENDS_ON = {
    'ecm' : '2.0',
    'ecm.plugins.assets' : '2.0',
}

MENUS = [
    {'title': tr_lazy('CSV'),    'url': '',      'items': [
    ]},
]

URL_PERMISSIONS = [
    r'^/csv/.*$',
]

SETTINGS = {
}


Exemple #9
0
# option) any later version.
#
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.
from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'scheduler'

MENUS = [
    {
        'title': tr_lazy('Scheduled Tasks'),
        'url': 'tasks/',
        'items': []
    },
]

URL_PERMISSIONS = [
    r'^/scheduler/.*$',
]

TASKS = [
    {
        'function': 'ecm.apps.scheduler.tasks.garbage.collect_garbage',
        'priority': 0,
        'frequency': 7,
        'frequency_units': 60 * 60 * 24,  # day
Exemple #10
0
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.
from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'scheduler'

MENUS = [
    {'title': tr_lazy('Scheduled Tasks'), 'url': 'tasks/', 'items': []},
]

URL_PERMISSIONS = [
    r'^/scheduler/.*$',
]

TASKS = [
    {
        'function': 'ecm.apps.scheduler.tasks.garbage.collect_garbage',
        'priority': 0,
        'frequency': 7,
        'frequency_units': 60 * 60 * 24, # day
    },
]
Exemple #11
0
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'hr'

MENUS = [
    {
        'title':
        tr_lazy('Human Resources'),
        'url':
        '',
        'items': [
            {
                'title':
                tr_lazy('Members'),
                'url':
                'members/',
                'items': [
                    {
                        'title': tr_lazy('History'),
                        'url': 'members/history/'
                    },
                    {
                        'title': tr_lazy('Access Changes'),
Exemple #12
0
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'mail'

DEPENDS_ON = {
    'ecm' : '2.0',
}

MENUS = [
     {'title': tr_lazy('Mail'),    'url': '',      'items': []},
]

TASKS = [
    {
        'function': 'ecm.plugins.mail.tasks.mail.update',
        'priority': 50,
        'frequency': 6,
        'frequency_units': 3600, # hour
    }
]

URL_PERMISSIONS = [
    r'^/mail/.*$',
]
Exemple #13
0
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'corp'

MENUS = [
    {
        'title':
        tr_lazy('Corporation'),
        'url':
        '',
        'items': [
            {
                'title': tr_lazy('Standings'),
                'url': 'standings/',
                'items': [],
            },
        ]
    },
]

TASKS = [
    {
        'function': 'ecm.apps.corp.tasks.corp.update',
Exemple #14
0
# more details.
#
# You should have received a copy of the GNU General Public License along with
# stocks-plugin. If not, see <http://www.gnu.org/licenses/>.

__date__ = "2013-11-09"
__author__ = "vittoros"

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'stocks'
VERSION = '1.0'

DEPENDS_ON = {
    'ecm' : '2.0',
    'ecm.plugins.assets' : '2.0',
}

MENUS = [
    {'title': tr_lazy('Stocks'),    'url': '',      'items': [
    ]},
]

URL_PERMISSIONS = [
    r'^/stocks/.*$',
]

SETTINGS = {
}

Exemple #15
0
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.


from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'accounting'
VERSION = '2.0'

DEPENDS_ON = {
    'ecm' : '2.0',
}

MENUS = [
     {'title': tr_lazy('Accounting'),    'url': '',      'items': [
        {'title': tr_lazy('Wallets Journal'), 'url': 'journal/', 'items': []},
        {'title': tr_lazy('Wallets Transactions'), 'url': 'transactions/', 'items': []},
        {'title': tr_lazy('Tax Contributions'), 'url': 'contributions/', 'items': []},
        {'title': tr_lazy('Contracts'), 'url': 'contracts/', 'items': []},
        {'title': tr_lazy('Market Orders'), 'url': 'marketorders/', 'items': []},
        {'title': tr_lazy('Report'), 'url': 'report/', 'items': []},
    ]},
]

TASKS = [
    {
        'function' : 'ecm.plugins.accounting.tasks.reftypes.update',
        'priority' : 100,
        'frequency' : 7,
        'frequency_units' : 60 * 60 * 24, # day
Exemple #16
0
LOG = logging.getLogger(__name__)

# This table gives the association between the status of the POS
# and the related CSS class for display
POS_CSS_STATUS = {
    0: 'pos-unanchored',
    1: 'pos-offline',
    2: 'pos-onlining',
    3: 'pos-reinforced',
    4: 'pos-online',
}

#------------------------------------------------------------------------------
COLUMNS = [
    # Name              Tooltip                 db_field
    [tr_lazy('Location'),        tr_lazy('Location'),             'moon'],
    [tr_lazy('Name'),            tr_lazy('Name'),                 'custom_name'],
    [tr_lazy('Type'),            tr_lazy('Type'),                 'type_id'],
    [tr_lazy('Status'),          tr_lazy('Status'),               'state'],
    [tr_lazy('Next Cycle'),      tr_lazy('Next Cycle'),           'online_timestamp'],
    [tr_lazy('Fuel Blocks'),     tr_lazy('Fuel Blocks'),          None],
    [tr_lazy('Strontium'),       tr_lazy('Strontium Clathrates'), None],
    [tr_lazy('Name'),            None,                   None],
    ['hours_int',       None,                   None],
]
@check_user_access()
def poses(request):
    data = {
        'posViewMode' : 'List',
        'columns' : [ (col, title) for col, title, _ in COLUMNS ],
        'posCSSStatus' : json.dumps(POS_CSS_STATUS),
Exemple #17
0
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

__date__ = "2011 11 12"
__author__ = "diabeteman"

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'shop'

DEPENDS_ON = {
    'ecm.plugins.industry': '1.0',
}

MENUS = [
    {
        'title': tr_lazy('Shop'),
        'url': '',
        'items': []
    },
]

TASKS = []

URL_PERMISSIONS = [
    r'^/shop/.*$',
]
Exemple #18
0
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = 'mail'

DEPENDS_ON = {
    'ecm': '2.0',
}

MENUS = [
    {
        'title': tr_lazy('Mail'),
        'url': '',
        'items': []
    },
]

TASKS = [{
    'function': 'ecm.plugins.mail.tasks.mail.update',
    'priority': 50,
    'frequency': 6,
    'frequency_units': 3600,  # hour
}]

URL_PERMISSIONS = [
    r'^/mail/.*$',
]
Exemple #19
0
#
# EVE Corporation Management is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# EVE Corporation Management. If not, see <http://www.gnu.org/licenses/>.

from django.utils.translation import ugettext_lazy as tr_lazy

NAME = "corp"

MENUS = [
    {
        "title": tr_lazy("Corporation"),
        "url": "",
        "items": [{"title": tr_lazy("Standings"), "url": "standings/", "items": []}],
    }
]

TASKS = [
    {
        "function": "ecm.apps.corp.tasks.corp.update",
        "priority": 200,
        "frequency": 12,
        "frequency_units": 60 * 60,  # hour
    },
    {
        "function": "ecm.apps.corp.tasks.standings.update",
        "priority": 200,