diff --git a/httpd/fx/app/controllers/fx_controller.kc3 b/httpd/fx/app/controllers/fx_controller.kc3
index 7001d26..133f986 100644
--- a/httpd/fx/app/controllers/fx_controller.kc3
+++ b/httpd/fx/app/controllers/fx_controller.kc3
@@ -100,7 +100,7 @@ defmodule FXController do
}
def tag_create = fn (path, tag) {
- Fx.tag_create(
+ Fx.tag_add(path, tag)
body = """
<html>
<head>
diff --git a/httpd/fx/app/models/fx.kc3 b/httpd/fx/app/models/fx.kc3
index df936f6..2a77711 100644
--- a/httpd/fx/app/models/fx.kc3
+++ b/httpd/fx/app/models/fx.kc3
@@ -1,4 +1,4 @@
-defmodule Fx
+defmodule Fx do
def db = Facts.database()
@@ -8,4 +8,12 @@ defmodule Fx
})
}
-
+ def tag_add = fn (path, tag) {
+ Facts.add_tags(db, path, :tag, tag)
+ }
+
+ def tag_remove = fn (path, tag) {
+ Facts.remove_tags(db, path, :tag, tag)
+ }
+
+end
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index 0f87a9d..8ce0170 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -14,27 +14,9 @@ defmodule HTTPd do
require Str
require URL
- def load_directory = fn (dir) {
- if File.exists?(dir) && File.is_directory?(dir) do
- files = File.list(dir)
- List.each(files, fn (file) {
- if (! Str.starts_with?(file, ".") &&
- ! Str.ends_with?(file, "~")) do
- path = dir + file
- if File.is_directory?(path) do
- load_directory(path + "/")
- else
- load(path)
- end
- end
- })
- end
- }
-
def load_app = fn () {
HTTP.mime_type_load("config/mime.types")
- load_directory("app/views/")
- load_directory("app/controllers/")
+ load_directory("app/")
if (File.exists?("config/routes.kc3")) do
load("config/routes.kc3")
end
diff --git a/lib/kc3/0.1/kc3.facts b/lib/kc3/0.1/kc3.facts
index ae7cac1..d5a28d6 100644
--- a/lib/kc3/0.1/kc3.facts
+++ b/lib/kc3/0.1/kc3.facts
@@ -337,3 +337,21 @@ replace {KC3.human_size, :symbol_value, fn (size) {
end
end
}}
+add {KC3, :symbol, KC3.load_directory}
+replace {KC3.load_directory, :symbol_value, fn (dir) {
+ if File.exists?(dir) && File.is_directory?(dir) do
+ files = File.list(dir)
+ List.each(files, fn (file) {
+ if (! Str.starts_with?(file, ".")) do
+ path = dir + file
+ if File.is_directory?(path) do
+ load_directory(path + "/")
+ else
+ if Str.ends_with?(path, ".kc3") do
+ load(path)
+ end
+ end
+ end
+ })
+ end
+}}