From f2db386452db9475ca36291fa44c59ee7b043219 Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Tue, 11 Jun 2013 18:34:41 +0000 Subject: [PATCH] Initial commit --- css/customtheme.css | 75 +++++++++++++++++++ customtheme.js | 88 ++++++++++++++++++++++ images/search-button.png | Bin 0 -> 725 bytes logo.png | Bin 0 -> 3479 bytes mkdrusampletheme.info | 27 +++++++ pz2urlrecipe.js | 133 ++++++++++++++++++++++++++++++++++ template.php | 11 +++ templates/mkdru-block-facet.tpl.php | 1 + templates/mkdru-block-search.tpl.php | 4 + templates/mkdru-form.tpl.php | 19 +++++ templates/mkdru-results.tpl.php | 6 ++ 11 files changed, 364 insertions(+) create mode 100644 css/customtheme.css create mode 100644 customtheme.js create mode 100644 images/search-button.png create mode 100644 logo.png create mode 100644 mkdrusampletheme.info create mode 100644 pz2urlrecipe.js create mode 100644 template.php create mode 100644 templates/mkdru-block-facet.tpl.php create mode 100644 templates/mkdru-block-search.tpl.php create mode 100644 templates/mkdru-form.tpl.php create mode 100644 templates/mkdru-results.tpl.php diff --git a/css/customtheme.css b/css/customtheme.css new file mode 100644 index 0000000..9198573 --- /dev/null +++ b/css/customtheme.css @@ -0,0 +1,75 @@ +.mkdru-result-description { + font-size: 0.8em; +} + +.mkdru-above-below { + font-size: 0.9em; + border: 0; + padding: 0.25em; + font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,sans-serif; +} +.mkdru-above { + border-bottom: 1px solid #D6D6D6; +} +.mkdru-below { + border-top: 1px solid #D6D6D6; + text-align: center; +} + + +.mkdru-result { + padding: .8em 1em 1em 1em !important; + border-bottom: 3px solid #FFFFFF; +/* margin-top: 0 !important; */ +/* margin-bottom: 0 !important; */ +} +.mkdru-result.odd { + background-color: #f6f6f2; +} +.mkdru-result.even { + background-color: #ebebe7; +} +.mkdru-result div { + margin-top: 0; + margin-bottom: .3em; +} +.mkdru-result-author { + margin-left: 1em !important; +} +.mkdru-result-description { + font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,sans-serif; +} + + +.mkdru-search { + text-align: left; +} +.mkdru-search input[type='text'] { + width: 100%; +} +.mkdru-search input[type='submit'] { + margin-left: 12px; +} + + +.mkdru-facet { + font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,sans-serif; +} + + +.mkdru-block-search input.form-text { + margin-right: 5px; + width: 9.5em; +} +.mkdru-block-search input.form-submit { + background: url("../images/search-button.png") no-repeat scroll center top transparent; + border-color: #E4E4E4 #D2D2D2 #B4B4B4; + cursor: pointer; + height: 25px; + margin-left: 0; + margin-right: 0; + overflow: hidden; + padding: 0; + text-indent: -9999px; + width: 34px; +} \ No newline at end of file diff --git a/customtheme.js b/customtheme.js new file mode 100644 index 0000000..9ba1f61 --- /dev/null +++ b/customtheme.js @@ -0,0 +1,88 @@ +Drupal.theme.mkdruCounts = function(first, last, available, total) { + if (last > 0) + return '' + first + '' + Drupal.t(' to ') + '' + last + '' + Drupal.t(' of ') + '' + + available + '' + Drupal.t(' available'); + else + return Drupal.t('No results'); +}; + +Drupal.theme.mkdruResult = function(hit, num, detailLink) { + var resultclass = "mkdru-result "; + if (num%2) + resultclass += "odd"; + else + resultclass += "even"; + var html = ""; + html += '
  • ' + + '
    ' + + hit["md-title"] + ''; + if (hit["md-title-remainder"] !== undefined) { + html += ' ' + + hit["md-title-remainder"] + ' '; + } + html += '
    '; + if (hit["md-title-responsibility"] !== undefined) { + html += '
    ' + + hit["md-title-responsibility"] + + ' '; + if (hit["md-date"] !== undefined) { + html += hit["md-date"]; + } + html += '
    '; + } + if (hit["md-description"] !== undefined) { + // limit description to 400 characters + html += '
    ' + + String(hit["md-description"]).substr(0, 400) + + '
    '; + } + + html += '
  • '; + return html; +}; + +Drupal.theme.mkdruDetail = function(data, linkBack) { + var html = ''; + if (data["md-title"] != undefined) { + html += ''; + } + if (data["md-date"] != undefined) + html += ''; + if (data["md-author"] != undefined) + html += ''; + if (data["md-electronic-url"] != undefined) + html += ''; + // test if there is an array of per-location data; process it + if (Object.prototype.toString.call(data['location']) === '[object Array]') { + var subject = false; + var locations = ""; + for (var i = 0; i < data['location'].length; i++) { + var locRec = data['location'][i]; + // grab the first value we find for subject + if (!subject && locRec['md-subject']) subject = locRec['md-subject']; + // list named locations and link to the record there if url is available + var link = locRec["md-electronic-url"]; + if (!link) link = pz2urlrecipe.getUrlFromRecipe(locRec); + var name = locRec["@name"] + if (link && name) locations += '' + name + '
    '; + else if (name) locations += name + '
    '; + } + if (subject) + html += ''; + if (locations) + html += ''; + } + html += '
    ' + Drupal.t("Title") + '' + + data["md-title"]; + if (data["md-title-remainder"] !== undefined) { + html += ' : ' + data["md-title-remainder"] + ' '; + } + if (data["md-title-responsibility"] !== undefined) { + html += ' '+ data["md-title-responsibility"] +''; + } + html += '
    ' + Drupal.t("Date") + '' + data["md-date"] + '
    ' + Drupal.t("Author") + '' + data["md-author"] + '
    URL' + + data["md-electronic-url"] + '' + '
    ' + Drupal.t("Subject") + '' + subject + '
    ' + Drupal.t("Location") + '' + locations + '
    '; + html += '' + Drupal.t('Return to result list...') + ''; + return html; +}; diff --git a/images/search-button.png b/images/search-button.png new file mode 100644 index 0000000000000000000000000000000000000000..c6e820ad9f6ac36bd158a4a2b96ed43d711c6bae GIT binary patch literal 725 zcmV;`0xJE9P)U-C)zI(T{l1y+`@DrESE#{Nra|6`=qe!c0TRMU0-o@?O1Nal zCKG}OjMI`!0)nq3i~)h3L=j6^qKGj-L;=Ivduwa^Z85Eto+L_&FH#gz_>`tsoLBiFt>2sOo)i8%dpcpJzDN*0^ zd|FxwqAZSx?0|eMA8^DwD18VbMI;Qv2;L}+PG+CBdc9Vo^uxy#2H_9^yZ-vHIzL}6 zKX^TWok&s~34(wdrvi5TzR`I1{dw)pHQYln2ncWTfz0p!30U{VLi0wf!T=Edp8+cE z-SsEGvxs1hn4ePJpMUWJM*KVSZrxMF8$A|?r^p|5&JbUn=S2E_uMaPjI1W1wygpF| z!x7Fry!DCuA6@ctUD8Fl-Ar!Y1>&lJ$Xz6a5eMAi)pfXJ$0iek2aMB_O9FzgIFtf` z?pPLesH2EdKtusUTg~O=&6b$p7Ud!~IJM!icV{NY#wKTWX->rElIPZRrFnSRtW39f zWaDCrNNtR7(q7Np9N(~2DTujHJkhyMiVJ2Au|PJMQ7fG4nx>x?YKE1?7Lgs0SH&%k zXj_GK!%{>{)3o5VOzX>dZTsS4yIR=MF@=FSM8GcJ-kX@3nkW_y6;)r1w+&E>> z&ui7{%TJFcS1;jiih)6RlMiHi=a)gx9^Ze~6RR))g#V|3O8Z&8a-2m3bHwzNI{W71 z1&ru-q}{rwh&FmG5KWOj>YO3EI?su8I$8%_C~+Ki9B7??RN-tiSs95V00000NkvXX Hu0mjfVdqcH literal 0 HcmV?d00001 diff --git a/logo.png b/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..0ada45326367a08cbf30ea75a79646aab2ac36aa GIT binary patch literal 3479 zcmV;I4QTR-P)VN)q?L2%; z1U@q3&nTU;P%pS_W7(#u!fyXYLaX4kRbq#G?M7?1?DYwW9uj@LKs!6|Zz-m9mc|BpA_TR90Wc+air z-X^v5l`k}D=!%}{cI@2gXH}}%J=@$rNeWkwpL)#~Z&)w`0S>kx+4_v>v`HF40ECt# zNG1v!i*|ACKJV=(+CNc+6{TmcxOC0Jc@bpk#hc!Nw&yHQ8O4%`Kt^b3BugQ@=;3%( z^xe9|tG`NqA_^<4@mDOlC58H*Ees+ z2~aozUz>5^hRau!_E2B#b1_C@rBUH-9aE(#4gNZ+w1A z=3}IA+sc*qF08~*YO$~Pz4q5F6V;Yh#xeqeK_C+*(O=S+MgrQn=jMN@oG?Uyu?vm8wXLs8-_}Yiql^r@5+gYFmk3S5VvTXh&&8gbedXa7lBcZj z)%Zml|NfgL(IEn9?7+cfP3!+DKf;#ouRwqW6C-Si;Ac%)74(-zLHZ2(!|c8zt%*~* z7A}u3{lSgbS{OnbcA=|#Tl-c^TP%YF!drkiY@P)~ARhEwtx5m2`9d>9`rcPZLeoqBcyb{L?FPzU{C8@7if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>6PRMDK zAG-gk`M>_r=`{x;&lP(LJ__c}|Nga0<{*d4iddZY<)q*rX_FupEX?sIjArP!;!9Rp zHcke4&GL;u?ppW1m0k?_6KCDO{`Kz;Cji7F(MVxSP73Km@B4ElQTEA0nhZ4caAwNf zSvYCVnEKQE);HAD6^>qf_Lw+Ez+ogh+K1WVxZ|3?i;U`)X_Zk9Jnf}*+SKd%8`j^2 zPnb6vuei1Sg`7bE-TU4z6hdeJRyV{1J|;^h;uL9VdwWOIVSEV9O{yLkMxnEAhcPw_ zBXy{NpxEG4*jBgt!I|q9+;Q%0>mKPiiV>)Kx3_s%h2JK(G`5bWfgB_YCWx5nOX4JH z@4WNzMfd#Tmq#0s>}mSRe_i_Bod+-sslKf*C%j=5fOOT%O4wRzWdsWlQyF*GXpIwM zyeD3qzhUE}&H*qO8U$0lb?JR??nVx;Y-!#KjG*vR=d(MjV-Xc@AxTIQrGnpkZzoQ` zAF40D_s090wt?)4r_DO!g2{93a!5t3yO%xi#s?&f|HRJ^B}Y^Mj%@o*vZ~LJvZN)Y zC6rolbn}yb8Y8l|>H3Wq-Tm4NNEA)E?;ACn4*Y1}Bl{oO@xv8Y_?9J(?)~aR?=)Z# z{PO9yHsiyYF#Y_ccUS&m-W&6G&)YYvZsxA(56|52ts{qd7#f@IdaU?L%*IU2o^?xg z1NYO^zWYE&H?xyIZvz(QUnnmuU-x!BXW9O4<;)Xq`c0$sMHOy-nO#it+CeV%Z1hSTi8C(Rj?hDQhr5K53_L0|$KHDi8B;cHuDN~mxPmJF9n zx2%r65td3yvLo)ygDqvLhT7JX-hGW!Oj%PT+eVnhJ842gr8SXamnHzuDgBN%k}zFdijP z%4AZhWZkiKcN>xljGi5qCDT&36V0|P*?)&aIfH~EU;q{#gx&W zmYz%%rlVe_&u!k{`3b)s8&Ub;_5I1- zQ0) { + has = true; + } + } + return has; + } + + var getUrlFromRecipe = function (data) { + if (has_recipe(data)) { + return prepare_url(data["md-url_recipe"][0],data); + } else { + return null; + } + } + + var getElectronicUrls = function (data) { + var urls = []; + if (data["md-electronic-url"] !== undefined) { + for (var i=0; i0 && regex_str.charAt(j) == '/' && regex_str.charAt(j-1) != '\\') + i++; + else + regex_parts[i] += regex_str.charAt(j); + } + var regex_obj = new RegExp(regex_parts[0], regex_parts[2]); + return input_str.replace(regex_obj, regex_parts[1]); + } + + var test_url_recipe = function () { + var url_recipe = "http://www.indexdata.com/?title=${md-title[\\s+/+/g]}&author=${md-author}"; + var meta_data = { "md-title" : ["Art of Computer Programming"], "md-author" : ["Knuth"]} + var final_url = prepare_url(url_recipe, meta_data); + alert(final_url); + } + + // expose public methods + return { + getUrlFromRecipe: getUrlFromRecipe, + getElectronicUrls: getElectronicUrls, + }; +})(); diff --git a/template.php b/template.php new file mode 100644 index 0000000..7ad3a78 --- /dev/null +++ b/template.php @@ -0,0 +1,11 @@ +type == 'mkdru')) { + # helper functions to apply URL recipes + drupal_add_js(drupal_get_path('theme', 'mkdrusampletheme') . '/pz2urlrecipe.js'); + drupal_add_js(drupal_get_path('theme', 'mkdrusampletheme') . '/customtheme.js'); + } +} + diff --git a/templates/mkdru-block-facet.tpl.php b/templates/mkdru-block-facet.tpl.php new file mode 100644 index 0000000..c32aed9 --- /dev/null +++ b/templates/mkdru-block-facet.tpl.php @@ -0,0 +1 @@ +
    diff --git a/templates/mkdru-block-search.tpl.php b/templates/mkdru-block-search.tpl.php new file mode 100644 index 0000000..17ef61d --- /dev/null +++ b/templates/mkdru-block-search.tpl.php @@ -0,0 +1,4 @@ + diff --git a/templates/mkdru-form.tpl.php b/templates/mkdru-form.tpl.php new file mode 100644 index 0000000..aaddba3 --- /dev/null +++ b/templates/mkdru-form.tpl.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/templates/mkdru-results.tpl.php b/templates/mkdru-results.tpl.php new file mode 100644 index 0000000..f187c59 --- /dev/null +++ b/templates/mkdru-results.tpl.php @@ -0,0 +1,6 @@ +
    +
    +
    +
      +
      +
      -- 1.7.10.4