aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt2
-rw-r--r--video.module40
2 files changed, 33 insertions, 9 deletions
diff --git a/TODO.txt b/TODO.txt
index f3e4063..501b8a5 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,8 +1,6 @@
TODO LIST (in order of importance)
-----------
-- Write more documentation (help)
- for this module
- Figure out how to make Windows Media
files play with relative URL in addition
to a fully qualified one
diff --git a/video.module b/video.module
index c07defd..8de1995 100644
--- a/video.module
+++ b/video.module
@@ -334,18 +334,44 @@ function video_delete(&$node) {
}
/**
- * Hook to see if a video exists already or not
+ * Hook to see if every video field has been submitted
+ * and contains a valid value.
*
* @param $node
* object
*/
function video_validate(&$node) {
- $result = db_query("SELECT * from {video} WHERE vidfile = '%s' and nid <> '%d'", $node->vidfile, $node->nid);
- if (db_num_rows($result) > 0) {
- $video = db_fetch_object($result);
- $othernode = node_load(array('nid' => $video->nid));
- form_set_error('video', t('A video %link-to-existing using that link already exists', array("%link-to-existing" => l($othernode->title, 'node/' . $othernode->nid . '/edit'))));
+ //control needed fields
+ if(isset($node->vidfile)) {
+ if($node->vidfile == '') {
+ form_set_error('vidfile', t('You have to insert a valid file path for this video'));
+ }
+ else {
+ //let's see if we have it yet
+ $result = db_query("SELECT * from {video} WHERE vidfile = '%s' and nid <> '%d'", $node->vidfile, $node->nid);
+ if (db_num_rows($result) > 0) {
+ $video = db_fetch_object($result);
+ $othernode = node_load(array('nid' => $video->nid));
+ form_set_error('vidfile', t('A video %link-to-existing using that link already exists', array("%link-to-existing" => l($othernode->title, 'node/' . $othernode->nid . '/edit'))));
+ }
+ }
+ }
+
+ if(isset($node->videox) && $node->videox <= 0) {
+ form_set_error('videox', t('You have to insert a valid horizontal pixel size for this video'));
+ }
+ if(isset($node->videoy) && $node->videoy <= 0) {
+ form_set_error('videoy', t('You have to insert a valid vertical pixel size for this video'));
+ }
+ if(isset($node->size) && $node->size <= 0) {
+ form_set_error('videoy', t('You have to insert a valid file size for this video'));
}
+/* this doesn't work.. maybe someone can get it work..
+ if((isset($node->playtime_minutes) && $node->playtime_minutes <= 0) || (isset($node->playtime_hours) && $node->playtime_hours <= 0) || (isset($node->playtime_seconds) && $node->playtime_seconds <= 0)) {
+ form_set_error('playtime_seconds', t('You have to insert valid playtime informations for this video'));
+ }
+*/
+
}
/**
@@ -575,7 +601,7 @@ function video_play() {
/**
* Themeable functions for playing videos.
- * It prints a page with a quicktime player inside
+ * It prints a page with a player embedded
* linked to the file record of the node.
*/