summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2011-04-20 13:53:21 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2011-04-20 13:53:21 +0200
commit23c56a5a7fb990e7126c0d246463898f427c6ed7 (patch)
tree860c3c281e75da8580041092787ba7f46ddca3b5
downloadalpine_drupal_settings-23c56a5a7fb990e7126c0d246463898f427c6ed7.tar.bz2
alpine_drupal_settings-23c56a5a7fb990e7126c0d246463898f427c6ed7.tar.xz
Initial import
-rw-r--r--.gitignore1
-rw-r--r--alpinelinux.info5
-rw-r--r--alpinelinux.module77
-rw-r--r--nbproject/project.properties7
-rw-r--r--nbproject/project.xml9
5 files changed, 99 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..14bc68c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/ \ No newline at end of file
diff --git a/alpinelinux.info b/alpinelinux.info
new file mode 100644
index 0000000..7bb9841
--- /dev/null
+++ b/alpinelinux.info
@@ -0,0 +1,5 @@
+name = "Alpine Linux"
+description = "Alpine Linux extra website functions"
+version = "7.x-1.0"
+core = "7.x"
+configure = "admin/config/alpinelinux/settings"
diff --git a/alpinelinux.module b/alpinelinux.module
new file mode 100644
index 0000000..1c12e24
--- /dev/null
+++ b/alpinelinux.module
@@ -0,0 +1,77 @@
+<?php
+
+function alpinelinux_menu() {
+ $items['admin/config/alpinelinux'] = array(
+ 'title' => 'Alpine Linux settings',
+ 'description' => 'Configure Alpine Linux settings',
+ 'page callback' => 'system_admin_menu_block_page',
+ 'access arguments' => array('admin alpinelinux'),
+ //system_admin_menu_block_page needs admin inc
+ 'file' => 'system.admin.inc',
+ 'file path' => drupal_get_path('module', 'system'),
+ );
+
+ $items['admin/config/alpinelinux/settings'] = array(
+ 'title' => 'Settings',
+ 'description' => 'Configure Alpine Linux settings',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('apk_browser_settings'),
+ 'access arguments' => array('admin alpinelinux'),
+ );
+ $items['wiki'] = array(
+ 'page callback' => 'alpinelinux_wiki_redirect',
+ 'access callback' => TRUE,
+ 'type' => MENU_LOCAL_TASK
+ );
+ return $items;
+}
+
+function alpinelinux_permission() {
+ return array(
+ 'admin alpinelinux' => array(
+ 'title' => t('Administer Alpine Linux settings'),
+ 'description' => t('Access permissions for Alpine Linux settings'),
+ ),
+ );
+}
+
+function alpinelinux_cron() {
+ alpinelinux_latest_releases();
+}
+
+function apk_browser_settings($form) {
+ $form['settings'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Alpine Linux settings'),
+ );
+ $form['settings']['alpinelinux_latest_link'] = array(
+ '#type' => 'textfield',
+ '#title' => t('URL to latest releases file'),
+ '#description' => t('A test file which holds information about Alpine Linux latests ISO\'s'),
+ '#default_value' => variable_get('alpinelinux_latest_link', '')
+ );
+ return system_settings_form($form);
+}
+
+function alpinelinux_latest_releases() {
+ $latest = variable_get('alpinelinux_latest_link', '');
+ $latest = file($latest);
+ if ($latest) {
+ foreach ($latest as $key => $line) {
+ $result[$key] = explode(" ", $line);
+ }
+ variable_set('alpinelinux_releases', $result);
+ $releases = variable_get('alpinelinux_releases', array());
+ print_r($releases);
+ } else {
+ watchdog('alpine', 'Failed to get latest alpine release information', array(), WATCHDOG_WARNING, NULL);
+ }
+}
+
+function alpinelinux_wiki_redirect() {
+ $wiki_url = 'http://wiki.alpinelinux.org/wiki/';
+ if (arg(0) == 'wiki') {
+ $url = (arg(1)) ? $wiki_url . arg(1) : $wiki_url;
+ drupal_goto($url);
+ }
+}
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..25f05c9
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_53
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=true
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..fdec8d3
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.php.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/php-project/1">
+ <name>alpine_drupal_settings</name>
+ </data>
+ </configuration>
+</project>