adding required field to the for sale title, fixing database creation script.
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 10 Nov 2017 18:35:31 +0000 (13:35 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 10 Nov 2017 18:35:31 +0000 (13:35 -0500)
fixing the posted date field, adding styles to the required field labels

classes/data/dataForSale.php
css/admin.css
css/admin.css.map
models/admin/management/itemsImport.php
scss/admin.scss
setup/databaseScripts/create_database_V0.0.1.sql
views/admin/forSale/edit.html

index deb85e3..ab5b1ac 100644 (file)
@@ -182,7 +182,7 @@ class GlmDataForSale extends GlmDataAbstract
             'post_date' => array (
                 'field' => 'post_date',
                 'type' => 'datetime',
-                'use' => 'lge'
+                'use' => 'a'
             ),
             'updated' => array (
                 'field' => 'updated',
index f0c1c51..3a51ba9 100644 (file)
@@ -1,3 +1,3 @@
-.for-sale-list-wrapper .glm-row{margin:0 !important}.for-sale-list-wrapper .admin-item-label,.for-sale-list-wrapper .admin-item-input,.for-sale-list-wrapper .admin-item-list{padding:6px 0px 6px 2px}.for-sale-list-wrapper .admin-item-label .admin-item-data,.for-sale-list-wrapper .admin-item-input .admin-item-data,.for-sale-list-wrapper .admin-item-list .admin-item-data{margin-bottom:0px !important}.for-sale-list-wrapper .admin-list-edit-item{padding:5px}.for-sale-list-wrapper .admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.for-sale-list-wrapper .admin-list-edit-items{margin:0 auto;float:none}}.for-sale-list-wrapper .itemTitle-record{float:left}.for-sale-list-wrapper .admin-new-item{margin-bottom:15px}.for-sale-list-wrapper .admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.for-sale-list-wrapper .no-padding{padding:0}.for-sale-list-wrapper .no-margin{margin:0}.for-sale-list-wrapper .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.for-sale-list-wrapper .item-company-list-header,.for-sale-list-wrapper .item-date-list-header,.for-sale-list-wrapper .item-title-list-header{font-weight:bold;font-size:16px}.for-sale-list-wrapper .admin-item-list-row:nth-child(odd){background:#e3e3e5}.for-sale-list-wrapper .item-image{display:block;max-width:200px}.for-sale-list-wrapper .item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
+.for-sale-list-wrapper .glm-row{margin:0 !important}.for-sale-list-wrapper .glm-required{color:red}.for-sale-list-wrapper .admin-item-label,.for-sale-list-wrapper .admin-item-input,.for-sale-list-wrapper .admin-item-list{padding:6px 0px 6px 2px}.for-sale-list-wrapper .admin-item-label .admin-item-data,.for-sale-list-wrapper .admin-item-input .admin-item-data,.for-sale-list-wrapper .admin-item-list .admin-item-data{margin-bottom:0px !important}.for-sale-list-wrapper .admin-list-edit-item{padding:5px}.for-sale-list-wrapper .admin-list-edit-items{position:absolute;right:0;max-width:100px;float:right}@media (max-width: 641px){.for-sale-list-wrapper .admin-list-edit-items{margin:0 auto;float:none}}.for-sale-list-wrapper .itemTitle-record{float:left}.for-sale-list-wrapper .admin-new-item{margin-bottom:15px}.for-sale-list-wrapper .admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.for-sale-list-wrapper .no-padding{padding:0}.for-sale-list-wrapper .no-margin{margin:0}.for-sale-list-wrapper .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.for-sale-list-wrapper .item-company-list-header,.for-sale-list-wrapper .item-date-list-header,.for-sale-list-wrapper .item-title-list-header{font-weight:bold;font-size:16px}.for-sale-list-wrapper .admin-item-list-row:nth-child(odd){background:#e3e3e5}.for-sale-list-wrapper .item-image{display:block;max-width:200px}.for-sale-list-wrapper .item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
 
 /*# sourceMappingURL=admin.css.map */
index d8116e4..a414064 100644 (file)
@@ -1 +1 @@
-{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".for-sale-list-wrapper{\n    .glm-row{\n        margin: 0 !important;\n    }\n\n    .admin-item-label,\n    .admin-item-input,\n    .admin-item-list{\n        padding: 6px 0px 6px 2px;\n        .admin-item-data{\n            margin-bottom: 0px !important;\n        }\n    }\n    .admin-list-edit-item{\n        // float: right;\n        padding: 5px;\n    }\n    .admin-list-edit-items{\n        position: absolute;\n        right: 0;\n        // top: 6px;\n        max-width: 100px;\n        float: right;\n        @media(max-width: 641px){\n            margin: 0 auto;\n            float: none;\n        }\n    }\n    .itemTitle-record{\n        float: left;\n    }\n    .admin-new-item{\n        margin-bottom: 15px;\n    }\n    .admin-new-item .admin-new-item-link{\n        padding: 5px;\n        background: #3D84D0;\n        color: white;\n        text-decoration: none;\n        border-radius: 4px;\n    }\n    .no-padding{\n        padding: 0;\n    }\n    .no-margin{\n        margin: 0;\n    }\n    .admin-item-list-header{\n        margin-bottom: 20px;\n        padding-bottom: 2px;\n        border-bottom: 1px solid lightgray;\n    }\n    .admin-item-list-row{\n        // padding-bottom: 5px;\n    /*    border-bottom: 1px solid lightgray;*/\n    }\n    .item-company-list-header,.item-date-list-header, .item-title-list-header{\n        font-weight: bold;\n        font-size: 16px;\n    }\n    .admin-item-list-row:nth-child(odd){\n        background: #e3e3e5;\n    }\n    .item-image{\n        display: block;\n        max-width: 200px;\n    }\n    .item-image-row{\n        border-bottom: 1px solid lightgray;\n        padding-bottom: 10px;\n    }\n}"],"names":[],"mappings":"AAAA,AACI,sBADkB,CAClB,QAAQ,AAAA,CACJ,MAAM,CAAE,YAAY,CACvB,AAHL,AAKI,sBALkB,CAKlB,iBAAiB,CALrB,AAMI,sBANkB,CAMlB,iBAAiB,CANrB,AAOI,sBAPkB,CAOlB,gBAAgB,AAAA,CACZ,OAAO,CAAE,eAAe,CAI3B,AAZL,AASQ,sBATc,CAKlB,iBAAiB,CAIb,gBAAgB,CATxB,AASQ,sBATc,CAMlB,iBAAiB,CAGb,gBAAgB,CATxB,AASQ,sBATc,CAOlB,gBAAgB,CAEZ,gBAAgB,AAAA,CACZ,aAAa,CAAE,cAAc,CAChC,AAXT,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,CAAE,OAAO,CACtB,AA9DL,AA+DI,sBA/DkB,CA+DlB,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACd,SAAS,CAAE,KAAK,CACnB,AAlEL,AAmEI,sBAnEkB,CAmElB,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
+{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":[".for-sale-list-wrapper{\n    .glm-row{\n        margin: 0 !important;\n    }\n    .glm-required{\n        color: red;\n    }\n    .admin-item-label,\n    .admin-item-input,\n    .admin-item-list{\n        padding: 6px 0px 6px 2px;\n        .admin-item-data{\n            margin-bottom: 0px !important;\n        }\n    }\n    .admin-list-edit-item{\n        // float: right;\n        padding: 5px;\n    }\n    .admin-list-edit-items{\n        position: absolute;\n        right: 0;\n        // top: 6px;\n        max-width: 100px;\n        float: right;\n        @media(max-width: 641px){\n            margin: 0 auto;\n            float: none;\n        }\n    }\n    .itemTitle-record{\n        float: left;\n    }\n    .admin-new-item{\n        margin-bottom: 15px;\n    }\n    .admin-new-item .admin-new-item-link{\n        padding: 5px;\n        background: #3D84D0;\n        color: white;\n        text-decoration: none;\n        border-radius: 4px;\n    }\n    .no-padding{\n        padding: 0;\n    }\n    .no-margin{\n        margin: 0;\n    }\n    .admin-item-list-header{\n        margin-bottom: 20px;\n        padding-bottom: 2px;\n        border-bottom: 1px solid lightgray;\n    }\n    .admin-item-list-row{\n        // padding-bottom: 5px;\n    /*    border-bottom: 1px solid lightgray;*/\n    }\n    .item-company-list-header,.item-date-list-header, .item-title-list-header{\n        font-weight: bold;\n        font-size: 16px;\n    }\n    .admin-item-list-row:nth-child(odd){\n        background: #e3e3e5;\n    }\n    .item-image{\n        display: block;\n        max-width: 200px;\n    }\n    .item-image-row{\n        border-bottom: 1px solid lightgray;\n        padding-bottom: 10px;\n    }\n}"],"names":[],"mappings":"AAAA,AACI,sBADkB,CAClB,QAAQ,AAAA,CACJ,MA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M,CAAE,CAAC,CACZ,AAhDL,AAiDI,sBAjDkB,CAiDlB,uBAAuB,AAAA,CACnB,aAAa,CAAE,IAAI,CACnB,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,mBAAmB,CACrC,AArDL,AA0DI,sBA1DkB,CA0DlB,yBAAyB,CA1D7B,AA0D8B,sBA1DR,CA0DQ,sBAAsB,CA1DpD,AA0DsD,sBA1DhC,CA0DgC,uBAAuB,AAAA,CACrE,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CAClB,AA7DL,AA8DI,sBA9DkB,CA8DlB,oBAAoB,AAAA,UAAW,CAAA,AAAA,GAAG,CAAC,CAC/B,UAAU,CAAE,OAAO,CACtB,AAhEL,AAiEI,sBAjEkB,CAiElB,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACd,SAAS,CAAE,KAAK,CACnB,AApEL,AAqEI,sBArEkB,CAqElB,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
index a6b0cb5..64293ab 100644 (file)
@@ -108,160 +108,139 @@ class GlmMembersAdmin_management_itemsImport
         }
 
         switch($option) {
-        case 'upload_file':
-            // We're given a CSV file.
-            // We need to parse it out. File must have header line.
-            // $file_data = $file_headers = $data = $members = array();
 
-            // if ( isset( $_FILES ) && isset( $_FILES['file_upload'] ) && ( $fh = fopen( $_FILES['file_upload']['tmp_name'], 'r' ) ) !== false ) {
-            //     $row = 0;
-            //     while( ( $data = fgetcsv( $fh, 1000, ',' ) ) !== false ) {
-            //         if ( $row === 0 ) {
-            //             // First row grab as headers.
-            //             $file_headers = $data;
-            //         } else {
-            //             // All other rows are data.
-            //             $file_data[] = array_combine( $file_headers, $data );
-            //         }
-            //         $row++;
-            //     }
-            //     fclose( $fh );
-            // }
-            // $resultMessage .= $this->importMemberData( $file_data );
-            //$resultMessage .= '<pre>$file_data: ' . print_r( $file_data, true ) . '</pre>';
-            break;
             
-        case 'importItems':
-            $table = GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX . 'items';
-            require_once GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php';
-            $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config);
-            
-            $img_src = "http://is0.gaslightmedia.com/migcsa/CKImage/";
+            case 'importItems':
+                $table = GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX . 'items';
+                require_once GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php';
+                $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config);
 
-            define('BASE_URL', 'http://www.migcsa.org');
-            define('PG_DSN', 'pgsql: host=ds4 dbname=migcsa2_update user=postgres');
-        
-            try {
-                $dsn = PG_DSN;
-                $driverOptions = array(
-                    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
-                );
-                $dbh = new PDO($dsn, null, null, $driverOptions);
-                $dbh->setAttribute(
-                    PDO::ATTR_ERRMODE,
-                    PDO::ERRMODE_EXCEPTION
-                );
-                
-                // FOR SALE
-                $forsale_sql = "SELECT * FROM forsale;";
-                $stmt = $dbh->query($forsale_sql);
-                $forsale = $stmt->fetchAll(PDO::FETCH_ASSOC);
-               $count = 0;
-                foreach($forsale as $key=>$value){
-                    
-                    $parts = false;
-                    $res = false;
-                    $image_1 = false;
-                    $image_2 = false;
-                    $image_3 = false;
-                    $post_exp = false;
+                $img_src = "http://is0.gaslightmedia.com/migcsa/CKImage/";
 
-                    // process the expiration values
-                    if( $value['post'] == "60days" ){
-                        $post_exp = 60;
-                    } else if( $value['post'] == "90days" ){
-                        $post_exp = 90;
-                    } else if( $value['post'] == "120days" ){
-                        $post_exp = 120;
-                    }
+                define('BASE_URL', 'http://www.migcsa.org');
+                define('PG_DSN', 'pgsql: host=ds4 dbname=migcsa2_update user=postgres');
 
-                    // check for images
-                    if($value['img'] !== ''){
-                        $res = $img_src . $value['img'];
-                        $parts = pathinfo($value['img']);
-                        if($parts['extension']){
-                            $image_1 = $ImageUpload->storeImage($res);
-                        } 
-                        
-                    }
-                    if($value['img2'] !== ''){
-                        $res = $img_src . $value['img2'];
-                        $parts = pathinfo($value['img2']);
-                        if($parts['extension']){
-                            $image_2 = $ImageUpload->storeImage($res);
-                        } 
-                    }
-                    if($value['img3'] !== ''){
-                        $res = $img_src . $value['img3'];
-                        $parts = pathinfo($value['img3']);
-                        if($parts['extension']){
-                            $image_3 = $ImageUpload->storeImage($res);
-                        } 
-                    }
-                    $this->wpdb->insert( $table,
-                        array(
-                            'old_id'            =>$value['id'],
-                            'title'             =>$value['title'],
-                            'topic'             =>$value['topicid'],
-                            'descr'             =>$value['descr'],
-                            'item_expiration'   =>$post_exp,
-                            'location'          =>$value['location'],
-                            'contact_email'     =>$value['contactemail'],
-                            'contact_name'      =>$value['contactname'],
-                            'contact_phone'     =>$value['contactphone'],
-                            'visible'           =>$value['visable'],
-                            'company'           =>$value['company'],
-                            'terms'             =>$value['terms'],
-                            'post_date'         =>$value['ds'],
-                            'updated'           =>$value['ds'],
-                            'member'            =>$value['member'],
-                            'image_1'           =>$image_1['newFileName'],
-                            'image_2'           =>$image_2['newFileName'],
-                            'image_3'           =>$image_3['newFileName'],
-                        ),
-                        array(
-                            '%d',
-                            '%s',
-                            '%d',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%s',
-                            '%d',
-                            '%s',
-                            '%s',
-                            '%s',
-                        )
+                try {
+                    $dsn = PG_DSN;
+                    $driverOptions = array(
+                        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
                     );
+                    $dbh = new PDO($dsn, null, null, $driverOptions);
+                    $dbh->setAttribute(
+                        PDO::ATTR_ERRMODE,
+                        PDO::ERRMODE_EXCEPTION
+                    );
+
+                    // FOR SALE
+                    $forsale_sql = "SELECT * FROM forsale;";
+                    $stmt = $dbh->query($forsale_sql);
+                    $forsale = $stmt->fetchAll(PDO::FETCH_ASSOC);
+                   $count = 0;
+                    foreach($forsale as $key=>$value){
+
+                        $parts = false;
+                        $res = false;
+                        $image_1 = false;
+                        $image_2 = false;
+                        $image_3 = false;
+                        $post_exp = false;
+
+                        // process the expiration values
+                        if( $value['post'] == "60days" ){
+                            $post_exp = 60;
+                        } else if( $value['post'] == "90days" ){
+                            $post_exp = 90;
+                        } else if( $value['post'] == "120days" ){
+                            $post_exp = 120;
+                        }
+
+                        // check for images
+                        if($value['img'] !== ''){
+                            $res = $img_src . $value['img'];
+                            $parts = pathinfo($value['img']);
+                            if($parts['extension']){
+                                $image_1 = $ImageUpload->storeImage($res);
+                            } 
+
+                        }
+                        if($value['img2'] !== ''){
+                            $res = $img_src . $value['img2'];
+                            $parts = pathinfo($value['img2']);
+                            if($parts['extension']){
+                                $image_2 = $ImageUpload->storeImage($res);
+                            } 
+                        }
+                        if($value['img3'] !== ''){
+                            $res = $img_src . $value['img3'];
+                            $parts = pathinfo($value['img3']);
+                            if($parts['extension']){
+                                $image_3 = $ImageUpload->storeImage($res);
+                            } 
+                        }
+                        $this->wpdb->insert( $table,
+                            array(
+                                'old_id'            =>$value['id'],
+                                'title'             =>$value['title'],
+                                'topic'             =>$value['topicid'],
+                                'descr'             =>$value['descr'],
+                                'item_expiration'   =>$post_exp,
+                                'location'          =>$value['location'],
+                                'contact_email'     =>$value['contactemail'],
+                                'contact_name'      =>$value['contactname'],
+                                'contact_phone'     =>$value['contactphone'],
+                                'visible'           =>$value['visable'],
+                                'company'           =>$value['company'],
+                                'terms'             =>$value['terms'],
+                                'post_date'         =>$value['ds'],
+                                'updated'           =>$value['ds'],
+                                'member'            =>$value['member'],
+                                'image_1'           =>$image_1['newFileName'],
+                                'image_2'           =>$image_2['newFileName'],
+                                'image_3'           =>$image_3['newFileName'],
+                            ),
+                            array(
+                                '%d',
+                                '%s',
+                                '%d',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%s',
+                                '%d',
+                                '%s',
+                                '%s',
+                                '%s',
+                            )
+                        );
+                    }
+
+                } catch(PDOException $e) {
+                    echo '<pre>'.print_r($e, true).'</pre>';           
                 }
-                
-            } catch(PDOException $e) {
-                echo '<pre>'.print_r($e, true).'</pre>';           
-            }
-            
-            if ( isset( $_REQUEST['start'] ) ) {
-                $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT );
-            } else {
-                $start = 0;
-            }
-            // global $wpdb;
-            
-            
-            $url = get_site_url() . '/wp-admin/admin.php?page=glm-members-admin-menu-management&glm_action=itemImport&option=importItems';
-            $limit = 200;
-            $resultMessage =  "<pre>Start: $start</pre>";
-            $start += $limit;
-            $resultMessage .= "<p><a class='next-import-btn' href=\"". $url . "&limit=$limit&start=$start\">Next</a></p>";
-            break;
-        default:
-            break;
+
+                if ( isset( $_REQUEST['start'] ) ) {
+                    $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT );
+                } else {
+                    $start = 0;
+                }
+                // global $wpdb;
+
+
+                $url = get_site_url() . '/wp-admin/admin.php?page=glm-members-admin-menu-management&glm_action=itemImport&option=importItems';
+                $limit = 200;
+                $resultMessage =  "<pre>Start: $start</pre>";
+                $start += $limit;
+                $resultMessage .= "<p><a class='next-import-btn' href=\"". $url . "&limit=$limit&start=$start\">Next</a></p>";
+                break;
+            default:
+                break;
         }
         $templateData = array(
             'success'       => $success,
index 4fe01fc..8c52029 100644 (file)
@@ -2,7 +2,9 @@
     .glm-row{
         margin: 0 !important;
     }
-
+    .glm-required{
+        color: red;
+    }
     .admin-item-label,
     .admin-item-input,
     .admin-item-list{
index 7e844d3..0707a52 100644 (file)
@@ -23,7 +23,7 @@ CREATE TABLE {prefix}items (
     contact_email TINYTEXT NULL ,
     contact_name TINYTEXT NULL ,
     contact_phone TINYTEXT NULL ,
-    post_date DATETIME NULL DEFAULT NOW(),
+    post_date DATETIME NULL,
     updated DATETIME NULL,
     visible BOOL NULL,
     terms TEXT NULL,
index 750b74f..8879187 100644 (file)
     {if $haveItem}
         <input type="hidden" name="option" value="update">
         <input type="hidden" name="item" value="{$item.fieldData.id}">
+        <input type="hidden" name="post_date" value="{$item.fieldData.updated.timestamp|date_format:'Y-m-d H:i:s'}">
     {else}
         <input type="hidden" name="option" value="insert">
+        <input type="hidden" name="post_date" value="{$smarty.now|date_format:'Y-m-d H:i:s'}">
     {/if}
 
         <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
         
         <!-- ITEM TITLE -->
         <div class="glm-item-row glm-row">
-            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label glm-required">
                 Item 
             </div>
             <div class="glm-small-12 glm-medium-8 glm-columns admin-item-input">
-                <input type="text" name="title" {if $item.fieldData.title} value='{$item.fieldData.title}' {/if}>
+                <input required type="text" name="title" {if $item.fieldData.title} value='{$item.fieldData.title}' {/if}>
             </div>
         </div>
         <!-- MEMBER for admins only-->