Skip to content
Browse files

Add academic license (school, yog) to profile form. Adjust xml for th…

…ese to be simpler to use as well.
  • Loading branch information...
1 parent cf78f37 commit 6f2fd3ba49353357bcf25760232e9629e97c2b68 @eedeebee eedeebee committed
Showing with 31 additions and 12 deletions.
  1. +1 −0 css/screen.css
  2. +9 −0 js/functions.js
  3. +10 −12 lib/users.xqy
  4. +11 −0 view/tag-library.xsl
View
1 css/screen.css
@@ -2332,6 +2332,7 @@ a.drop-down-trigger.menu-open span {
}
#profile-form input[type=text], #profile-form input[type=password],
+#profile-form select,
#reset-form input[type=text],
#signup-form input[type=text], #signup-form input[type=password] {
border: 1px solid #CFCFCF;
View
9 js/functions.js
@@ -389,6 +389,15 @@ if(typeof jQuery != 'undefined') {
// e.preventDefault();
//});
+ var d = $('.yearpicker').attr('data-value');
+ var now = new Date().getFullYear();
+ for (i = now; i < now + 10 ; i++)
+ {
+ $('.yearpicker').append($('<option />').val(i).html(i));
+ }
+ $('.yearpicker').append($('<option />').html('N/A'));
+ $('.yearpicker').val(d);
+
// add new functions before this comment
View
22 lib/users.xqy
@@ -178,10 +178,10 @@ as element(*)?
let $type := if ($school) then "academic" else "express"
let $sch := if ($type eq 'express') then () else
- <school>
- <name>{$school}</name>
- <year-of-graduation>{$yog}</year-of-graduation>
- </school>
+ (
+ <school>{$school}</school>,
+ <yog>{$yog}</yog>
+ )
let $co := if ($type eq 'academic') then $school else $company
let $doc :=
@@ -242,15 +242,13 @@ declare function users:recordAcademicLicense($email, $school, $yog, $license-met
let $uri := base-uri($user)
let $name := $user/name/string()
let $doc := <person>
- { for $field in $user/* where not($field/local-name() = ('school')) return $field }
- <school>
- <name>{$school}</name>
- <year-of-graduation>{$yog}</year-of-graduation>
- </school>
+ { for $field in $user/* where not($field/local-name() = ('school', 'yog')) return $field }
+ <school>{$school}</school>
+ <yog>{$yog}</yog>
<license>
<type>academic</type>
<school>{$school}</school>
- <year-of-graduation>{$yog}</year-of-graduation>
+ <yog>{$yog}</yog>
<date>{fn:current-dateTime()}</date>
<licensee>{$name}</licensee>
{$license-metadata}
@@ -375,7 +373,7 @@ Username: ", $user/name/string(), "
Email: ", $user/email/string(), "
ID: ", $user/id/string(), "
Organization: ", $user/organization/string(), "
-School: ", $user/school/name/string())
+School: ", $user/school/string())
}
</em:content>
)
@@ -449,7 +447,7 @@ declare function users:saveProfile($user as element(*), $params as element(*)*)
(: todo: cheap secure by only storing first 10? :)
(: trim params from input to only the ones we support for now, todo: generate from/share with profile-form in tag-lib :)
- let $fields := ('organization', 'title', 'name', 'url', 'picture', 'location', 'country', 'twitter')
+ let $fields := ('organization', 'title', 'name', 'url', 'picture', 'location', 'country', 'twitter', 'school', 'yog')
let $params := for $p in $params where $p/@name = $fields return $p
let $doc := <person>
View
11 view/tag-library.xsl
@@ -1019,6 +1019,17 @@
<input class="" id="location" name="location" value="{$user/*:location/string()}" type="text"/>
</div>
</fieldset>
+ <h3>Educational background</h3>
+ <fieldset>
+ <div class="profile-form-row">
+ <div class="profile-form-label">School </div>
+ <input class="" id="school" name="school" value="{$user/*:school/string()}" type="text"/>
+ </div>
+ <div class="profile-form-row">
+ <div class="profile-form-label">Year of graduation </div>
+ <select class="yearpicker" id="yog" name="yog" data-value="{$user/*:yog/string()}"></select>
+ </div>
+ </fieldset>
</div>
</xsl:template>

0 comments on commit 6f2fd3b

Please sign in to comment.
Something went wrong with that request. Please try again.