Plugin Directory

Changeset 2163735


Ignore:
Timestamp:
09/26/2019 01:40:42 PM (6 years ago)
Author:
navigationnorth
Message:

updates for v0.7.0

Location:
wp-oer
Files:
7 added
15 edited

Legend:

Unmodified
Added
Removed
  • wp-oer/tags/0.6.7/readme.txt

    r2057105 r2163735  
    11=== WP OER ===
    2 Contributors: navigationnorth, joehobson, johnpaulbalagolan, tomozaidem, arobotnamedchris
     2Contributors: navigationnorth, joehobson, johnpaulbalagolan, arobotnamedchris
    33Tags: OER, Open Educational Resources, Education, Learning
    44Requires at least: 4.4
  • wp-oer/trunk/css/back_styles.css

    r1971883 r2163735  
    279279.oer_settings_form .plugin-row-first{ padding-top:0px; }
    280280.loader-notice { font-size:18px; color: #fbe0e0;text-align:center;margin:10px auto;display:block !important;font-weight:bold; }
     281.table {
     282    width: 100%;
     283    max-width: 100%;
     284    margin-bottom: 20px;
     285}
     286.table th { text-align:left; }
     287.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
     288    padding: 8px;
     289    line-height: 1.42857143;
     290    vertical-align: top;
     291    border-top: 1px solid #ddd;
     292}
     293.table>tbody>tr>td input[type=text] { width:75%; }
     294#oer_local_resource_button.ui-button {
     295    padding: 6px 10px;
     296}
     297.standard-label {
     298    padding: 5px 10px;
     299    border: 1px solid #cdcdcd;
     300    border-radius: 15px;
     301    margin-right: 5px;
     302    background: #f1f1f1;
     303    margin:3px;
     304    display:inline-block;
     305}
     306a.remove-standard { text-decoration:none; }
     307a.remove-standard span { line-height:1.25em; }
     308.auto-width { width:auto !important; }
     309#standardModal ul ul { margin-left:40px; }
     310#standardModal #standards-list { max-height:400px; overflow-y:auto; }
     311#add-new-standard { margin:3px; height:32px; }
     312#standardModal .search-bar {
     313    margin-bottom: 15px;
     314    margin-top: auto;
     315    height: 40px;
     316    padding: 0;
     317    position:relative;
     318    border:1px solid #cdcdcd;
     319}
     320.search-standard-text {
     321    color: white;
     322    border: 0 !important;
     323    outline: none !important;
     324    background: none !important;
     325    line-height: 40px;
     326    transition: width 0.4s linear;
     327    padding: 0 10px;
     328}
     329.search-standard-text:focus { border-color:transparent !important; box-shadow:none !important;}
     330.search-bar:hover > .search_std_btn{
     331    background: white;
     332    color: #e74c3c;
     333}
     334.search_std_btn{
     335    height: 30px;
     336    width: 30px;
     337    float: right;
     338    display: flex;
     339    justify-content: center;
     340    align-items: center;
     341    border-radius: 50%;
     342    color:white;
     343    position:absolute;
     344    right:2.5px;
     345    top:2.5px;
     346}
     347.search_close_btn {
     348    height: 30px;
     349    width: 30px;
     350    float: right;
     351    display: flex;
     352    justify-content: center;
     353    align-items: center;
     354    border-radius: 50%;
     355    color: white;
     356    position: absolute;
     357    right: 2.5px;
     358    top: 2.5px;
     359}
     360.search_close_btn .dashicons { color:#000000; }
     361#oer_search_results_list { display:none; }
     362#oer_search_results_list{ position:relative; }
  • wp-oer/trunk/css/front_styles.css

    r1971883 r2163735  
    444444.oer-standards #content, .standards-template #content,
    445445.substandards-template #content, .notation-template #content { width:100%; }
    446 .oer-pdf-viewer { /*min-height:1250px;*/min-height:500px; height:100%; }
     446.oer-pdf-viewer { /*min-height:1250px;*/min-height:600px; height:100%; }
    447447.oer-standards #content ul.oer-standards li,
    448448.standards-template #content ul.oer-standards li,
  • wp-oer/trunk/css/resource-style.css

    r1971883 r2163735  
    6565}
    6666.oer-sngl-rsrc-img .oer-rsrcurl.left { text-align:left; }
     67.oer-cbxl h4 span { font-size: 0.85em; font-weight: normal; color: #000000; }
    6768/** For Mobile styles **/
    6869@media screen and (min-width: 960px) {
  • wp-oer/trunk/includes/init.php

    r1971883 r2163735  
    106106{
    107107    global $post;
    108    
    109108    if ((isset($_GET['post_type']) && $_GET['post_type']=='resource') || (isset($post->post_type) && $post->post_type=='resource')) {
    110109    wp_enqueue_style('jqueryui-styles', OER_URL.'css/jquery-ui.css');
     
    112111    wp_enqueue_style( 'thickbox' );
    113112
    114     if (isset($post->post_type) && $post->post_type!=='resource') {
    115         wp_enqueue_script('jquery');
    116     }
    117113   
    118     wp_enqueue_script( 'jquery-ui-core' );
    119     wp_enqueue_script( 'jquery-ui-widgets' );
    120     wp_enqueue_script( 'jquery-ui-tabs' );
    121     wp_enqueue_script( 'jquery-ui-datepicker' );
     114    wp_enqueue_script('jquery');
     115    wp_enqueue_script('jquery-ui-core' );
     116    wp_enqueue_script('jquery-ui-widgets' );
     117    wp_enqueue_script('jquery-ui-tabs' );
     118    wp_enqueue_script('jquery-ui-datepicker' );
    122119    wp_enqueue_script( 'media-upload' );
    123120    wp_enqueue_script( 'thickbox' );
     121    wp_enqueue_script( 'bootstrap-js', OER_URL.'js/bootstrap.min.js', array('jquery'));
    124122    wp_enqueue_script('back-scripts', OER_URL.'js/back_scripts.js',array( 'jquery','media-upload','thickbox','set-post-thumbnail' ));
     123    wp_enqueue_script('admin-resource', OER_URL.'js/admin_resource.js');
    125124    }
    126125   
     
    400399        }
    401400       
     401        // Save Format
     402        if(isset($_POST['oer_format']))
     403        {
     404            update_post_meta( $post->ID , 'oer_format' , sanitize_text_field($_POST['oer_format']));
     405        }
     406       
    402407        if(isset($_POST['oer_datecreated']))
    403408        {
    404409            update_post_meta( $post->ID , 'oer_datecreated' , sanitize_text_field($_POST['oer_datecreated']));
     410        }
     411       
     412        // Save Date Created Estimate
     413        if(isset($_POST['oer_datecreated_estimate']))
     414        {
     415            update_post_meta( $post->ID , 'oer_datecreated_estimate' , sanitize_text_field($_POST['oer_datecreated_estimate']));
    405416        }
    406417
     
    470481        if(isset($_POST['oer_standard']))
    471482        {
    472             $gt_oer_standard = $_POST['oer_standard'];
    473             $gt_oer_standard = array_map( 'sanitize_text_field', $_POST['oer_standard']) ;
    474            
    475             if(!empty($gt_oer_standard)) {
    476                 for($l = 0; $l < count($gt_oer_standard); $l++)
    477                 {
    478                 $results = $wpdb->get_row( $wpdb->prepare( "SELECT * from " . $wpdb->prefix. "oer_standard_notation where standard_notation =%s" , $gt_oer_standard[$l] ),ARRAY_A);
    479                 if(!empty($results))
    480                 {
    481                     $gt_oer_standard_notation .= "standard_notation-".$results['id'].",";
    482                     $table = explode("-", $results['parent_id']);
    483                    
    484                     if(!empty($table))
    485                     {
    486                     $stndrd_algn = $wpdb->get_row( $wpdb->prepare( "SELECT * from  " . $wpdb->prefix. $_oer_prefix.$table[0] . " where id =%s" , $table[1] ),ARRAY_A);
    487                     if($stndrd_algn['parent_id'])
    488                     {
    489                         oer_fetch_stndrd($stndrd_algn['parent_id'], $post_id);
    490                     }
    491                     }
    492                 }
    493                 }
    494             }
    495             $oer_standard = implode(",", $gt_oer_standard);
    496             update_post_meta( $post->ID , 'oer_standard' , $oer_standard);
     483            update_post_meta( $post->ID , 'oer_standard' , sanitize_text_field($_POST['oer_standard']));
    497484        }
    498485        else
     
    637624
    638625        }//Create Screeenshot
    639 
     626       
     627        // Save Citation
     628        if(isset($_POST['oer_citation']))
     629        {
     630            update_post_meta( $post->ID , 'oer_citation' , $_POST['oer_citation']);
     631        }
     632       
     633        // Save Sensitive Material
     634        if(isset($_POST['oer_sensitive_material']))
     635        {
     636            update_post_meta( $post->ID , 'oer_sensitive_material' , $_POST['oer_sensitive_material']);
     637        }
     638       
     639        // Save Transcription
     640        if(isset($_POST['oer_transcription']))
     641        {
     642            update_post_meta( $post->ID , 'oer_transcription' , $_POST['oer_transcription']);
     643        }
    640644    }
    641645    }
     
    812816    exit;
    813817}
     818
     819// Add Standard Modal
     820add_action( "admin_footer" , "oer_add_modal" );
     821function oer_add_modal(){
     822    if (oer_installed_standards_plugin()) {
     823    include_once(OER_PATH."oer_template/modals/standard_modal.php");
     824    }
     825}
    814826?>
  • wp-oer/trunk/includes/oer-functions.php

    r1971883 r2163735  
    230230
    231231// Log Debugging
    232 function debug_log($message) {
    233     global $_debug;
    234 
    235     // if debugging is on
    236     if ($_debug=="on")
    237         error_log($message);
     232if (!function_exists('debug_log')){
     233    function debug_log($message) {
     234        global $_debug;
     235   
     236        // if debugging is on
     237        if ($_debug=="on")
     238            error_log($message);
     239    }
    238240}
    239241
     
    10831085                $oer_kywrd      = "";
    10841086                $oer_datecreated    = "";
     1087                $oer_datecreated_estimate = "";
    10851088                $oer_datemodified   = "";
    10861089                $oer_mediatype      = "";
     
    11021105                $oer_authoremail2       = "";
    11031106                $oer_thumbnailurl   = "";
     1107                $oer_format     = "";
     1108                $oer_transcription  = "";
     1109                $oer_citation       = "";
     1110                $oer_sensitive_material = "";
    11041111
    11051112                /** Check first if column is set **/
     
    11211128                    $oer_datecreated    = $fnldata['cells'][$k][8];
    11221129                if (isset($fnldata['cells'][$k][9]))
    1123                     $oer_datemodified   = $fnldata['cells'][$k][9];
     1130                    $oer_datecreated_estimate    = $fnldata['cells'][$k][9];
    11241131                if (isset($fnldata['cells'][$k][10]))
    1125                     $oer_mediatype      = $fnldata['cells'][$k][10];
     1132                    $oer_datemodified       = $fnldata['cells'][$k][10];
    11261133                if (isset($fnldata['cells'][$k][11]))
    1127                     $oer_lrtype         = $fnldata['cells'][$k][11];
     1134                    $oer_mediatype          = $fnldata['cells'][$k][11];
    11281135                if (isset($fnldata['cells'][$k][12]))
    1129                     $oer_interactivity  = $fnldata['cells'][$k][12];
     1136                    $oer_lrtype             = $fnldata['cells'][$k][12];
    11301137                if (isset($fnldata['cells'][$k][13]))
    1131                     $oer_userightsurl   = $fnldata['cells'][$k][13];
     1138                    $oer_interactivity      = $fnldata['cells'][$k][13];
    11321139                if (isset($fnldata['cells'][$k][14]))
    1133                     $oer_isbasedonurl   = $fnldata['cells'][$k][14];
     1140                    $oer_userightsurl       = $fnldata['cells'][$k][14];
    11341141                if (isset($fnldata['cells'][$k][15]))
    1135                     $oer_standard       = $fnldata['cells'][$k][15];
     1142                    $oer_isbasedonurl       = $fnldata['cells'][$k][15];
    11361143                if (isset($fnldata['cells'][$k][16]))
    1137                     $oer_authortype     = $fnldata['cells'][$k][16];
     1144                    $oer_standard           = $fnldata['cells'][$k][16];
    11381145                if (isset($fnldata['cells'][$k][17]))
    1139                     $oer_authorname     = $fnldata['cells'][$k][17];
     1146                    $oer_authortype         = $fnldata['cells'][$k][17];
    11401147                if (isset($fnldata['cells'][$k][18]))
    1141                     $oer_authorurl      = $fnldata['cells'][$k][18];
     1148                    $oer_authorname         = $fnldata['cells'][$k][18];
    11421149                if (isset($fnldata['cells'][$k][19]))
    1143                     $oer_authoremail    = $fnldata['cells'][$k][19];
     1150                    $oer_authorurl          = $fnldata['cells'][$k][19];
    11441151                if (isset($fnldata['cells'][$k][20]))
    1145                     $oer_publishername  = $fnldata['cells'][$k][20];
     1152                    $oer_authoremail        = $fnldata['cells'][$k][20];
    11461153                if (isset($fnldata['cells'][$k][21]))
    1147                     $oer_publisherurl   = $fnldata['cells'][$k][21];
     1154                    $oer_publishername      = $fnldata['cells'][$k][21];
    11481155                if (isset($fnldata['cells'][$k][22]))
    1149                     $oer_publisheremail = $fnldata['cells'][$k][22];
     1156                    $oer_publisherurl       = $fnldata['cells'][$k][22];
    11501157                if (isset($fnldata['cells'][$k][23]))
    1151                     $oer_authortype2    = $fnldata['cells'][$k][23];
     1158                    $oer_publisheremail     = $fnldata['cells'][$k][23];
    11521159                if (isset($fnldata['cells'][$k][24]))
    1153                     $oer_authorname2    = $fnldata['cells'][$k][24];
     1160                    $oer_authortype2    = $fnldata['cells'][$k][24];
    11541161                if (isset($fnldata['cells'][$k][25]))
    1155                     $oer_authorurl2     = $fnldata['cells'][$k][25];
     1162                    $oer_authorname2        = $fnldata['cells'][$k][25];
    11561163                if (isset($fnldata['cells'][$k][26]))
    1157                     $oer_authoremail2  = $fnldata['cells'][$k][26];
     1164                    $oer_authorurl2      = $fnldata['cells'][$k][26];
    11581165                if (isset($fnldata['cells'][$k][27]))
    1159                     $oer_thumbnailurl   = $fnldata['cells'][$k][27];
     1166                    $oer_authoremail2       = $fnldata['cells'][$k][27];
     1167                if (isset($fnldata['cells'][$k][28]))
     1168                    $oer_thumbnailurl       = $fnldata['cells'][$k][28];
     1169                if (isset($fnldata['cells'][$k][29]))
     1170                    $oer_format         = $fnldata['cells'][$k][29];
     1171                if (isset($fnldata['cells'][$k][30]))
     1172                    $oer_transcription      = $fnldata['cells'][$k][30];
     1173                if (isset($fnldata['cells'][$k][31]))
     1174                    $oer_citation       = $fnldata['cells'][$k][31];
     1175                if (isset($fnldata['cells'][$k][32]))
     1176                    $oer_sensitive_material  = $fnldata['cells'][$k][32];
    11601177                   
    11611178                if(!empty($oer_standard) && (!is_array($oer_standard)))
     
    12661283                {
    12671284                    update_post_meta( $post_id , 'oer_datecreated' , $oer_datecreated);
     1285                }
     1286               
     1287                if(!empty($oer_datecreated_estimate) && !($oer_datecreated_estimate=="")){
     1288                    update_post_meta( $post_id , 'oer_datecreated_estimate' , $oer_datecreated_estimate);
    12681289                }
    12691290
     
    14081429                {
    14091430                    update_post_meta( $post_id , 'oer_publisheremail' , sanitize_email($oer_publisheremail));
     1431                }
     1432               
     1433                // Save Format field
     1434                if(!empty($oer_format))
     1435                {
     1436                    update_post_meta( $post_id , 'oer_format' , sanitize_text_field($oer_format));
     1437                }
     1438               
     1439                // Save Citation
     1440                if(!empty($oer_citation)){
     1441                    update_post_meta( $post_id , 'oer_citation' , $oer_citation);
     1442                }
     1443               
     1444                // Save Sensitive Material Warning
     1445                if(!empty($oer_sensitive_material)){
     1446                    update_post_meta( $post_id , 'oer_sensitive_material' , $oer_sensitive_material);
     1447                }
     1448               
     1449                // Save Transcription
     1450                if(!empty($oer_transcription)){
     1451                    update_post_meta( $post_id , 'oer_transcription' , $oer_transcription);
    14101452                }
    14111453                //saving meta fields
     
    30563098    return $substandards;
    30573099}
     3100
     3101if (!function_exists('oer_get_resource_metadata')){
     3102    function oer_get_resource_metadata($resource_id){
     3103        return get_post_meta($resource_id);
     3104    }
     3105}
     3106
     3107if (!function_exists('oer_get_meta_label')){
     3108    function oer_get_meta_label($key){
     3109        $label = "";
     3110        switch ($key){
     3111            case "oer_highlight":
     3112                $label = __("Highlight", OER_SLUG);
     3113                break;
     3114            case "oer_grade":
     3115                $label = __("Grade", OER_SLUG);
     3116                break;
     3117            case "oer_format":
     3118                $label = __("Format", OER_SLUG);
     3119                break;
     3120            case "oer_datecreated":
     3121                $label = __("Date Created", OER_SLUG);
     3122                break;
     3123            case "oer_datecreated_estimate":
     3124                $label = __("Date Created Estimate", OER_SLUG);
     3125                break;
     3126            case "oer_datemodified":
     3127                $label = __("Date Modified", OER_SLUG);
     3128                break;
     3129            case "oer_mediatype":
     3130                $label = __("Media Type", OER_SLUG);
     3131                break;
     3132            case "oer_lrtype":
     3133                $label = __("Learning Resource Type", OER_SLUG);
     3134                break;
     3135            case "oer_interactivity":
     3136                $label = __("Interactivity", OER_SLUG);
     3137                break;
     3138            case "oer_userightsurl":
     3139                $label = __("Use Rights URL", OER_SLUG);
     3140                break;
     3141            case "oer_isbasedonurl":
     3142                $label = __("Is based on URL", OER_SLUG);
     3143                break;
     3144            case "oer_standard":
     3145                $label = __("Standards", OER_SLUG);
     3146                break;
     3147            case "oer_standard_alignment":
     3148                $label = __("Standard Alignment", OER_SLUG);
     3149                break;
     3150            case "oer_authortype":
     3151                $label = __("Type", OER_SLUG);
     3152                break;
     3153            case "oer_authorname":
     3154                $label = __("Name", OER_SLUG);
     3155                break;
     3156            case "oer_authorurl":
     3157                $label = __("URL", OER_SLUG);
     3158                break;
     3159            case "oer_authoremail":
     3160                $label = __("Email Address", OER_SLUG);
     3161                break;
     3162            case "oer_authortype2":
     3163                $label = __("Type", OER_SLUG);
     3164                break;
     3165            case "oer_authorname2":
     3166                $label = __("Name", OER_SLUG);
     3167                break;
     3168            case "oer_authorurl2":
     3169                $label = __("URL", OER_SLUG);
     3170                break;
     3171            case "oer_authoremail2":
     3172                $label = __("Email Address", OER_SLUG);
     3173                break;
     3174            case "oer_publishername":
     3175                $label = __("Name", OER_SLUG);
     3176                break;
     3177            case "oer_publisherurl":
     3178                $label = __("URL", OER_SLUG);
     3179                break;
     3180            case "oer_publisheremail":
     3181                $label = __("Email Address", OER_SLUG);
     3182                break;
     3183            case "oer_citation":
     3184                $label = __("Citation", OER_SLUG);
     3185                break;
     3186            case "oer_sensitive_material":
     3187                $label = __("Sensitive Material Warning", OER_SLUG);
     3188                break;
     3189            case "oer_transcription":
     3190                $label = __("Transcription", OER_SLUG);
     3191                break;
     3192        }
     3193        return $label;
     3194    }
     3195}
     3196
     3197if (!function_exists('oer_get_all_meta')){
     3198    function oer_get_all_meta($type){
     3199        global $wpdb;
     3200        $result = $wpdb->get_results($wpdb->prepare(
     3201        "SELECT post_id, meta_key, meta_value FROM ".$wpdb->prefix."posts,".$wpdb->prefix."postmeta WHERE post_type=%s
     3202            AND ".$wpdb->prefix."posts.ID=".$wpdb->prefix."postmeta.post_id", $type
     3203        ), ARRAY_A);
     3204        return $result;
     3205    }
     3206}
     3207
     3208if (!function_exists('oer_save_metadata_options')){
     3209    function oer_save_metadata_options($post_data){
     3210        foreach($post_data as $key=>$value){
     3211            if (strpos($key,"oer_")!==false){
     3212                if (get_option($key))
     3213                    update_option($key, $value);
     3214                else
     3215                    add_option($key, $value);
     3216            }
     3217        }
     3218    }
     3219}
     3220
     3221if (! function_exists('oer_installed_standards_plugin')){
     3222    function oer_installed_standards_plugin(){
     3223        $activeWAS = false;
     3224        $active_plugins_basenames = get_option( 'active_plugins' );
     3225        foreach ( $active_plugins_basenames as $plugin_basename ) {
     3226        if ( false !== strpos( $plugin_basename, '/wp-academic-standards.php' ) ) {
     3227                $activeWAS = true;
     3228            }
     3229        }
     3230        return $activeWAS;
     3231    }
     3232}
     3233
     3234function oer_grade_levels($grade_levels){
     3235    $elmnt = 0;
     3236   
     3237    sort($grade_levels);
     3238
     3239    for($x=0; $x < count($grade_levels); $x++)
     3240    {
     3241        $grade_levels[$x];
     3242    }
     3243   
     3244    $fltrarr = array_filter($grade_levels, 'strlen');
     3245    $flag = array();
     3246    if (is_array($fltrarr) && count($fltrarr)>0)
     3247        $elmnt = $fltrarr[min(array_keys($fltrarr))];
     3248       
     3249    for($i =0; $i < count($fltrarr); $i++)
     3250    {
     3251        if($elmnt == $fltrarr[$i] || "k" == strtolower($fltrarr[$i]))
     3252        {
     3253            $flag[] = 1;
     3254        }
     3255        else
     3256        {
     3257            $flag[] = 0;
     3258        }
     3259        $elmnt++;
     3260    }
     3261
     3262    if(in_array('0',$flag))
     3263    {
     3264        return implode(",",array_unique($fltrarr));
     3265    }
     3266    else
     3267    {
     3268        $arr_flt = array_keys($fltrarr);
     3269        $end_filter = end($arr_flt);
     3270        if (count($fltrarr)>1) {
     3271            if (strtolower($fltrarr[$end_filter])=="k") {
     3272                $last_index = count($fltrarr)-2;
     3273                return $fltrarr[$end_filter]."-".$fltrarr[$last_index];
     3274            }
     3275            else
     3276                return $fltrarr[0]."-".$fltrarr[$end_filter];
     3277        }
     3278        else{
     3279            if (isset($fltrarr[0]))
     3280                return $fltrarr[0];
     3281        }
     3282    }
     3283}
     3284
     3285// Get Title or Description of Standard or Notation
     3286function oer_get_standard_label($slug){
     3287    global $wpdb;
     3288   
     3289    $slugs = explode("-", $slug);
     3290    $table_name = "oer_".$slugs[0];
     3291    $id = $slugs[1];
     3292    $standard = null;
     3293   
     3294    $results = $wpdb->get_results( $wpdb->prepare( "SELECT * from " . $wpdb->prefix. $table_name . " where id = %s" , $id ) , ARRAY_A);
     3295    if (!empty($results)){
     3296        foreach($results as $result) {
     3297            $standard = $result['description'];
     3298        }
     3299    }
     3300   
     3301    return $standard;
     3302}
     3303
    30583304?>
  • wp-oer/trunk/includes/resource_metafields.php

    r1776251 r2163735  
    1616            <div class="oer_fld">
    1717                <?php $oer_resourceurl = get_post_meta($post->ID, 'oer_resourceurl', true);?>
    18                 <input type="text" name="oer_resourceurl" value="<?php echo esc_attr($oer_resourceurl);?>" />
    19             </div>
    20         </div>
    21 
    22         <div class="oer_snglfld">
    23             <div class="oer_txt">
    24             <?php _e("Highlight:", OER_SLUG); ?>
     18                <input type="text" name="oer_resourceurl" id="oer_resourceurl" value="<?php echo esc_attr($oer_resourceurl);?>" /> <button name="oer_local_resource_button" id="oer_local_resource_button" class="ui-button" alt="Set Local Resource">...</button>
     19            </div>
     20        </div>
     21
     22        <?php
     23    // Highlight
     24    $option_set = false;
     25    if (get_option('oer_highlight_label')){
     26        $option_set = true;
     27    }
     28    if (($option_set && get_option('oer_highlight_enabled')) || !$option_set) {
     29    ?>
     30        <div class="oer_snglfld">
     31            <div class="oer_txt">
     32            <?php
     33            if (!$option_set)
     34                _e("Highlight:", OER_SLUG);
     35            else
     36                echo get_option('oer_highlight_label').":";
     37            ?>
    2538            </div>
    2639            <div class="oer_fld">
     
    3043            </div>
    3144        </div>
    32 
    33        <div class="oer_snglfld">
    34             <div class="oer_txt">
    35             <?php _e("Grade:", OER_SLUG); ?>
     45    <?php } ?>
     46
     47    <?php
     48    // Grade Level
     49    $option_set = false;
     50    if (get_option('oer_grade_label')){
     51        $option_set = true;
     52    }
     53    if (($option_set && get_option('oer_grade_enabled')) || !$option_set) {
     54    ?>
     55    <div class="oer_snglfld">
     56            <div class="oer_txt">
     57            <?php
     58            if (!$option_set)
     59                _e("Grade:", OER_SLUG);
     60            else
     61                echo get_option('oer_grade_label').":";
     62            ?>
    3663            </div>
    3764            <div class="oer_fld">
     
    7198            </div>
    7299        </div>
    73 
    74         <div class="oer_snglfld">
    75             <div class="oer_txt">
    76             <?php _e("Date Created:", OER_SLUG); ?>
     100       <?php } ?>
     101       
     102    <?php
     103    // Format
     104    $option_set = false;
     105    if (get_option('oer_format_label')){
     106        $option_set = true;
     107    }
     108    if (($option_set && get_option('oer_format_enabled')) || !$option_set) {
     109    ?>
     110    <div class="oer_snglfld">
     111            <div class="oer_txt">
     112            <?php
     113            if (!$option_set)
     114                _e("Format:", OER_SLUG);
     115            else
     116                echo get_option('oer_format_label').":";
     117            ?>
     118            </div>
     119            <div class="oer_fld">
     120                <?php $oer_format = get_post_meta($post->ID, 'oer_format', true);?>
     121                <input type="text" name="oer_format" value="<?php echo $oer_format;?>"/>
     122            </div>
     123        </div>
     124    <?php } ?>
     125
     126    <?php
     127    // Date Created
     128    $option_set = false;
     129    if (get_option('oer_datecreated_label')){
     130        $option_set = true;
     131    }
     132    if (($option_set && get_option('oer_datecreated_enabled')) || !$option_set) {
     133    ?>
     134        <div class="oer_snglfld">
     135            <div class="oer_txt">
     136            <?php
     137            if (!$option_set)
     138                _e("Date Created:", OER_SLUG);
     139            else
     140                echo get_option('oer_datecreated_label').":";
     141            ?>
    77142            </div>
    78143            <div class="oer_fld">
     
    81146            </div>
    82147        </div>
    83 
    84         <div class="oer_snglfld">
    85             <div class="oer_txt">
    86             <?php _e("Date Modified:", OER_SLUG); ?>
     148    <?php } ?>
     149   
     150    <?php
     151    // Date Created Estimate
     152    $option_set = false;
     153    if (get_option('oer_datecreated_estimate_label')){
     154        $option_set = true;
     155    }
     156    if (($option_set && get_option('oer_datecreated_estimate_enabled')) || !$option_set) {
     157    ?>
     158    <div class="oer_snglfld">
     159            <div class="oer_txt">
     160            <?php
     161            if (!$option_set)
     162                _e("Date Created Estimate:", OER_SLUG);
     163            else
     164                echo get_option('oer_datecreated_estimate_label').":";
     165            ?>
     166            </div>
     167            <div class="oer_fld">
     168                <?php $oer_datecreated_estimate = get_post_meta($post->ID, 'oer_datecreated_estimate', true);?>
     169                <input type="text" name="oer_datecreated_estimate" value="<?php echo $oer_datecreated_estimate;?>" />
     170            </div>
     171        </div>
     172    <?php } ?>
     173
     174    <?php
     175    // Date Modified
     176    $option_set = false;
     177    if (get_option('oer_datemodified_label')){
     178        $option_set = true;
     179    }
     180    if (($option_set && get_option('oer_datemodified_enabled')) || !$option_set) {
     181    ?>
     182        <div class="oer_snglfld">
     183            <div class="oer_txt">
     184            <?php
     185            if (!$option_set)
     186                _e("Date Modified:", OER_SLUG);
     187            else
     188                echo get_option('oer_datemodified_label').":";
     189            ?>
    87190            </div>
    88191            <div class="oer_fld">
     
    91194            </div>
    92195        </div>
    93 
    94         <div class="oer_snglfld">
    95             <div class="oer_txt">
    96             <?php _e("Media Type:", OER_SLUG); ?>
     196    <?php } ?>
     197
     198    <?php
     199    // Media Type
     200    $option_set = false;
     201    if (get_option('oer_mediatype_label')){
     202        $option_set = true;
     203    }
     204    if (($option_set && get_option('oer_mediatype_enabled')) || !$option_set) {
     205    ?>
     206        <div class="oer_snglfld">
     207            <div class="oer_txt">
     208            <?php
     209            if (!$option_set)
     210                _e("Media Type:", OER_SLUG);
     211            else
     212                echo get_option('oer_mediatype_label').":";
     213            ?>
    97214            </div>
    98215            <div class="oer_fld">
    99216                <?php $oer_mediatype = strtolower(get_post_meta($post->ID, 'oer_mediatype', true)); ?>
    100217                <select name="oer_mediatype">
    101                        <option value="website" <?php if($oer_mediatype == 'website'){echo 'selected="selected"';}?>><?php _e("Website", OER_SLUG); ?></option>
     218            <option value="website" <?php if($oer_mediatype == 'website'){echo 'selected="selected"';}?>><?php _e("Website", OER_SLUG); ?></option>
    102219                       <option value="audio" <?php if($oer_mediatype == 'audio'){echo 'selected="selected"';}?>><?php _e("Audio", OER_SLUG); ?></option>
    103220                       <option value="document" <?php if($oer_mediatype == 'document'){echo 'selected="selected"';}?>><?php _e("Document", OER_SLUG); ?></option>
     
    108225            </div>
    109226        </div>
    110 
    111         <div class="oer_snglfld">
    112             <div class="oer_txt">
    113             <?php _e("Learning Resource Type:", OER_SLUG); ?>
     227    <?php } ?>
     228
     229    <?php
     230    // Learning Resource Type
     231    $option_set = false;
     232    if (get_option('oer_lrtype_label')){
     233        $option_set = true;
     234    }
     235    if (($option_set && get_option('oer_lrtype_enabled')) || !$option_set) {
     236    ?>
     237        <div class="oer_snglfld">
     238            <div class="oer_txt">
     239            <?php
     240            if (!$option_set)
     241                _e("Learning Resource Type:", OER_SLUG);
     242            else
     243                echo get_option('oer_lrtype_label').":";
     244            ?>
    114245            </div>
    115246            <div class="oer_fld">
     
    117248                <select name="oer_lrtype">
    118249            <option value=""></option>
    119                        <option value="website" <?php if($oer_lrtype == 'website'){echo 'selected="selected"';}?>><?php _e("Assessment", OER_SLUG); ?></option>
     250            <option value="website" <?php if($oer_lrtype == 'website'){echo 'selected="selected"';}?>><?php _e("Assessment", OER_SLUG); ?></option>
    120251                       <option value="audio" <?php if($oer_lrtype == 'audio'){echo 'selected="selected"';}?>><?php _e("Audio", OER_SLUG); ?></option>
    121252                       <option value="calculator" <?php if($oer_lrtype == 'calculator'){echo 'selected="selected"';}?>><?php _e("Calculator", OER_SLUG); ?></option>
     
    131262            </div>
    132263        </div>
    133 
    134         <div class="oer_snglfld">
    135             <div class="oer_txt">
    136             <?php _e("Interactivity:", OER_SLUG); ?>
     264    <?php } ?>
     265
     266    <?php
     267    // Interactivity
     268    $option_set = false;
     269    if (get_option('oer_interactivity_label')){
     270        $option_set = true;
     271    }
     272    if (($option_set && get_option('oer_interactivity_enabled')) || !$option_set) {
     273    ?>
     274        <div class="oer_snglfld">
     275            <div class="oer_txt">
     276            <?php
     277            if (!$option_set)
     278                _e("Interactivity:", OER_SLUG);
     279            else
     280                echo get_option('oer_interactivity_label').":";
     281            ?>
    137282            </div>
    138283            <div class="oer_fld">
     
    140285                <select name="oer_interactivity">
    141286            <option value=""></option>
    142                        <option value="interactive" <?php if($oer_interactivity == 'interactive'){echo 'selected="selected"';}?>><?php _e("Interactive", OER_SLUG); ?></option>
     287            <option value="interactive" <?php if($oer_interactivity == 'interactive'){echo 'selected="selected"';}?>><?php _e("Interactive", OER_SLUG); ?></option>
    143288                       <option value="passive" <?php if($oer_interactivity == 'passive'){echo 'selected="selected"';}?>><?php _e("Passive", OER_SLUG); ?></option>
    144289                       <option value="social" <?php if($oer_interactivity == 'social'){echo 'selected="selected"';}?>><?php _e("Social", OER_SLUG); ?></option>
     
    151296            </div>
    152297        </div>
    153 
    154         <div class="oer_snglfld">
    155             <div class="oer_txt">
    156             <?php _e("Use Rights URL:", OER_SLUG); ?>
     298    <?php } ?>
     299
     300    <?php
     301    // User Rights URL
     302    $option_set = false;
     303    if (get_option('oer_userightsurl_label')){
     304        $option_set = true;
     305    }
     306    if (($option_set && get_option('oer_userightsurl_enabled')) || !$option_set) {
     307    ?>
     308        <div class="oer_snglfld">
     309            <div class="oer_txt">
     310            <?php
     311            if (!$option_set)
     312                _e("Use Rights URL:", OER_SLUG);
     313            else
     314                echo get_option('oer_userightsurl_label').":";
     315            ?>
    157316            </div>
    158317            <div class="oer_fld">
     
    161320            </div>
    162321        </div>
    163 
    164         <div class="oer_snglfld">
    165             <div class="oer_txt">
    166             <?php _e("Is based on URL:", OER_SLUG); ?>
     322    <?php } ?>
     323
     324    <?php
     325    // Is Based on URL
     326    $option_set = false;
     327    if (get_option('oer_isbasedonurl_label')){
     328        $option_set = true;
     329    }
     330    if (($option_set && get_option('oer_isbasedonurl_enabled')) || !$option_set) {
     331    ?>
     332        <div class="oer_snglfld">
     333            <div class="oer_txt">
     334            <?php
     335            if (!$option_set)
     336                _e("Is based on URL:", OER_SLUG);
     337            else
     338                echo get_option('oer_isbasedonurl_label').":";
     339            ?>
    167340            </div>
    168341            <div class="oer_fld">
     
    171344            </div>
    172345        </div>
    173 
     346    <?php } ?>
     347   
     348    <?php
     349    // Standard
     350    if (oer_installed_standards_plugin()){
     351        $option_set = false;
     352        if (get_option('oer_standard_label')){
     353            $option_set = true;
     354        }
     355        if (($option_set && get_option('oer_standard_enabled')) || !$option_set) {
     356        ?>
    174357        <div class="oer_snglfld">
    175             <div class="oer_txt">
    176             <?php _e("Standards Alignment:", OER_SLUG); ?>
    177             </div>
    178             <?php
    179                 $oer_standard_alignment = get_post_meta($post->ID, 'oer_standard_alignment', true);
    180                 $oer_standard = get_post_meta($post->ID, 'oer_standard', true);
    181                 $external_script_url = OER_URL."js/extrnl_script.js";
    182              ?>
    183              <div class="oer_fld">
    184                 <div class="oer_lstofstandrd ">
    185                       <?php
    186                             $results = $wpdb->get_results("SELECT * from " . $wpdb->prefix. "oer_core_standards",ARRAY_A);
    187                             foreach($results as $result)
    188                             {
    189                                 $value = 'core_standards-'.$result['id'];
    190                                 echo "<li class='oer_sbstndard oer_main'>
    191                                         <div class='stndrd_ttl'>
    192                                             <img src='".OER_URL."images/closed_arrow.png' data-pluginpath='".OER_URL."' class='tglimg' />
    193                                             <input type='checkbox' ".$chck." name='oer_standard[]' value='".esc_attr($value)."' onclick='oer_check_all(this)' >
    194                                             ".sanitize_text_field($result['standard_name'])."
    195                                         </div><div class='oer_stndrd_desc'></div>";
    196 
    197                                         oer_get_sub_standard($value, $oer_standard);
    198                                 echo "</li>";
    199                             }
    200                         ?>
    201                     <script src="<?php echo esc_url($external_script_url);?>" type="text/javascript"></script>
    202                  </div>
    203             </div>
    204 
    205         </div>
    206 
     358            <div class="oer_txt">
     359                <?php
     360                if (!$option_set)
     361                    _e("Standards:", OER_SLUG);
     362                else
     363                    echo get_option('oer_standard_label').":";
     364                ?>
     365            </div>
     366            <div class="oer_fld auto-width">
     367                <?php
     368                $oStandard = get_post_meta($post->ID, 'oer_standard', true);
     369                $standards = explode(",", $oStandard);
     370                foreach($standards as $standard){
     371                    if ($standard!=="") {
     372                        $std_name = oer_get_standard_label($standard);
     373                        echo "<span class='standard-label'>".$std_name."<a href='javascript:void(0)' class='remove-standard' data-id='".$standard."'><span class='dashicons dashicons-no-alt'></span></a></span>";
     374                    }
     375                }
     376                ?>
     377                <input type="hidden" name="oer_standard" value="<?php echo $oStandard; ?>" />
     378                <button id="add-new-standard" data-toggle="modal" class="ui-button components-button is-button is-default">Add Standards</button>
     379            </div>
     380   
     381        </div>
     382    <?php }
     383    } ?>
     384   
    207385        <div class="oer_snglfld oer_hdngsngl">
    208386        <?php _e("Author Information:", OER_SLUG); ?>
    209387        </div>
    210388
    211         <div class="oer_snglfld">
    212             <div class="oer_txt">
    213             <?php _e("Type:", OER_SLUG); ?>
     389        <?php
     390    // Author Type
     391    $option_set = false;
     392    if (get_option('oer_authortype_label')){
     393        $option_set = true;
     394    }
     395    if (($option_set && get_option('oer_authortype_enabled')) || !$option_set) {
     396    ?>
     397        <div class="oer_snglfld">
     398            <div class="oer_txt">
     399            <?php
     400            if (!$option_set)
     401                _e("Type:", OER_SLUG);
     402            else
     403                echo get_option('oer_authortype_label').":";
     404            ?>
    214405            </div>
    215406            <div class="oer_fld">
     
    221412            </div>
    222413        </div>
    223 
    224         <div class="oer_snglfld">
    225             <div class="oer_txt">
    226             <?php _e("Name:", OER_SLUG); ?>
     414    <?php } ?>
     415
     416    <?php
     417    // Author Name
     418    $option_set = false;
     419    if (get_option('oer_authorname_label')){
     420        $option_set = true;
     421    }
     422    if (($option_set && get_option('oer_authorname_enabled')) || !$option_set) {
     423    ?>
     424        <div class="oer_snglfld">
     425            <div class="oer_txt">
     426            <?php
     427            if (!$option_set)
     428                _e("Name:", OER_SLUG);
     429            else
     430                echo get_option('oer_authorname_label').":";
     431            ?>
    227432            </div>
    228433            <div class="oer_fld">
     
    231436            </div>
    232437        </div>
    233 
    234         <div class="oer_snglfld">
    235             <div class="oer_txt">
    236             <?php _e("URL:", OER_SLUG); ?>
     438    <?php } ?>
     439
     440    <?php
     441    // Author URL
     442    $option_set = false;
     443    if (get_option('oer_authorurl_label')){
     444        $option_set = true;
     445    }
     446    if (($option_set && get_option('oer_authorurl_enabled')) || !$option_set) {
     447    ?>
     448        <div class="oer_snglfld">
     449            <div class="oer_txt">
     450            <?php
     451            if (!$option_set)
     452                _e("URL:", OER_SLUG);
     453            else
     454                echo get_option('oer_authorurl_label').":";
     455            ?>
    237456            </div>
    238457            <div class="oer_fld">
     
    241460            </div>
    242461        </div>
    243 
    244         <div class="oer_snglfld">
    245             <div class="oer_txt">
    246             <?php _e("Email Address:", OER_SLUG); ?>
     462    <?php } ?>
     463
     464    <?php
     465    // Author Email Address
     466    $option_set = false;
     467    if (get_option('oer_authoremail_label')){
     468        $option_set = true;
     469    }
     470    if (($option_set && get_option('oer_authoremail_enabled')) || !$option_set) {
     471    ?>
     472        <div class="oer_snglfld">
     473            <div class="oer_txt">
     474            <?php
     475            if (!$option_set)
     476                _e("Email Address:", OER_SLUG);
     477            else
     478                echo get_option('oer_authoremail_label').":";
     479            ?>
    247480            </div>
    248481            <div class="oer_fld">
     
    251484            </div>
    252485        </div>
     486    <?php } ?>
    253487
    254488        <?php
     
    269503                </div>
    270504
     505                <?php
     506        // Second Author Type
     507        $option_set = false;
     508        if (get_option('oer_authortype_label')){
     509            $option_set = true;
     510        }
     511        if (($option_set && get_option('oer_authortype_enabled')) || !$option_set) {
     512        ?>
    271513                <div class="oer_snglfld">
    272514                    <div class="oer_txt">
    273             <?php _e("Type:", OER_SLUG); ?>
     515            <?php
     516            if (!$option_set)
     517                _e("Type:", OER_SLUG);
     518            else
     519                echo get_option('oer_authortype_label').":";
     520            ?>
    274521                    </div>
    275522                    <div class="oer_fld">
     
    281528                    </div>
    282529                </div>
    283 
     530        <?php } ?>
     531
     532        <?php
     533        // Second Author Name
     534        $option_set = false;
     535        if (get_option('oer_authorname_label')){
     536            $option_set = true;
     537        }
     538        if (($option_set && get_option('oer_authorname_enabled')) || !$option_set) {
     539        ?>
    284540                <div class="oer_snglfld">
    285541                    <div class="oer_txt">
    286             <?php _e("Name:", OER_SLUG); ?>
     542            <?php
     543            if (!$option_set)
     544                _e("Name:", OER_SLUG);
     545            else
     546                echo get_option('oer_authorname_label').":";
     547            ?>
    287548                    </div>
    288549                    <div class="oer_fld">
     
    291552                    </div>
    292553                </div>
    293 
     554        <?php } ?>
     555
     556        <?php
     557        // Second Author URL
     558        $option_set = false;
     559        if (get_option('oer_authorurl_label')){
     560            $option_set = true;
     561        }
     562        if (($option_set && get_option('oer_authorurl_enabled')) || !$option_set) {
     563        ?>
    294564                <div class="oer_snglfld">
    295565                    <div class="oer_txt">
    296             <?php _e("URL:", OER_SLUG); ?>
     566            <?php
     567            if (!$option_set)
     568                _e("URL:", OER_SLUG);
     569            else
     570                echo get_option('oer_authorurl_label').":";
     571            ?>
    297572                    </div>
    298573                    <div class="oer_fld">
     
    301576                    </div>
    302577                </div>
    303 
     578        <?php } ?>
     579
     580        <?php
     581        // Second Author Email Address
     582        $option_set = false;
     583        if (get_option('oer_authoremail_label')){
     584            $option_set = true;
     585        }
     586        if (($option_set && get_option('oer_authoremail_enabled')) || !$option_set) {
     587        ?>
    304588                <div class="oer_snglfld">
    305589                    <div class="oer_txt">
    306             <?php _e("Email Address:", OER_SLUG); ?>
     590            <?php
     591            if (!$option_set)
     592                _e("Email Address:", OER_SLUG);
     593            else
     594                echo get_option('oer_authoremail_label').":";
     595            ?>
    307596                    </div>
    308597                    <div class="oer_fld">
     
    311600                    </div>
    312601                </div>
     602        <?php } ?>
    313603            </div>
    314604        <?php
     
    316606        else
    317607        {
     608            $authorurl_label = "";
     609            $authorname_label = "";
     610            $authortype_label = "";
     611            $authoremail_label = "";
     612            if (get_option('oer_authortype_label'))
     613                $authortype_label = 'data-authortype-label="'.get_option('oer_authortype_label').'"';;
     614            if (get_option('oer_authorurl_label'))
     615                $authorurl_label = 'data-authorurl-label="'.get_option('oer_authorurl_label').'"';
     616            if (get_option('oer_authorname_label'))
     617                $authorname_label = 'data-authorname-label="'.get_option('oer_authorname_label').'"';;
     618            if (get_option('oer_authoremail_label'))
     619                $authoremail_label = 'data-authoremail-label="'.get_option('oer_authoremail_label').'"';;
    318620        ?>
    319621            <div class="oer_snglfld oer_hdngsngl">
    320                 <input type="button" class="button button-primary" value="<?php _e("Add Author", OER_SLUG); ?>" onClick="oer_addauthor(this);" data-url="<?php echo OER_URL.'/images/close.png'?>" />
     622                <input type="button" class="button button-primary" value="<?php _e("Add Author", OER_SLUG); ?>" onClick="oer_addauthor(this);" <?php echo $authorurl_label; ?> <?php echo $authorname_label; ?> <?php echo $authortype_label; ?> <?php echo $authoremail_label; ?> data-url="<?php echo OER_URL.'/images/close.png'?>" />
    321623            </div>
    322624        <?php
     
    328630        </div>
    329631
    330         <div class="oer_snglfld">
    331             <div class="oer_txt">
    332             <?php _e("Name:", OER_SLUG); ?>
    333             </div>
    334             <div class="oer_fld">
    335                 <?php $oer_publishername = get_post_meta($post->ID, 'oer_publishername', true);?>
    336                 <input type="text" name="oer_publishername" value="<?php echo esc_attr($oer_publishername);?>" />
    337             </div>
    338         </div>
    339 
    340         <div class="oer_snglfld">
    341             <div class="oer_txt">
    342             <?php _e("URL:", OER_SLUG); ?>
    343             </div>
    344             <div class="oer_fld">
    345                 <?php $oer_publisherurl = get_post_meta($post->ID, 'oer_publisherurl', true);?>
    346                 <input type="text" name="oer_publisherurl" value="<?php echo esc_attr($oer_publisherurl);?>" />
    347             </div>
    348         </div>
    349 
    350         <div class="oer_snglfld">
    351             <div class="oer_txt">
    352             <?php _e("Email Address:", OER_SLUG); ?>
     632        <?php
     633    // Publisher Name
     634    $option_set = false;
     635    if (get_option('oer_publishername_label')){
     636        $option_set = true;
     637    }
     638    if (($option_set && get_option('oer_publishername_enabled')) || !$option_set) {
     639    ?>
     640        <div class="oer_snglfld">
     641            <div class="oer_txt">
     642            <?php
     643            if (!$option_set)
     644                _e("Name:", OER_SLUG);
     645            else
     646                echo get_option('oer_publishername_label').":";
     647            ?>
     648        </div>
     649        <div class="oer_fld">
     650            <?php $oer_publishername = get_post_meta($post->ID, 'oer_publishername', true);?>
     651            <input type="text" name="oer_publishername" value="<?php echo esc_attr($oer_publishername);?>" />
     652        </div>
     653        </div>
     654    <?php } ?>
     655
     656    <?php
     657    // Publisher URL
     658    $option_set = false;
     659    if (get_option('oer_publisherurl_label')){
     660        $option_set = true;
     661    }
     662    if (($option_set && get_option('oer_publisherurl_enabled')) || !$option_set) {
     663    ?>
     664        <div class="oer_snglfld">
     665            <div class="oer_txt">
     666            <?php
     667            if (!$option_set)
     668                _e("URL:", OER_SLUG);
     669            else
     670                echo get_option('oer_publisherurl_label').":";
     671            ?>
     672        </div>
     673        <div class="oer_fld">
     674            <?php $oer_publisherurl = get_post_meta($post->ID, 'oer_publisherurl', true);?>
     675            <input type="text" name="oer_publisherurl" value="<?php echo esc_attr($oer_publisherurl);?>" />
     676        </div>
     677        </div>
     678    <?php } ?>
     679
     680    <?php
     681    // Publisher Email Address
     682    $option_set = false;
     683    if (get_option('oer_publisheremail_label')){
     684        $option_set = true;
     685    }
     686    if (($option_set && get_option('oer_publisheremail_enabled')) || !$option_set) {
     687    ?>
     688        <div class="oer_snglfld">
     689            <div class="oer_txt">
     690            <?php
     691            if (!$option_set)
     692                _e("Email Address:", OER_SLUG);
     693            else
     694                echo get_option('oer_publisheremail_label').":";
     695            ?>
    353696            </div>
    354697            <div class="oer_fld">
     
    357700            </div>
    358701        </div>
    359 
     702    <?php } ?>
     703
     704    <?php
     705    // Citation
     706    $option_set = false;
     707    if (get_option('oer_citation_label')){
     708        $option_set = true;
     709    }
     710    if (($option_set && get_option('oer_citation_enabled')) || !$option_set) {
     711    ?>
     712    <div class="oer_snglfld">
     713            <div class="oer_txt">
     714            <?php
     715            if (!$option_set)
     716                _e("Citation:", OER_SLUG);
     717            else
     718                echo get_option('oer_citation_label').":";
     719            ?>
     720            </div>
     721            <div class="oer_fld">
     722                <?php   $oer_citation = get_post_meta($post->ID, 'oer_citation', true);
     723            wp_editor( $oer_citation, 'oer_citation', array( "wpautop" => true, "media_buttons"  => true, 'textarea_name' => 'oer_citation', 'textarea_rows' => 10,  "tinymce" => true, 'teeny' => true ) ); ?>
     724            </div>
     725        </div><!-- Citation Section -->
     726    <?php } ?>
     727   
     728    <?php
     729    // Sensitive Material Warning
     730    $option_set = false;
     731    if (get_option('oer_sensitive_material_label')){
     732        $option_set = true;
     733    }
     734    if (($option_set && get_option('oer_sensitive_material_enabled')) || !$option_set) {
     735    ?>
     736    <div class="oer_snglfld">
     737            <div class="oer_txt">
     738            <?php
     739            if (!$option_set)
     740                _e("Sensitive Material Warning:", OER_SLUG);
     741            else
     742                echo get_option('oer_sensitive_material_label').":";
     743            ?>
     744            </div>
     745            <div class="oer_fld">
     746                <?php   $oer_sensitive_material = get_post_meta($post->ID, 'oer_sensitive_material', true);
     747            wp_editor( $oer_sensitive_material, 'oer_sensitive_material', array( "wpautop" => false, "media_buttons"  => true, "tinymce" => true, 'teeny' => true ) ); ?>
     748            </div>
     749        </div><!-- Sensitive Material Warning field -->
     750    <?php } ?>
     751   
     752    <?php
     753    // Transcription
     754    $option_set = false;
     755    if (get_option('oer_transcription_label')){
     756        $option_set = true;
     757    }
     758    if (($option_set && get_option('oer_transcription_enabled')) || !$option_set) {
     759    ?>
     760    <div class="oer_snglfld">
     761            <div class="oer_txt">
     762            <?php
     763            if (!$option_set)
     764                _e("Transcription:", OER_SLUG);
     765            else
     766                echo get_option('oer_transcription_label').":";
     767            ?>
     768            </div>
     769            <div class="oer_fld">
     770                <?php   $oer_transcription = get_post_meta($post->ID, 'oer_transcription', true);
     771            wp_editor( $oer_transcription, 'oer_transcription', array( "wpautop" => false, "media_buttons"  => true, "tinymce" => true, 'teeny' => true ) ); ?>
     772            </div>
     773        </div><!-- Transcription field -->
     774    <?php } ?>
    360775    </div>
    361776</div>
  • wp-oer/trunk/includes/settings.php

    r1971883 r2163735  
    135135        <a href="?post_type=resource&page=oer_settings&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">General</a>
    136136        <a href="?post_type=resource&page=oer_settings&tab=styles" class="nav-tab <?php echo $active_tab == 'styles' ? 'nav-tab-active' : ''; ?>">Styles</a>
     137    <a href="?post_type=resource&page=oer_settings&tab=metadata" class="nav-tab <?php echo $active_tab == 'metadata' ? 'nav-tab-active' : ''; ?>">Metadata Fields</a>
    137138    <?php if ($active_tab=="setup") { ?>
    138139        <a href="?post_type=resource&page=oer_settings&tab=setup" class="nav-tab <?php echo $active_tab == 'setup' ? 'nav-tab-active' : ''; ?>">Setup</a>
     
    151152            oer_show_styles_settings();
    152153            break;
     154        case "metadata":
     155            oer_show_metadata_settings();
     156            break;
    153157        case "setup":
    154158            oer_show_setup_settings();
     
    238242}
    239243
     244function oer_show_metadata_settings() {
     245    $metas = oer_get_all_meta("resource");
     246    $metadata = null;
     247   
     248    foreach($metas as $met){
     249        if (strpos($met['meta_key'],"oer_")!==false){
     250            $metadata[] = $met['meta_key'];
     251        }
     252    }
     253   
     254    $meta = array_unique($metadata);
     255   
     256    // Save Option
     257    if ($_POST){
     258        if ($_REQUEST['tab'] && $_REQUEST['tab']=="metadata") {
     259            // Remove meta key enabled option
     260            foreach($metas as $met){
     261                if (strpos($met['meta_key'],"oer_")!==false){
     262                    delete_option($met['meta_key']."_enabled");
     263                }
     264            }
     265            oer_save_metadata_options($_POST);
     266        }
     267    }
     268?>
     269<div class="oer-plugin-body">
     270    <div class="oer-plugin-row">
     271        <div class="oer-row-left">
     272            <?php _e("Use the options below to update metadata field options.", OER_SLUG); ?>
     273        </div>
     274        <div class="oer-row-right">
     275        </div>
     276    </div>
     277    <div class="oer-plugin-row">
     278        <form method="post" class="oer_settings_form" onsubmit="return processInitialSettings(this)">
     279            <table class="table">
     280                <thead>
     281                    <tr>
     282                        <th>Field Name</th>
     283                        <th>Label</th>
     284                        <th>Enabled</th>
     285                    </tr>
     286                </thead>
     287                <tbody>
     288                    <?php foreach($meta as $key) {
     289                        $label = "";
     290                        $enabled = "0";
     291                        $option_set = false;
     292                        if ($key!=="oer_resourceurl"){
     293                            if (get_option($key."_label")){
     294                                $label = get_option($key."_label");
     295                                $option_set = true;
     296                            }
     297                            else
     298                                $label = oer_get_meta_label($key);
     299                           
     300                            if (get_option($key."_enabled"))
     301                                $enabled = (get_option($key."_enabled")=="1")?true:false;
     302                            elseif ($option_set==false)
     303                                $enabled = "1";
     304                           
     305                    ?>
     306                    <tr>
     307                        <td><?php echo $key; ?></td>
     308                        <td><input type="text" name="<?php echo $key."_label"; ?>" value="<?php echo $label; ?>" /></td>
     309                        <td><input type="checkbox" name="<?php echo $key."_enabled"; ?>" value="1" <?php checked($enabled,"1",true); ?>/></td>
     310                    </tr>
     311                    <?php   }
     312                    } ?>
     313                </tbody>
     314            </table>
     315            <?php submit_button("Save Metadata Options"); ?>
     316        </form>
     317    </div>
     318</div>
     319<?php
     320}
     321
    240322function oer_show_setup_settings() {
    241323    global $message, $type;
  • wp-oer/trunk/js/back_scripts.js

    r1971883 r2163735  
     1var formfield, invoker;
    12jQuery(document).ready(function(e) {
    23    jQuery( ".oer_datepicker" ).datepicker( { dateFormat: 'MM d, yy' } );
     
    2425
    2526    /* Callback after calling media upload */
    26     window.send_to_editor = function(html) {
    27         imgurl = jQuery('img',html).attr('src');
    28         jQuery("#"+formfield).val(imgurl);
    29         if (jQuery("."+invoker+"_img").length>0) {
    30             jQuery("."+invoker+"_img").remove();
    31         }
    32         jQuery("#"+invoker).before('<div class="' + invoker + '_img">'+html+'</div>');
    33         jQuery("#remove_"+invoker).removeClass("hidden");
    34         tb_remove();
     27    if (typeof formfield !== "undefined") {
     28        window.send_to_editor = function(html) {
     29            imgurl = jQuery('img',html).attr('src');
     30            jQuery("#"+formfield).val(imgurl);
     31            if (jQuery("."+invoker+"_img").length>0) {
     32                jQuery("."+invoker+"_img").remove();
     33            }
     34            jQuery("#"+invoker).before('<div class="' + invoker + '_img">'+html+'</div>');
     35            jQuery("#remove_"+invoker).removeClass("hidden");
     36            tb_remove();   
     37        }
    3538    }
    3639   
     
    4851        jQuery(this).addClass('hidden');
    4952    });
     53   
     54    jQuery('.remove-standard').on('focus', function(){
     55        var std = jQuery(this);
     56        var std_id = std.attr('data-id');
     57        std.parent().remove();
     58        jQuery(".stndrd_ttl input[value='"+std_id+"']").attr('checked',false);
     59    });
     60    jQuery('#add-new-standard').on('click', function(e){
     61        e.preventDefault();
     62        jQuery('#standardModal').modal({
     63                    backdrop: 'static',
     64                    keyboard: false
     65                })
     66    });
     67    jQuery('#standardModal').on('click', "#btnSaveStandards", function(e){
     68        e.preventDefault();
     69        var selected = [];
     70                var selectedHtml = "";
     71        jQuery('#add-new-standard').prevAll('.standard-label').remove();
     72        jQuery.each(jQuery('#standardModal input[type=checkbox]:checked'), function(){
     73            var sId = jQuery(this).val();
     74            var title = jQuery(this).next('.oer_stndrd_desc').text();
     75            console.log(sId);
     76            console.log(title);
     77            displaySelectedStandard(sId, title);
     78            selected.push(sId);
     79        });
     80        var standards = selected.join();
     81        jQuery(".oer_metainrwpr input[name='oer_standard']").val(standards);
     82        jQuery(".search-standard-text").val("");
     83        displaydefaultStandards();
     84        jQuery("#standardModal").modal('hide');
     85    });
     86    jQuery('.search_close_btn').on("click", function(e){
     87        displaydefaultStandards();
     88    });
     89   
     90    if (typeof wp.data !== "undefined") {
     91        wp.data.subscribe(function(){
     92            var isSavingPost = wp.data.select('core/editor').isSavingPost();
     93            var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost();
     94           
     95            if (isSavingPost && !isAutosavingPost) {
     96                window.tinyMCE.triggerSave();
     97            }
     98        });
     99    }
    50100});
    51101
    52 
     102function displaySelectedStandard(sId, title) {
     103    jQuery('#add-new-standard').before("<span class='standard-label'>" + title + "<a href='javascript:void(0)' class='remove-standard' data-id='" + sId + "'><span class='dashicons dashicons-no-alt'></span></a></span>");
     104}
     105
     106function displaydefaultStandards() {
     107    $('#standardModal #oer_standards_list').show();
     108    $('#standardModal #oer_search_results_list').hide();
     109}
    53110
    54111//adding author
    55112function oer_addauthor(ref)
    56113{
     114    var author_label = 'URL:';
     115    var author_name_label = 'Name:';
     116    var author_type_label = 'Type:';
     117    var author_email_label = 'Email Address:';
    57118    var img_url = jQuery(ref).attr('data-url');
    58     jQuery(ref).parent('.oer_hdngsngl').after('<div class="oer_authrcntr"><div class="oer_cls" onClick="oer_removeauthor(this);"><img src="'+img_url+'" /></div><div class="oer_snglfld"><div class="oer_txt">Type:</div><div class="oer_fld"><select name="oer_authortype2"><option value="person">Person</option><option value="organization">Organization</option></select></div></div><div class="oer_snglfld"><div class="oer_txt">Name:</div><div class="oer_fld"><input type="text" name="oer_authorname2" value="" /></div></div><div class="oer_snglfld"><div class="oer_txt">URL:</div><div class="oer_fld"><input type="text" name="oer_authorurl2" value="" /></div></div><div class="oer_snglfld"><div class="oer_txt">Email Address:</div><div class="oer_fld"><input type="text" name="oer_authoremail2" value="" /></div></div></div>');
     119    var author_url = jQuery(ref).attr('data-authorurl-label');
     120    var author_name = jQuery(ref).attr('data-authorname-label');
     121    var author_type = jQuery(ref).attr('data-authortype-label');
     122    var author_email = jQuery(ref).attr('data-authoremail-label');
     123    if (typeof author_url !== 'undefined') {
     124        author_label = author_url + ':';
     125    }
     126    if (typeof author_name !== 'undefined') {
     127        author_name_label = author_name + ':';
     128    }
     129    if (typeof author_type !== 'undefined') {
     130        author_type_label = author_type + ':';
     131    }
     132    if (typeof author_email !== 'undefined') {
     133        author_email_label = author_email + ':';
     134    }
     135    var show_author = '<div class="oer_authrcntr"><div class="oer_cls" onClick="oer_removeauthor(this);"><img src="'+img_url+'" /></div><div class="oer_snglfld"><div class="oer_txt">' + author_type_label + '</div><div class="oer_fld"><select name="oer_authortype2"><option value="person">Person</option><option value="organization">Organization</option></select></div></div><div class="oer_snglfld"><div class="oer_txt">' + author_name_label + '</div><div class="oer_fld"><input type="text" name="oer_authorname2" value="" /></div></div><div class="oer_snglfld"><div class="oer_txt">' + author_label + '</div><div class="oer_fld"><input type="text" name="oer_authorurl2" value="" /></div></div><div class="oer_snglfld"><div class="oer_txt">' + author_email_label + '</div><div class="oer_fld"><input type="text" name="oer_authoremail2" value="" /></div></div></div>';
     136    jQuery(ref).parent('.oer_hdngsngl').after(show_author);
    59137    jQuery(ref).parent('.oer_hdngsngl').html('Author Information:');
    60138}
  • wp-oer/trunk/js/oer_admin.js

    r1714161 r2163735  
    2020        return false;
    2121    });
     22   
     23    $('.search-standard-text').on("keypress", function(e){
     24        if (e.which == 13) {
     25            if ($(this).val().length>0) {
     26                $('.search_std_btn').click();
     27            } else {
     28                displaydefaultStandards();
     29            }
     30        }
     31    });
     32   
     33    /**
     34     *
     35     * Search Standard Button Click
     36     *
     37     **/
     38    $('.search_std_btn').on("click", function(){
     39        data = {
     40            action: 'load_searched_standards',
     41            post_id: $(this).attr('data-postid'),
     42            keyword: $('.search-standard-text').val()
     43        }
     44       
     45        //* Process the AJAX POST request
     46        $.post(
     47                       ajaxurl,
     48                       data
     49               ).done( function(response) {
     50            list = $('#standardModal #oer_search_results_list .search_results_list');
     51            list.html("");
     52            list.html(response);
     53            $('#standardModal #oer_standards_list').hide();
     54            $('#standardModal #oer_search_results_list').show();
     55            });
     56
     57        return false;
     58    });
    2259});
  • wp-oer/trunk/oer_template/single-resource-standard.php

    r1971883 r2163735  
    8888    <?php } ?>
    8989   
    90     <?php if ($youtube) { ?>
    91         <div class="oer-rsrcurl oer-cbxl"><h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?></a></h4></div>
    92     <?php } else { ?>
    93         <div class="oer-rsrcurl oer-cbxl"><h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo $url_domain; ?></a></h4></div>
     90    <!-- Transcription -->
     91    <?php
     92    $oer_transcription = get_post_meta($post->ID, 'oer_transcription', true);
     93    if (!empty($oer_transcription)){
     94        $option_set = false;
     95        if (get_option('oer_transcription_label'))
     96            $option_set = true;
     97        ?>
     98        <div class="oer-sngl-rsrc-dscrptn">
     99                <h2><?php
     100                if (!$option_set)
     101                    _e("Transcription", OER_SLUG);
     102                else
     103                    echo get_option('oer_transcription_label');
     104                ?></h2>
     105                <?php echo $oer_transcription; ?>
     106        </div>
     107        <?php
     108    }
     109    ?>
     110   
     111    <!-- Sensitive Material Warning -->
     112    <?php
     113    $oer_sensitive_material = get_post_meta($post->ID, 'oer_sensitive_material', true);
     114    if (!empty($oer_sensitive_material)){
     115        $option_set = false;
     116    if (get_option('oer_sensitive_material_label'))
     117        $option_set = true;
     118        ?>
     119        <div class="oer-sngl-rsrc-dscrptn">
     120                <h2><?php
     121                if (!$option_set)
     122                    _e("Sensitive Material Warning", OER_SLUG);
     123                else
     124                    echo get_option('oer_sensitive_material_label');
     125                ?></h2>
     126                <?php echo $oer_sensitive_material; ?>
     127        </div>
     128        <?php
     129    }
     130    ?>
     131   
     132    <?php
     133    $oer_resourceurl = get_post_meta($post->ID, "oer_resourceurl", true);
     134    if (!empty($oer_resourceurl)) {
     135    ?>
     136        <?php if ($youtube) { ?>
     137            <div class="oer-rsrcurl oer-cbxl"><h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?></a></h4></div>
     138        <?php } else { ?>
     139            <div class="oer-rsrcurl oer-cbxl"><h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo $url_domain; ?></a></h4></div>
     140        <?php } ?>
    94141    <?php } ?>
    95142
     
    98145        $oer_authorname = get_post_meta($post->ID, "oer_authorname", true);
    99146        $oer_authorurl = get_post_meta($post->ID, "oer_authorurl", true);
    100 
    101         if(!empty($oer_authorname) && !empty($oer_authorurl))
     147        $oer_authorname2 = get_post_meta($post->ID, "oer_authorname2", true);
     148        $oer_authorurl2 = get_post_meta($post->ID, "oer_authorurl2", true);
     149
     150        if(!empty($oer_authorname) || !empty($oer_authorname2))
    102151        {
    103         ?>
    104             <h4><strong><?php _e("Creator:", OER_SLUG) ?></strong>
    105             <span><a href="<?php echo esc_url($oer_authorurl); ?>" target="_blank"><?php echo $oer_authorname; ?></a></span></h4>
     152            $option_set = false;
     153            if (get_option('oer_authorname_label'))
     154                $option_set = true;
     155        ?>
     156            <h4><strong><?php
     157            if (!$option_set)
     158                _e("Creator:", OER_SLUG);
     159        else
     160        echo get_option('oer_authorname_label').":"; ?></strong>
     161            <span><?php if (!empty($oer_authorurl)): ?><a href="<?php echo esc_url($oer_authorurl); ?>" target="_blank"><?php endif; ?><?php echo $oer_authorname; ?><?php if (!empty($oer_authorurl)): ?></a><?php endif; ?></span>
     162            <?php if ($oer_authorname2): echo ", "; ?>
     163            <span><?php if (!empty($oer_authorurl2)): ?><a href="<?php echo esc_url($oer_authorurl2); ?>" target="_blank"><?php endif; ?><?php echo $oer_authorname2; ?><?php if (!empty($oer_authorurl2)): ?></a><?php endif; ?></span>
     164            <?php endif; ?>
     165            </h4>
    106166        <?php } ?>
    107167    </div>
     
    112172    if(!empty($oer_publishername) && !empty($oer_publisherurl))
    113173    {
    114     ?>
    115     <div id="" class="oer-publisherName oer-cbxl">
    116         <h4><strong><?php _e("Publisher:", OER_SLUG) ?></strong>
     174        $option_set = false;
     175    if (get_option('oer_publishername_label'))
     176        $option_set = true;
     177    ?><div id="" class="oer-publisherName oer-cbxl">
     178        <h4><strong><?php
     179        if (!$option_set)
     180            _e("Publisher:", OER_SLUG);
     181        else
     182            echo get_option('oer_publishername_label').":";
     183        ?></strong>
    117184        <span><a href="<?php echo esc_url($oer_publisherurl); ?>" target="_blank"><?php echo $oer_publishername; ?></a></span></h4>
    118185    </div>
    119186    <?php } ?>
     187   
     188    <!-- Date Created Estimate -->
     189    <?php
     190    $oer_datecreated_estimate = get_post_meta($post->ID, 'oer_datecreated_estimate', true);
     191    if (!empty($oer_datecreated_estimate)){ ?>
     192    <div id="oerDateCreatedEstimate" class="oer-dateCreatedEstimate oer-cbxl">
     193        <?php
     194        $option_set = false;
     195        if (get_option('oer_datecreated_estimate_label'))
     196            $option_set = true;
     197        ?>
     198        <h4><strong><?php
     199        if (!$option_set)
     200            _e("Date Created Estimate:", OER_SLUG);
     201        else
     202            echo get_option('oer_datecreated_estimate_label').":";
     203        ?></strong>
     204        <span><?php echo $oer_datecreated_estimate; ?></span></h4>
     205    </div>
     206    <?php } ?>
     207   
    120208    <div id="" class="oer-mediaType oer-cbxl">
    121209        <?php
    122210            $oer_mediatype = get_post_meta($post->ID, "oer_mediatype", true);
    123211            if(!empty($oer_mediatype))
    124             { ?>
    125                 <h4><strong><?php _e("Type:", OER_SLUG) ?></strong>
     212            {
     213                $option_set = false;
     214                if (get_option('oer_mediatype_label'))
     215                        $option_set = true;
     216                ?>
     217                <h4><strong><?php
     218                if (!$option_set)
     219                _e("Type:", OER_SLUG);
     220            else
     221                echo get_option('oer_mediatype_label').":";
     222                ?></strong>
    126223                <span><?php echo ucwords($oer_mediatype); ?></span></h4>
    127224        <?php } ?>
    128225    </div>
     226   
     227    <!-- Format -->
     228    <?php
     229    $oer_format = get_post_meta($post->ID, 'oer_format', true);
     230    if (!empty($oer_format)){ ?>
     231    <div id="oerFormat" class="oer-Format oer-cbxl">
     232        <?php
     233        $option_set = false;
     234        if (get_option('oer_format_label'))
     235            $option_set = true;
     236        ?>
     237        <h4><strong><?php
     238        if (!$option_set)
     239            _e("Format:", OER_SLUG);
     240        else
     241            echo get_option('oer_format_label').":";
     242        ?></strong>
     243        <span><?php echo $oer_format; ?></span></h4>
     244    </div>
     245    <?php } ?>
     246   
     247    <!-- Citation -->
     248    <?php
     249    $oer_citation = get_post_meta($post->ID, 'oer_citation', true);
     250    if (!empty($oer_citation)){ ?>
     251    <div id="oerCitation" class="oer-Citation oer-cbxl">
     252        <?php
     253        $option_set = false;
     254        if (get_option('oer_citation_label'))
     255            $option_set = true;
     256        ?>
     257        <h4><strong><?php
     258        if (!$option_set)
     259            _e("Citation:", OER_SLUG);
     260        else
     261            echo get_option('oer_citation_label').":";
     262        ?></strong>
     263        <span><?php echo $oer_citation; ?></span></h4>
     264    </div>
     265    <?php } ?>
     266   
    129267    <?php
    130268    $grades =  trim(get_post_meta($post->ID, "oer_grade", true),",");
     
    133271    if(is_array($grades) && !empty($grades) && array_filter($grades))
    134272    {
     273        $option_set = false;
     274    if (get_option('oer_grade_label'))
     275        $option_set = true;
    135276    ?>
    136277        <div class="oer-rsrcgrd oer-cbxl">
    137278            <h4><strong><?php
    138             if (count($grades)>1)
    139                 _e("Grades:", OER_SLUG);
    140             else
    141                 _e("Grade:", OER_SLUG)
     279            if (!$option_set){
     280                if (count($grades)>1)
     281                    _e("Grades:", OER_SLUG);
     282                else
     283                    _e("Grade:", OER_SLUG);
     284            } else
     285                    echo get_option('oer_grade_label').":";
    142286            ?></strong>
    143287            <span>
     
    193337            if(!empty($oer_datecreated))
    194338            {
     339                $option_set = false;
     340                if (get_option('oer_datecreated_label'))
     341                        $option_set = true;
    195342            ?>
    196     <div class="oer-created oer-cbxl">
    197         <h4><strong>Created:</strong>
     343        <div class="oer-created oer-cbxl">
     344        <h4><strong><?php
     345        if (!$option_set)
     346                _e("Created:", OER_SLUG);
     347        else
     348                echo get_option('oer_datecreated_label').":";
     349        ?></strong>
    198350        <span><?php echo $oer_datecreated; ?></span></h4>
    199351    </div>
     
    318470                            if(!empty($stdrd_id) || !empty($oer_standards))
    319471                            {
     472                                $option_set = false;
     473                                if (get_option('oer_standard_label'))
     474                                        $option_set = true;
    320475                    ?>
    321476            <div class="alignedStandards">
    322             <h2><?php _e("Standards Alignment", OER_SLUG) ?></h2>
     477            <h2><?php
     478            if (!$option_set)
     479        _e("Standards Alignment", OER_SLUG);
     480        else
     481                echo get_option('oer_standard_label').":";
     482            ?></h2>
    323483            <div class="oer_meta_container">
    324484                <!--<div class="oer_stndrd_align">-->
     
    365525                                        echo "<div class='oer_sngl_stndrd'>";
    366526                                            if (strpos($table_name,"sub_standards")>0) {
    367                                                     echo "<span class='oer_sngl_description'>".$res['standard_title']."</span>";
     527                                                    echo "<span class='oer_sngl_description'>".stripslashes($res['standard_title'])."</span>";
    368528                                            } else {
    369529                                                    echo "<span class='oer_sngl_notation'>".$res['standard_notation']."</span>";
    370                                                     echo "<span class='oer_sngl_description'>".$res['description']."</span>";
     530                                                    echo "<span class='oer_sngl_description'>".stripslashes($res['description'])."</span>";
    371531                                            }
    372532                                        echo "</div>";
  • wp-oer/trunk/oer_template/single-resource-youtube.php

    r1971883 r2163735  
    3030        <?php } ?>
    3131       
    32        
    33         <div class="oer-rsrcurl oer-cbxl"><h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?></a></h4></div>
     32        <!-- Transcription -->
     33        <?php
     34        $oer_transcription = get_post_meta($post->ID, 'oer_transcription', true);
     35        if (!empty($oer_transcription)){
     36            $option_set = false;
     37            if (get_option('oer_transcription_label'))
     38                $option_set = true;
     39            ?>
     40            <div class="oer-sngl-rsrc-dscrptn">
     41                    <h2><?php
     42                    if (!$option_set)
     43                        _e("Transcription", OER_SLUG);
     44                    else
     45                        echo get_option('oer_transcription_label');
     46                    ?></h2>
     47                    <?php echo $oer_transcription; ?>
     48            </div>
     49            <?php
     50        }
     51        ?>
     52       
     53        <!-- Sensitive Material Warning -->
     54        <?php
     55        $oer_sensitive_material = get_post_meta($post->ID, 'oer_sensitive_material', true);
     56        if (!empty($oer_sensitive_material)){
     57            $option_set = false;
     58            if (get_option('oer_sensitive_material_label'))
     59                $option_set = true;
     60            ?>
     61            <div class="oer-sngl-rsrc-dscrptn">
     62                    <h2><?php
     63                    if (!$option_set)
     64                        _e("Sensitive Material Warning", OER_SLUG);
     65                    else
     66                        echo get_option('oer_sensitive_material_label');
     67                    ?></h2>
     68                    <?php echo $oer_sensitive_material; ?>
     69            </div>
     70            <?php
     71        }
     72        ?>
     73       
     74        <?php
     75        $oer_resourceurl = get_post_meta($post->ID, "oer_resourceurl", true);
     76        if (!empty($oer_resourceurl)) {
     77        ?>
     78        <div class="oer-rsrcurl oer-cbxl">
     79                <h4><strong>Original Resource:</strong> <a href="<?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?>" target="_blank" ><?php echo esc_url(get_post_meta($post->ID, "oer_resourceurl", true)); ?></a></h4>
     80        </div>
     81        <?php } ?>
    3482    </div>
    3583    <div class="oer-rsrcrghtcntr col-md-6 col-sm-12 col-xs-12">
     
    52100        $oer_authorname = get_post_meta($post->ID, "oer_authorname", true);
    53101        $oer_authorurl = get_post_meta($post->ID, "oer_authorurl", true);
    54 
    55         if(!empty($oer_authorname) && !empty($oer_authorurl))
     102        $oer_authorname2 = get_post_meta($post->ID, "oer_authorname2", true);
     103        $oer_authorurl2 = get_post_meta($post->ID, "oer_authorurl2", true);
     104
     105        if(!empty($oer_authorname) && !empty($oer_authorname2))
    56106        {
    57         ?>
    58             <h4><strong><?php _e("Creator:", OER_SLUG) ?></strong>
    59             <span><a href="<?php echo esc_url($oer_authorurl); ?>" target="_blank"><?php echo $oer_authorname; ?></a></span></h4>
     107                $option_set = false;
     108                if (get_option('oer_authorname_label'))
     109                        $option_set = true;
     110        ?>
     111            <h4><strong><?php
     112                if (!$option_set)
     113                        _e("Creator:", OER_SLUG);
     114        else
     115            echo get_option('oer_authorname_label').":";
     116                 ?>
     117                </strong>
     118            <span><?php if (!empty($oer_authorurl)): ?><a href="<?php echo esc_url($oer_authorurl); ?>" target="_blank"><?php endif; ?><?php echo $oer_authorname; ?><?php if (!empty($oer_authorurl)): ?></a><?php endif; ?></span>
     119            <?php if ($oer_authorname2): echo ", "; ?>
     120            <span><?php if (!empty($oer_authorurl2)): ?><a href="<?php echo esc_url($oer_authorurl2); ?>" target="_blank"><?php endif; ?><?php echo $oer_authorname2; ?><?php if (!empty($oer_authorurl2)): ?></a><?php endif; ?></span>
     121            <?php endif; ?>
     122            </h4>
    60123        <?php } ?>
    61124    </div>
     
    66129    if(!empty($oer_publishername) && !empty($oer_publisherurl))
    67130    {
     131        $option_set = false;
     132    if (get_option('oer_publishername_label'))
     133        $option_set = true;
    68134    ?>
    69135    <div id="" class="oer-publisherName oer-cbxl">
    70         <h4><strong><?php _e("Publisher:", OER_SLUG) ?></strong>
     136        <h4><strong><?php
     137                if (!$option_set)
     138                        _e("Publisher:", OER_SLUG);
     139                else
     140                        echo get_option('oer_publishername_label').":";
     141        ?></strong>
    71142        <span><a href="<?php echo esc_url($oer_publisherurl); ?>" target="_blank"><?php echo $oer_publishername; ?></a></span></h4>
    72143    </div>
    73144    <?php } ?>
     145   
     146        <!-- Date Created Estimate -->
     147        <?php
     148        $oer_datecreated_estimate = get_post_meta($post->ID, 'oer_datecreated_estimate', true);
     149        if (!empty($oer_datecreated_estimate)){ ?>
     150        <div id="oerDateCreatedEstimate" class="oer-dateCreatedEstimate oer-cbxl">
     151            <?php
     152            $option_set = false;
     153            if (get_option('oer_datecreated_estimate_label'))
     154                $option_set = true;
     155            ?>
     156            <h4><strong><?php
     157            if (!$option_set)
     158                _e("Date Created Estimate:", OER_SLUG);
     159            else
     160                echo get_option('oer_datecreated_estimate_label').":";
     161            ?></strong>
     162            <span><?php echo $oer_datecreated_estimate; ?></span></h4>
     163        </div>
     164         <?php } ?>
     165   
    74166    <div id="" class="oer-mediaType oer-cbxl">
    75167        <?php
    76168            $oer_mediatype = get_post_meta($post->ID, "oer_mediatype", true);
    77169            if(!empty($oer_mediatype))
    78             { ?>
    79                 <h4><strong><?php _e("Type:", OER_SLUG) ?></strong>
     170            {
     171                $option_set = false;
     172                if (get_option('oer_mediatype_label'))
     173                        $option_set = true;
     174                ?>
     175                <h4><strong><?php
     176                        if (!$option_set)
     177                _e("Type:", OER_SLUG);
     178            else
     179                echo get_option('oer_mediatype_label').":";
     180                ?></strong>
    80181                <span><?php echo ucwords($oer_mediatype); ?></span></h4>
    81182        <?php } ?>
    82183    </div>
     184   
     185        <!-- Format -->
     186        <?php
     187        $oer_format = get_post_meta($post->ID, 'oer_format', true);
     188        if (!empty($oer_format)){ ?>
     189        <div id="oerFormat" class="oer-Format oer-cbxl">
     190        <?php
     191            $option_set = false;
     192            if (get_option('oer_format_label'))
     193                $option_set = true;
     194            ?>
     195            <h4><strong><?php
     196            if (!$option_set)
     197                _e("Format:", OER_SLUG);
     198            else
     199                echo get_option('oer_format_label').":";
     200            ?></strong>
     201            <span><?php echo $oer_format; ?></span></h4>
     202        </div>
     203        <?php } ?>
     204       
     205        <!-- Citation -->
     206        <?php
     207        $oer_citation = get_post_meta($post->ID, 'oer_citation', true);
     208        if (!empty($oer_citation)){ ?>
     209        <div id="oerCitation" class="oer-Citation oer-cbxl">
     210            <?php
     211            $option_set = false;
     212            if (get_option('oer_citation_label'))
     213                $option_set = true;
     214            ?>
     215            <h4><strong><?php
     216            if (!$option_set)
     217                _e("Citation:", OER_SLUG);
     218            else
     219                echo get_option('oer_citation_label').":";
     220            ?></strong>
     221            <span><?php echo $oer_citation; ?></span></h4>
     222        </div>
     223        <?php } ?>
     224   
    83225    <?php
    84226    $grades =  trim(get_post_meta($post->ID, "oer_grade", true),",");
     
    87229    if(is_array($grades) && !empty($grades) && array_filter($grades))
    88230    {
     231        $option_set = false;
     232    if (get_option('oer_grade_label'))
     233        $option_set = true;
    89234    ?>
    90235        <div class="oer-rsrcgrd oer-cbxl">
    91236            <h4><strong><?php
    92             if (count($grades)>1)
    93                 _e("Grades:", OER_SLUG);
    94             else
    95                 _e("Grade:", OER_SLUG)
     237                if (!$option_set){
     238                        if (count($grades)>1)
     239                                _e("Grades:", OER_SLUG);
     240                        else
     241                                _e("Grade:", OER_SLUG);
     242                } else
     243            echo get_option('oer_grade_label').":";
     244           
    96245            ?></strong>
    97246            <span>
     
    147296            if(!empty($oer_datecreated))
    148297            {
     298                $option_set = false;
     299                if (get_option('oer_datecreated_label'))
     300                        $option_set = true;
    149301            ?>
    150302    <div class="oer-created oer-cbxl">
    151         <h4><strong>Created:</strong>
     303        <h4><strong><?php
     304        if (!$option_set)
     305                _e("Created:", OER_SLUG);
     306        else
     307                echo get_option('oer_datecreated_label').":";
     308        ?></strong>
    152309        <span><?php echo $oer_datecreated; ?></span></h4>
    153310    </div>
  • wp-oer/trunk/open-educational-resources.php

    r1982801 r2163735  
    44 Plugin URI:   https://www.wp-oer.com
    55 Description:  Open Educational Resource management and curation, metadata publishing, and alignment to Common Core State Standards.
    6  Version:      0.6.7
     6 Version:      0.7.0
    77 Author:       Navigation North
    88 Author URI:   https://www.navigationnorth.com
     
    1111 License URI:  https://www.gnu.org/licenses/gpl-3.0.html
    1212
    13  Copyright (C) 2018 Navigation North
     13 Copyright (C) 2019 Navigation North
    1414
    1515 This program is free software: you can redistribute it and/or modify
     
    3737define( 'OER_PLUGIN_NAME', 'WP OER Plugin' );
    3838define( 'OER_ADMIN_PLUGIN_NAME', 'WP OER Plugin');
    39 define( 'OER_VERSION', '0.6.7' );
     39define( 'OER_VERSION', '0.7.0' );
    4040
    4141include_once(OER_PATH.'includes/oer-functions.php');
     
    16231623add_action('wp_ajax_load_highlight', 'oer_load_highlight');
    16241624add_action('wp_ajax_nopriv_load_highlight', 'oer_load_highlight');
     1625
     1626add_action('wp_ajax_load_searched_standards', 'oer_load_searched_standards');
     1627function oer_load_searched_standards(){
     1628
     1629    $post_id = null;
     1630    $keyword = null;
     1631    $meta_key = "oer_standard";
     1632
     1633    if (isset($_POST['post_id'])){
     1634        $post_id = $_POST['post_id'];
     1635    }
     1636    if (isset($_POST['keyword'])){
     1637        $keyword = $_POST['keyword'];
     1638    }
     1639
     1640    if (!$post_id){
     1641        echo "Invalid Post ID";
     1642        die();
     1643    }
     1644
     1645    if (!$keyword){
     1646        was_selectable_admin_standards($post_id);
     1647        die();
     1648    }
     1649
     1650    if (function_exists('was_search_standards')){
     1651        was_search_standards($post_id,$keyword,$meta_key);
     1652    }
     1653    die();
     1654}
     1655
     1656add_action('wp_ajax_load_default_standards', 'oer_load_default_standards');
     1657function oer_load_default_standards(){
     1658    $post_id = null;
     1659
     1660    if (isset($_POST['post_id'])){
     1661        $post_id = $_POST['post_id'];
     1662    }
     1663
     1664    if (!$post_id){
     1665        echo "Invalid Post ID";
     1666        die();
     1667    }
     1668
     1669    if (function_exists('was_selectable_admin_standards')){
     1670        was_selectable_admin_standards($post_id);
     1671    }
     1672    die();
     1673}
    16251674
    16261675/** Parse Request **/
     
    22132262    }
    22142263} );
     2264
     2265/* Enqueue script and css for Gutenberg Resource block */
     2266function oer_enqueue_resource_block(){
     2267    wp_enqueue_script(
     2268        'resource-block-js',
     2269        OER_URL . "/js/oer_resource_block.build.js",
     2270        array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor', 'wp-api')
     2271    );
     2272    wp_enqueue_style(
     2273        'resource-block-css',
     2274        OER_URL . "/css/oer_resource_block.css",
     2275        array('wp-edit-blocks')
     2276    );
     2277    /* Register Block */
     2278    register_block_type('wp-oer-plugin/oer-resource-block', array(
     2279        'editor_script' => 'resource-block-js',
     2280        'editor_style' => 'resource-block-css'
     2281    ));
     2282}
     2283add_action('enqueue_block_editor_assets', 'oer_enqueue_resource_block');
     2284
     2285function oer_add_resources_rest_args() {
     2286    global $wp_post_types, $wp_taxonomies;
     2287
     2288    $wp_post_types['resource']->show_in_rest = true;
     2289    $wp_post_types['resource']->rest_base = 'resource';
     2290    $wp_post_types['resource']->rest_controller_class = 'WP_REST_Posts_Controller';
     2291
     2292    $wp_taxonomies['resource-subject-area']->show_in_rest = true;
     2293    $wp_taxonomies['resource-subject-area']->rest_base = 'resource-subject-area';
     2294    $wp_taxonomies['resource-subject-area']->rest_controller_class = 'WP_REST_Terms_Controller';
     2295}
     2296add_action( 'init', 'oer_add_resources_rest_args', 30 );
     2297
     2298function oer_add_meta_to_api() {
     2299    // Register Grade Levels to REST API
     2300    register_rest_field( 'resource',
     2301                'oer_grade',
     2302                array(
     2303                'get_callback' => 'oer_rest_get_meta_field',
     2304                'update_callback' => null,
     2305                'schema' => null
     2306                  ) );
     2307    // Register Resource URL to REST API
     2308    register_rest_field( 'resource',
     2309                'oer_resourceurl',
     2310                array(
     2311                'get_callback' => 'oer_rest_get_meta_field',
     2312                'update_callback' => null,
     2313                'schema' => null
     2314                  ) );
     2315    // Register Featured Image to REST API
     2316    register_rest_field( 'resource',
     2317            'fimg_url',
     2318            array(
     2319                'get_callback'    => 'oer_get_rest_featured_image',
     2320                'update_callback' => null,
     2321                'schema'          => null,
     2322            ) );
     2323
     2324}
     2325add_action( 'rest_api_init', 'oer_add_meta_to_api');
     2326
     2327function oer_rest_get_meta_field($resource, $field, $request){
     2328    if ($field=="oer_grade") {
     2329        $grades = trim(get_post_meta($resource['id'], $field, true),",");
     2330        $grades = explode(",",$grades);
     2331
     2332        return oer_grade_levels($grades);
     2333    } else
     2334        return get_post_meta($resource['id'], $field, true);
     2335}
     2336
     2337function oer_get_rest_featured_image($resource, $field, $request) {
     2338    if( $resource['featured_media'] ){
     2339        $img = wp_get_attachment_image_src( $resource['featured_media'], 'app-thumb' );
     2340        return $img[0];
     2341    }
     2342    return false;
     2343}
  • wp-oer/trunk/readme.txt

    r1983463 r2163735  
    11=== WP OER ===
    2 Contributors: navigationnorth, joehobson, johnpaulbalagolan, tomozaidem, arobotnamedchris
     2Contributors: navigationnorth, joehobson, johnpaulbalagolan, arobotnamedchris
    33Tags: OER, Open Educational Resources, Education, Learning
    44Requires at least: 4.4
    5 Tested up to: 4.9.8
    6 Stable tag: 0.6.7
     5Tested up to: 5.2.3
     6Stable tag: 0.7.0
    77License: GPLv3
    88License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    4242== Changelog ==
    4343
     44= 0.7.0 =
     45* Gutenberg blocks - updated for improved displaying OER
     46* Transcription field - transcripts can now be added on Resources, especially helpful for videos
     47* Sensitive Materials Warning field - Resources that have potentially sensitive content can now have written notices using this field
     48* Date Created Estimate field - Resources with no exact date of creation can use this field, which accepts plain text (e.g. "early 1900s")
     49* Format field - added field for storing information about the original format (physical or otherwise) of resources
     50* Local media files are now supported and can be selected as a Resource
     51* Standards are now optional and can be activated/deactivated using the new WP Academic Standards plugin (https://github.com/navnorth/wp-academic-standards)
     52* Labels of Metadata Fields can be customized using the Metadata Fields Options in the Settings
     53
    4454= 0.6.5 =
    4555* options for PDF display on resource view
    4656* pages to browse by Standard
    4757* preliminary support for Gutenberg editor
    48 
    4958
    5059= 0.6.1 =
Note: See TracChangeset for help on using the changeset viewer.